/* Vimana Leads — shared styles (from the approved mockups) */

:root {
  /* surfaces */
  --bg-a: oklch(0.955 0.03 175);
  --bg-b: oklch(0.95 0.028 235);
  --surface: oklch(1 0 0);
  --surface-2: oklch(0.972 0.01 210);
  --surface-3: oklch(0.94 0.014 215);
  --line: oklch(0.905 0.014 220);

  /* text */
  --ink: oklch(0.24 0.02 250);
  --ink-2: oklch(0.45 0.02 250);
  --ink-3: oklch(0.52 0.018 250);
  --on-ink: oklch(0.99 0 0);
  --focus: oklch(0.58 0.13 210);

  /* status (Red / Amber / Green) + one extra pastel */
  --red-bg: oklch(0.875 0.065 15);
  --red-deep: oklch(0.8 0.09 15);
  --red-ink: oklch(0.42 0.13 22);
  --red-dot: oklch(0.63 0.19 24);
  --amber-bg: oklch(0.915 0.09 88);
  --amber-deep: oklch(0.85 0.12 85);
  --amber-ink: oklch(0.42 0.09 65);
  --amber-dot: oklch(0.74 0.16 72);
  --green-bg: oklch(0.925 0.12 125);
  --green-deep: oklch(0.86 0.15 128);
  --green-ink: oklch(0.4 0.1 140);
  --green-dot: oklch(0.64 0.17 142);
  --teal-bg: oklch(0.87 0.065 185);

  /* shape — concentric: outer = inner + padding */
  --r-lg: 28px;   /* cards, 24px padding */
  --r-md: 20px;   /* items inside cards */
  --r-sm: 14px;   /* inputs */
  --r-pill: 999px;

  --shadow: 0 1px 2px oklch(0.3 0.03 240 / 0.05), 0 10px 30px -12px oklch(0.3 0.04 240 / 0.14);
  --shadow-lift: 0 1px 2px oklch(0.3 0.03 240 / 0.06), 0 16px 36px -14px oklch(0.3 0.04 240 / 0.22);
  --ring: 0 0 0 3px oklch(0.58 0.13 210 / 0.3);
  --ease: cubic-bezier(0.2, 0, 0, 1);

  --z-sticky: 10;
  --z-nav: 20;
  --z-toast: 40;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  min-height: 100%;
  background: linear-gradient(135deg, var(--bg-a), var(--bg-b));
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: "Manrope", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

h1, h2, h3 { margin: 0; line-height: 1.2; text-wrap: balance; }
h1 { font-size: 2rem; font-weight: 600; letter-spacing: -0.02em; }
h2 { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.01em; }
h3 { font-size: 1rem; font-weight: 600; }
p { margin: 0; text-wrap: pretty; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }

:focus-visible { outline: none; box-shadow: var(--ring); }

.muted { color: var(--ink-2); }
.count { color: var(--ink-3); font-weight: 500; }
.num { font-variant-numeric: tabular-nums; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* icons (sprite injected by app.js) */
.i {
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round;
}
.i-sm { width: 16px; height: 16px; }

/* ---------- App shell ---------- */

.app {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  gap: 32px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px 32px 24px 24px;
}

.sidebar {
  position: sticky; top: 24px;
  height: calc(100dvh - 48px);
  display: flex; flex-direction: column;
  gap: 28px;
}

.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 6px 8px;
  font-size: 1.2rem; font-weight: 700; letter-spacing: -0.02em;
  text-decoration: none;
}
.brand-mark {
  display: grid; place-items: center;
  width: 36px; height: 36px;
  border-radius: 11px;
  background: var(--ink); color: var(--on-ink);
  font-size: 1.05rem; font-weight: 700;
}

.nav-label {
  margin: 0 0 8px; padding: 0 12px;
  font-size: 0.8125rem; font-weight: 600; color: var(--ink-2);
}
.nav-label + ul + .nav-label { margin-top: 20px; }
.sidebar ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 12px;
  height: 48px; padding: 0 6px;
  border-radius: var(--r-pill);
  text-decoration: none; font-weight: 500;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}
