:root {
  --navy: #1E3A5F;
  --navy-deep: #13253d;
  --orange: #E8792B;
  --green: #6BAA3A;
  --cream: #F4EFE6;
  --paper: #F7F4EF;
  --ink: #142033;
  --muted: #5B6B7E;
  --line: rgba(30, 58, 95, 0.12);
  --serif: "Playfair Display", Georgia, serif;
  --sans: "Outfit", "Segoe UI", sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
body.app-body {
  margin: 0;
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.5;
  padding-bottom: 96px;
}
a { color: var(--navy); }
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; margin: 0 0 0.45em; }
h1 { font-size: 1.85rem; }
h2 { font-size: 1.25rem; }
.app-top {
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.app-brand { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-weight: 600; }
.app-brand img { height: 32px; width: auto; }
.app-top-meta { display: flex; align-items: center; gap: 12px; font-size: 0.9rem; }
.linkish { background: none; border: 0; color: #fff; cursor: pointer; font: inherit; text-decoration: underline; }
.app-nav {
  display: flex;
  gap: 4px;
  background: var(--navy-deep);
  padding: 8px 12px;
  position: sticky;
  top: 52px;
  z-index: 9;
}
.app-nav a {
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.92rem;
}
.app-nav a.active, .app-nav a:hover { background: var(--orange); color: #fff; }
.app-main { width: min(1100px, calc(100% - 32px)); margin: 24px auto 48px; }
.app-head-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; flex-wrap: wrap; }
.kicker { text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.75rem; color: var(--orange); font-weight: 600; margin: 0 0 4px; }
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 16px 14px;
  box-shadow: 0 8px 20px rgba(20,32,51,0.04);
}
.card.alert { border-left: 5px solid var(--orange); }
.card.alert.urgent { border-left-color: #c0392b; }
.card.alert.revisit { border-left-color: var(--green); }
.card.compact h3 { font-size: 1.05rem; }
.stack { display: grid; gap: 12px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 18px 0 28px; }
.form { display: grid; gap: 10px; }
.form label { display: grid; gap: 4px; font-weight: 600; font-size: 0.9rem; }
.form input, .form select, .form textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 11px; font: inherit;
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--orange); color: #fff; border: 0; border-radius: 999px;
  padding: 11px 16px; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn-small { padding: 8px 12px; font-size: 0.88rem; }
.btn-ghost-navy { background: transparent; color: var(--navy); border: 1px solid var(--navy); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  background: var(--cream); color: var(--navy);
}
.badge.urgent, .badge.new { background: #fde8d8; color: #9a3b0a; }
.badge.scheduled { background: #e4eef9; }
.badge.in_progress { background: #f5e7c8; }
.badge.done { background: #e5f3d8; color: #2d5a14; }
.badge.revisit, .badge.reminder { background: #e5f3d8; color: #2d5a14; }
.badge.lead { background: #efe9ff; color: #3d2a7a; }
.muted, .when { color: var(--muted); font-size: 0.88rem; margin: 0 0 6px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filters a {
  text-decoration: none; border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 12px; background: #fff; color: var(--ink); font-weight: 600; font-size: 0.88rem;
}
.filters a.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.table-wrap { overflow-x: auto; background: #fff; border-radius: 14px; border: 1px solid var(--line); }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); }
table.data th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-top: 12px; }
.photo-grid figure { margin: 0; background: #fff; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.photo-grid img { width: 100%; height: 120px; object-fit: cover; display: block; }
.photo-grid figcaption { padding: 6px 8px; font-size: 0.78rem; text-transform: capitalize; }
.plain-list { list-style: none; padding: 0; display: grid; gap: 8px; }
.plain-list li { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.crumb { margin-bottom: 8px; }
.banner { background: #e4eef9; border-radius: 10px; padding: 12px 14px; }
.banner.error { background: #fde8e8; color: #8a1f1f; }
.month-nav { display: flex; gap: 14px; align-items: center; }
.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin: 16px 0 32px;
}
.cal-dow { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 4px; }
.cal-cell {
  min-height: 92px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 6px;
  display: flex; flex-direction: column; gap: 4px;
}
.cal-cell.empty { background: transparent; border-color: transparent; }
.cal-cell.today { outline: 2px solid var(--orange); }
.cal-num { font-weight: 700; font-size: 0.85rem; }
.cal-item {
  display: block; font-size: 0.72rem; line-height: 1.25; text-decoration: none;
  background: var(--cream); color: var(--navy); border-radius: 6px; padding: 3px 5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cal-item.urgent { background: #fde8d8; }
.cal-item.reminder, .cal-item.revisit { background: #e5f3d8; }

.login-page {
  min-height: 100vh; display: grid; place-items: center;
  background: #102338 url('/images/hero/hero.jpg') center/cover no-repeat;
  padding: 24px;
}
.login-page::before {
  content: ""; position: fixed; inset: 0; background: rgba(11,23,38,0.62);
}
.login-card {
  position: relative; width: min(420px, 100%);
  background: var(--navy); color: #fff; border-radius: 20px; padding: 32px 28px;
  text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}
.login-logo { width: 168px; height: auto; margin: 0 auto 10px; }
.login-card form { display: grid; gap: 12px; text-align: left; margin-top: 16px; }
.login-card label { display: grid; gap: 6px; font-weight: 600; }
.login-card input { border: 0; border-radius: 10px; padding: 12px; }
.login-card .btn { width: 100%; }

@media (max-width: 800px) {
  .two-col, .row2 { grid-template-columns: 1fr; }
  .cal-cell { min-height: 64px; }
  .cal-item { display: none; }
  .cal-cell:has(.cal-item) .cal-num { color: var(--orange); }
  .app-nav {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0;
    justify-content: space-around; padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  }
  .app-body { padding-bottom: 110px; }
}

.badge.draft { background: #efe9ff; color: #3d2a7a; }
.badge.sent, .badge.viewed { background: #e4eef9; color: var(--navy); }
.badge.signed { background: #e5f3d8; color: #2d5a14; }
.badge.skipped, .badge.failed { background: #fde8e8; color: #8a1f1f; }
.line-table { width: 100%; border-collapse: collapse; }
.line-table th, .line-table td { padding: 4px 4px; vertical-align: top; }
.line-table th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); text-align: left; }
.line-table input { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px; font: inherit; }
.line-table .col-qty, .line-table .col-unit, .line-table .col-price, .line-table .col-total { width: 88px; }
.totals-box { display: grid; gap: 6px; justify-items: end; margin-top: 12px; font-weight: 600; }
.totals-box p { margin: 0; }
.ptypes { display: flex; flex-wrap: wrap; gap: 10px 16px; }
.ptypes label { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 0.9rem; }
.doc-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.share-box { background: var(--cream); border-radius: 10px; padding: 12px 14px; margin-top: 12px; word-break: break-all; }
.sign-canvas-wrap { background: #fff; border: 1px dashed var(--line); border-radius: 10px; }
#sig-pad { display: block; width: 100%; height: 140px; touch-action: none; }

.voice-card {
  background: var(--navy);
  color: #fff;
  border-radius: 20px;
  padding: 22px 20px 20px;
  margin: 8px 0 28px;
  display: grid;
  gap: 16px;
  box-shadow: 0 16px 40px rgba(19, 37, 61, 0.28);
}
.voice-card .kicker { color: #f3c09a; }
.voice-card h2 { color: #fff; font-size: 1.85rem; margin: 0; }
.voice-lede { margin: 6px 0 0; color: rgba(255,255,255,0.86); max-width: 36rem; }
.voice-mic-wrap { display: grid; justify-items: center; gap: 10px; text-align: center; }
.voice-mic {
  width: 104px; height: 104px;
  border: 0; border-radius: 50%;
  background: var(--orange); color: #fff;
  display: grid; place-items: center;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(232, 121, 43, 0.45);
}
.voice-mic:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.voice-mic.is-recording {
  background: #c0392b;
  animation: voice-pulse 1.1s ease-in-out infinite;
  box-shadow: 0 0 0 8px rgba(192, 57, 43, 0.25);
}
.voice-mic.is-busy { opacity: 0.7; cursor: wait; }
@keyframes voice-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}
.voice-status { margin: 0; font-weight: 600; color: #fff; }
.voice-timer { margin: 0; font-variant-numeric: tabular-nums; color: #f3c09a; font-weight: 700; }
.voice-form label { font-weight: 600; }
.voice-form textarea {
  width: 100%; border: 0; border-radius: 12px;
  padding: 12px; font: inherit; margin: 6px 0 10px;
  min-height: 88px;
}
.voice-transcript blockquote {
  margin: 8px 0 0; font-size: 1.05rem; line-height: 1.45;
}
.voice-summary { font-size: 1.05rem; }
.voice-action { display: grid; gap: 10px; }
.voice-check { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.voice-check input { width: 22px; height: 22px; accent-color: var(--orange); }
.voice-review-form { display: grid; gap: 16px; }
@media (max-width: 800px) {
  .voice-card { padding: 20px 16px 18px; margin-bottom: 22px; }
  .voice-card h2 { font-size: 1.7rem; }
  .voice-mic { width: 112px; height: 112px; }
}
