:root {
  --ink: #0c2347;
  --muted: #65758d;
  --line: #dce2ea;
  --soft: #f3f6fa;
  --panel: #ffffff;
  --blue: #4f80ff;
  --blue-dark: #3159dc;
  --green: #7bf0cb;
  --pink: #ff6b9d;
  --warning: #ffb84d;
  --shadow: 0 20px 60px rgba(26, 45, 79, 0.10);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #fafbfd;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1380px, calc(100vw - 64px));
  margin: 32px auto 56px;
}

.auth-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(560px, 100%);
  display: grid;
  gap: 18px;
  border: 1px solid #d6dce6;
  border-radius: 8px;
  background: white;
  padding: 34px;
  box-shadow: var(--shadow);
}

.auth-card input {
  min-height: 46px;
  border: 1px solid #c8d0db;
  border-radius: 4px;
  background: white;
  color: #3d4756;
  padding: 0 14px;
}

.auth-card .primary-action {
  justify-self: start;
}

.auth-brand {
  font-size: 30px;
  margin-bottom: 8px;
}

.form-error {
  border: 1px solid #ffd1df;
  border-radius: 6px;
  background: #fff2f6;
  color: #b32656;
  margin: 0;
  padding: 12px 14px;
  font-weight: 700;
}

.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 28px;
  min-height: 56px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #253052;
  font-size: 34px;
  font-weight: 700;
  text-decoration: none;
}

.brand-mark {
  width: 31px;
  height: 31px;
  display: inline-block;
  border: 4px solid #253052;
  border-radius: 5px;
  transform: rotate(-15deg);
  box-shadow: -7px 7px 0 -3px #253052;
}

.main-nav {
  display: flex;
  justify-content: center;
  gap: 26px;
}

.main-nav a {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  text-transform: uppercase;
}

.main-nav a.active {
  color: var(--ink);
}

.primary-action {
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, #5864ff, #4b95ff);
  color: white;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .04em;
  min-height: 46px;
  padding: 0 26px;
  text-transform: uppercase;
  box-shadow: 0 16px 26px rgba(79, 128, 255, .25);
}

.top-icons {
  display: flex;
  gap: 10px;
  align-items: center;
}

.icon-button {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.icon-button:hover {
  background: var(--soft);
  color: var(--ink);
}

.profile-button {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: var(--soft);
  padding: 0;
  overflow: hidden;
}

.profile-button img {
  width: 100%;
  height: 100%;
  display: block;
}

.hero-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin: 44px 0 30px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.05;
}

.server-health {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.server-health span {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  padding: 0 16px;
  color: var(--muted);
}

.server-health b {
  color: var(--ink);
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 22px;
  align-items: center;
  background: var(--soft);
  border-radius: 4px;
  min-height: 60px;
  padding: 10px 22px;
}

.tabs {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.tabs button {
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
}

.tabs button.active {
  color: var(--blue);
}

.search-wrap {
  display: flex;
  gap: 10px;
}

.search-wrap select,
.search-wrap input,
dialog input,
dialog select {
  min-height: 44px;
  border: 1px solid #c8d0db;
  border-radius: 4px;
  background: white;
  color: #3d4756;
  padding: 0 14px;
}

.search-wrap input {
  width: min(360px, 34vw);
}

.dashboard-view {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 24px;
  margin-top: 28px;
  align-items: start;
}

.site-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 18px;
}

.site-card {
  border: 1px solid #d6dce6;
  border-radius: 4px;
  background: white;
  box-shadow: 0 10px 26px rgba(24, 39, 75, .08);
  overflow: hidden;
}

.empty-state {
  grid-column: 1 / -1;
  border: 1px dashed #c8d0db;
  border-radius: 8px;
  background: white;
  padding: 34px;
  color: var(--muted);
}

.empty-state h2 {
  margin-bottom: 8px;
  color: var(--ink);
}

.empty-state p {
  margin-bottom: 0;
}

.site-preview {
  height: 154px;
  position: relative;
  background: var(--preview);
  overflow: hidden;
}

.site-preview::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(255,255,255,.18), rgba(255,255,255,.18)),
    repeating-linear-gradient(90deg, transparent 0 28px, rgba(255,255,255,.22) 29px 30px);
}

.site-preview img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: top center;
}

.site-preview:has(img)::after {
  display: none;
}

.site-body {
  padding: 18px;
}

.site-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.state-dot {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #c8ffec;
  color: #18b987;
  font-size: 14px;
  font-weight: 900;
}

.state-dot.maintenance {
  background: #fff2ce;
  color: #c98200;
}

.site-card h3 {
  margin: 0;
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 22px;
}

.access-badge {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  font-size: 15px;
}

.access-badge.open,
.access-pill.open {
  background: #edf8f2;
  color: #16845f;
}

.access-badge.locked,
.access-pill.locked {
  background: #fff0d5;
  color: #a46600;
}

.site-domain {
  display: block;
  margin: 12px 0 16px 32px;
  color: #2587ff;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.site-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  padding: 7px 10px;
}

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}

