:root {
  --font-body: Manrope, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --bg: #eff5fb;
  --surface: rgba(255, 255, 255, 0.94);
  --surface-soft: #f8fbff;
  --surface-muted: #edf4fb;
  --line: #d7e2ee;
  --line-strong: #c5d6e8;
  --text: #0f172a;
  --text-soft: #6b7b8d;
  --brand: #16c7b8;
  --brand-strong: #0fb6a8;
  --brand-soft: rgba(22, 199, 184, 0.14);
  --navy: #133a5e;
  --navy-strong: #102f4d;
  --navy-deep: #081d31;
  --accent-sky: #2d9bf0;
  --accent-gold: #f2b64a;
  --accent-coral: #f56f5b;
  --accent-violet: #7f68ff;
  --danger: #c7425f;
  --warning: #b88218;
  --success: #0d9f74;
  --shadow: 0 22px 50px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.38;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(45, 155, 240, 0.11), transparent 28%),
    radial-gradient(circle at top right, rgba(127, 104, 255, 0.09), transparent 24%),
    radial-gradient(circle at bottom left, rgba(22, 199, 184, 0.08), transparent 28%),
    linear-gradient(180deg, #f8fbff 0%, #eef4fb 100%);
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.login-card {
  width: min(430px, 100%);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 251, 255, 0.94));
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.brand-login,
.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-login {
  margin-bottom: 24px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #ffffff 0%, #eefaff 45%, #edf2ff 100%);
  color: var(--navy-strong);
  font-family: var(--font-display);
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(4, 12, 22, 0.22);
}

.brand-login strong,
.brand-copy strong {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
}

.brand-login span span,
.brand-copy small {
  display: block;
  color: var(--text-soft);
  font-size: 0.82rem;
}

.stack-form {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
  color: var(--text-soft);
  font-size: 0.82rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid rgba(18, 58, 89, 0.14);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  padding: 8px 11px;
  outline: none;
}

input:focus,
select:focus {
  border-color: rgba(8, 184, 168, 0.42);
  box-shadow: 0 0 0 4px rgba(18, 214, 197, 0.12);
}

.btn,
.icon-btn {
  border: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(245, 250, 255, 0.9));
  color: var(--text);
  border-radius: 12px;
  min-height: 34px;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}

.btn {
  padding: 8px 13px;
}

.btn:hover,
.icon-btn:hover,
.nav-item:hover {
  transform: translateY(-1px);
}

.btn-primary {
  border-color: transparent;
  color: #ffffff;
  background: linear-gradient(135deg, var(--brand-strong) 0%, var(--accent-sky) 100%);
  box-shadow: 0 14px 30px rgba(45, 155, 240, 0.2);
}

.btn-secondary {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(244, 249, 255, 0.92));
  border-color: rgba(18, 58, 89, 0.08);
}

.btn-quiet {
  background: rgba(255, 255, 255, 0.58);
  border-color: rgba(18, 58, 89, 0.08);
}

.btn-sm {
  padding: 5px 10px;
  border-radius: 10px;
  font-size: 0.78rem;
  min-height: 30px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
}

.form-error {
  margin: 0;
  color: var(--danger);
  background: rgba(199, 66, 95, 0.08);
  border: 1px solid rgba(199, 66, 95, 0.18);
  border-radius: 12px;
  padding: 10px 12px;
}

.app-shell {
  min-height: 100vh;
  display: block;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 220px;
  min-height: 100vh;
  padding: 16px 12px 12px;
  background:
    radial-gradient(circle at top left, rgba(81, 178, 255, 0.14), transparent 28%),
    radial-gradient(circle at bottom left, rgba(36, 209, 192, 0.12), transparent 30%),
    linear-gradient(180deg, #163d63 0%, #102d4a 54%, #0b2238 100%);
  color: #edf5fc;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  z-index: 30;
}

.sidebar .brand-mark {
  box-shadow: 0 10px 24px rgba(4, 12, 22, 0.28);
}

.brand-copy strong {
  color: #ffffff;
  font-size: 0.9rem;
}

.brand-copy small {
  color: rgba(237, 245, 252, 0.7);
}

.sidebar-context {
  padding: 9px 11px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-context strong {
  color: #ffffff;
  font-size: 1rem;
}

.sidebar-context span {
  color: rgba(237, 245, 252, 0.82);
  font-size: 0.76rem;
  font-weight: 600;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1 1 auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  border: 0;
  padding: 9px 11px;
  border-radius: 12px;
  background: transparent;
  color: rgba(237, 245, 252, 0.78);
  font-weight: 700;
  font-size: 0.88rem;
  text-align: left;
  transition: transform 0.18s ease, background 0.18s ease;
}

.nav-item:hover {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.09), rgba(81, 178, 255, 0.12));
  color: #ffffff;
}

.nav-item.is-active {
  background: linear-gradient(135deg, rgba(22, 199, 184, 0.22), rgba(81, 178, 255, 0.2));
  color: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1), 0 12px 24px rgba(5, 17, 28, 0.2);
}

