/* ============================================================
   BOSS — Dashboard (UI/Dashboard preview from the brand spec)
   Loads on top of styles.css (shares tokens, buttons, .b-mark).
   ============================================================ */
.boss-dashboard {
  display: grid;
  grid-template-columns: 256px minmax(0, 1fr);
  min-height: 100vh;
  background: var(--bg-2);
}

/* ---- Sidebar ---- */
.ds-sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  padding: 22px 16px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.ds-brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 22px; }
.ds-brand .b-mark { width: 32px; height: 32px; font-size: 19px; }
.ds-brand img { height: 20px; width: auto; filter: var(--logo-filter); }

.ds-nav { display: grid; gap: 3px; }
.ds-nav .label { padding: 14px 10px 8px; font-size: 11px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.ds-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 11px;
  color: var(--ink-2); font-size: 14.5px; font-weight: 600;
  transition: background-color 0.18s var(--ease), color 0.18s var(--ease);
}
.ds-nav a svg { width: 19px; height: 19px; flex: 0 0 auto; opacity: 0.85; }
.ds-nav a:hover { background: var(--surface-2); color: var(--ink); }
.ds-nav a.active { background: var(--accent); color: #fff; box-shadow: 0 8px 20px var(--glow); }
.ds-nav a.active svg { opacity: 1; }

.ds-side-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); }
.ds-back { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 11px; color: var(--muted); font-size: 14px; font-weight: 600; }
.ds-back:hover { background: var(--surface-2); color: var(--ink); }
.ds-back svg { width: 18px; height: 18px; }
.ds-user { display: flex; align-items: center; gap: 10px; margin-top: 8px; padding: 10px 12px; border-radius: 11px; background: var(--surface-2); }
.ds-avatar { width: 34px; height: 34px; border-radius: 50%; flex: 0 0 auto; display: grid; place-items: center; background: linear-gradient(160deg, var(--blue-bright), var(--accent)); color: #fff; font-weight: 800; font-size: 13px; }
.ds-user .who { line-height: 1.2; }
.ds-user .who b { display: block; font-size: 13.5px; font-weight: 800; color: var(--ink); }
.ds-user .who span { font-size: 12px; color: var(--muted); }

/* ---- Main ---- */
.ds-main { display: flex; flex-direction: column; min-width: 0; }
.ds-topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 28px;
  background: color-mix(in srgb, var(--bg-2) 80%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.ds-search { position: relative; flex: 1; max-width: 460px; }
.ds-search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); }
.ds-search input {
  width: 100%; height: 42px; padding: 0 14px 0 40px;
  border: 1px solid var(--line); border-radius: 11px;
  background: var(--surface); color: var(--ink);
  font: inherit; font-size: 14px; font-weight: 500;
}
.ds-search input::placeholder { color: var(--muted); }
.ds-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--brand-soft); }
.ds-top-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.ds-iconbtn {
  position: relative; display: inline-grid; place-items: center;
  width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 11px;
  background: var(--surface); color: var(--ink); cursor: pointer;
  transition: border-color 0.18s var(--ease), transform 0.18s var(--ease);
}
.ds-iconbtn:hover { border-color: var(--accent); transform: translateY(-1px); }
.ds-iconbtn svg { width: 18px; height: 18px; }
.ds-iconbtn .badge-dot { position: absolute; top: 9px; right: 11px; width: 7px; height: 7px; border-radius: 50%; background: #ef4444; border: 2px solid var(--surface); }

/* ---- Content ---- */
.ds-content { padding: 26px 28px 48px; }
.ds-pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 22px; }
.ds-pagehead h1 { margin: 0; font-size: clamp(26px, 3vw, 34px); font-weight: 900; letter-spacing: -0.035em; color: var(--ink); }
.ds-pagehead p { margin: 6px 0 0; font-size: 14.5px; color: var(--muted); }
.ds-head-actions { display: flex; gap: 10px; }
.ds-pill { display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 16px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--ink-2); font-size: 13.5px; font-weight: 700; }
.ds-pill svg { width: 16px; height: 16px; }

/* Cards */
.ds-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.ds-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.ds-card-head h3 { margin: 0; font-size: 15px; font-weight: 800; letter-spacing: -0.01em; color: var(--ink); }
.ds-card-head .sub { font-size: 12.5px; font-weight: 600; color: var(--muted); }

