/* =========================================================
   Layout: shell, sidebar, topbar, page, card, grid
   Angular: app-shell, app-sidebar, app-topbar component styles;
   .card / .grid / .page-head stay global in styles.scss.
   ========================================================= */

/* ---------- app-shell ---------- */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; transition: grid-template-columns .2s; }
.shell.collapsed { grid-template-columns: 68px 1fr; }
.main { display: flex; flex-direction: column; min-width: 0; }
.content { padding: var(--space-page); display: flex; flex-direction: column; gap: 20px; width: 100%; }

/* ---------- app-sidebar ---------- */
.sidebar { background: linear-gradient(180deg, var(--side-bg) 0%, var(--side-bg-2) 100%); color: var(--side-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 0 16px; height: 58px; }
.side-brand b { color: #fff; white-space: nowrap; font-weight: var(--fw-semibold); font-size: var(--fs-md); display: block; }
.side-brand small { display: block; color: var(--side-text); font-size: var(--fs-xs); }
.nav { padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-label { font-size: 10.5px; font-weight: var(--fw-medium); text-transform: uppercase; letter-spacing: .08em; color: #4b5b73; padding: 14px 10px 6px; }
.nav a { position: relative; display: flex; align-items: center; gap: 11px; color: var(--side-text); padding: 8px 10px; border-radius: var(--radius-sm); white-space: nowrap; font-size: var(--fs-base); transition: background .15s, color .15s; }
.nav a:hover { background: rgba(255,255,255,.05); color: var(--side-text-hi); }
.nav a.active { background: var(--side-active); color: #fff; font-weight: var(--fw-medium); }
.nav a.active::before { content: ""; position: absolute; left: -10px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: #3b82f6; }
.nav a.active svg { color: #60a5fa; }
.nav svg { flex: none; width: 17px; height: 17px; }
.nav .badge { margin-left: auto; background: rgba(59,130,246,.2); color: #93c5fd; font-size: var(--fs-xs); font-weight: var(--fw-medium); border-radius: 999px; padding: 0 7px; font-style: normal; }
.nav .badge.hot { background: rgba(239,68,68,.2); color: #fca5a5; }
.side-card { margin: 10px; padding: 12px; border-radius: var(--radius-sm); background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.06); font-size: var(--fs-sm); }
.side-card b { color: #fff; display: block; }
.side-card .bar { height: 5px; background: rgba(255,255,255,.08); border-radius: 99px; margin-top: 9px; overflow: hidden; }
.side-card .bar div { height: 100%; background: linear-gradient(90deg, #3b82f6, #06b6d4); }
.shell.collapsed .side-brand .txt, .shell.collapsed .nav a span, .shell.collapsed .nav-label, .shell.collapsed .nav .badge, .shell.collapsed .side-card { display: none; }
.shell.collapsed .nav a { justify-content: center; }
.shell.collapsed .side-brand { justify-content: center; padding: 0; }
.logo { width: 34px; height: 34px; border-radius: 10px; background: var(--grad); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12px; letter-spacing: .02em; flex: none; }

/* ---------- app-topbar ---------- */
.topbar {
  height: 58px; background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(12px); -webkit-backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; padding: 0 var(--space-page);
  position: sticky; top: 0; z-index: 10;
}
.topbar .count { position: absolute; top: 3px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; background: var(--bad); color: #fff; font-size: 9.5px; font-weight: var(--fw-semibold); border-radius: 99px; display: grid; place-items: center; border: 2px solid var(--surface); }
.search { flex: 1; max-width: 420px; position: relative; }
.search input { padding-left: 34px; padding-right: 40px; background: var(--surface-2); border-color: var(--border); height: 36px; }
.search > svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted); }
.search .kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.vsep { width: 1px; height: 24px; background: var(--border); margin: 0 6px; }
.user-btn { display: flex; align-items: center; gap: 9px; border: 0; background: transparent; padding: 4px 8px 4px 4px; border-radius: 10px; text-align: left; }
.user-btn:hover { background: var(--surface-3); }
.user-btn b { display: block; font-size: var(--fs-base); }
.user-btn span { display: block; font-size: var(--fs-xs); color: var(--muted); }

/* ---------- dropdown menu (Angular CDK overlay / menu) ---------- */
.menu { position: absolute; right: var(--space-page); top: 54px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); min-width: 250px; padding: 5px; z-index: 40; animation: pop .14s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.menu button, .menu .menu-item, .menu a.menu-link { display: flex; width: 100%; text-align: left; border: 0; background: transparent; padding: 7px 9px; border-radius: 7px; gap: 9px; align-items: center; font-size: var(--fs-base); color: var(--text); }
.menu button:hover, .menu a.menu-link:hover { background: var(--surface-3); }
.menu button.danger { color: var(--bad); }
.menu button svg, .menu a.menu-link svg { width: 15px; height: 15px; color: var(--muted); flex: none; }
.menu button.danger svg { color: var(--bad); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 5px 0; }
.menu .menu-title { padding: 6px 9px 4px; font-size: var(--fs-xs); font-weight: var(--fw-medium); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: flex; justify-content: space-between; }
.row-menu { position: fixed; right: auto; top: 0; min-width: 190px; }
.notif { display: flex; gap: 10px; padding: 9px; border-radius: 8px; color: var(--text); }
.notif:hover { background: var(--surface-3); }
.notif i { font-style: normal; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; font-size: 13px; }

/* ---------- page header, card, grid (global) ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 3px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { font-size: var(--fs-sm); color: var(--muted); margin-bottom: 4px; display: flex; gap: 6px; align-items: center; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--text); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-head { padding: 12px 18px; min-height: 58px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-head .sub { font-size: var(--fs-sm); color: var(--muted); margin-top: 1px; }
.card-head .tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.card-body { padding: 18px; }
.card-foot { padding: 14px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.grid { display: grid; gap: 16px; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.dash-main { grid-template-columns: minmax(0, 1fr) 340px; }

/* ---------- segmented control (app-segmented) ---------- */
.seg { display: inline-flex; background: var(--surface-3); border-radius: var(--radius-sm); padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 3px 10px; border-radius: 6px; font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ---------- notices ---------- */
.notice { border-radius: var(--radius-sm); padding: 10px 14px; display: flex; gap: 10px; align-items: center; border: 1px solid transparent; }
.notice .grow { flex: 1; }
.notice.warn { background: var(--warn-weak); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.notice.info { background: var(--primary-weak); border-color: color-mix(in srgb, var(--primary) 25%, transparent); }
.notice.bad { background: var(--bad-weak); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.notice.warn .ico { color: var(--warn); } .notice.info .ico { color: var(--primary); } .notice.bad .ico { color: var(--bad); }
