:root {
  --navy: #132a3a;
  --navy-2: #1a3a4d;
  --green: #16875d;
  --green-2: #0e6846;
  --mint: #ddf3e8;
  --mint-soft: #f2faf6;
  --gold: #c4a15a;
  --orange: #df901c;
  --red: #c84d4d;
  --ink: #30363b;
  --muted: #6e7a80;
  --line: #dfe7e3;
  --paper: #f5f7f6;
  --white: #fff;
  --shadow: 0 16px 42px rgba(19, 42, 58, .08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 28px 20px 22px; background: var(--navy); color: var(--white); display: flex; flex-direction: column; z-index: 20; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 32px; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: var(--green); color: white; font-weight: 800; letter-spacing: -.05em; }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 18px; }
.brand div span { margin-top: 2px; color: #a8c0b5; font-size: 12px; }
.nav { display: grid; gap: 6px; }
.nav-item { width: 100%; border: 0; border-radius: 10px; padding: 13px 14px; background: transparent; color: #bed0c8; text-align: left; font-size: 14px; display: flex; gap: 12px; align-items: center; transition: .2s ease; }
.nav-item span { font-size: 10px; color: #789489; font-weight: 800; }
.nav-item:hover { background: rgba(255,255,255,.06); color: white; }
.nav-item.active { background: var(--green); color: white; box-shadow: 0 8px 20px rgba(0,0,0,.15); }
.nav-item.active span { color: #c9f1df; }
.sidebar-status { margin-top: auto; border: 1px solid rgba(255,255,255,.1); border-radius: 12px; padding: 14px; display: flex; gap: 10px; align-items: center; }
.sidebar-status strong, .sidebar-status small { display: block; }
.sidebar-status strong { font-size: 12px; }
.sidebar-status small { color: #91aaa0; font-size: 11px; margin-top: 2px; }
.save-dot { width: 9px; height: 9px; border-radius: 50%; background: #55d899; box-shadow: 0 0 0 5px rgba(85,216,153,.12); }

.main { min-width: 0; }
.topbar { height: 76px; position: sticky; top: 0; z-index: 15; display: flex; align-items: center; gap: 18px; padding: 0 34px; background: rgba(255,255,255,.92); border-bottom: 1px solid var(--line); backdrop-filter: blur(14px); }
.project-identity { margin-right: auto; }
.project-identity span, .project-identity strong { display: block; }
.project-identity span { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.project-identity strong { color: var(--navy); margin-top: 2px; }
.top-actions { display: flex; gap: 8px; }
.btn { border: 1px solid var(--line); border-radius: 9px; padding: 10px 14px; background: white; color: var(--navy); font-weight: 700; font-size: 13px; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(19,42,58,.08); }
.btn.primary { background: var(--green); color: white; border-color: var(--green); }
.btn.ghost { background: transparent; }
.file-btn input { display: none; }
.menu-btn { display: none; }

.view { display: none; padding: 38px 34px 56px; max-width: 1500px; margin: 0 auto; animation: enter .25s ease; }
.view.active { display: block; }
@keyframes enter { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.eyebrow { color: var(--green); letter-spacing: .12em; font-size: 11px; font-weight: 800; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin: 7px 0 7px; color: var(--navy); font-size: clamp(28px, 3vw, 42px); letter-spacing: -.04em; }
.page-heading p { margin-bottom: 0; color: var(--muted); font-size: 15px; }
.status-pill { flex: 0 0 auto; background: var(--mint); color: var(--green-2); border-radius: 999px; padding: 9px 14px; font-weight: 700; font-size: 12px; }
.status-pill span { display: inline-block; width: 8px; height: 8px; background: var(--green); border-radius: 50%; margin-right: 7px; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi { position: relative; overflow: hidden; background: white; border: 1px solid var(--line); border-radius: 14px; padding: 20px 20px 18px 25px; box-shadow: 0 8px 24px rgba(19,42,58,.04); }
.kpi::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 7px; background: var(--accent); }
.kpi.navy { --accent: var(--navy); }.kpi.green { --accent: var(--green); }.kpi.gold { --accent: var(--gold); }.kpi.orange { --accent: var(--orange); }
.kpi span, .kpi strong, .kpi small { display: block; }
.kpi span { color: var(--muted); text-transform: uppercase; font-size: 11px; font-weight: 800; letter-spacing: .04em; }
.kpi strong { color: var(--navy); font-size: clamp(20px, 2vw, 28px); margin: 10px 0 7px; letter-spacing: -.03em; }
.kpi small { color: #8b969b; font-size: 11px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .65fr); gap: 18px; margin-bottom: 18px; }
.panel { background: white; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.chart-panel, .progress-panel, .alerts-panel, .form-panel { padding: 24px; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.panel-head h2 { margin: 5px 0 0; color: var(--navy); font-size: 20px; }
.hint { color: var(--muted); font-size: 11px; }
.bar-chart { min-height: 260px; display: grid; gap: 13px; align-content: center; }
.bar-row { display: grid; grid-template-columns: 135px minmax(0, 1fr) 90px; align-items: center; gap: 12px; font-size: 12px; }
.bar-row > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars { height: 20px; background: #edf2ef; border-radius: 6px; overflow: hidden; position: relative; }
.bar-plan, .bar-actual { position: absolute; left: 0; top: 0; height: 9px; border-radius: 5px; }
.bar-plan { background: #a9c4b8; top: 1px; }
.bar-actual { background: var(--green); top: 11px; }
.bar-row strong { color: var(--navy); text-align: right; font-size: 11px; }
.progress-panel { display: grid; align-content: start; }
.donut { --progress: 0deg; width: min(210px, 80%); aspect-ratio: 1; border-radius: 50%; margin: 4px auto 18px; display: grid; place-items: center; background: conic-gradient(var(--green) var(--progress), #e8eeeb 0); position: relative; }
.donut::after { content: ""; position: absolute; inset: 17px; border-radius: 50%; background: white; }
.donut div { position: relative; z-index: 1; text-align: center; }
.donut strong, .donut span { display: block; }
.donut strong { color: var(--navy); font-size: 34px; }.donut span { color: var(--muted); font-size: 11px; }
.legend { display: flex; justify-content: center; gap: 20px; color: var(--muted); font-size: 11px; }
.legend i { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; }.legend .planned { background: #c8d4cf; }.legend .actual { background: var(--green); }
.alert-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.alert-card { border: 1px solid var(--line); border-radius: 12px; padding: 16px; background: var(--mint-soft); }
.alert-card.warning { background: #fff8e8; border-color: #f0d999; }.alert-card.danger { background: #fff0f0; border-color: #ecc2c2; }
.alert-card span, .alert-card strong { display: block; }.alert-card span { color: var(--muted); font-size: 11px; }.alert-card strong { color: var(--navy); margin-top: 6px; font-size: 15px; }

.form-panel { margin-bottom: 18px; }
.section-title { display: flex; gap: 13px; align-items: flex-start; margin-bottom: 22px; }
.section-title > span { width: 32px; height: 32px; display: grid; place-items: center; background: var(--mint); color: var(--green-2); border-radius: 9px; font-weight: 800; font-size: 11px; }
.section-title h2 { color: var(--navy); margin: 0 0 3px; font-size: 18px; }.section-title p { color: var(--muted); margin: 0; font-size: 12px; }
.form-grid { display: grid; gap: 16px; }.form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }.form-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.span-2 { grid-column: span 2; }.span-4 { grid-column: span 4; }
.field { display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
.field input, .field select, .field textarea, .summary-strip input { width: 100%; border: 1px solid #d5dfda; border-radius: 8px; background: #fbfcfb; color: var(--ink); padding: 11px 12px; outline: none; font-weight: 500; font-size: 14px; }
.field input:focus, .field select:focus, .field textarea:focus, .summary-strip input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(22,135,93,.1); background: white; }
.field textarea { resize: vertical; }
.summary-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.summary-strip > * { margin: 0; min-height: 92px; border: 1px solid var(--line); border-radius: 13px; background: white; padding: 15px; display: flex; flex-direction: column; gap: 8px; color: var(--muted); font-size: 11px; font-weight: 700; }
.summary-strip strong { color: var(--navy); font-size: 21px; margin-top: 8px; }
.summary-strip input { padding: 8px 9px; }
.daily-entry { border-top: 4px solid var(--green); }
.daily-entry-grid { display: grid; grid-template-columns: 140px minmax(220px, 1.5fr) minmax(170px, 1fr) minmax(160px, 1fr); gap: 15px; align-items: end; }
.daily-description { grid-column: span 2; }
.daily-notes { grid-column: span 2; }
.daily-add { min-height: 43px; }
.daily-summary { margin-top: 18px; }
.daily-table-head { padding: 22px 24px 0; margin-bottom: 18px; align-items: end; }
.period-filter { display: grid; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 700; }
.period-filter select { border: 1px solid #d5dfda; border-radius: 8px; background: white; color: var(--ink); padding: 9px 34px 9px 10px; font-size: 13px; }
.table-panel { overflow: hidden; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 860px; }
th { padding: 14px 12px; background: var(--navy); color: white; text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
td { padding: 10px 8px; border-bottom: 1px solid #e9eeeb; background: white; }
tbody tr:nth-child(odd) td { background: #f7fbf9; }
td input, td select { width: 100%; min-width: 85px; border: 1px solid #d8e1dd; border-radius: 6px; padding: 8px; background: white; color: var(--ink); }
.cell-output { color: var(--navy); font-weight: 750; font-size: 12px; white-space: nowrap; }
.status-badge { display: inline-block; border-radius: 999px; padding: 6px 9px; background: var(--mint); color: var(--green-2); font-size: 10px; font-weight: 800; white-space: nowrap; }
.status-badge.warning { background: #fff0c9; color: #915d00; }.status-badge.danger { background: #ffe0e0; color: #9e3030; }
.delete-row { width: 30px; height: 30px; border: 0; border-radius: 7px; background: #f1f4f2; color: #8c9993; font-weight: 800; }.delete-row:hover { background: #ffe5e5; color: var(--red); }

.report-sheet { background: white; border: 1px solid var(--line); border-radius: 16px; padding: 34px; box-shadow: var(--shadow); }
.report-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 3px solid var(--green); padding-bottom: 20px; margin-bottom: 22px; }
.report-head span { color: var(--green); font-size: 10px; font-weight: 800; letter-spacing: .1em; }.report-head h2 { color: var(--navy); font-size: 28px; margin: 6px 0 0; }.report-head > strong { color: var(--muted); font-size: 12px; }
.report-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 26px; }.report-kpis > div { padding: 16px; border-radius: 10px; background: var(--mint-soft); }.report-kpis span, .report-kpis strong { display: block; }.report-kpis span { color: var(--muted); font-size: 10px; }.report-kpis strong { color: var(--navy); margin-top: 7px; }
.report-columns { display: grid; grid-template-columns: .8fr 1.2fr; gap: 28px; margin-bottom: 24px; }.report-columns h3 { color: var(--navy); font-size: 15px; }.report-columns dl { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin: 0; }.report-columns dt { color: var(--muted); font-size: 10px; }.report-columns dd { margin: 2px 0 0; color: var(--navy); font-weight: 700; font-size: 12px; }.report-category { display: grid; grid-template-columns: 1fr 100px 100px; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 12px; }.report-category strong { text-align: right; }
.report-notes { margin-bottom: 18px; }.report-checklist { display: flex; flex-wrap: wrap; gap: 16px; color: var(--muted); font-size: 12px; }
.toast { position: fixed; right: 24px; bottom: 24px; padding: 12px 16px; background: var(--navy); color: white; border-radius: 10px; font-size: 13px; box-shadow: var(--shadow); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s ease; z-index: 50; }.toast.show { opacity: 1; transform: none; }

@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 84px minmax(0,1fr); }
  .sidebar { padding: 24px 12px; }
  .brand { padding-inline: 9px; }.brand div, .nav-item:not(.active) { font-size: 0; }.brand-mark { width: 40px; }
  .nav-item { justify-content: center; padding: 14px 8px; }.nav-item span { font-size: 10px; }.nav-item.active { font-size: 0; }
  .sidebar-status { display: none; }
  .kpi-grid { grid-template-columns: repeat(2,1fr); }
  .form-grid.cols-4 { grid-template-columns: repeat(2,1fr); }.span-4 { grid-column: span 2; }
  .daily-entry-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .daily-description, .daily-notes { grid-column: span 1; }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; left: -270px; width: 250px; transition: .25s ease; }.sidebar.open { left: 0; box-shadow: 18px 0 40px rgba(19,42,58,.24); }
  .brand div { display: block; }.nav-item, .nav-item.active, .nav-item:not(.active) { justify-content: flex-start; font-size: 14px; }.sidebar-status { display: flex; }
  .topbar { height: auto; min-height: 72px; padding: 12px 16px; flex-wrap: wrap; }.menu-btn { display: block; border: 1px solid var(--line); background: white; border-radius: 8px; padding: 8px 10px; }.project-identity { flex: 1; }.top-actions { width: 100%; overflow-x: auto; padding-bottom: 2px; }.top-actions .btn { white-space: nowrap; }
  .view { padding: 28px 16px 44px; }.page-heading { align-items: flex-start; flex-direction: column; }.page-heading .btn { align-self: stretch; }
  .kpi-grid, .dashboard-grid, .summary-strip, .form-grid.cols-3, .form-grid.cols-4, .report-kpis, .report-columns { grid-template-columns: 1fr; }.span-2, .span-4 { grid-column: span 1; }
  .daily-entry-grid { grid-template-columns: 1fr; }.daily-description, .daily-notes { grid-column: span 1; }
  .alert-grid { grid-template-columns: 1fr; }.bar-row { grid-template-columns: 100px minmax(0,1fr); }.bar-row strong { display: none; }
  .report-sheet { padding: 20px; }.report-head { gap: 12px; }.report-kpis { grid-template-columns: repeat(2,1fr); }.report-category { grid-template-columns: 1fr 80px; }.report-category strong:last-child { display: none; }
}

@media print {
  body { background: white; }
  .sidebar, .topbar, .page-heading, .view:not(#report), .toast { display: none !important; }
  .app-shell, .main { display: block; }
  #report { display: block !important; padding: 0; }
  .report-sheet { box-shadow: none; border: 0; padding: 12mm; }
  .report-notes textarea { border: 1px solid #ccc; }
  @page { size: A4 landscape; margin: 8mm; }
}
