/* AanDeBak — mobile-first werkvloer UI */
:root {
  --bg: #f4f1eb;
  --bg-card: #ffffff;
  --bg-soft: #ebe6dc;
  --ink: #1c2430;
  --ink-muted: #5c6775;
  --ink-faint: #8a93a0;
  --line: #ddd6c8;
  --primary: #0f6e6a;
  --primary-dark: #0a524f;
  --primary-soft: #d8efed;
  --accent: #e87a2e;
  --accent-soft: #fde8d6;
  --ok: #2f7d4a;
  --ok-soft: #dcefe3;
  --warn: #b7791f;
  --warn-soft: #fef3c7;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --info: #1d4ed8;
  --info-soft: #dbeafe;
  --shadow: 0 4px 16px rgba(28, 36, 48, 0.07);
  --radius: 14px;
  --radius-sm: 10px;
  --nav-h: 64px;
  --header-h: 52px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --touch: 48px;
  --page-pad: 16px;
}

* { box-sizing: border-box; }
html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
}
html, body { margin: 0; }
body {
  min-height: 100%;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button, input, select, textarea { font: inherit; }
a { color: var(--primary); }
button { cursor: pointer; border: none; background: none; color: inherit; }
img { max-width: 100%; display: block; }
.hidden { display: none !important; }

.app-shell {
  min-height: 100dvh;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* —— Login —— */
.login-screen {
  min-height: 100dvh;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(24px, var(--safe-t)) 20px max(24px, var(--safe-b));
  background:
    radial-gradient(ellipse at top left, #d8efed 0%, transparent 50%),
    radial-gradient(ellipse at bottom right, #fde8d6 0%, transparent 45%),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border-radius: 20px;
  padding: 28px 22px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.brand-mark .mark {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), #14948e);
  display: grid; place-items: center;
  color: white; font-size: 1rem; font-weight: 800;
  flex-shrink: 0;
}
.login-card h1 {
  margin: 18px 0 8px;
  font-size: 1.5rem;
  letter-spacing: -0.03em;
  line-height: 1.2;
}
.login-card .tagline {
  color: var(--ink-muted);
  margin: 0 0 24px;
  line-height: 1.5;
  font-size: 0.95rem;
}
.company-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  border: 1px solid var(--line);
  min-height: var(--touch);
}
.company-chip .avatar {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--primary);
  color: white; display: grid; place-items: center;
  font-weight: 700; flex-shrink: 0;
}
.company-chip strong { display: block; font-size: 1rem; }
.company-chip span { color: var(--ink-muted); font-size: 0.875rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 18px;
  border-radius: 12px;
  font-weight: 650;
  font-size: 1rem;
  transition: transform .12s, background .12s, box-shadow .12s;
  min-height: var(--touch);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--primary);
  color: white;
  width: 100%;
  box-shadow: 0 6px 16px rgba(15, 110, 106, 0.28);
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary {
  background: var(--bg-soft);
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-accent {
  background: var(--accent);
  color: white;
}
.btn-ghost {
  color: var(--primary);
  background: var(--primary-soft);
}
.btn-sm {
  min-height: 44px;
  padding: 10px 14px;
  font-size: 0.95rem;
}
.btn-block { width: 100%; }
.login-foot {
  margin-top: 16px;
  text-align: center;
  color: var(--ink-faint);
  font-size: 0.8125rem;
}

/* —— App chrome —— */
.app-header {
  position: sticky; top: 0; z-index: 20;
  min-height: calc(var(--header-h) + var(--safe-t));
  padding: var(--safe-t) max(16px, var(--safe-r)) 0 max(16px, var(--safe-l));
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(244, 241, 235, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.app-header > .brand-mark,
.app-header > .header-meta {
  height: var(--header-h);
  display: flex;
  align-items: center;
}
.app-header .brand-mark { font-size: 1.05rem; }
.app-header .brand-mark .mark { width: 28px; height: 28px; font-size: 0.8rem; border-radius: 8px; }
.header-meta {
  display: flex; align-items: center; gap: 8px;
  color: var(--ink-muted); font-size: 0.8125rem;
}
.header-meta .pill {
  background: var(--primary-soft);
  color: var(--primary-dark);
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 650;
  font-size: 0.75rem;
  max-width: 42vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-main {
  flex: 1;
  padding: 14px var(--page-pad) calc(var(--nav-h) + var(--safe-b) + 20px);
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}

.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  height: calc(var(--nav-h) + var(--safe-b));
  padding: 0 max(var(--safe-l), 2px) var(--safe-b) max(var(--safe-r), 2px);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: rgba(255,255,255,0.97);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 -4px 20px rgba(28, 36, 48, 0.04);
}
.bottom-nav button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--ink-faint);
  font-size: 0.6875rem;
  font-weight: 650;
  min-height: var(--nav-h);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  position: relative;
  letter-spacing: 0.01em;
}
.bottom-nav button .ico {
  font-size: 1.35rem;
  line-height: 1;
  height: 1.35rem;
}
.bottom-nav button.active {
  color: var(--primary);
}
.bottom-nav button.active::before {
  content: "";
  position: absolute;
  top: 0; left: 20%; right: 20%;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--primary);
}

.view { display: none; animation: fade .16s ease; }
.view.active { display: block; }
@keyframes fade {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: none; }
}

.page-title {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  margin-bottom: 14px;
}
.page-title h2 {
  margin: 0;
  font-size: 1.4rem;
  letter-spacing: -0.03em;
  line-height: 1.2;
}
.page-title p {
  margin: 4px 0 0;
  color: var(--ink-muted);
  font-size: 0.9375rem;
}

.grid-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 8px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 14px 12px;
  box-shadow: var(--shadow);
  min-height: 88px;
}
.stat-card .label {
  color: var(--ink-muted);
  font-size: 0.8125rem;
  font-weight: 650;
  line-height: 1.3;
}
.stat-card .value {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-top: 6px;
  line-height: 1.1;
}
.stat-card .hint {
  color: var(--ink-faint);
  font-size: 0.75rem;
  margin-top: 4px;
  line-height: 1.3;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}
