:root {
  --sidebar-width: 292px;
  --sidebar-collapsed-width: 92px;
  --sidebar-bg: #0b1730;
  --sidebar-bg-2: #102952;
  --sidebar-accent: #4f7cff;
  --sidebar-accent-soft: rgba(102, 145, 255, .18);
  --page-bg: #f3f6fb;
  --panel-bg: rgba(255, 255, 255, .94);
  --panel-solid: #ffffff;
  --text-main: #17233b;
  --text-strong: #0d1930;
  --text-muted: #69758a;
  --border: #dfe6f0;
  --border-strong: #cfd9e7;
  --primary: #315fdd;
  --primary-dark: #244bb9;
  --primary-soft: #edf3ff;
  --success: #138a57;
  --success-soft: #eaf8f1;
  --warning: #b87400;
  --warning-soft: #fff6df;
  --danger: #c83b50;
  --danger-soft: #fff0f2;
  --info: #1476bd;
  --info-soft: #ebf6ff;
  --shadow-sm: 0 2px 8px rgba(22, 34, 57, .05);
  --shadow-md: 0 12px 32px rgba(26, 44, 76, .09);
  --shadow-lg: 0 24px 60px rgba(17, 32, 62, .16);
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --focus-ring: 0 0 0 .24rem rgba(49, 95, 221, .17);
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body {
  min-height: 100%;
  margin: 0;
  font-family: 'Sarabun', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-main);
  background:
    radial-gradient(circle at 100% 0, rgba(79, 124, 255, .09), transparent 32rem),
    radial-gradient(circle at 0 100%, rgba(41, 184, 158, .06), transparent 28rem),
    var(--page-bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
img, svg { max-width: 100%; }
::selection { color: #fff; background: var(--primary); }

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 2000;
  transform: translateY(-150%);
  padding: .72rem 1rem;
  border-radius: 12px;
  color: #fff;
  background: var(--text-strong);
  box-shadow: var(--shadow-md);
  transition: transform .18s ease;
}
.skip-link:focus { transform: translateY(0); color: #fff; }

.layout { display: flex; min-height: 100vh; }
.main-content { flex: 1; min-width: 0; transition: width .24s ease; }
.container-fluid { width: 100%; max-width: 1760px; margin-inline: auto; padding: 28px 30px 44px !important; }

/* Sidebar */
.sidebar {
  position: sticky;
  top: 0;
  z-index: 1040;
  width: var(--sidebar-width);
  height: 100vh;
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  color: #fff;
  background:
    radial-gradient(circle at 20% 5%, rgba(100, 151, 255, .22), transparent 15rem),
    linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
  border-right: 1px solid rgba(255, 255, 255, .06);
  box-shadow: 12px 0 36px rgba(9, 24, 49, .12);
  transition: width .22s ease, transform .22s ease;
}
.brand {
  min-height: 94px;
  padding: 18px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.brand-with-actions { justify-content: space-between; }
.brand-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 17px;
  color: #fff;
  font-size: 1.35rem;
  background: linear-gradient(145deg, rgba(255, 255, 255, .18), rgba(255, 255, 255, .06));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .13), 0 10px 25px rgba(0, 0, 0, .14);
}
.brand-title { font-size: 1.28rem; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; white-space: nowrap; }
.brand-subtitle { margin-top: 4px; color: #aebdd4; font-size: .78rem; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.brand-actions { display: flex; align-items: center; gap: 8px; }
.sidebar-icon-btn {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 13px;
  color: #fff;
  background: rgba(255, 255, 255, .06);
  cursor: pointer;
  transition: all .18s ease;
}
.sidebar-icon-btn:hover { background: rgba(255, 255, 255, .13); transform: translateY(-1px); }
.sidebar-icon-btn:focus-visible { outline: 3px solid rgba(145, 181, 255, .45); outline-offset: 2px; }
.sidebar-scroll { flex: 1; min-height: 0; overflow: auto; padding: 14px 11px 18px; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .16) transparent; }
.sidebar-scroll::-webkit-scrollbar { width: 8px; }
.sidebar-scroll::-webkit-scrollbar-thumb { border-radius: 999px; background: rgba(255, 255, 255, .14); }
.nav-menu { gap: 10px; }
.nav-section { display: flex; flex-direction: column; gap: 5px; }
.nav-collapsible { padding: 6px; border: 1px solid rgba(255, 255, 255, .045); border-radius: 20px; background: rgba(255, 255, 255, .025); }
.nav-collapsible.open { background: rgba(255, 255, 255, .04); }
.nav-section-toggle {
  width: 100%;
  min-height: 46px;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 0;
  border-radius: 14px;
  color: #fff;
  background: transparent;
  cursor: pointer;
}
.nav-section-toggle:hover { background: rgba(255, 255, 255, .055); }
.nav-section-toggle-left { display: flex; align-items: center; gap: 11px; min-width: 0; }
.nav-section-toggle-label { font-size: .82rem; font-weight: 700; letter-spacing: .04em; white-space: nowrap; }
.nav-section-chevron, .nav-link-chevron { flex: 0 0 auto; color: #9fb2cf; font-size: .8rem; transition: transform .18s ease; }
.nav-collapsible.open > .nav-section-toggle .nav-section-chevron,
.nav-collapsible-inner.open > .nav-link-subtoggle .nav-link-chevron { transform: rotate(180deg); }
.nav-submenu { display: none; flex-direction: column; gap: 4px; padding-top: 4px; }
.nav-collapsible.open > .nav-submenu,
.nav-collapsible-inner.open > .nav-submenu { display: flex; }
.nav-link {
  min-height: 50px;
  padding: 7px 10px;
  display: flex;
  align-items: center;
  gap: 11px;
  border: 1px solid transparent;
  border-radius: 15px;
  color: #e9f0fb;
  font-size: .92rem;
  transition: color .18s ease, background .18s ease, border-color .18s ease, transform .18s ease;
}
.nav-link:hover { color: #fff; background: rgba(255, 255, 255, .07); border-color: rgba(255, 255, 255, .07); transform: translateX(2px); }
.nav-link.active {
  color: #fff;
  border-color: rgba(134, 174, 255, .26);
  background: linear-gradient(90deg, rgba(87, 137, 255, .26), rgba(255, 255, 255, .07));
  box-shadow: inset 3px 0 0 #85adff, 0 8px 20px rgba(0, 0, 0, .08);
}
.nav-link.active-parent { color: #fff; border-color: rgba(255, 255, 255, .08); background: rgba(255, 255, 255, .06); }
.nav-link-subtoggle { width: 100%; justify-content: flex-start; background: transparent; cursor: pointer; }
.nav-link-subtoggle .nav-link-label { flex: 1; }
.nav-icon-wrap {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 13px;
  background: rgba(255, 255, 255, .055);
}
.nav-icon-wrap-section { background: rgba(105, 157, 255, .14); border-color: rgba(105, 157, 255, .2); }
.nav-link.active .nav-icon-wrap, .nav-link.active-parent .nav-icon-wrap { background: rgba(121, 166, 255, .19); border-color: rgba(121, 166, 255, .28); }
.nav-link i { width: auto; font-size: 1.02rem; text-align: center; }
.nav-link-label { display: block; min-width: 0; overflow: hidden; font-weight: 500; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.nav-item-group { display: flex; flex-direction: column; gap: 4px; }
.nav-submenu-inner { gap: 3px; padding: 2px 0 2px 14px; }
.nav-link-child { min-height: 40px; padding: 7px 10px 7px 14px; gap: 9px; background: rgba(255, 255, 255, .018); }
.nav-link-child .nav-link-label { font-size: .86rem; }
.nav-link-bullet { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: #8eb3ff; box-shadow: 0 0 0 4px rgba(142, 179, 255, .1); }
.sidebar-footer { margin-top: auto; padding: 15px 18px 18px; color: #9fb0c9; border-top: 1px solid rgba(255, 255, 255, .08); background: rgba(0, 0, 0, .08); font-size: .82rem; line-height: 1.55; }
.sidebar-footer-title { margin-bottom: 5px; color: #c1cce0; font-size: .7rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }

/* Header */
.topbar {
  position: sticky;
  top: 0;
  z-index: 1025;
  min-height: 104px;
  padding: 18px 30px;
  border-bottom: 1px solid rgba(209, 220, 234, .85);
  background: rgba(248, 250, 253, .88);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}
.topbar-heading { min-width: 0; }
.page-eyebrow { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; color: var(--primary); font-size: .74rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.page-eyebrow::before { content: ''; width: 22px; height: 2px; border-radius: 99px; background: var(--primary); }
.page-title { margin: 0; color: var(--text-strong); font-size: clamp(1.45rem, 2.4vw, 2rem); font-weight: 700; line-height: 1.2; letter-spacing: -.035em; }
.page-description { max-width: 920px; margin-top: 4px; color: var(--text-muted); font-size: .9rem; line-height: 1.45; }
.topbar-user { display: flex; align-items: center; gap: 10px; }
.user-account-btn {
  min-height: 48px;
  padding: 5px 10px 5px 6px !important;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border-color: var(--border) !important;
  border-radius: 16px !important;
  color: var(--text-main) !important;
  background: rgba(255, 255, 255, .9) !important;
  box-shadow: var(--shadow-sm);
}
.user-account-btn:hover { border-color: var(--border-strong) !important; background: #fff !important; transform: translateY(-1px); }
.user-avatar {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  font-size: .8rem;
  font-weight: 700;
  background: linear-gradient(145deg, #4c7cff, #244bb9);
  box-shadow: 0 6px 16px rgba(49, 95, 221, .24);
}
.user-meta { min-width: 0; text-align: left; line-height: 1.15; }
.user-name { display: block; max-width: 170px; overflow: hidden; color: var(--text-strong); font-size: .88rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.user-email { display: block; max-width: 170px; margin-top: 3px; overflow: hidden; color: var(--text-muted); font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
.dropdown-menu { padding: 8px; border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); }
.dropdown-item { padding: .65rem .8rem; border-radius: 10px; }
.dropdown-item:active { background: var(--primary); }

/* Surfaces and content */
.panel, .stat-card, .kpi-tile, .card-mini, .builder-sidebar, .preview-paper {
  border: 1px solid rgba(217, 226, 238, .9);
  background: var(--panel-bg);
  box-shadow: var(--shadow-sm);
}
.panel { padding: clamp(18px, 2.3vw, 26px); border-radius: var(--radius-lg); }
.panel:hover { border-color: rgba(201, 213, 229, .95); }
.panel-title { margin: 0; color: var(--text-strong); font-size: clamp(1.3rem, 2vw, 1.72rem); font-weight: 700; letter-spacing: -.025em; }
.surface-hero {
  position: relative;
  overflow: hidden;
  padding: clamp(24px, 3vw, 34px);
  border: 1px solid rgba(255, 255, 255, .11);
  border-radius: var(--radius-xl);
  color: #fff;
  background:
    radial-gradient(circle at 86% 18%, rgba(133, 179, 255, .36), transparent 14rem),
    radial-gradient(circle at 0 100%, rgba(49, 203, 181, .17), transparent 18rem),
    linear-gradient(135deg, #0e2245 0%, #244d91 100%);
  box-shadow: 0 20px 48px rgba(24, 55, 104, .2);
}
.surface-hero::after { content: ''; position: absolute; right: -70px; bottom: -100px; width: 260px; height: 260px; border: 1px solid rgba(255, 255, 255, .11); border-radius: 50%; }
.surface-hero > * { position: relative; z-index: 1; }
.surface-hero h2 { font-size: clamp(1.55rem, 3vw, 2.35rem); font-weight: 700; letter-spacing: -.035em; }
.surface-hero .muted-inverse { max-width: 880px; color: rgba(255, 255, 255, .8); font-size: 1rem; }
.surface-hero .btn-light { color: #173b75; border-color: rgba(255,255,255,.6); box-shadow: 0 9px 24px rgba(4, 22, 54, .18); }
.kpi-tile {
  position: relative;
  height: 100%;
  min-height: 142px;
  overflow: hidden;
  padding: 20px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,251,255,.94));
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.kpi-tile::before { content: ''; position: absolute; top: 0; left: 20px; right: 20px; height: 3px; border-radius: 0 0 999px 999px; background: linear-gradient(90deg, var(--primary), #6ba6ff); opacity: .85; }
.kpi-tile:hover { transform: translateY(-3px); border-color: #cbd8eb; box-shadow: var(--shadow-md); }
.stat-card { min-height: 148px; padding: 22px; border-radius: 22px; }
.stat-value, .metric-number { color: var(--text-strong); font-variant-numeric: tabular-nums; font-weight: 700; line-height: 1; letter-spacing: -.045em; }
.stat-value { font-size: clamp(2rem, 4vw, 2.75rem); }
.metric-number { font-size: clamp(1.65rem, 3vw, 2.25rem); }
.kpi-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 1.25rem;
}
.small-muted, .text-muted-soft { color: var(--text-muted); }
.metric-chip, .step-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid #dce6f4;
  border-radius: 999px;
  color: #24477c;
  background: #f3f7fd;
  font-weight: 700;
}
.metric-chip { padding: .55rem .9rem; }
.step-badge { padding: .34rem .68rem; font-size: .78rem; }
.section-block { margin-bottom: 14px; padding: 16px; border: 1px solid #e3eaf3; border-radius: 17px; background: #f9fbfe; }
.section-block:last-child { margin-bottom: 0; }
.form-section-title { margin-bottom: 6px; color: var(--text-strong); font-size: 1.05rem; font-weight: 700; }
.card-mini { padding: 16px; border-radius: 18px; background: #f9fbfd; }

/* Forms */
.form-label { margin-bottom: .42rem; color: #34415a; font-size: .88rem; font-weight: 600; }
.form-control, .form-select {
  min-height: 46px;
  padding: .66rem .82rem;
  border-color: #d7e0ec;
  border-radius: 13px;
  color: var(--text-main);
  background-color: rgba(255, 255, 255, .96);
  box-shadow: none;
  transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}
textarea.form-control { min-height: 104px; line-height: 1.55; }
.form-control:hover, .form-select:hover { border-color: #bbc9db; }
.form-control:focus, .form-select:focus { border-color: #7ea2f4; background-color: #fff; box-shadow: var(--focus-ring); }
.form-control::placeholder { color: #9ba6b7; }
.form-control:disabled, .form-select:disabled { color: #68758b; background: #f0f3f7; }
.form-check-input { width: 1.1em; height: 1.1em; border-color: #b9c6d8; }
.form-check-input:checked { border-color: var(--primary); background-color: var(--primary); }
.form-check-input:focus { box-shadow: var(--focus-ring); }
.input-group .form-control:first-child { border-radius: 13px 0 0 13px; }
.input-group .btn:last-child { border-radius: 0 13px 13px 0; }

/* Buttons */
.btn {
  min-height: 42px;
  padding: .58rem .92rem;
  border-radius: 13px;
  font-weight: 600;
  box-shadow: none;
  transition: transform .16s ease, box-shadow .16s ease, background-color .16s ease, border-color .16s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:focus-visible { box-shadow: var(--focus-ring); }
.btn-sm { min-height: 34px; padding: .38rem .68rem; border-radius: 10px; font-size: .82rem; }
.btn-lg { min-height: 50px; padding: .72rem 1.1rem; border-radius: 15px; }
.btn-primary { border-color: var(--primary); background: linear-gradient(135deg, #3f71ea, #2854cb); box-shadow: 0 8px 18px rgba(49, 95, 221, .2); }
.btn-primary:hover, .btn-primary:focus { border-color: var(--primary-dark); background: linear-gradient(135deg, #315fdd, #2048ba); box-shadow: 0 10px 22px rgba(49, 95, 221, .25); }
.btn-outline-primary { color: var(--primary); border-color: #9db4eb; }
.btn-outline-primary:hover { border-color: var(--primary); background: var(--primary); }
.btn-outline-secondary { color: #506078; border-color: #c6d1df; }
.btn-outline-secondary:hover { border-color: #40516a; background: #40516a; }
.btn-light { border-color: var(--border); background: #fff; }
.btn-danger { box-shadow: 0 8px 18px rgba(200, 59, 80, .16); }

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border: 1px solid #e2e9f2;
  border-radius: 17px;
  background: #fff;
  scrollbar-width: thin;
  scrollbar-color: #bdc9da #f1f4f8;
  -webkit-overflow-scrolling: touch;
}
.table-responsive::-webkit-scrollbar { height: 9px; }
.table-responsive::-webkit-scrollbar-track { background: #f1f4f8; }
.table-responsive::-webkit-scrollbar-thumb { border: 2px solid #f1f4f8; border-radius: 999px; background: #bdc9da; }
.table { width: 100%; margin-bottom: 0; color: var(--text-main); }
.table > :not(caption) > * > * { padding: .9rem .85rem; border-color: #e9eef5; }
.table thead th {
  border-bottom: 1px solid #dde5ef;
  color: #44516a;
  background: #f5f8fc;
  font-size: .79rem;
  font-weight: 700;
  letter-spacing: .025em;
  text-transform: none;
  white-space: nowrap;
}
.table tbody td { vertical-align: middle; }
.table tbody tr { transition: background-color .14s ease; }
.table tbody tr:hover { background: #f9fbfe; }
.table-clean thead th { background: #f5f8fc; }
.table-clean tbody tr:hover { background: #f8fbff; }
.table code { color: #294fae; font-size: .82rem; }
.heatmap td.score-low { background: var(--danger-soft); color: #9f2f43; font-weight: 700; }
.heatmap td.score-mid { background: var(--warning-soft); color: #956100; font-weight: 700; }
.heatmap td.score-high { background: var(--success-soft); color: #117148; font-weight: 700; }

/* Status and feedback */
.badge-status { display: inline-flex; align-items: center; min-height: 28px; padding: .35rem .7rem; border-radius: 999px; font-size: .76rem; font-weight: 700; }
.badge-draft { color: #526176; background: #edf1f6; }
.badge-in_progress, .badge-under_assessment, .badge-monitoring { color: #315dcf; background: #eaf1ff; }
.badge-submitted_to_faculty, .badge-submitted_to_qa, .badge-assessor_assigned, .badge-action-pending { color: #946000; background: #fff3d8; }
.badge-preliminary_result, .badge-final_result, .badge-completed, .badge-done, .badge-approved, .badge-published, .badge-closed, .badge-action-approved { color: #13774c; background: #e7f7ef; }
.badge-returned_by_faculty, .badge-rejected, .badge-delayed, .badge-cancelled, .badge-action-returned, .badge-action-rejected { color: #b33549; background: #fdecee; }
.alert { padding: .85rem 1rem; border-width: 1px; border-radius: 15px !important; box-shadow: var(--shadow-sm); }
.alert-success { color: #146c49; border-color: #bfe7d4; background: #ecf9f3; }
.alert-warning { color: #805400; border-color: #f0d99f; background: #fff9e9; }
.alert-danger { color: #a43043; border-color: #efc2ca; background: #fff1f3; }
.alert-info { color: #145e91; border-color: #bedff4; background: #eef8ff; }

/* Progress, timeline, builder */
.progress { height: 9px; overflow: hidden; border-radius: 999px; background: #e8edf5; }
.progress-bar { border-radius: 999px; background: linear-gradient(90deg, #3868dc, #6a9bff); }
.timeline-item { display: flex; gap: 13px; align-items: flex-start; padding: 9px 0; }
.timeline-dot { width: 12px; height: 12px; flex: 0 0 12px; margin-top: 6px; border: 3px solid #dce7ff; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 2px #fff; }
.timeline-list { position: relative; }
.timeline-list::before { content: ''; position: absolute; top: 4px; bottom: 4px; left: 8px; width: 2px; background: #dbe4f0; }
.timeline-entry { position: relative; padding-bottom: 16px; padding-left: 28px; }
.timeline-entry::before { content: ''; position: absolute; top: 5px; left: 2px; width: 14px; height: 14px; border: 3px solid #fff; border-radius: 50%; background: #24477c; box-shadow: 0 0 0 1px #dbe4f0; }
.editor-sticky, .builder-sidebar { position: sticky; top: 124px; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 14px; }
.kpi-card { padding: 16px; border: 1px solid #e3eaf4; border-radius: 18px; background: #f7faff; }
.builder-grid { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 20px; }
.builder-sidebar { padding: 20px; border-radius: 22px; }
.builder-step { display: flex; gap: 12px; padding: 12px; border-radius: 16px; color: #213047; }
.builder-step.active, .builder-step:hover { background: #eef4ff; }
.builder-step-no { width: 30px; height: 30px; flex: 0 0 30px; display: grid; place-items: center; border-radius: 50%; color: #24477c; background: #e5edfa; font-weight: 700; }
.preview-paper { max-width: 960px; margin-inline: auto; padding: clamp(24px, 5vw, 48px); border-radius: 26px; box-shadow: var(--shadow-md); }
.preview-page-break { height: 1px; margin: 34px 0; background: linear-gradient(90deg, transparent, #cfd8e6, transparent); }
.nav-pills .nav-link { min-height: 40px; padding: .5rem .85rem; border-radius: 999px; color: #516173; }
.nav-pills .nav-link.active { color: #fff; background: var(--primary); }

/* Login */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(16px, 4vw, 42px);
  background:
    radial-gradient(circle at 10% 10%, rgba(104, 155, 255, .23), transparent 24rem),
    radial-gradient(circle at 95% 90%, rgba(42, 199, 174, .16), transparent 26rem),
    linear-gradient(145deg, #07152c 0%, #12356a 55%, #1c4f91 100%);
}
.login-shell {
  width: min(1180px, 100%);
  min-height: min(720px, calc(100vh - 60px));
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(400px, .92fr);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 34px;
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 35px 90px rgba(0, 12, 36, .34);
}
.login-showcase {
  position: relative;
  overflow: hidden;
  padding: clamp(32px, 5vw, 62px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #fff;
  background:
    radial-gradient(circle at 78% 18%, rgba(135, 180, 255, .35), transparent 16rem),
    radial-gradient(circle at 15% 85%, rgba(50, 220, 188, .15), transparent 15rem),
    linear-gradient(150deg, #0b1f40 0%, #153d74 100%);
}
.login-showcase::before, .login-showcase::after { content: ''; position: absolute; border: 1px solid rgba(255, 255, 255, .1); border-radius: 50%; }
.login-showcase::before { width: 300px; height: 300px; top: -130px; right: -90px; }
.login-showcase::after { width: 220px; height: 220px; bottom: -100px; left: -70px; }
.login-brand { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 13px; }
.login-brand-mark { width: 54px; height: 54px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.16); border-radius: 18px; background: rgba(255,255,255,.1); font-size: 1.35rem; }
.login-brand-name { font-size: 1.28rem; font-weight: 700; line-height: 1.15; }
.login-brand-sub { margin-top: 3px; color: rgba(255,255,255,.66); font-size: .76rem; letter-spacing: .08em; text-transform: uppercase; }
.login-message { position: relative; z-index: 1; max-width: 570px; }
.login-kicker { margin-bottom: 12px; color: #9dc1ff; font-size: .8rem; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
.login-message h1 { margin-bottom: 16px; font-size: clamp(2rem, 3.5vw, 3.4rem); font-weight: 700; line-height: 1.08; letter-spacing: -.04em; }
.login-message p { max-width: 520px; margin-bottom: 0; color: rgba(255,255,255,.76); font-size: 1rem; }
.login-feature-list { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; }
.login-feature { padding: 13px; border: 1px solid rgba(255,255,255,.1); border-radius: 16px; background: rgba(255,255,255,.06); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.login-feature i { display: block; margin-bottom: 7px; color: #9fc2ff; font-size: 1.15rem; }
.login-feature span { display: block; color: rgba(255,255,255,.8); font-size: .78rem; line-height: 1.35; }
.login-panel { padding: clamp(28px, 5vw, 64px); display: flex; align-items: center; background: #fff; }
.login-card { width: min(440px, 100%); margin-inline: auto; }
.login-card-title { margin-bottom: 7px; color: var(--text-strong); font-size: clamp(1.7rem, 3vw, 2.3rem); font-weight: 700; letter-spacing: -.035em; }
.login-card-subtitle { margin-bottom: 26px; color: var(--text-muted); }
.google-login-btn { position: relative; justify-content: center; border-color: #d5deea !important; color: #23324c !important; background: #fff !important; }
.google-login-btn:hover { border-color: #b7c6d9 !important; background: #f9fbfd !important; }
.google-icon-wrap { position: absolute; left: 14px; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 9px; background: #f3f5f8; }
.divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: #8792a4; font-size: .8rem; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: #e2e7ef; }
.password-field { position: relative; }
.password-field .form-control { padding-right: 48px; }
.password-toggle { position: absolute; top: 50%; right: 7px; width: 36px; height: 36px; transform: translateY(-50%); display: grid; place-items: center; border: 0; border-radius: 10px; color: #68758a; background: transparent; }
.password-toggle:hover { color: var(--primary); background: var(--primary-soft); }
.login-footnote { margin-top: 22px; color: #8792a4; font-size: .76rem; text-align: center; }

/* Mobile sidebar */
.mobile-sidebar-open {
  position: fixed;
  top: 16px;
  left: 14px;
  z-index: 1055;
  width: 46px;
  height: 46px;
  display: none;
  place-items: center;
  border: 1px solid rgba(17, 36, 60, .1);
  border-radius: 14px;
  color: #17325a;
  background: rgba(255,255,255,.94);
  box-shadow: 0 10px 26px rgba(17, 36, 60, .14);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.sidebar-overlay { position: fixed; inset: 0; z-index: 1035; display: none; background: rgba(7, 17, 35, .56); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.sidebar-overlay.show { display: block; }

/* Collapsed desktop sidebar */
body.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed-width); }
body.sidebar-collapsed .brand-title,
body.sidebar-collapsed .brand-subtitle,
body.sidebar-collapsed .nav-section-toggle-label,
body.sidebar-collapsed .nav-link-label,
body.sidebar-collapsed .nav-link-chevron,
body.sidebar-collapsed .nav-section-chevron,
body.sidebar-collapsed .sidebar-footer,
body.sidebar-collapsed .nav-submenu,
body.sidebar-collapsed .nav-collapsible-inner .nav-submenu { display: none !important; }
body.sidebar-collapsed .brand { padding: 18px 12px; }
body.sidebar-collapsed .brand-main { width: 100%; justify-content: center; }
body.sidebar-collapsed .brand-actions { display: none; }
body.sidebar-collapsed .brand-mark { margin-inline: auto; }
body.sidebar-collapsed .sidebar-scroll { padding-inline: 9px; }
body.sidebar-collapsed .nav-collapsible { padding: 5px; border-color: transparent; background: transparent; }
body.sidebar-collapsed .nav-section-toggle, body.sidebar-collapsed .nav-link { min-height: 54px; justify-content: center; padding: 8px; }
body.sidebar-collapsed .nav-link:hover { transform: none; }
body.sidebar-collapsed .nav-section-toggle-left { width: 100%; justify-content: center; }
body.sidebar-collapsed .nav-section .nav-link, body.sidebar-collapsed .nav-section .nav-section-toggle { position: relative; }
body.sidebar-collapsed .nav-section .nav-link[title]:hover::after,
body.sidebar-collapsed .nav-section .nav-section-toggle[title]:hover::after {
  content: attr(title);
  position: absolute;
  top: 50%;
  left: calc(100% + 12px);
  z-index: 30;
  transform: translateY(-50%);
  padding: 8px 10px;
  border-radius: 10px;
  color: #fff;
  background: #10233e;
  box-shadow: 0 10px 24px rgba(0,0,0,.2);
  font-size: .82rem;
  white-space: nowrap;
}

.print-only { display: none; }

@media (max-width: 1199.98px) {
  :root { --sidebar-width: 272px; }
  .container-fluid { padding-inline: 22px !important; }
  .topbar { padding-inline: 22px; }
  .login-feature-list { grid-template-columns: 1fr; }
}

@media (max-width: 991.98px) {
  .layout { display: block; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(322px, 88vw); height: 100dvh; transform: translateX(-105%); border-radius: 0 26px 26px 0; box-shadow: 22px 0 60px rgba(4, 14, 31, .34); }
  body.sidebar-mobile-open { overflow: hidden; }
  body.sidebar-mobile-open .sidebar { transform: translateX(0); }
  .mobile-sidebar-open { display: inline-grid; }
  .main-content { width: 100%; }
  .topbar { min-height: 92px; padding: 15px 16px 14px 72px; }
  .page-description { max-width: 620px; font-size: .82rem; }
  .container-fluid { padding: 18px 16px 36px !important; }
  .editor-sticky, .builder-sidebar { position: static; }
  .builder-grid { grid-template-columns: 1fr; }
  body.sidebar-collapsed .sidebar { width: min(322px, 88vw); }
  body.sidebar-collapsed .brand-title,
  body.sidebar-collapsed .brand-subtitle,
  body.sidebar-collapsed .nav-section-toggle-label,
  body.sidebar-collapsed .nav-link-label,
  body.sidebar-collapsed .nav-link-chevron,
  body.sidebar-collapsed .nav-section-chevron,
  body.sidebar-collapsed .sidebar-footer,
  body.sidebar-collapsed .nav-submenu,
  body.sidebar-collapsed .nav-collapsible-inner .nav-submenu { display: initial !important; }
  body.sidebar-collapsed .brand-actions { display: flex; }
  body.sidebar-collapsed .sidebar-scroll { padding: 14px 11px 18px; }
  body.sidebar-collapsed .nav-collapsible { padding: 6px; border-color: rgba(255,255,255,.045); background: rgba(255,255,255,.025); }
  body.sidebar-collapsed .nav-section-toggle, body.sidebar-collapsed .nav-link { justify-content: flex-start; padding: 7px 10px; }
  .login-shell { grid-template-columns: minmax(0, 1fr) minmax(370px, .95fr); }
  .login-showcase { padding: 34px; }
}

@media (max-width: 767.98px) {
  body { font-size: 15px; }
  .topbar { align-items: center !important; }
  .page-eyebrow, .page-description { display: none; }
  .topbar-user .user-meta { display: none; }
  .user-account-btn { padding-right: 7px !important; }
  .surface-hero { border-radius: 24px; }
  .surface-hero .text-lg-end { text-align: left !important; }
  .surface-hero .btn { width: 100%; }
  .panel { border-radius: 20px; }
  .panel .d-flex.justify-content-between.align-items-center { align-items: flex-start !important; }
  .panel .d-flex.justify-content-between.align-items-center:not(.flex-nowrap) { flex-wrap: wrap; }
  .table > :not(caption) > * > * { padding: .78rem .7rem; }
  .btn:not(.btn-sm):not(.dropdown-toggle) { min-height: 44px; }
  .login-page { padding: 0; place-items: stretch; background: #fff; }
  .login-shell { min-height: 100dvh; grid-template-columns: 1fr; border: 0; border-radius: 0; box-shadow: none; }
  .login-showcase { min-height: 240px; padding: 24px; justify-content: flex-start; }
  .login-message { margin-top: 36px; }
  .login-message h1 { font-size: 2rem; }
  .login-message p { font-size: .9rem; }
  .login-feature-list { display: none; }
  .login-panel { padding: 28px 20px 40px; align-items: flex-start; }
}

@media (max-width: 575.98px) {
  .container-fluid { padding-inline: 12px !important; }
  .topbar { padding-right: 12px; }
  .mobile-sidebar-open { left: 10px; }
  .panel, .kpi-tile, .stat-card { padding: 17px; }
  .surface-hero { padding: 22px 18px; }
  .surface-hero h2 { font-size: 1.5rem; }
  .surface-hero .muted-inverse { font-size: .88rem; }
  .row.g-4 { --bs-gutter-y: 1rem; }
  .preview-paper { padding: 20px 16px; border-radius: 18px; }
  .form-control, .form-select { font-size: 16px; }
  .login-showcase { min-height: 220px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

@media print {
  body { color: #000; background: #fff; }
  .sidebar, .topbar, .no-print, .mobile-sidebar-open, .sidebar-overlay { display: none !important; }
  .main-content { width: 100%; }
  .container-fluid { max-width: none; padding: 0 !important; }
  .panel { padding: 0; border: 0; border-radius: 0; box-shadow: none; background: #fff; }
  .table-responsive { overflow: visible; border: 0; }
  .print-only { display: block; }
}
