/* assets/css/app.css - all styles for the app (was the <style> block in index.php). */
:root {
  --navy-bg: #0b1329;
  --navy-surface: #0f172a;
  --navy-card: #1e293b;
  --navy-border: #334155;
  --navy-hover: #475569;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-blue: #2563eb;
  --accent-blue-hover: #1d4ed8;
  --accent-gold: #d97706;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --accent-red-hover: #dc2626;
  --color-white: #fff;
  --color-black: #000;
  --text-soft: #cbd5e1;
  --text-danger: #fca5a5;
  --color-night: #a5b4fc;
  --color-ink: #111827;
  --color-map-bg: #1f2937;
  --color-print-border: #bbb;
  --color-print-rule: #ccc;
  --color-print-muted: #444;
  /* Colours: translucent tints (navy, accents) */
  --navy-a97: rgba(15, 23, 42, 0.97);
  --navy-a95: rgba(15, 23, 42, 0.95);
  --navy-a92: rgba(15, 23, 42, 0.92);
  --navy-a88: rgba(15, 23, 42, 0.88);
  --navy-a80: rgba(15, 23, 42, 0.8);
  --gold-a10: rgba(217, 119, 6, 0.1);
  --gold-a12: rgba(217, 119, 6, 0.12);
  --gold-a15: rgba(217, 119, 6, 0.15);
  --gold-a30: rgba(217, 119, 6, 0.3);
  --gold-a35: rgba(217, 119, 6, 0.35);
  --gold-a60: rgba(217, 119, 6, 0.6);
  --gold-a90: rgba(217, 119, 6, 0.9);
  --blue-a08: rgba(37, 99, 235, 0.08);
  --blue-a25: rgba(37, 99, 235, 0.25);
  --blue-a80: rgba(37, 99, 235, 0.8);
  --green-a12: rgba(16, 185, 129, 0.12);
  --green-a16: rgba(16, 185, 129, 0.16);
  --red-a10: rgba(239, 68, 68, 0.1);
  --red-a15: rgba(239, 68, 68, 0.15);
  --red-a16: rgba(239, 68, 68, 0.16);
  --red-a20: rgba(239, 68, 68, 0.2);
  --red-a50: rgba(239, 68, 68, 0.5);
  --slate-a15: rgba(148, 163, 184, 0.15);
  --backdrop: rgba(0, 0, 0, 0.55);
  /* Typography */
  --font-heading: "Quicksand", sans-serif;
  --font-body: "Nunito", sans-serif;
  --font-mono: ui-monospace, Menlo, Consolas, monospace;
  --font-size-body: 15px;
  --font-size-input: 16px;
  --line-height-body: 1.55;
  --font-size-h2: 1.25rem;
  --font-size-h3: 1.02rem;
  --font-size-small: 0.82rem;
  /* Radii and shadows */
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --radius-14: 14px;
  --radius-12: 12px;
  --radius-sheet: 18px;
  --radius-pill: 99px;
  --shadow-menu: 0 12px 32px rgba(0, 0, 0, 0.5);
  --shadow-toast: 0 10px 30px rgba(0, 0, 0, 0.4);
  --shadow-dot: 0 0 0 6px rgba(37, 99, 235, 0.25), 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-dot-sel: 0 0 0 6px rgba(217, 119, 6, 0.3), 0 4px 12px rgba(0, 0, 0, 0.5);
  /* Cards */
  --card-padding: 20px;
  --card-padding-sm: 16px;
  --card-gap: 20px;
  --card-gap-sm: 16px;
  --tile-padding: 14px 16px;
  --tile-min: 160px;
  --grid-min: 200px;
  --grid-gap: 14px;
  /* Navigation */
  --nav-width: 220px;
  --nav-top: 80px;
  --nav-gap: 6px;
  --nav-btn-padding: 11px 16px;
  --header-padding: 10px 20px;
  --header-padding-sm: 8px 16px;
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --admin-menu-top: 52px;
  /* Layout */
  --layout-max: 1240px;
  --layout-gap: 24px;
  --layout-padding: 24px 20px;
  --layout-padding-sm: 16px;
  --sheet-max: 640px;
  --sheet-pad: 18px;
  --sheet-head-pad: 14px 18px;
  --sheet-foot-pad: 12px 18px;
  --login-max: 420px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--navy-bg); color: var(--text-main); font-family: var(--font-body); font-size: var(--font-size-body); line-height: var(--line-height-body); min-height: 100vh; }