.card-h {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 10px;
}
.card-h h3 { margin: 0; font-size: 1.05rem; }
.section-label {
  font-size: 0.75rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  margin: 20px 0 10px;
}

.list { display: flex; flex-direction: column; gap: 8px; }
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 14px 14px 12px;
  box-shadow: var(--shadow);
  transition: border-color .12s, transform .12s;
  min-height: 64px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  position: relative;
  overflow: hidden;
}
.list-item::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--line);
}
.list-item.status-lopend::before { background: var(--info); }
.list-item.status-gepland::before { background: var(--warn); }
.list-item.status-afgerond::before { background: var(--ok); }
.list-item.status-open::before { background: var(--accent); }
.list-item.status-betaald::before,
.list-item.status-goedgekeurd::before { background: var(--ok); }
.list-item.status-phase::before { background: var(--primary); }
.list-item:hover { border-color: #c5bfb0; }
.list-item:active { transform: scale(0.99); }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title {
  font-weight: 700;
  font-size: 1rem;
  margin: 0;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-item .sub {
  color: var(--ink-muted);
  font-size: 0.875rem;
  margin-top: 3px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-item .chev {
  color: var(--ink-faint);
  font-size: 1.35rem;
  flex-shrink: 0;
  line-height: 1;
}
.list-item .meta-right {
  text-align: right;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.list-item .meta-right .amt {
  font-weight: 800;
  font-size: 0.95rem;
}

.badge {
  display: inline-flex; align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.2;
}
.badge-lopend { background: var(--info-soft); color: var(--info); }
.badge-gepland { background: var(--warn-soft); color: var(--warn); }
.badge-afgerond { background: var(--ok-soft); color: var(--ok); }
.badge-open { background: var(--accent-soft); color: #9a4b12; }
.badge-betaald, .badge-goedgekeurd { background: var(--ok-soft); color: var(--ok); }
.badge-phase { background: var(--primary-soft); color: var(--primary-dark); }

.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 4px;
}
.quick-actions .btn {
  justify-content: flex-start;
  padding: 14px 14px;
  font-size: 0.9375rem;
}

.search {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-card);
  margin-bottom: 12px;
  min-height: var(--touch);
  font-size: 1rem;
  -webkit-appearance: none;
  appearance: none;
}
.search:focus {
  outline: 2px solid var(--primary-soft);
  border-color: var(--primary);
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--primary);
  font-weight: 650;
  font-size: 1rem;
  margin-bottom: 8px;
  min-height: 44px;
  padding: 8px 4px 8px 0;
  -webkit-tap-highlight-color: transparent;
}

.detail-head h2 {
  margin: 0 0 8px;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  line-height: 1.25;
}
.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: var(--ink-muted);
  font-size: 0.9375rem;
  margin-bottom: 14px;
}

.kv { display: grid; gap: 0; }
.kv-row {
  display: grid;
  grid-template-columns: 108px 1fr;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
  align-items: start;
}
.kv-row:last-child { border-bottom: none; padding-bottom: 0; }
.kv-row:first-child { padding-top: 0; }
.kv-row .k { color: var(--ink-muted); font-weight: 650; }

.timeline { border-left: 2px solid var(--line); margin-left: 6px; padding-left: 16px; }
.tl-item { position: relative; padding-bottom: 16px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: "";
  position: absolute;
  left: -21px; top: 4px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid white;
  box-shadow: 0 0 0 2px var(--primary-soft);
}
.tl-item .when {
  font-size: 0.8125rem;
  color: var(--ink-faint);
  font-weight: 650;
}
.tl-item .what {
  font-weight: 700;
  margin: 3px 0;
  font-size: 1rem;
}
.tl-item .txt {
  color: var(--ink-muted);
  font-size: 0.9375rem;
  line-height: 1.4;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.photo {
  aspect-ratio: 4/3;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--line);
  background: var(--bg-soft);
}
.photo .swatch {
  width: 100%; height: 100%;
  display: grid; place-items: center;
  color: rgba(255,255,255,0.92);
  font-weight: 700; font-size: 0.875rem;
  text-shadow: 0 1px 2px rgba(0,0,0,.25);
  padding: 10px; text-align: center;
}
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo .cap {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: linear-gradient(transparent, rgba(0,0,0,.7));
  color: white;
  font-size: 0.75rem;
  padding: 20px 8px 8px;
  line-height: 1.3;
}
.photo .hidden-tag {
  position: absolute; top: 8px; right: 8px;
  background: rgba(0,0,0,.7); color: white;
  font-size: 0.6875rem;
  padding: 4px 8px;
  border-radius: 6px;
  font-weight: 650;
}

.phase-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 4px 0 8px;
}
.phase-chip {
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 650;
  background: var(--bg-soft);
  color: var(--ink-muted);
  border: 1px solid var(--line);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.phase-chip.done {
  background: var(--ok-soft);
  color: var(--ok);
  border-color: transparent;
}
.phase-chip.current {
  background: var(--primary);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(15, 110, 106, 0.25);
}
.phase-chip.btnlike { cursor: pointer; }
.phase-chip.btnlike:active { transform: scale(0.97); }

.actions-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 14px 0;
}
.actions-row .btn,
.actions-row .file-label {
  width: 100%;
  justify-content: center;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + var(--safe-b) + 16px);
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: white;
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 0.9375rem;
  font-weight: 650;
  opacity: 0;
  pointer-events: none;
  transition: .2s;
  z-index: 50;
  max-width: calc(100vw - 32px);
  box-shadow: var(--shadow);
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Planning */
.day-block { margin-bottom: 18px; }
.day-block h4 {
  margin: 0 0 10px;
  font-size: 0.8125rem;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 750;
}
.day-block.today h4 { color: var(--primary); }
.plan-item {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 10px;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 12px;
  margin-bottom: 8px;
  width: 100%;
  text-align: left;
  min-height: 64px;
  box-shadow: var(--shadow);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.plan-item:active { transform: scale(0.99); }
.plan-item .time {
  font-weight: 800;
  color: var(--primary);
  font-size: 0.875rem;
}
.plan-item .title {
  font-weight: 700;
  font-size: 0.975rem;
  line-height: 1.3;
}
.plan-item .sub {
  color: var(--ink-muted);
  font-size: 0.8125rem;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.plan-item .who {
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--bg-soft);
  padding: 6px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

/* Documents */
.doc-preview {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.doc-preview .doc-top {
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 14px;
  margin-bottom: 14px;
}
.doc-preview .doc-top .doc-party { text-align: left; }
.doc-preview table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  min-width: 280px;
}
.doc-preview th, .doc-preview td {
  text-align: left;
  padding: 10px 6px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.doc-preview th {
  color: var(--ink-muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.doc-preview .right { text-align: right; }
.doc-total {
  margin-top: 14px;
  text-align: right;
  font-size: 1.2rem;
  font-weight: 800;
}

/* Portal */
.portal-shell {
  min-height: 100dvh;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at top, #d8efed 0%, transparent 40%),
    var(--bg);
  padding-bottom: max(24px, var(--safe-b));
}
.portal-header {
  padding: max(16px, var(--safe-t)) 16px 4px;
  max-width: 640px;
  margin: 0 auto;
}
.portal-main {
  padding: 8px 16px 32px;
  max-width: 640px;
  margin: 0 auto;
}
.portal-banner {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 8px;
}
.portal-banner h2 {
  margin: 14px 0 6px;
  letter-spacing: -0.02em;
  font-size: 1.35rem;
  line-height: 1.25;
}
.portal-banner .by {
  color: var(--ink-muted);
  font-size: 0.875rem;
  margin-top: 6px;
}
.portal-banner .for {
  color: var(--ink-muted);
  font-size: 0.95rem;
}
.status-big {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  padding: 12px 16px;
  border-radius: 999px;
  font-weight: 750;
  font-size: 1rem;
  margin: 14px 0 8px;
  min-height: 48px;
}
.portal-updated {
  font-size: 0.875rem;
  color: var(--ink-muted);
}
.portal-footer {
  text-align: center;
  color: var(--ink-faint);
  font-size: 0.8125rem;
  margin-top: 28px;
  padding-bottom: 16px;
  line-height: 1.5;
}
.portal-footer strong { color: var(--ink-muted); }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(28,36,48,.5);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 60;
  padding: 12px;
  padding-bottom: max(12px, var(--safe-b));
}
.modal-backdrop.show { display: flex; }
.modal {
  background: white;
  border-radius: 20px 20px 16px 16px;
  width: 100%;
  max-width: 440px;
  padding: 22px 20px max(20px, var(--safe-b));
  box-shadow: var(--shadow);
  max-height: min(90vh, 640px);
  overflow-y: auto;
}
.modal h3 { margin: 0 0 8px; font-size: 1.2rem; }
.modal p {
  color: var(--ink-muted);
  margin: 0 0 14px;
  line-height: 1.5;
  font-size: 0.95rem;
}
.share-link {
  display: block;
  width: 100%;
  padding: 14px;
  border-radius: 10px;
  background: var(--bg-soft);
  border: 1px dashed var(--line);
  font-family: ui-monospace, monospace;
  font-size: 0.8125rem;
  word-break: break-all;
  margin-bottom: 14px;
  line-height: 1.4;
}
.file-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 650;
  font-size: 1rem;
  cursor: pointer;
  min-height: var(--touch);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.file-label input { display: none; }

.empty {
  text-align: center;
  color: var(--ink-muted);
  padding: 32px 16px;
  font-size: 0.95rem;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--ink-muted);
  font-weight: 650;
  font-size: 0.9rem;
  white-space: nowrap;
  border: 1px solid transparent;
  min-height: 44px;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.tab.active {
  background: var(--primary);
  color: white;
}

.note-box {
  background: var(--warn-soft);
  border: 1px solid #f6e05e;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.9rem;
  color: #744210;
  margin: 4px 0 14px;
  line-height: 1.45;
}

/* —— Tablet (≥768) —— */
@media (min-width: 768px) {
  :root {
    --page-pad: 24px;
    --header-h: 56px;
    --nav-h: 68px;
  }

  .app-main {
    max-width: 960px;
    padding-top: 20px;
  }

  .page-title h2 { font-size: 1.55rem; }
  .grid-stats { grid-template-columns: repeat(4, 1fr); gap: 12px; }
  .stat-card { min-height: 96px; padding: 16px; }
  .stat-card .value { font-size: 1.75rem; }

  .photo-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; }

  .actions-row {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .actions-row .btn,
  .actions-row .file-label {
    width: auto;
    flex: 1 1 auto;
    min-width: 160px;
  }

  .doc-preview { padding: 24px; }
  .doc-preview .doc-top {
    flex-direction: row;
    justify-content: space-between;
  }
  .doc-preview .doc-top .doc-party { text-align: right; }
  .doc-preview table { font-size: 0.9rem; }

  .bottom-nav button { font-size: 0.75rem; }
  .bottom-nav button .ico { font-size: 1.4rem; }

  .modal-backdrop { align-items: center; padding: 24px; }
  .modal { border-radius: 20px; padding: 24px; }

  .portal-main, .portal-header { max-width: 720px; }
  .portal-banner { padding: 24px; }
  .portal-banner h2 { font-size: 1.5rem; }

  .quick-actions { grid-template-columns: repeat(4, 1fr); }

  /* List + breathing room on tablet */
  .list { gap: 10px; }
  .list-item { padding: 16px 16px 16px 14px; }

  .login-card { padding: 36px 32px; }
}

/* —— Wide tablet / small desktop (≥1024) —— */
@media (min-width: 1024px) {
  .app-main { max-width: 1040px; }
  .grid-stats { gap: 14px; }

  /* Optional two-column detail feel via wide cards */
  .detail-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    align-items: start;
  }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  .view { animation: none; }
  .btn, .list-item, .plan-item, .toast { transition: none; }
}
