:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-2: #eef3f1;
  --ink: #151718;
  --muted: #66706c;
  --line: #dbe3df;
  --teal: #00ad9f;
  --teal-strong: #008a80;
  --blue: #2b6fe0;
  --red: #c43d4b;
  --amber: #b56a00;
  --shadow: 0 20px 45px rgba(15, 33, 33, 0.08);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(0, 173, 159, 0.09), rgba(255, 255, 255, 0) 260px),
    var(--bg);
}

body.auth-locked {
  overflow: hidden;
}

body.auth-locked .app-shell {
  display: none;
}

body:not(.auth-locked) .auth-screen {
  display: none;
}

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  grid-template-columns: minmax(300px, 0.95fr) minmax(360px, 520px);
  gap: clamp(28px, 5vw, 76px);
  align-items: center;
  padding: clamp(24px, 6vw, 72px);
  background:
    linear-gradient(135deg, rgba(0, 173, 159, 0.16), rgba(255, 255, 255, 0) 48%),
    linear-gradient(180deg, #f8fbfa, #edf4f2);
}

.auth-visual {
  display: grid;
  align-content: center;
  min-height: min(640px, 72vh);
  border: 1px solid rgba(0, 173, 159, 0.18);
  border-radius: 18px;
  padding: clamp(28px, 5vw, 64px);
  color: #071c1a;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(238, 248, 246, 0.74)),
    repeating-linear-gradient(90deg, rgba(0, 173, 159, 0.08) 0 1px, transparent 1px 44px);
  box-shadow: var(--shadow);
}