h1, h2, h3, h4 { font-family: var(--font-heading); font-weight: 700; color: var(--color-white); line-height: 1.25; }
h2 { font-size: var(--font-size-h2); }
h3 { font-size: var(--font-size-h3); margin-bottom: 8px; }
.muted { color: var(--text-muted); }
.small { font-size: var(--font-size-small); }
[hidden] { display: none !important; }

/* Header */
header { position: sticky; top: 0; z-index: 50; background: var(--navy-a95); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--navy-border); padding: var(--header-padding); padding-top: max(10px, env(safe-area-inset-top)); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.logo { font-family: var(--font-heading); font-size: 1.15rem; font-weight: 700; color: var(--color-white); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.logo span { color: var(--accent-gold); }
.logo.branded { gap: 10px; }
.logo .brand-img { display: block; max-height: 34px; max-width: 150px; object-fit: contain; }
.logo.branded .powered { font-family: var(--font-body); font-size: 0.6rem; font-weight: 600; color: var(--text-muted); opacity: 0.8; letter-spacing: 0.02em; }
.brand-preview { display: block; margin-top: 6px; background: var(--navy-surface); border: 1px solid var(--navy-border); border-radius: var(--radius-xs); padding: 6px; }
.brand-preview.logo { max-width: 100%; max-height: 64px; object-fit: contain; }
.brand-preview.favicon { width: 40px; height: 40px; }
@media (max-width: 520px) { .logo.branded .powered { display: none; } }
.header-right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--navy-card); border: 1px solid var(--navy-border); padding: 6px 12px; border-radius: var(--radius-pill); font-size: 0.85rem; white-space: nowrap; }
.user-chip { cursor: pointer; color: var(--text-main); font: inherit; font-size: 0.85rem; min-height: 36px; max-width: 220px; }
.user-chip .name { overflow: hidden; text-overflow: ellipsis; }
/* Platform admin menu in the top bar */
.admin-menu-wrap { position: relative; }
.admin-chip { cursor: pointer; color: var(--text-main); font: inherit; font-size: 0.85rem; min-height: 36px; }
.admin-chip:hover, .admin-chip[aria-expanded="true"] { border-color: var(--accent-gold); }
.admin-chip.has-active { border-color: var(--accent-gold); color: var(--color-white); background: var(--gold-a15); }
.admin-caret { font-size: 0.7rem; color: var(--text-muted); }
.admin-menu { position: absolute; top: calc(100% + 8px); right: 0; min-width: 230px; z-index: 60; background: var(--navy-card);
              border: 1px solid var(--navy-border); border-radius: var(--radius-14); padding: 6px; box-shadow: var(--shadow-menu);
              display: flex; flex-direction: column; gap: 2px; }
.admin-menu[hidden] { display: none; }
.admin-menu button { display: flex; align-items: center; gap: 10px; width: 100%; background: none; border: none; color: var(--text-main);
                     font: inherit; font-size: 0.92rem; text-align: left; padding: 10px 12px; border-radius: var(--radius-md); cursor: pointer; min-height: 42px; }
.admin-menu button:hover, .admin-menu button:focus-visible { background: var(--navy-surface); outline: none; }
.admin-menu button.active { background: var(--accent-blue); color: var(--color-white); }
.role-tag { background: var(--accent-gold); color: var(--color-black); font-size: 0.66rem; font-weight: 800; padding: 1px 7px; border-radius: var(--radius-pill); text-transform: uppercase; }

/* Layout */
.app-wrap { display: grid; grid-template-columns: var(--nav-width) 1fr; gap: var(--layout-gap); max-width: var(--layout-max); margin: 0 auto; padding: var(--layout-padding); }
.app-wrap.no-nav { grid-template-columns: 1fr; }
nav#appNav { display: flex; flex-direction: column; gap: var(--nav-gap); position: sticky; top: var(--nav-top); height: fit-content; }
nav#appNav button { display: flex; align-items: center; gap: 10px; text-align: left; background: none; border: 1px solid transparent; padding: var(--nav-btn-padding); border-radius: var(--radius-md); font-family: var(--font-heading); font-weight: 600; font-size: 0.95rem; color: var(--text-muted); cursor: pointer; transition: 0.2s; }
nav#appNav button:hover { background: var(--navy-card); color: var(--color-white); }
nav#appNav button.active { background: var(--accent-blue); color: var(--color-white); font-weight: 700; }
nav#appNav .ico { font-size: 1.1rem; width: 22px; text-align: center; }
main, .main-col { min-width: 0; }
.yard-bar { display: flex; align-items: center; gap: 10px; background: var(--navy-card); border: 1px solid var(--navy-border); border-left: 4px solid var(--accent-gold);
            border-radius: var(--radius-md); padding: 8px 8px 8px 14px; margin-bottom: 16px; }
