:root {
  --violet: #665ebf;
  --violet-deep: #5551af;
  --blue: #4197d6;
  --blue-deep: #3587c8;
  --gradient: linear-gradient(111deg, #665ebf 0%, #6270c4 32%, #537acb 56%, #4197d6 100%);
  --ink: #1f2941;
  --ink-soft: #46516b;
  --muted: #7b869f;
  --border: #e8ebf2;
  --surface: #fff;
  --canvas: #f6f8fc;
  --shadow: 0 20px 50px rgba(26, 45, 87, .08);
  --radius: 17px;
}
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--canvas); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.5; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #a1b8fa; outline-offset: 3px; }
svg { display: block; }
.muted { color: var(--muted); }
.brand { display: inline-flex; align-items: center; gap: 12px; font-size: 25px; font-weight: 800; letter-spacing: -.8px; color: var(--ink); white-space: nowrap; }
.brand--light { color: #fff; }
.brand__mark { display: grid; width: 43px; height: 43px; place-items: center; color: #fff; background: var(--gradient); border-radius: 12px; box-shadow: 0 6px 14px rgba(77, 91, 172, .16); }
.brand--light .brand__mark { background: rgba(255, 255, 255, .20); box-shadow: none; }
.brand__mark svg { width: 27px; height: 27px; }
.brand__accent { font-weight: 500; }
.eyebrow { display: inline-block; color: #6960bd; font-size: 10px; font-weight: 800; letter-spacing: 2px; text-transform: uppercase; }
.eyebrow--light { color: rgba(255,255,255,.87); }
.btn { display: inline-flex; justify-content: center; align-items: center; gap: 13px; border: 1px solid transparent; padding: 12px 21px; min-height: 47px; border-radius: 10px; font-weight: 700; font-size: 13px; line-height: 1.2; text-align: center; transition: transform .15s, background .15s, box-shadow .15s; }
.btn:hover { transform: translateY(-1px); }
.btn--primary { color: #fff; background: var(--gradient); box-shadow: 0 8px 18px rgba(82, 109, 195, .2); }
.btn--primary:hover { box-shadow: 0 10px 25px rgba(82, 109, 195, .3); }
.btn--white { color: #5d60be; background: #fff; }
.btn--outline { color: #5e63b5; background: #fff; border-color: #d9deef; }
.btn--full { width: 100%; }
.stack-form { display: grid; gap: 10px; }
.stack-form label { margin-top: 7px; color: #3e4960; font-size: 12px; font-weight: 700; }
.stack-form input, .stack-form select { width: 100%; height: 47px; min-width: 0; padding: 0 14px; color: #263250; background: #fbfcff; border: 1px solid #dfe4ee; border-radius: 9px; outline: none; transition: border-color .15s, box-shadow .15s; }
.stack-form input:focus, .stack-form select:focus { border-color: #7a8cdf; box-shadow: 0 0 0 3px rgba(102,94,191,.12); }
.stack-form input::placeholder { color: #a7b0c1; }
.stack-form .btn { margin-top: 13px; }
.input-wrap { position: relative; }
.input-wrap input { padding-right: 80px; }
.input-toggle { position: absolute; top: 7px; right: 7px; min-height: 33px; padding: 0 9px; border: 0; color: #696bb1; background: transparent; border-radius: 7px; font-size: 11px; font-weight: 700; }
.input-toggle:hover { background: #f0f0fc; }
.notice { padding: 12px 14px; border-radius: 10px; font-size: 13px; line-height: 1.5; margin: 14px 0 18px; }
.notice--error { color: #ad3741; background: #fff1f1; border: 1px solid #f3cacc; }
.notice--success { color: #196b50; background: #eaf9f1; border: 1px solid #cbeedd; }

/* LOGIN: corrected full-screen split layout (visual left, form right) */
.login-page { background: #f7f8fc; }
.login-shell { position: relative; display: grid; grid-template-columns: minmax(0, 1.14fr) minmax(430px, .86fr); min-height: 100dvh; background: #fff; }
.login-glow { display: none !important; }
.login-story { min-height: 100dvh; position: relative; isolation: isolate; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 42px clamp(34px, 5vw, 90px) 34px; color: #fff; background: var(--gradient); }
.login-story::before { content: ''; position: absolute; inset: -18% auto auto -28%; width: 88%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.14), transparent 66%); z-index: -1; }
.login-story::after { content: ''; position: absolute; width: 460px; height: 460px; right: -185px; bottom: -230px; border: 1px solid rgba(255,255,255,.18); border-radius: 50%; }
.login-visual { pointer-events: none; position: absolute; inset: 8% -5% 11% 2%; opacity: .76; }
.geo-illustration { width: 100%; height: 100%; object-fit: contain; }
.story-copy { position: relative; z-index: 1; max-width: 560px; margin: auto 0 28px; }
.story-copy h1 { margin: 16px 0 16px; line-height: 1.08; letter-spacing: -2px; font-size: clamp(38px, 4vw, 66px); font-weight: 820; }
.story-copy p { max-width: 460px; color: rgba(255,255,255,.86); font-size: 15px; line-height: 1.8; }
.story-pill { display: inline-flex; align-items: center; gap: 10px; margin-top: 26px; padding: 11px 15px; border: 1px solid rgba(255,255,255,.30); border-radius: 999px; background: rgba(255,255,255,.10); font-size: 11px; font-weight: 700; backdrop-filter: blur(8px); }
.live-dot { width: 7px; height: 7px; background: #d6fce6; border-radius: 50%; box-shadow: 0 0 0 4px rgba(214,252,230,.17); }
.story-footer { position: relative; z-index: 1; color: rgba(255,255,255,.72); font-size: 11px; letter-spacing: .2px; }
.login-pane { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 48px clamp(28px, 5vw, 80px); background: linear-gradient(180deg, #ffffff 0%, #fafbff 100%); border-left: 1px solid #edf0f7; }
.login-card { width: 100%; max-width: 470px; padding: 38px 34px 32px; background: #fff; border: 1px solid #e8ebf2; border-radius: 24px; box-shadow: 0 24px 60px rgba(35, 48, 84, .08); }
.card-pin { display: grid; place-items: center; width: 58px; height: 58px; margin-bottom: 24px; color: #fff; border-radius: 16px; background: var(--gradient); box-shadow: 0 14px 30px rgba(84, 106, 194, .24); }
.card-pin svg { width: 31px; height: 31px; }
.login-card h2 { margin: 8px 0 6px; font-size: clamp(30px, 3vw, 38px); letter-spacing: -1.5px; line-height: 1.15; }
.login-card .intro { font-size: 13px; margin-bottom: 25px; line-height: 1.75; }
.login-card .stack-form { gap: 12px; }
.login-card .stack-form input { height: 52px; }
.login-card .btn { min-height: 54px; margin-top: 22px; font-size: 13px; }
.login-bottom { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border); color: #949caf; font-size: 11px; }
.lock-icon { font-size: 8px; color: #62b59d; }
.login-support { width: 100%; max-width: 470px; margin-top: 18px; color: #abb3c2; text-align: center; font-size: 11px; }

/* ADMIN DASHBOARD */
.admin-layout { display: grid; grid-template-columns: 255px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; padding: 30px 18px 19px; background: var(--surface); border-right: 1px solid var(--border); z-index: 5; }
.sidebar-logo { padding: 1px 13px 0; }
.sidebar .brand { font-size: 22px; }
.sidebar .brand__mark { width: 39px; height: 39px; }
.sidebar-tag { margin: 9px 0 43px 66px; color: #a4a9b9; font-size: 9px; font-weight: 800; letter-spacing: 1.75px; }
.side-nav { display: grid; gap: 6px; }
.nav-caption { color: #a2aabd; margin: 0 14px 13px; font-size: 10px; letter-spacing: 1.5px; font-weight: 800; }
.nav-link { display: flex; gap: 12px; align-items: center; border-radius: 10px; padding: 13px 13px; color: #737d96; font-size: 13px; font-weight: 650; transition: background .12s, color .12s; }
.nav-link:hover { color: #5656af; background: #f7f7fd; }
.nav-link--active { color: #625cb6; background: linear-gradient(90deg, #f1f0ff, #f6f8ff); }
.nav-icon { display: grid; width: 20px; flex: 0 0 20px; place-items: center; font-size: 21px; line-height: 1; }
.sidebar-bottom { margin-top: auto; border-top: 1px solid var(--border); padding-top: 19px; }
.sidebar-account { display: flex; align-items: center; gap: 10px; padding: 4px 9px 13px; }
.account-avatar { display: grid; place-items: center; width: 39px; height: 39px; flex: 0 0 39px; background: linear-gradient(135deg, #efecff, #ddf0ff); color: #6763b9; border-radius: 12px; font-size: 16px; font-weight: 850; }
.account-info strong, .account-info small { display: block; }
.account-info strong { color: #313a52; font-size: 12px; overflow-wrap: anywhere; }
.account-info small { color: #929ab1; font-size: 11px; }
.logout-form { margin: 0; }
.logout-btn { display: flex; align-items: center; justify-content: space-between; width: 100%; margin-top: 8px; padding: 12px; border: none; background: #fafbfe; color: #828ba5; border-radius: 9px; font-size: 12px; font-weight: 650; }
.logout-btn:hover { background: #f0f2fa; color: #5f61b4; }
.main-shell { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 15px; min-height: 83px; padding: 0 clamp(24px, 3.3vw, 60px); border-bottom: 1px solid var(--border); background: #fff; }
.topbar-breadcrumb { font-size: 12px; color: #96a0b3; }
.topbar-breadcrumb span { margin: 0 9px; color: #c0c8d4; }
.topbar-breadcrumb strong { color: #48526c; }
.topbar-right { display: flex; align-items: center; gap: 23px; }
.topbar-status { display: flex; align-items: center; gap: 8px; color: #8293a7; font-size: 11px; }
.topbar-status i { width: 7px; height: 7px; background: #4fbe98; border-radius: 50%; }
.topbar-user { color: #414d68; font-weight: 750; font-size: 12px; }
.nav-toggle { display: none; border: none; color: #4b539c; background: transparent; font-size: 22px; }
.content { width: 100%; max-width: 1600px; flex: 1; margin: 0 auto; padding: 31px clamp(24px, 3.3vw, 60px) 50px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 27px; }
.page-heading h1 { margin: 5px 0 3px; color: #212d47; letter-spacing: -.7px; font-size: 29px; }
.page-heading p { font-size: 13px; margin: 0; }
.welcome-panel { position: relative; overflow: hidden; isolation: isolate; min-height: 240px; display: flex; align-items: center; padding: 30px clamp(25px, 4.4vw, 61px); border-radius: 20px; background: var(--gradient); color: #fff; box-shadow: 0 20px 35px rgba(74, 113, 205, .16); }
.welcome-content { position: relative; z-index: 1; max-width: 540px; }
.welcome-panel h2 { margin: 8px 0 7px; font-size: clamp(25px, 2.5vw, 33px); font-weight: 800; letter-spacing: -.75px; }
.welcome-panel p { margin: 0 0 22px; max-width: 425px; color: rgba(255,255,255,.86); line-height: 1.7; font-size: 13px; }
.welcome-map { width: min(50%, 430px); position: absolute; right: 0; top: -55%; height: 200%; opacity: .62; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 18px; margin: 22px 0; }
.stat-card { min-width: 0; background: #fff; border: 1px solid var(--border); border-radius: 15px; padding: 20px; box-shadow: 0 7px 20px rgba(31,42,80,.025); }
.stat-upper { display: flex; align-items: center; gap: 11px; }
.stat-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: #f0f1ff; color: #6764c5; font-size: 23px; }
.stat-caption { color: #8994ab; font-size: 11px; font-weight: 700; }
.stat-value { margin: 17px 0 4px; font-size: 31px; line-height: 1; font-weight: 800; letter-spacing: -1px; }
.stat-details { margin-top: 10px; color: #a3acbd; font-size: 11px; }
.panel-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(290px, 1fr); gap: 20px; }
.panel { min-width: 0; padding: 25px; border: 1px solid var(--border); border-radius: 15px; background: #fff; box-shadow: 0 8px 23px rgba(31,42,80,.025); }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.panel h3 { margin: 0 0 4px; font-size: 17px; letter-spacing: -.25px; }
.panel-head p { margin: 0; font-size: 11px; }
.text-link { color: #6464b9; font-size: 11px; font-weight: 750; white-space: nowrap; }
.empty-block { text-align: center; display: grid; place-items: center; justify-items: center; min-height: 265px; padding: 24px; }
.empty-block h4 { margin: 8px 0 0; color: #414961; font-size: 14px; }
.empty-block p { color: #9da6b8; font-size: 12px; line-height: 1.65; }
.empty-block .btn { margin-top: 10px; }
.empty-icon { display: grid; place-items: center; width: 58px; height: 58px; background: #f0f0ff; border-radius: 18px; color: #7569c7; font-size: 36px; }
.quick-links { display: grid; }
.quick-links a { display: flex; align-items: center; gap: 13px; border-bottom: 1px solid #f0f1f5; padding: 15px 0; }
.quick-links a:last-child { border-bottom: none; }
.quick-links a > span { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: #f2f4ff; color: #6d6bc0; font-size: 24px; flex: 0 0 38px; }
.quick-links a > div { flex: 1; }
.quick-links strong { display: block; color: #4a5570; font-size: 12px; }
.quick-links small { color: #9ea7b8; font-size: 11px; }
.quick-links b { color: #8d91ac; font-size: 17px; font-weight: 500; }
.quick-links a:hover strong { color: #6560bb; }
.workspace-grid { display: grid; grid-template-columns: minmax(300px, .9fr) minmax(0, 1.6fr); gap: 20px; align-items: start; }
.workspace-grid .stack-form { gap: 9px; }
.form-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-pair label { display: block; margin-bottom: 9px; }
.field-hint { color: #98a1b4; font-size: 11px; margin: 4px 0; }
.table-scroll { width: 100%; overflow-x: auto; }
.data-table { width: 100%; min-width: 450px; border-collapse: collapse; text-align: left; }
.data-table th { padding: 12px 12px 15px; border-bottom: 1px solid var(--border); color: #99a4b8; font-size: 10px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; }
.data-table td { padding: 17px 12px; border-bottom: 1px solid #eef0f5; color: #7b8499; font-size: 11px; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.table-name { color: #34415d; font-size: 12px; font-weight: 740; }
.tiny-muted { margin-top: 3px; color: #a1aab9; font-size: 10px; }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 6px; font-size: 10px; font-weight: 800; }
.status::before { content: ''; width: 5px; height: 5px; background: currentColor; border-radius: 50%; }
.status--active { color: #218864; background: #ebf8f2; }
.status--draft { color: #ac8650; background: #fcf5e8; }
.actions-cell { white-space: nowrap; }
.action-link { color: #6362b7; padding: 4px; font-size: 11px; font-weight: 750; border: none; background: transparent; }
.action-link:hover { text-decoration: underline; }
.action-link--danger { color: #b55d64; }
.inline-form { display: inline; }
.profile-dl { display: grid; grid-template-columns: 1fr 1.5fr; gap: 15px; padding: 12px 0; font-size: 12px; }
.profile-dl dt { color: #959eb0; }
.profile-dl dd { margin: 0; color: #4a5670; font-weight: 750; overflow-wrap: anywhere; }
.security-tip { padding: 17px; border-radius: 12px; background: #f6f6ff; }
.security-tip strong { color: #5f60b5; font-size: 12px; }
.security-tip p { font-size: 11px; line-height: 1.7; color: #8b92ab; margin-bottom: 0; }
.event-tag { display: inline-block; color: #5c5f9d; background: #f2f3fc; border-radius: 5px; padding: 4px 7px; font-size: 10px; }
.audit-detail { max-width: 260px; overflow-wrap: anywhere; }
.app-footer { display: flex; justify-content: space-between; gap: 20px; padding: 17px clamp(24px, 3.3vw, 60px); color: #a2aabb; font-size: 10px; }
@media (max-width: 1250px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-grid { grid-template-columns: 1fr; }
  .workspace-grid { grid-template-columns: 1fr; }
}
@media (max-width: 970px) {
  .login-shell { grid-template-columns: minmax(0, 1fr) minmax(390px, .95fr); }
  .login-story { min-height: 100dvh; padding-left: 32px; padding-right: 28px; }
  .story-copy h1 { font-size: 42px; }
  .admin-layout { grid-template-columns: 77px minmax(0, 1fr); }
  .sidebar { padding: 28px 10px; }
  .sidebar-logo .brand > span:last-child, .sidebar-tag, .nav-caption, .nav-link:not(.nav-link--active) { } 
  .sidebar .brand { font-size: 0; }
  .sidebar .brand__mark { width: 44px; height: 44px; }
  .sidebar-logo { padding: 0 5px; }
  .nav-link { justify-content: center; font-size: 0; padding: 14px 0; }
  .nav-icon { font-size: 22px; }
  .nav-caption { font-size: 0; margin: 0 0 10px; }
  .sidebar-account { justify-content: center; padding: 4px 0 15px; }
  .account-info, .logout-btn { font-size: 0; }
  .logout-btn span { font-size: 18px; }
}
@media (max-width: 690px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-story { min-height: 320px; padding: 25px 25px 30px; }
  .login-story .brand { font-size: 24px; }
  .login-visual { inset: -22% -35% -22% 35%; opacity: .45; }
  .story-copy { margin-top: 42px; margin-bottom: 0; }
  .story-copy h1 { margin: 8px 0; font-size: 30px; letter-spacing: -.9px; }
  .story-copy p { display: none; }
  .story-pill { margin-top: 10px; }
  .story-footer { display: none; }
  .login-pane { min-height: auto; padding: 34px 20px 60px; border-left: none; }
  .login-card { max-width: 460px; padding: 30px 22px 26px; border-radius: 20px; }
  .card-pin { width: 48px; height: 48px; margin-bottom: 20px; }
  .login-card h2 { font-size: 31px; }
  .login-support { margin-top: 20px; }
  .admin-layout { display: block; }
  .sidebar { position: fixed; width: 260px; height: 100dvh; left: 0; top: 0; transform: translateX(-105%); box-shadow: 20px 0 40px rgba(30,38,80,.1); transition: transform .2s; }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar .brand { font-size: 22px; }
  .sidebar .brand__mark { width: 39px; height: 39px; }
  .sidebar-logo .brand > span:last-child { font-size: 22px; }
  .sidebar-tag { font-size: 9px; margin-left: 60px; }
  .nav-caption { font-size: 10px; margin: 0 14px 13px; }
  .nav-link { justify-content: flex-start; font-size: 13px; padding: 13px; }
  .sidebar-account { justify-content: flex-start; padding: 4px 9px 13px; }
  .account-info { display: block; font-size: 12px; }
  .logout-btn { font-size: 12px; }
  .topbar { min-height: 68px; padding: 0 19px; }
  .topbar-right { gap: 12px; }
  .topbar-status { display: none; }
  .nav-toggle { display: block; }
  .content { padding: 24px 18px 34px; }
  .page-heading h1 { font-size: 26px; }
  .welcome-panel { padding: 25px; min-height: 220px; }
  .welcome-map { width: 65%; right: -100px; }
  .welcome-panel h2 { font-size: 26px; }
  .welcome-panel p { max-width: 280px; }
  .stats-grid { gap: 10px; }
  .stat-card { padding: 15px; }
  .stat-value { font-size: 27px; }
  .panel { padding: 20px 16px; }
  .app-footer { padding: 17px 20px; }
}
@media (max-width: 380px) {
  .stats-grid { grid-template-columns: 1fr; }
  .form-pair { grid-template-columns: 1fr; }
  .login-story { min-height: 280px; }
  .story-copy h1 { font-size: 26px; }
  .welcome-map { opacity: .25; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
