:root {
  --ink: #1e2528;
  --muted: #667174;
  --line: #d8dfdf;
  --panel: #ffffff;
  --paper: #f5f7f4;
  --soft: #eef3ef;
  --accent: #246a73;
  --red: #b42318;
  --green: #227a4c;
  --gold: #b7791f;
  --shadow: 0 14px 34px rgba(31, 42, 44, 0.08);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--paper); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
.app-shell { display: grid; grid-template-columns: 280px minmax(0, 1fr); min-height: 100vh; }
.guest-shell { grid-template-columns: 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 24px 18px; border-right: 1px solid var(--line); background: #fbfcfa; display: flex; flex-direction: column; gap: 24px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 42px; height: 42px; border-radius: 8px; display: grid; place-items: center; background: var(--accent); color: #fff; font-weight: 800; }
.brand span, .sidebar-panel span, label, .metric-label, .metric-note, small { display: block; color: var(--muted); font-size: 12px; }
.nav { display: grid; gap: 6px; }
.nav-item { min-height: 42px; padding: 10px 12px; border: 1px solid transparent; border-radius: 8px; }
.nav-item.active, .nav-item:hover { border-color: var(--line); background: var(--soft); }
.sidebar-panel, .panel, .metric, .login-card, .notice { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); box-shadow: var(--shadow); }
.sidebar-panel { margin-top: auto; padding: 14px; }
.link-button { margin-top: 10px; padding: 0; border: 0; background: transparent; color: var(--accent); font-weight: 700; cursor: pointer; }
.main { min-width: 0; padding: 26px; display: grid; gap: 18px; align-content: start; }
.login-main { min-height: 100vh; display: grid; place-items: center; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 28px; line-height: 1.2; }
h2 { margin-bottom: 14px; font-size: 18px; }
.topbar p, .login-card p { margin-top: 5px; color: var(--muted); }
.notice { padding: 12px 14px; border-color: #d8c383; background: #fff8dc; }
.notice.bad { border-color: #f1b8b4; background: #fdebea; }
.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric, .panel, .login-card { padding: 18px; }
.metric-value { display: block; margin: 8px 0 4px; font-size: 26px; }
.grid-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 1fr); gap: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 12px; align-items: end; }
.form-grid.one { grid-template-columns: 1fr; }
.field input, .field select, label input, label select, .week-picker input { width: 100%; min-height: 40px; margin-top: 6px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.btn { min-height: 38px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); cursor: pointer; }
.btn.primary { border-color: var(--accent); background: var(--accent); color: #fff; }
.btn.danger { border-color: #f1b8b4; color: var(--red); }
.btn.mini { min-height: 32px; padding: 5px 8px; font-size: 12px; }
.actions, .inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.row-actions { display: inline-flex; flex-wrap: nowrap; align-items: center; gap: 8px; min-width: 174px; white-space: nowrap; }
.row-actions form { margin: 0; }
.row-actions .btn { min-height: 34px; padding: 6px 10px; white-space: nowrap; }
.timesheet-tools { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; white-space: nowrap; }
th { color: var(--muted); font-size: 12px; }
td input, td select { width: 100%; min-width: 88px; min-height: 34px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.empty-row { padding: 28px; color: var(--muted); text-align: center; }
.status { display: inline-flex; min-height: 24px; align-items: center; padding: 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--soft); }
.status.good { background: #e8f5ee; color: var(--green); }
.status.warn { background: #fff6df; color: var(--gold); }
.status.bad { background: #fdebea; color: var(--red); }
.save-bar { display: flex; justify-content: flex-end; padding-top: 14px; }
.rate-grid { display: grid; grid-template-columns: repeat(2, minmax(240px, 1fr)); gap: 10px; margin: 16px 0; }
.rate-row { display: grid; grid-template-columns: minmax(0, 1fr) 120px; gap: 12px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.login-card { width: min(440px, calc(100vw - 32px)); }
@media (max-width: 980px) {
  .app-shell, .grid-two { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .metrics-grid, .form-grid, .rate-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .main { padding: 16px; }
  .topbar, .metrics-grid, .form-grid, .rate-grid, .rate-row { display: grid; grid-template-columns: 1fr; }
}