.nav-ico {
  display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 50%;
  background: oklch(1 0 0 / 0.65);
  transition: background-color 0.2s var(--ease);
}
.sidebar nav a:hover { background: oklch(1 0 0 / 0.55); }
.sidebar nav a[aria-current="page"] { background: var(--ink); color: var(--on-ink); }
.sidebar nav a[aria-current="page"] .nav-ico { background: oklch(1 0 0 / 0.12); }

.sidebar-foot {
  margin-top: auto;
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
  border-radius: var(--r-md);
  background: oklch(1 0 0 / 0.7);
  box-shadow: var(--shadow);
}
.sidebar-foot .who { flex: 1; min-width: 0; line-height: 1.3; }
.sidebar-foot .who strong { display: block; font-weight: 600; }
.sidebar-foot .who span { font-size: 0.8125rem; color: var(--ink-2); }

.main { min-width: 0; display: grid; gap: 24px; align-content: start; }

.mobile-top { display: none; }

.page-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 16px;
  padding-top: 8px;
}
.page-head .sub { margin-top: 6px; color: var(--ink-2); }
.page-head .actions { display: flex; flex-wrap: wrap; gap: 10px; }

.back {
  display: inline-flex; align-items: center; gap: 6px;
  margin-bottom: 10px;
  font-size: 0.875rem; font-weight: 500; color: var(--ink-2); text-decoration: none;
}
.back:hover { color: var(--ink); }

/* ---------- Surfaces ---------- */

.card {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 18px;
  min-height: 40px;
}
.card-head p { font-size: 0.875rem; color: var(--ink-2); margin-top: 2px; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.grid-2.even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stack { display: grid; gap: 24px; align-content: start; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px;
  border: 0; border-radius: var(--r-pill);
  font-weight: 600; font-size: 0.9375rem;
  text-decoration: none; white-space: nowrap; cursor: pointer;
  background: var(--surface-3);
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease), scale 0.15s var(--ease);
}
.btn:hover { background: oklch(0.91 0.016 215); }
.btn:active { scale: 0.96; }
.btn-primary { background: var(--ink); color: var(--on-ink); }
.btn-primary:hover { background: oklch(0.32 0.025 250); }
.btn-danger { background: var(--red-bg); color: var(--red-ink); }
.btn-danger:hover { background: var(--red-deep); }
.btn-sm { height: 36px; padding: 0 14px; font-size: 0.875rem; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; scale: 1; }

.icon-btn {
  position: relative;
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; flex: none;
  border: 0; border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer; text-decoration: none;
  transition: background-color 0.2s var(--ease), scale 0.15s var(--ease);
}
.icon-btn:hover { background: var(--surface-3); }
.icon-btn:active { scale: 0.96; }
.icon-btn.danger:hover { background: var(--red-bg); color: var(--red-ink); }
.icon-btn[disabled] { opacity: 0.4; cursor: not-allowed; scale: 1; }
.icon-btn[disabled]:hover { background: var(--surface-2); color: var(--ink); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ---------- Chips + status ---------- */

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 11px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 0.8125rem; font-weight: 500; white-space: nowrap;
}
a.chip { text-decoration: none; transition: background-color 0.2s var(--ease); }
a.chip:hover { background: var(--surface-3); }
.chip.soft { border-color: transparent; background: var(--surface-2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.status {
  display: inline-flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 12px 0 10px;
  border: 0; border-radius: var(--r-pill);
  font-size: 0.8125rem; font-weight: 600; white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease), scale 0.15s var(--ease);
}
.status::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: currentColor;
  transition: background-color 0.25s var(--ease);
}
.status:active { scale: 0.96; }
.status[data-status="red"]   { background: var(--red-bg);   color: var(--red-ink); }
.status[data-status="red"]::before   { background: var(--red-dot); }
.status[data-status="amber"] { background: var(--amber-bg); color: var(--amber-ink); }
.status[data-status="amber"]::before { background: var(--amber-dot); }
.status[data-status="green"] { background: var(--green-bg); color: var(--green-ink); }
.status[data-status="green"]::before { background: var(--green-dot); }
.status.lg { height: 40px; padding: 0 16px 0 14px; font-size: 0.9375rem; }
span.status { cursor: default; }