.nav-item.is-utility {
  margin-top: auto;
}

.nav-icon {
  display: inline-flex;
  flex: 0 0 18px;
}

.content-shell {
  min-height: 100vh;
  width: min(calc(100vw - 220px), 1380px);
  margin: 0 auto 0 220px;
  padding: 14px 16px 22px;
  display: grid;
  gap: 12px;
  align-content: start;
}

.topbar {
  position: sticky;
  top: 12px;
  z-index: 26;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(18, 58, 89, 0.08);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(247, 251, 255, 0.92));
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.06);
  backdrop-filter: blur(12px);
}

.topbar-copy {
  min-width: 0;
  margin-right: auto;
}

.eyebrow {
  margin: 0;
  color: #93a1b2;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.68rem;
  font-weight: 800;
}

.topbar h1,
.panel-head h2,
.detail-head h2 {
  margin: 0;
  font-family: var(--font-display);
  color: var(--text);
}

.topbar h1 {
  font-size: 1.32rem;
  line-height: 1.1;
}

.topbar-tools,
.panel-actions,
.control-block {
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 10px 6px 6px;
  border: 1px solid rgba(18, 58, 89, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
}

.profile-avatar {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: linear-gradient(135deg, var(--navy), var(--accent-sky));
  font-weight: 900;
}

.profile-copy {
  display: grid;
  line-height: 1.1;
}

.profile-copy small {
  color: var(--text-soft);
  font-size: 0.72rem;
}

.mobile-nav-btn {
  display: none;
}

.page-shell,
.page-stack {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.page-grid {
  display: grid;
  gap: 12px;
}

.page-grid.two-up {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.wide-panel {
  grid-column: 1 / -1;
}

.surface-panel {
  min-width: 0;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(248, 251, 255, 0.92));
  border-radius: 18px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.05);
  padding: 14px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-head h2 {
  font-size: 1rem;
  font-weight: 700;
}

.count-pill {
  display: inline-flex;
  min-width: 30px;
  justify-content: center;
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--surface-muted);
  color: var(--text-soft);
  font-weight: 900;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border: 1px solid rgba(18, 58, 89, 0.08);
  border-radius: 16px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.48);
}

.metric-strip div {
  min-height: 88px;
  padding: 14px;
  border-right: 1px solid rgba(18, 58, 89, 0.08);
  display: grid;
  align-content: center;
  gap: 5px;
}

.metric-strip div:last-child {
  border-right: 0;
}

.metric-strip strong {
  font-size: 1.45rem;
  font-family: var(--font-display);
}

.metric-strip span {
  color: var(--text-soft);
  font-weight: 700;
}

.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 25px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 0.72rem;
  font-weight: 900;
  white-space: nowrap;
}

.status.ok {
  background: rgba(13, 159, 116, 0.12);
  color: var(--success);
}

.status.off,
.status.muted {
  background: rgba(107, 123, 141, 0.12);
  color: #64748b;
}

.status.warn {
  background: rgba(242, 182, 74, 0.18);
  color: var(--warning);
}

.status.bad {
  background: rgba(199, 66, 95, 0.12);
  color: var(--danger);
}

.client-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.client-list-panel {
  position: sticky;
  top: 84px;
}

.client-list,
.list-stack,
.activity-list {
  display: grid;
  gap: 7px;
}

.client-list {
  margin-top: 10px;
  max-height: calc(100vh - 220px);
  overflow: auto;
}

.client-row,
.inline-row {
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 10px;
}

.client-row:hover,
.client-row.is-active,
.inline-row:hover {
  background: rgba(19, 58, 94, 0.05);
  border-color: rgba(18, 58, 89, 0.08);
}

.client-row strong,
.inline-row strong,
.mini-project strong,
.service-row strong {
  display: block;
  overflow-wrap: anywhere;
}

.client-row small,
.inline-row small,
.mini-project small,
.service-row small {
  display: block;
  margin-top: 2px;
  color: var(--text-soft);
  overflow-wrap: anywhere;
}

.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.detail-head h2 {
  font-size: 1.42rem;
}

.domains,
.domain-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.domains {
  margin-top: 9px;
}

.domain-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--brand-soft);
  color: var(--navy);
  font-weight: 800;
  font-size: 0.78rem;
}

.switch {
  display: inline-block;
  position: relative;
  width: 58px;
  height: 32px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch span {
  position: absolute;
  inset: 0;
  background: #c5ccd8;
  border-radius: 999px;
  transition: background 160ms ease;
}

.switch span::before {
  content: "";
  position: absolute;
  width: 24px;
  height: 24px;
  left: 4px;
  top: 4px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.2);
  transition: transform 160ms ease;
}

.switch input:checked + span {
  background: var(--success);
}

.switch input:checked + span::before {
  transform: translateX(26px);
}

.switch input:disabled + span {
  opacity: 0.55;
  cursor: not-allowed;
}

.service-table,
.table,
.file-table {
  display: grid;
  margin-top: 12px;
  border: 1px solid rgba(18, 58, 89, 0.08);
  border-radius: 16px;
  overflow: hidden;
}

