/* components.css — buttons, cards, forms, tables, modal, toasts */

/* ── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px;
  border: var(--stroke-2);
  border-radius: var(--r-md);
  box-shadow: var(--pop-sm);
  background: var(--paper);
  color: var(--ink);
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: -0.005em;
  white-space: nowrap;
  transition: transform 0.07s ease, box-shadow 0.07s ease, filter 0.12s ease;
}
.btn:hover  { filter: brightness(0.96); }
/* Press pushes the face into its own shadow — the one motion the drawn
   language asks for, and it only answers a click. */
.btn:active { transform: translate(2px, 2px); box-shadow: none; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: var(--pop-sm); }

.btn-primary { background: var(--yellow); }
.btn-blue    { background: var(--blue);  color: #fff; }
.btn-green   { background: var(--green); color: #fff; }
.btn-danger  { background: var(--red);   color: #fff; }
.btn-ghost   { background: var(--paper); }
.btn-block   { width: 100%; }
.btn-sm      { padding: 6px 11px; font-size: var(--fs-xs); border-radius: var(--r-sm); gap: 5px; }

/* Selected tab keeps the ink border; the rest sit quiet until hovered. */
.btn-tab      { background: rgba(255,255,255,0.92); border-color: var(--line); box-shadow: none; color: var(--text-2); }
.btn-tab.is-on { background: var(--yellow); border-color: var(--ink); box-shadow: var(--pop-sm); color: var(--ink); }

.icon-btn {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center;
  border: none; border-radius: 8px;
  background: rgba(255,255,255,0.16);
  color: #fff;
}
.icon-btn:hover { background: rgba(255,255,255,0.3); }

.menu-btn {
  display: none; place-items: center;
  width: 40px; height: 40px; flex: none;
  border: var(--stroke-2); border-color: rgba(255,255,255,0.5);
  border-radius: var(--r-sm);
  background: rgba(255,255,255,0.14);
  color: #fff;
}

/* Search sits in the navy bar, so it inverts rather than punching a white hole. */
.search-box { position: relative; display: flex; align-items: center; }
.search-box .ico { position: absolute; left: 11px; color: #9FB6D8; pointer-events: none; }
.search-box input {
  width: 260px;
  background: rgba(255,255,255,0.12);
  border: 2px solid rgba(255,255,255,0.28);
  border-radius: var(--r-md);
  padding: 9px 12px 9px 36px;
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: 500;
}
.search-box input::placeholder { color: #9FB6D8; }
.search-box input:focus { background: rgba(255,255,255,0.2); outline-offset: 1px; }

.select-plain {
  background: rgba(255,255,255,0.12);
  border: 2px solid rgba(255,255,255,0.28);
  border-radius: var(--r-md);
  padding: 9px 12px;
  color: #fff; font-size: var(--fs-sm); font-weight: 600;
  max-width: 320px;
}
.select-plain option { color: var(--text); }

/* ── Cards & sections ──────────────────────────────────── */
.card {
  background: var(--paper);
  border: var(--stroke);
  border-radius: var(--r-lg);
  box-shadow: var(--pop);
  padding: 20px;
}

.section-head { display: flex; align-items: center; gap: 12px; }
.section-icon {
  width: 36px; height: 36px; flex: none;
  display: grid; place-items: center;
  border: var(--stroke-2);
  border-radius: var(--r-sm);
  box-shadow: var(--pop-sm);
  background: var(--paper);
}
.section-title { flex: 1; font-size: var(--fs-lg); }
.count-badge {
  min-width: 32px; padding: 3px 10px;
  border: var(--stroke-2);
  border-radius: 999px;
  box-shadow: var(--pop-sm);
  font-size: var(--fs-sm); font-weight: 800; text-align: center;
}

/* ── Grids ─────────────────────────────────────────────── */
.grid { display: grid; gap: 18px; }
.grid-stats { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(370px, 1fr)); }
.grid-quick { grid-template-columns: repeat(auto-fill, minmax(186px, 1fr)); }

/* ── Stat tile ─────────────────────────────────────────────
   The number is the content; the icon is a quiet marker beside the label,
   not a decorative blob above it. */
.stat {
  background: var(--paper);
  border: var(--stroke);
  border-radius: var(--r-lg);
  box-shadow: var(--pop);
  padding: 18px 20px;
  display: grid; gap: 4px;
  position: relative;
  overflow: hidden;
}
.stat::before {
  content: ''; position: absolute; inset: 0 auto 0 0; width: 7px;
  background: var(--accent, var(--blue));
}
.stat-val { font-size: var(--fs-3xl); font-weight: 800; line-height: 1; letter-spacing: -0.03em; }
.stat-row { display: flex; align-items: center; gap: 7px; color: var(--text-2); }
.stat-lbl { font-size: var(--fs-sm); font-weight: 600; }

/* ── Quick action ──────────────────────────────────────── */
.quick {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 15px;
  border: var(--stroke-2);
  border-radius: var(--r-md);
  box-shadow: var(--pop-sm);
  background: var(--paper);
  font-weight: 700; font-size: var(--fs-sm);
  transition: transform 0.07s ease, box-shadow 0.07s ease;
}
.quick:active { transform: translate(2px,2px); box-shadow: none; }
.quick .chip {
  width: 32px; height: 32px; flex: none;
  display: grid; place-items: center;
  border: var(--stroke-2); border-radius: 8px;
  color: var(--ink);
}

/* ── List card ─────────────────────────────────────────── */
.item-card {
  display: flex;
  background: var(--paper);
  border: var(--stroke);
  border-radius: var(--r-lg);
  box-shadow: var(--pop);
  overflow: hidden;
}
.item-stripe { width: 8px; flex: none; background: var(--yellow); }
.item-body { flex: 1; padding: 16px 18px; display: grid; gap: 9px; min-width: 0; }
.item-top { display: flex; gap: 13px; align-items: flex-start; }
.item-num {
  min-width: 44px; height: 44px; flex: none;
  display: grid; place-items: center;
  padding: 0 8px;
  border: var(--stroke-2);
  border-radius: 10px;
  box-shadow: var(--pop-sm);
  font-weight: 800; font-size: var(--fs-sm);
  letter-spacing: -0.02em;
}
.item-title { font-size: var(--fs-md); font-weight: 700; line-height: 1.35; letter-spacing: -0.01em; }
.item-meta  { display: flex; align-items: center; gap: 6px; color: var(--text-3); font-size: var(--fs-xs); font-weight: 500; }
.item-meta .ico { color: var(--text-3); }
.item-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tag-row { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }

/* ── Pills ─────────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  font-size: 11.5px; font-weight: 700;
  color: #fff;
}
.pill .ico { width: 13px; height: 13px; }
.pill-green  { background: var(--green); }
.pill-grey   { background: #8FA0B4; }
.pill-blue   { background: var(--blue); }
.pill-orange { background: var(--orange); }
.pill-soft   { background: #E7F1FC; border-color: var(--line); color: var(--text-2); }

/* ── Forms ─────────────────────────────────────────────────
   Sentence-case labels: a wall of tracked-out caps reads as a form to fill,
   not a tool to use. Weight carries the hierarchy instead. */
.field { display: grid; gap: 6px; }
.field-label { font-size: var(--fs-sm); font-weight: 700; color: var(--text-2); }
.field input, .field select, .field textarea {
  width: 100%;
  background: var(--input);
  border: var(--stroke-2);
  border-radius: var(--r-md);
  box-shadow: var(--pop-sm);
  padding: 10px 13px;
  font-size: var(--fs-sm);
  font-weight: 500;
}
.field textarea { min-height: 108px; resize: vertical; line-height: 1.55; }
.field-hint { color: var(--text-3); font-size: var(--fs-xs); }
.req { color: var(--red); font-weight: 800; }

.form-grid { display: grid; gap: 16px; }
.form-row-2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }

.form-section {
  background: var(--paper);
  border: var(--stroke);
  border-radius: var(--r-lg);
  box-shadow: var(--pop);
  padding: 20px;
  display: grid; gap: 15px;
}
.form-section > h4 { display: flex; align-items: center; gap: 9px; }
.form-desc { color: var(--text-2); font-size: var(--fs-sm); margin-top: -6px; }

.readout {
  white-space: pre-wrap; line-height: 1.6;
  background: var(--input);
  border: var(--stroke-2);
  border-radius: var(--r-md);
  padding: 14px;
  font-size: var(--fs-sm);
}

/* ── Table ─────────────────────────────────────────────── */
.table-wrap {
  background: var(--paper);
  border: var(--stroke);
  border-radius: var(--r-lg);
  box-shadow: var(--pop);
  overflow: auto;
}
table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--navy); color: #fff;
  text-align: left;
  font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.01em;
  padding: 13px 16px; white-space: nowrap;
}
tbody td { padding: 13px 16px; border-top: 2px solid var(--line-2); vertical-align: middle; }
tbody tr:hover { background: #F3F9FF; }
.cell-actions { display: flex; gap: 8px; justify-content: flex-end; }
.cell-person { display: flex; align-items: center; gap: 11px; }
.cell-person strong { font-weight: 700; }

/* ── Progress bar ──────────────────────────────────────── */
.bar {
  height: 12px; min-width: 90px;
  background: #E4EEF9;
  border: var(--stroke-2);
  border-radius: 999px;
  overflow: hidden;
}
.bar > span { display: block; height: 100%; background: var(--green); }

/* ── Empty / loading ───────────────────────────────────────
   An empty screen states what is missing and what to do next. */
.empty {
  display: grid; justify-items: center; gap: 10px;
  padding: 54px 24px;
  background: rgba(255,255,255,0.82);
  border: 2px dashed var(--line);
  border-radius: var(--r-lg);
  text-align: center;
}
.empty-icon {
  width: 56px; height: 56px;
  display: grid; place-items: center;
  border: var(--stroke-2); border-radius: var(--r-md);
  background: var(--paper); color: var(--text-3);
  margin-bottom: 2px;
}
.empty-title { font-size: var(--fs-md); font-weight: 700; }
.empty-sub { color: var(--text-2); font-size: var(--fs-sm); max-width: 40ch; }

.skeleton { display: grid; gap: 16px; }
.skeleton-row {
  height: 88px;
  border: 2px solid var(--line-2);
  border-radius: var(--r-lg);
  background: linear-gradient(90deg, #E9F2FB 25%, #F7FBFF 37%, #E9F2FB 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* ── Modal ─────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(10,20,45,0.55);
  display: grid; place-items: center;
  padding: 32px;
}
.modal {
  width: 100%; max-width: 780px; max-height: 88vh;
  background: var(--bg);
  border: var(--stroke);
  border-radius: var(--r-xl);
  box-shadow: var(--pop), 0 22px 60px rgba(6, 18, 44, 0.35);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.modal.modal-sm { max-width: 460px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: var(--navy);
  border-bottom: var(--stroke);
  padding: 15px 20px;
}
.modal-head h3 { color: #fff; font-size: var(--fs-md); }
.modal-body { padding: 20px; overflow-y: auto; display: grid; gap: 16px; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 15px 20px;
  border-top: 2px solid var(--line);
  background: rgba(255,255,255,0.72);
}

/* ── Toasts ────────────────────────────────────────────── */
.toast-host {
  position: fixed; right: 24px; bottom: 24px; z-index: 80;
  display: grid; gap: 10px; justify-items: end;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--paper);
  border: var(--stroke-2);
  border-left-width: 8px;
  border-radius: var(--r-md);
  box-shadow: var(--pop);
  padding: 12px 16px;
  font-size: var(--fs-sm); font-weight: 600;
  max-width: 390px;
  animation: rise 0.18s ease-out;
}
.toast-ok   { border-left-color: var(--green); }
.toast-ok   .ico { color: var(--green); }
.toast-err  { border-left-color: var(--red); }
.toast-err  .ico { color: var(--red); }
.toast-info { border-left-color: var(--blue); }
.toast-info .ico { color: var(--blue); }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