.role { font-size: 0.75rem; font-weight: 600; height: 24px; padding: 0 9px; }
.role.admin { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }

/* ---------- Status cards (dashboard / client view) ---------- */

.status-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.status-card {
  display: flex; flex-direction: column; justify-content: space-between;
  min-height: 168px; padding: 20px;
  border-radius: var(--r-lg);
  text-decoration: none;
  transition: box-shadow 0.25s var(--ease), translate 0.25s var(--ease);
}
.status-card:hover { box-shadow: var(--shadow-lift); translate: 0 -2px; }
.status-card.red   { background: var(--red-bg); }
.status-card.amber { background: var(--amber-bg); }
.status-card.green { background: var(--green-bg); }
.status-card .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.status-card h3 { font-size: 1.125rem; font-weight: 600; max-width: 10ch; }
.status-card .go {
  display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 50%;
  background: oklch(1 0 0 / 0.5);
}
.status-card .bottom { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.status-card .meta { font-size: 0.8125rem; line-height: 1.35; }
.status-card .meta span { display: block; opacity: 0.75; }
.status-card .badge {
  display: grid; place-items: center;
  min-width: 52px; height: 52px; padding: 0 10px;
  border-radius: var(--r-pill);
  font-size: 1.125rem; font-weight: 700;
}
.status-card.red .badge   { background: var(--red-deep); }
.status-card.amber .badge { background: var(--amber-deep); }
.status-card.green .badge { background: var(--green-deep); }

/* ---------- Stat strip ---------- */

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
.stat { display: grid; gap: 4px; min-width: 0; }
.stat .label { font-size: 0.875rem; color: var(--ink-2); }
.stat .value { font-size: 1.75rem; font-weight: 600; letter-spacing: -0.02em; }
.stat .bar { height: 4px; border-radius: var(--r-pill); margin-top: 10px; }
.bar.red { background: var(--red-deep); }
.bar.amber { background: var(--amber-deep); }
.bar.green { background: var(--green-deep); }
.bar.teal { background: var(--teal-bg); }

/* ---------- Tables ---------- */

.table-wrap { margin: 0 -8px; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 0.8125rem; font-weight: 600; color: var(--ink-2);
  padding: 0 8px 10px; white-space: nowrap;
}
.table td {
  padding: 14px 8px;
  border-top: 1px solid var(--line);
  vertical-align: middle;
}
.table tbody tr { transition: background-color 0.15s var(--ease); }
.table tbody tr:hover { background: var(--surface-2); }
.table td.num { white-space: nowrap; }
.table .strong { font-weight: 600; }
.table .sub { display: block; font-size: 0.8125rem; color: var(--ink-2); }
.table .right { text-align: right; }
.table a.strong { text-decoration: none; }
.table a.strong:hover { text-decoration: underline; }

/* ---------- Filters ---------- */

.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 20px; }
.filters .field { min-width: 180px; }
.filters .grow { flex: 1; min-width: 220px; }

.segmented {
  display: inline-flex; gap: 4px; padding: 4px;
  border-radius: var(--r-pill); background: var(--surface-2);
}
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.segmented span {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 14px;
  border-radius: var(--r-pill);
  font-size: 0.875rem; font-weight: 500; white-space: nowrap;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}
.segmented input:checked + span { background: var(--surface); box-shadow: var(--shadow); font-weight: 600; }
.segmented input:focus-visible + span { box-shadow: var(--ring); }
.dot { width: 8px; height: 8px; border-radius: 50%; }
.dot.red { background: var(--red-dot); }
.dot.amber { background: var(--amber-dot); }
.dot.green { background: var(--green-dot); }

/* ---------- Forms ---------- */

