/* ============================================================
   CRM — neutral, responsive design system
   ============================================================ */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fa;
  --border: #e3e6ea;
  --border-strong: #cfd4da;
  --text: #1c2127;
  --text-muted: #687078;
  --text-faint: #98a0a8;
  --accent: #2f6f7e;
  /* muted teal — restrained */
  --accent-fg: #ffffff;
  --accent-soft: #e6f0f1;
  --success: #2e7d52;
  --success-soft: #e4f1ea;
  --warn: #9a6b1f;
  --warn-soft: #f6eddc;
  --danger: #b3402f;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(20, 24, 28, .06), 0 4px 16px rgba(20, 24, 28, .06);
  --shadow-pop: 0 8px 28px rgba(20, 24, 28, .16);
  --font: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}

a {
  color: var(--accent);
  text-decoration: none;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--text-muted);
}

.mono {
  font-family: var(--mono);
  font-size: .9em;
}

/* ---------- App shell ---------- */
.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  font-weight: 600;
  font-size: 18px;
  padding: 6px 10px 16px;
  letter-spacing: -0.02em;
}

.brand small {
  display: block;
  font-weight: 400;
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: .04em;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 500;
  cursor: pointer;
  border: 0;
  background: none;
  width: 100%;
  text-align: left;
  font-size: 14px;
}