.auth-mark {
  display: grid;
  width: 66px;
  height: 66px;
  place-items: center;
  border-radius: 16px;
  color: #00211f;
  background: linear-gradient(135deg, #20e2cf, #9af2d0);
  font-size: 26px;
  font-weight: 900;
}

.auth-visual h1 {
  margin-top: 28px;
  max-width: 680px;
  font-size: clamp(42px, 6vw, 74px);
  line-height: 0.98;
}

.auth-visual p {
  margin-top: 18px;
  max-width: 560px;
  color: var(--muted);
  font-size: 19px;
}

.auth-card {
  display: grid;
  gap: 18px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: clamp(24px, 4vw, 38px);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 28px 70px rgba(17, 40, 38, 0.16);
}

.auth-card-heading {
  display: grid;
  gap: 7px;
  margin-bottom: 4px;
}

.auth-card-heading span {
  color: var(--teal-strong);
  font-size: 13px;
  font-weight: 800;
}

.auth-card-heading strong {
  font-size: 30px;
  line-height: 1.1;
}

.auth-message {
  min-height: 22px;
  color: var(--muted);
  font-size: 14px;
}

.auth-message.error {
  color: var(--red);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

a.secondary,
a.primary {
  text-decoration: none;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.is-disabled {
  opacity: 0.55;
  pointer-events: none;
}

.app-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: var(--radius);
  color: #031918;
  background: linear-gradient(135deg, #20e2cf, #95f0c7);
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span,
.hint,
.quiet,
.metric span,
.panel-heading span,
.empty-state p,
.meta {
  color: var(--muted);
}

.primary,
.secondary,
.danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: var(--radius);
  font-weight: 650;
  white-space: nowrap;
}

.primary {
  color: #001d1b;
  background: var(--teal);
}

.primary:hover {
  background: #18c6b8;
}

.secondary {
  color: var(--ink);
  border: 1px solid var(--line);
  background: var(--surface);
}

.secondary:hover {
  border-color: #b8c5c0;
}

.danger {
  color: #fff;
  background: var(--red);
}

.small {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

.full {
  width: 100%;
}

.icon-btn {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: var(--radius);
  color: var(--muted);
  background: transparent;
  font-size: 20px;
  line-height: 1;
}

.icon-btn:hover {
  color: var(--ink);
  background: var(--surface-2);
}

.side-section {
  display: grid;
  gap: 10px;
}

.side-actions {
  display: grid;
  gap: 8px;
}

.side-actions .secondary {
  width: 100%;
  min-width: 0;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.account-list {
  display: grid;
  gap: 8px;
}

.account-item {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 11px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: inherit;
  text-align: left;
  background: transparent;
}

.account-item:hover,
.account-item.active {
  border-color: var(--line);
  background: var(--surface);
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #9aa4a0;
}

.status-dot.ok {
  background: var(--teal-strong);
}

.status-dot.error {
  background: var(--red);
}

.status-dot.loading {
  background: var(--amber);
}

.account-name,
.site-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.account-meta {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace {
  display: grid;
  align-content: start;
  gap: 20px;
  padding: 28px;
}

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.1;
}

h2 {
  font-size: 18px;
}

.topbar p {
  margin-top: 8px;
  color: var(--muted);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 12px;
}

.metric {
  display: grid;
  gap: 7px;
  min-height: 86px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 10px 24px rgba(24, 38, 35, 0.04);
}

.metric strong {
  font-size: 28px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 220px 160px;
  gap: 12px;
  align-items: end;
}

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

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 12px;
  color: var(--ink);
  background: var(--surface);
  outline: none;
}

textarea {
  padding: 12px;
  resize: vertical;
}

.file-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 7px;
  background: var(--surface);
}

.file-label,
#deployFileLabel {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal-strong);
  box-shadow: 0 0 0 3px rgba(0, 173, 159, 0.18);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
}

.panel,
.detail-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

tr.selectable {
  cursor: pointer;
}

tr.selectable:hover td,
tr.selected td {
  background: #f1f8f6;
}

.site-cell {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.domain-line {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  color: #21403d;
  background: #dff6f1;
  font-size: 12px;
  font-weight: 800;
}

.pill.error {
  color: #7e1e29;
  background: #ffe1e5;
}

.pill.warn {
  color: #6d4100;
  background: #ffefd4;
}

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

.detail-panel {
  padding: 18px;
  align-self: start;
  position: sticky;
  top: 20px;
}

.detail-view {
  display: grid;
  gap: 16px;
}

.detail-title {
  display: grid;
  gap: 4px;
}

.detail-title h2 {
  overflow-wrap: anywhere;
}

.detail-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.detail-list div {
  display: grid;
  gap: 3px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.detail-list dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.detail-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.empty-state {
  display: grid;
  min-height: 260px;
  place-content: center;
  gap: 8px;
  text-align: center;
}

.dialog {
  width: min(520px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.dialog.wide {
  width: min(760px, calc(100vw - 28px));
}

.dialog::backdrop {
  background: rgba(9, 20, 19, 0.42);
}

.dialog form {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}

.check-row input {
  width: 18px;
  min-height: 18px;
}

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

.console-row {
  display: grid;
  grid-template-columns: 1fr 140px;
  gap: 12px;
}

.console-output {
  min-height: 170px;
  max-height: 360px;
  margin: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  color: #d7fff8;
  background: #10201f;
  white-space: pre-wrap;
}

.progress-box {
  min-height: 84px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  color: var(--muted);
  background: #f8fbfa;
  white-space: pre-wrap;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: min(440px, calc(100vw - 40px));
  padding: 13px 15px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow);
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: 160ms ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.front-body {
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(0, 173, 159, 0.12), rgba(255, 255, 255, 0) 320px),
    #f6f7f4;
}

.front-login {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(340px, 460px);
  gap: clamp(24px, 5vw, 64px);
  align-items: center;
  min-height: 100vh;
  padding: clamp(24px, 6vw, 76px);
}

.front-hero {
  display: grid;
  align-content: center;
  min-height: min(620px, 72vh);
  border-radius: 18px;
  padding: clamp(28px, 5vw, 64px);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(229, 246, 242, 0.72)),
    repeating-linear-gradient(90deg, rgba(0, 173, 159, 0.08) 0 1px, transparent 1px 46px);
  box-shadow: var(--shadow);
}

.front-hero h1 {
  margin-top: 26px;
  font-size: clamp(42px, 6vw, 72px);
  line-height: 1;
}

.front-hero p {
  margin-top: 16px;
  max-width: 560px;
  color: var(--muted);
  font-size: 18px;
}

.front-card {
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: clamp(24px, 4vw, 36px);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 28px 70px rgba(17, 40, 38, 0.14);
}

.front-card p {
  color: var(--muted);
}

.front-login-btn {
  min-height: 46px;
}

.front-dashboard {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.front-nav {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
}

.front-main {
  display: grid;
  align-content: start;
  gap: 20px;
  padding: 30px;
}

.front-profile-panel {
  overflow: hidden;
}

.front-profile {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 20px;
  padding: 20px;
  align-items: start;
}

.front-profile img {
  width: 92px;
  height: 92px;
  border-radius: 18px;
  object-fit: cover;
  background: var(--surface-2);
}

.is-hidden {
  display: none !important;
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 260px minmax(0, 1fr);
  }

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

  .detail-panel {
    position: static;
  }
}

@media (max-width: 820px) {
  .front-login,
  .front-dashboard {
    grid-template-columns: 1fr;
  }

  .front-nav {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .auth-screen {
    grid-template-columns: 1fr;
    align-content: center;
    overflow-y: auto;
  }

  .auth-visual {
    min-height: auto;
    padding: 24px;
  }

  .auth-visual h1 {
    font-size: 38px;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .workspace {
    padding: 20px;
  }

  .topbar {
    display: grid;
  }

  .side-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

  .search-wrap {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .front-login,
  .front-main,
  .front-nav {
    padding: 16px;
  }

  .front-hero {
    display: none;
  }

  .front-profile {
    grid-template-columns: 1fr;
  }

  .auth-screen {
    padding: 16px;
  }

  .auth-visual {
    display: none;
  }

  .workspace,
  .sidebar {
    padding: 16px;
  }

  h1 {
    font-size: 25px;
  }

  .metrics,
  .toolbar,
  .console-row {
    grid-template-columns: 1fr;
  }

  menu {
    width: 100%;
  }

  menu button {
    flex: 1;
  }

  .side-actions {
    grid-template-columns: 1fr;
  }
}
