:root {
  color-scheme: dark;
  --bg-top: #252a31;
  --bg-mid: #2d333b;
  --bg-bottom: #22272e;
  --panel: rgba(49, 56, 66, 0.95);
  --panel-soft: rgba(34, 39, 46, 0.56);
  --surface: rgba(58, 66, 77, 0.9);
  --surface-strong: rgba(67, 76, 88, 0.96);
  --field-bg: rgba(28, 33, 40, 0.92);
  --border: rgba(148, 163, 184, 0.16);
  --border-strong: rgba(250, 204, 21, 0.28);
  --text: #f5f7fa;
  --muted: #b4bfcc;
  --gold: #facc15;
  --gold-hover: #fde047;
  --shadow: 0 24px 70px rgba(15, 23, 42, 0.32);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  min-height: 100vh;
  font-family: Arial, sans-serif;
  background: linear-gradient(135deg, var(--bg-top), var(--bg-mid), var(--bg-bottom));
  color: var(--text);
}

a { color: inherit; }

.page-shell {
  width: min(1240px, calc(100% - 32px));
  margin: 22px auto 34px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.site-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 22px 26px;
  border-bottom: 1px solid var(--border);
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
}

.brand-logo {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  padding: 8px;
  background: radial-gradient(circle at 30% 10%, #ffffff 0, #fff6d4 32%, #f0c300 62%, #b58202 100%);
  box-shadow: 0 0 24px rgba(250, 204, 21, 0.28);
}

.brand-title { font-size: 22px; font-weight: bold; }
.brand-subtitle { font-size: 13px; color: var(--muted); }

.site-nav {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.nav-link {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  text-decoration: none;
  color: var(--muted);
  font-size: 14px;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text);
  border-color: rgba(250, 204, 21, 0.4);
  background: rgba(250, 204, 21, 0.08);
}

.site-user {
  display: flex;
  align-items: center;
  gap: 14px;
}

.site-user-meta { text-align: right; }
.site-user-name { font-size: 14px; font-weight: bold; }
.site-user-role { font-size: 12px; color: var(--muted); }

.page-body {
  padding: 24px 26px 28px;
}

.section {
  margin-top: 20px;
  padding: 20px;
  border-radius: 18px;
  background: var(--panel-soft);
  border: 1px solid var(--border);
}

.section:first-child { margin-top: 0; }

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.section-title { margin: 0; font-size: 18px; }
.section-copy, .muted { color: var(--muted); font-size: 13px; }
.error { color: #f87171; font-size: 13px; min-height: 18px; white-space: pre-wrap; }

.btn {
  padding: 12px 16px;
  border-radius: 10px;
  border: none;
  font-weight: bold;
  cursor: pointer;
}

.btn-gold { background: var(--gold); color: #111827; }
.btn-gold:hover { background: var(--gold-hover); }
.btn-secondary {
  background: #3b4450;
  color: var(--text);
  border: 1px solid rgba(148, 163, 184, 0.24);
}
.btn-secondary:hover { background: #4a5563; }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(148, 163, 184, 0.24);
}
.btn-ghost:hover { background: rgba(148, 163, 184, 0.12); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}

.stat-card, .tile-card {
  background: var(--surface);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 16px;
  padding: 16px;
}

.stat-label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.stat-value { font-size: 34px; font-weight: bold; line-height: 1.1; }
.stat-detail { margin-top: 10px; color: #d7dee8; font-size: 13px; line-height: 1.5; white-space: pre-wrap; }

.quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.tile-card h3 { margin: 0 0 8px; }
.tile-card p { margin: 0 0 14px; color: var(--muted); line-height: 1.5; }

.table-wrap { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
}
.table th, .table td {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  text-align: left;
  font-size: 14px;
}
.table th { color: var(--muted); font-weight: bold; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(250, 204, 21, 0.08);
  border: 1px solid rgba(250, 204, 21, 0.28);
  color: #fde68a;
  font-size: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}
.field { display: grid; gap: 8px; }
.field label { font-size: 13px; font-weight: bold; color: #d7dee8; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: var(--field-bg);
  color: var(--text);
}
.field textarea { min-height: 92px; resize: vertical; }

.search-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 18px;
}

.search-panel, .detail-panel {
  min-height: 420px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid rgba(148, 163, 184, 0.16);
  padding: 16px;
}

.search-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: var(--field-bg);
  color: var(--text);
  margin-bottom: 14px;
}

.client-list { display: grid; gap: 10px; max-height: 540px; overflow: auto; }
.client-item {
  width: 100%;
  text-align: left;
  padding: 14px;
  border-radius: 12px;
  background: var(--field-bg);
  border: 1px solid rgba(148, 163, 184, 0.18);
  color: var(--text);
}
.client-item:hover, .client-item.active {
  background: var(--surface-strong);
  border-color: rgba(250, 204, 21, 0.5);
}
.client-name { font-weight: bold; margin-bottom: 6px; }
.client-meta { font-size: 12px; color: var(--muted); line-height: 1.45; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.empty-state {
  min-height: 280px; display: flex; align-items: center; justify-content: center; text-align: center;
  color: var(--muted); padding: 24px; line-height: 1.6;
}

.login-shell {
  width: min(440px, calc(100% - 24px));
  margin: 60px auto;
}
.login-card {
  padding: 40px;
  border-radius: 22px;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  text-align: center;
}
.login-card h1 { margin: 0 0 10px; }
.login-card p { color: var(--muted); margin: 0 0 24px; }
.login-card input { margin-bottom: 12px; }
.login-link { display: block; margin-top: 16px; color: var(--muted); text-decoration: none; font-size: 12px; }

@media (max-width: 920px) {
  .site-header { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .site-user-meta { text-align: center; }
  .search-layout { grid-template-columns: 1fr; }
}


.brand-kicker {
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: #f8e08a;
  margin-bottom: 4px;
  font-weight: bold;
}
.brand-title {
  font-size: 24px;
  font-weight: bold;
  line-height: 1.15;
}
.brand-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}
.login-card .brand-kicker {
  justify-content: center;
  text-align: center;
}
.login-card h1 {
  margin: 0 0 8px;
  font-size: 28px;
}
.login-card p {
  color: var(--muted);
  margin: 0 0 24px;
  line-height: 1.5;
}
.field input:focus, .field select:focus, .field textarea:focus, .search-input:focus, .login-card input:focus {
  outline: none;
  border-color: rgba(250, 204, 21, 0.5);
  box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.12);
}
