:root {
    --bg: #f0ece4; --bg2: #e8e2d8; --surface: #faf8f5; --surface2: #f3efe8; --surface3: #ece8e0;
    --border: #d4cdc0; --border2: #bfb8aa;
    --navy: #1a2744; --navy2: #243560; --navy3: #2f4480;
    --text: #1a1f2e; --text2: #3d4460; --muted: #7a8099; --faint: #a8afc5;
    --orange: #c95b1a; --orange2: #e06b22; --orange-bg: #fdf0e8; --orange-bd: #e8c4a8;
    --green: #1a6e3c; --green-bg: #e8f5ee; --green-bd: #a8d4b8;
    --red: #a8201a; --red-bg: #fbecea; --red-bd: #e0b0ac;
    --blue: #1a4d8a; --blue-bg: #e8f0fa; --blue-bd: #a8c4e8;
    --teal: #1a6b6b; --teal-bg: #e8f5f5; --teal-bd: #a0d0d0;
    --amber: #8a5c00; --amber-bg: #fdf6e3; --amber-bd: #e0d090;
    --nav-w: 100px; --topbar-h: calc(48px + env(safe-area-inset-top, 0px)); --panel-w: 400px;
    --shadow: 0 1px 3px rgba(26,31,46,.12),0 4px 12px rgba(26,31,46,.06);
    --shadow-md: 0 4px 16px rgba(26,31,46,.14),0 1px 4px rgba(26,31,46,.08);
    --sans: system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: "Cascadia Mono", "Consolas", ui-monospace, monospace;
    --head: "Oswald", "Segoe UI", "Arial Narrow", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 13px; }
html, body { height: 100%; overflow: hidden; touch-action: manipulation; }
body { font-family: var(--sans); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
.hidden { display: none !important; }
.tb-spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 12px; line-height: 1.5; margin-bottom: 10px; }
.screen { height: 100vh; width: 100vw; }

.ic { width: 1em; height: 1em; display: inline-block; vertical-align: -0.125em; }
span.ico { display: inline-flex; width: 1em; height: 1em; vertical-align: -0.125em; flex: 0 0 auto; }
span.ico svg { width: 100%; height: 100%; }

