:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-soft: #eef3f7;
  --text: #18202b;
  --muted: #667085;
  --line: #d9e1ea;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --danger: #b42318;
  --warning: #a15c07;
  --shadow: 0 16px 40px rgba(24, 32, 43, 0.08);
}

[data-theme="dark"] {
  --bg: #101418;
  --panel: #171d23;
  --panel-soft: #202832;
  --text: #edf2f7;
  --muted: #a5b2c1;
  --line: #2c3744;
  --accent: #2dd4bf;
  --accent-strong: #5eead4;
  --danger: #f97066;
  --warning: #fdb022;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
}

* { box-sizing: border-box; }

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

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

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

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

.client-shell {
  min-height: 100vh;
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 28px;
  display: grid;
  gap: 24px;
}

.client-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.client-topbar h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 44px);
}

.client-progress-panel {
  padding: 24px;
}

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

.client-task-list form,
.mock-stepper form {
  margin: 0;
}

.client-task-list label {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  cursor: pointer;
}

.client-task-list input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.client-task-list label.checked {
  border-color: rgba(34, 197, 94, 0.38);
  color: #15803d;
  background: rgba(34, 197, 94, 0.08);
}

.client-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

.client-application-review {
  display: grid;
  gap: 16px;
}

.client-application-form {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.sms-box {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(260px, auto);
  gap: 12px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.sms-box > div {
  display: grid;
  gap: 4px;
}

.sms-box span,
.sms-box small {
  color: var(--muted);
}

.sms-code-form {
  display: flex;
  gap: 8px;
}

.sms-code-form input {
  min-height: 40px;
  width: 120px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}

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

.document-upload {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.document-upload span {
  color: var(--muted);
}

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

.info-section {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.info-section h4 {
  margin: 0 0 8px;
}

.info-section ul {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 6px;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 32px;
}

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

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  color: #ffffff;
  background: var(--accent);
  font-weight: 800;
}

.brand small, .eyebrow, .muted, .list-row span, .list-row small {
  color: var(--muted);
}

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

.nav-list a, .sidebar-footer {
  border-radius: 8px;
  padding: 12px;
}

.nav-list a:hover {
  background: var(--panel-soft);
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  background: var(--panel-soft);
  color: var(--muted);
}

.main {
  padding: 24px;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.topbar h1, .login-copy h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 40px);
}

.eyebrow {
  margin: 0 0 4px;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 700;
}

.icon-button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

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

.metric {
  padding: 20px;
  display: grid;
  gap: 8px;
}

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

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

.content-grid, .two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.panel {
  padding: 20px;
  min-width: 0;
}

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

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

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

.panel-header a {
  color: var(--accent);
  font-weight: 700;
}

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

.list-stack, .timeline {
  display: grid;
  gap: 12px;
}

.list-row, .timeline > div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.status-strip span {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--panel-soft);
}

.form-grid, .inline-form {
  display: grid;
  gap: 16px;
}

.inline-form {
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  align-items: end;
  margin-bottom: 16px;
}

.compact {
  margin-bottom: 16px;
}

.field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
  font-size: 14px;
}

.field input, .field select, .field textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  padding: 10px 12px;
}

.field input[type="checkbox"] {
  width: 20px;
  min-height: 20px;
}

.field small {
  color: var(--muted);
  font-weight: 500;
}

.field-error {
  color: var(--danger);
}

.primary-button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  color: #ffffff;
  background: var(--accent);
  font-weight: 800;
  cursor: pointer;
}

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

.secondary-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--text);
  background: var(--panel-soft);
  font-weight: 800;
  cursor: pointer;
}

.secondary-button:hover {
  border-color: var(--accent);
}

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

.osk-application-form .field:nth-of-type(1),
.osk-application-form .field:nth-of-type(4),
.osk-application-form .field:nth-of-type(5),
.osk-application-form .application-submit {
  grid-column: 1 / -1;
}

