/* Qurilish 360 — UI */
:root {
  --bg: #f3f5fa;
  --card: #ffffff;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e4e8f1;
  --soft: #f7f9fc;
  --primary: #2457e6;
  --primary-soft: #e8eefe;
  --pos: #0e9f6e;
  --pos-soft: #e3f6ee;
  --neg: #dc3545;
  --neg-soft: #fdecee;
  --warn: #d97706;
  --warn-soft: #fdf3e2;
  --info: #2457e6;
  --info-soft: #e8eefe;
  --violet: #7c3aed;
  --violet-soft: #f1eafe;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 4px 16px rgba(15, 23, 42, .04);
  --sidebar: 248px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120; --card: #121a2c; --ink: #e8edf7; --ink-2: #c3cbdb; --muted: #8b97ad; --line: #222d44;
    --soft: #0f1728; --primary: #5b8cff; --primary-soft: #1a2a52; --pos: #34d399; --pos-soft: #0f2e25;
    --neg: #f87171; --neg-soft: #3a1418; --warn: #fbbf24; --warn-soft: #3a2a0c; --info: #5b8cff;
    --info-soft: #1a2a52; --violet: #a78bfa; --violet-soft: #2a1f4a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 14px/1.5 "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
.muted { color: var(--muted); }
.ic { flex: none; }
.spacer { flex: 1; }
.right { text-align: right; }
.center { text-align: center; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.warn { color: var(--warn); }
.nowrap { white-space: nowrap; }

/* Layout */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar); background: var(--card); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; flex: none; z-index: 40;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 18px 18px 14px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.logo {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-weight: 800;
  background: linear-gradient(135deg, #2457e6, #7c3aed); color: #fff; font-size: 13px; letter-spacing: -.5px;
}
.logo.big { width: 64px; height: 64px; font-size: 22px; border-radius: 16px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text small { color: var(--muted); font-size: 12px; }
.back-kala {
  display: flex; align-items: center; gap: 8px; margin: 0 10px 6px; padding: 7px 12px; border-radius: 9px;
  background: var(--soft); color: var(--muted); font-size: 13px; font-weight: 600;
}
.back-kala:hover { color: var(--ink); text-decoration: none; }
.side-nav { flex: 1; overflow-y: auto; padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; }
.side-nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 9px; color: var(--ink-2);
  font-weight: 500;
}
.side-nav a:hover { background: var(--soft); text-decoration: none; }
.side-nav a.active { background: var(--primary); color: #fff; }
.count {
  margin-left: auto; font-style: normal; font-size: 11px; font-weight: 700; background: var(--neg); color: #fff;
  border-radius: 99px; padding: 1px 7px;
}
.side-foot { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); }
.me { display: flex; gap: 10px; align-items: center; flex: 1; min-width: 0; }
.me-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.me-text b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.me-text small { color: var(--muted); font-size: 12px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--primary-soft); color: var(--primary);
  display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none;
}
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 56px; display: flex; align-items: center; gap: 12px; padding: 0 24px; background: var(--card);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.crumbs { display: flex; gap: 8px; align-items: center; color: var(--muted); min-width: 0; }
.crumbs b { color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs span + b::before { content: "›"; margin-right: 8px; color: var(--muted); font-weight: 400; }
.top-actions { margin-left: auto; display: flex; gap: 8px; }
.topbar .menu-btn { display: none; }
.tabs {
  display: flex; gap: 4px; padding: 0 24px; background: var(--card); border-bottom: 1px solid var(--line);
  overflow-x: auto; scrollbar-width: none;
}
.tabs a {
  padding: 11px 12px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; white-space: nowrap;
}
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }
.content { padding: 20px 24px 40px; display: flex; flex-direction: column; gap: 16px; }
.backdrop { display: none; }
.bottom-nav { display: none; }

/* Cards & stats */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-head p { margin: 2px 0 0; }
.card-body { padding: 16px 18px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
  display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--line); }