.service-row,
.table-row,
.file-row {
  display: grid;
  gap: 12px;
  align-items: center;
  min-height: 58px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(18, 58, 89, 0.08);
}

.service-row {
  grid-template-columns: minmax(140px, 1.1fr) minmax(140px, 1fr) minmax(120px, 0.8fr) minmax(130px, 1fr) 76px;
}

.table-row {
  grid-template-columns: minmax(180px, 1.2fr) minmax(260px, 1.7fr) 110px 110px;
}

.audit-table .table-row {
  grid-template-columns: 190px 130px 150px minmax(180px, 1fr) 90px;
}

.file-row {
  grid-template-columns: minmax(240px, 1fr) 190px 100px 110px;
}

.service-row:last-child,
.table-row:last-child,
.file-row:last-child {
  border-bottom: 0;
}

.service-header,
.table-head,
.file-head {
  min-height: 40px;
  background: rgba(237, 244, 251, 0.72);
  color: var(--text-soft);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.mono {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.mini-project {
  min-width: 0;
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid rgba(18, 58, 89, 0.08);
  padding: 8px 2px;
}

.files-panel {
  min-height: calc(100vh - 118px);
  position: relative;
}

.files-panel.is-dragging {
  outline: 3px solid rgba(22, 199, 184, 0.28);
  outline-offset: 4px;
}

.file-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.breadcrumbs {
  display: flex;
  gap: 6px;
  align-items: center;
  overflow-x: auto;
}

.breadcrumbs button {
  border: 1px solid rgba(18, 58, 89, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  padding: 6px 10px;
  color: var(--navy);
  font-weight: 800;
  white-space: nowrap;
}

.file-name {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.file-name svg {
  flex: 0 0 18px;
  color: var(--accent-sky);
}

.upload-progress {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(18, 58, 89, 0.08);
  border-radius: 14px;
  padding: 10px;
  margin-bottom: 10px;
  background: rgba(255, 255, 255, 0.7);
}

.upload-progress div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.progress-track {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-muted);
  overflow: hidden;
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--brand-strong), var(--accent-sky));
}

.log-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) 150px;
  gap: 8px;
  margin-bottom: 10px;
}

.log-output {
  height: calc(100vh - 230px);
  min-height: 430px;
  margin: 0;
  padding: 14px;
  overflow: auto;
  background: #08111b;
  color: #e6fff9;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.78rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.activity-row {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(18, 58, 89, 0.08);
}

.activity-row:last-child {
  border-bottom: 0;
}

.activity-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--success);
}

.activity-dot.bad {
  background: var(--danger);
}

.activity-row time {
  color: var(--text-soft);
  font-size: 0.76rem;
  white-space: nowrap;
}

.definition-list {
  display: grid;
  border: 1px solid rgba(18, 58, 89, 0.08);
  border-radius: 16px;
  overflow: hidden;
}

.definition-list div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border-bottom: 1px solid rgba(18, 58, 89, 0.08);
}

.definition-list div:last-child {
  border-bottom: 0;
}

.definition-list span {
  color: var(--text-soft);
  font-weight: 700;
}

.empty-state,
.muted-text {
  color: var(--text-soft);
}

.empty-state {
  padding: 14px;
}

.mobile-sidebar-backdrop {
  display: none;
}

@media (max-height: 820px) {
  .sidebar {
    padding: 10px;
    gap: 8px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }

  .nav-item {
    padding: 7px 10px;
  }
}

@media (max-width: 1180px) {
  .page-grid.two-up,
  .project-grid {
    grid-template-columns: 1fr;
  }

  .client-layout {
    grid-template-columns: 280px minmax(0, 1fr);
  }
}

@media (max-width: 880px) {
  .mobile-nav-btn {
    display: grid;
  }

  .sidebar {
    transform: translateX(-104%);
    transition: transform 0.2s ease;
  }

  body.mobile-sidebar-open .sidebar {
    transform: translateX(0);
  }

  body.mobile-sidebar-open .mobile-sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(8, 17, 27, 0.42);
    z-index: 24;
  }

  .content-shell {
    width: 100%;
    margin-left: 0;
    padding: 10px;
  }

  .topbar {
    top: 8px;
  }

  .topbar-tools {
    gap: 6px;
  }

  .profile-chip,
  #logoutBtn {
    display: none;
  }

  .client-layout,
  .metric-strip,
  .file-toolbar,
  .log-controls {
    grid-template-columns: 1fr;
  }

  .client-list-panel {
    position: static;
  }

  .client-list {
    max-height: 360px;
  }

  .detail-head,
  .control-block,
  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .service-row,
  .table-row,
  .audit-table .table-row,
  .file-row {
    grid-template-columns: 1fr;
  }

  .service-header,
  .table-head,
  .file-head {
    display: none;
  }

  .metric-strip div {
    border-right: 0;
    border-bottom: 1px solid rgba(18, 58, 89, 0.08);
  }

  .metric-strip div:last-child {
    border-bottom: 0;
  }
}
