:root {
  --bg: #f3f5f4;
  --surface: #ffffff;
  --surface-soft: #f8faf9;
  --line: #dfe5e2;
  --line-strong: #cbd5d1;
  --text: #18211e;
  --muted: #697570;
  --teal: #0f766e;
  --teal-dark: #115e59;
  --teal-soft: #dff4f0;
  --blue: #2563eb;
  --blue-soft: #e8f0ff;
  --amber: #b45309;
  --amber-soft: #fff1d6;
  --rose: #be123c;
  --rose-soft: #ffe4eb;
  --violet: #6d28d9;
  --violet-soft: #f0e9ff;
  --green: #15803d;
  --green-soft: #e4f5e8;
  --shadow: 0 10px 30px rgba(24, 33, 30, 0.07);
  font-family: "DM Sans", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--bg); }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(15, 118, 110, 0.24); outline-offset: 2px; }
i[data-lucide] { width: 18px; height: 18px; stroke-width: 2; }

.app-shell { display: grid; grid-template-columns: 238px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 22px 16px; background: #15231f; color: #f6fbf9; display: flex; flex-direction: column; gap: 24px; }
.brand-block { display: flex; align-items: center; gap: 11px; padding: 2px 8px 18px; border-bottom: 1px solid rgba(255,255,255,.11); }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 8px; background: #27a697; color: white; font-family: "Manrope", sans-serif; font-size: 13px; font-weight: 800; }
.brand-block div { display: flex; flex-direction: column; line-height: 1.2; }
.brand-block strong { font-family: "Manrope", sans-serif; font-size: 14px; }
.brand-block span:last-child { color: #aebdb7; font-size: 13px; margin-top: 3px; }
.side-nav { display: grid; gap: 4px; }
.nav-item { border: 0; background: transparent; color: #b9c7c2; display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 11px; border-radius: 6px; text-align: left; }
.nav-item:hover, .nav-item.active { color: #fff; background: rgba(255,255,255,.09); }
.nav-item.active { box-shadow: inset 3px 0 #45c4b5; }
.label-guide { margin-top: 2px; }
.side-heading { display: flex; align-items: center; justify-content: space-between; color: #93a59f; font-size: 11px; font-weight: 700; text-transform: uppercase; margin: 0 8px 12px; }
.side-heading i { width: 15px; height: 15px; }
.guide-row { display: grid; grid-template-columns: 32px 1fr; align-items: center; gap: 9px; padding: 8px; }
.guide-row > span:last-child { display: flex; flex-direction: column; }
.guide-row b { font-size: 12px; font-weight: 600; }
.guide-row small { color: #8fa19a; font-size: 10px; margin-top: 2px; }
.label-badge { display: inline-grid; place-items: center; min-width: 28px; height: 25px; border-radius: 5px; padding: 0 6px; font-family: "Manrope", sans-serif; font-size: 11px; font-weight: 800; }
.label-t { color: #14532d; background: #bbf7d0; }
.label-b { color: #854d0e; background: #fef08a; }
.label-m { color: #3730a3; background: #ddd6fe; }
.label-a { color: #155e75; background: #cffafe; }
.source-note { margin-top: auto; display: flex; gap: 10px; align-items: center; padding: 12px; border: 1px solid rgba(255,255,255,.1); border-radius: 7px; color: #b7c7c1; }
.source-note i { color: #5bd0c1; }
.source-note div { display: flex; flex-direction: column; }
.source-note b { color: white; font-size: 11px; }
.source-note span { font-size: 10px; margin-top: 2px; }

.main-content { min-width: 0; padding: 28px 34px 54px; max-width: 1640px; width: 100%; margin: 0 auto; }
.topbar { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; margin-bottom: 26px; }
.eyebrow { margin: 0 0 6px; color: var(--teal); font-size: 10px; line-height: 1; font-weight: 800; letter-spacing: 1.4px; }
h1, h2 { font-family: "Manrope", sans-serif; letter-spacing: 0; margin: 0; }
h1 { font-size: 30px; line-height: 1.15; }
h2 { font-size: 18px; }
.subtitle { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.header-actions { display: flex; align-items: center; gap: 12px; }
.sync-status { min-height: 38px; display: inline-flex; align-items: center; gap: 7px; padding: 0 11px; border: 1px solid var(--line); background: var(--surface); border-radius: 6px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #16a34a; box-shadow: 0 0 0 3px #dcfce7; }
.button { min-height: 38px; border-radius: 6px; padding: 0 13px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent; font-size: 12px; font-weight: 700; }
.button.primary { background: var(--teal); color: white; }
.button.primary:hover { background: var(--teal-dark); }
.button.secondary { background: var(--surface); color: var(--text); border-color: var(--line-strong); }
.button.secondary:hover { border-color: var(--teal); color: var(--teal-dark); }

.metrics { display: grid; grid-template-columns: repeat(5, minmax(145px, 1fr)); gap: 12px; margin-bottom: 18px; }
.metric { min-height: 94px; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; padding: 16px; display: flex; align-items: center; gap: 13px; }
.metric-primary { background: #173d36; color: white; border-color: #173d36; }
.metric-icon { width: 38px; height: 38px; border-radius: 7px; display: grid; place-items: center; background: rgba(255,255,255,.12); color: #70e0d2; flex: 0 0 auto; }
.metric:not(.metric-primary) .metric-icon { background: var(--teal-soft); color: var(--teal); }
.metric .icon-task { background: var(--green-soft) !important; color: var(--green) !important; }
.metric .icon-backlog { background: var(--amber-soft) !important; color: var(--amber) !important; }
.metric .icon-meeting { background: var(--violet-soft) !important; color: var(--violet) !important; }
.metric .icon-priority { background: var(--rose-soft) !important; color: var(--rose) !important; }
.metric > div:last-child { min-width: 0; display: grid; }
.metric small { color: var(--muted); font-size: 10px; font-weight: 700; }
.metric-primary small, .metric-primary span { color: #acd0c7; }
.metric strong { font-family: "Manrope", sans-serif; font-size: 24px; line-height: 1.05; margin: 4px 0 2px; }
.metric span:last-child { color: var(--muted); font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.insight-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr); gap: 14px; margin-bottom: 22px; }
.insight-panel, .latest-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 7px; padding: 18px; min-height: 224px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.section-heading .muted { color: var(--muted); font-size: 10px; }
.section-heading > i { color: var(--teal); }
.distribution-bars { display: grid; gap: 14px; margin-top: 20px; }
.bar-row { display: grid; grid-template-columns: 102px minmax(100px, 1fr) 40px; gap: 10px; align-items: center; }
.bar-label { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; }
.bar-track { height: 8px; background: #edf1ef; border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; min-width: 3px; }
.bar-fill.t { background: #22a05a; }
.bar-fill.b { background: #d18a14; }
.bar-fill.m { background: #7952d6; }
.bar-fill.a { background: #168e9f; }
.bar-value { text-align: right; font-family: "Manrope", sans-serif; font-size: 11px; font-weight: 800; }
.latest-list { display: grid; margin-top: 10px; }
.latest-item { display: grid; grid-template-columns: 7px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.latest-item:last-child { border-bottom: 0; }
.latest-marker { width: 7px; height: 7px; border-radius: 50%; background: var(--rose); margin-top: 5px; }
.latest-item p { margin: 0; font-size: 11px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.latest-item span { display: block; color: var(--muted); font-size: 9px; margin-top: 4px; }

.direction-section { background: var(--surface); border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.direction-heading { padding: 18px 18px 14px; }
.view-toggle { display: flex; gap: 3px; padding: 3px; border: 1px solid var(--line); background: var(--surface-soft); border-radius: 6px; }
.icon-button { width: 34px; height: 32px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); display: inline-grid; place-items: center; }
.icon-button:hover, .icon-button.active { background: var(--surface); color: var(--teal); box-shadow: 0 1px 4px rgba(20,40,34,.12); }
.filter-toolbar { display: grid; grid-template-columns: minmax(260px, 1fr) 145px minmax(170px, .8fr) 145px 38px; gap: 8px; padding: 13px 18px; background: var(--surface-soft); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.search-field { height: 38px; display: flex; align-items: center; gap: 8px; padding: 0 10px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 6px; }
.search-field i { color: var(--muted); width: 16px; }
.search-field input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; font-size: 12px; color: var(--text); }
kbd { color: #89938f; background: #edf1ef; border: 1px solid #d9dfdc; border-radius: 4px; padding: 1px 5px; font-size: 9px; }
select { min-height: 38px; max-width: 100%; padding: 0 30px 0 10px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--text); font-size: 11px; }
select:disabled { color: #76540e; background: #fff9df; border-color: #e5d9ae; opacity: 1; }
input[type="date"] { min-height: 38px; width: 100%; max-width: 100%; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--text); font-size: 11px; }
.reset-button { width: 38px; height: 38px; border: 1px solid var(--line-strong); background: var(--surface); }
.date-toolbar { display: grid; grid-template-columns: 170px 170px minmax(230px, 1fr); align-items: end; gap: 8px; padding: 12px 18px; background: #fbfdfc; border-bottom: 1px solid var(--line); }
.date-field { display: grid; gap: 5px; min-width: 0; }
.date-field span { color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.date-presets { display: flex; gap: 6px; justify-content: flex-start; overflow-x: auto; padding-bottom: 1px; }
.date-presets button { min-height: 38px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--text); padding: 0 12px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.date-presets button:hover { border-color: var(--teal); color: var(--teal-dark); background: var(--teal-soft); }
.subfilters { display: flex; justify-content: space-between; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.segmented { display: flex; padding: 3px; border: 1px solid var(--line); background: var(--surface-soft); border-radius: 6px; overflow-x: auto; }
.segmented button { min-height: 30px; border: 0; border-radius: 4px; background: transparent; padding: 0 10px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.segmented button.active { background: var(--surface); color: var(--teal-dark); font-weight: 800; box-shadow: 0 1px 4px rgba(20,40,34,.1); }
.compact-controls { display: flex; gap: 7px; }
.compact-controls select { min-height: 36px; }
.results-summary { min-height: 38px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 18px; color: var(--muted); font-size: 10px; border-bottom: 1px solid var(--line); }
.results-summary span:first-child { color: var(--text); font-weight: 800; }
.backlog-urgency-guide { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 18px; background: #fffdf5; border-bottom: 1px solid #eadca9; }
.backlog-urgency-guide[hidden] { display: none; }
.backlog-urgency-guide > div:first-child { display: grid; gap: 3px; }
.backlog-urgency-guide strong { font-size: 11px; }
.backlog-urgency-guide > div:first-child span { color: #6f6653; font-size: 9px; line-height: 1.45; }
.urgency-scale { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.urgency-scale span, .urgency-pill { min-height: 23px; display: inline-flex; align-items: center; border-radius: 12px; padding: 0 8px; font-size: 8px; font-weight: 800; white-space: nowrap; }
.scale-critical, .urgency-kritis { color: #9f1239; background: #ffe4e6; }
.scale-high, .urgency-tinggi { color: #b45309; background: #ffedd5; }
.scale-medium, .urgency-menengah { color: #854d0e; background: #fef9c3; }
.scale-low, .urgency-rendah { color: #166534; background: #dcfce7; }
.scale-park, .urgency-parkir { color: #4b5563; background: #e5e7eb; }
.backlog-matrix { padding: 16px 18px 12px; border-bottom: 1px solid var(--line); background: #fbfdfc; }
.backlog-matrix[hidden] { display: none; }
.matrix-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.matrix-heading h3 { margin: 0; font-family: "Manrope", sans-serif; font-size: 15px; letter-spacing: 0; }
.matrix-heading > span { color: var(--muted); font-size: 9px; font-weight: 700; }
.matrix-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; margin: 12px 0 8px; }
.matrix-stat { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 34px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; background: white; }
.matrix-stat span { color: var(--muted); font-size: 8px; font-weight: 700; }
.matrix-stat strong { font-size: 13px; }
.matrix-critical { border-color: #fecdd3; background: #fff1f2; }
.matrix-fast { border-color: #bae6fd; background: #f0f9ff; }
.matrix-complex { border-color: #fde68a; background: #fffbeb; }
.matrix-planned { border-color: #d1fae5; background: #f0fdf4; }
.matrix-chart-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; background: white; }
.backlog-matrix-chart { display: block; width: 100%; min-width: 720px; height: auto; }
.quadrant-bg { opacity: .7; }
.quadrant-bg.quadrant-fast { fill: #f0f9ff; }
.quadrant-bg.quadrant-critical { fill: #fff1f2; }
.quadrant-bg.quadrant-planned { fill: #f0fdf4; }
.quadrant-bg.quadrant-complex { fill: #fffbeb; }
.matrix-grid line { stroke: #dfe5e2; stroke-width: 1; }
.matrix-grid text { fill: #7c8782; font-size: 9px; text-anchor: middle; }
.matrix-grid text:nth-of-type(n+11) { text-anchor: end; }
.quadrant-labels text { fill: #697570; font-size: 8px; font-weight: 800; }
.matrix-point { cursor: pointer; outline: none; }
.matrix-point circle { stroke: white; stroke-width: 2; opacity: .88; transition: .15s ease; }
.matrix-point:hover circle, .matrix-point:focus circle { stroke: #173d36; stroke-width: 3; opacity: 1; }
.matrix-point-critical circle { fill: #e11d48; }
.matrix-point-fast circle { fill: #0284c7; }
.matrix-point-complex circle { fill: #d97706; }
.matrix-point-planned circle { fill: #16a34a; }
.matrix-point-label { fill: #37413d; font-size: 8px; font-weight: 700; paint-order: stroke; stroke: white; stroke-width: 3px; stroke-linejoin: round; }
.axis-title { fill: #52605b; font-size: 9px; font-weight: 800; text-anchor: middle; }
.matrix-axis-note { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 7px; color: var(--muted); font-size: 8px; font-weight: 700; }
.matrix-axis-note span { display: inline-flex; align-items: center; gap: 4px; }
.matrix-axis-note i { width: 12px; height: 12px; }

.direction-list { min-height: 280px; }
.direction-row { display: grid; grid-template-columns: 94px 104px minmax(130px, .72fr) minmax(260px, 1.6fr) 86px 84px 32px; align-items: center; gap: 12px; min-height: 76px; padding: 11px 18px; border-bottom: 1px solid var(--line); transition: background .16s ease; cursor: pointer; }
.direction-row:hover { background: #f8fbfa; }
.direction-row.completed { opacity: .62; }
.direction-row.completed .direction-text { text-decoration: line-through; }
.date-cell { display: grid; gap: 2px; }
.date-cell strong { font-size: 11px; }
.date-cell span { color: var(--muted); font-size: 9px; }
.label-cell .label-badge { min-width: 76px; }
.group-cell { min-width: 0; font-size: 10px; font-weight: 700; line-height: 1.35; }
.group-cell span { display: block; color: var(--muted); font-size: 9px; font-weight: 400; margin-top: 3px; }
.direction-copy { min-width: 0; display: grid; gap: 5px; }
.direction-text { margin: 0; font-size: 11px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.backlog-preview { margin: 0; color: #7c5a11; font-size: 9px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.backlog-preview strong { color: #6b4b08; }
.urgency-preview { margin: 0; color: #655e50; font-size: 9px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.urgency-preview strong { color: #9f1239; }
.priority-pill, .source-pill, .status-pill { display: inline-flex; align-items: center; justify-content: center; min-height: 25px; padding: 0 8px; border-radius: 12px; font-size: 9px; font-weight: 700; white-space: nowrap; }
.priority-Tinggi { color: var(--rose); background: var(--rose-soft); }
.priority-Sedang { color: var(--amber); background: var(--amber-soft); }
.priority-Normal { color: var(--muted); background: #edf1ef; }
.source-Excel { color: #166534; background: #dcfce7; }
.source-WhatsApp { color: #155e75; background: #cffafe; }
.status-pill { border: 0; color: var(--teal-dark); background: var(--teal-soft); }
.status-pill.done { color: var(--green); background: var(--green-soft); }
.row-arrow { color: #9ba6a1; }
.load-more-wrap { display: flex; justify-content: center; padding: 15px; }
.empty-state { min-height: 300px; display: grid; place-items: center; text-align: center; padding: 40px; color: var(--muted); }
.empty-state i { width: 34px; height: 34px; color: var(--line-strong); margin-bottom: 10px; }
.empty-state strong { display: block; color: var(--text); font-size: 13px; margin-bottom: 4px; }

.direction-list.timeline-view { padding: 6px 18px 14px 34px; }
.timeline-view .direction-row { position: relative; grid-template-columns: 90px 90px minmax(120px, .65fr) minmax(260px, 1.6fr) 80px 76px 28px; padding-left: 18px; border-left: 2px solid #d8e5e1; }
.timeline-view .direction-row::before { content: ""; position: absolute; left: -6px; top: 32px; width: 8px; height: 8px; border: 2px solid var(--surface); border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 1px var(--teal); }

.detail-dialog { width: min(620px, calc(100vw - 28px)); border: 0; border-radius: 8px; padding: 0; box-shadow: 0 24px 80px rgba(14,31,25,.25); color: var(--text); }
.detail-dialog::backdrop { background: rgba(13, 27, 23, .54); backdrop-filter: blur(2px); }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.dialog-content { padding: 22px; display: grid; gap: 20px; }
.dialog-text { margin: 0; font-size: 15px; line-height: 1.65; }
.backlog-detail { display: grid; gap: 14px; padding: 2px 0 2px 16px; border-left: 3px solid #f1cf55; }
.backlog-detail div { display: grid; gap: 5px; }
.backlog-detail span { color: #76540e; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.backlog-detail p { margin: 0; color: #423a29; font-size: 12px; line-height: 1.6; }
.urgency-detail { padding: 12px !important; border: 1px solid #eadca9; border-radius: 6px; background: #fffdf6; }
.urgency-detail-heading { display: flex !important; grid-template-columns: 1fr auto; align-items: center; justify-content: space-between; gap: 12px !important; }
.urgency-detail-heading strong { font-size: 13px; white-space: nowrap; }
.urgency-meter { display: grid !important; grid-template-columns: repeat(10, 1fr); gap: 3px !important; }
.urgency-meter span { height: 6px; border-radius: 3px; background: #e7e5e4; }
.urgency-meter span.active { background: #d97706; }
.urgency-kritis .urgency-meter span.active { background: #e11d48; }
.urgency-detail small { color: #5f5747; font-size: 10px; line-height: 1.55; }
.dependency-detail { padding: 12px !important; border: 1px solid #bae6fd; border-radius: 6px; background: #f0f9ff; }
.dependency-detail-heading { display: flex !important; align-items: center; justify-content: space-between; gap: 12px !important; }
.dependency-detail-heading strong { color: #075985; font-size: 12px; white-space: nowrap; }
.related-backlogs { display: grid; gap: 7px; }
.related-backlog { position: relative; display: grid; gap: 4px; width: 100%; padding: 10px 34px 10px 11px; border: 1px solid #e5d9ae; border-radius: 6px; background: #fffdf6; color: var(--text); text-align: left; cursor: pointer; }
.related-backlog:hover { border-color: #d1aa28; background: #fff9df; }
.related-backlog span { color: var(--text); font-size: 11px; font-weight: 700; line-height: 1.45; text-transform: none; }
.related-backlog small { color: #74674c; font-size: 9px; line-height: 1.45; }
.related-backlog i { position: absolute; right: 10px; top: 50%; width: 15px; height: 15px; color: #8a6c14; transform: translateY(-50%); }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.detail-field { padding: 11px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 6px; }
.detail-field small { display: block; color: var(--muted); font-size: 9px; text-transform: uppercase; margin-bottom: 5px; }
.detail-field strong { display: block; font-size: 11px; overflow-wrap: anywhere; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; background: var(--surface-soft); border-top: 1px solid var(--line); }
.toast { position: fixed; right: 24px; bottom: 24px; transform: translateY(20px); opacity: 0; pointer-events: none; padding: 11px 15px; border-radius: 6px; background: #173d36; color: white; box-shadow: var(--shadow); font-size: 11px; transition: .2s ease; z-index: 20; }
.toast.show { transform: translateY(0); opacity: 1; }

@media (max-width: 1180px) {
  .metrics { grid-template-columns: repeat(3, 1fr); }
  .direction-row { grid-template-columns: 84px 92px minmax(120px, .7fr) minmax(220px, 1.5fr) 82px 30px; }
  .source-pill { display: none; }
  .filter-toolbar { grid-template-columns: minmax(230px, 1fr) 140px minmax(160px, .8fr) 38px; }
  #priority-filter { display: none; }
  .date-toolbar { grid-template-columns: repeat(2, minmax(150px, 1fr)); }
  .date-presets { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
  .app-shell { display: block; }
  .sidebar { position: static; height: auto; padding: 14px 18px; gap: 12px; }
  .brand-block { border-bottom: 0; padding: 0; }
  .side-nav { grid-template-columns: repeat(3, 1fr); }
  .nav-item { justify-content: center; }
  .nav-item.active { box-shadow: inset 0 -3px #45c4b5; }
  .label-guide, .source-note { display: none; }
  .main-content { padding: 22px 18px 42px; }
  .insight-grid { grid-template-columns: 1fr; }
  .filter-toolbar { grid-template-columns: 1fr 1fr 1fr 38px; }
  .search-field { grid-column: 1 / -1; }
  .date-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .date-presets { grid-column: 1 / -1; }
  .subfilters { align-items: flex-start; flex-direction: column; }
  .compact-controls { width: 100%; }
  .compact-controls select { flex: 1; }
  .direction-row, .timeline-view .direction-row { grid-template-columns: 80px 85px minmax(120px, .6fr) minmax(220px, 1.4fr) 28px; }
  .priority-pill, .urgency-pill, .source-pill { display: none; }
}

@media (max-width: 640px) {
  .sidebar { padding: 12px; }
  .brand-mark { width: 34px; height: 34px; }
  .side-nav { overflow-x: auto; grid-template-columns: repeat(3, minmax(120px, 1fr)); }
  .nav-item { min-height: 38px; font-size: 11px; }
  .main-content { padding: 18px 12px 34px; }
  .topbar { display: block; }
  h1 { font-size: 25px; }
  .header-actions { margin-top: 14px; justify-content: space-between; }
  .sync-status { min-width: 0; white-space: normal; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { min-height: 84px; padding: 12px; }
  .metric-primary { grid-column: 1 / -1; }
  .metric-icon { width: 34px; height: 34px; }
  .metric strong { font-size: 21px; }
  .bar-row { grid-template-columns: 90px minmax(80px, 1fr) 34px; }
  .filter-toolbar { grid-template-columns: 1fr 38px; }
  #month-filter, #group-filter { grid-column: 1; }
  .date-toolbar { grid-template-columns: 1fr; padding: 12px; }
  .date-presets { grid-column: auto; }
  .date-presets button { flex: 1 0 auto; }
  .compact-controls { display: grid; grid-template-columns: 1fr 1fr; }
  #sort-filter { grid-column: 1 / -1; }
  .results-summary { align-items: flex-start; flex-direction: column; justify-content: center; padding-top: 8px; padding-bottom: 8px; }
  .backlog-urgency-guide { align-items: flex-start; flex-direction: column; padding: 12px; }
  .urgency-scale { justify-content: flex-start; }
  .backlog-matrix { padding: 14px 12px 10px; }
  .matrix-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .direction-row, .timeline-view .direction-row { grid-template-columns: 72px 76px 1fr 26px; min-height: 92px; gap: 8px; padding: 12px; }
  .timeline-view .direction-row { padding-left: 16px; }
  .group-cell { grid-column: 3; grid-row: 1; }
  .direction-copy { grid-column: 1 / 4; grid-row: 2; }
  .direction-text { -webkit-line-clamp: 3; }
  .backlog-preview { -webkit-line-clamp: 3; }
  .row-arrow { grid-column: 4; grid-row: 1 / 3; }
  .direction-list.timeline-view { padding-left: 22px; padding-right: 8px; }
  .detail-grid { grid-template-columns: 1fr; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions .button { width: 100%; }
}