.stat.pos::before { background: var(--pos); }
.stat.neg::before { background: var(--neg); }
.stat.warn::before { background: var(--warn); }
.stat.info::before { background: var(--info); }
.stat span { color: var(--muted); font-size: 12.5px; }
.stat b { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.3px; }
.stat b small { font-size: 12px; color: var(--muted); font-weight: 500; margin-left: 3px; }
.stat > small { color: var(--muted); font-size: 12px; }
.stat.pos b { color: var(--pos); }
.stat.neg b { color: var(--neg); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px;
  border-radius: 9px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit;
  font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none !important;
}
.btn:hover { background: var(--soft); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; }
.btn.success { background: var(--pos); border-color: var(--pos); color: #fff; }
.btn.danger { background: var(--neg); border-color: var(--neg); color: #fff; }
.btn.danger-ghost { color: var(--neg); }
.btn.ghost { background: transparent; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.block { width: 100%; height: 42px; }
.btn.in { color: var(--pos); }
.btn.out { color: var(--neg); }
.icon-btn {
  width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 8px; border: 0;
  background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--soft); color: var(--ink); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline { display: inline; }

/* Toolbar & inputs */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.input, .toolbar select, .toolbar input[type=date], select.input, textarea.input {
  height: 36px; border: 1px solid var(--line); border-radius: 9px; padding: 0 11px; background: var(--card);
  color: var(--ink); font: inherit; min-width: 0;
}
textarea.input { height: auto; padding: 8px 11px; resize: vertical; }
.input:focus, .toolbar select:focus, .toolbar input:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
.search { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 9px; padding: 0 10px; height: 36px; color: var(--muted); background: var(--card); }
.search input { border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; width: 180px; }
.toolbar select { max-width: 200px; }

/* Tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 14px; background: var(--soft);
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:hover { background: var(--soft); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .right { text-align: right; white-space: nowrap; }
.table tfoot td { font-weight: 700; background: var(--soft); border-top: 1px solid var(--line); }
.table tr.section td { background: var(--soft); font-weight: 700; color: var(--ink-2); }
.table .row-actions { text-align: right; white-space: nowrap; width: 1%; }
.table td.muted a { color: var(--muted); font-size: 12px; }
.empty { text-align: center; color: var(--muted); padding: 40px 14px !important; }
.pager { display: flex; gap: 6px; padding: 12px 14px; align-items: center; justify-content: flex-end; border-top: 1px solid var(--line); }
.pager span { color: var(--muted); margin-right: auto; }

/* Badges */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600;
  background: var(--soft); color: var(--ink-2); white-space: nowrap;
}
.b-income, .b-done, .b-paid, .b-received, .b-approved, .b-active.b-c, .b-True, .b-receipt, .b-transfer_in, .b-closed { background: var(--pos-soft); color: var(--pos); }
.b-expense, .b-rejected, .b-cancelled, .b-overdue, .b-False, .b-writeoff, .b-consumption { background: var(--neg-soft); color: var(--neg); }
.b-new, .b-draft, .b-planning, .b-transfer_out { background: var(--warn-soft); color: var(--warn); }
.b-in_progress, .b-ordered, .b-active { background: var(--info-soft); color: var(--info); }
.b-paused, .b-adjust { background: var(--violet-soft); color: var(--violet); }
.b-material { background: var(--info-soft); color: var(--info); }
.b-labor { background: var(--violet-soft); color: var(--violet); }
.b-machine { background: var(--warn-soft); color: var(--warn); }
.b-service { background: var(--pos-soft); color: var(--pos); }

/* Progress */
.progress { height: 6px; background: var(--soft); border-radius: 99px; overflow: hidden; border: 1px solid var(--line); }
.progress > i { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
.progress.pos > i { background: var(--pos); }
.progress.warn > i { background: var(--warn); }
.progress.neg > i { background: var(--neg); }

/* Forms */
.form-card { max-width: 860px; }
.form { padding: 18px; display: flex; flex-direction: column; gap: 16px; }
.grid-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label, .field > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field label em { color: var(--neg); font-style: normal; }
.field .input { width: 100%; }
.field:has(textarea), .field.wide { grid-column: 1 / -1; }
.field-check { flex-direction: row-reverse; justify-content: flex-end; align-items: center; gap: 8px; }
.check { width: 18px; height: 18px; accent-color: var(--primary); }
.help { color: var(--muted); font-size: 12px; }
.error { color: var(--neg); font-size: 12px; }
.has-error .input { border-color: var(--neg); }
.form-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 16px; }
.alert { padding: 10px 14px; border-radius: 9px; background: var(--info-soft); color: var(--info); }
.alert.error { background: var(--neg-soft); color: var(--neg); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert ul { margin: 0; padding-left: 18px; }
.formset td { padding: 6px 8px; }
.formset .input { width: 100%; }

/* Toasts */
.toasts { display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 10px 14px; border-radius: 9px; background: var(--pos-soft); color: var(--pos); font-weight: 500; }
.toast.error { background: var(--neg-soft); color: var(--neg); }
.toast.warning { background: var(--warn-soft); color: var(--warn); }

/* Projects */
.folders { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.folder {
  display: flex; gap: 12px; align-items: center; padding: 14px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); color: var(--ink); box-shadow: var(--shadow);
}
.folder:hover { border-color: var(--primary); text-decoration: none; }
.folder.active { border-color: var(--primary); background: var(--primary-soft); }
.folder .ic { color: var(--primary); }
.folder small { color: var(--muted); display: block; }
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.project-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; color: var(--ink);
  display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow);
}
.project-card:hover { border-color: var(--primary); text-decoration: none; }
.project-card .top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.project-card small { color: var(--muted); }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 13px; }
.kv span { color: var(--muted); }
.kv b { text-align: right; font-variant-numeric: tabular-nums; }
.add-card {
  border: 1.5px dashed var(--line); border-radius: var(--radius); display: grid; place-items: center; min-height: 150px;
  color: var(--muted); font-weight: 600; gap: 6px;
}
.add-card:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.subtabs { display: flex; gap: 4px; background: var(--soft); border: 1px solid var(--line); padding: 3px; border-radius: 10px; width: max-content; max-width: 100%; overflow-x: auto; }
.subtabs a { padding: 6px 12px; border-radius: 8px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.subtabs a.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.subtabs a:hover { text-decoration: none; color: var(--ink); }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; }

