/* ────────────────────────────────────────────────────────────
   DASHBOARD.CSS — staff portal admin shell
   Built on top of the existing design tokens in style.css /
   custom.css (same indigo brand, same card/tag/button language)
   so the portal still feels like part of the same product.
   ──────────────────────────────────────────────────────────── */

.dash-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: calc(100vh - 56px - 42px);
  align-items: start;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.dash-sidebar {
  background: #fff;
  border-right: 1px solid #e2e4e8;
  min-height: calc(100vh - 56px - 42px);
  position: sticky;
  top: 98px;
  display: flex;
  flex-direction: column;
  padding: 20px 0;
}

.dash-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px 18px;
  margin-bottom: 8px;
  border-bottom: 1px solid #eceef3;
}

.dash-user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #e8eaff;
  color: #3d47c9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .82rem;
  flex-shrink: 0;
  overflow: hidden;
}
.dash-user-avatar img { width: 100%; height: 100%; object-fit: cover; }

.dash-user-name { font-size: .86rem; font-weight: 600; color: #111; line-height: 1.3; }
.dash-user-role { font-size: .72rem; color: #888; }

.dash-nav-group { margin-bottom: 18px; }
.dash-nav-label {
  font-size: .68rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: #9aa0b4; padding: 0 18px; margin-bottom: 6px; display: block;
}
.dash-nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 9px 18px; font-size: .85rem; font-weight: 500;
  color: #444; background: none; border: none; text-align: left; cursor: pointer;
  font-family: 'Roboto', sans-serif; transition: background .12s, color .12s;
  border-left: 3px solid transparent;
}
.dash-nav-item svg { width: 17px; height: 17px; fill: #888; flex-shrink: 0; transition: fill .12s; }
.dash-nav-item:hover { background: #f4f5ff; color: #3d47c9; }
.dash-nav-item:hover svg { fill: #3d47c9; }
.dash-nav-item.active { background: #f0f1ff; color: #3d47c9; border-left-color: #3d47c9; font-weight: 700; }
.dash-nav-item.active svg { fill: #3d47c9; }
.dash-nav-item .count-pill {
  margin-left: auto; background: #e2e4e9; color: #555; font-size: .68rem; font-weight: 700;
  padding: 1px 7px; border-radius: 999px; min-width: 18px; text-align: center;
}
.dash-nav-item.active .count-pill { background: #3d47c9; color: #fff; }

.dash-sidebar-footer { margin-top: auto; padding: 14px 18px 0; border-top: 1px solid #eceef3; }

/* ── Main content ────────────────────────────────────────── */
.dash-main { padding: 24px 28px; min-width: 0; }

.dash-view { display: none; }
.dash-view.active { display: block; }

.dash-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.dash-head h1 { font-size: 1.4rem; font-weight: 700; color: #111; margin-bottom: 3px; }
.dash-head p { font-size: .85rem; color: #666; }

/* ── Stat cards ──────────────────────────────────────────── */
.dash-stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px; margin-bottom: 24px;
}
.dash-stat-card {
  background: #fff; border-radius: 8px; padding: 18px 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06); display: flex; align-items: center; gap: 14px;
}
.dash-stat-icon {
  width: 40px; height: 40px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.dash-stat-icon svg { width: 20px; height: 20px; }
.dash-stat-icon.blue { background: #e8eaff; } .dash-stat-icon.blue svg { fill: #3d47c9; }
.dash-stat-icon.green { background: #e8f5e9; } .dash-stat-icon.green svg { fill: #2e7d32; }
.dash-stat-icon.amber { background: #fff8e1; } .dash-stat-icon.amber svg { fill: #b8860b; }
.dash-stat-icon.red { background: #fdecea; } .dash-stat-icon.red svg { fill: #c62828; }
.dash-stat-icon.purple { background: #f3e8ff; } .dash-stat-icon.purple svg { fill: #7b2fd1; }
.dash-stat-value { font-size: 1.4rem; font-weight: 700; color: #111; line-height: 1.1; }
.dash-stat-label { font-size: .76rem; color: #777; margin-top: 2px; }

/* ── Two-column dashboard grid ───────────────────────────── */
.dash-grid-2 { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; }
@media (max-width: 980px) { .dash-grid-2 { grid-template-columns: 1fr; } }

.dash-card { background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.dash-card-head {
  padding: 16px 18px; border-bottom: 1px solid #eceef3;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.dash-card-head h3 { font-size: .92rem; font-weight: 700; color: #111; }
.dash-card-body { padding: 16px 18px; }

/* ── Simple bar list (status / category breakdowns) ─────── */
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.bar-row:last-child { margin-bottom: 0; }
.bar-row-label { font-size: .78rem; color: #444; width: 96px; flex-shrink: 0; text-transform: capitalize; }
.bar-row-track { flex: 1; height: 8px; background: #eef0f6; border-radius: 999px; overflow: hidden; }
.bar-row-fill { height: 100%; background: #3d47c9; border-radius: 999px; }
.bar-row-count { font-size: .78rem; font-weight: 700; color: #111; width: 26px; text-align: right; flex-shrink: 0; }

/* ── Toolbar (search/filter/add above tables) ───────────── */
.dash-toolbar {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap;
}
.dash-toolbar .form-input, .dash-toolbar .form-select { height: 36px; font-size: .82rem; }
.dash-toolbar-spacer { flex: 1; }

/* ── Data table ──────────────────────────────────────────── */
.dash-table-wrap { overflow-x: auto; }
.dash-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.dash-table th {
  text-align: left; font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: #888; padding: 10px 14px; border-bottom: 1px solid #eceef3; white-space: nowrap;
}
.dash-table td { padding: 12px 14px; border-bottom: 1px solid #f2f3f7; vertical-align: top; color: #333; }
.dash-table tr:last-child td { border-bottom: none; }
.dash-table tr:hover td { background: #fafbff; }
.dash-table .muted { color: #999; }
.dash-row-actions { display: flex; gap: 6px; white-space: nowrap; }
.dash-icon-btn {
  width: 28px; height: 28px; border-radius: 5px; border: 1px solid #e2e4e8; background: #fff;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  transition: background .12s, border-color .12s;
}
.dash-icon-btn svg { width: 14px; height: 14px; fill: #666; }
.dash-icon-btn:hover { background: #f4f5ff; border-color: #c7cdf5; }
.dash-icon-btn:hover svg { fill: #3d47c9; }
.dash-icon-btn.danger:hover { background: #fdecea; border-color: #f3b9b4; }
.dash-icon-btn.danger:hover svg { fill: #c62828; }

/* ── Status / role pills ─────────────────────────────────── */
.pill { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; font-size: .72rem; font-weight: 700; }
.pill-open { background: #fdecea; color: #c62828; }
.pill-in_progress { background: #fff8e1; color: #9a6a00; }
.pill-quoted { background: #e8eaff; color: #3d47c9; }
.pill-completed { background: #e8f5e9; color: #2e7d32; }
.pill-closed { background: #eceef3; color: #666; }

/* ── Modal (add/edit forms) ──────────────────────────────── */
.dash-modal-backdrop {
  position: fixed; inset: 0; background: rgba(20, 22, 40, .45);
  display: none; align-items: flex-start; justify-content: center;
  padding: 60px 20px; z-index: 500; overflow-y: auto;
}
.dash-modal-backdrop.open { display: flex; }
.dash-modal {
  background: #fff; border-radius: 10px; width: 100%; max-width: 520px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.dash-modal-head {
  padding: 18px 22px; border-bottom: 1px solid #eceef3;
  display: flex; align-items: center; justify-content: space-between;
}
.dash-modal-head h3 { font-size: 1rem; font-weight: 700; color: #111; }
.dash-modal-close { background: none; border: none; cursor: pointer; padding: 4px; line-height: 0; }
.dash-modal-close svg { width: 18px; height: 18px; fill: #888; }
.dash-modal-body { padding: 20px 22px; max-height: 65vh; overflow-y: auto; }
.dash-modal-foot { padding: 16px 22px; border-top: 1px solid #eceef3; display: flex; justify-content: flex-end; gap: 10px; }
.dash-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dash-form-row .form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: .8rem; font-weight: 600; color: #333; margin-bottom: 6px; }
.dash-modal textarea.form-input { height: auto; padding: 10px 12px; min-height: 80px; resize: vertical; }

/* ── Toasts ──────────────────────────────────────────────── */
.dash-toast-stack {
  position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column;
  gap: 8px; z-index: 600;
}
.dash-toast {
  background: #1e2257; color: #fff; padding: 11px 16px; border-radius: 7px;
  font-size: .83rem; box-shadow: 0 6px 20px rgba(0,0,0,.25);
  display: flex; align-items: center; gap: 8px; animation: ukm-toast-in .2s ease-out;
}
.dash-toast.error { background: #c62828; }
.dash-toast.success { background: #2e7d32; }
@keyframes ukm-toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ── Login gate ──────────────────────────────────────────── */
.dash-login-gate {
  max-width: 420px; margin: 60px auto; text-align: center; padding: 44px 32px;
}
.dash-login-gate .lock-icon {
  width: 52px; height: 52px; border-radius: 12px; background: #e8eaff; margin: 0 auto 18px;
  display: flex; align-items: center; justify-content: center;
}
.dash-login-gate .lock-icon svg { width: 24px; height: 24px; fill: #3d47c9; }
.dash-login-gate h2 { font-size: 1.15rem; font-weight: 700; color: #111; margin-bottom: 8px; }
.dash-login-gate p { font-size: .86rem; color: #666; line-height: 1.6; margin-bottom: 20px; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 880px) {
  .dash-shell { grid-template-columns: 1fr; }
  .dash-sidebar {
    position: static; min-height: auto; flex-direction: row; flex-wrap: wrap;
    padding: 12px; border-right: none; border-bottom: 1px solid #e2e4e8;
  }
  .dash-user { display: none; }
  .dash-nav-group { margin-bottom: 0; display: flex; align-items: center; gap: 2px; }
  .dash-nav-label { display: none; }
  .dash-nav-item { width: auto; padding: 8px 12px; border-left: none; border-radius: 6px; }
  .dash-nav-item.active { border-left: none; }
  .dash-sidebar-footer { display: none; }
  .dash-main { padding: 18px 16px; }
  .dash-form-row { grid-template-columns: 1fr; }
}