.yard-bar .yb-main { min-width: 0; flex: 1; }
.yard-bar .yb-name { font-family: var(--font-heading); font-weight: 700; color: var(--color-white); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.role-pill { display: inline-block; padding: 1px 8px; border-radius: var(--radius-pill); font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.03em; }
.role-manager { background: var(--accent-gold); color: var(--color-black); }
.role-staff { background: var(--accent-blue); color: var(--color-white); }
.role-viewer { background: var(--navy-hover); color: var(--color-white); }
.role-help { font-size: 0.8rem; color: var(--text-muted); display: grid; gap: 4px; margin-top: 10px; }
.invite-link { display: block; background: var(--navy-surface); border: 1px dashed var(--accent-gold); border-radius: var(--radius-md); padding: 10px 12px; color: var(--accent-gold); font-size: 0.85rem; word-break: break-all; margin: 10px 0; }
.tabs2 { display: flex; gap: 6px; margin: 14px 0; }
.tabs2 button { flex: 1; }
fieldset { border: none; min-width: 0; }
fieldset:disabled input, fieldset:disabled select { opacity: 0.75; }

/* Components */
.card { background: var(--navy-card); border: 1px solid var(--navy-border); border-radius: var(--radius-lg); padding: var(--card-padding); margin-bottom: var(--card-gap); }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; flex-wrap: wrap; gap: 10px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(var(--grid-min), 1fr)); gap: var(--grid-gap); }
label { display: block; font-size: var(--font-size-small); font-weight: 700; color: var(--text-muted); }
label > input, label > select, label > textarea { margin-top: 4px; }
input, select, textarea { width: 100%; min-height: 44px; padding: 10px 12px; background: var(--navy-surface); border: 1px solid var(--navy-border); border-radius: var(--radius-md); color: var(--color-white); font-family: inherit; font-size: var(--font-size-input); /* 16px stops iOS zooming on focus */ }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-blue); outline-offset: 1px; }
.btn { background: var(--accent-blue); color: var(--color-white); border: none; min-height: 44px; padding: 10px 18px; border-radius: var(--radius-md); font-family: var(--font-heading); font-weight: 700; font-size: 0.95rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: 0.2s; text-decoration: none; }
.btn:hover { background: var(--accent-blue-hover); }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn-alt { background: transparent; border: 1px solid var(--navy-border); color: var(--text-main); }
.btn-alt:hover { background: var(--navy-hover); }
.btn-danger { background: transparent; border: 1px solid var(--accent-red); color: var(--text-danger); }
.btn-danger:hover { background: var(--red-a15); }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: 0.82rem; }
.btn-block { width: 100%; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

.tile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(var(--tile-min), 1fr)); gap: var(--grid-gap); margin-bottom: var(--card-gap); }
.tile { background: var(--navy-surface); border: 1px solid var(--navy-border); border-radius: var(--radius-md); padding: var(--tile-padding); border-top: 4px solid var(--accent-blue); }
.tile.gold { border-top-color: var(--accent-gold); }
.tile.green { border-top-color: var(--accent-green); }
.tile.red { border-top-color: var(--accent-red); }
.tile-val { font-family: var(--font-heading); font-size: 1.5rem; font-weight: 700; color: var(--color-white); margin: 2px 0; }

.badge { display: inline-block; padding: 2px 10px; border-radius: var(--radius-pill); font-size: 0.74rem; font-weight: 800; background: var(--navy-border); color: var(--color-white); white-space: nowrap; }
.badge.gold { background: var(--accent-gold); color: var(--color-black); }
.badge.blue { background: var(--accent-blue); }
.badge.green { background: var(--accent-green); }
.badge.red { background: var(--accent-red); }

.segmented { display: inline-flex; background: var(--navy-surface); border: 1px solid var(--navy-border); border-radius: var(--radius-pill); padding: 4px; gap: 4px; }
.segmented button { background: none; border: none; min-height: 36px; padding: 6px 14px; border-radius: var(--radius-pill); color: var(--text-muted); font-weight: 700; font-size: 0.85rem; cursor: pointer; font-family: inherit; }
.segmented button.active { background: var(--accent-blue); color: var(--color-white); }

