/* Fraktal Books — one stylesheet, no build step. */
:root {
  --bg: #f5f6f8; --surface: #fff; --border: #e4e7ec; --border-strong: #cfd4dc;
  --text: #111827; --text-2: #4b5563; --muted: #6b7280; --faint: #9ca3af;
  --accent: #1d4ed8; --accent-hover: #1e40af; --accent-soft: #e8efff;
  --sidebar: #0f172a; --sidebar-text: #cbd5e1; --sidebar-active: rgba(255,255,255,.09);
  --success: #15803d; --success-bg: #dcfce7; --danger: #b91c1c; --danger-bg: #fee2e2;
  --warning: #b45309; --warning-bg: #fef3c7; --info: #1d4ed8; --info-bg: #dbeafe;
  --neutral: #374151; --neutral-bg: #eef0f3;
  --radius: 10px; --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.06);
  --shadow-lg: 0 10px 30px rgba(16,24,40,.12);
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
svg { width: 1.1em; height: 1.1em; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.18em; }
code, .mono { font-family: var(--mono); font-size: .92em; }
.muted { color: var(--muted); } .small { font-size: .86rem; } .tiny { font-size: .78rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pos { color: var(--success); } .neg { color: var(--danger); }
.nowrap { white-space: nowrap; } .right { text-align: right; } .center { text-align: center; }
.mt { margin-top: 1rem; } .mt-2 { margin-top: 2rem; } .mb { margin-bottom: 1rem; } .mb-0 { margin-bottom: 0; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; } .row.end { justify-content: flex-end; }
.grow { flex: 1; } .hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

/* Layout */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar { background: var(--sidebar); color: var(--sidebar-text); padding: 1.1rem .9rem; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: .6rem; color: #fff; font-size: 1.05rem; padding: .3rem .5rem 1.2rem; text-decoration: none !important; }
.brand b { font-weight: 700; }
.brand-mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 800; font-size: 1rem; }
.brand.big { color: var(--text); font-size: 1.3rem; justify-content: center; padding-bottom: 1.4rem; }
.sidebar nav, .sidebar-foot { display: flex; flex-direction: column; gap: 2px; }
.sidebar-foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,.08); padding-top: .6rem; }
.sidebar a, .sidebar .linklike { display: flex; align-items: center; gap: .65rem; padding: .55rem .7rem; border-radius: 8px; color: var(--sidebar-text); font-weight: 500; font-size: .95rem; text-decoration: none !important; background: none; border: 0; width: 100%; cursor: pointer; font-family: inherit; text-align: left; }
.sidebar a:hover, .sidebar .linklike:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar a.active { background: var(--sidebar-active); color: #fff; }
.sidebar svg { width: 1.2rem; height: 1.2rem; opacity: .85; }
.sidebar .count { margin-left: auto; background: #f59e0b; color: #111; font-size: .72rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
.main { padding: 1.6rem 2rem 3rem; max-width: 1280px; width: 100%; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.4rem; }
.page-head .sub { color: var(--muted); margin-top: .25rem; }
.page-actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.crumbs { font-size: .86rem; color: var(--muted); margin-bottom: .3rem; }
.crumbs a { color: var(--muted); }
.crumbs span::before { content: "/"; margin: 0 .45rem; color: var(--faint); }

/* Cards & grids */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 1.2rem 1.3rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .9rem 1.3rem; border-bottom: 1px solid var(--border); }
.card-head h2, .card-head h3 { font-size: 1rem; }
.card-body { padding: 1.1rem 1.3rem; }
.card-foot { padding: .8rem 1.3rem; border-top: 1px solid var(--border); background: #fafbfc; border-radius: 0 0 var(--radius) var(--radius); }
.grid { display: grid; gap: 1rem; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.side { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); align-items: start; }
.stack { display: flex; flex-direction: column; gap: 1rem; }

/* Stat tiles */
.stat { padding: 1rem 1.2rem; }
.stat .label { color: var(--muted); font-size: .82rem; font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 1.55rem; font-weight: 650; letter-spacing: -.02em; margin: .15rem 0 .1rem; font-variant-numeric: tabular-nums; }
.stat .value small { font-size: .95rem; color: var(--muted); font-weight: 500; margin-right: .3rem; }
.stat .sub { font-size: .84rem; color: var(--muted); }
.stat .sub a { color: inherit; text-decoration: underline; text-decoration-color: var(--border-strong); }
.stat.warn .value { color: var(--danger); }

/* Tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th, .table td { padding: .7rem .9rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.table th { font-size: .76rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; background: #fafbfc; white-space: nowrap; }
.table tbody tr:hover { background: #fafbfd; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.row-link { cursor: pointer; }
.table td.actions { text-align: right; white-space: nowrap; }
.table .primary-cell a { font-weight: 600; color: var(--text); }
.table tfoot td { font-weight: 650; background: #fafbfc; border-top: 2px solid var(--border); }
.table.compact th, .table.compact td { padding: .45rem .7rem; }
.table .sub { display: block; color: var(--muted); font-size: .82rem; font-weight: 400; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .55rem; border-radius: 999px; font-size: .76rem; font-weight: 600; white-space: nowrap; line-height: 1.5; text-decoration: none !important; }
.badge.success { background: var(--success-bg); color: var(--success); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.warning { background: var(--warning-bg); color: var(--warning); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.neutral { background: var(--neutral-bg); color: var(--neutral); }
.badge.muted { background: var(--neutral-bg); color: var(--muted); text-decoration: line-through; }
.badge.outline { background: transparent; border: 1px solid var(--border-strong); color: var(--text-2); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); margin-right: .4rem; }
.dot.success { background: var(--success); } .dot.danger { background: var(--danger); } .dot.warning { background: #f59e0b; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: .45rem; padding: .5rem .95rem; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 550; font-size: .92rem; cursor: pointer; text-decoration: none !important; line-height: 1.3; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: #f3f4f6; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.success { background: var(--success); border-color: var(--success); color: #fff; }
.btn.success:hover { background: #166534; }
.btn.danger { color: var(--danger); border-color: #f1b4b4; }
.btn.danger:hover { background: var(--danger-bg); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: #eef0f3; color: var(--text); }
.btn.sm { padding: .3rem .65rem; font-size: .84rem; }
.btn.xs { padding: .15rem .5rem; font-size: .78rem; }
.btn.block { width: 100%; justify-content: center; }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; }
.btn svg { width: 1em; height: 1em; }
.btn-group { display: inline-flex; gap: .4rem; flex-wrap: wrap; }
button.linklike { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; }
button.linklike:hover { text-decoration: underline; }

/* Dropdown menu */
.menu { position: relative; display: inline-block; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-items { position: absolute; right: 0; top: calc(100% + 4px); min-width: 200px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); padding: .3rem; z-index: 30; display: flex; flex-direction: column; }
.menu-items a, .menu-items button { display: block; width: 100%; text-align: left; padding: .5rem .7rem; border-radius: 6px; color: var(--text); background: none; border: 0; font: inherit; font-size: .9rem; cursor: pointer; text-decoration: none !important; }
.menu-items a:hover, .menu-items button:hover { background: #f3f4f6; }
.menu-items .danger { color: var(--danger); }
.menu-items hr { border: 0; border-top: 1px solid var(--border); margin: .3rem 0; }

/* Filters / tabs */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; flex-wrap: wrap; }
.tabs a { padding: .55rem .9rem; color: var(--muted); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: .92rem; text-decoration: none !important; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }
.tabs .n { color: var(--faint); margin-left: .3rem; font-weight: 500; }
.filters { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.filters input[type=search], .filters input[type=text], .filters select { height: 36px; }
.search { position: relative; }
.search svg { position: absolute; left: .6rem; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search input { padding-left: 2rem !important; }

/* Forms */
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: .5rem .65rem; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--accent); }
input[type=file] { padding: .4rem; }
textarea { min-height: 84px; resize: vertical; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .55rem center; background-size: 1rem; padding-right: 2rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem 1.2rem; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.field label { font-size: .86rem; font-weight: 600; color: var(--text-2); }
.field .req { color: var(--danger); margin-left: 2px; }
.field .help { color: var(--muted); font-size: .8rem; }
.field .error, small.error { color: var(--danger); font-size: .8rem; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }
.field.span-2 { grid-column: span 2; } .field.span-3 { grid-column: span 3; } .field.span-all { grid-column: 1 / -1; }
label.check { display: flex; align-items: center; gap: .5rem; font-weight: 500 !important; color: var(--text) !important; cursor: pointer; }
.form-actions { display: flex; gap: .6rem; align-items: center; margin-top: 1.4rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.form-actions .spacer { flex: 1; }
.errorlist { color: var(--danger); font-size: .86rem; margin: 0 0 1rem; padding-left: 1.1rem; }
.inline-form { display: inline; }
.fieldset-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; margin: 1.4rem 0 .7rem; padding-bottom: .4rem; border-bottom: 1px solid var(--border); }
.fieldset-title:first-child { margin-top: 0; }

/* Definition lists */
.dl { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.2rem; font-size: .93rem; margin: 0; }
.dl dt { color: var(--muted); } .dl dd { margin: 0; }

/* Flash messages */
.flashes { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1rem; }
.flash { padding: .7rem 1rem; border-radius: var(--radius-sm); border: 1px solid; display: flex; justify-content: space-between; align-items: center; gap: 1rem; font-size: .93rem; }
.flash.success { background: var(--success-bg); border-color: #a7f3c0; color: #14532d; }
.flash.error { background: var(--danger-bg); border-color: #fca5a5; color: #7f1d1d; }
.flash.warning { background: var(--warning-bg); border-color: #fcd34d; color: #78350f; }
.flash.info { background: var(--info-bg); border-color: #93c5fd; color: #1e3a8a; }
.flash-close { background: none; border: 0; font-size: 1.2rem; cursor: pointer; color: inherit; opacity: .6; }

/* Empty states */
.empty { text-align: center; padding: 3rem 1.5rem; color: var(--muted); }
.empty h3 { color: var(--text); margin-bottom: .3rem; }
.empty-icon { width: 2.4rem; height: 2.4rem; color: var(--faint); margin-bottom: .6rem; }
.empty .btn { margin-top: .8rem; }

/* Callouts */
.callout { padding: .85rem 1rem; border-radius: var(--radius-sm); border: 1px solid var(--border); background: #fafbfc; font-size: .92rem; display: flex; gap: .6rem; align-items: flex-start; }
.callout.warning { background: var(--warning-bg); border-color: #fcd34d; color: #78350f; }
.callout.danger { background: var(--danger-bg); border-color: #fca5a5; color: #7f1d1d; }
.callout.info { background: var(--info-bg); border-color: #bfdbfe; color: #1e3a8a; }
.callout.success { background: var(--success-bg); border-color: #a7f3c0; color: #14532d; }
.callout svg { flex: none; margin-top: .15rem; }

/* To-do list on Home */
.todo { display: flex; flex-direction: column; }
.todo a { display: flex; align-items: center; gap: .8rem; padding: .75rem 1.3rem; border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none !important; }
.todo a:last-child { border-bottom: 0; }
.todo a:hover { background: #fafbfd; }
.todo .n { min-width: 2.2rem; height: 2.2rem; border-radius: 8px; display: grid; place-items: center; font-weight: 700; background: var(--neutral-bg); color: var(--neutral); }
.todo .n.warning { background: var(--warning-bg); color: var(--warning); }
.todo .n.danger { background: var(--danger-bg); color: var(--danger); }
.todo .n.info { background: var(--info-bg); color: var(--info); }
.todo .t { flex: 1; } .todo .t small { display: block; color: var(--muted); }
.todo svg.chev { color: var(--faint); }

/* Review split (bill review) */
.split { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(380px, .9fr); gap: 1.2rem; align-items: start; }
.doc-view { position: sticky; top: 1rem; height: calc(100vh - 2rem); background: #e9ebee; border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.doc-view iframe, .doc-view img { width: 100%; height: 100%; border: 0; object-fit: contain; background: #fff; }
.doc-view img { object-fit: contain; height: auto; max-height: 100%; }
.extract-note { font-size: .84rem; color: var(--text-2); }

/* Reconcile */
.recon { display: flex; flex-direction: column; gap: .7rem; }
.line-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 1rem; padding: .95rem 1.2rem; align-items: center; }
.line-card .when { font-size: .82rem; color: var(--muted); }
.line-card .desc { font-weight: 600; margin: .1rem 0; }
.line-card .meta { font-size: .82rem; color: var(--muted); }
.line-card .amt { font-size: 1.15rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.suggest { display: flex; align-items: center; gap: .8rem; justify-content: space-between; background: #f8fafc; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); padding: .65rem .85rem; }
.suggest.strong { background: #f0fdf4; border-color: #86efac; border-style: solid; }
.suggest .what { font-size: .9rem; } .suggest .what b { font-weight: 600; }
.suggest .why { display: block; font-size: .78rem; color: var(--muted); }
.suggest .act { display: flex; gap: .4rem; flex: none; }
.choices { display: flex; flex-direction: column; gap: .35rem; }
.choice { display: flex; justify-content: space-between; align-items: center; gap: .8rem; padding: .55rem .75rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); font-size: .9rem; }
.choice:hover { border-color: var(--accent); }
.choice .amt { font-weight: 600; font-variant-numeric: tabular-nums; }

/* Line editor */
.lines-table th, .lines-table td { padding: .4rem .45rem; }
.lines-table input, .lines-table select { padding: .4rem .5rem; }
.lines-table .drag { color: var(--faint); cursor: grab; }
.totals { margin-left: auto; width: 320px; font-size: .95rem; }
.totals div { display: flex; justify-content: space-between; padding: .3rem 0; }
.totals .grand { border-top: 1px solid var(--border); font-weight: 700; font-size: 1.05rem; padding-top: .5rem; margin-top: .3rem; }
.totals .aed { color: var(--muted); font-size: .86rem; }

/* Timesheet calendar */
.cal { display: inline-grid; grid-template-columns: repeat(7, 2.2rem); gap: 3px; }
.cal .h { font-size: .7rem; text-transform: uppercase; color: var(--muted); text-align: center; }
.cal .d { width: 2.2rem; height: 2.2rem; border-radius: 6px; border: 1px solid var(--border); display: grid; place-items: center; font-size: .82rem; cursor: pointer; user-select: none; background: var(--surface); }
.cal .d.we { background: #f3f4f6; color: var(--faint); }
.cal .d.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.cal .d.off { visibility: hidden; }

/* Dropzone */
.dropzone { border: 2px dashed var(--border-strong); border-radius: var(--radius); padding: 2.4rem; text-align: center; color: var(--muted); background: #fafbfc; cursor: pointer; transition: border-color .12s, background .12s; }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input { display: none; }
.dropzone .big { font-size: 1.05rem; color: var(--text); font-weight: 600; }
.filelist { margin: .8rem 0 0; padding: 0; list-style: none; text-align: left; font-size: .9rem; }
.filelist li { padding: .3rem 0; border-bottom: 1px solid var(--border); }

/* Progress steps */
.steps { display: flex; gap: .4rem; align-items: center; font-size: .86rem; color: var(--muted); margin-bottom: 1rem; }
.steps .s { padding: .25rem .7rem; border-radius: 999px; background: var(--neutral-bg); }
.steps .s.on { background: var(--accent); color: #fff; }
.steps .s.done { background: var(--success-bg); color: var(--success); }

/* Pagination, misc */
.pagination { display: flex; justify-content: space-between; align-items: center; padding: .8rem 0; font-size: .88rem; }
.kbd { font-family: var(--mono); font-size: .8em; background: var(--neutral-bg); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--border-strong); }
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: var(--bg); padding: 1rem; }
.login { width: 100%; max-width: 380px; padding: 2rem; display: flex; flex-direction: column; gap: .9rem; }
.login label { font-size: .86rem; font-weight: 600; color: var(--text-2); display: flex; flex-direction: column; gap: .3rem; }
.timeline { list-style: none; margin: 0; padding: 0; font-size: .9rem; }
.timeline li { display: flex; gap: .7rem; padding: .45rem 0; border-bottom: 1px dashed var(--border); }
.timeline li:last-child { border-bottom: 0; }
.timeline .when { color: var(--muted); min-width: 6.5rem; }
.bar { height: 8px; background: var(--neutral-bg); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.progress-note { font-size: .82rem; color: var(--muted); }
dialog { border: 0; border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 0; max-width: 560px; width: 95%; }
dialog::backdrop { background: rgba(15,23,42,.45); }
.dialog-body { padding: 1.3rem 1.5rem; }
.dialog-head { padding: 1rem 1.5rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.htmx-request .htmx-indicator { display: inline; }
.htmx-indicator { display: none; }
.spin { width: 1rem; height: 1rem; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1000px) {
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.side { grid-template-columns: 1fr; }
  .split { grid-template-columns: 1fr; } .doc-view { position: static; height: 70vh; }
  .line-card { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: .3rem; padding: .6rem .8rem; }
  .sidebar nav, .sidebar-foot { flex-direction: row; flex-wrap: wrap; border: 0; margin: 0; padding: 0; }
  .sidebar a, .sidebar .linklike { padding: .4rem .6rem; font-size: .88rem; width: auto; }
  .brand { padding: .3rem .4rem; width: 100%; }
  .main { padding: 1rem; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4, .form-grid, .form-grid.cols-3, .form-grid.cols-4 { grid-template-columns: 1fr; }
  .field.span-2, .field.span-3 { grid-column: auto; }
  .page-head { flex-direction: column; }
}
@media print {
  .sidebar, .page-actions, .flashes, .tabs, .filters { display: none !important; }
  .app { display: block; } .main { padding: 0; max-width: none; }
  .card { box-shadow: none; }
}