.form { display: grid; gap: 18px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.field { display: grid; gap: 6px; }
.field > label, .field > .label { font-size: 0.875rem; font-weight: 600; }
.field .hint { font-size: 0.8125rem; color: var(--ink-2); }
.req { color: var(--red-ink); }

.input, .select, .textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--line); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; background: var(--surface); border-color: var(--focus); box-shadow: var(--ring);
}
.textarea { min-height: 112px; resize: vertical; }
.select {
  appearance: none; cursor: pointer; padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23454b57' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
.input-prefix { position: relative; }
.input-prefix span {
  position: absolute; left: 14px; top: 50%; translate: 0 -50%;
  font-weight: 600; color: var(--ink-2); pointer-events: none;
}
.input-prefix .input { padding-left: 30px; }

.field.has-error .input, .field.has-error .select { border-color: var(--red-dot); background: var(--surface); }
.field .error { font-size: 0.8125rem; font-weight: 500; color: var(--red-ink); }

.form-actions { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 4px; }

/* checkbox chips (products picker) */
.pick { display: flex; flex-wrap: wrap; gap: 8px; }
.pick label { position: relative; }
.pick input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.pick span {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 0 14px 0 10px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 0.875rem; font-weight: 500;
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.pick span::before {
  content: ""; width: 18px; height: 18px; border-radius: 6px;
  border: 1.5px solid var(--ink-3);
  background: var(--surface) center / 12px no-repeat;
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.pick input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.pick input:checked + span::before {
  border-color: var(--on-ink); background-color: var(--on-ink);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='%23252a35' stroke-width='3' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}
.pick input:focus-visible + span { box-shadow: var(--ring); }
.pick-empty {
  padding: 14px 16px; border-radius: var(--r-sm);
  background: var(--surface-2); color: var(--ink-2); font-size: 0.875rem;
}

/* ---------- Flash messages ---------- */

.flash {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px; border-radius: var(--r-md);
  font-weight: 500;
}
.flash .i { margin-top: 1px; }
.flash p { flex: 1; }
.flash.ok { background: var(--green-bg); color: var(--green-ink); }
.flash.err { background: var(--red-bg); color: var(--red-ink); }
.flash .icon-btn { width: 32px; height: 32px; margin: -4px -6px -4px 0; background: oklch(1 0 0 / 0.45); color: inherit; }

/* ---------- Avatars + info rows ---------- */

.avatar {
  display: grid; place-items: center; flex: none;
  width: 40px; height: 40px; border-radius: 50%;
  font-size: 0.8125rem; font-weight: 700; text-transform: uppercase;
  background: var(--teal-bg); color: var(--ink);
}
.avatar.a2 { background: var(--amber-bg); }
.avatar.a3 { background: var(--red-bg); }
.avatar.a4 { background: var(--green-bg); }
.avatar.sm { width: 32px; height: 32px; font-size: 0.75rem; }

.info { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 24px; }
.info-item { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.info-item .i { color: var(--ink-3); margin-top: 1px; }
.info-item a { text-decoration: none; }
.info-item a:hover { text-decoration: underline; }
.info-item .wrap { overflow-wrap: anywhere; }

.profile { display: grid; gap: 20px; }
.profile-top { display: flex; align-items: flex-start; gap: 16px; }
.profile-top .avatar { width: 64px; height: 64px; font-size: 1.25rem; border-radius: 22px; }
.profile-top .titles { flex: 1; min-width: 0; }
.profile-top .titles p { color: var(--ink-2); margin-top: 4px; }

.section-label { font-size: 0.8125rem; font-weight: 600; color: var(--ink-2); margin-bottom: 8px; }
.message {
  padding: 16px; border-radius: var(--r-md);
  background: var(--surface-2); max-width: 70ch;
}
.divider { height: 1px; background: var(--line); border: 0; margin: 0; }

/* ---------- Timeline (notes) ---------- */

.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.timeline li { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 12px; }
.tl-when { display: grid; justify-items: center; align-content: start; gap: 8px; padding-top: 2px; text-align: center; }
.tl-when .ico {
  display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--surface-2);
}
.tl-when time { font-size: 0.75rem; line-height: 1.3; color: var(--ink-2); }
.tl-when time b { display: block; font-weight: 600; color: var(--ink); }
.tl-body { padding: 14px 16px; border-radius: var(--r-md); background: var(--surface-2); display: grid; gap: 10px; }
.tl-who { display: flex; align-items: center; gap: 10px; }
.tl-who strong { font-weight: 600; }
.tl-who .chip { margin-left: auto; }
.tl-body p { font-size: 0.9375rem; }

/* ---------- Quotes ---------- */

.quote-latest {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 18px; border-radius: var(--r-md);
  background: var(--amber-bg); color: var(--ink);
}
.quote-latest .amount { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; }
.quote-latest .meta { flex: 1; min-width: 160px; font-size: 0.875rem; }
.quote-latest .meta span { display: block; color: var(--amber-ink); }
.quote-latest .btn { background: oklch(1 0 0 / 0.6); }
.quote-latest .btn:hover { background: oklch(1 0 0 / 0.85); }

.history { list-style: none; margin: 0; padding: 0; }
.history li {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-top: 1px solid var(--line);
}
.history .amt { font-weight: 600; min-width: 84px; }
.history li { flex-wrap: wrap; }
.history .meta { flex: 1 1 140px; min-width: 0; font-size: 0.875rem; color: var(--ink-2); }
.history a.file { font-size: 0.875rem; font-weight: 500; display: inline-flex; gap: 6px; align-items: center; }

.file-drop {
  display: flex; align-items: center; gap: 12px;
  min-height: 48px; padding: 8px 14px;
  border: 1.5px dashed var(--line); border-radius: var(--r-sm);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease);
}
.file-drop:hover { border-color: var(--ink-3); background: var(--surface-2); }
.file-drop:focus-within { border-color: var(--focus); box-shadow: var(--ring); }
.file-drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.file-drop, .file-drop .name { min-width: 0; }
.file-drop .name { font-size: 0.875rem; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Lists (products / users) ---------- */

.list { list-style: none; margin: 0; padding: 0; }
.list > li {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 0; border-top: 1px solid var(--line);
}
.list > li:first-child { border-top: 0; padding-top: 0; }
.list .body { flex: 1; min-width: 0; }
.list .body strong { font-weight: 600; }
.list .body p { font-size: 0.875rem; color: var(--ink-2); margin-top: 2px; }
.list .body .chips { margin-top: 8px; }

details.reset summary { list-style: none; }
details.reset summary::-webkit-details-marker { display: none; }
.reset-form {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  margin-top: 12px; padding: 12px; border-radius: var(--r-md); background: var(--surface-2);
}
.reset-form .input { flex: 1; min-width: 180px; background: var(--surface); min-height: 40px; padding: 8px 12px; }

.inactive .body strong, .inactive .avatar { opacity: 0.5; }

/* ---------- Empty states ---------- */

.empty {
  display: flex;
  flex-direction: column; align-items: center; text-align: center; gap: 10px;
  padding: 40px 20px;
}
.empty .ico {
  display: grid; place-items: center;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--surface-2); margin-bottom: 4px;
}
.empty .ico .i { width: 24px; height: 24px; }
.empty p { color: var(--ink-2); max-width: 42ch; }
.empty .btn { margin-top: 6px; }


/* ---------- Login ---------- */

.login {
  min-height: 100dvh;
  display: grid; place-items: center;
  padding: 24px 16px;
}
.login-card { width: min(100%, 420px); padding: 36px 32px; }
.login-card .brand { padding: 0; margin-bottom: 28px; }
.login-card h1 { font-size: 1.625rem; }
.login-card .sub { color: var(--ink-2); margin: 6px 0 8px; }
.login-card .btn { width: 100%; height: 48px; }
.login-foot { margin-top: 20px; text-align: center; font-size: 0.8125rem; color: var(--ink-2); }

/* ---------- Responsive ---------- */

@media (max-width: 1180px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  body { font-size: 16px; }
  h1 { font-size: 1.625rem; }

  .app { grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 12px 16px 112px; }

  .mobile-top {
    display: flex; align-items: center; justify-content: space-between;
  }
  .mobile-top .brand { padding: 4px 0; font-size: 1.05rem; }

  /* sidebar becomes a bottom tab bar */
  .sidebar {
    position: fixed; top: auto; left: 12px; right: 12px; bottom: 12px;
    height: auto; z-index: var(--z-nav);
    padding: 6px;
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: var(--shadow-lift);
  }
  .sidebar > .brand, .sidebar-foot, .nav-label { display: none; }
  .sidebar nav { display: flex; justify-content: space-around; }
  .sidebar ul { display: contents; }
  .sidebar li { flex: 1; }
  .sidebar nav a {
    flex-direction: column; justify-content: center; gap: 2px;
    height: 58px; padding: 0 4px;
    border-radius: 22px;
    font-size: 0.6875rem; font-weight: 600;
  }
  .nav-ico { width: 28px; height: 28px; background: transparent; }
  .sidebar nav a:hover { background: var(--surface-2); }
  .sidebar nav a[aria-current="page"] .nav-ico { background: transparent; }

  .status-cards { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .status-card { min-height: 0; flex-direction: row; align-items: center; padding: 16px 16px 16px 20px; gap: 12px; }
  .status-card .top { flex: 1; }
  .status-card .top .go { display: none; }
  .status-card .meta { display: none; }
  .status-card .badge { min-width: 48px; height: 48px; }
  .status-card h3 { max-width: none; }

  .card { padding: 20px; border-radius: 24px; }
  .form-row, .info, .grid-2.even { grid-template-columns: minmax(0, 1fr); }
  .stats { gap: 16px; }
  .stat .value { font-size: 1.5rem; }

  .page-head { align-items: flex-start; flex-direction: column; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1; }

  .filters .field, .filters .grow { min-width: 0; flex: 1 1 100%; }
  .segmented { display: flex; overflow-x: auto; }
  .segmented label { flex: none; }
  .segmented span { padding: 0 11px; }

  /* tables become stacked cards */
  .table-wrap { margin: 0; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; }
  .table tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-auto-flow: dense; gap: 8px 12px;
    padding: 16px 0; border-top: 1px solid var(--line);
  }
  .table tbody tr:first-child { border-top: 0; padding-top: 4px; }
  .table tbody tr:hover { background: none; }
  .table td { padding: 0; border: 0; grid-column: 1 / -1; }
  .table td:first-child { grid-column: 1; }
  .table td.st { grid-column: 2; grid-row: 1; align-self: start; }
  .table td.ml { grid-column: 1; color: var(--ink-2); align-self: center; }
  .table td.mr { grid-column: 2; align-self: center; }
  .table td.mr[data-label]::before {
    content: attr(data-label) " ";
    font-size: 0.8125rem; font-weight: 500; color: var(--ink-3);
  }
  .table td.hide-sm { display: none; }
  .table .right { text-align: right; }

  .icon-btn { width: 44px; height: 44px; }
  .list > li { flex-wrap: wrap; }
  .list > li > form:has(.btn) { width: 100%; padding-left: 54px; }
  .timeline li { grid-template-columns: minmax(0, 1fr); }
  .tl-when { display: flex; justify-items: start; align-items: center; text-align: left; }
  .tl-when .ico { display: none; }
  .tl-when time b { display: inline; margin-right: 6px; }

}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; }
  .status-card:hover { translate: none; }
}

/* ---------- Small helpers ---------- */
fieldset.field { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.field legend { float: left; width: 100%; padding: 0; margin-bottom: 6px; font-size: 0.875rem; font-weight: 600; }
fieldset.field .hint { margin: -2px 0 6px; }
.narrow { max-width: 880px; }
.textarea.short { min-height: 80px; }
.history { margin-top: 12px; }
.divider.gap { margin: 20px 0; }
.note-form { margin-bottom: 22px; }
