/* ==========================================================================
   Yellow IoT Admin — light, minimal UI
   Soft grey canvas, white rounded cards, black pill buttons, orange accent.
   ========================================================================== */

:root {
  --bg: #f3f3f1;
  --card: #ffffff;
  --ink: #161616;
  --ink-2: #2a2a2a;
  --text: #2b2b2b;
  --muted: #8b8b86;
  --line: #ececE8;
  --line-2: #e0e0db;
  --field: #f6f6f4;
  --hover: #f7f7f5;

  /* Brand orange from the Yellow IoT logo */
  --accent: #f99d1d;
  --accent-dark: #df840a;
  --accent-soft: #fff3e2;
  --yellow: var(--accent);
  --yellow-dark: var(--accent-dark);
  --yellow-soft: var(--accent-soft);

  --red: #e5484d;
  --green: #30a46c;

  --radius-lg: 24px;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(22, 22, 22, .03), 0 6px 24px rgba(22, 22, 22, .04);
  --shadow-lg: 0 20px 60px rgba(22, 22, 22, .16);
  --ease: cubic-bezier(.2, .8, .2, 1);

  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  font-feature-settings: "cv11", "ss01";
}

/* Tones used by pills, icons, calendar chips */
.tone-gray, .pill-gray, .cal-gray     { --tone: #7c7c78; --tone-bg: #f1f1ee; --tone-line: #e3e3df; }
.tone-blue, .pill-blue, .cal-blue     { --tone: #2f6fe4; --tone-bg: #edf3ff; --tone-line: #d5e3ff; }
.tone-purple, .pill-purple, .cal-purple { --tone: #7c4ddb; --tone-bg: #f4efff; --tone-line: #e3d8fb; }
.tone-yellow, .pill-yellow, .cal-yellow { --tone: #c27803; --tone-bg: #fff6e0; --tone-line: #fbe5b0; }
.tone-orange, .pill-orange            { --tone: #db6a0b; --tone-bg: #fff1e3; --tone-line: #fddcbd; }
.tone-green, .pill-green, .cal-green  { --tone: #23935c; --tone-bg: #eaf8f0; --tone-line: #cdeedb; }
.tone-red, .pill-red, .cal-red        { --tone: #d93d42; --tone-bg: #fff0f0; --tone-line: #fbd5d6; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text); line-height: 1.45;
  -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased;
}
a { color: var(--ink); text-underline-offset: 3px; }
h1, h2, h3 { color: var(--ink); margin: 0; letter-spacing: -.02em; }
h1 { font-size: 1.85rem; font-weight: 700; line-height: 1.15; }
h2 { font-size: 1.1rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0 0 .5em; }
img { max-width: 100%; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }
.num, .table th.num, .table td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.text-green { color: #1f8a55; }
.text-red { color: #c9353a; }
.text-yellow { color: #b06c02; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.prose p { margin: 0 0 .6em; line-height: 1.55; }
.prose p:last-child { margin-bottom: 0; }
.print-only { display: none; }

/* Icons */
.icon { width: 20px; height: 20px; flex: none; }
.icon-sm { width: 16px; height: 16px; }
.icon-xs { width: 13px; height: 13px; vertical-align: -2px; }
.icon-inline { width: 16px; height: 16px; vertical-align: -3px; }

/* ==========================================================================
   App shell
   ========================================================================== */
.shell {
  display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh;
}

.sidebar {
  position: sticky; top: 16px; margin: 16px 0 16px 16px; height: calc(100vh - 32px);
  background: var(--card); border-radius: var(--radius-lg); box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 14px; padding: 22px 14px 14px; overflow-y: auto;
}
.brand { display: flex; align-items: center; text-decoration: none; padding: 0 10px; }
.brand-wordmark { width: 118px; height: auto; display: block; }
.create-btn { margin: 4px 0 2px; }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-heading {
  font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .09em;
  color: var(--muted); padding: 14px 12px 6px;
}
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 5px 12px 5px 5px; border-radius: 999px;
  color: var(--text); text-decoration: none; font-weight: 550; font-size: .93rem;
  transition: background .15s, color .15s;
}
.nav-icon {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--bg); color: var(--ink); flex: none; transition: background .15s;
}
.nav-icon .icon { width: 18px; height: 18px; }
.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-link:hover { background: var(--hover); }
.nav-link.active { background: var(--ink); color: #fff; }
.nav-link.active .nav-icon { background: #fff; color: var(--ink); }
.nav-count {
  margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px;
  display: inline-grid; place-items: center; font-size: .72rem; font-weight: 700;
  background: var(--accent); color: var(--ink);
}

.sidebar-footer {
  margin-top: auto; display: flex; align-items: center; gap: 8px;
  padding: 10px 6px 6px 8px; border-top: 1px solid var(--line);
}
.me { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; text-decoration: none; padding: 4px; border-radius: 14px; }
.me:hover { background: var(--hover); }
.me-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.me-text strong { font-size: .9rem; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-text small { font-size: .76rem; color: var(--muted); }
.signout { margin: 0; }

.main { padding: 34px 40px 60px; max-width: 1240px; width: 100%; min-width: 0; transition: opacity .2s; }

/* Mobile-only chrome */
.topbar, .tabbar { display: none; }

/* ==========================================================================
   Building blocks
   ========================================================================== */
.card {
  background: var(--card); border-radius: var(--radius-lg); box-shadow: var(--shadow);
  border: 1px solid rgba(22, 22, 22, .03);
}
.card-dark { background: var(--ink); color: #f1f1ef; border-color: var(--ink); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 6px; }
.card-head h2 { font-size: 1.05rem; }
.card-title { font-size: .76rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 14px; }

/* Avatars */
.avatar {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; flex: none;
  background: var(--accent); color: var(--ink); font-weight: 700; font-size: .82rem; text-decoration: none;
}
.avatar-lg { width: 60px; height: 60px; font-size: 1.15rem; }
.avatar-sm { width: 30px; height: 30px; font-size: .7rem; margin-right: 8px; vertical-align: middle; }
.avatar-xs { width: 24px; height: 24px; font-size: .6rem; border: 2px solid #fff; margin-left: -7px; }
.avatars { display: inline-flex; }
.avatars .avatar-xs:first-child { margin-left: 0; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; position: relative;
  min-height: 42px; padding: 10px 18px; border-radius: 999px; border: 1px solid transparent;
  font: inherit; font-weight: 600; font-size: .9rem; line-height: 1.1; cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s, transform .1s, opacity .15s; white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn .icon { width: 18px; height: 18px; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: #333; }
.btn-ghost { background: var(--card); border-color: var(--line-2); color: var(--ink); }
.btn-ghost:hover { background: var(--hover); border-color: #d3d3cd; }
.btn-danger { background: var(--card); border-color: #f6c9ca; color: var(--red); }
.btn-danger:hover { background: #fff5f5; }
.btn-sm { min-height: 34px; padding: 6px 13px; font-size: .82rem; }
.btn-lg { min-height: 50px; padding: 13px 22px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; min-width: 42px; }
.btn[disabled], .btn:disabled { opacity: .55; cursor: default; }
form.button_to { display: inline; margin: 0; }

.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; flex: none;
  border: 1px solid var(--line-2); background: var(--card); color: var(--ink); cursor: pointer; padding: 0;
  transition: background .15s;
}
.icon-btn:hover { background: var(--hover); }
.icon-btn .icon { width: 18px; height: 18px; }
.icon-btn-dark { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .14); color: #fff; }
.icon-btn-dark:hover { background: rgba(255, 255, 255, .18); }

/* Status pills — tinted, with an icon */
/* Default tone, with zero specificity so .pill-green etc. (defined above) win. */
:where(.pill) { --tone: #7c7c78; --tone-bg: #f1f1ee; --tone-line: #e3e3df; }
.pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px 3px 8px; border-radius: 999px;
  font-size: .74rem; font-weight: 600; white-space: nowrap; line-height: 1.4; text-decoration: none;
  color: var(--tone); background: var(--tone-bg); border: 1px solid var(--tone-line);
}
.pill:not(:has(.pill-icon)) { padding-left: 10px; }
.pill-icon { width: 13px; height: 13px; }
.pill span { color: color-mix(in srgb, var(--tone) 70%, var(--ink)); }

/* Chips */
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 3px 12px 3px 3px; border-radius: 999px; background: var(--bg); margin: 0 6px 6px 0; font-size: .87rem; }
.chip .avatar-xs { margin: 0; border: 0; }

/* Segmented progress (dashboard, plans) */
.segments { display: grid; grid-template-columns: repeat(var(--count, 30), 1fr); gap: 3px; height: 34px; margin: 4px 0 12px; }
.segments span { border-radius: 4px; background: #ececE8; }
.segments span.on { background: var(--ink); }
.segments span.on:last-of-type, .segments span.on:has(+ span:not(.on)) { background: var(--accent); }
.progress { height: 8px; border-radius: 999px; background: var(--bg); overflow: hidden; margin-bottom: 14px; }
.progress span { display: block; height: 100%; background: var(--ink); border-radius: inherit; }

/* Flash blocks (inline, e.g. form errors) */
.flash { padding: 13px 16px; border-radius: var(--radius-sm); margin-bottom: 18px; font-size: .92rem; border: 1px solid transparent; }
.flash ul { margin: 6px 0 0; padding-left: 18px; }
.flash-notice { background: #eaf8f0; border-color: #cdeedb; color: #1b6b45; }
.flash-alert { background: #fff0f0; border-color: #fbd5d6; color: #a32a2f; }

/* Toasts */
.toasts {
  position: fixed; z-index: 60; top: 18px; right: 18px; display: flex; flex-direction: column; gap: 10px;
  width: min(380px, calc(100vw - 32px)); pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; border-radius: 18px;
  background: var(--ink); color: #fff; box-shadow: var(--shadow-lg); pointer-events: auto; font-size: .92rem;
  opacity: 0; transform: translateY(-10px) scale(.98); transition: opacity .25s var(--ease), transform .25s var(--ease);
}
.toast.show { opacity: 1; transform: none; }
.toast-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; flex: none; }
.toast-icon .icon { width: 17px; height: 17px; }
.toast-success .toast-icon { background: #30a46c; color: #fff; }
.toast-error .toast-icon { background: var(--red); color: #fff; }
.toast-text { flex: 1; min-width: 0; line-height: 1.35; }
.toast-close { background: none; border: 0; color: rgba(255, 255, 255, .6); font-size: 1.4rem; line-height: 1; padding: 2px 6px; cursor: pointer; }
.toast-close:hover { color: #fff; }

/* Offline banner */
.offline-banner {
  position: fixed; z-index: 70; left: 50%; top: calc(12px + env(safe-area-inset-top)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 999px;
  background: var(--ink); color: #fff; font-size: .86rem; font-weight: 550; box-shadow: var(--shadow-lg);
  width: max-content; max-width: calc(100vw - 32px); white-space: nowrap;
  animation: drop-in .3s var(--ease);
}
.offline-banner[data-state="online"] { background: var(--green); }
@keyframes drop-in { from { opacity: 0; transform: translate(-50%, -12px); } }

/* ==========================================================================
   Loading — slow networks
   ========================================================================== */
.turbo-progress-bar {
  height: 3px; background: linear-gradient(90deg, var(--accent), #ffc56e, var(--accent));
  background-size: 200% 100%; animation: shimmer 1.2s linear infinite;
  box-shadow: 0 0 10px rgba(249, 157, 29, .5);
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* Page is loading: fade the content a little (only if it takes a while). */
html[aria-busy="true"] .main { opacity: .55; transition-delay: .25s; pointer-events: none; }

/* Form is being sent: spinner on the button that was pressed. */
@keyframes spin { to { transform: rotate(360deg); } }
.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading::after::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid currentColor; border-color: #fff #fff transparent transparent; animation: spin .7s linear infinite;
}
.btn-ghost.is-loading::after, .btn-danger.is-loading::after { border-color: var(--ink) var(--ink) transparent transparent; }
.icon-btn.is-loading { color: transparent; position: relative; }
.icon-btn.is-loading::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--ink); border-color: var(--ink) var(--ink) transparent transparent; animation: spin .7s linear infinite;
}
form[aria-busy="true"] { cursor: progress; }
.checklist form[aria-busy="true"] label { opacity: .5; }

/* Uploading photos: a floating pill so people know to wait. */
html.uploading::after {
  content: "Uploading photos…"; position: fixed; z-index: 70; left: 50%; bottom: calc(110px + env(safe-area-inset-bottom));
  transform: translateX(-50%); padding: 11px 18px 11px 42px; border-radius: 999px; background: var(--ink); color: #fff;
  font-size: .88rem; font-weight: 600; box-shadow: var(--shadow-lg);
  background-image: radial-gradient(circle at 22px 50%, var(--accent) 0 5px, transparent 6px);
  animation: pulse-dot 1s ease-in-out infinite alternate;
}
@keyframes pulse-dot { to { background-image: radial-gradient(circle at 22px 50%, var(--accent) 0 3px, transparent 4px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ==========================================================================
   Pages
   ========================================================================== */
.page-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.page-header p { margin: 6px 0 0; }
.eyebrow { margin: 0 0 6px; font-size: .82rem; color: var(--muted); }
.eyebrow a { color: var(--muted); text-decoration: none; }
.eyebrow a:hover { color: var(--ink); }
.header-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.work-header { align-items: flex-end; }
.work-badges { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 10px 0 0; }

.section-title { font-size: 1.1rem; margin: 34px 0 14px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 34px 0 14px; }
.section-head .section-title { margin: 0; }
section[id] { scroll-margin-top: 90px; }

/* Chip-style tabs and section links */
.tabs, .section-nav { display: flex; gap: 6px; margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; padding: 1px; }
.tabs::-webkit-scrollbar, .section-nav::-webkit-scrollbar, .cat-chips::-webkit-scrollbar { display: none; }
.tab, .section-nav a {
  flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 8px 15px; border-radius: 999px;
  text-decoration: none; font-size: .87rem; font-weight: 600; color: var(--text);
  background: var(--card); border: 1px solid var(--line-2); white-space: nowrap; transition: background .15s;
}
.tab:hover, .section-nav a:hover { background: var(--hover); }
.tab.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.section-nav .count, .tab .count { color: var(--muted); font-weight: 500; }
.tab.active .count { color: rgba(255, 255, 255, .6); }

.segmented { display: inline-flex; background: #e8e8e4; border-radius: 999px; padding: 4px; gap: 2px; }
.segmented a { text-decoration: none; padding: 7px 16px; border-radius: 999px; font-weight: 600; font-size: .87rem; color: var(--muted); }
.segmented a.active { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.segmented-lg { display: flex; width: 100%; max-width: 420px; }
.segmented-lg label { flex: 1; text-align: center; padding: 10px 14px; border-radius: 999px; font-weight: 600; font-size: .92rem; color: var(--muted); cursor: pointer; }
.segmented-lg input { position: absolute; opacity: 0; pointer-events: none; }
.segmented-lg label:has(input:checked) { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.segmented-lg label:has(input:focus-visible) { outline: 2px solid var(--accent); }

.searchbar { margin-bottom: 14px; max-width: 520px; }
.searchbar input[type=search], .tool-filters input[type=search] {
  padding-left: 42px; border-radius: 999px; background-color: var(--card);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b8b86' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 15px 50%; background-size: 18px;
}

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.stat {
  display: flex; flex-direction: column; gap: 4px; padding: 18px 20px; text-decoration: none; color: inherit;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid rgba(22, 22, 22, .03);
  transition: transform .15s, box-shadow .15s;
}
a.stat:hover { transform: translateY(-1px); box-shadow: 0 10px 30px rgba(22, 22, 22, .07); }
.stat-label { color: var(--muted); font-size: .84rem; font-weight: 550; }
.stat-value { font-size: 1.9rem; font-weight: 700; color: var(--ink); letter-spacing: -.03em; line-height: 1.1; }
.stat small.muted { font-size: .8rem; }
.stat-warn .stat-label::before, .stat-danger .stat-label::before {
  content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; vertical-align: 1px;
}
.stat-warn .stat-label::before { background: #f5a524; }
.stat-danger .stat-label::before { background: var(--red); }
.stat-warn .stat-value { color: #b06c02; }
.stat-danger .stat-value { color: #c9353a; }

/* Callout (a card with a small accent) */
.callout { padding: 16px 18px; margin-bottom: 18px; display: flex; flex-direction: column; gap: 8px; position: relative; }
.callout::before { content: ""; position: absolute; left: 0; top: 18px; bottom: 18px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.callout-link { display: flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 550; flex-wrap: wrap; }
.callout .button_to { align-self: flex-start; }

/* Lists of rows (dashboard, settings) */
.row-list { padding: 6px; display: flex; flex-direction: column; }
.row-item {
  display: flex; align-items: center; gap: 14px; padding: 10px 12px; border-radius: var(--radius);
  text-decoration: none; color: inherit; transition: background .15s;
}
.row-item + .row-item { position: relative; }
.row-item + .row-item::before { content: ""; position: absolute; top: 0; left: 62px; right: 12px; border-top: 1px solid var(--line); }
.row-item:hover { background: var(--hover); }
.row-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; flex: none; color: var(--tone); background: var(--tone-bg); }
.row-icon .icon { width: 19px; height: 19px; }
.row-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.row-text strong { font-weight: 600; color: var(--ink); font-size: .94rem; }
.row-text small { color: var(--muted); font-size: .83rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-chevron { color: #b8b8b3; font-size: 1.5rem; line-height: 1; padding-right: 4px; }

.link-list { display: flex; flex-direction: column; padding: 6px; }
.link-list a { display: grid; grid-template-columns: 24px auto 1fr; align-items: center; gap: 12px; padding: 13px 14px; border-radius: var(--radius); text-decoration: none; font-weight: 600; }
.link-list a:hover { background: var(--hover); }
.link-list .muted { font-weight: 400; font-size: .85rem; text-align: right; }

.empty { padding: 28px; text-align: center; margin: 0; color: var(--muted); }
.empty-state { padding: 36px 24px; text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.empty-state p { margin: 0; }
.empty-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--bg); color: var(--muted); }

/* ==========================================================================
   Dashboard
   ========================================================================== */
.dash-top { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 16px; }
.hero { padding: 22px; display: flex; flex-direction: column; gap: 22px; }
.hero-head { display: flex; justify-content: space-between; align-items: center; font-weight: 600; color: rgba(255, 255, 255, .7); }
.hero-figures { display: flex; align-items: center; gap: 22px; }
.hero-figures > div { display: flex; align-items: center; gap: 12px; }
.hero-figures strong { font-size: 3rem; font-weight: 700; letter-spacing: -.04em; color: #fff; line-height: 1; }
.hero-figures span { font-size: .84rem; color: rgba(255, 255, 255, .6); line-height: 1.3; }
.hero-divider { width: 1px; align-self: stretch; background: rgba(255, 255, 255, .14); }
.hero-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.hero-tile {
  display: flex; flex-direction: column; gap: 2px; padding: 14px; border-radius: var(--radius);
  background: rgba(255, 255, 255, .07); color: #fff; text-decoration: none; transition: background .15s;
}
.hero-tile:hover { background: rgba(255, 255, 255, .13); }
.hero-tile .icon { width: 18px; height: 18px; color: var(--accent); margin-bottom: 10px; }
.hero-tile strong { font-size: 1.4rem; line-height: 1.1; }
.hero-tile small { font-size: .76rem; color: rgba(255, 255, 255, .6); }

.week-card { padding: 22px; display: flex; flex-direction: column; }
.week-card > p { margin: 0 0 auto; font-size: .88rem; }
.big-figure { display: flex; align-items: center; gap: 12px; margin: 18px 0 10px; }
.big-figure strong { font-size: 2.8rem; font-weight: 700; letter-spacing: -.04em; color: var(--ink); line-height: 1; }

.timeline { padding: 8px 6px; display: flex; flex-direction: column; }
.timeline-item {
  display: grid; grid-template-columns: 64px 14px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 12px; border-radius: var(--radius); text-decoration: none; color: inherit; position: relative;
}
.timeline-item:hover { background: var(--hover); }
.timeline-item:not(:last-child)::after { content: ""; position: absolute; left: 94px; top: 36px; bottom: -12px; border-left: 2px dotted var(--line-2); }
.timeline-time { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); font-size: .92rem; }
.timeline-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--card); border: 3px solid var(--tone); position: relative; z-index: 1; justify-self: center; }
.timeline-body { display: flex; flex-direction: column; min-width: 0; }
.timeline-body strong { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timeline-body small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timeline-meta { display: flex; align-items: center; gap: 10px; }

/* Quick action cards (equipment, trip) */
.quick-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-bottom: 14px; }
.quick-card { display: flex; align-items: center; gap: 12px; padding: 14px 16px; text-decoration: none; color: inherit; flex-wrap: wrap; }
.quick-card:hover { box-shadow: 0 10px 30px rgba(22, 22, 22, .07); }
.quick-card > span:nth-child(2) { display: flex; flex-direction: column; flex: 1; }
.quick-trip { grid-column: 1 / -1; }
.quick-trip .adjust-row { flex-basis: 100%; }
.quick-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-dark); flex: none; }

/* ==========================================================================
   Tables — rows float as rounded strips
   ========================================================================== */
.table-card { overflow-x: auto; padding: 6px 10px; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .92rem; }
.table th {
  text-align: left; font-size: .76rem; font-weight: 600; color: var(--muted);
  padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover td { background: var(--hover); }
.table tbody tr:hover td:first-child { border-radius: 14px 0 0 14px; }
.table tbody tr:hover td:last-child { border-radius: 0 14px 14px 0; }
.table td a { font-weight: 600; text-decoration: none; }
.table td a:hover { text-decoration: underline; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions .btn { margin-left: 4px; }
.cell-title { font-weight: 600; color: var(--ink); }
tr.inactive td { opacity: .55; }

/* ==========================================================================
   Forms
   ========================================================================== */
.form { display: flex; flex-direction: column; gap: 16px; }
.form-card { padding: 26px; max-width: 680px; }
.stacked-form { gap: 16px; }
.form-section { max-width: 880px; margin: 0; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
fieldset.card { border: 1px solid rgba(22, 22, 22, .03); }
.form-section legend { float: left; width: 100%; font-weight: 650; font-size: 1.05rem; color: var(--ink); padding: 0; margin-bottom: 2px; letter-spacing: -.01em; }
.form-section legend + * { clear: both; }
.form-hint { margin: -6px 0 0; font-size: .86rem; color: var(--muted); }

.field { display: flex; flex-direction: column; gap: 7px; flex: 1; min-width: 0; }
.label, .field label { font-weight: 600; font-size: .85rem; color: var(--ink); }
.field small { font-size: .8rem; }
.field-row { display: flex; gap: 16px; flex-wrap: wrap; }
.field-row .field { min-width: 200px; }
.field-narrow { max-width: 130px; flex: none; }
.field-grow { flex: 3; }

input[type=text], input[type=email], input[type=password], input[type=search], input[type=tel], input[type=url],
input[type=number], input[type=date], input[type=time], input[type=datetime-local], select, textarea {
  font: inherit; font-size: .94rem; color: var(--text); width: 100%; min-height: 44px; padding: 10px 14px;
  background: var(--field); border: 1px solid transparent; border-radius: 14px;
  transition: border-color .15s, box-shadow .15s, background .15s; -webkit-appearance: none; appearance: none;
}
select {
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23161616' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; background-size: 16px;
}
textarea { resize: vertical; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: #aaaaa5; }
input:hover, select:hover, textarea:hover { border-color: var(--line-2); }
input:focus, select:focus, textarea:focus { outline: none; background-color: var(--card); border-color: var(--ink); box-shadow: 0 0 0 4px rgba(22, 22, 22, .06); }
input[type=checkbox], input[type=radio] { accent-color: var(--ink); }
input[type=file] { font: inherit; font-size: .88rem; }
:is(.form-card, .form-section) :is(input:not([type=submit], [type=button], [type=checkbox], [type=radio], [type=file]), select, textarea) { background-color: var(--field); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.input-with-button { display: flex; gap: 8px; }
.input-with-button input { flex: 1; min-width: 0; }
.sticky-actions {
  position: sticky; bottom: 12px; z-index: 5; max-width: 880px; padding: 10px; margin-top: 4px;
  background: rgba(255, 255, 255, .85); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-radius: 999px; box-shadow: var(--shadow-lg);
}
.danger-zone { max-width: 880px; margin-top: 28px; padding-top: 18px; border-top: 1px dashed var(--line-2); }

.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.check-tile {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px; border: 1px solid var(--line-2); border-radius: 14px;
  cursor: pointer; font-weight: 550; font-size: .92rem; background: var(--card); transition: border-color .15s, background .15s;
}
.check-tile input { width: 18px; height: 18px; }
.check-tile small { margin-left: auto; }
.check-tile:has(input:checked) { border-color: var(--ink); background: var(--hover); box-shadow: inset 0 0 0 1px var(--ink); }
.radio-cards { display: flex; flex-direction: column; gap: 8px; }

.nested-list { display: flex; flex-direction: column; gap: 10px; }
.nested-list:empty { display: none; }
.nested-row-inline { display: flex; gap: 8px; align-items: center; }
.line-item { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 10px; background: #fbfbfa; }
.line-item input, .line-item select { background-color: var(--card); }
.line-item-numbers .field { min-width: 90px; }
.line-total { justify-content: flex-end; }
.line-total strong { padding: 10px 0; font-variant-numeric: tabular-nums; }
.line-remove { align-self: flex-start; }

.icon-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 8px; }
.icon-picker label, .color-picker label { cursor: pointer; }
.icon-picker input, .color-picker input, .weekday-picker input, .kind-picker input { position: absolute; opacity: 0; pointer-events: none; }
.icon-picker span { display: grid; place-items: center; height: 48px; border: 1px solid var(--line-2); border-radius: 14px; color: var(--ink); background: var(--card); }
.icon-picker input:checked + span { border-color: var(--ink); background: var(--ink); color: #fff; }
.color-picker { display: flex; gap: 10px; flex-wrap: wrap; }
.color-picker span { display: block; width: 36px; height: 36px; border-radius: 50%; background: var(--swatch); border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line-2); }
.color-picker input:checked + span { box-shadow: 0 0 0 3px var(--ink); }
.weekday-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.weekday-picker span { display: inline-grid; place-items: center; min-width: 50px; height: 40px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 999px; font-weight: 600; font-size: .87rem; cursor: pointer; background: var(--card); }
.weekday-picker input:checked + span { background: var(--ink); color: #fff; border-color: var(--ink); }
.kind-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.kind-picker label { --cat: var(--ink); cursor: pointer; }
.kind-picker span { display: flex; align-items: center; gap: 8px; padding: 11px 13px; border: 1px solid var(--line-2); border-radius: 14px; background: var(--card); font-weight: 600; font-size: .87rem; }
.kind-picker span .icon { color: var(--cat); }
.kind-picker input:checked + span { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); background: var(--hover); }
.kind-picker-sm { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.client-form[data-kind="pf"] .pj-only, .client-form[data-kind="pj"] .pf-only { display: none !important; }

/* Signature */
.signature-pad { position: relative; height: 190px; border: 1.5px dashed var(--line-2); border-radius: var(--radius); background: #fbfbfa; touch-action: none; }
.signature-pad canvas { width: 100%; height: 100%; display: block; cursor: crosshair; touch-action: none; }
.signature-placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: #b3b3ae; pointer-events: none; font-size: .95rem; }
.signature-existing { display: flex; flex-direction: column; gap: 6px; }
.signature-existing img { max-width: 280px; max-height: 110px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }

/* ==========================================================================
   Auth
   ========================================================================== */
.auth { min-height: 100vh; display: grid; place-items: center; align-content: center; padding: 24px; background: var(--bg); }
.auth-card { width: 100%; max-width: 410px; background: var(--card); border-radius: 28px; padding: 34px 32px; box-shadow: var(--shadow); }
.auth-brand { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-bottom: 28px; }
.auth-wordmark { width: 170px; height: auto; display: block; }
.auth-brand small { color: var(--muted); font-size: .8rem; }
.auth-title { font-size: 1.45rem; }
.auth-card > p.muted { margin: 6px 0 20px; }
.auth-footer { text-align: center; margin: 20px 0 0; font-size: .9rem; }
.auth .btn-primary { min-height: 48px; }

/* "Add to Home Screen" hint (iPhone Safari only) */
.install-hint { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; margin-bottom: 18px; }
.install-hint-icon { width: 42px; height: 42px; border-radius: 10px; flex: none; }
.install-hint-text { display: flex; flex-direction: column; gap: 2px; font-size: .88rem; color: var(--ink); flex: 1; }
.install-hint-close { background: none; border: 0; font-size: 1.5rem; line-height: 1; color: var(--muted); padding: 4px 8px; cursor: pointer; }
.auth .install-hint { width: 100%; max-width: 410px; margin: 16px 0 0; }

/* Account */
.profile { display: flex; align-items: center; gap: 16px; padding: 22px; margin-bottom: 16px; }
.profile h2 { font-size: 1.15rem; }
.profile p { margin: 4px 0 8px; word-break: break-all; }
.push-status { font-weight: 600; }
.push-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ==========================================================================
   Works
   ========================================================================== */
.work-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.work-card {
  display: flex; flex-direction: column; gap: 12px; padding: 18px; text-decoration: none; color: inherit;
  transition: transform .15s var(--ease), box-shadow .15s;
}
.work-card:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(22, 22, 22, .08); }
.work-card h3 { font-size: 1.02rem; line-height: 1.3; }
.work-card-top, .work-card-bottom { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.work-card-bottom { font-size: .85rem; border-top: 1px solid var(--line); padding-top: 12px; margin-top: auto; }
.work-number { font-weight: 600; font-size: .78rem; color: var(--muted); letter-spacing: .02em; }
.work-meta { display: flex; flex-direction: column; gap: 5px; font-size: .87rem; color: #55554f; }
.work-meta span { display: flex; align-items: center; gap: 7px; }
.work-meta .icon { color: var(--muted); width: 16px; height: 16px; }

.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.detail-wide { grid-column: 1 / -1; }
.detail-card { padding: 20px 22px; }
.detail-card + .detail-card { margin-top: 12px; }
.detail-grid .detail-card { margin-top: 0; }
.facts { display: grid; grid-template-columns: 112px 1fr; gap: 11px 14px; margin: 0; font-size: .93rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

.checklist { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; }
.checklist li { border-top: 1px solid var(--line); }
.checklist li:first-child { border-top: 0; }
.checklist form { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 11px 0; flex-wrap: wrap; }
.checklist label { display: flex; align-items: center; gap: 12px; cursor: pointer; font-size: .95rem; }
.checklist input[type=checkbox] { width: 22px; height: 22px; flex: none; }
.checklist li.done span { text-decoration: line-through; color: var(--muted); }
.plain-checklist { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 8px; }
.plain-checklist li { display: flex; align-items: center; gap: 8px; }
.plain-checklist .icon { color: var(--green); }

.totals { display: grid; grid-template-columns: 1fr auto; gap: 7px 24px; margin: 0; padding: 16px 14px 10px; border-top: 1px solid var(--line); font-size: .93rem; justify-items: end; }
.totals dt { color: var(--muted); }
.totals dd { margin: 0; font-variant-numeric: tabular-nums; }
.totals .grand { font-weight: 700; color: var(--ink); font-size: 1.1rem; }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: 8px; margin-bottom: 14px; }
.photo { position: relative; margin: 0; aspect-ratio: 1; border-radius: 16px; overflow: hidden; background: var(--bg); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s var(--ease); }
.photo:hover img { transform: scale(1.03); }
.photo form.button_to { display: contents; }
.photo-remove { position: absolute; top: 7px; right: 7px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(22, 22, 22, .7); color: #fff; font-size: 1.1rem; line-height: 1; cursor: pointer; backdrop-filter: blur(6px); }
.photo-upload { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.photo-upload label.btn { cursor: pointer; }
.photo-upload[aria-busy="true"] label.btn { opacity: .6; pointer-events: none; }
.report-link { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; font-size: .8rem; color: var(--muted); }

/* Proces-verbal document */
.pv { padding: 34px; max-width: 880px; display: flex; flex-direction: column; gap: 24px; }
.pv h2, .po-doc h2 { font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 6px; }
.pv p, .po-doc p { margin: 0; line-height: 1.5; }
.pv-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding-bottom: 20px; border-bottom: 3px solid var(--accent); flex-wrap: wrap; }
.pv-brand { display: flex; flex-direction: column; gap: 6px; }
.pv-brand small { color: var(--muted); font-size: .78rem; }
.pv-wordmark { width: 150px; height: auto; display: block; }
.pv-title { text-align: right; }
.pv-title h1 { font-size: 1.5rem; text-transform: uppercase; letter-spacing: .04em; }
.pv-title p { color: var(--muted); }
.pv-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.pv-table th { background: transparent; }
.pv-signatures { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; border-top: 1px solid var(--line); padding-top: 20px; }
.pv-signature { max-width: 240px; max-height: 100px; margin-top: 8px; }
.pv-signature-line { height: 70px; border-bottom: 1px solid var(--ink); max-width: 240px; }

/* ==========================================================================
   Calendar
   ========================================================================== */
.cal-header { align-items: flex-end; }
.cal-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-nav .btn-icon { width: 42px; font-size: 1.2rem; line-height: 1; padding: 0; }
.cal-title { font-size: 1.2rem; margin-left: 10px; text-transform: capitalize; }
.cal-filter select { min-width: 210px; background-color: var(--card); border-radius: 999px; }

.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); overflow: hidden; padding: 8px; }
.cal-weekday { padding: 8px 10px 10px; font-size: .74rem; font-weight: 600; color: var(--muted); }
.cal-day {
  position: relative; min-height: 118px; padding: 6px; display: flex; flex-direction: column; gap: 4px; min-width: 0;
  border-top: 1px solid var(--line); border-radius: 0;
}
.cal-day.weekend { background: #fbfbfa; }
.cal-day.other-month .cal-daynum { color: #c6c6c1; }
.cal-day.selected { background: var(--hover); border-radius: 14px; box-shadow: inset 0 0 0 1.5px var(--ink); }
.cal-daynum {
  align-self: flex-start; display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 4px;
  border-radius: 999px; font-size: .84rem; font-weight: 600; color: var(--ink); text-decoration: none;
}
.cal-daynum:hover { background: var(--bg); }
.cal-day.today .cal-daynum { background: var(--accent); color: var(--ink); }
.cal-chips { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
:where(.cal-chip) { --tone: #7c7c78; --tone-bg: #f1f1ee; }
.cal-chip {
  display: flex; align-items: center; gap: 5px; min-width: 0; padding: 4px 7px; border-radius: 8px;
  font-size: .74rem; line-height: 1.25; text-decoration: none; color: var(--ink); background: var(--tone-bg);
  box-shadow: inset 3px 0 0 var(--tone);
}
.cal-chip:hover { filter: brightness(.97); }
.cal-time { font-weight: 700; font-variant-numeric: tabular-nums; flex: none; }
.cal-chip-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.cal-chip-team { flex: none; font-size: .64rem; font-weight: 700; color: var(--muted); }
.cal-more { font-size: .74rem; color: var(--muted); padding-left: 6px; text-decoration: none; }
.cal-dots { display: none; }

.cal-agenda { margin-top: 8px; }
.agenda-list { display: flex; flex-direction: column; gap: 10px; }
.agenda-item { display: flex; gap: 16px; padding: 16px 18px; text-decoration: none; color: inherit; transition: box-shadow .15s; }
.agenda-item:hover { box-shadow: 0 10px 30px rgba(22, 22, 22, .07); }
.agenda-time { flex: none; width: 64px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); }
.agenda-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.agenda-team { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; }
.agenda-team .chip { margin: 0; }

.cal-week-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 6px; }
.cal-week { width: 100%; min-width: 860px; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.cal-week th, .cal-week td { border-bottom: 1px solid var(--line); padding: 7px; vertical-align: top; text-align: left; }
.cal-week tbody tr:last-child th, .cal-week tbody tr:last-child td { border-bottom: 0; }
.cal-week thead th { font-size: .78rem; color: var(--muted); font-weight: 600; }
.cal-week thead th strong { color: var(--ink); font-size: .96rem; margin-left: 2px; }
.cal-week thead th.today { background: var(--accent-soft); border-radius: 12px 12px 0 0; }
.cal-week td.today { background: #fffaf2; }
.cal-week td.weekend { background: #fbfbfa; }
.cal-week td { height: 66px; }
.cal-week td .cal-chip { margin-bottom: 4px; }
.cal-person-col { width: 170px; position: sticky; left: 0; background: var(--card); z-index: 1; }
.cal-person { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: .88rem; text-decoration: none; color: var(--ink); }
.cal-person .avatar-sm { margin: 0; }
tr.unassigned th { font-style: italic; }

.cal-legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 14px 0 0; font-size: .8rem; color: var(--muted); }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend i, .cal-dots i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--tone); }
.cal-subscribe { display: flex; align-items: center; gap: 6px; margin-top: 24px; font-size: .88rem; flex-wrap: wrap; }

.cal-forecast { background: repeating-linear-gradient(135deg, #f8f8f6, #f8f8f6 6px, #f0f0ed 6px, #f0f0ed 12px); box-shadow: inset 0 0 0 1px #d6d6d0; color: #44443f; }
.cal-chip-icon { width: 12px; height: 12px; flex: none; color: #6f6f6a; }
.cal-forecast-dot { background: transparent !important; border: 1.5px dashed #6f6f6a; box-sizing: border-box; }
.agenda-forecast { border: 1.5px dashed var(--line-2); background: #fbfbfa; box-shadow: none; }
.agenda-forecast strong { display: flex; align-items: center; gap: 6px; }

.feed-card { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; padding: 20px 22px; }
.feed-card p { margin: 0; line-height: 1.5; }
.feed-card details { border-top: 1px solid var(--line); padding-top: 12px; }
.feed-card summary { cursor: pointer; font-weight: 600; font-size: .9rem; }
.feed-card details[open] { display: flex; flex-direction: column; gap: 10px; }
.feed-card details input { font-size: .8rem; }

/* ==========================================================================
   Clients
   ========================================================================== */
.contact-row-bottom { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.contact-row-bottom .check-tile { padding: 8px 12px; }
.contact-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 16px; }
.contact-list li { display: flex; gap: 12px; align-items: flex-start; }
.contact-list .avatar-sm { margin: 2px 0 0; }
.contact-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.contact-body .muted { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: .86rem; }
.contact-links { display: flex; gap: 12px; flex-wrap: wrap; font-size: .9rem; overflow-wrap: anywhere; }
.location-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.location-card { padding: 18px 20px; display: flex; flex-direction: column; gap: 8px; }
.location-card p { margin: 0; font-size: .92rem; }
.location-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.location-head h3 { font-size: 1rem; display: flex; align-items: center; gap: 6px; }
.location-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }

/* ==========================================================================
   Inventory
   ========================================================================== */
.inv-nav { display: flex; gap: 4px; margin: -8px 0 24px; padding: 4px; background: #e8e8e4; border-radius: 999px; width: fit-content; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.inv-nav a { display: flex; align-items: center; gap: 7px; padding: 8px 16px; border-radius: 999px; text-decoration: none; font-weight: 600; font-size: .87rem; color: var(--muted); white-space: nowrap; }
.inv-nav a .icon { width: 17px; height: 17px; }
.inv-nav a.active { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }

.cat-tile { --cat: #8b8b86; display: inline-grid; place-items: center; flex: none; border-radius: 14px; color: var(--cat); background: color-mix(in srgb, var(--cat) 12%, #fff); }
.cat-tile .icon { width: 55%; height: 55%; }
.cat-tile-xs { width: 28px; height: 28px; border-radius: 9px; vertical-align: middle; }
.cat-tile-sm { width: 36px; height: 36px; border-radius: 11px; }
.cat-tile-md { width: 56px; height: 56px; border-radius: 16px; }
.cat-tile-lg { width: 64px; height: 64px; border-radius: 18px; }
.cat-tile-xl { width: 100%; height: 100%; min-height: 220px; border-radius: var(--radius); }
.cat-tile-xl .icon { width: 30%; height: 30%; stroke-width: 1.5; }
.product-photo { object-fit: cover; border-radius: 14px; background: var(--bg); flex: none; }
.product-photo-xs { width: 28px; height: 28px; border-radius: 9px; vertical-align: middle; }
.product-photo-sm { width: 36px; height: 36px; border-radius: 11px; }
.product-photo-md { width: 56px; height: 56px; border-radius: 16px; }

.cat-chips { display: flex; gap: 8px; overflow-x: auto; padding: 1px 1px 4px; margin-bottom: 12px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.cat-chip { --cat: var(--ink); flex: none; display: inline-flex; align-items: center; gap: 7px; padding: 8px 15px; border-radius: 999px; background: var(--card); border: 1px solid var(--line-2); text-decoration: none; font-weight: 600; font-size: .86rem; color: var(--ink); }
.cat-chip .icon { color: var(--cat); width: 17px; height: 17px; }
.cat-chip:hover { background: var(--hover); }
.cat-chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.cat-chip.active .icon { color: var(--accent); }

.product-group { margin-top: 20px; }
.group-title { display: flex; align-items: center; gap: 10px; font-size: 1.05rem; margin-bottom: 12px; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.product-card { display: flex; flex-direction: column; gap: 6px; padding: 16px; text-decoration: none; color: inherit; transition: transform .15s var(--ease), box-shadow .15s; }
.product-card:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(22, 22, 22, .08); }
.product-card.inactive { opacity: .55; }
.product-card-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; }
.product-name { line-height: 1.3; }
.product-stock { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-top: auto; padding-top: 6px; font-size: .9rem; }
.product-meta { display: flex; gap: 10px; flex-wrap: wrap; }
.stock-value { margin: 10px 0 0; font-size: .9rem; }

.stock-meter { position: relative; display: block; height: 8px; border-radius: 999px; background: #ececE8; overflow: visible; }
.stock-meter-fill { display: block; height: 100%; border-radius: inherit; background: var(--ink); }
.stock-low .stock-meter-fill { background: #f5a524; }
.stock-out .stock-meter-fill { background: var(--red); }
.stock-meter-min { position: absolute; top: -3px; width: 2px; height: 14px; background: var(--ink); border-radius: 1px; opacity: .45; }

.product-hero { display: grid; grid-template-columns: minmax(220px, 300px) 1fr 1fr; gap: 14px; align-items: start; }
.product-media { padding: 10px; display: grid; place-items: center; min-height: 240px; }
.product-media img { width: 100%; height: auto; border-radius: var(--radius); display: block; }
.stock-big { display: flex; align-items: baseline; gap: 6px; margin-bottom: 12px; }
.stock-big strong { font-size: 2.6rem; line-height: 1; color: var(--ink); letter-spacing: -.04em; }
.stock-big.stock-low strong { color: #b06c02; }
.stock-big.stock-out strong { color: #c9353a; }
.product-hero .stock-meter { margin-bottom: 16px; }
.product-desc { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: .92rem; }
.adjust-form { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.adjust-row { display: flex; gap: 8px; }
.adjust-row select { flex: 1.2; }
.adjust-row input { flex: 1; min-width: 0; }
.image-current { display: flex; align-items: center; gap: 12px; }
.image-current img { width: 72px; height: 72px; object-fit: cover; border-radius: 14px; }

.reorder-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 14px; }
.reorder-group { padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.reorder-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.reorder-head h3 { font-size: 1rem; display: flex; align-items: center; gap: 6px; }
.reorder-head .btn { white-space: nowrap; }
.reorder-head small { display: block; margin-top: 4px; }
.reorder-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.reorder-list li { display: grid; grid-template-columns: 36px 1fr auto; grid-template-areas: "img name qty" "img name suggest"; column-gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); }
.reorder-list li > :first-child { grid-area: img; }
.reorder-name { grid-area: name; display: flex; flex-direction: column; min-width: 0; font-weight: 600; font-size: .92rem; }
.reorder-qty { grid-area: qty; text-align: right; font-size: .88rem; }
.reorder-suggest { grid-area: suggest; text-align: right; font-size: .8rem; color: var(--muted); }
.reorder-hint { margin: 0; font-size: .85rem; }

.inv-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: 10px; }
.cat-card { display: flex; align-items: center; gap: 12px; padding: 12px; text-decoration: none; color: inherit; border-radius: var(--radius); }
.cat-card span { display: flex; flex-direction: column; min-width: 0; }
.cat-card:hover { box-shadow: 0 10px 30px rgba(22, 22, 22, .07); }
.cat-card-add { justify-content: center; color: var(--muted); border: 1.5px dashed var(--line-2); background: transparent; box-shadow: none; font-weight: 600; flex-direction: row; }
.cat-grid-lg { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.cat-card-lg { padding: 16px; }
.cat-card-lg > span:nth-child(2) { flex: 1; }
.cat-actions { flex-direction: row !important; gap: 6px; }

.supplier-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.supplier-card { display: flex; flex-direction: column; gap: 12px; padding: 18px; text-decoration: none; color: inherit; align-items: flex-start; }
.supplier-card:hover { box-shadow: 0 10px 30px rgba(22, 22, 22, .07); }
.supplier-card.inactive { opacity: .55; }
.supplier-head { display: flex; gap: 12px; align-items: center; }
.supplier-head > span:last-child { display: flex; flex-direction: column; }
.supplier-avatar { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-dark); }
.supplier-facts { display: flex; gap: 12px; flex-wrap: wrap; font-size: .85rem; color: #55554f; }
.inline-alert { margin: 12px 0 0; font-size: .86rem; }

.po-doc { padding: 30px; max-width: 980px; display: flex; flex-direction: column; gap: 20px; }
.po-table td { vertical-align: middle; }
.receive-input { width: 100px; }
.receive-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 6px 6px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.po-item-row .po-product { flex: 3; }
.po-item-row .po-qty, .po-item-row .po-price { flex: 1; min-width: 80px; }

/* ==========================================================================
   Tools & vehicles
   ========================================================================== */
.tool-filters { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.tool-filters input[type=search] { flex: 2; min-width: 220px; width: auto; }
.tool-filters select { flex: 1; min-width: 150px; width: auto; background-color: var(--card); border-radius: 999px; }
.holder-box { display: flex; align-items: center; gap: 12px; }
.holder-box > span:last-child { display: flex; flex-direction: column; }
.photo-pick { cursor: pointer; align-self: flex-start; }

.incident-list { display: flex; flex-direction: column; gap: 10px; }
.incident { padding: 16px 18px 16px 22px; display: flex; flex-direction: column; gap: 8px; position: relative; }
.incident::before { content: ""; position: absolute; left: 0; top: 16px; bottom: 16px; width: 4px; border-radius: 0 4px 4px 0; background: #f5a524; }
.incident.open-missing::before { background: var(--red); }
.incident.resolved { opacity: .8; }
.incident.resolved::before { background: var(--green); }
.incident p { margin: 0; }
.incident-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.incident .photo-grid { margin: 0; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
.resolve-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.resolve-form select { flex: 2; min-width: 200px; width: auto; }
.resolve-form input[type=number] { flex: 1; min-width: 110px; }
.resolve-form input[type=text] { flex: 2; min-width: 160px; }
.handout-grid .check-tile span { display: flex; flex-direction: column; }

.vehicle-mini { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.vehicle-mini > span:nth-child(2) { display: flex; flex-direction: column; }
.vehicle-alerts { display: inline-flex; gap: 6px; flex-wrap: wrap; }

.handover { padding: 0; overflow: hidden; }
.handover > .section-title { padding: 18px 18px 0; margin: 0 0 8px; }
.handover .empty { padding: 18px; margin: 0; }
.tool-table td { vertical-align: middle; }
.check-cell { min-width: 270px; }
.check-options { display: inline-flex; background: var(--bg); border-radius: 999px; padding: 3px; gap: 2px; }
.check-opt input { position: absolute; opacity: 0; pointer-events: none; }
.check-opt span { display: block; padding: 7px 13px; font-size: .83rem; font-weight: 600; cursor: pointer; color: var(--muted); border-radius: 999px; transition: background .15s; }
.check-ok input:checked + span { background: #fff; color: #1f8a55; box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.check-damaged input:checked + span { background: #fff; color: #b06c02; box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.check-missing input:checked + span { background: #fff; color: #c9353a; box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.check-opt input:focus-visible + span { outline: 2px solid var(--accent); }
.check-note { display: none; margin-top: 6px; font-size: .85rem; padding: 8px 12px !important; min-height: 0 !important; }
.check-cell:has(.check-damaged input:checked) .check-note, .check-cell:has(.check-missing input:checked) .check-note { display: block; }

.vehicle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.vehicle-card { padding: 0; overflow: hidden; text-decoration: none; color: inherit; display: flex; flex-direction: column; transition: transform .15s var(--ease), box-shadow .15s; }
.vehicle-card:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(22, 22, 22, .08); }
.vehicle-card.inactive { opacity: .55; }
.vehicle-photo { position: relative; height: 160px; background: var(--bg); margin: 6px; border-radius: 18px; overflow: hidden; }
.vehicle-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vehicle-photo .cat-tile-xl { min-height: 0; height: 100%; border-radius: 0; }
.plate { display: inline-block; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; letter-spacing: .04em; background: #fff; color: #111; border: 2px solid #111; border-left: 10px solid #1d4ed8; border-radius: 7px; padding: 2px 10px; font-size: .95rem; }
.vehicle-photo .plate { position: absolute; left: 12px; bottom: 12px; }
.plate-inline { font-size: 1.1rem; vertical-align: middle; margin-right: 6px; }
.vehicle-body { padding: 10px 18px 18px; display: flex; flex-direction: column; gap: 6px; }
.vehicle-figures { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 6px; }
.vehicle-figures span { display: flex; flex-direction: column; }
.cost-bars { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.cost-bar { display: grid; grid-template-columns: 160px 1fr 110px; gap: 10px; align-items: center; font-size: .9rem; }
.cost-label { display: flex; align-items: center; gap: 6px; }
.cost-track { height: 10px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.cost-track span { display: block; height: 100%; background: var(--ink); border-radius: inherit; }
.cost-bar:first-child .cost-track span { background: var(--accent); }
.cost-value { text-align: right; font-variant-numeric: tabular-nums; }

/* ==========================================================================
   Quick-actions sheet
   ========================================================================== */
html.sheet-open { overflow: hidden; }
.sheet { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(22, 22, 22, .32); opacity: 0; transition: opacity .2s; backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.sheet-panel {
  position: relative; width: min(560px, 100%); max-height: calc(100vh - 40px); overflow-y: auto;
  background: var(--card); border-radius: 28px; padding: 22px; box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(12px) scale(.98); transition: opacity .2s var(--ease), transform .25s var(--ease);
}
.sheet.open .sheet-backdrop { opacity: 1; }
.sheet.open .sheet-panel { opacity: 1; transform: none; }
.sheet-handle { display: none; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.sheet-head strong { font-size: 1.1rem; color: var(--ink); }
.sheet-head .icon-btn { border: 0; background: var(--bg); }
.sheet-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sheet-action {
  display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--radius);
  background: var(--bg); text-decoration: none; color: inherit; transition: background .15s, transform .1s;
}
.sheet-action:hover, .sheet-action:focus-visible { background: #ebebe7; }
.sheet-action:active { transform: scale(.98); }
.sheet-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--card); color: var(--ink); flex: none; }
.sheet-icon .icon { width: 19px; height: 19px; }
.sheet-action:first-child .sheet-icon { background: var(--ink); color: #fff; }
.sheet-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.sheet-text strong { font-size: .92rem; color: var(--ink); font-weight: 600; }
.sheet-text small { font-size: .78rem; color: var(--muted); }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1100px) {
  .product-hero { grid-template-columns: 1fr 1fr; }
  .product-media { grid-column: 1 / -1; min-height: 180px; }
  .product-media img { max-height: 320px; width: auto; }
  .inv-columns { grid-template-columns: 1fr; }
  .dash-top { grid-template-columns: 1fr; }
}

@media (max-width: 800px) {
  .shell { display: block; min-height: 100vh; }
  .sidebar { display: none; }
  h1 { font-size: 1.55rem; }

  .topbar {
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 20;
    background: rgba(243, 243, 241, .86); backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px);
    padding: calc(10px + env(safe-area-inset-top)) calc(18px + env(safe-area-inset-right)) 10px calc(18px + env(safe-area-inset-left));
  }
  .topbar .brand { padding: 0; }
  .topbar-wordmark { height: 30px; width: auto; display: block; }
  .topbar .avatar { width: 36px; height: 36px; }

  /* Floating tab bar with a notched "+" in the middle */
  .tabbar {
    display: block; position: fixed; z-index: 30;
    left: calc(14px + env(safe-area-inset-left)); right: calc(14px + env(safe-area-inset-right));
    bottom: calc(10px + env(safe-area-inset-bottom));
  }
  .tabbar-bar {
    display: grid; grid-template-columns: 1fr 1fr 76px 1fr 1fr; align-items: center; height: 64px; padding: 0 6px;
    background: var(--card); border-radius: 26px; box-shadow: 0 10px 34px rgba(22, 22, 22, .12), 0 1px 2px rgba(22, 22, 22, .05);
    -webkit-mask: radial-gradient(circle 38px at 50% -6px, transparent 98%, #000 100%);
            mask: radial-gradient(circle 38px at 50% -6px, transparent 98%, #000 100%);
  }
  .tab-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: 100%;
    text-decoration: none; color: var(--muted); font-size: .68rem; font-weight: 600;
  }
  .tab-item .icon { width: 23px; height: 23px; }
  .tab-item.active { color: var(--ink); }
  .tab-item.active .icon { color: var(--ink); }
  .tab-item.active::after { content: ""; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); margin-top: 1px; }
  .tab-item.active span { display: none; }
  .tab-fab {
    position: absolute; left: 50%; top: -22px; transform: translateX(-50%);
    width: 58px; height: 58px; border-radius: 50%; border: 0; cursor: pointer;
    display: grid; place-items: center; background: var(--ink); color: #fff;
    box-shadow: 0 8px 20px rgba(22, 22, 22, .25); transition: transform .15s var(--ease);
  }
  .tab-fab .icon { width: 26px; height: 26px; transition: transform .2s var(--ease); }
  .tab-fab:active { transform: translateX(-50%) scale(.94); }
  html.sheet-open .tab-fab .icon { transform: rotate(45deg); }

  .main {
    padding: 8px calc(16px + env(safe-area-inset-right)) calc(110px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
  }

  .toasts { top: auto; right: auto; left: 50%; transform: translateX(-50%); bottom: calc(92px + env(safe-area-inset-bottom)); flex-direction: column-reverse; }
  .toast { transform: translateY(10px) scale(.98); }
  .toast.show { transform: none; }

  .sheet { place-items: end stretch; padding: 0; }
  .sheet-panel {
    width: 100%; border-radius: 28px 28px 0 0; max-height: 85vh;
    padding: 10px 16px calc(20px + env(safe-area-inset-bottom));
    transform: translateY(100%); opacity: 1;
  }
  .sheet-handle { display: block; width: 40px; height: 5px; border-radius: 999px; background: var(--line-2); margin: 0 auto 12px; }
  .sheet-grid { grid-template-columns: 1fr; }
  .sheet-action { padding: 10px 12px; }

  .page-header { align-items: stretch; flex-direction: column; margin-bottom: 18px; gap: 12px; }
  .page-header .btn { width: 100%; }
  .header-actions { width: 100%; }
  .header-actions > *, .header-actions form.button_to, .header-actions form.button_to .btn { flex: 1; width: 100%; }
  .section-head { margin-top: 28px; }
  .section-title { margin-top: 28px; }

  .hero { padding: 18px; gap: 18px; }
  .hero-figures strong { font-size: 2.5rem; }
  .hero-tiles { gap: 8px; }
  .hero-tile { padding: 12px; }
  .big-figure strong { font-size: 2.3rem; }
  .segments { height: 30px; gap: 2px; }

  .timeline-item { grid-template-columns: 52px 12px minmax(0, 1fr); gap: 10px; padding: 12px 10px; }
  .timeline-item:not(:last-child)::after { left: 77px; }
  .timeline-meta { grid-column: 3; }

  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat { padding: 14px 16px; }
  .stat-value { font-size: 1.55rem; }

  .work-list { grid-template-columns: 1fr; gap: 10px; }
  .facts { grid-template-columns: 96px 1fr; }
  .detail-card { padding: 18px; }
  .form-section, .form-card { padding: 18px; }
  .line-item-numbers { flex-direction: row; flex-wrap: wrap; gap: 10px; }
  .line-item-numbers .field { flex: 1 1 40%; min-width: 0; }
  .line-item-numbers .field-grow { flex-basis: 100%; }
  .sticky-actions { bottom: calc(86px + env(safe-area-inset-bottom)); flex-direction: row; border-radius: 24px; }
  .sticky-actions .btn { flex: 1; }
  .pv { padding: 20px; }
  .pv-grid, .pv-signatures { grid-template-columns: 1fr; }
  .pv-title { text-align: left; }
  .link-list > a > .muted { display: none; }

  /* Tables become a list of cards */
  .table-card:has(.table-stack) { background: transparent; border: 0; box-shadow: none; overflow: visible; padding: 0; }
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tr { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; margin-bottom: 10px; }
  .table-stack tbody tr:hover td { background: transparent; }
  .table-stack td { border: 0; padding: 4px 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: right; word-break: break-word; }
  .table-stack td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: .8rem; text-align: left; flex: none; }
  .table-stack td.cell-title { font-size: 1rem; justify-content: flex-start; text-align: left; padding-bottom: 8px; }
  .table-stack td.actions { justify-content: stretch; gap: 8px; padding-top: 12px; margin-top: 8px; border-top: 1px solid var(--line); }
  .table-stack td.actions > * { flex: 1; }
  .table-stack td.actions .btn { width: 100%; margin: 0; }
  .table-stack td.actions form.button_to { display: block; }
  .table-card:has(.table-stack) .totals { background: var(--card); border-radius: var(--radius); border: 0; box-shadow: var(--shadow); padding: 16px; }
  .table-card:has(.table-stack) .receive-actions { border: 0; padding: 4px 0; }

  /* 16px inputs stop iOS from zooming in on focus; bigger tap targets */
  input[type=text], input[type=email], input[type=password], input[type=search], input[type=tel], input[type=url],
  input[type=number], input[type=date], input[type=time], input[type=datetime-local], select, textarea { font-size: 16px; min-height: 48px; padding: 12px 14px; }
  .searchbar input[type=search], .tool-filters input[type=search] { padding-left: 42px; }
  .field-row { flex-direction: column; gap: 16px; }
  .form-actions:not(.sticky-actions) { flex-direction: column-reverse; }
  .form-actions .btn { width: 100%; min-height: 48px; }

  .auth { padding: calc(24px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom)); }
  .auth-card { padding: 28px 22px; }

  /* Calendar */
  .cal-header { flex-direction: row; align-items: center; }
  .cal-toolbar { flex-direction: column; align-items: stretch; }
  .cal-nav { justify-content: space-between; }
  .cal-title { order: -1; flex: 1; margin: 0; font-size: 1.08rem; }
  .cal-filter select { width: 100%; }
  .cal-month { padding: 6px; }
  .cal-weekday { padding: 6px 0; text-align: center; font-size: .68rem; }
  .cal-day { min-height: 50px; padding: 4px 2px; align-items: center; border-top: 0; }
  .cal-daynum { align-self: center; font-size: .86rem; }
  .cal-daynum::after { content: ""; position: absolute; inset: 0; }
  .cal-chips { display: none; }
  .cal-dots { display: flex; gap: 3px; justify-content: center; }
  .cal-dots i { width: 5px; height: 5px; }
  .cal-day.selected { box-shadow: none; background: transparent; }
  .cal-day.selected .cal-daynum { background: var(--ink); color: #fff; }
  .agenda-item { flex-direction: column; gap: 6px; }
  .agenda-time { width: auto; }
  .cal-person-col { width: 120px; }
  .cal-person span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* Inventory */
  .inv-nav { margin: -4px 0 16px; width: 100%; }
  .inv-nav a { flex: 1; justify-content: center; padding: 9px 10px; }
  .inv-nav a span { display: none; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .product-card { padding: 13px; }
  .product-stock { flex-direction: column; align-items: flex-start; gap: 2px; }
  .product-meta { flex-direction: column; gap: 2px; }
  .product-card-top { flex-direction: column; gap: 8px; }
  .product-hero { grid-template-columns: 1fr; }
  .reorder-groups { grid-template-columns: 1fr; }
  .reorder-head { flex-direction: column; }
  .reorder-head .button_to, .reorder-head .btn { width: 100%; }
  .cat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cat-grid-lg { grid-template-columns: 1fr; }
  .cat-card-lg { flex-wrap: wrap; }
  .po-doc { padding: 18px; }
  .po-item-row { flex-wrap: wrap; }
  .po-item-row .po-product { flex-basis: 100%; }
  .receive-input { width: 100%; }

  /* Tools & vehicles */
  .tool-filters { flex-direction: column; }
  .tool-filters select, .tool-filters input[type=search] { width: 100%; }
  .quick-actions { grid-template-columns: 1fr; }
  .check-cell { min-width: 0; }
  .check-cell .check-options { width: 100%; }
  .check-opt { flex: 1; text-align: center; }
  .table-stack td.check-cell { flex-direction: column; align-items: stretch; text-align: left; }
  .cost-bar { grid-template-columns: 1fr 90px; }
  .cost-track { grid-column: 1 / -1; grid-row: 2; }
}

@media (max-width: 380px) {
  .hero-figures { gap: 14px; }
  .hero-figures strong { font-size: 2.1rem; }
  .hero-tile small { font-size: .7rem; }
}

/* ==========================================================================
   Print (proces-verbal, purchase orders, tool hand-over sheets)
   ========================================================================== */
@media print {
  @page { margin: 14mm; }
  body { background: #fff; }
  .sidebar, .topbar, .tabbar, .sheet, .toasts, .offline-banner, .screen-only, .flash, .install-hint, .inv-nav, .receive-actions { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; max-width: none; opacity: 1 !important; }
  .card { box-shadow: none; border: 0; }
  .pv, .po-doc { padding: 0; max-width: none; }
  .pv .photo-grid { grid-template-columns: repeat(4, 1fr); }
  .pv a { color: inherit; text-decoration: none; }
  .print-only { display: block; }
  td.print-only, th.print-only { display: table-cell; }
  .handover .pv-head { margin-bottom: 18px; }
  .tool-table td.print-only { width: 120px; border-bottom: 1px solid #999; }
  .pv-signatures.print-only { display: grid; margin-top: 30px; }
  .handover h2 { font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 6px; }
  .handover p { margin: 0; }
  .table tbody tr:hover td { background: none; }
}

/* ==========================================================================
   Work done & invoices
   ========================================================================== */
.done-banner { display: flex; align-items: center; gap: 14px; padding: 14px 16px; margin-bottom: 18px; flex-wrap: wrap; }
.done-banner .btn .pill { margin-left: 4px; }
.end-hint { display: flex; align-items: center; gap: 6px; margin: -8px 0 16px; }
.invoice-doc { padding: 34px; max-width: 920px; display: flex; flex-direction: column; gap: 22px; }
.invoice-doc h2 { font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 6px; }
.invoice-doc p { margin: 0; line-height: 1.5; }
.invoice-kind { display: block; font-size: .74rem; color: var(--muted); font-weight: 500; }
.invoice-pay { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-top: 16px; border-top: 1px solid var(--line); font-size: .9rem; }
.ready-list .row-item { flex-wrap: wrap; }
.ready-list .button_to { margin-left: auto; }
@media (max-width: 800px) {
  .done-banner .btn, .done-banner form.button_to { width: 100%; }
  .invoice-doc { padding: 20px; }
  .ready-list .button_to, .ready-list .button_to .btn { width: 100%; }
}
@media print {
  .invoice-doc { padding: 0; max-width: none; }
}
.last-day { flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.last-day .row-text small { white-space: normal; }
@media (max-width: 800px) { .last-day .btn { width: 100%; } }
.done-banner .row-text small, .ready-list .row-text small { white-space: normal; }
.invoice-line-calc { display: none; }
@media (max-width: 800px) {
  .invoice-lines th:nth-child(1), .invoice-lines td:nth-child(1),
  .invoice-lines th:nth-child(3), .invoice-lines td:nth-child(3),
  .invoice-lines th:nth-child(4), .invoice-lines td:nth-child(4) { display: none; }
  .invoice-lines td, .invoice-lines th { padding-left: 0; padding-right: 0; }
  .invoice-line-calc { display: block; color: var(--muted); font-size: .8rem; margin-top: 2px; }
  .invoice-doc .totals { padding-right: 0; }
}
.cal-green .cal-chip-icon { color: var(--tone); }
.cal-legend .icon { color: #23935c; }
.weekend-tile { align-self: flex-start; }
.full-tank-tile { align-self: flex-end; min-height: 44px; }

/* ==========================================================================
   "Call back now" banner (website callback requests)
   ========================================================================== */
#callback-alert:empty { display: none; }
.callback-alert {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; margin-bottom: 18px;
  border-radius: var(--radius); background: var(--red); color: #fff; box-shadow: 0 10px 30px rgba(229, 72, 77, .35);
  animation: callback-pulse 1.6s ease-in-out infinite;
}
@keyframes callback-pulse { 50% { box-shadow: 0 0 0 6px rgba(229, 72, 77, .25), 0 10px 30px rgba(229, 72, 77, .35); } }
.callback-alert-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: rgba(255, 255, 255, .2); flex: none; animation: ring 1.2s ease-in-out infinite; }
@keyframes ring { 0%, 60%, 100% { transform: rotate(0); } 10%, 30%, 50% { transform: rotate(-14deg); } 20%, 40% { transform: rotate(14deg); } }
.callback-alert-text { display: flex; flex-direction: column; flex: 1; min-width: 160px; line-height: 1.3; }
.callback-alert-text small { opacity: .85; }
.callback-alert .btn { border-color: transparent; }
.callback-alert-call { background: #fff; color: var(--red); }
.callback-alert-claim { background: rgba(255, 255, 255, .18); color: #fff; }
@media (max-width: 800px) {
  .callback-alert-call, .callback-alert form.button_to { flex: 1; }
  .callback-alert form.button_to .btn { width: 100%; }
}
.api-url { display: block; padding: 10px 12px; border-radius: 12px; background: var(--field); font-size: .82rem; overflow-wrap: anywhere; user-select: all; }
