/* NEWERA — interface styles. Dark by default, light via [data-theme="light"]. */
/* Brand palette from the NEWERA logo: navy #04265B, blue #006AFD, sky #179CE9, teal #2EC9B0, mint #3CF9D0. Flat colours only. */
:root {
  --bg: #061530;
  --bg-2: #04112A;
  --surface: #0A1D40;
  --surface-2: #0F2650;
  --surface-3: #15305E;
  --line: #1A3462;
  --line-2: #244273;
  --text: #EAF1FF;
  --text-2: #B7C6E2;
  --muted: #8193B5;
  --accent: #1F7BFF;
  --accent-2: #3B8CFF;
  --accent-ink: #FFFFFF;
  --accent-text: #62A6FF;
  --accent-soft: rgba(31, 123, 255, .16);
  --teal: #2FD8BE;
  --teal-soft: rgba(47, 216, 190, .14);
  --info: #2FD8BE;
  --info-soft: rgba(47, 216, 190, .14);
  --ok: #2FD8A0;
  --ok-soft: rgba(47, 216, 160, .14);
  --warn: #F5B544;
  --warn-soft: rgba(245, 181, 68, .14);
  --danger: #FF6B7A;
  --danger-soft: rgba(255, 107, 122, .14);
  --side-bg: #04112A;
  --side-line: #13284F;
  --side-text: #B7C6E2;
  --side-muted: #6F83A8;
  --side-hover: #0B1D40;
  --side-active: #0F2650;
  --side-strong: #FFFFFF;
  --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 10px 30px -18px rgba(0, 0, 0, .6);
  --shadow-lg: 0 24px 64px -20px rgba(0, 0, 0, .7);
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --side-w: 264px;
  --top-h: 68px;
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans Malayalam', 'Noto Sans', Arial, sans-serif;
  --display: 'Montserrat', 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #F4F7FC;
  --bg-2: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #F3F6FB;
  --surface-3: #E9EEF7;
  --line: #E1E7F1;
  --line-2: #CFD8E7;
  --text: #04265B;
  --text-2: #2E4670;
  --muted: #62749A;
  --accent: #006AFD;
  --accent-2: #1A7BFF;
  --accent-ink: #FFFFFF;
  --accent-text: #0058D6;
  --accent-soft: rgba(0, 106, 253, .09);
  --teal: #0FA392;
  --teal-soft: rgba(15, 163, 146, .1);
  --info: #0FA392;
  --info-soft: rgba(15, 163, 146, .1);
  --ok: #0E9467;
  --ok-soft: rgba(14, 148, 103, .1);
  --warn: #B7791F;
  --warn-soft: rgba(183, 121, 31, .1);
  --danger: #D92D42;
  --danger-soft: rgba(217, 45, 66, .08);
  --side-bg: #04265B;
  --side-line: #0E3570;
  --side-text: #C5D5F0;
  --side-muted: #7F9BC8;
  --side-hover: #0A3068;
  --side-active: #0D3A7C;
  --side-strong: #FFFFFF;
  --shadow: 0 1px 2px rgba(4, 38, 91, .05), 0 8px 24px -16px rgba(4, 38, 91, .22);
  --shadow-lg: 0 28px 70px -24px rgba(4, 38, 91, .35);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 500 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  min-height: 100vh; min-height: 100dvh;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
h1, h2, h3, h4 { font-family: var(--display); letter-spacing: -.02em; margin: 0; line-height: 1.2; font-weight: 600; }
p { margin: 0 0 .75em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent); color: #fff; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.i.sm { width: 16px; height: 16px; }
.i.lg { width: 24px; height: 24px; }
.logo-mark { width: 32px; height: 32px; flex: none; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.stack { display: grid; gap: 14px; }
.hidden { display: none !important; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---------- Boot ---------- */
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot-mark .logo-mark { width: 52px; height: 52px; animation: pulse 1.4s ease-in-out infinite; }
.boot-msg { color: var(--muted); text-align: center; }
@keyframes pulse { 50% { transform: scale(.92); opacity: .7; } }

/* ---------- Buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--surface-2); color: var(--text); font-weight: 600; font-size: 14px;
  white-space: nowrap; transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.btn.danger:hover { background: var(--danger); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn.lg { height: 48px; font-size: 15px; border-radius: 12px; }
.icon-btn {
  width: 38px; height: 38px; display: inline-grid; place-items: center; flex: none;
  border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--text-2);
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.sm { width: 30px; height: 30px; border-radius: 8px; }
.icon-btn.on { color: var(--accent-text); }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-soft); }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.field { display: grid; gap: 6px; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 12.5px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; height: 42px; padding: 0 13px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--line-2); color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 110px; padding: 11px 13px; resize: vertical; line-height: 1.55; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238193B5' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-position: right 13px center; background-repeat: no-repeat; padding-right: 36px; }
.input-wrap { position: relative; }
.input-wrap .input { padding-right: 44px; }
.input-wrap .icon-btn { position: absolute; right: 3px; top: 2px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 14px; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; position: absolute; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--line-2); transition: background .2s; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.field > .seg { justify-self: start; max-width: 100%; }
.seg { display: inline-flex; padding: 3px; gap: 3px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line); }
.seg button { border: 0; background: transparent; color: var(--text-2); height: 34px; padding: 0 14px; border-radius: 8px; font-weight: 600; font-size: 13.5px; display: inline-flex; align-items: center; gap: 7px; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
[data-theme="dark"] .seg button.on { background: var(--surface-3); }
.form-error { display: none; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--danger-soft); color: var(--danger); font-size: 13.5px; font-weight: 600; }
.form-error.show { display: flex; }
.meter { height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--danger); transition: width .25s, background .25s; }

/* ---------- Auth screens ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth-art {
  position: relative; overflow: hidden; padding: 44px; display: flex; flex-direction: column; justify-content: space-between; gap: 28px;
  background: #FFFFFF; color: #04265B; border-right: 1px solid #E1E7F1;
}
.auth-art .logo-full { width: min(460px, 100%); height: auto; display: block; }
.auth-art .points { display: grid; gap: 14px; max-width: 440px; }
.auth-art .point { display: flex; gap: 12px; align-items: flex-start; font-size: 14.5px; color: #2E4670; }
.auth-art .point b { display: block; color: #04265B; font-size: 15px; }
.auth-art .point .ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; background: #EAF2FF; color: #006AFD; }
.auth-art .point .ic.t { background: #E3F8F4; color: #0FA392; }
.brand { display: flex; align-items: center; gap: 11px; }
.wordmark { font-family: var(--display); font-weight: 700; font-size: 22px; letter-spacing: -.035em; }
.auth-foot { color: #62749A; font-size: 13px; }
.auth-form { display: grid; place-items: center; padding: 40px 24px; background: var(--bg); }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h2 { font-size: 26px; margin-bottom: 6px; }
.auth-card .sub { color: var(--muted); margin-bottom: 26px; }
.auth-card form { display: grid; gap: 16px; }
.auth-card.wide { max-width: 520px; }
.steps { display: flex; gap: 6px; margin-bottom: 22px; }
.steps i { height: 4px; flex: 1; border-radius: 4px; background: var(--line); }
.steps i.on { background: var(--accent); }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.side {
  position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column;
  background: var(--side-bg); border-right: 1px solid var(--side-line); padding: 18px 14px 14px; z-index: 40; color: var(--side-text);
}
.side .brand { padding: 2px 6px 18px; }
.brand-mark { width: 40px; height: 40px; flex: none; border-radius: 11px; background: #FFFFFF; display: grid; place-items: center; }
.brand-mark img { width: 30px; height: 30px; display: block; }
.side .brand .wm { font-family: var(--display); font-weight: 800; font-size: 20px; letter-spacing: -.01em; line-height: 1; color: var(--side-strong); }
.side .brand .wm span { color: #3B9BFF; }
.side .brand .tagline { display: block; font-size: 9.5px; letter-spacing: .14em; font-weight: 700; color: var(--side-muted); margin-top: 4px; text-transform: uppercase; }
.side .brand .company { display: block; font-size: 12px; color: var(--side-text); font-weight: 600; margin-top: 3px; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { display: grid; gap: 2px; align-content: start; overflow-y: auto; flex: 1; margin: 0 -6px; padding: 0 6px; scrollbar-width: thin; scrollbar-color: var(--side-line) transparent; }
.nav-group { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--side-muted); font-weight: 700; padding: 13px 10px 5px; display: flex; align-items: center; gap: 6px; }
.nav-group button { margin-left: auto; width: 22px; height: 22px; border-radius: 6px; border: 0; background: transparent; color: var(--side-muted); display: grid; place-items: center; }
.nav-group button:hover { background: var(--side-hover); color: var(--side-strong); }
.nav a {
  display: flex; align-items: center; gap: 12px; height: 37px; padding: 0 10px; border-radius: 10px;
  color: var(--side-text); font-weight: 600; font-size: 14px; text-decoration: none; position: relative;
}
.nav a span.lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.nav a:hover { background: var(--side-hover); color: var(--side-strong); text-decoration: none; }
.nav a.on { background: var(--side-active); color: var(--side-strong); }
.nav a.on::before { content: ''; position: absolute; left: -6px; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: #3CF9D0; }
.nav a.on .i { color: #3CF9D0; }
.nav .count { margin-left: auto; font-size: 11.5px; color: var(--side-muted); font-weight: 600; }
.side-foot { border-top: 1px solid var(--side-line); margin: 10px -14px 0; padding: 12px 14px 0; }
.me { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 12px; width: 100%; background: transparent; border: 0; text-align: left; color: var(--side-strong); }
.me small { color: var(--side-muted) !important; }
.me:hover { background: var(--side-hover); }
.me small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me b { display: block; font-size: 14px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me small { color: var(--muted); font-size: 12px; }
.avatar {
  width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex: none;
  font-family: var(--display); font-weight: 600; font-size: 13.5px; letter-spacing: 0;
  background: var(--info-soft); color: var(--info);
}
.avatar.admin { background: var(--accent-soft); color: var(--accent-text); }
.side .avatar { background: #0F3B7A; color: #3CF9D0; }
.side .avatar.admin { background: #006AFD; color: #FFFFFF; }
.avatar.lg { width: 56px; height: 56px; border-radius: 16px; font-size: 20px; }

.side-backdrop { display: none; }
.main-wrap { min-width: 0; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 30; height: var(--top-h); display: flex; align-items: center; gap: 14px;
  padding: 0 28px; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.hello { min-width: 0; }
.hello b { font-family: var(--display); font-weight: 600; font-size: 17px; letter-spacing: -.02em; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hello small { color: var(--muted); font-size: 12.5px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-trigger {
  margin-left: auto; width: min(420px, 42vw); height: 42px; display: flex; align-items: center; gap: 10px; padding: 0 8px 0 14px;
  border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); color: var(--muted); font-weight: 500; font-size: 14px; text-align: left;
}
.search-trigger:hover { border-color: var(--accent); color: var(--text-2); }
.search-trigger span { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
kbd { font: 600 11.5px/1 var(--font); padding: 4px 6px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 4px; }
.menu-btn { display: none; }
.role-badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 99px; font-size: 11.5px; font-weight: 700; background: var(--info-soft); color: var(--info); }
.role-badge.admin { background: var(--accent-soft); color: var(--accent-text); }

.main { padding: 28px 28px 110px; width: 100%; max-width: 1320px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; }
.page-head p { color: var(--muted); margin: 4px 0 0; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.section { margin-top: 30px; }
.section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.section-head h2 { font-size: 16px; font-weight: 600; }
.section-head .i { color: var(--muted); }
.section-head .more { margin-left: auto; font-size: 13px; font-weight: 600; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.panel-pad { padding: 20px; }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.panel-head h3 { font-size: 15px; }
.panel-head .actions { margin-left: auto; display: flex; gap: 6px; }

/* ---------- Home hero ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 22px; padding: 30px 30px 26px; margin-bottom: 8px;
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent);
}
.hero .date { color: var(--muted); font-size: 13.5px; font-weight: 600; }
.hero h1 { font-size: clamp(26px, 3vw, 36px); margin: 4px 0 18px; letter-spacing: -.035em; }
.ask {
  display: flex; align-items: center; gap: 10px; max-width: 720px; padding: 6px 6px 6px 16px; border-radius: 14px;
  background: var(--bg); border: 1px solid var(--line-2);
}
[data-theme="light"] .ask { background: var(--surface-2); }
.ask:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ask .i { color: var(--accent-text); }
.ask input { flex: 1; min-width: 0; border: 0; background: transparent; height: 42px; outline: none; font-size: 15px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; min-height: 32px; padding: 5px 12px; border-radius: 99px; text-align: left; line-height: 1.3;
  border: 1px solid var(--line-2); background: transparent; color: var(--text-2); font-size: 13px; font-weight: 600;
}
.chip:hover { border-color: var(--accent); color: var(--text); }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip .n { font-size: 11.5px; opacity: .7; }
.notice {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; margin-top: 18px;
  background: var(--accent-soft); color: var(--text); font-size: 14px;
}
.notice .i { color: var(--accent-text); margin-top: 1px; }
.notice.info { background: var(--info-soft); }
.notice.info .i { color: var(--info); }
.notice.danger { background: var(--danger-soft); }
.notice.danger .i { color: var(--danger); }
.notice b { display: block; }

/* ---------- Item cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); gap: 12px; }
.cards.compact { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.card {
  position: relative; display: flex; align-items: center; gap: 12px; min-height: 72px; padding: 13px 14px; min-width: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); color: var(--text); text-decoration: none;
  transition: border-color .15s, background .15s;
}
a.card:hover, .card.link:hover { border-color: var(--line-2); background: var(--surface-2); text-decoration: none; }
.card .body { min-width: 0; flex: 1; }
.card .name { display: block; font-weight: 700; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .desc { display: block; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .tools { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); display: flex; gap: 2px; padding: 2px; border-radius: 9px; background: var(--surface-3); box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .15s; }
.card:hover .tools, .card:focus-within .tools { pointer-events: auto; }
.card:hover .tools, .card:focus-within .tools { opacity: 1; }
.card .pin-dot { position: absolute; top: 8px; right: 8px; color: var(--accent-text); }
.card .pin-dot .i { width: 13px; height: 13px; }
.fav {
  width: 40px; height: 40px; border-radius: 11px; flex: none; display: grid; place-items: center; overflow: hidden;
  background: var(--surface-3); border: 1px solid var(--line); font-family: var(--display); font-weight: 600; font-size: 14px; color: var(--text-2);
}
.fav img { width: 22px; height: 22px; object-fit: contain; }
.fav.prompt { background: var(--info-soft); color: var(--info); border-color: transparent; }
.fav.doc { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.dept-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.dept { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px; }
.dept-head { display: flex; align-items: center; gap: 10px; padding: 2px 2px 10px; }
.dept-head .ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); }
.dept-head h3 { font-size: 14.5px; font-family: var(--font); font-weight: 700; letter-spacing: 0; }
.dept-head .n { color: var(--muted); font-size: 12.5px; margin-left: auto; }
.dept-list { display: grid; gap: 6px; }
.dept-list .card { min-height: 56px; padding: 9px 10px; border-radius: 10px; background: var(--surface-2); border-color: transparent; }
.dept-list .card:hover { border-color: var(--line-2); }
.dept-list .fav { width: 34px; height: 34px; border-radius: 9px; }
.dept-empty { color: var(--muted); font-size: 13px; padding: 10px 4px 4px; }

.prompt-card { display: flex; flex-direction: column; gap: 10px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.prompt-card h3 { font-size: 15px; font-family: var(--font); font-weight: 700; letter-spacing: 0; display: flex; gap: 8px; align-items: center; }
.prompt-card .text { color: var(--text-2); font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; }
.prompt-card .foot { display: flex; gap: 6px; align-items: center; margin-top: auto; flex-wrap: wrap; }
.prompt-card .foot .admin-tools { margin-left: auto; display: flex; gap: 2px; }
.prompt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); font-size: 12px; font-weight: 600; }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.danger { background: var(--danger-soft); color: var(--danger); }
.tag.accent { background: var(--accent-soft); color: var(--accent-text); }
.tag.info { background: var(--info-soft); color: var(--info); }

.empty { text-align: center; padding: 42px 20px; border: 1px dashed var(--line-2); border-radius: var(--r-lg); color: var(--muted); }
.empty .i { width: 32px; height: 32px; color: var(--text-2); margin-bottom: 8px; }
.empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }
.empty .btn { margin-top: 14px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.filter-input { position: relative; flex: 1; min-width: 220px; max-width: 420px; }
.filter-input .i { position: absolute; left: 12px; top: 11px; color: var(--muted); }
.filter-input .input { padding-left: 40px; }

/* ---------- Knowledge ---------- */
.doc-list { display: grid; gap: 8px; }
.doc-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); cursor: pointer; text-align: left; width: 100%; color: var(--text); }
.doc-row:hover { border-color: var(--line-2); background: var(--surface-2); }
.doc-row .body { flex: 1; min-width: 0; }
.doc-row b { display: block; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-row small { color: var(--muted); font-size: 12.5px; }
.snippet { color: var(--text-2); font-size: 13px; margin-top: 3px; display: block; }
mark { background: var(--accent-soft); color: var(--accent-text); border-radius: 3px; padding: 0 1px; }
.dropzone { border: 1.5px dashed var(--line-2); border-radius: var(--r-lg); padding: 26px; text-align: center; color: var(--muted); transition: border-color .15s, background .15s; }
.dropzone.drag { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.dropzone .i { width: 30px; height: 30px; color: var(--accent-text); }
.upload-list { display: grid; gap: 6px; margin-top: 12px; }
.upload-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; background: var(--surface-2); font-size: 13.5px; }
.upload-item .st { margin-left: auto; font-size: 12.5px; font-weight: 600; }
.reader { white-space: pre-wrap; font-size: 14px; line-height: 1.7; color: var(--text-2); max-height: 62vh; overflow: auto; padding-right: 6px; }

/* ---------- Chat ---------- */
.chat-page { height: calc(100vh - var(--top-h) - 56px); height: calc(100dvh - var(--top-h) - 56px); min-height: 460px; }
.chat { display: flex; flex-direction: column; height: 100%; min-height: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.chat-head .av { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.chat-head b { display: block; font-size: 14.5px; }
.chat-head small { color: var(--muted); font-size: 12px; }
.chat-head .tools { margin-left: auto; display: flex; gap: 2px; }
.msgs { flex: 1; overflow-y: auto; padding: 20px 18px; display: flex; flex-direction: column; gap: 16px; scroll-behavior: smooth; }
.msg { display: flex; gap: 10px; max-width: 100%; }
.msg .bubble { padding: 11px 14px; border-radius: 14px; font-size: 14.5px; line-height: 1.6; min-width: 0; overflow-wrap: anywhere; }
.msg.user { justify-content: flex-end; }
.msg.user .bubble { background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; max-width: 82%; white-space: pre-wrap; font-weight: 600; }
.msg.ai .bubble { background: var(--surface-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; max-width: 92%; }
.msg.ai .av { width: 28px; height: 28px; border-radius: 8px; flex: none; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); margin-top: 2px; }
.msg.ai .av .i { width: 16px; height: 16px; }
.msg.err .bubble { background: var(--danger-soft); border-color: transparent; color: var(--danger); font-weight: 600; }
.md p { margin: 0 0 .6em; }
.md p:last-child, .md ul:last-child, .md ol:last-child { margin-bottom: 0; }
.md ul, .md ol { margin: .2em 0 .7em; padding-left: 1.25em; }
.md li { margin: .15em 0; }
.md code { font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--surface-3); padding: 1px 5px; border-radius: 5px; }
.md pre { background: var(--bg); border: 1px solid var(--line); padding: 12px; border-radius: 10px; overflow-x: auto; margin: .4em 0 .8em; }
.md pre code { background: none; padding: 0; }
.md h4 { font-family: var(--font); font-size: 14.5px; font-weight: 800; margin: .6em 0 .3em; letter-spacing: 0; }
.md a { word-break: break-all; }
.msg-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.src { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 9px; border-radius: 7px; border: 1px solid var(--line-2); background: transparent; font-size: 12px; font-weight: 600; color: var(--text-2); max-width: 220px; }
.src span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.src:hover { border-color: var(--accent); color: var(--text); }
.typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.chat-empty { margin: auto; text-align: center; max-width: 440px; padding: 10px; }
.chat-empty .big { width: 52px; height: 52px; border-radius: 16px; display: inline-grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); margin-bottom: 12px; }
.chat-empty h3 { font-size: 19px; margin-bottom: 6px; }
.chat-empty p { color: var(--muted); font-size: 14px; }
.suggest { display: grid; gap: 8px; margin-top: 16px; text-align: left; }
.suggest button { padding: 11px 14px; border-radius: 11px; border: 1px solid var(--line-2); background: transparent; color: var(--text-2); font-size: 13.5px; font-weight: 600; text-align: left; }
.suggest button:hover { border-color: var(--accent); color: var(--text); }
.composer { display: flex; align-items: flex-end; gap: 8px; padding: 12px; border-top: 1px solid var(--line); background: var(--surface); }
.composer textarea { flex: 1; resize: none; min-height: 44px; max-height: 180px; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface-2); outline: none; line-height: 1.5; }
.composer textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.composer .send { width: 44px; height: 44px; border-radius: 12px; border: 0; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; flex: none; }
.composer .send:disabled { opacity: .45; cursor: not-allowed; }
.composer .send.stop { background: var(--surface-3); color: var(--text); }
.chat-note { font-size: 11.5px; color: var(--muted); text-align: center; padding: 0 12px 10px; background: var(--surface); }

.fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 50; height: 52px; padding: 0 20px 0 16px; border-radius: 16px; border: 0;
  display: inline-flex; align-items: center; gap: 9px; font-weight: 700; font-size: 14.5px;
  background: var(--accent); color: var(--accent-ink); box-shadow: 0 12px 28px -12px rgba(0, 60, 160, .55);
  transition: transform .15s;
}
.fab:hover { transform: translateY(-2px); }
.drawer {
  position: fixed; right: 22px; bottom: 22px; z-index: 60; width: min(440px, calc(100vw - 32px)); height: min(680px, calc(100dvh - 44px));
  display: none; box-shadow: var(--shadow-lg); border-radius: var(--r-lg);
}
.drawer.open { display: block; animation: pop .18s ease-out; }
@keyframes pop { from { transform: translateY(12px) scale(.98); opacity: 0; } }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12.5px; font-weight: 700; color: var(--muted); padding: 11px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.click { cursor: pointer; }
.table tbody tr.click:hover td { background: var(--surface-2); }
.table .user-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.table .user-cell b { display: block; font-size: 14px; }
.table .user-cell small { color: var(--muted); font-size: 12.5px; }
.table td.actions { text-align: right; white-space: nowrap; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); margin-right: 6px; vertical-align: middle; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.pager { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.pager .btn { margin-left: 4px; }
.pager .first { margin-left: auto; }

/* ---------- Admin overview ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat { padding: 18px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); }
.stat .k { color: var(--muted); font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.stat .v { font-family: var(--display); font-size: 30px; font-weight: 600; letter-spacing: -.03em; margin-top: 6px; }
.stat .s { font-size: 12.5px; color: var(--muted); }
.two-col { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 14px; margin-top: 14px; align-items: start; }
.chart { width: 100%; height: 210px; display: block; }
.chart .bar-a { fill: var(--accent); }
.chart .bar-b { fill: var(--teal); }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); font-weight: 600; }
.chart .grid { stroke: var(--line); stroke-dasharray: 3 4; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.feed { display: grid; }
.feed-row { display: flex; gap: 12px; padding: 11px 20px; border-bottom: 1px solid var(--line); font-size: 13.5px; align-items: flex-start; }
.feed-row:last-child { border-bottom: 0; }
.feed-row .ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); flex: none; }
.feed-row .ic .i { width: 15px; height: 15px; }
.feed-row .t { color: var(--muted); font-size: 12px; margin-left: auto; white-space: nowrap; padding-left: 8px; }
.feed-row .what { min-width: 0; }
.feed-row .what small { display: block; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; }
.checklist { display: grid; gap: 2px; }
.check-row { display: flex; align-items: center; gap: 12px; padding: 12px 20px; font-size: 14px; }
.check-row .ic { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--ok-soft); color: var(--ok); }
.check-row.todo .ic { background: var(--accent-soft); color: var(--accent-text); }
.check-row .ic .i { width: 14px; height: 14px; }
.check-row small { display: block; color: var(--muted); font-size: 12.5px; }
.check-row .btn { margin-left: auto; }
.bar-list { display: grid; gap: 12px; padding: 16px 20px; }
.bar-item { display: grid; gap: 6px; font-size: 13.5px; }
.bar-item .row { justify-content: space-between; }
.bar-track { height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.bar-track i { display: block; height: 100%; border-radius: 6px; background: var(--accent); }

/* ---------- Settings ---------- */
.settings { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 22px; align-items: start; }
.tabs { display: grid; gap: 2px; position: sticky; top: calc(var(--top-h) + 20px); }
.tabs .group { font-size: 12px; color: var(--muted); font-weight: 600; padding: 14px 12px 6px; }
.tabs button { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px; border-radius: 10px; border: 0; background: transparent; color: var(--text-2); font-weight: 600; font-size: 14px; text-align: left; }
.tabs button:hover { background: var(--surface); color: var(--text); }
.tabs button.on { background: var(--surface-2); color: var(--text); }
.tabs button.on .i { color: var(--accent-text); }
.set-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); margin-bottom: 16px; }
.set-card > header { padding: 18px 22px 0; }
.set-card > header h3 { font-size: 16px; }
.set-card > header p { color: var(--muted); font-size: 13.5px; margin: 4px 0 0; }
.set-body { padding: 18px 22px 22px; display: grid; gap: 16px; }
.set-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; align-items: center; }
.set-row { display: flex; align-items: center; gap: 16px; justify-content: space-between; }
.set-row .txt b { display: block; font-size: 14px; }
.set-row .txt small { color: var(--muted); font-size: 13px; }
.theme-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.theme-card { border: 1.5px solid var(--line-2); border-radius: 14px; padding: 10px; background: transparent; text-align: left; color: var(--text); }
.theme-card.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.theme-card .pv { height: 74px; border-radius: 9px; margin-bottom: 9px; display: grid; grid-template-columns: 28% 1fr; overflow: hidden; border: 1px solid var(--line); }
.theme-card .pv.dark { background: #0A1D40; }
.theme-card .pv.dark i { background: #04112A; }
.theme-card .pv.light { background: #FFFFFF; }
.theme-card .pv.light i { background: #04265B; }
.theme-card .pv.sys { background: #FFFFFF; }
.theme-card .pv.sys i { background: #04265B; }
.theme-card .pv b { margin: 12px; height: 8px; border-radius: 4px; background: #006AFD; width: 50%; }
.theme-card span { font-weight: 700; font-size: 14px; display: flex; gap: 7px; align-items: center; }
.key-box { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13.5px; }
.key-box code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.dept-edit { display: grid; gap: 8px; }
.dept-edit .row { background: var(--surface-2); border-radius: 10px; padding: 6px 6px 6px 10px; }
.dept-edit .input, .dept-edit .select { height: 36px; }
.dept-edit .select { max-width: 150px; }
.sec-list { display: grid; gap: 10px; }
.sec-item { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; }
.sec-item .ic { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--ok-soft); color: var(--ok); }
.sec-item.warn .ic { background: var(--accent-soft); color: var(--accent-text); }
.sec-item .ic .i { width: 14px; height: 14px; }
.sec-item small { display: block; color: var(--muted); font-size: 12.5px; }

/* ---------- Modal, menu, toast ---------- */
.overlay { position: fixed; inset: 0; z-index: 100; background: rgba(2, 10, 26, .66); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); display: grid; place-items: center; padding: 20px; animation: fade .15s ease-out; }
[data-theme="light"] .overlay { background: rgba(4, 38, 91, .35); }
@keyframes fade { from { opacity: 0; } }
.modal { width: 100%; max-width: 520px; max-height: calc(100dvh - 40px); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-lg); animation: pop .18s ease-out; }
.modal.wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px 14px; }
.modal-head h3 { font-size: 18px; }
.modal-head p { color: var(--muted); font-size: 13.5px; margin: 2px 0 0; }
.modal-head .icon-btn { margin-left: auto; }
.modal-body { padding: 4px 20px 20px; overflow-y: auto; display: grid; gap: 14px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line); align-items: center; }
.modal-foot .left { margin-right: auto; }
.cred { display: grid; gap: 8px; padding: 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-size: 14px; }
.cred code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13.5px; }

.pop-menu { position: fixed; z-index: 120; min-width: 220px; padding: 6px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--shadow-lg); animation: pop .12s ease-out; }
.pop-menu .hd { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.pop-menu .hd b { display: block; font-size: 14px; }
.pop-menu .hd small { color: var(--muted); font-size: 12.5px; }
.pop-menu button { width: 100%; display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 10px; border: 0; border-radius: 9px; background: transparent; color: var(--text-2); font-weight: 600; font-size: 14px; text-align: left; }
.pop-menu button:hover { background: var(--surface-2); color: var(--text); }
.pop-menu button.danger:hover { color: var(--danger); background: var(--danger-soft); }

#toast-root { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 200; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: 12px; background: var(--text); color: var(--bg); font-weight: 700; font-size: 14px; box-shadow: var(--shadow-lg); animation: pop .18s ease-out; pointer-events: auto; max-width: min(520px, calc(100vw - 32px)); }
.toast.err { background: var(--danger); color: #fff; }
.toast .i { width: 18px; height: 18px; }

/* ---------- Command palette ---------- */
.palette-wrap { align-items: start; padding-top: 10vh; }
.palette { width: 100%; max-width: 680px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 20px; box-shadow: var(--shadow-lg); overflow: hidden; display: flex; flex-direction: column; max-height: 76vh; animation: pop .15s ease-out; }
.palette-top { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.palette-top .i { color: var(--accent-text); }
.palette-top input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font-size: 17px; height: 32px; }
.palette-filters { display: flex; gap: 6px; padding: 10px 16px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.palette-filters::-webkit-scrollbar { display: none; }
.palette-filters .chip { height: 28px; flex: none; }
.palette-list { overflow-y: auto; padding: 6px 8px 10px; flex: 1; }
.p-group { font-size: 12px; color: var(--muted); font-weight: 700; padding: 12px 10px 5px; display: flex; justify-content: space-between; }
.p-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; border-radius: 11px; border: 0; background: transparent; color: var(--text); text-align: left; }
.p-item.sel { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--accent); }
.p-item .fav { width: 34px; height: 34px; border-radius: 9px; }
.p-item .body { flex: 1; min-width: 0; }
.p-item b { display: block; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-item small { display: block; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-item .kind { font-size: 11.5px; color: var(--muted); font-weight: 700; flex: none; }
.p-item .go { color: var(--muted); opacity: 0; }
.p-item.sel .go { opacity: 1; }
.palette-foot { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); font-weight: 600; flex-wrap: wrap; }
.palette-foot span { display: inline-flex; gap: 6px; align-items: center; }
.p-empty { padding: 36px 20px; text-align: center; color: var(--muted); }
.p-empty b { display: block; color: var(--text); margin-bottom: 4px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); transform: translateX(-102%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
  .side.open { transform: none; }
  .side-backdrop { position: fixed; inset: 0; z-index: 35; background: rgba(4, 7, 16, .55); }
  .side-backdrop.open { display: block; }
  .menu-btn { display: inline-grid; margin-left: -8px; }
  .top { padding: 0 16px; gap: 8px; }
  .search-trigger { width: 42px; padding: 0; justify-content: center; margin-left: auto; }
  .search-trigger span, .search-trigger kbd { display: none; }
  .main { padding: 20px 16px 110px; }
  .settings { grid-template-columns: minmax(0, 1fr); }
  .tabs { position: static; display: flex; overflow-x: auto; gap: 6px; padding-bottom: 4px; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs .group { display: none; }
  .tabs button { flex: none; background: var(--surface); border: 1px solid var(--line); height: 38px; }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-art { min-height: 220px; padding: 26px 24px; }
  .auth-art h1 { font-size: 28px; max-width: 16ch; }
  .auth-art p, .auth-foot { display: none; }
  .auth-art::before { bottom: -80vh; }
}
@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .hero { padding: 22px 18px 18px; border-radius: 18px; }
  .page-head h1 { font-size: 22px; }
  .page-head .actions { margin-left: 0; width: 100%; }
  .cards, .cards.compact, .dept-grid, .prompt-grid { grid-template-columns: minmax(0, 1fr); }
  .card .tools { opacity: 1; position: static; transform: none; background: transparent; box-shadow: none; pointer-events: auto; }
  .stats { gap: 10px; }
  .stat { padding: 14px; }
  .stat .v { font-size: 24px; }
  .theme-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .theme-card .pv { height: 52px; }
  .hello small { display: none; }
  .fab { right: 16px; bottom: 16px; padding: 0; width: 54px; justify-content: center; }
  .fab span { display: none; }
  .drawer { inset: 0; width: 100%; height: 100%; border-radius: 0; }
  .drawer .chat { border-radius: 0; border: 0; }
  .chat-page { height: calc(100dvh - var(--top-h) - 40px); }
  .overlay { padding: 0; align-items: end; }
  .modal { max-width: none; border-radius: 20px 20px 0 0; max-height: 92dvh; }
  .palette-wrap { padding-top: 0; align-items: start; }
  .palette { border-radius: 0 0 20px 20px; max-height: 88dvh; }
  .palette-foot { display: none; }
  .table.responsive thead { display: none; }
  .table.responsive tr { display: grid; grid-template-columns: 1fr auto; padding: 12px 14px; border-bottom: 1px solid var(--line); gap: 4px 10px; }
  .table.responsive td { border: 0; padding: 0; }
  .table.responsive td[data-label]:not(.first)::before { content: attr(data-label) ': '; color: var(--muted); font-size: 12px; }
  .table.responsive td.first { grid-column: 1 / -1; }
  .table.responsive td.actions { grid-column: 2; grid-row: 1; }
  .table.responsive td.hide-m { display: none; }
  .feed-row { padding: 10px 14px; }
  .set-body { padding: 16px; }
  .set-card > header { padding: 16px 16px 0; }
  .set-foot { padding: 12px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print { .side, .top, .fab, .drawer { display: none !important; } }

/* ---------- Department hub ---------- */
.hub-head { display: flex; gap: 18px; align-items: center; padding: 22px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); margin-bottom: 22px; flex-wrap: wrap; }
.hub-ic { width: 60px; height: 60px; border-radius: 16px; display: grid; place-items: center; flex: none; background: var(--accent); color: #fff; }
.hub-ic .i { width: 28px; height: 28px; }
.hub-head h1 { font-size: 26px; }
.hub-head p { color: var(--muted); margin: 4px 0 0; }
.hub-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.hub-stats { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.hub-stat { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 8px; background: var(--surface-2); color: var(--text-2); font-size: 12.5px; font-weight: 700; }
.hub-stat .i { width: 14px; height: 14px; color: var(--accent-text); }
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.app-card { position: relative; display: flex; flex-direction: column; min-width: 0; padding: 18px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); color: var(--text); transition: border-color .15s, transform .15s, box-shadow .15s; }
.app-card:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-2px); }
.app-card .fav { width: 48px; height: 48px; border-radius: 13px; font-size: 16px; }
.app-card .fav img { width: 26px; height: 26px; }
.app-card h3 { font-family: var(--font); font-size: 16px; font-weight: 800; letter-spacing: -.01em; margin: 14px 0 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-card p { color: var(--muted); font-size: 13.5px; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.9em; }
.app-card .foot { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); margin-top: 14px; padding-top: 12px; }
.app-card .foot .tag { max-width: 70%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-card .open { margin-left: auto; color: var(--accent-text); display: inline-flex; }
.app-card .corner { position: absolute; top: 12px; right: 12px; display: flex; gap: 2px; }
.app-card .stretch { position: absolute; inset: 0; border-radius: inherit; z-index: 0; }
.app-card .corner { z-index: 2; }
.app-card .foot { position: relative; z-index: 1; pointer-events: none; }
.app-card .foot a, .app-card .foot button { pointer-events: auto; }
.app-card > .fav, .app-card > h3, .app-card > p { position: relative; pointer-events: none; }
.pin-flag { color: var(--accent-text); }
.muted-ic { color: var(--muted); }

/* ---------- App management ---------- */
.mg-dept { display: grid; gap: 10px; }
.mg-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); }
.mg-row .ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); flex: none; }
.mg-row .txt { min-width: 0; flex: 1; }
.mg-row .txt b { display: block; font-size: 15px; }
.mg-row .txt small { display: block; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mg-row .counts { display: flex; gap: 6px; flex-wrap: wrap; }
.mg-row .acts { display: flex; gap: 2px; }
.bulkbar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--r); background: var(--accent-soft); margin-bottom: 12px; font-weight: 700; font-size: 14px; flex-wrap: wrap; }
.table .cb { width: 36px; }
.table input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--accent); }
.icon-pick { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.icon-pick button { height: 42px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text-2); display: grid; place-items: center; }
.icon-pick button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.install-step { display: none; }
.install-step.on { display: grid; gap: 16px; }
.db-ok { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px; background: var(--ok-soft); color: var(--ok); font-weight: 700; font-size: 13.5px; }
.lock-note { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--muted); }
.lock-note .i { color: var(--teal); margin-top: 1px; }
@media (max-width: 900px) {
  .auth-art { display: none; }
  .auth-form { padding-top: 28px; align-items: start; }
  .auth-mobile-logo { display: block !important; width: 220px; margin: 0 0 22px; }
}
@media (max-width: 640px) {
  .hub-head { padding: 16px; }
  .hub-head .actions { margin-left: 0; width: 100%; }
  .app-grid { grid-template-columns: minmax(0, 1fr); }
  .mg-row { flex-wrap: wrap; }
  .mg-row .counts { order: 3; width: 100%; }
}
.auth-mobile-logo { display: none; }