#screen-auth { display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, #1a2744 0%, #0f1729 100%); overflow: auto; }
.auth-card { background: var(--surface); border-radius: 16px; box-shadow: 0 18px 60px rgba(0,0,0,.4); padding: 40px 36px; width: 100%; max-width: 400px; margin: 20px; animation: rise .4s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.auth-form { margin-top: 8px; }
.form-error { color: var(--red); font-size: 13px; margin-top: 12px; text-align: center; }
.auth-hint { text-align: center; margin-top: 12px; }
.startup-logo { font-family: var(--head); font-size: 42px; font-weight: 700; letter-spacing: 4px; color: var(--navy); text-align: center; }
.startup-sub { text-align: center; color: var(--muted); font-size: 12px; letter-spacing: 1px; text-transform: uppercase; margin-top: 4px; margin-bottom: 18px; }

#topbar { position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h); z-index: 300; background: var(--navy); display: flex; align-items: center; color: #fff; padding: env(safe-area-inset-top, 0px) 14px 0 0; }
.tb-brandwrap { line-height: 1; width: var(--nav-w); padding-left: 14px; }
.tb-brand { font-family: var(--head); font-size: 17px; letter-spacing: 2px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.tb-brand-sub { font-size: 9px; letter-spacing: 2px; color: var(--faint); margin-top: 2px; }
.tb-toolbox-btn { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18); color: #fff; border-radius: 7px; padding: 6px 12px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; margin-left: 16px; transition: background .12s, border-color .12s; display: inline-flex; align-items: center; gap: 4px; }
.tb-toolbox-btn:hover { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.4); }

.account-chip { display: inline-flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border2); border-radius: 22px; padding: 4px 12px 4px 5px; color: var(--navy); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.account-chip-tb { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.18); color: #fff; margin-left: 12px; }
.account-chip-tb:hover { border-color: rgba(255,255,255,.4); }
.chip-avatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; overflow: hidden; }
.avatar-fallback { background: var(--navy); color: #fff; font-family: var(--head); font-weight: 700; letter-spacing: .5px; }
.account-chip-tb .avatar-fallback { background: var(--orange); }

.presence-stack { display: flex; align-items: center; margin-right: 6px; }
.presence-stack:empty { display: none; }
.presence-chip { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; margin-left: -6px; border-radius: 50%; background: var(--navy3); color: #fff; font-family: var(--head); font-weight: 700; font-size: 11px; border: 2px solid var(--navy); box-shadow: 0 1px 3px rgba(0,0,0,.35); cursor: default; overflow: hidden; }
.presence-chip img { width: 100%; height: 100%; object-fit: cover; }
.presence-chip:first-child { margin-left: 0; }

#nav { position: fixed; top: var(--topbar-h); left: 0; bottom: 0; width: var(--nav-w); z-index: 200; background: var(--navy); display: flex; flex-direction: column; overflow-y: auto; padding-bottom: 8px; }
.nav-item { background: none; border: none; color: rgba(255,255,255,.4); display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 11px 4px; cursor: pointer; position: relative; transition: color .12s, background .12s; width: 100%; font: inherit; }
.nav-item:hover { color: rgba(255,255,255,.75); background: rgba(255,255,255,.04); }
.nav-item.active { color: #fff; background: rgba(255,255,255,.06); }
.nav-item.active::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--orange2); }
.nav-icon { font-size: 22px; }
.nav-label { font-family: var(--head); font-size: 10px; letter-spacing: 1.2px; position: relative; }
.nav-badge { position: absolute; top: -10px; right: -16px; background: var(--orange2); color: #1a1200; border-radius: 10px; font-size: 9px; padding: 1px 5px; font-family: var(--sans); font-weight: 800; }
.nav-spacer { flex: 1; }
.nav-foot { color: rgba(255,255,255,.3); font-size: 9px; text-align: center; padding: 8px 4px 2px; line-height: 1.4; }
.nav-m-only { display: none; }

#shell { position: fixed; top: var(--topbar-h); left: var(--nav-w); right: 0; bottom: 0; background: var(--bg); }
.view { display: none; height: 100%; flex-direction: column; }
.view.active { display: flex; animation: pageIn .18s ease; }
@keyframes pageIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.view-head { display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 6px 20px; background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.view-head h2 { font-family: var(--head); text-transform: uppercase; letter-spacing: 1.5px; font-size: 16px; color: var(--navy); margin-right: auto; }
.view-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.view-scroll { flex: 1; overflow-y: auto; padding: 18px 22px 40px; -webkit-overflow-scrolling: touch; }
.view-intro { color: var(--text2); font-size: 12.5px; max-width: 760px; margin-bottom: 14px; line-height: 1.5; }

.seg { display: inline-flex; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 2px; }
.seg-btn { font: inherit; font-size: 12px; font-weight: 600; border: none; background: none; color: var(--text2); padding: 5px 10px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.seg-btn.active { background: var(--navy); color: #fff; }

.btn { font: inherit; font-weight: 600; border: 1px solid transparent; border-radius: 7px; padding: 8px 14px; cursor: pointer; letter-spacing: .3px; transition: filter .12s, background .12s; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-block { width: 100%; justify-content: center; margin-top: 10px; }
.btn-sm { padding: 6px 11px; font-size: 12px; }
.btn-xs { padding: 4px 9px; font-size: 11px; }
.btn-navy { background: var(--navy); color: #fff; }
.btn-orange { background: var(--orange); color: #fff; }
.btn-red { background: var(--red); color: #fff; }
.btn-green { background: var(--green); color: #fff; }
.btn-outline { background: var(--surface); color: var(--navy); border-color: var(--border2); }
.btn-red-outline { background: var(--surface); color: var(--red); border-color: var(--red-bd); }
.icon-btn { background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; min-width: 28px; height: 26px; cursor: pointer; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; color: var(--text2); padding: 0 6px; font-family: inherit; }
.icon-btn:hover { background: var(--surface3); }
.icon-btn.del:hover { background: var(--red-bg); color: var(--red); border-color: var(--red-bd); }
.icon-btn:disabled { opacity: .35; cursor: default; }

.field { display: block; margin-bottom: 12px; min-width: 0; }
.field-label { display: block; font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--text2); margin-bottom: 5px; }
.field-input, .field-select, .field-textarea { display: block; width: 100%; padding: 9px 11px; border: 1.5px solid var(--border); border-radius: 8px; font: inherit; background: #fff; color: var(--text); }
.field-input:focus, .field-select:focus, .field-textarea:focus { outline: none; border-color: var(--navy3); }
.field-input:disabled, .field-select:disabled, .field-textarea:disabled { background: var(--surface2); color: var(--text2); }
.field-textarea { resize: vertical; min-height: 70px; }
.form-row { display: flex; gap: 10px; }
.form-row .field { flex: 1; }
.form-row .f1 { flex: 1; } .form-row .f2 { flex: 2; }
.mono-input { font-family: var(--mono); text-transform: uppercase; letter-spacing: .5px; }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 10px 0; cursor: pointer; }
input[type=date], input[type=time], input[type=datetime-local] { -webkit-appearance: none; appearance: none; min-width: 0; max-width: 100%; }

.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 700; letter-spacing: .3px; white-space: nowrap; }
.tag-navy { background: var(--navy); color: #fff; }
.tag-orange { background: var(--orange-bg); color: var(--orange); border: 1px solid var(--orange-bd); }
.tag-green { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-bd); }
.tag-red { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-bd); }
.tag-teal { background: var(--teal-bg); color: var(--teal); border: 1px solid var(--teal-bd); }
.tag-amber { background: var(--amber-bg); color: var(--amber); border: 1px solid var(--amber-bd); }
.tag-blue { background: var(--blue-bg); color: var(--blue); border: 1px solid var(--blue-bd); }
.tag-grey { background: var(--surface3); color: var(--text2); border: 1px solid var(--border); }

.section-head { font-family: var(--head); text-transform: uppercase; letter-spacing: 1.5px; font-size: 13px; color: var(--navy); margin: 18px 0 8px; padding-bottom: 4px; border-bottom: 2px solid var(--border); }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; font-size: 13px; }
.empty-icon { font-size: 34px; margin-bottom: 8px; opacity: .6; }

.cl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.cl-card { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--navy); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); cursor: pointer; transition: transform .12s ease, box-shadow .12s ease; display: flex; flex-direction: column; gap: 6px; }
.cl-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.cl-card.archived { border-left-color: var(--border2); opacity: .85; }
.cl-card.template { border-left-color: var(--teal); }
.cl-card.crate { border-left-color: var(--orange); }
.cl-card-name { font-family: var(--head); font-weight: 700; text-transform: uppercase; letter-spacing: .5px; font-size: 16px; color: var(--navy); }
.cl-card-meta { color: var(--muted); font-size: 12px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.cl-card-badges { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 2px; }
.cl-card-actions { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.cl-card-desc { font-size: 12px; color: var(--text2); }
.mini-progress { height: 6px; background: var(--surface3); border-radius: 4px; overflow: hidden; margin-top: 4px; }
.mini-progress-fill { height: 100%; background: var(--green); border-radius: 4px; transition: width .3s; }
.mini-progress-fill.full { background: var(--green); }

.cl-head { display: flex; align-items: flex-start; gap: 12px; padding: 10px 18px; background: var(--surface); border-bottom: 1px solid var(--border); }
.cl-back { margin-top: 4px; }
.cl-head-main { flex: 1; min-width: 0; }
.cl-title-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cl-title-row h2 { font-family: var(--head); text-transform: uppercase; letter-spacing: 1px; font-size: 18px; color: var(--navy); overflow: hidden; text-overflow: ellipsis; }
.cl-sub { color: var(--muted); font-size: 12px; margin-top: 2px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.cl-participants { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-top: 6px; }
.pchip { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; background: var(--surface2); border: 1px solid var(--border); border-radius: 20px; padding: 2px 8px 2px 3px; color: var(--text); }
.pchip .mini-av, .pchip img { width: 16px; height: 16px; border-radius: 50%; object-fit: cover; display: inline-flex; align-items: center; justify-content: center; background: var(--navy); color: #fff; font-size: 8px; font-weight: 700; }
.pchip small { color: var(--muted); font-size: 10px; }
.pchip.all { background: var(--surface3); }
.pchip.add { cursor: pointer; border-style: dashed; color: var(--navy); padding: 2px 8px; }
.pchip.add:hover { border-color: var(--navy3); }
.cl-progress { display: flex; align-items: center; gap: 10px; margin-top: 6px; max-width: 420px; }
.cl-progress-bar { flex: 1; height: 8px; background: var(--surface3); border-radius: 5px; overflow: hidden; }
.cl-progress-fill { height: 100%; background: var(--green); border-radius: 5px; transition: width .3s; }
.cl-progress-txt { font-family: var(--mono); font-size: 12px; color: var(--text2); white-space: nowrap; }
.cl-head-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.cl-toolbar { display: flex; align-items: center; gap: 10px; padding: 8px 18px; background: var(--surface2); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.cl-body { flex: 1; display: flex; min-height: 0; }
.cl-tree-wrap { flex: 1; overflow-y: auto; padding: 14px 18px 60px; min-width: 0; -webkit-overflow-scrolling: touch; }

.phase-block { margin-bottom: 18px; }
.phase-head { display: flex; align-items: center; gap: 10px; font-family: var(--head); text-transform: uppercase; letter-spacing: 1.5px; font-size: 13px; color: var(--navy); margin: 6px 0 8px; padding-bottom: 4px; border-bottom: 2px solid var(--border); }
.phase-head .phase-count { font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: 0; text-transform: none; }
.phase-head .btn { margin-left: auto; }

.tree { display: flex; flex-direction: column; gap: 4px; }
.tree-node { }
.tree-row { display: flex; align-items: flex-start; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 7px 10px; cursor: pointer; transition: border-color .12s, background .12s; position: relative; }
.tree-row:hover { border-color: var(--border2); }
.tree-row.selected { border-color: var(--navy3); box-shadow: 0 0 0 2px rgba(47,68,128,.18); }
.tree-row.done { background: var(--green-bg); border-color: var(--green-bd); }
.tree-row.done .tree-title { text-decoration: line-through; color: var(--muted); }
.tree-row.late { border-left: 4px solid var(--red); }
.tree-row.dragging { opacity: .45; }
.tree-row.drop-before { box-shadow: 0 -3px 0 0 var(--orange2); }
.tree-row.drop-after { box-shadow: 0 3px 0 0 var(--orange2); }
.tree-row.drop-inside { background: var(--orange-bg); border-color: var(--orange-bd); }
.tree-row.kind-group { background: var(--surface2); }
.tree-row.kind-group.done { background: var(--green-bg); }
.tree-children { margin-left: 26px; margin-top: 4px; display: flex; flex-direction: column; gap: 4px; border-left: 2px solid var(--border); padding-left: 8px; }
.tree-node.collapsed > .tree-children { display: none; }
.tree-toggle { width: 20px; height: 20px; border: none; background: none; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; flex: 0 0 auto; margin-top: 1px; transition: transform .15s; }
.tree-toggle.no-kids { visibility: hidden; }
.tree-node.collapsed > .tree-row .tree-toggle { transform: rotate(-90deg); }
.tree-check { width: 22px; height: 22px; border: 2px solid var(--border2); border-radius: 6px; background: #fff; cursor: pointer; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 14px; transition: background .12s, border-color .12s; margin-top: 0; }
.tree-check.checked { background: var(--green); border-color: var(--green); }
.tree-check.partial { background: #fff; border-color: var(--green); color: var(--green); }
.tree-check:disabled, .tree-check.locked { opacity: .45; cursor: default; }
.tree-main { flex: 1; min-width: 0; }
.tree-title { font-weight: 600; font-size: 13.5px; color: var(--text); overflow-wrap: anywhere; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tree-title .kind-ico { color: var(--muted); font-size: 13px; }
.tree-meta { display: flex; flex-wrap: wrap; gap: 4px 8px; margin-top: 3px; font-size: 11px; color: var(--muted); align-items: center; }
.tree-meta .tag { font-size: 10px; padding: 1px 7px; }
.tree-meta .who { display: inline-flex; align-items: center; gap: 4px; }
.tree-meta .who img, .tree-meta .who .mini-av { width: 16px; height: 16px; border-radius: 50%; object-fit: cover; display: inline-flex; align-items: center; justify-content: center; background: var(--navy); color: #fff; font-size: 8px; font-weight: 700; }
.tree-handle { color: var(--faint); cursor: grab; font-size: 14px; flex: 0 0 auto; margin-top: 3px; touch-action: none; }
.tree-handle:active { cursor: grabbing; }
.tree-add-row { display: flex; gap: 6px; margin-left: 26px; margin-top: 2px; }
.tree-add-btn { width: 100%; padding: 8px; border: 1.5px dashed var(--border2); background: none; border-radius: 8px; color: var(--muted); cursor: pointer; font: inherit; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.tree-add-btn:hover { border-color: var(--navy3); color: var(--navy); }
.tree-template .tree-check { display: none; }

.item-panel { width: var(--panel-w); flex: 0 0 auto; background: var(--surface); border-left: 1px solid var(--border); overflow-y: auto; padding: 14px 16px 40px; -webkit-overflow-scrolling: touch; }
.ip-head { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 10px; }
.ip-head .tag { margin-top: 3px; }
.ip-close { margin-left: auto; }
.ip-title { font-family: var(--head); text-transform: uppercase; letter-spacing: .5px; font-size: 16px; color: var(--navy); border: none; background: none; width: 100%; padding: 4px 0; font-weight: 700; border-bottom: 2px solid transparent; }
.ip-title:focus { outline: none; border-bottom-color: var(--navy3); }
.ip-title:disabled { color: var(--navy); }
.ip-status { display: flex; align-items: center; gap: 10px; background: var(--surface2); border: 1px solid var(--border); border-radius: 9px; padding: 8px 10px; margin-bottom: 12px; font-size: 12px; color: var(--text2); flex-wrap: wrap; }
.ip-status.done { background: var(--green-bg); border-color: var(--green-bd); color: var(--green); }
.ip-status .btn { margin-left: auto; }
.ip-move { display: flex; gap: 4px; flex-wrap: wrap; margin: 6px 0 12px; }
.ip-section { margin-top: 14px; }
.ip-section-title { font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--text2); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.ip-section-title .muted { font-weight: 400; text-transform: none; letter-spacing: 0; }
.vehicle-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; }
.vehicle-grid .field { margin-bottom: 0; }
.vehicle-grid .span2 { grid-column: 1 / -1; }

.lines-editor { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
.line-row { display: grid; grid-template-columns: 1fr 64px 64px 28px; gap: 6px; align-items: center; }
.line-row.head { font-size: 10px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); }
.line-row .field-input { padding: 6px 8px; }
.line-row.ok .line-present { border-color: var(--green-bd); background: var(--green-bg); }
.line-row.short .line-present { border-color: var(--red-bd); background: var(--red-bg); }
.line-row.tpl { grid-template-columns: 1fr 70px 28px; }
.line-checked { font-size: 10px; color: var(--muted); grid-column: 1 / -1; margin: -2px 0 2px 2px; }
.crate-summary { display: flex; align-items: center; gap: 10px; font-size: 12px; margin-bottom: 8px; color: var(--text2); flex-wrap: wrap; }

.notes { display: flex; flex-direction: column; gap: 6px; }
.note { background: var(--surface2); border: 1px solid var(--border); border-radius: 9px; padding: 8px 10px; font-size: 12.5px; }
.note.mine { background: var(--blue-bg); border-color: var(--blue-bd); }
.note-head { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); margin-bottom: 3px; flex-wrap: wrap; }
.note-head strong { color: var(--text2); }
.note-head .note-actions { margin-left: auto; display: flex; gap: 2px; }
.note-text { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); line-height: 1.45; }
.note.sys { background: none; border: none; padding: 2px 4px; font-size: 11px; color: var(--muted); display: flex; gap: 6px; align-items: baseline; }
.note.sys .note-time { font-family: var(--mono); font-size: 10px; white-space: nowrap; }
.note-form { display: flex; gap: 6px; margin-top: 8px; align-items: flex-end; }
.note-form textarea { flex: 1; min-height: 44px; }
.history-toggle { background: none; border: none; color: var(--blue); font: inherit; font-size: 12px; cursor: pointer; padding: 4px 0; text-decoration: underline; }

.tasks-list { display: flex; flex-direction: column; gap: 6px; max-width: 900px; }
.task-group-head { font-family: var(--head); text-transform: uppercase; letter-spacing: 1.5px; font-size: 12px; color: var(--navy); margin: 14px 0 4px; padding-bottom: 4px; border-bottom: 2px solid var(--border); }
.task-row { display: flex; align-items: flex-start; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 8px 12px; cursor: pointer; }
.task-row.done { background: var(--green-bg); border-color: var(--green-bd); }
.task-row.done .task-title { text-decoration: line-through; color: var(--muted); }
.task-row.late { border-left: 4px solid var(--red); }
.task-main { flex: 1; min-width: 0; }
.task-title { font-weight: 600; font-size: 13.5px; }
.task-sub { font-size: 11px; color: var(--muted); margin-top: 2px; display: flex; gap: 4px 10px; flex-wrap: wrap; }
.task-sub .tag { font-size: 10px; padding: 1px 7px; }

.agenda-list { display: flex; flex-direction: column; gap: 4px; max-width: 900px; }
.agenda-day { display: grid; grid-template-columns: 120px 1fr; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.agenda-day.today .agenda-date { color: var(--orange); }
.agenda-date { font-family: var(--head); font-size: 14px; color: var(--navy); text-transform: uppercase; letter-spacing: .5px; }
.agenda-date small { display: block; font-family: var(--sans); font-size: 11px; color: var(--muted); text-transform: none; letter-spacing: 0; }
.agenda-items { display: flex; flex-direction: column; gap: 4px; }
.agenda-range { font-family: var(--mono); font-size: 12px; color: var(--text2); white-space: nowrap; }
.agenda-select { width: auto; padding: 6px 8px; }

.kind-pick { display: flex; gap: 6px; flex-wrap: wrap; }
.kind-btn { font: inherit; font-size: 12px; font-weight: 600; padding: 7px 12px; border: 1.5px solid var(--border); border-radius: 8px; background: var(--surface2); color: var(--text2); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.kind-btn.active { border-color: var(--navy3); background: var(--blue-bg); color: var(--navy); }

.overlay { position: fixed; inset: 0; z-index: 500; background: rgba(15,23,41,.55); display: none; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }
.overlay.open { display: flex; }
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 480px; box-shadow: 0 20px 70px rgba(0,0,0,.4); animation: modalIn .2s ease; }
@keyframes modalIn { from { opacity: 0; transform: translateY(-10px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; background: var(--navy); color: #fff; border-radius: 14px 14px 0 0; }
.modal-head h3 { font-family: var(--head); text-transform: uppercase; letter-spacing: 1px; font-size: 15px; }
.modal-close { background: none; border: none; color: rgba(255,255,255,.7); font-size: 18px; cursor: pointer; }
.modal-close:hover { color: #fff; }
.modal-body { padding: 18px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 18px; border-top: 1px solid var(--border); }
.modal-note { background: var(--blue-bg); border: 1px solid var(--blue-bd); color: var(--blue); border-radius: 8px; padding: 8px 12px; font-size: 12px; margin: 10px 0 4px; line-height: 1.45; }
.confirm-body { line-height: 1.6; }

.share-vis { display: flex; flex-direction: column; gap: 6px; }
.share-radio { display: flex; align-items: flex-start; gap: 10px; padding: 9px 12px; border: 1.5px solid var(--border); border-radius: 8px; cursor: pointer; }
.share-radio:hover { border-color: var(--navy3); }
.share-radio input { margin-top: 3px; }
.share-radio-txt { display: flex; flex-direction: column; gap: 2px; }
.share-radio-txt strong { color: var(--text); font-size: 13px; }
.share-radio-txt small { color: var(--muted); font-size: 12px; }
.share-search-wrap { position: relative; margin-bottom: 8px; }
.share-results { margin-top: 6px; display: flex; flex-direction: column; gap: 4px; }
.share-result { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface2); flex-wrap: wrap; }
.share-result-empty { color: var(--muted); font-size: 12px; padding: 6px 2px; }
.share-list { display: flex; flex-direction: column; }
.share-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 6px; border-bottom: 1px solid var(--border); }
.share-row-info { min-width: 0; }
.share-row-name { font-size: 13px; font-weight: 600; color: var(--text); }
.share-row-sub { font-size: 12px; color: var(--muted); }
.share-row-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.share-role { width: auto; padding: 5px 8px; }

.startup-choice { display: flex; flex-direction: column; gap: 8px; }
.startup-btn { display: flex; align-items: center; gap: 12px; text-align: left; font: inherit; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 10px; background: var(--surface2); cursor: pointer; color: var(--text); }
.startup-btn:hover { border-color: var(--navy3); background: var(--blue-bg); }
.startup-btn.danger:hover { border-color: var(--red-bd); background: var(--red-bg); color: var(--red); }
.startup-btn-icon { font-size: 22px; color: var(--navy); flex: 0 0 auto; }
.startup-btn-icon .ico, .startup-btn-icon .ic { width: 22px; height: 22px; }
.startup-btn > span:last-child { font-weight: 700; font-size: 13px; }
.startup-btn-sub { display: block; font-weight: 400; font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.account-photo-row { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.account-avatar { width: 76px; height: 76px; border-radius: 50%; flex: 0 0 auto; background: var(--navy); color: #fff; font-family: var(--head); font-weight: 700; font-size: 28px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.account-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.account-central-hint { font-size: 12px; line-height: 1.5; margin: 0; }
.account-info { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 2px 14px; margin-bottom: 14px; }
.account-info-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.account-info-row:last-child { border-bottom: none; }
.account-info-label { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; }
.account-info-value { font-size: 13px; font-weight: 600; color: var(--text); word-break: break-word; text-align: right; }

#toast-container { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 900; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 13px; box-shadow: var(--shadow-md); animation: toastIn .2s ease; max-width: 90vw; text-align: center; pointer-events: auto; }
.toast.err { background: var(--red); }
.toast.ok { background: var(--green); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.print-root { display: none; }

@media print {
    @page { size: A4; margin: 14mm 12mm; }
    html, body { height: auto; overflow: visible; background: #fff; }
    #screen-app, #screen-auth, #toast-container, .overlay, #boot-splash { display: none !important; }
    .print-root { display: block; font-family: "Segoe UI", Arial, sans-serif; color: #000; font-size: 11pt; }
    .pr-head { border-bottom: 2px solid #000; padding-bottom: 6px; margin-bottom: 10px; }
    .pr-head h1 { font-size: 18pt; margin: 0; }
    .pr-head .pr-meta { font-size: 9.5pt; color: #333; display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 4px; }
    .pr-phase { font-size: 13pt; font-weight: 700; margin: 14px 0 6px; padding-bottom: 3px; border-bottom: 1px solid #000; text-transform: uppercase; letter-spacing: 1px; page-break-after: avoid; }
    .pr-row { display: flex; gap: 8px; align-items: flex-start; padding: 3px 0; border-bottom: 1px solid #ddd; page-break-inside: avoid; }
    .pr-box { width: 12px; height: 12px; border: 1.5px solid #000; border-radius: 2px; flex: 0 0 auto; margin-top: 3px; text-align: center; font-size: 9px; line-height: 10px; }
    .pr-box.on { background: #000; color: #fff; }
    .pr-main { flex: 1; min-width: 0; }
    .pr-title { font-weight: 600; }
    .pr-title.done { text-decoration: line-through; color: #555; }
    .pr-sub { font-size: 9pt; color: #444; }
    .pr-notes { font-size: 9pt; color: #333; margin: 2px 0 0 4px; border-left: 2px solid #bbb; padding-left: 6px; }
    .pr-notes div { margin: 1px 0; }
    .pr-table { width: 100%; border-collapse: collapse; font-size: 9.5pt; margin: 4px 0 10px; }
    .pr-table th, .pr-table td { border: 1px solid #999; padding: 3px 5px; text-align: left; vertical-align: top; }
    .pr-table th { background: #eee; }
    .pr-foot { margin-top: 14px; font-size: 8.5pt; color: #666; border-top: 1px solid #ccc; padding-top: 4px; }
}

@media (max-width: 900px) {
    :root { --panel-w: 340px; }
}

@media (max-width: 820px) {
    #topbar { gap: 6px; padding-right: 8px; }
    .tb-brandwrap { width: auto; padding-left: 10px; }
    .tb-btn-txt, #app-user { display: none !important; }
    .tb-toolbox-btn { display: none; }
    .account-chip-tb { padding: 4px 5px; margin-left: 6px; }
    #nav { top: auto; bottom: 0; left: 0; right: 0; width: auto; height: calc(58px + env(safe-area-inset-bottom, 0px)); padding: 0 4px env(safe-area-inset-bottom, 0px); flex-direction: row; overflow-x: auto; overflow-y: hidden; align-items: stretch; scrollbar-width: none; }
    #nav::-webkit-scrollbar { display: none; }
    .nav-item { width: auto; min-width: 62px; padding: 6px 6px; gap: 2px; flex: 1; }
    .nav-item.active::before { left: 0; right: 0; top: auto; bottom: 0; width: auto; height: 3px; }
    .nav-icon { font-size: 18px; }
    .nav-label { font-size: 8px; letter-spacing: .6px; }
    .nav-spacer, .nav-foot { display: none; }
    .nav-m-only { display: flex; }
    #shell { left: 0; bottom: calc(58px + env(safe-area-inset-bottom, 0px)); }
    .view-head { padding: 6px 12px; }
    .view-scroll { padding: 12px 10px 30px; }
    .cl-head { padding: 8px 10px; flex-wrap: wrap; }
    .cl-head-actions { width: 100%; justify-content: flex-start; }
    .cl-toolbar { padding: 6px 10px; gap: 6px; }
    .cl-tree-wrap { padding: 10px 10px 80px; }
    .tree-children { margin-left: 14px; padding-left: 6px; }
    .tree-add-row { margin-left: 14px; }
    .tree-handle { display: none; }
    .cl-body { position: relative; }
    .item-panel { position: absolute; inset: 0; width: auto; border-left: none; z-index: 20; }
    .agenda-day { grid-template-columns: 1fr; gap: 4px; }
    .overlay { padding: 8px; padding-top: calc(8px + env(safe-area-inset-top, 0px)); overscroll-behavior: contain; }
    .modal { max-width: 100%; margin-bottom: 24px; }
    .modal-body { padding: 14px; }
    .form-row { flex-wrap: wrap; }
    .form-row .field, .form-row .f1, .form-row .f2 { flex: 1 1 130px; }
    input, select, textarea { font-size: 16px !important; }
    .vehicle-grid { grid-template-columns: 1fr; }
    .presence-chip { width: 22px; height: 22px; font-size: 9px; }
    .cl-grid { grid-template-columns: 1fr; }
}

@media (hover: none) {
    .btn:hover { filter: none; }
    .nav-item:hover:not(.active) { color: rgba(255,255,255,.4); background: none; }
}
@media (display-mode: standalone) { html, body { overscroll-behavior-y: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
