/* ---------- App shell */
.app { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 40; display: flex; flex-direction: column;
  background: var(--primary); color: #DCEAE4; transition: width var(--t) var(--ease), transform var(--t) var(--ease);
}
:root[data-theme="dark"] .sidebar { background: #0B1613; border-right: 1px solid var(--border); }
.sb-brand { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 12px; }
.brand { display: flex; align-items: center; gap: 11px; color: #fff; text-decoration: none !important; }
.brand .logo { border-radius: 11px; box-shadow: 0 0 0 1px rgba(255,255,255,.12); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-size: 19px; letter-spacing: .14em; font-weight: 800; color: #fff; }
.brand-text small { font-size: 11.5px; color: #A8C9BD; font-weight: 500; margin-top: 3px; }
.sidebar .sb-close { display: none; color: #fff; }
.sb-nav { flex: 1; overflow-y: auto; padding: 4px 10px 12px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent; }
.nav-group { margin-top: 6px; }
.nav-group-head {
  width: 100%; display: flex; align-items: center; justify-content: space-between; background: none; border: 0; padding: 8px 10px 6px;
  font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: #8FB5A7; font-weight: 700;
}
html[lang="ta"] .nav-group-head { letter-spacing: 0; text-transform: none; font-size: 12px; }
.nav-group-head .caret { width: 14px; height: 14px; transition: transform var(--t) var(--ease); }
.nav-group.collapsed .caret { transform: rotate(-90deg); }
.nav-items { display: grid; gap: 2px; overflow: hidden; transition: max-height var(--t) var(--ease); max-height: 600px; }
.nav-group.collapsed .nav-items { max-height: 0; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 10px; color: #CFE2DA;
  font-weight: 500; font-size: 14px; text-decoration: none !important; border: 0; background: none; width: 100%; text-align: left;
  transition: background var(--t-fast), color var(--t-fast);
}
.nav-item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: rgba(231,182,93,.16); color: #fff; font-weight: 650; }
.nav-item.active::before { content: ''; position: absolute; left: -10px; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: var(--gold); }
.nav-item.active .ico, .nav-item.active svg { color: var(--gold); }
.nav-count { margin-left: auto; background: var(--gold); color: #3B2A08; font-size: 11px; font-weight: 700; border-radius: 20px; padding: 0 7px; line-height: 18px; }
.nav-count:empty { display: none; }
.sb-foot { padding: 10px; border-top: 1px solid rgba(255,255,255,.08); display: grid; gap: 6px; }
.demo-note { display: flex; gap: 10px; padding: 10px 11px; border-radius: 10px; background: rgba(231,182,93,.1); color: #F2D9A6; font-size: 12px; }
.demo-note strong { display: block; color: var(--gold); font-size: 11.5px; letter-spacing: .06em; }
.demo-note small { color: #CBBF9F; line-height: 1.4; display: block; }
.sb-collapse { color: #A8C9BD; }

body.sb-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
body.sb-collapsed .brand-text, body.sb-collapsed .nav-item span, body.sb-collapsed .nav-group-head span,
body.sb-collapsed .demo-note div, body.sb-collapsed .nav-count { display: none; }
body.sb-collapsed .nav-group-head { justify-content: center; padding: 6px 0; }
body.sb-collapsed .nav-group-head .caret { display: none; }
body.sb-collapsed .nav-group-head::after { content: ''; width: 18px; height: 1px; background: rgba(255,255,255,.14); }
body.sb-collapsed .nav-group.collapsed .nav-items { max-height: 600px; }
body.sb-collapsed .nav-item { justify-content: center; padding: 10px 0; }
body.sb-collapsed .demo-note { justify-content: center; }
body.sb-collapsed .sb-collapse svg { transform: rotate(180deg); }
body.sb-collapsed .main { margin-left: var(--sidebar-w-collapsed); }

.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; transition: margin-left var(--t) var(--ease); }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h); display: flex; align-items: center; gap: 14px; padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--border);
}
.topbar .menu-btn { display: none; }
.gsearch { position: relative; flex: 1; max-width: 520px; min-width: 160px; display: flex; align-items: center; }
.topbar .gsearch-toggle { display: none; }
.fy-mobile { display: none; }
.gsearch > .ico, .gsearch > svg { position: absolute; left: 12px; color: var(--text-faint); pointer-events: none; }
.gsearch .input { padding-left: 38px; padding-right: 40px; height: 40px; background: var(--surface); border-radius: 11px; }
.gsearch kbd { position: absolute; right: 10px; }
.gsearch-results { position: absolute; top: 46px; left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-lg); padding: 6px; max-height: 420px; overflow: auto; z-index: 50; }
.gsearch-results a { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 9px; color: var(--text); text-decoration: none; }
.gsearch-results a:hover, .gsearch-results a:focus { background: var(--sage); outline: none; }
.gsearch-results a svg { color: var(--secondary); }
.gsearch-results strong { display: block; font-size: 13.5px; }
.gsearch-results small { color: var(--text-muted); font-size: 12px; }
.tb-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.demo-pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 20px; background: var(--gold-50); color: var(--warning); font-weight: 700; font-size: 11.5px; letter-spacing: .06em; border: 1px solid color-mix(in srgb, var(--gold) 45%, transparent); }
.demo-pill svg { width: 14px; height: 14px; }
.fy-select { display: flex; align-items: center; gap: 6px; padding: 0 4px 0 10px; height: 38px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text-muted); }
.fy-select select { border: 0; background: transparent; font-weight: 600; color: var(--text); height: 36px; padding-right: 6px; cursor: pointer; }
.fy-select select:focus { outline: none; }
.lang-switch { display: flex; padding: 3px; border-radius: 10px; background: var(--surface-3); }
.lang-switch button { border: 0; background: none; padding: 5px 10px; border-radius: 8px; font-size: 12.5px; font-weight: 700; color: var(--text-muted); }
.lang-switch button.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }
.dropdown { position: relative; }
.bell { position: relative; }
.bell-dot { position: absolute; top: 2px; right: 1px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 10px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--bg); }
.bell-dot[hidden], .bell-dot:empty { display: none; }
.user-btn { display: flex; align-items: center; gap: 9px; border: 1px solid transparent; background: none; padding: 4px 8px 4px 4px; border-radius: 12px; }
.user-btn:hover { background: var(--surface); border-color: var(--border); }
.user-meta { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.user-meta strong { font-size: 13px; } .user-meta small { font-size: 11.5px; color: var(--text-muted); }
.avatar { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(140deg, var(--secondary), var(--primary)); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.avatar.lg { width: 44px; height: 44px; border-radius: 12px; font-size: 17px; }
.avatar svg { color: #fff; }
.dd-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 250px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-lg); padding: 6px; z-index: 60; animation: pop var(--t) var(--ease); }
.dd-bell { width: 360px; max-width: calc(100vw - 24px); }
.dd-head { padding: 10px 10px 8px; display: flex; flex-direction: column; }
.dd-head.row { flex-direction: row; justify-content: space-between; align-items: center; }
.dd-head small { color: var(--text-muted); }
.dd-label { font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-faint); padding: 8px 10px 4px; }
.dd-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 8px; color: var(--text); text-align: left; font-size: 13.5px; text-decoration: none !important; }
.dd-item:hover { background: var(--sage); }
.dd-item.active { color: var(--secondary); font-weight: 650; }
.dd-item.danger { color: var(--danger); }
.dd-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.dd-foot { display: block; text-align: center; padding: 9px; font-weight: 600; font-size: 13px; border-top: 1px solid var(--border); margin-top: 4px; }
.bell-item { display: flex; gap: 10px; padding: 9px 10px; border-radius: 9px; color: var(--text); text-decoration: none !important; }
.bell-item:hover { background: var(--sage); }
.bell-item strong { display: block; font-size: 13px; } .bell-item small { color: var(--text-muted); font-size: 12px; }
.bell-item.unread strong::after { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--secondary); margin-left: 6px; vertical-align: middle; }
.bi-ico { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.tone-danger { background: var(--danger-bg); color: var(--danger); } .tone-warning { background: var(--warning-bg); color: var(--warning); }
.tone-info, .tone-blue { background: var(--info-bg); color: var(--info); } .tone-green, .tone-teal { background: var(--secondary-50); color: var(--secondary); } .tone-gold { background: var(--gold-50); color: var(--warning); }

.view { flex: 1; padding: 24px 28px 40px; width: 100%; max-width: 1480px; margin: 0 auto; outline: none; }
.page { display: grid; gap: 20px; }
.page-in { animation: pageIn 260ms var(--ease); }
.app-foot { padding: 14px 28px 22px; color: var(--text-faint); font-size: 12px; text-align: center; }
.drawer-scrim { display: none; }

/* Bare pages (TV rate board) */
body.bare .sidebar, body.bare .topbar, body.bare .app-foot, body.bare .drawer-scrim { display: none !important; }
body.bare .main { margin-left: 0 !important; }
body.bare .view { max-width: none; padding: 0; }

/* Grids */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.grid-2-1 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; }
.grid-1-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 20px; }
.section-title { font-size: 16px; display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.section-title.row { justify-content: space-between; }
.section-title.row h2 { font-size: 16px; }

@keyframes pageIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
