:root {
  --ink: #132235;
  --muted: #728096;
  --muted-dark: #526176;
  --teal: #08a89d;
  --teal-dark: #087f79;
  --teal-soft: #e4f7f5;
  --blue: #2463eb;
  --line: #e3e9f0;
  --surface: #ffffff;
  --canvas: #f4f7fa;
  --shadow: 0 16px 40px rgba(24, 45, 74, 0.08);
  --shadow-soft: 0 8px 24px rgba(24, 45, 74, 0.06);
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

body { margin: 0; min-width: 0; background: var(--canvas); }

button, input, select { font: inherit; }
button { cursor: pointer; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

/* Login */
.login-page {
  display: grid;
  grid-template-columns: minmax(480px, 1fr) minmax(460px, 0.82fr);
  min-height: 100vh;
  background: #fff;
}

.login-aside {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 44px 60px 46px;
  color: #fff;
  background:
    radial-gradient(circle at 8% 92%, rgba(22, 188, 177, 0.4), transparent 31%),
    radial-gradient(circle at 86% 12%, rgba(54, 109, 232, 0.28), transparent 38%),
    linear-gradient(145deg, #0c2038 0%, #0c2b43 58%, #09394e 100%);
}

.login-aside::after {
  position: absolute;
  right: -150px;
  bottom: -190px;
  width: 500px;
  height: 500px;
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 50%;
  box-shadow: 0 0 0 40px rgba(255,255,255,0.025), 0 0 0 80px rgba(255,255,255,0.018);
  content: "";
}

.brand-lockup, .login-copy, .login-aside-footer { position: relative; z-index: 1; }

.brand-lockup { display: flex; align-items: center; gap: 12px; font-weight: 800; letter-spacing: -0.02em; }
.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 13px;
  color: #062c3e;
  background: var(--teal);
  box-shadow: 0 8px 24px rgba(8,168,157,.3);
  font-weight: 900;
}
.brand-name { font-size: 16px; }

.login-copy { max-width: 500px; margin: auto 0; }
.eyebrow { margin: 0 0 16px; color: var(--teal); font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.login-copy h1 { max-width: 490px; margin: 0; font-size: clamp(38px, 4.5vw, 68px); line-height: .98; letter-spacing: -.055em; }
.login-copy p { max-width: 460px; margin: 24px 0 0; color: rgba(255,255,255,.7); font-size: 16px; line-height: 1.65; }
.login-aside-footer { display: flex; gap: 16px; align-items: center; color: rgba(255,255,255,.55); font-size: 12px; }
.footer-dot { width: 7px; height: 7px; border-radius: 99px; background: var(--teal); }

.login-panel { display: grid; place-items: center; padding: 48px 70px; background: #fff; }
.login-card { width: min(100%, 430px); }
.login-card h2 { margin: 0; font-size: 32px; letter-spacing: -.035em; }
.login-card .subtitle { margin: 10px 0 34px; color: var(--muted); line-height: 1.55; }
.form-field { display: grid; gap: 8px; margin-top: 18px; }
.form-field label { color: var(--muted-dark); font-size: 12px; font-weight: 800; letter-spacing: .02em; }
.input-wrap { position: relative; }
.input-wrap input, .form-field input, .form-field select {
  width: 100%;
  height: 50px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: 0;
  padding: 0 15px;
  color: var(--ink);
  background: #fbfcfd;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.input-wrap input:focus, .form-field input:focus, .form-field select:focus { border-color: var(--teal); background: #fff; box-shadow: 0 0 0 4px rgba(8,168,157,.12); }
.password-toggle { position: absolute; top: 50%; right: 10px; transform: translateY(-50%); border: 0; padding: 6px 8px; color: var(--muted); background: transparent; font-size: 12px; }
.form-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 18px 0 24px; color: var(--muted); font-size: 12px; }
.checkbox-label { display: inline-flex; align-items: center; gap: 8px; }
.checkbox-label input { width: 15px; height: 15px; accent-color: var(--teal); }
.text-button { border: 0; padding: 0; color: var(--teal-dark); background: transparent; font-size: 12px; font-weight: 800; }
.primary-button, .secondary-button, .ghost-button, .danger-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 0 18px;
  font-weight: 800;
  transition: transform .2s, box-shadow .2s, background .2s, border-color .2s;
}
.primary-button { color: white; background: var(--teal); box-shadow: 0 8px 18px rgba(8,168,157,.18); }
.primary-button:hover { background: var(--teal-dark); transform: translateY(-1px); box-shadow: 0 12px 22px rgba(8,168,157,.24); }
.secondary-button { color: var(--ink); border-color: var(--line); background: #fff; }
.secondary-button:hover, .ghost-button:hover { border-color: #b9c6d4; background: #f8fafc; }
.ghost-button { color: var(--muted-dark); border-color: var(--line); background: #fff; }
.danger-button { color: #b52d3d; border-color: #f2c8ce; background: #fff7f8; }
.full-width { width: 100%; }
.form-error { min-height: 18px; margin: 14px 0 0; color: #c43d4e; font-size: 12px; }
.demo-box { margin-top: 28px; border: 1px solid #dcefea; border-radius: 14px; padding: 14px 16px; background: #f4fbfa; }
.demo-box strong { display: block; margin-bottom: 6px; color: var(--teal-dark); font-size: 12px; }
.demo-box p { margin: 0; color: var(--muted-dark); font-size: 11px; line-height: 1.55; }
.demo-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 11px; }
.demo-chip { border: 1px solid #cbe9e5; border-radius: 999px; padding: 7px 10px; color: var(--teal-dark); background: white; font-size: 11px; font-weight: 800; }

/* App */
.portal-layout { display: flex; min-height: 100vh; }
.sidebar { position: sticky; top: 0; display: flex; width: 258px; min-height: 100vh; flex-direction: column; border-right: 1px solid var(--line); padding: 28px 16px 20px; background: #fff; }
.sidebar .brand-lockup { padding: 0 12px 36px; }
.sidebar .brand-mark { width: 36px; height: 36px; border-radius: 11px; font-size: 13px; }
.sidebar .brand-name { color: var(--ink); }
.side-label { margin: 0 12px 10px; color: #9aa6b5; font-size: 10px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.nav-list { display: grid; gap: 4px; }
.nav-item { display: flex; width: 100%; align-items: center; gap: 11px; border: 0; border-radius: 10px; padding: 12px; color: var(--muted-dark); background: transparent; text-align: left; font-size: 13px; font-weight: 700; }
.nav-item:hover { background: #f4f8fa; color: var(--ink); }
.nav-item.active { color: var(--teal-dark); background: var(--teal-soft); }
.nav-icon { display: grid; width: 25px; height: 25px; place-items: center; border-radius: 7px; color: currentColor; background: rgba(8,168,157,.08); font-size: 14px; }
.sidebar-spacer { flex: 1; }
.sidebar-note { margin: 18px 8px; border: 1px solid #d8eee9; border-radius: 13px; padding: 14px; background: #f4fbfa; }
.sidebar-note strong { display: block; color: var(--teal-dark); font-size: 12px; }
.sidebar-note span { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.user-mini { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line); padding: 18px 8px 0; }
.avatar { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; border-radius: 10px; color: #fff; background: #1d63d8; font-size: 12px; font-weight: 900; }
.user-mini-copy { min-width: 0; }
.user-mini-copy strong, .user-mini-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-mini-copy strong { color: var(--ink); font-size: 12px; }
.user-mini-copy span { margin-top: 3px; color: var(--muted); font-size: 11px; }

.main-content { width: calc(100% - 258px); padding: 30px 42px 52px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 30px; margin-bottom: 38px; }
.breadcrumbs { color: var(--muted); font-size: 12px; }
.breadcrumbs strong { color: var(--ink); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.support-chip { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; color: var(--muted-dark); background: #fff; font-size: 11px; font-weight: 700; }
.support-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 4px var(--teal-soft); }
.logout-button { border: 0; color: var(--muted); background: transparent; font-size: 12px; font-weight: 800; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-heading h1 { margin: 0; font-size: 36px; letter-spacing: -.045em; }
.page-heading p { max-width: 600px; margin: 10px 0 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.heading-actions { display: flex; align-items: center; gap: 10px; }
.heading-actions select { min-height: 42px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; color: var(--muted-dark); background: #fff; font-size: 12px; font-weight: 700; }

.notice { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 28px; border: 1px solid #bce7e2; border-radius: 14px; padding: 16px 18px; color: var(--teal-dark); background: #f2fbfa; }
.notice-icon { display: grid; width: 24px; height: 24px; flex: 0 0 auto; place-items: center; border-radius: 50%; color: white; background: var(--teal); font-size: 13px; font-weight: 900; }
.notice strong { display: block; font-size: 13px; }
.notice span { display: block; margin-top: 4px; color: #4d7d7b; font-size: 12px; line-height: 1.45; }

.stat-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 30px; }
.stat-card { display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--line); border-radius: 15px; padding: 18px 20px; background: #fff; box-shadow: var(--shadow-soft); }
.stat-label { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; }
.stat-value { margin-top: 7px; color: var(--ink); font-size: 27px; font-weight: 850; letter-spacing: -.04em; }
.stat-icon { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 12px; color: var(--teal-dark); background: var(--teal-soft); font-size: 17px; }

.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-heading h2 { margin: 0; font-size: 17px; letter-spacing: -.02em; }
.section-heading span { color: var(--muted); font-size: 12px; }
.dashboard-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.dashboard-card { display: flex; min-height: 226px; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); padding: 19px; background: var(--surface); box-shadow: var(--shadow-soft); transition: transform .2s, box-shadow .2s, border-color .2s; }
.dashboard-card:hover { border-color: #bde5e1; box-shadow: var(--shadow); transform: translateY(-3px); }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.account-badge { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 13px; color: #0d5260; background: #dff6f4; font-size: 13px; font-weight: 900; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 6px 9px; color: #21845e; background: #eaf8f1; font-size: 10px; font-weight: 800; }
.status-pill::before { width: 6px; height: 6px; border-radius: 50%; background: currentColor; content: ""; }
.dashboard-card h3 { margin: 22px 0 6px; font-size: 17px; letter-spacing: -.025em; }
.dashboard-card p { min-height: 39px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.card-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 20px; }
.card-meta { color: var(--muted); font-size: 10px; }
.open-card { border: 0; color: var(--teal-dark); background: transparent; font-size: 12px; font-weight: 900; }
.open-card:hover { color: var(--ink); }
.empty-state { grid-column: 1 / -1; border: 1px dashed #cbd6e2; border-radius: 16px; padding: 42px; color: var(--muted); background: #fff; text-align: center; }

/* Account view */
.back-link { display: inline-flex; align-items: center; gap: 7px; margin-bottom: 18px; border: 0; padding: 0; color: var(--teal-dark); background: transparent; font-size: 12px; font-weight: 900; }
.account-hero { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 28px; border: 1px solid #ccebe7; border-radius: 18px; padding: 24px; background: linear-gradient(110deg, #effbf9, #ffffff 70%); }
.account-hero-left { display: flex; align-items: center; gap: 16px; }
.account-hero .account-badge { width: 56px; height: 56px; font-size: 17px; }
.account-hero h1 { margin: 0; font-size: 30px; letter-spacing: -.04em; }
.account-hero p { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.resource-list { display: grid; gap: 12px; }
.resource-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; border: 1px solid var(--line); border-radius: 15px; padding: 17px 19px; background: #fff; box-shadow: var(--shadow-soft); }
.resource-main { display: flex; align-items: center; gap: 13px; }
.resource-icon { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 11px; color: #3863bc; background: #edf2ff; font-size: 15px; font-weight: 900; }
.resource-main strong { display: block; font-size: 13px; }
.resource-main span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.resource-actions { display: flex; align-items: center; gap: 10px; }

/* Admin */
.admin-layout { display: grid; grid-template-columns: minmax(430px, .8fr) minmax(520px, 1.2fr); gap: 22px; align-items: start; }
.panel { border: 1px solid var(--line); border-radius: 17px; padding: 22px; background: #fff; box-shadow: var(--shadow-soft); }
.panel h2 { margin: 0; font-size: 18px; letter-spacing: -.025em; }
.panel-subtitle { margin: 8px 0 20px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.account-checkboxes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 9px; }
.account-checkbox { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 9px; padding: 10px; color: var(--muted-dark); background: #fafcfd; font-size: 11px; font-weight: 700; }
.account-checkbox:has(input:checked) { border-color: #b9e5e0; color: var(--teal-dark); background: var(--teal-soft); }
.account-checkbox input { accent-color: var(--teal); }
.selected-user-list { display: grid; gap: 10px; margin-top: 18px; }
.access-row { display: grid; grid-template-columns: minmax(0, 1.3fr) 90px minmax(120px, .8fr) auto; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 12px; padding: 12px 13px; }
.access-user { display: flex; align-items: center; gap: 9px; min-width: 0; }
.access-user .avatar { width: 30px; height: 30px; border-radius: 9px; font-size: 10px; }
.access-user strong, .access-user span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.access-user strong { font-size: 11px; }
.access-user span { margin-top: 2px; color: var(--muted); font-size: 10px; }
.role-tag, .account-tag { border-radius: 999px; padding: 6px 8px; text-align: center; font-size: 10px; font-weight: 800; }
.role-tag { color: #3469b4; background: #eef4ff; }
.account-tag { color: var(--muted-dark); background: #f1f4f7; }
.remove-access { border: 0; color: #ae5361; background: transparent; font-size: 11px; font-weight: 800; }

.modal-backdrop { position: fixed; inset: 0; z-index: 5; display: grid; place-items: center; padding: 24px; background: rgba(11, 31, 56, .48); backdrop-filter: blur(4px); }
.modal { width: min(100%, 480px); border-radius: 20px; padding: 25px; background: #fff; box-shadow: 0 28px 80px rgba(8, 28, 53, .24); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.modal h2 { margin: 0; font-size: 20px; letter-spacing: -.03em; }
.modal p { margin: 9px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.modal-close { border: 0; color: var(--muted); background: transparent; font-size: 20px; line-height: 1; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 24px; }

.toast-region { position: fixed; right: 28px; bottom: 24px; z-index: 10; display: grid; gap: 9px; }
.toast { min-width: 270px; max-width: 380px; border: 1px solid #ccebe7; border-radius: 12px; padding: 13px 15px; color: #1e655f; background: #effbf9; box-shadow: var(--shadow); font-size: 12px; font-weight: 700; animation: toast-in .2s ease-out; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 1180px) {
  .login-aside { padding-inline: 42px; }
  .login-panel { padding-inline: 44px; }
  .main-content { padding-inline: 28px; }
  .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  body { min-width: 0; }
  .login-page { grid-template-columns: 1fr; }
  .login-aside { min-height: 330px; padding: 30px 28px; }
  .login-copy { margin-top: 52px; }
  .login-copy h1 { max-width: 620px; font-size: 43px; }
  .login-copy p { max-width: 600px; }
  .login-aside-footer { margin-top: 40px; }
  .login-panel { padding: 42px 28px 55px; }
  .portal-layout { display: block; }
  .sidebar { position: static; width: 100%; min-height: 0; border-right: 0; border-bottom: 1px solid var(--line); padding: 14px 18px; }
  .sidebar .brand-lockup { padding: 0 0 14px; }
  .sidebar .nav-list { display: flex; gap: 5px; overflow-x: auto; }
  .sidebar .side-label, .sidebar-spacer, .sidebar-note, .user-mini { display: none; }
  .sidebar .nav-item { width: auto; white-space: nowrap; }
  .main-content { width: 100%; padding: 22px 22px 42px; }
  .topbar { margin-bottom: 28px; }
  .support-chip { display: none; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .heading-actions, .heading-actions select { width: 100%; }
  .stat-row, .dashboard-grid, .admin-layout { grid-template-columns: 1fr; }
  .account-hero { align-items: flex-start; flex-direction: column; }
  .access-row { grid-template-columns: 1fr auto; }
  .access-row .account-tag { text-align: left; }
}
