:root {
  --bg: #f3f5f8; --surface: #ffffff; --surface-2: #f8f9fb; --border: #e3e7ed; --border-strong: #cfd6df;
  --text: #121a26; --text-2: #4f5b6b; --muted: #7b8696;
  --primary: #1f5fae; --primary-ink: #fff; --primary-soft: #e8f0fa; --accent: #d97a06;
  --side: #0f1c2e; --side-2: #172840; --side-text: #c4cedb; --side-muted: #7d8ca1;
  --good: #1a7f37; --good-soft: #e6f4ea; --warn: #a86400; --warn-soft: #fdf3e1; --bad: #c42b2b; --bad-soft: #fcebeb; --info: #1f5fae; --info-soft: #e8f0fa; --neutral-soft: #eef1f5;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
  --radius: 10px; --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08); --shadow-lg: 0 12px 32px rgba(16, 24, 40, .18);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e131b; --surface: #161d28; --surface-2: #1b2431; --border: #273243; --border-strong: #34425a;
    --text: #e8edf4; --text-2: #b3bfcf; --muted: #8592a6; --primary: #4b8fe0; --primary-soft: #1b2b44; --side: #0a0f16; --side-2: #131c29;
    --good: #4cc26e; --good-soft: #15301f; --warn: #e3a33b; --warn-soft: #33270f; --bad: #f06a6a; --bad-soft: #3a1919; --info: #6aa6ef; --info-soft: #1b2b44; --neutral-soft: #222c3a;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e131b; --surface: #161d28; --surface-2: #1b2431; --border: #273243; --border-strong: #34425a;
  --text: #e8edf4; --text-2: #b3bfcf; --muted: #8592a6; --primary: #4b8fe0; --primary-soft: #1b2b44; --side: #0a0f16; --side-2: #131c29;
  --good: #4cc26e; --good-soft: #15301f; --warn: #e3a33b; --warn-soft: #33270f; --bad: #f06a6a; --bad-soft: #3a1919; --info: #6aa6ef; --info-soft: #1b2b44; --neutral-soft: #222c3a;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767; color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; }
.muted { color: var(--muted); } .small { font-size: 12px; } .num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.hidden { display: none !important; }
.show-m { display: none !important; }
@media (max-width: 860px) { .show-m { display: inline-flex !important; } }
svg.i { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- layout */
#app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
#side { background: var(--side); color: var(--side-text); position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
#side .brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: #fff; font-weight: 700; font-size: 15px; }
#side .brand .logo { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; color: #fff; }
#side nav { padding: 4px 10px 20px; flex: 1; }
#side .grp { margin-top: 14px; }
#side .grp-t { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--side-muted); padding: 6px 10px; }
#side a.nav { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 7px; color: var(--side-text); font-size: 13.5px; }
#side a.nav:hover { background: var(--side-2); color: #fff; }
#side a.nav.on { background: #1f5fae; color: #fff; }
#side a.nav .cnt { margin-left: auto; background: #c42b2b; color: #fff; font-size: 11px; border-radius: 10px; padding: 0 7px; font-weight: 600; }
#side .me { border-top: 1px solid #22324a; padding: 12px 18px; font-size: 12.5px; }
#main { min-width: 0; display: flex; flex-direction: column; }
#top { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; padding: 10px 22px; }
#top .proj { min-width: 220px; max-width: 340px; }
#top .sp { flex: 1; }
#view { padding: 22px; max-width: 1500px; width: 100%; margin: 0 auto; }
#menuBtn { display: none; }

/* ---------- controls */
.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); padding: 7px 13px; border-radius: 8px; font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap; min-height: 36px; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--border)); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 4px 9px; min-height: 30px; font-size: 13px; }
.btn.icon { padding: 6px; min-width: 36px; justify-content: center; }
.btn:disabled { opacity: .55; cursor: default; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px; padding: 7px 10px; min-height: 36px; width: 100%; }
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--primary) 40%, transparent); outline-offset: 0; border-color: var(--primary); }
input[type=checkbox] { width: 18px; height: 18px; min-height: 0; accent-color: var(--primary); }
label.f { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
label.f .help { font-weight: 400; color: var(--muted); font-size: 11.5px; }
label.f.req > span:first-child::after { content: " *"; color: var(--bad); }
label.chk { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--text); }

