:root {
  --bg: #f3f1ec;
  --ink: #1c2430;
  --muted: #5d6b7c;
  --line: #d7d2c8;
  --panel: #fffdf8;
  --accent: #0f6a62;
  --accent-ink: #083833;
  --danger: #b42318;
  --warn: #9a6700;
  --ok: #067647;
  --shadow: 0 10px 30px rgba(28, 36, 48, 0.08);
  --radius: 18px;
  --font: "Segoe UI", "Candara", "Gill Sans", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(15, 106, 98, 0.10), transparent 34%),
    linear-gradient(180deg, #efeae2 0%, var(--bg) 45%, #ebe7df 100%);
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.shell {
  width: min(1400px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.topbar {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.brand h1 {
  margin: 0;
  font-size: clamp(1.5rem, 2vw, 2rem);
  letter-spacing: -0.03em;
}
.brand p {
  margin: 6px 0 0;
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.btn, button, .nav a {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 10px 16px;
  font: inherit;
  cursor: pointer;
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.btn-primary, button.primary {
  background: var(--accent);
  color: white;
}
.btn-secondary {
  background: #e7f3f1;
  color: var(--accent-ink);
  border-color: #b9d9d4;
}
.btn-ghost {
  background: transparent;
  box-shadow: none;
  border-color: var(--line);
}
button:disabled { opacity: 0.55; cursor: not-allowed; }

.nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.nav a.active {
  background: var(--accent-ink);
  color: white;
}
.badge {
  display: inline-flex;
  min-width: 1.5rem;
  justify-content: center;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 999px;
  background: #f4d0cb;
  color: var(--danger);
  font-size: 0.85rem;
}

.panel {
  background: var(--panel);
  border: 1px solid rgba(215, 210, 200, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.meta .card {
  background: rgba(255, 253, 248, 0.85);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
}
.meta .card strong {
  display: block;
  font-size: 1.2rem;
  margin-top: 4px;
}
.meta .card span { color: var(--muted); font-size: 0.92rem; }

.flash {
  margin-bottom: 16px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid;
}
.flash.ok { background: #e8f8ef; border-color: #abefc6; color: var(--ok); }
.flash.err { background: #fee4e2; border-color: #fecdca; color: var(--danger); }

.table-wrap { overflow: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}
th, td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 0.95rem;
}
th {
  position: sticky;
  top: 0;
  background: #f7f3eb;
  color: var(--muted);
  font-weight: 600;
}
tr:hover td { background: rgba(15, 106, 98, 0.04); }

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  background: #eceff3;
}
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
}
.status.серый { color: #667085; background: #eceff3; }
.status.красный { color: #b42318; background: #fee4e2; }
.status.оранжевый { color: #b54708; background: #fef0c7; }
.status.желтый { color: #854d0e; background: #fef9c3; }
.status.синий { color: #175cd3; background: #d1e9ff; }
.status.фиолетовый { color: #6941c6; background: #ebe9fe; }
.status.зеленый { color: #067647; background: #dcfae6; }

.filters { margin-bottom: 12px; }
.filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}
.filter-form label {
  display: grid;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--muted);
  min-width: 160px;
}
.filter-form input,
.filter-form select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  font: inherit;
  background: white;
}
.hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}
.block-reason { color: #b42318; font-size: 0.85rem; }
.tiny { font-size: 0.85rem; margin-top: 4px; color: var(--muted); }
tfoot td {
  border-top: 2px solid var(--line);
  background: rgba(15, 106, 98, 0.06);
}

.pay-form {
  display: grid;
  gap: 6px;
  min-width: 220px;
}
.pay-form input, .pay-form select, .searchbar input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  font: inherit;
  background: white;
}
.pay-form button { width: 100%; margin-top: 4px; }

.our-comment-cell { min-width: 220px; }
.our-comment-form { display: grid; gap: 6px; }
.our-comment-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  font: inherit;
  background: white;
  resize: vertical;
}
.our-comment-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.our-comment-actions select,
.our-comment-actions input[type=password] {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 8px;
  font: inherit;
  background: white;
}
.our-comment-actions button { padding: 6px 12px; }

.searchbar {
  display: flex;
  gap: 8px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}
.searchbar input { flex: 1; }

.empty {
  padding: 36px 20px;
  text-align: center;
  color: var(--muted);
}

.footer-note {
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.92rem;
}

@media (max-width: 720px) {
  .topbar { flex-direction: column; }
  .actions { justify-content: flex-start; }
  .shell { width: calc(100% - 20px); }
}

.shell-wide { width: min(1680px, calc(100% - 24px)); }
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  margin: 12px 0 16px;
}
.presets, .filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters input, .login-box input, .toolbar input {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  font: inherit;
  background: var(--panel);
}
.login-box label { display: block; margin: 12px 0 4px; color: var(--muted); font-size: .9rem; }
.user-chip {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 999px;
  background: #e7f3f1;
  color: var(--accent-ink);
  font-size: .9rem;
}
.meta-line { color: var(--muted); font-size: .9rem; }
.col-edit { background: #f0faf6 !important; }
#grid, #errors-grid, #delta-grid {
  background: var(--panel);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.tabulator { font-size: 13px; border: none !important; }
.tabulator .tabulator-header { background: #eef6f4 !important; }
