:root {
    --sv-blue-950: #062755;
    --sv-blue-900: #07366d;
    --sv-blue-800: #064a86;
    --sv-blue-700: #075fae;
    --sv-blue-600: #0873d1;
    --sv-blue-100: #eaf4ff;
    --sv-gold: #d59a13;
    --sv-gold-soft: #f7e6b2;
    --sv-red: #df283d;
    --sv-ink: #102d60;
    --sv-text: #4f6387;
    --sv-muted: #7e8da9;
    --sv-line: #d8e1ee;
    --sv-surface: #ffffff;
    --sv-canvas: #f6f9fd;
    --sv-sidebar-width: 118px;
    --sv-header-height: 92px;
    --sv-radius: 12px;
    --sv-shadow: 0 10px 32px rgba(26, 63, 111, .08);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--sv-canvas); }

body.sv-body {
    margin: 0;
    min-width: 320px;
    color: var(--sv-text);
    background: var(--sv-canvas);
    font: 400 15px/1.5 "Segoe UI", Inter, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.sv-body a { color: var(--sv-blue-700); }
.sv-body svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.sv-skip-link {
    position: fixed;
    z-index: 1000;
    top: 8px;
    left: 50%;
    padding: 10px 16px;
    border-radius: 8px;
    color: #fff !important;
    background: var(--sv-blue-950);
    transform: translate(-50%, -150%);
}
.sv-skip-link:focus { transform: translate(-50%, 0); }

.sv-topbar {
    position: fixed;
    z-index: 60;
    inset: 0 0 auto 0;
    display: grid;
    grid-template-columns: minmax(315px, 1fr) minmax(340px, 735px) minmax(315px, 1fr);
    align-items: center;
    min-height: var(--sv-header-height);
    padding: 0 24px 0 18px;
    border-bottom: 1px solid var(--sv-line);
    background: rgba(255,255,255,.96);
    backdrop-filter: blur(12px);
}

.sv-brand {
    display: inline-flex;
    align-items: center;
    gap: 16px;
    width: fit-content;
    color: var(--sv-blue-800) !important;
    text-decoration: none !important;
    font: 600 18px/1.15 Georgia, "Times New Roman", serif;
    letter-spacing: .01em;
    text-transform: uppercase;
}
.sv-brand img { width: 72px; height: 78px; object-fit: contain; }

.sv-search-wrap { position: relative; display: flex; align-items: center; min-width: 0; }
.sv-search-wrap > svg { position: absolute; left: 18px; width: 20px; height: 20px; color: #7083a5; }
.sv-search-wrap input {
    width: 100%;
    height: 48px;
    padding: 0 82px 0 50px;
    border: 1px solid #cfd9e8;
    border-radius: 8px;
    outline: none;
    color: var(--sv-ink);
    background: #fff;
    transition: border-color .2s, box-shadow .2s;
}
.sv-search-wrap input:focus { border-color: var(--sv-blue-600); box-shadow: 0 0 0 3px rgba(8,115,209,.12); }
.sv-search-wrap kbd { position: absolute; right: 12px; padding: 2px 7px; border: 1px solid #d7dfeb; border-radius: 4px; color: #7182a0; background: #f8fafd; font: 12px/1.4 inherit; }
.sv-search-results {
    position: absolute;
    top: 56px;
    right: 0;
    left: 0;
    max-height: min(420px, 60vh);
    overflow-y: auto;
    padding: 8px;
    border: 1px solid var(--sv-line);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 18px 45px rgba(13,48,91,.18);
}
.sv-search-results a { display: flex; justify-content: space-between; gap: 16px; padding: 10px 12px; border-radius: 7px; text-decoration: none; color: var(--sv-ink); }
.sv-search-results a:hover, .sv-search-results a:focus { background: var(--sv-blue-100); }
.sv-search-results small { color: var(--sv-muted); }
.sv-search-empty { margin: 0; padding: 12px; color: var(--sv-muted); }

.sv-user-tools { display: flex; align-items: center; justify-content: flex-end; gap: 24px; min-width: 0; }
.sv-icon-button { position: relative; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; color: var(--sv-ink) !important; }
.sv-icon-button:hover { background: var(--sv-blue-100); }
.sv-icon-button svg { width: 25px; height: 25px; }
.sv-notification-dot { position: absolute; top: 5px; right: 5px; width: 9px; height: 9px; border: 2px solid #fff; border-radius: 50%; background: var(--sv-red); }
.sv-user { display: flex; align-items: center; gap: 14px; min-width: 0; text-align: right; text-decoration: none !important; }
.sv-user-copy { display: flex; flex-direction: column; min-width: 0; color: var(--sv-ink); font-weight: 600; }
.sv-user-copy > span { overflow: hidden; max-width: 220px; text-overflow: ellipsis; white-space: nowrap; }
.sv-user-copy small { color: var(--sv-muted); font-size: 13px; font-weight: 400; }
.sv-avatar { display: grid; place-items: center; width: 52px; height: 52px; overflow: hidden; border: 1.5px solid var(--sv-blue-600); border-radius: 50%; background: var(--sv-blue-100); }
.sv-avatar img { width: 100%; height: 100%; object-fit: cover; }
.sv-menu-toggle { display: none; width: 42px; height: 42px; padding: 10px; border: 0; border-radius: 8px; background: transparent; }
.sv-menu-toggle span { display: block; height: 2px; margin: 4px 0; background: var(--sv-ink); }

.sv-sidebar {
    position: fixed;
    z-index: 55;
    top: var(--sv-header-height);
    bottom: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    width: var(--sv-sidebar-width);
    overflow: hidden auto;
    color: #fff;
    background: linear-gradient(180deg, #064e8d 0%, #075fae 48%, #064477 100%);
    box-shadow: 8px 0 26px rgba(6,52,100,.08);
    transition: width .22s ease, transform .22s ease;
}
.sv-nav { flex: 1; padding: 8px 0 16px; }
.sv-nav a, .sv-sidebar-footer a, .sv-sidebar-footer button {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: 100%;
    min-height: 83px;
    padding: 9px 8px;
    border: 0;
    color: rgba(255,255,255,.96) !important;
    background: transparent;
    text-align: center;
    text-decoration: none !important;
    font: 600 12px/1.18 inherit;
    cursor: pointer;
    transition: background .18s, color .18s;
}
.sv-nav a::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: transparent; }
.sv-nav a:hover, .sv-nav a:focus, .sv-nav a.is-active { background: rgba(1,31,73,.24); }
.sv-nav a.is-active::before { background: var(--sv-gold); }
.sv-nav svg, .sv-sidebar-footer svg { width: 26px; height: 26px; flex: none; }
.sv-sidebar-footer { padding: 8px 0 max(10px, env(safe-area-inset-bottom)); border-top: 1px solid rgba(255,255,255,.14); }
.sv-sidebar-footer a, .sv-sidebar-footer button { min-height: 58px; }
.sv-sidebar-backdrop { display: none; }

.sv-page-shell { min-height: 100vh; margin-left: var(--sv-sidebar-width); padding-top: var(--sv-header-height); transition: margin-left .22s ease; }
.sv-main { min-width: 0; min-height: calc(100vh - var(--sv-header-height) - 46px); padding: 24px 28px 36px; outline: none; }
.sv-workspace { width: min(100%, 1680px); min-width: 0; margin: 0 auto; }
.sv-footer { display: flex; justify-content: space-between; gap: 16px; min-height: 46px; padding: 12px 28px; border-top: 1px solid var(--sv-line); color: var(--sv-muted); background: #fff; font-size: 12px; }

body.sv-collapsed { --sv-sidebar-width: 76px; }
body.sv-collapsed .sv-nav span, body.sv-collapsed .sv-sidebar-footer span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
body.sv-collapsed .sv-nav a { min-height: 64px; }
body.sv-collapsed #portalCollapse svg { transform: rotate(180deg); }

.sv-page-heading { margin: 0 0 24px; }
.sv-page-heading h1 { margin: 0; color: var(--sv-ink); font-size: clamp(24px, 2vw, 32px); font-weight: 650; letter-spacing: -.02em; }
.sv-page-heading p { margin: 4px 0 0; color: var(--sv-muted); }
.sv-section-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
.sv-section-header h1 { margin: 0; color: var(--sv-ink); font-size: 26px; }
.sv-section-header p { margin: 3px 0 0; color: var(--sv-muted); }
.sv-card { padding: 20px; border: 1px solid var(--sv-line); border-radius: var(--sv-radius); background: var(--sv-surface); box-shadow: var(--sv-shadow); }
.sv-grid { display: grid; gap: 20px; }
.sv-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.sv-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sv-card-title { display: flex; align-items: center; gap: 10px; margin: 0 0 18px; color: var(--sv-blue-700); font-size: 13px; font-weight: 700; text-transform: uppercase; }
.sv-card-title svg { width: 24px; height: 24px; }
.sv-card-value { margin: 0 0 22px; color: var(--sv-ink); font-size: 26px; font-weight: 650; }
.sv-quick-link { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 8px 18px; border: 1px solid var(--sv-blue-600); border-radius: 6px; color: var(--sv-blue-700) !important; text-decoration: none !important; font-weight: 600; }
.sv-quick-link:hover { color: #fff !important; background: var(--sv-blue-700); }
.sv-alert-card { display: block; margin: 0 0 20px; border: 1px solid #f0cf78 !important; border-radius: 10px; background: #fff9e8 !important; color: #725008; }
.sv-alert-card > div { background: transparent !important; }
.sv-alert-card [class*="dxp-content"] { display: flex; align-items: center; gap: 12px; padding: 12px 16px !important; }
.sv-alert-icon { display: inline-grid; place-items: center; flex: 0 0 26px; height: 26px; border-radius: 50%; color: #fff; background: var(--sv-gold); font-weight: 800; }
.sv-dashboard-cards { margin-bottom: 20px; }
.sv-dashboard-card { display: flex; flex-direction: column; min-height: 270px; }
.sv-dashboard-card p { margin: 0 0 18px; }
.sv-dashboard-card .sv-quick-link { align-self: flex-start; margin-top: auto; }
.sv-dashboard-list { flex: 1; min-height: 90px; margin-bottom: 16px; color: var(--sv-text); }
.sv-dashboard-list ul { margin: 0; padding: 0; list-style: none; }
.sv-dashboard-list li { padding: 5px 0; border-bottom: 1px solid #eef2f7; }
.sv-dashboard-detail { grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr); }
.sv-card-heading-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.sv-card-heading-row h2 { margin: 0; color: var(--sv-ink); font-size: 18px; }
.sv-card-heading-row p { margin: 3px 0 0; color: var(--sv-muted); }
.sv-card-heading-row > a { flex: none; font-size: 13px; font-weight: 600; }
.sv-calendar-wrap { width: 100%; overflow-x: auto; }
.sv-calendar { width: 100%; min-width: 480px; border: 0 !important; border-collapse: separate; border-spacing: 3px; color: var(--sv-text); background: transparent !important; }
.sv-calendar td { height: 38px; padding: 6px !important; border: 0 !important; text-align: center; }
.sv-calendar-title { padding: 8px !important; color: var(--sv-ink) !important; background: transparent !important; font-weight: 700; }
.sv-calendar-title a { color: var(--sv-blue-700) !important; }
.sv-calendar-day-header { color: var(--sv-muted) !important; background: transparent !important; font-size: 12px; font-weight: 700; }
.sv-calendar-other-month { color: #b7c1d2 !important; }
.sv-calendar-today { border-radius: 50%; color: var(--sv-blue-800) !important; background: var(--sv-blue-100) !important; font-weight: 700; }
.sv-calendar-selected { border-radius: 50%; color: #fff !important; background: var(--sv-blue-700) !important; font-weight: 700; }
.sv-calendar-weekend { background: #f5f8fc !important; color: var(--sv-muted) !important; }
.sv-calendar-guard { background: #fff4cc !important; color: #725400 !important; font-weight: 700; }
.sv-calendar-course { background: #dff3ff !important; color: var(--sv-blue-800) !important; font-weight: 700; }
.sv-calendar-registered { background: #ffe2e5 !important; color: #9f1728 !important; font-weight: 700; }
.sv-calendar-guard-course { background: #e7ddff !important; color: #563494 !important; font-weight: 700; }
.sv-calendar-guard-registered { background: #ffd9c8 !important; color: #9b3217 !important; font-weight: 700; }
.sv-action-list { display: grid; gap: 8px; }
.sv-action-list a { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 50px; padding: 12px 14px; border: 1px solid #e1e8f2; border-radius: 8px; color: var(--sv-ink) !important; text-decoration: none !important; font-weight: 600; }
.sv-action-list a:hover { border-color: #b9d6f2; background: var(--sv-blue-100); }
.sv-action-list b { color: var(--sv-blue-600); font-size: 24px; font-weight: 400; }
.sv-legacy-links { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--sv-line); }

.dx-menu-container { margin: 0 0 20px; overflow-x: auto; border: 1px solid var(--sv-line); border-radius: 10px; background: #fff; box-shadow: var(--sv-shadow); }
.sv-section-menu { width: 100% !important; border: 0 !important; background: transparent !important; }
.sv-section-menu .dxm-item { border: 0 !important; }
.sv-section-menu .dxm-content { padding: 12px 15px !important; color: var(--sv-ink) !important; font-weight: 600; }
.sv-section-menu .dxm-hovered, .sv-section-menu .dxm-selected { background: var(--sv-blue-100) !important; }
.dxgvControl, [class*="dxgvControl"] { max-width: 100% !important; border-radius: 10px; overflow: hidden; background: #fff; }
.dxgvTable, [class*="dxgvTable"] { width: 100% !important; }
.dxgvHeader, [class*="dxgvHeader"] { padding: 12px 10px !important; color: var(--sv-ink) !important; background: #f8fafd !important; font-weight: 650 !important; }
.dxgvDataRow td, [class*="dxgvDataRow"] td { padding: 11px 10px !important; border-color: #e5ebf3 !important; }
.dxbButton, [class*="dxbButton"] { border-radius: 6px !important; }
.dxflGroupBox, [class*="dxflGroupBox"] { border-color: var(--sv-line) !important; border-radius: 10px !important; }
.dxflGroupBoxCaption, [class*="dxflGroupBoxCaption"] { color: var(--sv-ink) !important; font-weight: 650 !important; }
.sv-body table { max-width: 100%; }
.sv-body .container, .sv-body .container-fluid { max-width: 100%; }
.sv-body h1, .sv-body h2, .sv-body h3 { color: var(--sv-ink); }
.sv-body input, .sv-body select, .sv-body textarea, .sv-body button { max-width: 100%; }
.sv-body [class*="dxeTextBox"], .sv-body [class*="dxeButtonEdit"], .sv-body [class*="dxflFormLayout"], .sv-body [class*="dxvgControl"] { max-width: 100% !important; }

.sv-staff-body {
    min-height: 100vh;
    background:
        radial-gradient(circle at 12% 10%, rgba(213,154,19,.18), transparent 28rem),
        linear-gradient(145deg, #edf5ff 0%, #f8fbff 52%, #eef4fb 100%);
}
.sv-staff-body form { min-height: 100vh; }
.sv-access-shell { display: grid; min-height: 100vh; place-items: center; padding: 32px 20px; }
.sv-access-card {
    width: min(100%, 560px);
    padding: clamp(28px, 5vw, 48px);
    border: 1px solid rgba(174,193,219,.8);
    border-radius: 18px;
    background: rgba(255,255,255,.97);
    box-shadow: 0 28px 80px rgba(11,52,101,.16);
}
.sv-access-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 34px; color: var(--sv-blue-800); font: 600 17px/1.15 Georgia, "Times New Roman", serif; text-transform: uppercase; }
.sv-access-brand img { width: 66px; height: 72px; object-fit: contain; }
.sv-access-badge { display: inline-flex; margin-bottom: 14px; padding: 6px 10px; border-radius: 999px; color: #795407; background: var(--sv-gold-soft); font-size: 12px; font-weight: 750; letter-spacing: .035em; text-transform: uppercase; }
.sv-access-card h1 { margin: 0; color: var(--sv-ink); font-size: clamp(27px, 5vw, 36px); line-height: 1.13; letter-spacing: -.025em; }
.sv-access-intro { margin: 14px 0 28px; color: var(--sv-text); font-size: 16px; }
.sv-access-form { display: grid; gap: 14px; }
.sv-access-form > label { color: var(--sv-ink); font-size: 14px; font-weight: 700; }
.sv-access-form [class*="dxeTextBox"] { width: 100% !important; min-height: 46px; border-color: #c9d6e6 !important; border-radius: 8px !important; font-size: 16px !important; }
.sv-access-form [class*="dxeEditArea"] { min-height: 44px; padding: 10px 12px !important; font-size: 16px !important; }
.sv-access-submit { min-height: 46px; margin-top: 4px; border: 1px solid var(--sv-blue-700) !important; border-radius: 8px !important; color: #fff !important; background: var(--sv-blue-700) !important; font-weight: 700 !important; }
.sv-access-submit:hover { background: var(--sv-blue-800) !important; }
.sv-access-message { min-height: 22px; color: #b42335; font-size: 14px; font-weight: 600; }
.sv-access-security { margin: 26px 0 0; padding-top: 18px; border-top: 1px solid var(--sv-line); color: var(--sv-muted); font-size: 13px; }

@media (max-width: 1250px) {
    .sv-topbar { grid-template-columns: minmax(265px, 1fr) minmax(300px, 620px) minmax(245px, 1fr); }
    .sv-brand { font-size: 15px; }
    .sv-brand img { width: 58px; height: 67px; }
    .sv-user-tools { gap: 12px; }
    .sv-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
    :root { --sv-header-height: 72px; --sv-sidebar-width: 0px; }
    .sv-topbar { grid-template-columns: auto 1fr auto; gap: 12px; padding: 0 14px; }
    .sv-menu-toggle { display: block; grid-column: 1; }
    .sv-brand { grid-column: 2; gap: 9px; font-size: 12px; }
    .sv-brand img { width: 44px; height: 54px; }
    .sv-search-wrap { grid-column: 1 / -1; position: fixed; z-index: 62; top: 78px; right: 14px; left: 14px; display: none; }
    .sv-search-wrap.is-open { display: flex; }
    .sv-search-wrap input { box-shadow: 0 12px 30px rgba(10,42,83,.18); }
    .sv-user-copy { display: none; }
    .sv-user-tools { grid-column: 3; }
    .sv-avatar { width: 42px; height: 42px; }
    .sv-icon-button { display: none; }
    .sv-sidebar { top: 0; z-index: 80; width: min(320px, 86vw); padding-top: max(14px, env(safe-area-inset-top)); transform: translateX(-105%); }
    .sv-sidebar .sv-nav { padding-top: 12px; }
    .sv-nav a, .sv-sidebar-footer a, .sv-sidebar-footer button { flex-direction: row; justify-content: flex-start; gap: 14px; min-height: 56px; padding: 12px 22px; text-align: left; font-size: 14px; }
    .sv-nav a::before { width: 4px; }
    body.sv-menu-open .sv-sidebar { transform: translateX(0); }
    .sv-sidebar-backdrop { position: fixed; z-index: 75; inset: 0; width: 100%; height: 100%; border: 0; background: rgba(3,24,55,.48); backdrop-filter: blur(2px); }
    body.sv-menu-open .sv-sidebar-backdrop { display: block; }
    body.sv-collapsed { --sv-sidebar-width: 0px; }
    body.sv-collapsed .sv-nav span, body.sv-collapsed .sv-sidebar-footer span { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
    .sv-page-shell { margin-left: 0; }
    .sv-main { padding: 20px 16px 30px; }
    .sv-footer { padding: 12px 16px; }
    #portalCollapse { display: none; }
    .sv-section-header { align-items: flex-start; flex-direction: column; }
    .sv-dashboard-detail { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .sv-brand span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .sv-grid-4, .sv-grid-2 { grid-template-columns: 1fr; }
    .sv-card { padding: 16px; }
    .sv-footer { flex-direction: column; gap: 2px; }
    .dx-menu-container { margin-right: -16px; margin-left: -16px; border-right: 0; border-left: 0; border-radius: 0; }
    .dxgvControl, [class*="dxgvControl"] { display: block !important; width: 100% !important; overflow-x: auto !important; -webkit-overflow-scrolling: touch; }
    .dxgvTable, [class*="dxgvTable"] { min-width: 100%; }
    .sv-card-heading-row { flex-direction: column; }
    .sv-calendar { min-width: 0; }
    .sv-access-shell { align-items: start; padding: 0; }
    .sv-access-card { min-height: 100vh; padding: 28px 20px; border: 0; border-radius: 0; box-shadow: none; }
    .sv-access-brand { margin-bottom: 28px; font-size: 14px; }
    .sv-access-brand img { width: 56px; height: 62px; }
}

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