:root {
  --navy: #17345c;
  --navy-deep: #102843;
  --blue: #246aa5;
  --teal: #2f8d84;
  --teal-soft: #e8f6f3;
  --sky: #eef7fc;
  --ink: #243247;
  --muted: #66758a;
  --line: #dbe6ee;
  --surface: #ffffff;
  --canvas: #f5f8fb;
  --warning: #8a5a0a;
  --warning-bg: #fff8e8;
  --danger: #a12b38;
  --danger-bg: #fff0f2;
  --success: #216b5c;
  --success-bg: #eaf7f3;
  --shadow: 0 20px 55px rgba(23, 52, 92, .13);
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--blue); text-underline-offset: 3px; }
[hidden] { display: none !important; }

.loading-screen,
.configuration-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  text-align: center;
}

.loading-screen { align-content: center; gap: 16px; color: var(--muted); }

.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid var(--line);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--navy);
  font-weight: 850;
  letter-spacing: -.02em;
  text-decoration: none;
}

.brand-lockup.light { color: #fff; }

.brand-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, var(--blue), var(--teal));
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .14);
}

.configuration-card {
  width: min(620px, 100%);
  padding: clamp(28px, 6vw, 54px);
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.configuration-card h1 {
  margin: 22px 0 12px;
  color: var(--navy);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.05;
  letter-spacing: -.035em;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--teal);
  font-size: .74rem;
  font-weight: 850;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.eyebrow.light-text { color: #a9ddd5; }

.notice {
  margin: 22px 0;
  padding: 16px 18px;
  border-radius: 10px;
  font-size: .92rem;
}

.notice strong { display: block; margin-bottom: 2px; }
.notice.warning { color: var(--warning); background: var(--warning-bg); border: 1px solid #ecd8ad; }

.button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.button:hover { transform: translateY(-1px); }
.button:focus-visible, button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid rgba(36, 106, 165, .28); outline-offset: 2px; }
.button.primary { color: #fff; background: var(--navy); box-shadow: 0 9px 22px rgba(23, 52, 92, .18); }
.button.primary:hover { background: #214774; }
.button.full { width: 100%; }
.button:disabled { opacity: .6; cursor: wait; transform: none; }

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(370px, .88fr) minmax(500px, 1.12fr);
  background: #fff;
}

.auth-story {
  position: sticky;
  top: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(34px, 6vw, 76px);
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 20% 80%, rgba(55, 154, 143, .45), transparent 35%),
    radial-gradient(circle at 85% 8%, rgba(75, 150, 198, .28), transparent 30%),
    var(--navy-deep);
}

.auth-story::after {
  content: "";
  position: absolute;
  right: -120px;
  bottom: 120px;
  width: 320px;
  height: 320px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 50%;
  box-shadow: 0 0 0 55px rgba(255,255,255,.035), 0 0 0 110px rgba(255,255,255,.025);
}

.story-copy { position: relative; z-index: 1; max-width: 540px; }
.story-copy h1 { margin: 0 0 22px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.8rem, 5vw, 5rem); line-height: 1; letter-spacing: -.045em; }
.story-copy > p:last-child { max-width: 500px; color: #cfdeeb; font-size: 1.08rem; }

.privacy-note {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 5px;
  padding: 17px 18px;
  color: #dce8f1;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  font-size: .86rem;
}

.privacy-note strong { color: #fff; }

.auth-main {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px clamp(24px, 6vw, 96px) 24px;
  background: #fff;
}

.mobile-brand { display: none; margin-bottom: 42px; align-self: flex-start; }

.auth-panel { width: min(500px, 100%); }
.auth-panel h2 { margin: 0; color: var(--navy); font-family: Georgia, "Times New Roman", serif; font-size: clamp(2rem, 4vw, 2.75rem); letter-spacing: -.035em; line-height: 1.08; }
.intro { margin: 12px 0 26px; color: var(--muted); }

.field { display: grid; gap: 7px; margin-bottom: 18px; }
.field label, fieldset legend { color: var(--ink); font-size: .9rem; font-weight: 750; }
.field input, .field select {
  width: 100%;
  min-height: 48px;
  padding: 11px 13px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #bfcdda;
  border-radius: 8px;
}
.field input:hover, .field select:hover { border-color: #8ca2b7; }
.field input:focus, .field select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(36,106,165,.1); outline: none; }
.field-help { color: var(--muted); font-size: .8rem; }
.label-row { display: flex; justify-content: space-between; gap: 18px; align-items: baseline; }
.label-row a { font-size: .84rem; font-weight: 700; }

.password-field { position: relative; }
.password-field input { padding-right: 68px; }
.password-toggle { position: absolute; top: 50%; right: 8px; transform: translateY(-50%); padding: 7px 8px; color: var(--blue); background: transparent; border: 0; border-radius: 5px; font-size: .78rem; font-weight: 800; cursor: pointer; }

.two-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.account-types { display: grid; gap: 10px; margin: 0 0 20px; padding: 0; border: 0; }
.account-types legend { margin-bottom: 8px; }
.choice-card { display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start; padding: 14px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.choice-card:has(input:checked) { background: var(--sky); border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
.choice-card input { margin-top: 4px; accent-color: var(--blue); }
.choice-card span { display: grid; gap: 2px; }
.choice-card small { color: var(--muted); line-height: 1.4; }

.check-row { display: grid; grid-template-columns: 20px 1fr; gap: 9px; align-items: start; margin: 4px 0 20px; color: var(--muted); font-size: .82rem; cursor: pointer; }
.check-row input { margin-top: 4px; accent-color: var(--teal); }
.switch-view { margin: 22px 0 0; color: var(--muted); text-align: center; font-size: .9rem; }

.form-message { margin-bottom: 18px; padding: 13px 14px; border-radius: 8px; font-size: .87rem; }
.form-message.error { color: var(--danger); background: var(--danger-bg); border: 1px solid #f0c3c9; }
.form-message.success { color: var(--success); background: var(--success-bg); border: 1px solid #bfe0d7; }

.auth-footer { margin-top: auto; padding-top: 38px; color: #8996a7; font-size: .75rem; }

.dashboard-shell { min-height: 100vh; display: grid; grid-template-columns: 260px 1fr; }
.dashboard-sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 28px 20px 22px; color: #fff; background: var(--navy-deep); }
.dashboard-nav { display: grid; gap: 5px; margin-top: 42px; }
.dashboard-nav button { display: grid; grid-template-columns: 26px 1fr; gap: 9px; align-items: center; width: 100%; padding: 11px 12px; color: #cbd9e6; background: transparent; border: 0; border-radius: 8px; text-align: left; cursor: pointer; }
.dashboard-nav button:hover, .dashboard-nav button.active { color: #fff; background: rgba(255,255,255,.1); }
.dashboard-nav button span { color: #8fc8c2; font-size: 1.05rem; text-align: center; }
.sidebar-safety { display: grid; gap: 3px; margin-top: auto; padding: 13px; color: #c8d7e5; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1); border-radius: 9px; font-size: .74rem; }
.sidebar-safety strong { color: #fff; }

.dashboard-frame { min-width: 0; }
.dashboard-header { min-height: 76px; display: flex; align-items: center; gap: 14px; padding: 12px clamp(20px, 4vw, 48px); background: #fff; border-bottom: 1px solid var(--line); }
.header-label { margin: 0; color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .09em; }
.menu-button { display: none; background: transparent; border: 0; font-size: 1.25rem; cursor: pointer; }
.account-menu { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.avatar { width: 38px; height: 38px; display: grid; place-items: center; color: #fff; background: linear-gradient(145deg, var(--blue), var(--teal)); border-radius: 50%; font-size: .78rem; font-weight: 800; }
.account-summary { display: grid; line-height: 1.25; }
.account-summary strong { font-size: .86rem; }
.account-summary small { color: var(--muted); font-size: .73rem; }
.text-button { padding: 7px 9px; color: var(--blue); background: transparent; border: 0; border-radius: 6px; font-size: .8rem; font-weight: 800; cursor: pointer; }

.dashboard-content { padding: clamp(24px, 5vw, 54px); }
.welcome { display: flex; justify-content: space-between; gap: 28px; align-items: start; margin-bottom: 32px; }
.welcome h1, .content-heading h1 { margin: 0; color: var(--navy); font-family: Georgia, "Times New Roman", serif; font-size: clamp(2rem, 4vw, 3.2rem); letter-spacing: -.04em; line-height: 1.08; }
.welcome p, .content-heading p { max-width: 680px; margin: 10px 0 0; color: var(--muted); }
.status-pill { padding: 7px 11px; color: var(--success); background: var(--success-bg); border: 1px solid #c2e3da; border-radius: 999px; font-size: .75rem; font-weight: 800; white-space: nowrap; }
.safety-banner { display: flex; gap: 12px; margin-bottom: 24px; padding: 16px 18px; color: var(--warning); background: var(--warning-bg); border: 1px solid #edd8aa; border-radius: 11px; }
.safety-banner strong { display: block; }
.safety-banner p { margin: 2px 0 0; font-size: .85rem; }
.dashboard-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 17px; }
.dashboard-card { min-height: 168px; padding: 22px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 8px 28px rgba(23,52,92,.055); }
.card-icon { width: 38px; height: 38px; display: grid; place-items: center; color: var(--teal); background: var(--teal-soft); border-radius: 10px; font-weight: 900; }
.dashboard-card h2 { margin: 16px 0 5px; color: var(--navy); font-size: 1rem; }
.dashboard-card p { margin: 0; color: var(--muted); font-size: .84rem; }
.dashboard-card button { margin-top: 16px; padding: 0; color: var(--blue); background: transparent; border: 0; font-weight: 800; font-size: .8rem; cursor: pointer; }
.empty-panel { margin-top: 24px; padding: 42px 24px; text-align: center; background: #fff; border: 1px dashed #b9c9d6; border-radius: 14px; }
.empty-panel h2 { margin: 0 0 7px; color: var(--navy); }
.empty-panel p { max-width: 560px; margin: 0 auto; color: var(--muted); }
.profile-card { max-width: 680px; margin-top: 26px; padding: 24px; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.profile-list { display: grid; grid-template-columns: 150px 1fr; gap: 14px; margin: 0; }
.profile-list dt { color: var(--muted); }
.profile-list dd { margin: 0; font-weight: 700; }
.admin-panel { margin-top: 24px; padding: 24px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 8px 28px rgba(23,52,92,.04); }
.admin-panel h2 { margin: 0 0 18px; color: var(--navy); font-size: 1.1rem; }
.admin-form { max-width: 760px; }
.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: .83rem; }
.admin-table th, .admin-table td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.admin-table th { color: var(--muted); background: #f7fafc; font-size: .74rem; letter-spacing: .03em; text-transform: uppercase; }
.admin-table td small { color: var(--muted); }
.admin-actions { display: flex; flex-wrap: wrap; gap: 7px; min-width: 150px; }
.admin-actions button { padding: 6px 9px; color: var(--blue); background: #fff; border: 1px solid #b9c9d6; border-radius: 6px; font-size: .74rem; font-weight: 800; cursor: pointer; }
.admin-actions button:hover { background: var(--sky); }
.admin-actions button:disabled { opacity: .55; cursor: wait; }
.admin-empty { margin: 0; color: var(--muted); }
.audit-list { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.audit-item { display: grid; grid-template-columns: minmax(150px, .8fr) minmax(180px, 1.4fr) auto; gap: 12px; padding: 11px 13px; background: #fff; font-size: .8rem; }
.audit-item strong { text-transform: capitalize; }
.audit-item span, .audit-item time { color: var(--muted); }

@media (max-width: 960px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-story { display: none; }
  .mobile-brand { display: inline-flex; }
  .auth-main { justify-content: flex-start; }
  .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .dashboard-shell { grid-template-columns: 1fr; }
  .dashboard-sidebar { position: fixed; z-index: 20; left: 0; width: 260px; transform: translateX(-105%); transition: transform .2s ease; box-shadow: var(--shadow); }
  .dashboard-shell.nav-open .dashboard-sidebar { transform: translateX(0); }
  .menu-button { display: inline-block; }
  .account-summary { display: none; }
}

@media (max-width: 560px) {
  .auth-main { padding: 28px 18px 20px; }
  .two-fields, .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-header { padding-inline: 14px; }
  .text-button { padding-inline: 3px; }
  .dashboard-content { padding: 24px 16px; }
  .welcome { display: grid; }
  .status-pill { justify-self: start; }
  .profile-list { grid-template-columns: 1fr; gap: 2px; }
  .profile-list dd { margin-bottom: 12px; }
  .admin-panel { padding: 18px 14px; }
  .audit-item { grid-template-columns: 1fr; gap: 3px; }
}
