:root {
  color-scheme: light;

  /* RSRG brand palette */
  --rsrg-red: #DC002E;
  --rsrg-red-dark: #B30025;
  --rsrg-orange: #FF6300;
  --rsrg-orange-dark: #E05800;
  --rsrg-blue: #5CACD8;
  --rsrg-grey: #A0A0A0;
  --rsrg-dark: #323232;

  /* Semantic surfaces */
  --bg: #f2f2f3;
  --card: #ffffff;
  --soft: #f5f5f6;
  --text: #232323;
  --muted: #6e6e6e;
  --line: #e5e5e5;
  --line-strong: #a0a0a0;
  --accent: var(--rsrg-red);
  --accent-2: var(--rsrg-orange);
  --danger: var(--rsrg-red);

  /* RSRG is a square, print-first brand. The only diagonal is the logo slash. */
  --radius: 0px;
  --radius-input: 2px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .06);
  --shadow-strong: 0 2px 8px rgba(0, 0, 0, .08);

  --slash-aspect: 0.656;

  /* Print: Corporate S/E. Office/web fallback: Arial. Never Inter/Roboto/system-ui. */
  --font: "Corporate E", Arial, "Helvetica Neue", Helvetica, sans-serif;
  --font-head: "Corporate E", Arial, "Helvetica Neue", Helvetica, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font: 15px/1.45 var(--font); }
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
h1, h2, h3, p, figure { margin: 0; }
h1 { font-family: var(--font-head); font-weight: 700; font-size: 24px; line-height: 1.1; letter-spacing: -.01em; }
h2 { font-family: var(--font-head); font-weight: 700; font-size: 15px; letter-spacing: 0; }
small { color: var(--muted); font-size: 12px; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled { opacity: .45; cursor: not-allowed; }

.app { min-height: 100dvh; }
.screen { width: min(100%, 1120px); margin: 0 auto; padding: max(10px, env(safe-area-inset-top)) 12px calc(78px + env(safe-area-inset-bottom)); }
.screen.home { max-width: 720px; padding-bottom: max(20px, env(safe-area-inset-bottom)); }
.screen.detail { max-width: 1040px; }

/* RSRG brand strip — logo + claim. Carries the red+orange slash (tandem rule). */
.brand-strip { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 4px 12px; border-bottom: 2px solid var(--rsrg-red); margin-bottom: 12px; }
.brand-strip .brand-logo { height: 34px; width: auto; display: block; }
.brand-strip .claim { color: var(--rsrg-dark); font-weight: 700; font-size: 13px; letter-spacing: -.01em; }
@media (max-width: 480px) { .brand-strip .claim { display: none; } }

.app-header { position: sticky; top: 0; z-index: 20; margin: 0 -12px 12px; padding: max(10px, env(safe-area-inset-top)) 12px 10px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(160px, 230px); gap: 10px; align-items: center; background: rgba(242, 242, 243, .94); border-bottom: 1px solid var(--line); backdrop-filter: blur(16px); }
.app-header.with-back { grid-template-columns: 38px minmax(0, 1fr) auto; }
.title-stack { min-width: 0; display: grid; gap: 2px; }
.title-stack h1, .title-stack .project-meta, .kicker { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kicker { color: var(--rsrg-red-dark); font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.kicker-slash { height: 1.05em; width: auto; vertical-align: -0.18em; }
.project-meta { display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 12px; }
.header-actions { display: flex; gap: 6px; align-items: center; }
.detail-card h2 .loc-source { font: 600 11px/1 var(--font); color: var(--muted); text-transform: none; letter-spacing: 0; }
.user-block { display: grid; gap: 4px; }
.user-block label { color: var(--muted); font-size: 12px; font-weight: 700; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.stack { display: grid; gap: 10px; }
.section { padding: 12px; display: grid; gap: 9px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.section-head strong { font-family: var(--font-head); font-size: 15px; font-weight: 700; }
.section-head small { text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.section-body { min-width: 0; }

input, textarea, select { width: 100%; min-height: 38px; border: 1px solid var(--line-strong); border-radius: var(--radius-input); background: var(--card); padding: 8px 10px; outline: 0; }
textarea { min-height: 54px; max-height: 126px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--rsrg-red); box-shadow: 0 0 0 3px rgba(220, 0, 46, .15); }
.field { display: grid; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 700; }

button { min-height: 38px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--card); padding: 8px 12px; font-weight: 700; transition: background-color .15s ease, color .15s ease, transform .05s ease; }
button:active { transform: translateY(1px); }
button.primary { background: var(--rsrg-red); border-color: var(--rsrg-red); color: #fff; letter-spacing: .04em; text-transform: uppercase; }
button.primary:hover { background: var(--rsrg-red-dark); border-color: var(--rsrg-red-dark); }
button.danger, .danger { color: var(--danger); border-color: rgba(220, 0, 46, .35); }
button.danger.primary, .audio-actions .danger { color: #fff; background: var(--danger); border-color: var(--danger); }
button.ghost { background: transparent; box-shadow: none; }
button.icon { width: 38px; min-width: 38px; height: 38px; padding: 0; display: grid; place-items: center; border-radius: var(--radius); font-size: 28px; line-height: 1; }
button.small, .small { min-height: 32px; padding: 6px 10px; font-size: 13px; }
.hidden { display: none; }

.project-create { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 10px; margin-bottom: 10px; box-shadow: none; }
.project-list { display: grid; gap: 8px; }
.project-row-wrap { overflow: hidden; border-left: 3px solid var(--rsrg-red); }
.project-row { width: 100%; min-height: 60px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 12px 14px; text-align: left; border: 0; border-radius: 0; }
.project-row strong { display: block; font-family: var(--font-head); font-size: 16px; margin-bottom: 2px; }
.project-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 12px; align-items: start; }
.two-col > .stack:last-child { position: sticky; top: 76px; }
.action-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.action { min-height: 50px; display: grid; justify-items: start; align-content: center; gap: 1px; padding: 8px 10px; text-align: left; }
.action strong { font-size: 14px; }
.action small { font-size: 11px; }

.thumb-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scroll-snap-type: x proximity; }
.thumb { position: relative; flex: 0 0 92px; overflow: hidden; min-height: 88px; border: 1px solid var(--line); border-radius: 0; background: var(--soft); scroll-snap-align: start; }
.thumb img, .thumb video { width: 100%; height: 68px; display: block; object-fit: cover; background: #e9e9ec; }
.thumb .type { display: block; padding: 3px 7px 5px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .06em; }
.thumb button { position: absolute; top: 5px; right: 5px; width: 32px; min-height: 32px; padding: 0; border-radius: 0; background: rgba(255, 255, 255, .95); }
.thumb .draw-btn { right: 41px; }

.draw-editor { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; padding: 12px; background: rgba(0, 0, 0, .76); }
.draw-sheet { width: min(100%, 980px); height: min(100%, 820px); display: grid; grid-template-rows: auto minmax(0, 1fr); background: #fff; border: 1px solid var(--line-strong); box-shadow: var(--shadow-strong); }
.draw-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px; border-bottom: 1px solid var(--line); }
.draw-toolbar strong { margin-right: auto; }
.draw-toolbar label { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 800; }
.draw-toolbar input[type="color"] { width: 42px; min-height: 32px; padding: 2px; }
.draw-toolbar input[type="range"] { width: 110px; min-height: 32px; padding: 0; }
.draw-sheet canvas { width: 100%; height: 100%; display: block; object-fit: contain; touch-action: none; background: #eee; }

.audio-actions { display: grid; grid-template-columns: minmax(0, 1fr) 68px 40px; gap: 7px; }
.audio-list { display: grid; gap: 7px; }
.audio-note { overflow: hidden; border: 1px solid var(--line); border-radius: 0; background: var(--soft); }
.audio-note summary { list-style: none; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 8px 9px; cursor: pointer; }
.audio-note summary::-webkit-details-marker { display: none; }
.audio-title { display: grid; min-width: 0; }
.audio-title strong { display: flex; align-items: center; gap: 6px; }
.audio-title small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audio-tools button { width: 34px; min-height: 34px; padding: 0; border-radius: 0; }
.audio-note audio { width: calc(100% - 18px); height: 32px; margin: 0 9px 8px; }
.audio-inner { display: grid; gap: 8px; padding: 0 9px 9px; }
.recording-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--rsrg-red); display: inline-block; box-shadow: 0 0 0 5px rgba(220, 0, 46, .14); }

.comment-box textarea { min-height: 60px; }
.capture-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; align-items: end; }
.capture-meta .field { min-width: 0; }
.bf-toggle { min-height: 38px; display: grid; grid-template-columns: minmax(72px, 1fr) auto auto; align-items: center; gap: 7px; padding: 6px 8px; border: 1px solid var(--line-strong); background: var(--card); color: var(--muted); font-size: 12px; font-weight: 700; }
.bf-toggle label { display: inline-flex; align-items: center; gap: 5px; color: var(--text); }
.bf-toggle input { width: auto; min-height: 0; margin: 0; padding: 0; accent-color: var(--rsrg-red); }
.save-panel { padding: 12px; display: grid; gap: 8px; }
.empty-line { border: 1px dashed var(--line-strong); border-radius: 0; padding: 10px; background: var(--card); color: var(--muted); text-align: center; }
.compact-empty { margin: 0 9px 8px; padding: 8px; }

.location-card { overflow: hidden; }
.location-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; margin-bottom: 8px; }
.coord-main { font-family: var(--font-head); font-weight: 700; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.coord-sub { margin-top: 1px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.map-shell { position: relative; height: 228px; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 0; background: #dfe8df; isolation: isolate; }
.leaflet-map { position: absolute; inset: 0; z-index: 1; touch-action: none; }
.leaflet-container { font: 12px/1.2 Arial, "Helvetica Neue", Helvetica, sans-serif; background: #dfe8df; outline: 0; }
.leaflet-pane, .leaflet-tile, .leaflet-marker-icon, .leaflet-marker-shadow, .leaflet-tile-container, .leaflet-pane > svg, .leaflet-pane > canvas, .leaflet-zoom-box, .leaflet-image-layer, .leaflet-layer { position: absolute; left: 0; top: 0; }
.leaflet-container { overflow: hidden; }
.leaflet-tile, .leaflet-marker-icon, .leaflet-marker-shadow { user-select: none; -webkit-user-drag: none; }
.leaflet-control-zoom { border: 0 !important; box-shadow: var(--shadow-strong) !important; }
.leaflet-control-zoom a { width: 30px !important; height: 30px !important; line-height: 30px !important; color: var(--text) !important; border: 0 !important; border-radius: 0 !important; }
.leaflet-bar { border-radius: 0 !important; }
.leaflet-control-layers { border-radius: 0 !important; border: 1px solid var(--line) !important; box-shadow: var(--shadow-strong) !important; }
.leaflet-control-layers-toggle { width: 24px !important; height: 24px !important; background-size: 14px 14px !important; }
.leaflet-control-layers-expanded { padding: 4px 6px !important; font-size: 10px !important; max-width: 132px; max-height: 92px; overflow-y: auto; }
.leaflet-control-layers-list label { margin: 1px 0 !important; line-height: 1.1 !important; }
.leaflet-control-layers-list input { width: auto; min-height: 0; margin: 0 3px 0 0; padding: 0; }
.leaflet-control-layers-separator { margin: 3px 0 !important; }
.pdf-map-overlay { position: absolute; border: 0; background: transparent; mix-blend-mode: multiply; }
.leaflet-control-attribution { opacity: .7; font-size: 10px !important; }
.map-center-pin { position: absolute; left: 50%; top: 50%; z-index: 2; width: 18px; height: 18px; transform: translate(-50%, -50%); border-radius: 999px; background: var(--rsrg-red); border: 3px solid #fff; box-shadow: 0 2px 7px rgba(0,0,0,.32), 0 0 0 1px rgba(0,0,0,.08); pointer-events: none; }
.map-center-pin::after { content: ""; position: absolute; left: 50%; top: 50%; width: 5px; height: 5px; transform: translate(-50%, -50%); border-radius: 999px; background: #fff; opacity: .98; }
.map-fallback { height: 100%; display: grid; place-items: center; padding: 18px; color: var(--muted); text-align: center; background: var(--soft); }
.map-help { margin-top: 7px; color: var(--muted); font-size: 12px; }
.pdf-pin-card .bf-toggle { margin-bottom: 0; }
.pdf-pin-tools { display: grid; grid-template-columns: 40px 52px 58px 40px minmax(52px, 1fr); gap: 6px; align-items: center; }
.pdf-pin-tools button { min-height: 34px; padding: 0 8px; }
.pdf-pin-tools small { justify-self: end; font-weight: 800; color: var(--muted); }
.pdf-pin-stage { position: relative; width: 100%; height: min(54vh, 520px); min-height: 220px; overflow: auto; border: 1px solid var(--line-strong); background: #d7d7d9; overscroll-behavior: contain; touch-action: none; }
.pdf-pin-page { position: relative; width: max-content; height: max-content; margin-inline: auto; }
.pdf-pin-stage canvas { display: block; max-width: none; background: #fff; touch-action: none; cursor: crosshair; }
.pdf-pin-draft-marker { position: absolute; z-index: 2; width: 18px; height: 18px; border-radius: 999px; background: #1565d8; border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.34); transform: translate(-50%, -50%); pointer-events: none; }
.pdf-pin-draft-marker::after { content: ""; position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; border-radius: 999px; background: #fff; transform: translate(-50%, -50%); }

.project-tabs { position: fixed; left: 50%; bottom: max(12px, env(safe-area-inset-bottom)); z-index: 40; transform: translateX(-50%); width: min(420px, calc(100% - 24px)); display: grid; grid-template-columns: 1fr 1fr; gap: 0; padding: 0; border: 1px solid var(--line-strong); border-radius: 0; background: #fff; box-shadow: var(--shadow-strong); overflow: hidden; }
.project-tabs button { border: 0; border-radius: 0; background: transparent; min-height: 46px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; font-size: 13px; }
.project-tabs button + button { border-left: 1px solid var(--line); }
.project-tabs button.active { color: #fff; background: var(--rsrg-dark); }

.timeline-list { display: grid; gap: 8px; }
.timeline-filters { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; align-items: stretch; }
.filter-toggle { min-height: 40px; display: inline-grid; grid-template-columns: auto auto auto; align-items: center; gap: 6px; padding: 6px 9px; border: 1px solid var(--line-strong); background: var(--card); font-weight: 700; white-space: nowrap; }
.filter-toggle input { width: auto; min-height: unset; accent-color: var(--rsrg-red); }
.filter-toggle small { min-width: 22px; padding: 1px 5px; border: 1px solid var(--line); text-align: center; }
.bundle-row { width: 100%; min-height: 72px; display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 10px; align-items: center; padding: 8px; text-align: left; border-radius: 0; border-left: 3px solid var(--rsrg-orange); touch-action: pan-y; transition: transform .12s ease, background .12s ease, box-shadow .12s ease; }
.bundle-row.is-unread { border-left-color: var(--rsrg-red); background: #fff7f5; }
.bundle-row.swiping-read { background: #eef8f1; }
.bundle-row.swiping-unread { background: #fff1e8; }
.bundle-cover { width: 56px; height: 56px; display: grid; place-items: center; overflow: hidden; border-radius: 0; background: var(--rsrg-dark); color: #fff; font-family: var(--font-head); font-weight: 700; }
.bundle-cover img, .bundle-cover video { width: 100%; height: 100%; object-fit: cover; }
.bundle-main { display: grid; gap: 4px; min-width: 0; }
.bundle-title { display: flex; justify-content: space-between; gap: 8px; min-width: 0; }
.bundle-title strong, .bundle-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bundle-title strong { min-width: 0; flex: 1 1 auto; font-family: var(--font-head); }
.bundle-title small { flex: 0 0 auto; }
.badges { display: flex; flex-wrap: wrap; gap: 5px; }
.badges span { display: inline-flex; min-height: 21px; align-items: center; border-radius: 0; background: #ededee; color: #3f3f46; padding: 2px 8px; font-size: 11px; font-weight: 700; letter-spacing: .02em; }
.badges .unread-badge { color: #fff; background: var(--rsrg-red); }

.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.detail-card { padding: 12px; display: grid; gap: 8px; }
.detail-card h2 { padding-bottom: 6px; border-bottom: 2px solid var(--rsrg-red); }
.detail-meta-edit { grid-template-columns: 1fr; }
.meta-read { align-content: start; }
.detail-card.wide { grid-column: span 2; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(138px, 1fr)); gap: 8px; }
.file-card { overflow: hidden; border: 1px solid var(--line); border-radius: 0; background: var(--soft); }
.file-card img, .file-card video { width: 100%; max-height: 340px; display: block; object-fit: contain; background: #e9e9ec; }
.file-card figcaption, .file-foot { min-height: 34px; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 8px; padding: 6px 8px; color: var(--muted); font-size: 12px; }
.file-foot strong, .file-foot span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-card button, .file-foot button { width: 34px; min-height: 34px; padding: 0; border-radius: 0; }
.audio-detail { overflow: hidden; border: 1px solid var(--line); border-radius: 0; background: var(--soft); }
.audio-detail + .audio-detail { margin-top: 8px; }
.audio-detail summary { list-style: none; cursor: pointer; }
.audio-detail summary::-webkit-details-marker { display: none; }
.audio-detail audio { width: calc(100% - 18px); height: 32px; margin: 0 9px 8px; }
.audio-detail .read-field { padding: 0 9px 9px; }
pre { margin: 0; padding: 9px; border: 1px solid var(--line); border-radius: 0; background: var(--card); white-space: pre-wrap; word-break: break-word; font: inherit; }

@media (max-width: 820px) {
  html, body { font-size: 14px; }
  .screen { max-width: 520px; padding-inline: 9px; }
  .screen.home { max-width: 520px; }
  .app-header { margin-inline: -9px; grid-template-columns: 1fr; gap: 8px; }
  .app-header.with-back { grid-template-columns: 38px minmax(0, 1fr) auto; }
  .user-block { grid-template-columns: 52px minmax(0, 1fr); align-items: end; }
  .user-block label { padding-bottom: 10px; }
  .two-col { grid-template-columns: 1fr; gap: 8px; }
  .two-col > .stack:last-child { position: static; }
  .section { padding: 10px; gap: 8px; }
  .action-row { gap: 6px; }
  .action { min-height: 46px; padding: 7px 8px; }
  .thumb { flex-basis: 78px; min-height: 74px; }
  .thumb img, .thumb video { height: 56px; }
  .audio-actions { grid-template-columns: minmax(0, 1fr) 62px 38px; gap: 6px; }
  .capture-meta, .timeline-filters { grid-template-columns: 1fr; }
  .map-shell { height: 196px; }
  .detail-grid, .detail-card.wide { grid-template-columns: 1fr; grid-column: auto; }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
}

@media (max-width: 380px) {
  .action-row { grid-template-columns: 1fr; }
}

/* Keyboard focus — visible ring in brand red */
:focus-visible { outline: 2px solid var(--rsrg-red); outline-offset: 2px; }
button:focus-visible, .project-row:focus-visible, .bundle-row:focus-visible { outline: 2px solid var(--rsrg-red); outline-offset: 2px; }

/* Hover / press affordance for clickable rows (lift via shadow, no scale) */
.project-row:hover, .bundle-row:hover { background: var(--soft); }
.project-row-wrap:hover, .timeline-list .bundle-row:hover { box-shadow: var(--shadow-strong); }
.project-row:active, .bundle-row:active { transform: translateY(1px); }

/* Tabular figures keep coordinates and timestamps from shifting */
.bundle-main small, pre { font-variant-numeric: tabular-nums; }

/* Status toast — sober dark surface, orange accent (red+orange tandem), polite live region */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(76px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(8px);
  z-index: 60;
  max-width: min(440px, calc(100% - 24px));
  padding: 11px 14px;
  background: var(--rsrg-dark);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  border-left: 3px solid var(--rsrg-orange);
  box-shadow: var(--shadow-strong);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .001ms !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; }
}

/* Official RSRG line-art icons (black stroke). Decorative — aria-hidden in markup. */
.rsrg-ico { width: 18px; height: 18px; flex: 0 0 auto; display: inline-block; vertical-align: middle; }
.section-head strong, .detail-card h2 { display: inline-flex; align-items: center; gap: 8px; }
.section-head strong .rsrg-ico, .detail-card h2 .rsrg-ico { width: 19px; height: 19px; }
[data-use-gps] { display: inline-flex; align-items: center; gap: 6px; }
[data-use-gps] .rsrg-ico { width: 16px; height: 16px; }
.project-tabs button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.project-tabs button .rsrg-ico { width: 18px; height: 18px; }
.project-tabs button.active .rsrg-ico { filter: brightness(0) invert(1); }

/* Timeline map markers */
.map-marker { background: none; border: 0; }
.map-marker-pin { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 999px; background: var(--rsrg-red); border: 3px solid #fff; box-shadow: 0 1px 5px rgba(0, 0, 0, .4); }
.map-marker-label { color: #fff; font: 700 11px/1 Arial, sans-serif; }
.map-marker.marker-active .map-marker-pin { box-shadow: 0 0 0 5px rgba(220, 0, 46, .30), 0 1px 5px rgba(0, 0, 0, .4); animation: marker-pulse .7s ease-in-out infinite; }
@keyframes marker-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.35); } }
.map-marker-phone { display: block; width: 18px; height: 18px; border-radius: 999px; background: var(--rsrg-blue); border: 3px solid #fff; box-shadow: 0 0 0 4px rgba(92, 172, 216, .35), 0 1px 5px rgba(0, 0, 0, .4); }

/* Hover preview tooltip on map markers (desktop) */
.map-preview-float { position: fixed; z-index: 70; padding: 0; border: 1px solid var(--line-strong); background: #fff; box-shadow: var(--shadow-strong); overflow: hidden; pointer-events: none; opacity: 0; transition: opacity .12s ease; }
.map-preview-float.show { opacity: 1; }
.map-preview .map-preview-grid { display: grid; grid-template-columns: repeat(2, 76px); gap: 2px; }
.map-preview .map-preview-grid:has(> :only-child) { grid-template-columns: 154px; }
.map-preview img, .map-preview video { width: 100%; height: 58px; object-fit: cover; display: block; background: #e9e9ec; }
.map-preview .map-preview-grid:has(> :only-child) img, .map-preview .map-preview-grid:has(> :only-child) video { height: 100px; }
.map-preview-cap { padding: 5px 8px; font: 600 12px/1.3 Arial, sans-serif; color: var(--text); }
.map-preview .map-preview-grid + .map-preview-cap { border-top: 1px solid var(--line); }

/* Timeline "Wann war was wo" log */
.timeline-map-card .map-shell { margin-top: 2px; }
.timeline-log-card .timeline-list { margin-top: 2px; }
.bundle-when, .bundle-where { display: inline-flex; align-items: center; gap: 5px; }
.bundle-when .rsrg-ico, .bundle-where .rsrg-ico { width: 13px; height: 13px; opacity: .65; }

/* Accessibility helper */
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Login screen — Swiss-style split: construction-site hero + clean form panel */
.login-screen { width: 100%; max-width: none; margin: 0; padding: 0; min-height: 100dvh; display: flex; flex-direction: column; background: var(--rsrg-dark); }

.login-hero {
  position: relative; flex: 1 1 42vh; min-height: 230px;
  background: url('/brand/login-bg.jpg') center 38% / cover no-repeat;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: max(20px, env(safe-area-inset-top)) 22px 22px;
}
.login-hero-scrim { position: absolute; inset: 0; background:
  linear-gradient(180deg, rgba(20,20,22,.62) 0%, rgba(20,20,22,.18) 32%, rgba(20,20,22,.30) 60%, rgba(20,20,22,.78) 100%); }
.login-hero-content { position: relative; z-index: 1; display: flex; flex-direction: column; justify-content: space-between; height: 100%; gap: 16px; }
.login-logo { height: 40px; width: auto; align-self: flex-start; filter: drop-shadow(0 1px 6px rgba(0,0,0,.45)); }
.login-hero-text { display: grid; gap: 4px; }
.login-kicker { color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; opacity: .9; }
.login-hero-title { color: #fff; font-size: 30px; line-height: 1.05; text-shadow: 0 2px 12px rgba(0,0,0,.5); }
.login-claim { color: #fff; font-weight: 700; font-size: 14px; letter-spacing: -.01em; opacity: .95; text-shadow: 0 1px 8px rgba(0,0,0,.5); }

.login-panel { background: var(--card); display: flex; align-items: flex-start; justify-content: center; padding: 22px 22px calc(26px + env(safe-area-inset-bottom)); border-top: 3px solid var(--rsrg-red); }
.login-card { position: relative; width: 100%; max-width: 380px; display: grid; gap: 14px; }
.login-hero-slash { position: absolute; right: 20px; bottom: 18px; z-index: 1; height: 120px; aspect-ratio: 113.18 / 172.52; background: url('/brand/slash.svg') right bottom / contain no-repeat; filter: drop-shadow(0 2px 10px rgba(0,0,0,.45)); pointer-events: none; }
.login-card .title-stack { gap: 5px; }
.login-title { font-family: var(--font-head); font-weight: 700; font-size: 22px; }
.login-subtitle { color: var(--muted); font-size: 13px; }
.login-card .field { gap: 6px; }
.login-submit { min-height: 46px; font-size: 15px; }
.login-error { display: block; padding: 9px 11px; border: 1px solid rgba(220, 0, 46, .35); background: rgba(220, 0, 46, .07); color: var(--rsrg-red-dark); font-size: 13px; font-weight: 700; }
.login-error[hidden] { display: none; }

/* Desktop / tablet: true split screen */
@media (min-width: 880px) {
  .login-screen { flex-direction: row; }
  .login-hero { flex: 1 1 auto; min-height: 100dvh; padding: 40px 44px; background-position: center 42%; }
  .login-hero-title { font-size: 44px; }
  .login-claim { font-size: 16px; }
  .login-hero-slash { height: 240px; right: 44px; bottom: 40px; }
  .login-panel { flex: 0 0 clamp(380px, 34vw, 520px); min-height: 100dvh; align-items: center; padding: 40px; border-top: 0; border-left: 3px solid var(--rsrg-red); }
}

@media (prefers-reduced-motion: no-preference) {
  .login-card { animation: login-rise .42s ease-out both; }
  .login-hero-text { animation: login-fade .6s ease-out both; }
}
@keyframes login-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes login-fade { from { opacity: 0; } to { opacity: 1; } }

/* Auth block in the projects header (signed-in user, language switcher, sign out) */
.auth-block { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "user lang" "user logout"; gap: 4px 8px; align-items: center; justify-items: end; }
.auth-user { grid-area: user; display: grid; gap: 1px; justify-items: end; min-width: 0; text-align: right; }
.auth-user small { font-size: 11px; }
.auth-user strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.auth-lang { grid-area: lang; display: block; }
.auth-lang select { min-height: 32px; padding: 4px 8px; font-size: 13px; }
.auth-block [data-logout] { grid-area: logout; }
@media (max-width: 480px) {
  .auth-block { grid-template-columns: auto auto; grid-template-areas: "user user" "lang logout"; justify-items: stretch; }
  .auth-user { justify-items: start; text-align: left; }
}

/* RTL (Arabic) — flip alignment; layout is mostly flexbox/grid so this is light-touch */
[dir="rtl"] .section-head small { text-align: left; }
[dir="rtl"] .auth-block { justify-items: start; }
[dir="rtl"] .auth-user { justify-items: start; text-align: left; }
[dir="rtl"] .login-card, [dir="rtl"] .field, [dir="rtl"] .kicker { text-align: right; }
[dir="rtl"] .login-hero-text, [dir="rtl"] .login-title, [dir="rtl"] .login-subtitle { text-align: right; }
[dir="rtl"] .login-logo { align-self: flex-end; }
[dir="rtl"] .login-hero-slash { right: auto; left: 20px; background-position: left bottom; }
@media (min-width: 880px) { [dir="rtl"] .login-hero-slash { left: 44px; } }
[dir="rtl"] .login-card input, [dir="rtl"] .login-card select { text-align: right; }
@media (min-width: 880px) {
  [dir="rtl"] .login-panel { border-left: 0; border-right: 3px solid var(--rsrg-red); }
}
[dir="rtl"] .coord-main, [dir="rtl"] .coord-sub { direction: ltr; text-align: right; }
[dir="rtl"] .app-header.with-back { grid-template-columns: auto minmax(0, 1fr) 38px; }
[dir="rtl"] .icon { transform: scaleX(-1); }

/* X/Y/Z nudge in the location edit card */
.coord-edit-grid { display: grid; gap: 6px; margin: 8px 0; }

.coord-edit-row {
  display: grid; grid-template-columns: 64px minmax(0, 1fr);
  align-items: center; gap: 8px;
  color: var(--muted); font-size: 12px; font-weight: 700;
}

.coord-edit-controls {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) 34px; gap: 4px;
}

.coord-edit-controls button {
  min-height: 34px; padding: 0;
  font-weight: 700;
}

.coord-edit-controls input {
  min-height: 34px; padding: 4px 8px;
  text-align: right;
}

/* Comment thread on the bundle detail page */
.thread-list { display: grid; gap: 6px; }

.thread-item {
  display: grid; gap: 2px;
  padding: 7px 9px;
  background: var(--soft);
  border-left: 3px solid var(--rsrg-red);
}

.thread-item small { color: var(--muted); font-size: 11px; }
.thread-item p { margin: 0; white-space: pre-wrap; }

.thread-add {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px; align-items: end; margin-top: 8px;
}

.thread-add textarea { min-height: 44px; }