.list { display: flex; flex-direction: column; gap: 10px; }
.item { background: var(--navy-surface); padding: 14px 16px; border-radius: var(--radius-md); border: 1px solid var(--navy-border); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
button.item { width: 100%; text-align: left; color: inherit; font: inherit; cursor: pointer; transition: 0.2s; }
button.item:hover { border-color: var(--accent-blue); background: var(--blue-a08); }
.item-main { min-width: 0; flex: 1; }
.item-title { font-weight: 800; color: var(--color-white); }
.item-sub { color: var(--text-muted); font-size: 0.85rem; }
.chev { color: var(--text-muted); font-size: 1.3rem; }

/* Rug cards and the horse share card photo: modules/equine/css/equine.css */
.yard-map { height: 340px; border-radius: var(--radius-md); overflow: hidden; border: 1px solid var(--navy-border); background: var(--color-map-bg); z-index: 0; }
/* Darken the OpenStreetMap tiles to match the app's navy theme */
/* Light tile sets (OpenStreetMap) are darkened to match the app; dark ones are shown as they are */
.yard-map.tiles-light .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(0.85) contrast(0.9) saturate(0.6); }
.yard-map { position: relative; }
.map-note { position: absolute; left: 10px; right: 10px; bottom: 26px; z-index: 500; background: var(--navy-a92); border: 1px solid var(--navy-border); border-radius: var(--radius-sm); padding: 8px 10px; font-size: 0.8rem; color: var(--text-muted); }
.yard-map.leaflet-container .leaflet-control-attribution { background: var(--navy-a80); color: var(--text-muted); font-size: 10px; }
.yard-map.leaflet-container .leaflet-control-attribution a { color: var(--text-soft); }
.yard-map.leaflet-container .leaflet-bar a { background: var(--navy-card); color: var(--color-white); border-color: var(--navy-border); }
.yard-map.leaflet-container .leaflet-tooltip { background: var(--color-ink); color: var(--color-white); border: 1px solid var(--navy-border); font-family: var(--font-body); }
.yard-map .leaflet-tooltip-top::before { border-top-color: var(--color-ink); }
.yard-dot-wrap { background: none; border: none; }
.yard-dot { border-radius: 50%; background: var(--blue-a80); border: 2px solid var(--color-white); color: var(--color-white); font-weight: 800; font-family: var(--font-heading);
            display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-dot); cursor: pointer; transition: transform 0.15s; }
.yard-dot:hover { transform: scale(1.08); }
.yard-dot.sel { background: var(--gold-a90); box-shadow: var(--shadow-dot-sel); }
.overlay-wrap { position: relative; }
.tile.has-pill { position: relative; }
.csv-pill { position: absolute; top: 8px; right: 8px; z-index: 5; display: inline-flex; align-items: center; gap: 3px;
            background: var(--navy-a88); color: var(--accent-gold); border: 1px solid var(--gold-a60); border-radius: var(--radius-pill);
            padding: 3px 9px; min-height: 26px; font-family: var(--font-heading); font-weight: 700; font-size: 0.7rem; letter-spacing: 0.02em;
            cursor: pointer; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); transition: 0.15s; }