/* ---------- cards & grid */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card > .hd { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--border); }
.card > .bd { padding: 16px; }
.card > .hd h3 { flex: 1; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.page-h { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-h h1 { flex: 1; min-width: 200px; }
.page-h .sub { color: var(--muted); font-size: 13px; font-weight: 400; display: block; margin-top: 2px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar input, .toolbar select { width: auto; min-width: 140px; }
.toolbar input[type=checkbox] { min-width: 0; width: 18px; }
.toolbar .search { flex: 1; min-width: 200px; max-width: 360px; }

/* ---------- KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 13px 15px; box-shadow: var(--shadow); cursor: default; }
.kpi[data-go] { cursor: pointer; } .kpi[data-go]:hover { border-color: var(--primary); }
.kpi .l { font-size: 12px; color: var(--text-2); font-weight: 550; display: flex; gap: 6px; align-items: center; }
.kpi .v { font-size: 21px; font-weight: 680; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.kpi .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.bad .v { color: var(--bad); } .kpi.warn .v { color: var(--warn); } .kpi.good .v { color: var(--good); }
.meter { height: 6px; background: var(--neutral-soft); border-radius: 4px; overflow: hidden; margin-top: 8px; position: relative; }
.meter > i { display: block; height: 100%; background: var(--s1); border-radius: 4px; }
.meter > b { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--text); }

/* ---------- table */
.tbl-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { position: sticky; top: 0; background: var(--surface-2); text-align: left; font-weight: 600; color: var(--text-2); padding: 9px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; cursor: pointer; user-select: none; font-size: 12px; z-index: 1; }
table.t th.num { text-align: right; }
table.t td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.t tbody tr { cursor: pointer; } table.t tbody tr:hover { background: var(--surface-2); }
table.t tfoot td { font-weight: 650; background: var(--surface-2); position: sticky; bottom: 0; }
table.t td.clip { min-width: 220px; max-width: 380px; overflow: hidden; text-overflow: ellipsis; }
table.t.plain tbody tr { cursor: default; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 10px 0; color: var(--muted); font-size: 12.5px; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty svg.i { width: 34px; height: 34px; margin-bottom: 8px; opacity: .6; }
.bar { display: flex; align-items: center; gap: 8px; min-width: 110px; }
.bar .meter { flex: 1; margin: 0; }

/* ---------- badges */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 20px; background: var(--neutral-soft); color: var(--text-2); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.good { background: var(--good-soft); color: var(--good); } .badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); } .badge.info { background: var(--info-soft); color: var(--info); }

/* ---------- modal & drawer */
.overlay { position: fixed; inset: 0; background: rgba(10, 16, 26, .45); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 4vh 16px; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-lg); width: 100%; max-width: 760px; display: flex; flex-direction: column; max-height: 92vh; }
.modal.wide { max-width: 1100px; }
.modal > .hd { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal > .hd h2 { flex: 1; }
.modal > .bd { padding: 18px; overflow-y: auto; }
.modal > .ft { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 12px 12px; flex-wrap: wrap; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(640px, 100%); background: var(--surface); box-shadow: var(--shadow-lg); z-index: 90; display: flex; flex-direction: column; animation: slide .18s ease-out; }
@keyframes slide { from { transform: translateX(30px); opacity: .4; } }
.drawer > .hd { display: flex; align-items: center; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.drawer > .hd h2 { flex: 1; font-size: 16px; }
.drawer > .bd { flex: 1; overflow-y: auto; padding: 16px 18px; }
dl.kv { display: grid; grid-template-columns: 190px 1fr; gap: 0; margin: 0; font-size: 13.5px; }
dl.kv dt { color: var(--muted); padding: 7px 0; border-bottom: 1px solid var(--border); }
dl.kv dd { margin: 0; padding: 7px 0; border-bottom: 1px solid var(--border); white-space: pre-wrap; word-break: break-word; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 9px 13px; color: var(--text-2); font-weight: 550; border-bottom: 2px solid transparent; white-space: nowrap; font-size: 13.5px; cursor: pointer; }
.tabs a.on { color: var(--primary); border-color: var(--primary); }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; color: var(--text-2); border-right: 1px solid var(--border); min-height: 34px; }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--primary-soft); color: var(--primary); font-weight: 600; }

