:root {
  --bg: #f3efe6;
  --bg-2: #ebe4d6;
  --ink: #1c1914;
  --muted: #6b6458;
  --line: #d7cfc0;
  --paper: #fbf8f1;
  --accent: #2a5a46;
  --accent-2: #c45c26;
  --danger: #9b2c2c;
  --own: #2a5a46;
  --clients: #2c4c7a;
  --me: #7a4a1f;
  --family: #6a3d6a;
  --shadow: 0 10px 30px rgba(28, 25, 20, 0.08);
  --radius: 14px;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { min-height: 100vh; display: grid; grid-template-columns: 220px 1fr; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; }

.side {
  background: #1c1914;
  color: #f3efe6;
  padding: 28px 18px;
  min-height: 100vh;
  position: sticky;
  top: 0;
}
.side .brand { font-size: 1.15rem; letter-spacing: 0.04em; margin: 0 0 6px; }
.side .brand a { color: inherit; text-decoration: none; }
.side .brand a:hover { text-decoration: none; opacity: 0.82; }
.side .sub { color: #b7af9f; font-size: 0.82rem; margin-bottom: 28px; }
.side nav a {
  display: block;
  color: #f3efe6;
  padding: 7px 10px;
  border-radius: 8px;
  margin-bottom: 2px;
}
.side nav a:hover, .side nav a.active { background: #2f2a23; text-decoration: none; }
.side .meta { margin-top: 36px; color: #b7af9f; font-size: 0.8rem; line-height: 1.45; }

.main { padding: 28px 36px 64px; max-width: 1100px; }
.top { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; margin-bottom: 22px; }
h1 { font-size: 1.8rem; font-weight: 600; margin: 0; letter-spacing: -0.02em; }
h2 { font-size: 1.15rem; margin: 28px 0 12px; }
.muted { color: var(--muted); }

.notice {
  background: #e7f0ea;
  border: 1px solid #c9ddd2;
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
}

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 16px;
}

.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.stack { display: grid; gap: 10px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 0.82rem; letter-spacing: 0.04em; text-transform: uppercase; }

input, select, textarea, button {
  font: inherit;
  color: var(--ink);
}
input, select, textarea {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  width: 100%;
}
textarea { min-height: 120px; }
label { display: grid; gap: 4px; font-size: 0.88rem; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

button, .btn {
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  display: inline-block;
}
button.secondary, .btn.secondary { background: #3d3830; }
button.ghost, .btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
button.danger, .btn.danger { background: var(--danger); }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  background: var(--bg-2);
}
.badge.own { background: #dce8e2; color: var(--own); }
.badge.clients { background: #dce4f0; color: var(--clients); }
.badge.me { background: #f0e4d4; color: var(--me); }
.badge.family { background: #eadcea; color: var(--family); }
.badge.emergency { background: #f3d6d6; color: var(--danger); }

.see-also { margin-top: 28px; }
.see-also h2 { margin: 0 0 8px; font-size: 0.95rem; color: var(--muted); }
.see-also ul { margin: 0; padding: 0; list-style: none; }
.see-also li { margin: 0 0 4px; }

.filters a, .filters span { margin-right: 10px; }
.filters a.active, .filters span.active { font-weight: 700; color: var(--ink); }
.filters span.active { cursor: default; }
.date-input { width: auto; }

.timer { font-size: 3.4rem; font-weight: 300; letter-spacing: -0.04em; line-height: 1; }
.desktop-row { display: grid; grid-template-columns: 18px 1fr auto auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.handle { cursor: grab; color: var(--muted); }
.dim { opacity: 0.45; }

.time-table, .edit-table { table-layout: fixed; }
.time-table th:nth-child(1), .time-table td:nth-child(1),
.time-table th:nth-child(2), .time-table td:nth-child(2) { width: 22%; }
.time-table th:nth-child(4), .time-table td:nth-child(4) { width: 8.5rem; }
.time-table th:nth-child(5), .time-table td:nth-child(5) { width: 7.5rem; }
.edit-table th:nth-child(2), .edit-table td:nth-child(2) { width: 12rem; }
.edit-table th:nth-child(3), .edit-table td:nth-child(3) { width: 14rem; }
.edit-table th:nth-child(4), .edit-table td:nth-child(4) { width: 7.5rem; }
.time-table td, .edit-table td { vertical-align: middle; }
.time-table input, .time-table select,
.edit-table input, .edit-table select { width: 100%; min-width: 0; }
.time-table input.dt { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.88em; }
select[multiple] { min-height: 7.5rem; }
.row-actions {
  display: inline-flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  white-space: nowrap;
}
button.icon-btn, .btn.icon-btn {
  width: auto;
  min-width: 2rem;
  flex: 0 0 auto;
  padding: 6px 8px;
  border-radius: 8px;
  line-height: 1;
  font-size: 1rem;
}
button.icon-btn.danger, .btn.icon-btn.danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--line);
}
.time-table tr.downtime-row td { background: rgba(196, 92, 38, 0.06); }

.EasyMDEContainer { background: #fff; }
.editor-toolbar button {
  color: var(--ink);
  background: transparent;
  border-radius: 3px;
  padding: 0 6px;
}
@media (max-width: 860px) {
  body { grid-template-columns: 1fr; }
  .side { position: relative; min-height: auto; }
  .grid { grid-template-columns: 1fr; }
}