.csv-pill:hover, .csv-pill:focus-visible { background: var(--accent-gold); color: var(--color-black); }
.overlay-wrap > .csv-pill { top: 10px; right: 10px; }
.csv-note { margin-top: 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.csv-token-select { width: auto; min-height: 36px; padding: 4px 8px; font-size: var(--font-size-input); }
.check-row { cursor: pointer; justify-content: flex-start; }
.check-row input[type=checkbox] { width: 22px; height: 22px; min-height: 0; flex-shrink: 0; accent-color: var(--accent-gold); margin: 0; }
.check-row input[type=checkbox]:disabled + span { opacity: .6; }
.horse-access .ha-list { max-height: 280px; overflow-y: auto; }
.horse-access #haScopeRow { display: flex; gap: 10px; align-items: flex-start; }
.notice.danger-notice { background: var(--red-a10); border-color: var(--accent-red); }
.btn-danger-solid { background: var(--accent-red); color: var(--color-white); }
.btn-danger-solid:hover { background: var(--accent-red-hover); }
.about details { border-bottom: 1px solid var(--navy-border); }
.about details:last-child { border-bottom: none; }
.about summary { cursor: pointer; padding: 12px 0; font-family: var(--font-heading); font-weight: 700; font-size: 1.02rem; color: var(--color-white); list-style: none; display: flex; justify-content: space-between; align-items: center; }
.about summary::-webkit-details-marker { display: none; }
.about summary::after { content: '＋'; color: var(--text-muted); }
.about details[open] summary::after { content: '－'; }
.about-body { padding: 0 0 14px; color: var(--text-soft); font-size: 0.92rem; }
.about-body p { margin-bottom: 8px; }
.about-body ul { margin: 0 0 8px 20px; display: grid; gap: 4px; }
.about-body code, code.ref { background: var(--navy-surface); border: 1px solid var(--navy-border); border-radius: var(--radius-xs); padding: 0 5px; font-size: 0.85em; color: var(--accent-gold); }
code.ref { font-size: 0.9rem; font-weight: 700; letter-spacing: 0.04em; padding: 1px 7px; }
.filter-chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
.filter-chips button { flex-shrink: 0; background: var(--navy-surface); border: 1px solid var(--navy-border); color: var(--text-muted); border-radius: var(--radius-pill); padding: 6px 12px; min-height: 34px; font-weight: 700; font-size: 0.8rem; cursor: pointer; font-family: inherit; }
.filter-chips button span { opacity: 0.7; margin-left: 2px; }
.filter-chips button.active { background: var(--accent-blue); border-color: var(--accent-blue); color: var(--color-white); }
.item.idea { position: relative; padding: 0; align-items: stretch; }
.idea-main { flex: 1; min-width: 0; text-align: left; background: none; border: none; color: inherit; font: inherit; padding: 14px 16px; padding-right: 84px; cursor: pointer; border-radius: var(--radius-md); }
.idea-main:hover { background: var(--blue-a08); }
.idea-details { white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin: 4px 0; }
.idea-pill { top: 12px; right: 12px; }
.import-list { max-height: 360px; overflow-y: auto; }
.import-list .item { align-items: flex-start; gap: 10px; }
.import-list .item-sub.clip { white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* Claude builds */
.meter { height: 8px; background: var(--navy-surface); border: 1px solid var(--navy-border); border-radius: var(--radius-pill); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--accent-blue); }
.diff-file { margin-bottom: 10px; }
.diff-file > summary { cursor: pointer; padding: 6px 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.diff { font-family: var(--font-mono); font-size: 0.75rem; line-height: 1.45; overflow-x: auto; background: var(--navy-surface); border: 1px solid var(--navy-border); border-radius: var(--radius-md); padding: 6px 0; }
.diff > div { white-space: pre; padding: 0 10px; min-width: max-content; }
.diff .add { background: var(--green-a16); }
.diff .del { background: var(--red-a16); }
.diff .gap { color: var(--text-muted); text-align: center; }
.diff .ln { display: inline-block; width: 3.5em; color: var(--text-muted); user-select: none; }
.import-paste { width: 100%; font-family: var(--font-mono); font-size: 0.8rem; }
.horse-pill { position: static; vertical-align: middle; margin-left: 10px; }
.api-box { border: 1px solid var(--gold-a60); border-radius: var(--radius-12); padding: 12px; margin-bottom: 14px; background: var(--navy-surface); }
.status-planned { background: var(--accent-blue); } .status-in_progress { background: var(--accent-gold); color: var(--color-black); }
.status-done { background: var(--accent-green); } .status-dropped { background: transparent; border: 1px solid var(--navy-hover); color: var(--text-muted); }
.prio-high { background: var(--red-a20); color: var(--text-danger); } .prio-medium { background: var(--slate-a15); color: var(--text-soft); } .prio-low { background: transparent; color: var(--text-muted); border: 1px solid var(--navy-border); }
textarea { resize: vertical; line-height: 1.5; }
.sheet-head h2 code.ref { vertical-align: middle; }
.reqs { display: grid; gap: 8px; }
.req { display: flex; gap: 10px; align-items: flex-start; font-size: 0.9rem; }
code.hint { display: block; margin-top: 4px; background: var(--navy-surface); border: 1px solid var(--navy-border); border-radius: var(--radius-xs); padding: 6px 8px; font-size: 0.78rem; color: var(--accent-gold); word-break: break-all; white-space: pre-wrap; }
.reqs-details summary { cursor: pointer; margin-top: 12px; }
.reqs-details .reqs { margin-top: 8px; }
input[type=file] { padding: 8px; }
button.item.selected { border-color: var(--accent-gold); background: var(--gold-a10); }
hr.sep { border: none; border-top: 1px solid var(--navy-border); margin: 16px 0; }
.feedlog-form { display: grid; grid-template-columns: 1.3fr 1fr 1fr auto; gap: 8px; align-items: end; }

table.data { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
table.data th, table.data td { padding: 10px 12px; border-bottom: 1px solid var(--navy-border); text-align: left; vertical-align: top; }
table.data th { background: var(--navy-surface); color: var(--text-muted); font-family: var(--font-heading); font-weight: 700; }
code.tok { color: var(--accent-gold); font-size: 0.8rem; word-break: break-all; }

.chart-box { position: relative; height: 260px; }
.empty { text-align: center; color: var(--text-muted); padding: 24px 8px; }
.notice { background: var(--gold-a12); border: 1px solid var(--accent-gold); border-radius: var(--radius-md); padding: 10px 14px; font-size: 0.85rem; margin-bottom: 14px; }
.error-text { color: var(--text-danger); font-size: 0.88rem; min-height: 1.2em; }

/* Login */
.login-card { max-width: var(--login-max); margin: 40px auto; }
.login-card form { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }

/* Bottom sheet / modal */
.sheet-backdrop { position: fixed; inset: 0; background: var(--backdrop); z-index: 90; display: flex; align-items: center; justify-content: center; padding: 20px; }
.sheet { background: var(--navy-card); border: 1px solid var(--navy-border); border-radius: var(--radius-lg); width: 100%; max-width: var(--sheet-max); max-height: 90vh; display: flex; flex-direction: column; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: var(--sheet-head-pad); border-bottom: 1px solid var(--navy-border); gap: 10px; }
.sheet-body { padding: var(--sheet-pad); overflow-y: auto; -webkit-overflow-scrolling: touch; }
.sheet-foot { padding: var(--sheet-foot-pad); padding-bottom: max(12px, var(--safe-b)); border-top: 1px solid var(--navy-border); display: flex; gap: 10px; flex-wrap: wrap; }
.icon-btn { background: none; border: none; color: var(--text-muted); font-size: 1.5rem; width: 44px; height: 44px; border-radius: var(--radius-pill); cursor: pointer; }
.icon-btn:hover { background: var(--navy-hover); color: var(--color-white); }
.feed-row { display: grid; grid-template-columns: 1fr 80px 96px 44px; gap: 8px; align-items: end; margin-bottom: 8px; }

/* Toast */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(150%); background: var(--color-ink); border: 1px solid var(--navy-border); color: var(--color-white); padding: 12px 18px; border-radius: var(--radius-12); z-index: 100; max-width: calc(100% - 32px); box-shadow: var(--shadow-toast); transition: transform 0.25s, opacity 0.25s; font-weight: 600; opacity: 0; visibility: hidden; pointer-events: none; }
#toast.show { transform: translateX(-50%) translateY(0); opacity: 1; visibility: visible; }
/* While a panel is open, show messages at the top so they don't cover it */
body:has(.sheet-backdrop) #toast { top: max(12px, env(safe-area-inset-top)); bottom: auto; transform: translateX(-50%) translateY(-150%); }
body:has(.sheet-backdrop) #toast.show { transform: translateX(-50%) translateY(0); }
#toast.err { border-color: var(--accent-red); }

/* Mobile tab bar (hidden on desktop) */
#tabbar { display: none; }

@media (max-width: 768px) {
  header { padding: var(--header-padding-sm); padding-top: max(8px, env(safe-area-inset-top)); }
  .logo { font-size: 1.02rem; }
  #weatherChip .wlabel { display: none; }
  .user-chip .name { display: none; }
  .admin-label, .admin-caret { display: none; }
  .header-right { gap: 6px; }
  header .chip { padding: 6px 9px; }
  .admin-menu-wrap { position: static; }
  .admin-menu { position: fixed; top: calc(var(--admin-menu-top) + env(safe-area-inset-top)); left: 12px; right: 12px; min-width: 0; }
  .app-wrap { grid-template-columns: 1fr; padding: var(--layout-padding-sm) var(--layout-padding-sm) calc(var(--tabbar-h) + var(--safe-b) + 20px); gap: 0; }
  .app-wrap.no-nav { padding-bottom: 24px; }
  nav#appNav { display: none; }
  .card { padding: var(--card-padding-sm); border-radius: var(--radius-14); margin-bottom: var(--card-gap-sm); }
  .tile-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tile { padding: 12px; }
  .tile-val { font-size: 1.25rem; }
  .chart-box { height: 220px; }
  .yard-map { height: 280px; }
  .csv-pill { min-height: 30px; padding: 4px 10px; }

  #tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; background: var(--navy-a97); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--navy-border); padding-bottom: var(--safe-b); }
  #tabbar button { flex: 1; min-width: 0; height: var(--tabbar-h); background: none; border: none; color: var(--text-muted); font-family: var(--font-heading); font-size: 0.68rem; font-weight: 700; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; }
  #tabbar button .ico { font-size: 1.3rem; line-height: 1; }
  #tabbar button.active { color: var(--color-white); }
  #tabbar button.active .ico { transform: scale(1.1); }
  #tabbar button span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; padding: 0 2px; }

  /* Sheets slide up from the bottom on phones */
  .sheet-backdrop { align-items: flex-end; padding: 0; }
  .sheet { max-width: none; border-radius: var(--radius-sheet) var(--radius-sheet) 0 0; max-height: 92vh; border-bottom: none; }
  .feed-row { grid-template-columns: 1fr 70px 44px; }
  .feedlog-form { grid-template-columns: 1fr 1fr; }
  .feedlog-form label:first-child, .feedlog-form .btn { grid-column: 1 / -1; }
  .feed-row .feed-time { grid-column: 1 / 3; }

  /* Tables become stacked cards */
  table.data.stack thead { display: none; }
  table.data.stack, table.data.stack tbody, table.data.stack tr, table.data.stack td { display: block; width: 100%; }
  table.data.stack tr { background: var(--navy-surface); border: 1px solid var(--navy-border); border-radius: var(--radius-md); margin-bottom: 10px; padding: 8px 12px; }
  table.data.stack td { border: none; padding: 4px 0; display: flex; gap: 12px; justify-content: space-between; text-align: right; }
  table.data.stack td::before { content: attr(data-label); color: var(--text-muted); font-weight: 700; text-align: left; flex-shrink: 0; }
  table.data.stack td.full { display: block; text-align: left; }
  table.data.stack td.full::before { display: block; margin-bottom: 2px; }

  #toast { bottom: calc(var(--tabbar-h) + var(--safe-b) + 12px); }
}
/* Feed plan */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid label .small { display: block; font-weight: 400; margin-top: 3px; }
@media (max-width: 480px) { .form-grid { grid-template-columns: 1fr; } }
@media (max-width: 380px) { .logo span { display: none; } }   /* room for the top bar chips on small phones */
/* The Feed plan table styles (.feed-in, .feed-table, .feed-pair) are in modules/equine/css/equine.css */
@media print {
  body { background: var(--color-white) !important; color: var(--color-black) !important; }
  header, nav#appNav, #tabbar, #yardBar, #toast, #sheetRoot, .no-print, .csv-pill { display: none !important; }
  .app-wrap { display: block !important; padding: 0 !important; }
  .card, .tile { background: var(--color-white) !important; border-color: var(--color-print-border) !important; color: var(--color-black) !important; box-shadow: none !important; break-inside: avoid; }
  .tile-val, h2, h3, strong { color: var(--color-black) !important; }
  .muted, .small { color: var(--color-print-muted) !important; }
  table.data.stack { display: table !important; width: 100% !important; }
  table.data.stack thead { display: table-header-group !important; }
  table.data.stack tbody { display: table-row-group !important; }
  table.data th { background: var(--color-white) !important; color: var(--color-black) !important; border-bottom: 2px solid var(--color-black) !important; }
  table.data.stack tr { display: table-row !important; background: none !important; border: none !important; }
  table.data.stack td { display: table-cell !important; border-bottom: 1px solid var(--color-print-rule) !important; text-align: left !important; }
  table.data.stack td::before { display: none !important; }
  .chart-box { height: 220px; }
}
/* Profile photos */
.photo-box { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.photo-frame { position: relative; width: 72px; height: 72px; flex: none; border-radius: var(--radius-md); overflow: hidden; background: var(--navy-surface); border: 1px solid var(--navy-border); display: flex; align-items: center; justify-content: center; font-size: 30px; }
.photo-frame img { display: none; position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-box.has .photo-frame img { display: block; }
.photo-box.has .photo-ph, .photo-box:not(.has) .photo-remove { display: none; }
.photo-info { min-width: 0; flex: 1; }
.avatar { width: 44px; height: 44px; flex: none; border-radius: var(--radius-md); object-fit: cover; margin-right: 12px; }
.photo-backdrop { z-index: 96; }
.photo-canvas { display: block; width: 280px; max-width: 100%; aspect-ratio: 1; margin: 0 auto; border-radius: var(--radius-md); border: 1px solid var(--navy-border); cursor: grab; touch-action: none; background: var(--color-white); }
/* Sharing links */
.share-backdrop { z-index: 95; }
.share-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.share-box { margin-top: 12px; padding: 12px; border: 1px solid var(--navy-border); border-radius: var(--radius-md); background: var(--navy-surface); }
.share-qr { display: inline-block; background: var(--color-white); padding: 6px; border-radius: var(--radius-sm); line-height: 0; }
.share-qr svg { max-width: 100%; height: auto; }
.badge.signoff-due { background: var(--red-a15); color: var(--text-danger); border: 1px solid var(--red-a50); }
.badge.private { background: var(--red-a15); color: var(--text-danger); border: 1px solid var(--red-a50); }
.grow { flex: 1; }
/* Modules page (roadmap 2nti1) */
.module-about { white-space: pre-line; margin-top: 4px; }
.module-facts { margin-top: 8px; line-height: 1.6; word-break: break-word; }
.module-actions { margin-top: 10px; }
.link-btn { background: none; border: none; color: var(--text-muted); font: inherit; font-size: 0.85rem; cursor: pointer; text-decoration: underline; padding: 4px 0; align-self: center; }
.link-btn:hover { color: var(--color-white); }
@media print { #shareRoot { display: none !important; } }
/* Sidebar folder for platform admin pages */
nav#appNav .nav-caret { margin-left: auto; transition: transform 0.2s; font-size: 1.1rem; }
/* Settings page */
.settings-form .grid { margin-top: 10px; }
.field-help { display: block; font-weight: 400; margin-top: 4px; }
.lock-badge { font-size: 0.68rem; vertical-align: middle; margin-left: 4px; }
.settings-form input:disabled, .settings-form select:disabled { opacity: 0.6; }
.settings-form .check-row { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; color: var(--text-main); font-weight: 600; }
/* Roadmap search */
.idea-search { display: flex; align-items: center; gap: 8px; background: var(--navy-surface); border: 1px solid var(--navy-border); border-radius: var(--radius-md); padding: 0 12px; }
.idea-search:focus-within { outline: 2px solid var(--accent-blue); outline-offset: 1px; }
.idea-search input { border: none; background: none; padding-left: 0; outline: none; }
.idea-search input:focus { outline: none; }
mark { background: var(--gold-a35); color: var(--color-white); border-radius: 3px; padding: 0 1px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Installable app (roadmap LMVST): offline banner, update prompt, notch and home bar */
.offline-banner { background: var(--accent-red); color: var(--color-white); text-align: center; font-family: var(--font-heading); font-weight: 700; font-size: 0.9rem; padding: 8px 16px; }
body.is-offline .btn:not(.btn-alt) { opacity: 0.45; pointer-events: none; }
.update-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(24px + var(--safe-b)); z-index: 90; display: flex; align-items: center; gap: 12px; background: var(--color-ink); border: 1px solid var(--accent-gold); color: var(--color-white); padding: 8px 8px 8px 16px; border-radius: var(--radius-pill); box-shadow: var(--shadow-menu); white-space: nowrap; }
.update-bar[hidden], .offline-banner[hidden] { display: none; }
.update-bar .btn { min-height: 36px; padding: 6px 14px; }
@media (max-width: 768px) { .update-bar { bottom: calc(var(--tabbar-h) + var(--safe-b) + 12px); } }
/* Install banner (roadmap zBBrm) */
.install-banner { position: fixed; right: 20px; bottom: calc(20px + var(--safe-b)); z-index: 80; display: flex; align-items: center; gap: 10px; max-width: min(420px, calc(100vw - 24px)); background: var(--color-ink); border: 1px solid var(--accent-gold); color: var(--color-white); padding: 8px 6px 8px 14px; border-radius: var(--radius-card, 16px); box-shadow: var(--shadow-menu); }
.install-banner[hidden] { display: none; }
.install-banner .install-text { display: flex; flex-direction: column; min-width: 0; font-size: 0.85rem; line-height: 1.3; }
.install-banner .install-text strong { font-family: var(--font-heading); }
.install-banner .install-text span { opacity: 0.8; }
.install-banner .btn { min-height: 36px; padding: 6px 14px; white-space: nowrap; }
.install-banner .icon-btn { color: var(--color-white); background: none; }
.install-steps { margin: 0 0 12px; padding-left: 22px; line-height: 1.5; }
.install-steps li { margin-bottom: 8px; }
@media (max-width: 768px) { .install-banner { left: 12px; right: 12px; max-width: none; bottom: calc(var(--tabbar-h) + var(--safe-b) + 12px); } }
@media print { .install-banner { display: none !important; } }
@media (display-mode: standalone) {
  header { padding-top: max(10px, env(safe-area-inset-top)); padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); }
  #tabbar { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
}
@media (display-mode: standalone) and (max-width: 768px) {
  header { padding-top: max(8px, env(safe-area-inset-top)); padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
}