/* Gantt */
.gantt { position: relative; }
.gantt-row { display: grid; grid-template-columns: 260px 1fr; border-bottom: 1px solid var(--line); min-height: 40px; align-items: center; }
.gantt-row .name { padding: 8px 14px; font-size: 13px; border-right: 1px solid var(--line); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gantt-row .name small { display: block; color: var(--muted); }
.gantt-track { position: relative; height: 40px; }
.gantt-bar {
  position: absolute; top: 10px; height: 20px; border-radius: 6px; background: var(--primary-soft); border: 1px solid var(--primary);
  overflow: hidden; font-size: 11px; color: var(--ink); display: flex; align-items: center; padding-left: 6px; white-space: nowrap;
}
.gantt-bar > i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--primary); opacity: .35; }
.gantt-bar.overdue { border-color: var(--neg); background: var(--neg-soft); }
.gantt-bar.done { border-color: var(--pos); background: var(--pos-soft); }
.gantt-head { display: grid; grid-template-columns: 260px 1fr; background: var(--soft); border-bottom: 1px solid var(--line); height: 32px; }
.gantt-months { position: relative; }
.gantt-months span { position: absolute; top: 7px; font-size: 11px; color: var(--muted); padding-left: 4px; border-left: 1px solid var(--line); height: 100%; }
.gantt-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--neg); z-index: 2; }
.gantt-body { position: relative; }
.gantt-lines { position: absolute; left: 260px; right: 0; top: 0; bottom: 0; pointer-events: none; }

/* Calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal .wd { padding: 8px; font-size: 12px; color: var(--muted); font-weight: 600; text-align: center; background: var(--soft); border-bottom: 1px solid var(--line); }
.cal .day { min-height: 110px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.cal .day:nth-child(7n) { border-right: 0; }
.cal .day.out { background: var(--soft); color: var(--muted); }
.cal .day.today .num { background: var(--primary); color: #fff; }
.cal .num { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 600; }
.cal .ev { display: block; border-radius: 6px; padding: 3px 6px; font-size: 11px; line-height: 1.3; background: var(--warn-soft); color: var(--ink); }
.cal .ev b { display: block; font-variant-numeric: tabular-nums; }
.cal .ev.pos { background: var(--pos-soft); }
.cal .ev.neg { background: var(--neg-soft); }
.cal .ev.info { background: var(--info-soft); }
.cal .ev:hover { text-decoration: none; filter: brightness(.97); }

/* Lists in dashboard */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .grow b, .list-item .grow small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item small { color: var(--muted); }
.list-item .amt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dot { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.dot.pos { background: var(--pos-soft); color: var(--pos); }
.dot.neg { background: var(--neg-soft); color: var(--neg); }
.dot.warn { background: var(--warn-soft); color: var(--warn); }
.chart-box { position: relative; height: 280px; padding: 12px 16px; }
.cash-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.cash-card { padding: 14px 16px; }
.cash-card b { display: block; font-variant-numeric: tabular-nums; }
.cash-card small { color: var(--muted); }

/* AI assistant */
.chat-wrap { max-width: 920px; width: 100%; margin: 0 auto; }
.chat-card { display: flex; flex-direction: column; height: calc(100vh - 150px); min-height: 460px; }
.chat { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 82%; padding: 10px 14px; border-radius: 14px; line-height: 1.55; overflow-wrap: anywhere; }
.msg.me { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.msg.ai { align-self: flex-start; background: var(--soft); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.ai p { margin: 0 0 8px; }
.msg.ai p:last-child { margin-bottom: 0; }
.msg.ai h4 { margin: 10px 0 6px; font-size: 14px; }
.msg.ai h4:first-child { margin-top: 0; }
.msg.ai ul { margin: 4px 0 8px; padding-left: 20px; }
.msg.thinking { color: var(--muted); display: flex; align-items: center; gap: 4px; }
.msg.thinking span { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.msg.thinking span:nth-child(2) { animation-delay: .2s; }
.msg.thinking span:nth-child(3) { animation-delay: .4s; margin-right: 6px; }
.msg[hidden] { display: none; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.chat-empty { margin: auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--muted); }
.chat-empty .logo { color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 640px; }
.chip { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 99px; padding: 7px 13px; font: inherit; cursor: pointer; }
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); align-items: flex-end; }
.chat-form textarea { flex: 1; resize: none; min-height: 44px; max-height: 160px; }
.chat-form .btn { height: 44px; }
.ai-text { line-height: 1.6; }
.ai-text h4 { margin: 16px 0 6px; font-size: 15px; }
.ai-text h4:first-child { margin-top: 0; }
.ai-text ul { padding-left: 20px; }
.steps { padding-left: 20px; margin: 0 0 12px; line-height: 1.7; }
code { background: var(--soft); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; font-size: 12.5px; }

/* Login */
.login-page { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.login-hero {
  background: linear-gradient(150deg, #1d3fb8, #2457e6 45%, #7c3aed); color: #fff; padding: 56px;
  display: flex; flex-direction: column; justify-content: center; gap: 16px;
}
.login-hero h1 { font-size: 36px; }
.login-hero p { font-size: 16px; opacity: .9; max-width: 460px; margin: 0; }
.login-hero ul { margin: 8px 0 0; padding-left: 18px; opacity: .9; line-height: 1.9; }
.login-hero .logo { background: rgba(255, 255, 255, .18); }
.login-box { display: grid; place-items: center; padding: 24px; }
.login-card { width: min(380px, 100%); padding: 28px; display: flex; flex-direction: column; gap: 14px; }

/* Print (PDF) */
@media print {
  .sidebar, .topbar, .tabs, .bottom-nav, .toolbar, .no-print, .toasts, .btn { display: none !important; }
  body, .content { background: #fff; padding: 0; color: #000; }
  .card { box-shadow: none; border: 0; }
  .print-only { display: block !important; }
  .table th, .table td { padding: 5px 8px; font-size: 11px; }
}
.print-only { display: none; }

/* Responsive */
@media (max-width: 1100px) {
  .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .4); z-index: 30; }
  .topbar .menu-btn { display: inline-grid; }
  .topbar { padding: 0 12px; }
  .tabs { padding: 0 8px; }
  .content { padding: 14px 12px 90px; }
  .grid-2, .grid-form { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stat { padding: 10px 12px; }
  .stat b { font-size: 16px; }
  .stat b small { display: block; margin: 0; }
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: var(--card); border-top: 1px solid var(--line);
    z-index: 25; padding-bottom: env(safe-area-inset-bottom);
  }
  .bottom-nav a, .bottom-nav button {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0; font-size: 11px;
    color: var(--muted); background: none; border: 0; font: inherit; font-size: 11px; cursor: pointer;
  }
  .bottom-nav a.active { color: var(--primary); }
  .bottom-nav a:hover { text-decoration: none; }
  .gantt-row, .gantt-head { grid-template-columns: 140px 1fr; }
  .gantt-lines { left: 140px; }
  .login-page { grid-template-columns: 1fr; }
  .login-hero { padding: 28px 22px; }
  .login-hero ul { display: none; }
  .search input { width: 120px; }
  .btn span.hide-sm { display: none; }

  /* Tables become cards on phones */
  .table.stack thead { display: none; }
  .table.stack, .table.stack tbody, .table.stack tr, .table.stack td { display: block; width: 100%; }
  .table.stack tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  .table.stack td { border: 0; padding: 4px 14px; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .table.stack td::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-align: left; }
  .table.stack td.row-actions { justify-content: flex-end; width: 100%; }
  .table.stack td.row-actions::before { content: none; }
  .cal .day { min-height: 70px; padding: 3px; }
  .cal .ev { font-size: 10px; padding: 2px 3px; }
  .cal .ev span { display: none; }
}
