:root {
  color-scheme: light;
  --ink: #1d252c;
  --muted: #61707e;
  --line: #d9e0e6;
  --paper: #f7f8f6;
  --panel: #ffffff;
  --nav: #132d35;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --warning: #b45309;
  --danger: #b42318;
  --good: #15803d;
  --soft: #edf5f3;
  --shadow: 0 10px 28px rgba(25, 43, 54, 0.08);
  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;
  background: var(--paper);
  color: var(--ink);
}

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

button {
  border: 0;
  cursor: pointer;
}

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

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

.sidebar {
  background: var(--nav);
  color: white;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: grid;
  gap: 5px;
}

.brand strong {
  font-size: 19px;
  letter-spacing: 0;
}

.brand span,
.session span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav button {
  min-height: 42px;
  border-radius: 8px;
  padding: 0 12px;
  color: rgba(255, 255, 255, 0.8);
  background: transparent;
  text-align: left;
}

.nav button.active,
.nav button:hover {
  color: white;
  background: rgba(255, 255, 255, 0.12);
}

.session {
  margin-top: auto;
  display: grid;
  gap: 10px;
}

.ghost-dark {
  min-height: 38px;
  border-radius: 8px;
  color: white;
  background: rgba(255, 255, 255, 0.11);
}

.main {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  min-height: 72px;
  padding: 18px 26px;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 248, 246, 0.92);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.topbar p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.content {
  padding: 24px 26px 38px;
  display: grid;
  gap: 20px;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px;
  background: linear-gradient(135deg, #f7f8f6 0%, #eaf2ef 52%, #f6f2e9 100%);
}

.login-panel {
  width: min(100%, 430px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 26px;
  display: grid;
  gap: 18px;
}

.login-panel h1 {
  margin: 0;
  font-size: 28px;
}

.login-panel p {
  margin: 0;
  color: var(--muted);
}

.login-grid {
  display: grid;
  gap: 10px;
}

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

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow);
}

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

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 25px;
}

.band,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
  display: grid;
  gap: 16px;
}

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

.panel-header h2 {
  margin: 0;
  font-size: 18px;
}

.panel-header p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 18px;
  align-items: start;
}

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

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

.field {
  display: grid;
  gap: 6px;
}

.field.full {
  grid-column: 1 / -1;
}

label {
  color: #394650;
  font-weight: 650;
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cbd5dd;
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 10px 11px;
  min-height: 40px;
  outline: none;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
}

.primary,
.secondary,
.danger,
.text-button {
  min-height: 40px;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 700;
}

.primary {
  color: white;
  background: var(--accent);
}

.primary:hover {
  background: var(--accent-strong);
}

.secondary {
  color: var(--ink);
  background: #e9eef1;
}

.danger {
  color: white;
  background: var(--danger);
}

.text-button {
  color: var(--accent-strong);
  background: transparent;
  padding-inline: 8px;
}

.filters {
  display: grid;
  grid-template-columns: minmax(180px, 1.5fr) repeat(5, minmax(115px, 1fr));
  gap: 10px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
  background: white;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid #e7ecef;
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  color: #40505d;
  background: #f3f6f7;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
  white-space: nowrap;
}

tr:hover td {
  background: #fbfcfc;
}

.sortable {
  cursor: pointer;
}

.status,
.role {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 750;
  background: #e8eef2;
  color: #344653;
  white-space: nowrap;
}

.status.active,
.status.approved {
  background: #e6f4ea;
  color: #166534;
}

.status.pending,
.status.follow-up {
  background: #fff7ed;
  color: #9a3412;
}

.status.rejected,
.status.denied {
  background: #fee4e2;
  color: #991b1b;
}

.status.archived {
  background: #e5e7eb;
  color: #374151;
}

.status.new {
  background: #e0f2fe;
  color: #075985;
}

.status.won {
  background: #dcfce7;
  color: #166534;
}

.status.lost {
  background: #f3f4f6;
  color: #4b5563;
}

.notice {
  border: 1px solid #bfd8d2;
  background: var(--soft);
  color: #214841;
  border-radius: 8px;
  padding: 11px 13px;
  font-size: 14px;
}

.notice.error {
  border-color: #fecaca;
  background: #fff1f2;
  color: #991b1b;
}

.empty {
  color: var(--muted);
  padding: 22px;
  text-align: center;
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
}

.drawer.open {
  display: block;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.34);
}

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(620px, 100%);
  height: 100%;
  overflow: auto;
  background: white;
  padding: 22px;
  display: grid;
  align-content: start;
  gap: 18px;
  box-shadow: -18px 0 40px rgba(15, 23, 42, 0.18);
}

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

.kv {
  background: #f8fafb;
  border: 1px solid #e2e8ee;
  border-radius: 8px;
  padding: 10px;
}

.kv span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.kv strong {
  display: block;
  margin-top: 5px;
  overflow-wrap: anywhere;
}

.hidden {
  display: none !important;
}

@media (max-width: 1100px) {
  .metrics,
  .grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    padding: 16px;
  }

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

  .session {
    margin-top: 0;
  }

  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }

  .content {
    padding: 18px 16px 30px;
  }

  .metrics,
  .grid-2,
  .grid-3,
  .form-grid,
  .filters {
    grid-template-columns: 1fr;
  }
}