.application-submit {
  background: var(--danger);
}

.workflow-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  max-width: 520px;
}

.workflow-step {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.workflow-step.done {
  border-color: rgba(34, 197, 94, 0.35);
  color: #15803d;
}

.workflow-step.current {
  border-color: rgba(37, 99, 235, 0.45);
  color: var(--accent);
  background: rgba(37, 99, 235, 0.08);
}

.workflow-step.pending {
  opacity: 0.72;
}

.mock-process-layout {
  display: grid;
  grid-template-columns: minmax(220px, 0.45fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.mock-stepper {
  display: grid;
  gap: 8px;
}

.mock-step {
  width: 100%;
  display: grid;
  grid-template-columns: 32px 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--muted);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.mock-step span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--panel);
  font-weight: 900;
}

.mock-step.done {
  border-color: rgba(34, 197, 94, 0.36);
  color: #15803d;
}

.mock-step.current {
  border-color: rgba(37, 99, 235, 0.5);
  color: var(--accent);
  background: rgba(37, 99, 235, 0.08);
}

.mock-step.selected {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.mock-current-step {
  display: grid;
  gap: 12px;
}

.mock-current-step h3 {
  margin: 0;
  font-size: 22px;
}

.mock-current-step p {
  margin: 0;
  color: var(--muted);
}

.mock-checklist {
  display: grid;
  gap: 8px;
  margin: 4px 0;
  padding-left: 20px;
}

.mock-checklist li {
  line-height: 1.45;
}

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

.crm-alert-card {
  display: grid;
  grid-template-columns: minmax(180px, 0.7fr) minmax(180px, 0.55fr) minmax(260px, 1fr);
  gap: 16px;
  padding: 14px;
  border: 1px solid rgba(37, 99, 235, 0.28);
  border-radius: 8px;
  background: rgba(37, 99, 235, 0.07);
}

.crm-alert-card > div {
  display: grid;
  gap: 5px;
}

.crm-alert-card small {
  color: var(--muted);
  font-weight: 900;
  text-transform: uppercase;
}

.crm-alert-card span,
.crm-alert-card p {
  margin: 0;
  color: var(--muted);
}

.call-script {
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  font-weight: 700;
}

.call-script.urgent {
  border-left-color: var(--danger);
  background: rgba(239, 68, 68, 0.08);
}

.osk-status-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.status-pill {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 900;
}

.status-pill.ok {
  border-color: rgba(34, 197, 94, 0.34);
  color: #15803d;
  background: rgba(34, 197, 94, 0.08);
}

.status-pill.warn {
  border-color: rgba(245, 158, 11, 0.38);
  color: #a16207;
  background: rgba(245, 158, 11, 0.09);
}

.status-pill.danger {
  border-color: rgba(239, 68, 68, 0.34);
  color: #b91c1c;
  background: rgba(239, 68, 68, 0.08);
}

.calendar-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(280px, 0.55fr);
  gap: 24px;
  align-items: start;
}

.calendar-board {
  padding: 22px;
  border: 1px solid #203327;
  border-radius: 8px;
  background: #111d17;
  color: #eef8f0;
  box-shadow: 0 18px 42px rgba(6, 16, 11, 0.3);
}

.calendar-top {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  margin-bottom: 18px;
}

.calendar-top h2 {
  margin: 0;
  text-align: center;
  font-size: 18px;
  font-weight: 900;
}

.calendar-arrow {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  color: #8fa097;
  font-size: 30px;
  line-height: 1;
}

.calendar-arrow:hover {
  background: #1a2a21;
  color: #f5fff7;
}

.calendar-weekdays,
.calendar-month {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.calendar-weekdays {
  margin-bottom: 8px;
}

.calendar-weekdays span {
  min-height: 24px;
  display: grid;
  place-items: center;
  color: #91a198;
  font-size: 14px;
  font-weight: 800;
}

.calendar-day {
  position: relative;
  min-height: 68px;
  aspect-ratio: 0.94;
  padding: 9px 8px;
  border: 1px solid #263b2d;
  border-radius: 8px;
  background: #172b1f;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
  overflow: hidden;
}

.calendar-day.is-muted {
  color: rgba(238, 248, 240, 0.22);
  background: #13231a;
}

.calendar-day.is-selected {
  border-color: #2fee72;
  box-shadow: 0 0 0 2px rgba(47, 238, 114, 0.24), inset 0 0 0 1px rgba(47, 238, 114, 0.35);
}

.calendar-number {
  position: relative;
  z-index: 1;
  display: inline-grid;
  min-width: 20px;
  min-height: 20px;
  place-items: center;
  font-size: 16px;
  font-weight: 900;
}

.calendar-day.is-today .calendar-number {
  border-radius: 999px;
  outline: 1px solid rgba(47, 238, 114, 0.85);
  outline-offset: 2px;
}

.calendar-events {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  display: grid;
  gap: 3px;
}

.calendar-event {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  color: #c4d3c9;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  white-space: nowrap;
}

.calendar-event span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calendar-dot {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  border-radius: 50%;
  background: #28ed64;
  box-shadow: 0 0 12px rgba(40, 237, 100, 0.55);
}

.calendar-more {
  justify-self: start;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(47, 238, 114, 0.18);
  color: #aef7c3;
  font-size: 10px;
  font-weight: 900;
}

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

.calendar-list-panel {
  margin-top: 24px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

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

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

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.details {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 12px;
}

.details dt {
  color: var(--muted);
  font-weight: 700;
}

.messages, .warning-stack {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.message {
  padding: 12px;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.message.error { color: var(--danger); }
.message.success { color: var(--accent); }
.message.warning { color: var(--warning); }

.kanban {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 16px;
  overflow-x: auto;
}

.kanban > div {
  min-height: 160px;
  padding: 12px;
  border-radius: 8px;
  background: var(--panel-soft);
}

.kanban h3 {
  margin: 0 0 12px;
  font-size: 14px;
}

.kanban p {
  display: grid;
  gap: 4px;
  margin: 0 0 8px;
  padding: 10px;
  border-radius: 8px;
  background: var(--panel);
}

.kanban p span {
  color: var(--muted);
  font-size: 12px;
}

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

.login-layout {
  width: min(1040px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 24px;
  align-items: stretch;
}

.login-copy, .auth-panel {
  padding: 32px;
}

.login-copy {
  display: grid;
  align-content: center;
  gap: 20px;
}

.login-copy p {
  max-width: 640px;
  color: var(--muted);
  line-height: 1.6;
}

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

.login-points span {
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--panel-soft);
  font-weight: 800;
}

.auth-panel h2 {
  margin-top: 0;
}

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

  .sidebar {
    position: fixed;
    z-index: 20;
    inset: 0 auto 0 0;
    width: min(320px, 88vw);
    transform: translateX(-100%);
    transition: transform 180ms ease;
  }

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

  .metric-grid,
  .content-grid,
  .two-column,
  .login-layout,
  .calendar-layout,
  .mock-process-layout,
  .osk-application-form,
  .crm-alert-card,
  .sms-box,
  .document-grid,
  .info-section-grid {
    grid-template-columns: 1fr;
  }

  .inline-form {
    grid-template-columns: 1fr;
  }
}

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

  .topbar {
    align-items: flex-start;
  }

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

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

  .calendar-board {
    padding: 14px;
  }

  .calendar-weekdays,
  .calendar-month {
    gap: 4px;
  }

  .calendar-day {
    min-height: 54px;
    padding: 7px 6px;
  }

  .calendar-events {
    left: 6px;
    right: 6px;
    bottom: 6px;
  }

  .calendar-event span:last-child {
    display: none;
  }
}
