:root {
  --bg: #f5f5f3;
  --panel: #ffffff;
  --ink: #1d1d1b;
  --muted: #7a7a73;
  --line: #e2e1dc;
  --accent: #2f5d3a;
  --accent-ink: #ffffff;
  --danger: #a33a2b;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px;
  flex: 0 0 232px;
  background: #23261f;
  color: #e8e6df;
  display: flex;
  flex-direction: column;
  padding: 20px 0;
}

.brand {
  padding: 0 20px 20px;
  font-size: 17px;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.brand span {
  display: block;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #a8a79b;
  font-weight: 400;
  margin-top: 2px;
}

.nav { display: flex; flex-direction: column; }
.nav a {
  color: #d9d7cd;
  padding: 9px 20px;
  border-left: 3px solid transparent;
}
.nav a:hover { background: #2c3027; text-decoration: none; }
.nav a.active { background: #2c3027; border-left-color: #7fa86f; color: #fff; }

.me {
  margin-top: auto;
  padding: 16px 20px 0;
  border-top: 1px solid #33372e;
  font-size: 13px;
}
.me-name { font-weight: 600; }
.me-role { color: #a8a79b; font-size: 12px; margin-bottom: 6px; }

.content { flex: 1; padding: 28px 32px 60px; min-width: 0; }
.content.solo { display: flex; align-items: center; justify-content: center; }

.login-box {
  background: var(--panel);
  padding: 36px 32px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  width: 340px;
}
.login-box h1 { font-size: 19px; margin: 0 0 4px; }

.page-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.page-head h1 { font-size: 22px; margin: 0; font-weight: 600; }
.page-head .actions { display: flex; gap: 8px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 20px;
}
.panel h2 { font-size: 15px; margin: 0 0 12px; font-weight: 600; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 24px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.card .k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.card .v { font-size: 24px; font-weight: 600; margin-top: 4px; }
.card .v .sub, .card .sub { font-size: 12px; font-weight: 400; color: var(--muted); }

table.grid { width: 100%; border-collapse: collapse; }
table.grid th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 500;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.grid td { padding: 9px 10px; border-bottom: 1px solid #f0efeb; vertical-align: top; }
table.grid tr:last-child td { border-bottom: none; }
table.grid tr.archived td { color: var(--muted); text-decoration: line-through; }
table.grid.small td, table.grid.small th { padding: 6px 8px; font-size: 13px; }

.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filters input[type=text] { min-width: 240px; }

input, select, textarea {
  font: inherit;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #c9dcc4; outline-offset: 0; border-color: #9dbb92; }
label { display: block; font-size: 13px; color: #4a4a44; }
label input, label select, label textarea { margin-top: 4px; }
label.check { display: flex; align-items: center; gap: 7px; }
label.check input { width: auto; margin: 0; }

.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .span2 { grid-column: span 2; }
.form-grid .actions { display: flex; gap: 8px; }

.stack { display: flex; flex-direction: column; gap: 12px; }

.btn {
  display: inline-block;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: #f2f1ec; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #274d30; }
.btn.danger { color: var(--danger); border-color: #e6cfca; }
.btn.danger:hover { background: #fbf1ef; }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn.link, .link { background: none; border: none; padding: 0; color: #d9d7cd; cursor: pointer; font: inherit; }
.link:hover { color: #fff; }

form.inline { display: inline; }

.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; }
.alert.error { background: #fbf1ef; border: 1px solid #e6cfca; color: #7d2b1f; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; background: #eceae4; }
.badge.draft { background: #fdf3d9; color: #7a5b12; }
.badge.posted { background: #e6f0e2; color: #2f5d3a; }
.badge.cancelled { background: #f6e3e0; color: #8a3324; }

@media print {
  .sidebar, .filters, .actions, .btn { display: none !important; }
  body { background: #fff; }
  .content { padding: 0; }
  .panel { border: none; padding: 0; }
  table.grid th { border-bottom: 1px solid #999; }
}