/* ---------- files */
.files { display: flex; flex-wrap: wrap; gap: 8px; }
.file { position: relative; width: 92px; height: 92px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); overflow: hidden; display: flex; align-items: center; justify-content: center; flex-direction: column; font-size: 11px; color: var(--text-2); text-align: center; padding: 4px; cursor: pointer; }
.file img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.file .x { position: absolute; top: 3px; right: 3px; background: rgba(0, 0, 0, .6); color: #fff; border: 0; border-radius: 50%; width: 22px; height: 22px; cursor: pointer; z-index: 2; line-height: 1; }
.file.add { border-style: dashed; color: var(--primary); }
.file .nm { word-break: break-all; max-height: 3.6em; overflow: hidden; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.gallery figure { margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; cursor: pointer; }
.gallery img { width: 100%; height: 130px; object-fit: cover; display: block; background: var(--surface-2); }
.gallery figcaption { padding: 7px 9px; font-size: 12px; color: var(--text-2); }
.lightbox { position: fixed; inset: 0; background: rgba(0, 0, 0, .9); z-index: 200; display: flex; align-items: center; justify-content: center; }
.lightbox img { max-width: 94vw; max-height: 90vh; }

/* ---------- alerts */
.alert-item { display: flex; gap: 11px; padding: 11px 14px; border-bottom: 1px solid var(--border); align-items: flex-start; cursor: pointer; }
.alert-item:hover { background: var(--surface-2); }
.alert-item:last-child { border-bottom: 0; }
.alert-item .dot { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.alert-item.critica .dot { background: var(--bad-soft); color: var(--bad); } .alert-item.alta .dot { background: var(--bad-soft); color: var(--bad); }
.alert-item.media .dot { background: var(--warn-soft); color: var(--warn); } .alert-item.info .dot { background: var(--info-soft); color: var(--info); }
.alert-item .t { font-weight: 600; font-size: 13.5px; } .alert-item .d { color: var(--text-2); font-size: 12.5px; }

/* ---------- kanban */
.kanban { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 12px; overflow-x: auto; align-items: start; }
.kcol { background: var(--neutral-soft); border-radius: 10px; padding: 10px; min-height: 200px; }
.kcol.over { outline: 2px dashed var(--primary); }
.kcol h4 { display: flex; justify-content: space-between; font-size: 13px; padding: 2px 4px 10px; color: var(--text-2); }
.kcard { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 11px; margin-bottom: 8px; box-shadow: var(--shadow); cursor: grab; font-size: 13px; border-left: 3px solid var(--border-strong); }
.kcard.p-Urgente { border-left-color: var(--bad); } .kcard.p-Alta { border-left-color: var(--s2); } .kcard.p-Media { border-left-color: var(--s1); }
.kcard .tt { font-weight: 600; margin-bottom: 5px; }
.kcard .meta > span.tx { flex: 1; min-width: 0; }
.kcard .meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 12px; }
.kcard.dragging { opacity: .5; }

/* ---------- calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.cal .dh { background: var(--surface-2); padding: 7px; font-size: 12px; font-weight: 600; color: var(--text-2); text-align: center; border-bottom: 1px solid var(--border); }
.cal .day { min-height: 112px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 5px; font-size: 12px; overflow: hidden; }
.cal .day:nth-child(7n) { border-right: 0; }
.cal .day.out { background: var(--surface-2); color: var(--muted); }
.cal .day.today .dn { background: var(--primary); color: #fff; border-radius: 50%; }
.cal .dn { display: inline-grid; place-items: center; width: 22px; height: 22px; font-weight: 600; margin-bottom: 3px; }
.cal .ev { display: block; padding: 1px 6px; border-radius: 4px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; font-size: 11.5px; color: var(--text); background: var(--neutral-soft); border-left: 3px solid var(--c, var(--s1)); }
.cal .more { color: var(--primary); cursor: pointer; font-size: 11.5px; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.legend span.off { opacity: .4; }
.legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); display: inline-block; }

/* ---------- timeline (bitácora) */
.tl-day { margin-bottom: 18px; }
.tl-day > h3 { font-size: 13px; color: var(--text-2); margin-bottom: 8px; display: flex; gap: 10px; align-items: center; position: sticky; top: 58px; background: var(--bg); padding: 4px 0; z-index: 2; }
.tl-item { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 8px; cursor: pointer; display: grid; grid-template-columns: 1fr auto; gap: 4px 14px; box-shadow: var(--shadow); }
.tl-item:hover { border-color: var(--primary); }
.tl-item .a { font-weight: 600; }
.tl-item .m { color: var(--muted); font-size: 12.5px; }
.tl-item .q { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
.tl-item .pb { grid-column: 1 / -1; color: var(--bad); font-size: 12.5px; }
.tl-item .ph { grid-column: 1 / -1; display: flex; gap: 6px; }
.tl-item .ph img { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; }

/* ---------- misc */
.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 220px; }
.toast-wrap { position: fixed; bottom: 20px; right: 20px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #142033; color: #fff; padding: 11px 16px; border-radius: 9px; box-shadow: var(--shadow-lg); font-size: 13.5px; max-width: 380px; animation: slide .2s; }
.toast.err { background: #a42121; }
#map, .map { height: 380px; border-radius: var(--radius); border: 1px solid var(--border); z-index: 0; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(135deg, #0f1c2e, #1f3a5f); }
.login .card { width: 100%; max-width: 400px; padding: 28px; }
.login h1 { margin-bottom: 4px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pcard { padding: 16px; cursor: pointer; transition: border-color .15s; }
.pcard:hover { border-color: var(--primary); }
.pcard .nm { font-weight: 650; font-size: 15px; }
.pcard .two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; font-size: 12.5px; }
.pcard .two b { display: block; font-size: 14px; font-variant-numeric: tabular-nums; }
.fab { display: none; }
#bottom { display: none; }
.sheet-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.sheet-list button { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); font: inherit; font-weight: 600; color: var(--text); cursor: pointer; }
.sheet-list button svg.i { width: 26px; height: 26px; color: var(--primary); }
.sheet-list button:hover { border-color: var(--primary); }
.att-row { display: grid; grid-template-columns: 1fr auto 80px; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.att-row .seg button { padding: 6px 9px; }
.hist { font-size: 12.5px; border-left: 2px solid var(--border); padding-left: 12px; }
.hist div { margin-bottom: 9px; }
.section-t { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; margin: 20px 0 10px; }

/* ---------- responsive */
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .hide-m { display: none !important; }
  .toolbar.collapsible:not(.open) > :not(.search):not([data-filt]):not(.btn) { display: none; }
  .toolbar.collapsible .search { flex: 1; }
  #app { grid-template-columns: 1fr; }
  #side { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; z-index: 150; transform: translateX(-100%); transition: transform .2s; }
  #side.open { transform: none; box-shadow: var(--shadow-lg); }
  #menuBtn { display: inline-flex; }
  #top { padding: 8px 12px; gap: 6px; }
  #top .proj { min-width: 0; flex: 1; max-width: none; }
  #top .hide-m { display: none; }
  #view { padding: 14px 12px 90px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; } .span2 { grid-column: auto; }
  .form-grid { grid-template-columns: 1fr; }
  .overlay { padding: 0; }
  .modal { max-width: none; min-height: 100%; max-height: none; border-radius: 0; }
  .modal > .ft { position: sticky; bottom: 0; border-radius: 0; }
  dl.kv { grid-template-columns: 1fr; } dl.kv dt { border: 0; padding-bottom: 0; font-size: 12px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: 10px 12px; } .kpi .v { font-size: 17px; }
  .toolbar .search { max-width: none; }
  table.t.cards thead { display: none; }
  table.t.cards, table.t.cards tbody, table.t.cards tr, table.t.cards td { display: block; width: 100%; }
  table.t.cards tr { border-bottom: 1px solid var(--border); padding: 8px 4px; }
  table.t.cards td { border: 0; padding: 2px 8px; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  table.t.cards td::before { content: attr(data-l); color: var(--muted); font-size: 12px; text-align: left; flex: none; max-width: 45%; }
  table.t.cards td.clip { max-width: none; }
  table.t.cards tfoot { display: block; } table.t.cards tfoot tr { display: flex; flex-wrap: wrap; } table.t.cards tfoot td:empty { display: none; }
  .cal .day { min-height: 64px; padding: 3px; } .cal .ev { font-size: 10px; padding: 0 3px; }
  .chart-box { height: 240px; }
  #bottom { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface); border-top: 1px solid var(--border); z-index: 40; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
  #bottom a { flex: 1; display: flex; flex-direction: column; align-items: center; font-size: 10.5px; color: var(--text-2); padding: 4px 0; gap: 2px; }
  #bottom a.on { color: var(--primary); }
  #bottom a.plus svg.i { background: var(--primary); color: #fff; border-radius: 50%; width: 40px; height: 40px; padding: 9px; margin-top: -16px; box-shadow: var(--shadow-lg); }
  .drawer { width: 100%; }
  .toast-wrap { bottom: 80px; left: 12px; right: 12px; }
  .kanban { grid-template-columns: repeat(4, 82vw); }
}
@media print {
  #side, #top, #bottom, .toolbar, .btn { display: none !important; }
  #app { display: block; } #view { padding: 0; }
}