/* ---------- Sidebar logo ---------- */
.side .brand { display: block; padding: 6px 8px 18px; text-decoration: none; }
.side .brand .brand-logo { display: block; width: 148px; height: auto; }

/* ---------- Sign-in page ---------- */
.auth { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); background: #FFFFFF; }
.auth-art {
  position: relative; overflow: hidden; isolation: isolate; justify-content: space-between; gap: 34px;
  padding: 56px clamp(32px, 6.5vw, 108px); background: #FFFFFF; color: #04265B; border-right: 0;
}
.auth-art::before, .auth-art::after { content: ''; position: absolute; border-radius: 50%; background: #EEF5FF; z-index: -1; }
.auth-art::before { width: 240px; height: 240px; left: -120px; top: -110px; }
.auth-art::after { width: 320px; height: 320px; right: -170px; bottom: -150px; background: #F0F7FD; }
.art-logo { width: min(390px, 80%); height: auto; display: block; }
.art-h { font-family: var(--display); font-weight: 800; font-size: clamp(30px, 3.1vw, 46px); line-height: 1.12; letter-spacing: -.02em; color: #0B1B3F; margin: 34px 0 12px; }
.art-h span { color: #006AFD; }
.art-pillars { color: #3E547C; font-size: 17px; font-weight: 500; margin: 0; }
.art-pillars i { font-style: normal; color: #9AAACB; margin: 0 6px; }
.auth-art .points { gap: 22px; max-width: 520px; }
.auth-art .point { gap: 18px; font-size: 15.5px; color: #3E547C; line-height: 1.45; }
.auth-art .point b { font-size: 17px; color: #0B1B3F; margin-bottom: 3px; }
.auth-art .point .ic { width: 58px; height: 58px; border-radius: 14px; background: #EAF2FF; color: #006AFD; }
.auth-art .point .ic .i { width: 26px; height: 26px; }
.auth-art .point .ic.t { background: #E3F8F4; color: #0FA392; }
.auth-art .point .ic.p { background: #F1ECFF; color: #6D4AE8; }
.auth-foot { display: grid; gap: 6px; }
.auth-foot span { font-size: 13px; letter-spacing: .28em; color: #3E547C; font-weight: 500; }
.auth-foot small { font-size: 11px; letter-spacing: .34em; text-transform: uppercase; color: #8A9BBE; font-weight: 600; }

.auth-dark {
  --px: clamp(28px, 7vw, 120px);
  position: relative; overflow: hidden; isolation: isolate; display: flex; flex-direction: column; align-items: flex-start; justify-content: center;
  padding: 96px var(--px) 0; color: #EAF1FF; min-height: 100vh; min-height: 100dvh;
  background: radial-gradient(ellipse at 100% 0%, rgba(124, 58, 237, .55), rgba(124, 58, 237, 0) 55%), linear-gradient(180deg, #0A1E5E 0%, #07143F 55%, #040C2A 100%);
}
.auth-dark .welcome { position: absolute; top: 40px; right: clamp(28px, 6vw, 110px); font-size: 16px; letter-spacing: .06em; color: #C9D6F5; }
.auth-dark .welcome::after { content: ''; display: block; width: 44px; height: 3px; border-radius: 3px; background: #1F8BFF; margin-top: 14px; }
.auth-dark .auth-card { flex: none; width: 100%; }
.auth-dark .globe { order: 2; display: block; flex: none; width: calc(100% + 2 * var(--px)); margin: 18px calc(-1 * var(--px)) 0; height: 250px; z-index: -1; }
.auth-dark .globe text { font-family: var(--font); }
.auth-dark .auth-card { max-width: 520px; }
.auth-card .login-h, .login-h { font-family: var(--display); font-size: clamp(36px, 3.4vw, 50px); font-weight: 800; color: #FFFFFF; letter-spacing: -.02em; margin: 0 0 10px; }
.login-sub { color: #C3D0EE; font-size: 18px; line-height: 1.5; max-width: 390px; margin: 0 0 30px; }
.login-tiles { display: flex; gap: 22px; flex-wrap: wrap; margin-bottom: 30px; }
.lt { display: grid; justify-items: center; gap: 10px; }
.lt span { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; border: 1px solid rgba(147, 176, 255, .28); background: rgba(10, 30, 90, .45); }
.lt small { color: #DCE6FF; font-size: 14px; font-weight: 500; }
.auth-dark form { display: grid; gap: 14px; }
.auth-dark .field > label { color: #C3D0EE; }
.auth-dark .input { background: rgba(255, 255, 255, .06); border-color: rgba(147, 176, 255, .28); color: #FFFFFF; height: 48px; border-radius: 12px; }
.auth-dark .input::placeholder { color: #7F92BE; }
.auth-dark .input:focus { border-color: #22B8F0; box-shadow: 0 0 0 3px rgba(34, 184, 240, .2); }
.auth-dark .input-wrap .icon-btn { color: #9FB2DC; top: 5px; }
.auth-dark .input-wrap .icon-btn:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.auth-dark .form-error { background: rgba(255, 107, 122, .14); color: #FF9AA5; }
.auth-dark .notice { background: rgba(34, 184, 240, .12); color: #DCE6FF; }
.btn-grad {
  margin-top: 8px; height: 62px; width: 100%; border: 0; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  font-size: 19px; font-weight: 700; color: #FFFFFF; background: linear-gradient(90deg, #0A6CFF 0%, #16C8F0 100%);
  box-shadow: 0 16px 36px -14px rgba(22, 160, 255, .7); transition: filter .15s, transform .05s;
}
.btn-grad:hover { filter: brightness(1.07); }
.btn-grad:active { transform: translateY(1px); }
.btn-grad:disabled { opacity: .7; }
.btn-grad .i { width: 22px; height: 22px; }
.login-foot { text-align: center; color: #9FB2DC; font-size: 15px; margin: 18px 0 0; }
@media (max-width: 900px) {
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-dark { --px: 22px; padding: 36px 22px 0; justify-content: flex-start; }
  .auth-dark .welcome { display: none; }
  .auth-dark .auth-mobile-logo { display: block !important; width: 190px; margin-bottom: 28px; }
  .login-tiles { gap: 10px; justify-content: space-between; }
  .lt span { width: 56px; height: 56px; }
  .lt small { font-size: 12px; }
  .login-sub { font-size: 16px; }
  .auth-dark .globe { height: 190px; margin-top: auto; padding-top: 18px; }
}