.nav-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.nav-spacer {
  flex: 1;
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 60px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar h1 {
  font-size: 17px;
}

.topbar .spacer {
  flex: 1;
}

.menu-btn {
  display: none;
}

.content {
  padding: 24px;
  width: 100%;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font: inherit;
  font-weight: 500;
  font-size: 14px;
  padding: 9px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background .12s, border-color .12s;
}

.btn:hover {
  background: var(--surface-2);
}

.btn:active {
  transform: translateY(.5px);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}

.btn-primary:hover {
  background: #285e6b;
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
}

.btn-ghost:hover {
  background: var(--surface-2);
}

.btn-sm {
  padding: 6px 11px;
  font-size: 13px;
}

.btn-wa {
  background: #25d366;
  border-color: #25d366;
  color: #fff;
}

.btn-wa:hover {
  background: #1fb858;
}

.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* ---------- Cards / tables ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-pad {
  padding: 18px;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.toolbar .spacer {
  flex: 1;
}

table.grid {
  width: 100%;
  border-collapse: collapse;
}

table.grid th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-faint);
  font-weight: 600;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

table.grid td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

table.grid tr:last-child td {
  border-bottom: 0;
}

table.grid tbody tr {
  cursor: pointer;
}

table.grid tbody tr:hover {
  background: var(--surface-2);
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
}

.badge.lead {
  background: var(--warn-soft);
  color: var(--warn);
}

.badge.confirmed {
  background: var(--success-soft);
  color: var(--success);
}

.badge.status-pending {
  background: var(--warn-soft);
  color: var(--warn);
}

.badge.status-in_progress {
  background: var(--accent-soft);
  color: var(--accent);
}

.badge.status-done {
  background: var(--success-soft);
  color: var(--success);
}

.badge.dev-allocated {
  background: var(--accent-soft);
  color: var(--accent);
}

.badge.dev-installed {
  background: var(--success-soft);
  color: var(--success);
}

.badge.dev-removed {
  background: var(--danger-soft, #fbeaea);
  color: var(--danger);
}

.badge.dev-spare {
  background: var(--surface-2);
  color: var(--text-muted);
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ---------- Forms ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.input {
  font: inherit;
  font-size: 14px;
  padding: 10px 12px;
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* ---------- Modal ---------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 24, 28, .4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow: auto;
  box-shadow: var(--shadow-pop);
}

.modal-head {
  display: flex;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-head h2 {
  font-size: 16px;
  flex: 1;
}

.modal-body {
  padding: 20px;
}

.modal-foot {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 380px;
}

/* ============================================================
   Rich Select (replaces every native <select>)
   ============================================================ */
.rs {
  position: relative;
  width: 100%;
}

.rs-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  font: inherit;
  font-size: 14px;
  padding: 10px 12px;
  cursor: pointer;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  text-align: left;
}

.rs-trigger:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.rs-trigger .rs-value {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rs-trigger .rs-value.placeholder {
  color: var(--text-faint);
}

.rs-caret {
  flex-shrink: 0;
  transition: transform .15s;
  color: var(--text-muted);
}

.rs.open .rs-caret {
  transform: rotate(180deg);
}

.rs-panel {
  position: absolute;
  z-index: 200;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
  display: none;
}

.rs.open .rs-panel {
  display: block;
}

.rs-search {
  padding: 8px;
  border-bottom: 1px solid var(--border);
}

.rs-search input {
  width: 100%;
  font: inherit;
  font-size: 14px;
  padding: 7px 9px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
}

.rs-search input:focus {
  outline: none;
  border-color: var(--accent);
}

.rs-options {
  max-height: 240px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px;
}

.rs-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

.rs-opt:hover,
.rs-opt.active {
  background: var(--surface-2);
}

.rs-opt.selected {
  color: var(--accent);
  font-weight: 600;
}

.rs-opt .check {
  margin-left: auto;
  opacity: 0;
}

.rs-opt.selected .check {
  opacity: 1;
}

.rs-empty {
  padding: 14px;
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
}

/* ---------- Asset thumbs ---------- */
.thumbs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.thumb {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

/* ---------- Client contract details ---------- */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px 24px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 14px;
}

.detail-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-faint);
  font-weight: 600;
}

/* ---------- Approval panel + danger button ---------- */
.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.btn-danger:hover {
  filter: brightness(0.94);
}

.approval-panel {
  border: 1px solid var(--border);
  border-left: 3px solid var(--warn);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 12px 14px;
  margin-bottom: 16px;
}

.approval-head {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.approval-body {
  font-size: 14px;
  line-height: 1.5;
}

.approval-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 12px;
}

/* ---------- Product thumbnails ---------- */
.prod-thumb {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  background-size: cover;
  background-position: center;
  background-color: var(--surface-2);
  border: 1px solid var(--border);
}

.prod-thumb.lg {
  width: 120px;
  height: 120px;
  border-radius: 8px;
}

.prod-thumb.empty {
  background-image: none;
  position: relative;
}

.prod-thumb.empty::after {
  content: '📦';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: .35;
}

/* ---------- Task checklist ---------- */
.check-pill {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.check-pill.all {
  background: var(--success-soft);
  color: var(--success);
  border-color: transparent;
}

.check-progress {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.check-list {
  display: flex;
  flex-direction: column;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}

.check-label {
  flex: 1;
  font-size: 14px;
  word-break: break-word;
}

.check-label.done {
  color: var(--text-faint);
  text-decoration: line-through;
}

.check-box {
  position: relative;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  cursor: pointer;
}

.check-box input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.check-box span {
  position: absolute;
  inset: 0;
  border: 1.5px solid var(--border-strong);
  border-radius: 5px;
  background: var(--surface);
}

.check-box input:checked+span {
  background: var(--accent);
  border-color: var(--accent);
}

.check-box input:checked+span::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.check-add {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

/* ---------- Due Today widget ---------- */
.due-counter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--border);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 14px;
  margin-left: 10px;
}

.due-counter.has {
  background: var(--accent);
  color: var(--accent-fg);
}

.due-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.due-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
}

.due-item:hover {
  background: var(--surface-2);
}

.due-time {
  flex-shrink: 0;
  width: 64px;
  font-weight: 600;
  font-size: 13px;
  color: var(--accent);
}

.due-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.due-divider {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-faint);
  font-weight: 600;
  padding: 10px 12px 4px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

/* ---------- Calendar ---------- */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.cal-head {
  background: var(--surface-2);
  text-align: center;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-faint);
  font-weight: 600;
  padding: 8px 0;
}

.cal-cell {
  background: var(--surface);
  min-height: 96px;
  padding: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cal-cell:hover {
  background: var(--surface-2);
}

.cal-cell.empty {
  background: var(--surface-2);
  cursor: default;
}

.cal-cell.is-today {
  background: var(--accent-soft);
}

.cal-daynum {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.cal-cell.is-today .cal-daynum {
  color: var(--accent);
}

.cal-chip {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 4px;
  padding: 3px 6px;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: var(--accent-soft);
  color: var(--accent);
}

.cal-chip.status-done {
  background: var(--success-soft);
  color: var(--success);
  text-decoration: line-through;
}

.cal-chip.status-pending {
  background: var(--warn-soft);
  color: var(--warn);
}

.cal-more {
  font-size: 10px;
  color: var(--text-faint);
  padding-left: 2px;
}

@media (max-width: 700px) {
  .cal-cell {
    min-height: 64px;
    padding: 3px;
  }

  .cal-chip {
    font-size: 10px;
    padding: 2px 4px;
  }

  .due-time {
    width: 54px;
  }
}

/* ---------- Toggle switch ---------- */
.switch-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.switch-row:last-child {
  border-bottom: 0;
}

.switch {
  position: relative;
  width: 40px;
  height: 23px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch .slider {
  position: absolute;
  inset: 0;
  background: var(--border-strong);
  border-radius: 999px;
  transition: background .15s;
  cursor: pointer;
}

.switch .slider::before {
  content: '';
  position: absolute;
  height: 17px;
  width: 17px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .15s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
}

.switch input:checked+.slider {
  background: var(--accent);
}

.switch input:checked+.slider::before {
  transform: translateX(17px);
}

/* ---------- Reports ---------- */
.report-filters {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.report-filters .field {
  margin-bottom: 8px;
  min-width: 150px;
}

.report-summary {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-muted);
  margin: 10px 0 4px;
}

/* ---------- Dashboard ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.stat-num {
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
}

.stat-label {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-muted);
}

.chart-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}

/* ---------- Sub-tabs (main client area) ---------- */
.subtabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.subtab {
  padding: 9px 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  border: 0;
  background: none;
  cursor: pointer;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.subtab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ---------- Document groups (Documents tab) ---------- */
.doc-group {
  margin-bottom: 14px;
}

.doc-group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.doc-group-title {
  font-weight: 600;
  font-size: 14px;
}

.doc-group-body {
  padding: 4px 16px 10px;
}

.doc-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}

.doc-row:last-child {
  border-bottom: 0;
}

.doc-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.doc-expiry {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.doc-expiry.ok {
  color: var(--text-muted);
}

.doc-expiry.warn {
  color: var(--warn);
}

.doc-expiry.danger {
  color: var(--danger);
}

.doc-empty {
  padding: 12px 0;
  color: var(--text-faint);
  font-size: 13px;
}

/* ---------- Client detail two-column layout ---------- */
.client-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.client-main {
  flex: 1;
  min-width: 0;
}

.client-aside {
  width: 300px;
  flex-shrink: 0;
  position: sticky;
  top: 84px;
  height: calc(100vh - 108px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.aside-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.aside-tab {
  flex: 1;
  padding: 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  border: 0;
  background: none;
  cursor: pointer;
  color: var(--text-muted);
}

.aside-tab.active {
  color: var(--accent);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.aside-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.aside-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  -webkit-overflow-scrolling: touch;
}

.note {
  margin-bottom: 12px;
}

.note .meta {
  font-size: 11px;
  color: var(--text-faint);
  margin-bottom: 3px;
}

.note .bubble {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
}

.note-compose {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  padding: 10px;
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.note-compose textarea {
  flex: 1;
  font: inherit;
  font-size: 13px;
  resize: none;
  max-height: 90px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 8px 9px;
}

.note-compose textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.activity-item {
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.activity-item:last-child {
  border-bottom: 0;
}

.activity-item .meta {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 2px;
}

/* ---------- Upload progress overlay ---------- */
.upload-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 26px 32px;
  box-shadow: var(--shadow-pop);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  min-width: 190px;
}

.upload-ring {
  position: relative;
  width: 72px;
  height: 72px;
}

.upload-ring svg {
  transform: rotate(-90deg);
}

.upload-ring circle {
  fill: none;
  stroke-width: 6;
}

.upload-ring .track {
  stroke: var(--border);
}

.upload-ring .bar {
  stroke: var(--accent);
  stroke-linecap: round;
  transition: stroke-dashoffset .15s ease;
}

.upload-pct {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
}

.upload-label {
  font-size: 14px;
  color: var(--text-muted);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  padding: 11px 18px;
  border-radius: 8px;
  font-size: 14px;
  box-shadow: var(--shadow-pop);
  z-index: 300;
  opacity: 0;
  transition: opacity .2s, transform .2s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(-4px);
}

/* ============================================================
   Responsive — works at any size
   ============================================================ */
@media (max-width: 820px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 60;
    transform: translateX(-100%);
    transition: transform .2s;
    height: 100vh;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-pop);
  }

  .scrim {
    position: fixed;
    inset: 0;
    background: rgba(20, 24, 28, .4);
    z-index: 50;
  }

  .menu-btn {
    display: inline-flex;
  }

  .content {
    padding: 16px;
  }

  .row {
    grid-template-columns: 1fr;
  }

  .client-layout {
    flex-direction: column;
  }

  .client-aside {
    width: 100%;
    position: static;
    height: auto;
    max-height: 70vh;
    margin-top: 8px;
  }

  /* tables collapse to stacked cards */
  table.grid thead {
    display: none;
  }

  table.grid,
  table.grid tbody,
  table.grid tr,
  table.grid td {
    display: block;
    width: 100%;
  }

  table.grid tr {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 10px;
    padding: 6px 4px;
  }

  table.grid td {
    border: 0;
    padding: 7px 14px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
  }

  table.grid td::before {
    content: attr(data-label);
    color: var(--text-faint);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
    font-weight: 600;
  }
}