/* Stat cards */
.ds-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.ds-stat { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.ds-stat .top { display: flex; align-items: center; justify-content: space-between; }
.ds-stat .top .name { font-size: 13px; font-weight: 700; color: var(--muted); }
.ds-stat .top .ico { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); }
.ds-stat .top .ico svg { width: 17px; height: 17px; }
.ds-stat .num { margin: 14px 0 4px; font-size: 28px; font-weight: 900; letter-spacing: -0.04em; color: var(--ink); }
.ds-stat .meta { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.ds-stat .up { color: var(--success); font-weight: 800; }
.ds-stat .meta span { color: var(--muted); }
.ds-spark { margin-top: 14px; width: 100%; height: 38px; display: block; }
.ds-spark path.line { fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.ds-spark path.area { fill: var(--brand-soft); stroke: none; }

/* Two-column rows */
.ds-row { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; margin-bottom: 16px; }
.ds-row.alt { grid-template-columns: 1fr 1.4fr; }

/* Operations table */
.ds-table { width: 100%; border-collapse: collapse; }
.ds-table th { text-align: left; padding: 12px 20px; font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); }
.ds-table td { padding: 14px 20px; font-size: 14px; border-bottom: 1px solid var(--line); color: var(--ink); }
.ds-table tr:last-child td { border-bottom: none; }
.ds-table .dept { font-weight: 700; }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag.ok { color: var(--success); background: color-mix(in srgb, var(--success) 14%, transparent); }
.tag.risk { color: #d97706; background: rgba(217, 119, 6, 0.14); }
:root[data-theme="dark"] .tag.risk { color: #fbbf24; }
.perf { display: flex; align-items: center; gap: 10px; }
.perf .bar { flex: 1; height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; min-width: 70px; }
.perf .bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--blue), var(--blue-bright)); }
.perf b { font-size: 13px; font-weight: 800; color: var(--ink); min-width: 34px; }

/* Tasks */
.ds-tasks { padding: 8px 8px; }
.ds-task { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; }
.ds-task:hover { background: var(--surface-2); }
.ds-check { width: 20px; height: 20px; flex: 0 0 auto; border: 2px solid var(--line-strong); border-radius: 6px; display: grid; place-items: center; color: transparent; }
.ds-task.done .ds-check { background: var(--accent); border-color: var(--accent); color: #fff; }
.ds-task.done .ds-check svg { width: 12px; height: 12px; }
.ds-task .t-main { min-width: 0; flex: 1; }
.ds-task .t-name { font-size: 14px; font-weight: 700; color: var(--ink); }
.ds-task.done .t-name { color: var(--muted); text-decoration: line-through; }
.ds-task .t-tag { font-size: 12px; color: var(--muted); }
.t-status { font-size: 12px; font-weight: 800; padding: 4px 10px; border-radius: 999px; }
.t-status.prog { color: var(--accent); background: var(--brand-soft); }
.t-status.todo { color: var(--muted); background: var(--surface-3); }

/* Cash flow */
.ds-cash .num { font-size: 34px; font-weight: 900; letter-spacing: -0.04em; color: var(--ink); }
.ds-cash .num small { font-size: 14px; font-weight: 800; color: var(--success); letter-spacing: 0; margin-left: 8px; }
.ds-cash-body { padding: 20px; }
.ds-bars { display: flex; align-items: flex-end; gap: 8px; height: 150px; margin-top: 18px; }
.ds-bars i { flex: 1; border-radius: 6px 6px 3px 3px; background: linear-gradient(180deg, var(--blue-bright), var(--blue)); opacity: 0.85; transition: opacity 0.2s var(--ease); }
.ds-bars i:hover { opacity: 1; }
.ds-bars i.dim { background: var(--surface-3); opacity: 1; }

/* Mini app-icon grid card */
.ds-quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 18px; }
.ds-quick a { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); color: var(--ink-2); font-size: 12.5px; font-weight: 700; text-align: center; transition: border-color 0.18s var(--ease), transform 0.18s var(--ease); }
.ds-quick a:hover { border-color: var(--accent); transform: translateY(-2px); color: var(--ink); }
.ds-quick a svg { width: 22px; height: 22px; color: var(--brand); }

/* ---- Responsive ---- */
@media (max-width: 980px) {
  .boss-dashboard { grid-template-columns: 1fr; }
  .ds-sidebar { position: static; height: auto; flex-direction: row; align-items: center; gap: 8px; overflow-x: auto; padding: 12px; border-right: none; border-bottom: 1px solid var(--line); }
  .ds-brand { padding: 0 8px 0 4px; }
  .ds-nav { display: flex; gap: 4px; }
  .ds-nav .label, .ds-side-foot { display: none; }
  .ds-nav a span { display: none; }
  .ds-stats { grid-template-columns: 1fr 1fr; }
  .ds-row, .ds-row.alt { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .ds-stats { grid-template-columns: 1fr; }
  .ds-content, .ds-topbar { padding-left: 16px; padding-right: 16px; }
  .ds-quick { grid-template-columns: repeat(3, 1fr); }
}