.card-actions button,
.secondary-button {
  border: 0;
  border-radius: 4px;
  background: #e9edf3;
  color: #5f7088;
  font-size: 12px;
  font-weight: 900;
  min-height: 34px;
  padding: 0 14px;
  text-transform: uppercase;
}

.activity-panel,
.info-card,
.domain-card,
.modal-card,
.user-card {
  border: 1px solid #d6dce6;
  border-radius: 6px;
  background: white;
  box-shadow: 0 8px 24px rgba(24, 39, 75, .06);
}

.activity-panel {
  padding: 18px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-heading h2 {
  margin: 0;
  font-size: 22px;
}

.panel-heading span {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--soft);
  color: var(--muted);
  font-weight: 800;
}

.task-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.task-item {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.task-item strong {
  display: block;
  margin-bottom: 4px;
}

.task-item span {
  color: var(--muted);
  font-size: 13px;
}

.hidden {
  display: none !important;
}

.detail-view {
  margin-top: 28px;
}

.team-head {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  margin-bottom: 22px;
}

.team-head h1 {
  margin: 0;
}

.user-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 16px;
}

.user-card {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 16px;
  align-items: center;
  padding: 18px;
}

.user-card img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
}

.user-card h3 {
  margin: 0 0 4px;
}

.user-card a {
  display: inline-block;
  color: #2587ff;
  margin-bottom: 12px;
  text-decoration: none;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  margin-bottom: 24px;
  border-radius: 4px;
  background: var(--soft);
  padding: 0 26px;
  color: var(--muted);
  font-weight: 900;
  text-transform: uppercase;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr);
  gap: 18px;
}

.hero-card {
  border: 1px solid #d6dce6;
  border-radius: 5px;
  overflow: hidden;
  background: white;
}

.hero-card .site-preview {
  height: 290px;
}

.hero-summary {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 26px;
}

.hero-summary h2 {
  margin: 0 0 8px;
  font-size: 28px;
}

.quick-actions {
  display: flex;
  gap: 8px;
  align-items: start;
  flex-wrap: wrap;
}

.domain-card,
.info-card {
  padding: 22px;
}

.domain-card {
  margin-top: 18px;
}

.edit-grid {
  display: grid;
  grid-template-columns: 1.2fr .8fr .8fr .8fr auto;
  align-items: end;
  gap: 14px;
}

.edit-grid input,
.edit-grid select {
  min-height: 42px;
  border: 1px solid #c8d0db;
  border-radius: 4px;
  background: white;
  color: #3d4756;
  padding: 0 12px;
}

.edit-actions {
  display: flex;
  align-items: end;
  min-height: 42px;
}

.domain-line {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  border-bottom: 1px dashed var(--line);
}

.domain-line a {
  color: #2587ff;
  text-decoration: none;
}

.side-stack {
  display: grid;
  gap: 16px;
}

.usage-bar {
  height: 20px;
  border: 1px solid #46d4b3;
  border-radius: 4px;
  background: linear-gradient(90deg, #ff6b9d var(--used), #d8fff2 var(--used));
  margin: 8px 0;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 12px 0;
}

.metric-row:first-of-type {
  border-top: 0;
}

.metric-row span {
  color: var(--muted);
}

.ssl-active {
  color: #18a978;
  font-weight: 900;
}

.ssl-pending {
  color: #c98200;
  font-weight: 900;
}

.ssl-missing {
  color: #e14678;
  font-weight: 900;
}

.ssl-expired,
.ssl-unknown {
  color: #c98200;
  font-weight: 900;
}

dialog {
  width: min(720px, calc(100vw - 32px));
  border: 0;
  padding: 0;
  background: transparent;
}

dialog::backdrop {
  background: rgba(13, 24, 45, .32);
  backdrop-filter: blur(2px);
}

.modal-card {
  display: grid;
  gap: 16px;
  padding: 24px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: start;
}

.modal-head h2 {
  margin: 0;
  font-size: 28px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.checks {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

.checks label {
  display: flex;
  align-items: center;
  gap: 8px;
}

menu {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin: 0;
  padding: 0;
}

menu button:not(.primary-action) {
  border: 1px solid #c8d0db;
  border-radius: 8px;
  background: white;
  min-height: 46px;
  padding: 0 20px;
  color: var(--muted);
  font-weight: 800;
}

@media (max-width: 1120px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .main-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
  }

  .top-icons {
    display: none;
  }

  .dashboard-view,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .site-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 24px, 1380px);
    margin-top: 18px;
  }

  .brand {
    font-size: 27px;
  }

  .primary-action {
    padding: 0 14px;
  }

  .hero-row,
  .toolbar,
  .hero-summary {
    display: grid;
  }

  .toolbar {
    grid-template-columns: 1fr;
  }

  .search-wrap {
    display: grid;
  }

  .search-wrap input {
    width: 100%;
  }

  .site-grid,
  .form-grid,
  .edit-grid,
  .user-grid {
    grid-template-columns: 1fr;
  }

  .hero-card .site-preview {
    height: 190px;
  }
}
