:root {
  --bg: #eef1f4;
  --panel: #ffffff;
  --ink: #111827;
  --muted: #5c6674;
  --accent: #1f7a6d;
  --accent-dark: #155f56;
  --warn: #b42318;
  --border: #d6dde6;
  --shadow: 0 18px 48px rgba(17, 24, 39, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", "Manrope", sans-serif;
  color: var(--ink);
  padding: 28px 28px 60px;
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 10% 10%, rgba(31, 122, 109, 0.14) 0%, transparent 45%),
    radial-gradient(circle at 90% 15%, rgba(15, 118, 110, 0.1) 0%, transparent 38%),
    repeating-linear-gradient(0deg, rgba(15, 23, 42, 0.05) 0, rgba(15, 23, 42, 0.05) 1px, transparent 1px, transparent 44px),
    repeating-linear-gradient(90deg, rgba(15, 23, 42, 0.05) 0, rgba(15, 23, 42, 0.05) 1px, transparent 1px, transparent 44px),
    linear-gradient(180deg, #f7f9fb 0%, #eef1f4 100%);
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-bottom: 22px;
}

.site-header h1 {
  margin: 0 0 6px;
  font-size: 30px;
  letter-spacing: -0.02em;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.subtle {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
  animation: lift 0.35s ease both;
}

.panel h2,
.panel h3 {
  margin-top: 0;
}

.panel-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
}

.card {
  background: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.card strong {
  font-size: 20px;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.filter-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  align-items: end;
}

.filter-form label {
  font-size: 12px;
  color: var(--muted);
  display: block;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.filter-form input,
.filter-form select {
  width: 100%;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-family: inherit;
  background: #fff;
}

.filter-form input:focus,
.filter-form select:focus {
  outline: 2px solid rgba(31, 122, 109, 0.25);
  border-color: rgba(31, 122, 109, 0.5);
}

.filter-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.public-filter-form {
  align-items: stretch;
}

.preset-actions {
  display: flex;
  gap: 10px;
  align-items: end;
  flex-wrap: wrap;
}

.preset-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 8px 20px rgba(31, 122, 109, 0.2);
}

.custom-day-actions {
  display: grid;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 16px;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(31, 122, 109, 0.2);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.btn:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(31, 122, 109, 0.25);
}

.btn.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--ink);
  box-shadow: none;
}

.btn.danger {
  background: #b42318;
  box-shadow: 0 8px 20px rgba(180, 35, 24, 0.2);
}

.btn.danger:hover {
  background: #8f1c13;
  box-shadow: 0 10px 24px rgba(180, 35, 24, 0.25);
}

.btn.small {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 8px;
}

.notice {
  padding: 12px 16px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-weight: 600;
}

.notice.success {
  background: #e6f6f4;
  color: #0f3d3a;
  border: 1px solid #b7e4df;
}

.notice.error {
  background: #fde8e8;
  color: #7a1c1c;
  border: 1px solid #f5bcbc;
}

.table-wrap {
  overflow-x: auto;
}

.table-wrap table {
  width: 100%;
  border-collapse: collapse;
}

.table-wrap th,
.table-wrap td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 13px;
  line-height: 1.2;
}

.table-wrap th {
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 11px;
}

.table-wrap tbody tr:hover {
  background: #f7fafc;
}

.table-input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 12px;
}

.inline-form {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.actions-cell {
  white-space: nowrap;
}

table.sortable th.sortable {
  cursor: pointer;
  position: relative;
  padding-right: 24px;
}

table.sortable th.sortable::after {
  content: '^v';
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  color: var(--muted);
}

table.sortable th.sortable[data-sort-dir="asc"]::after {
  content: '^';
}

table.sortable th.sortable[data-sort-dir="desc"]::after {
  content: 'v';
}

.status-bad {
  background: #fff0f0;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 11px;
}

.status-red {
  background: #fee2e2;
  color: #b42318;
}

.status-orange {
  background: #ffedd5;
  color: #c2410c;
}

.status-yellow {
  background: #fef9c3;
  color: #a16207;
}

.status-green {
  background: #dcfce7;
  color: #166534;
}

.status-none {
  background: #e5e7eb;
  color: #4b5563;
}

.bph-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 11px;
}

.bph-red {
  background: #fee2e2;
  color: #b42318;
}

.bph-orange {
  background: #ffedd5;
  color: #c2410c;
}

.bph-yellow {
  background: #fef9c3;
  color: #a16207;
}

.bph-green {
  background: #dcfce7;
  color: #166534;
}

.bph-none {
  background: #e5e7eb;
  color: #4b5563;
}

.total-row td {
  font-weight: 600;
  background: #f1f4f8;
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.upload-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.upload-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 14px;
  display: grid;
  gap: 10px;
}

.header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.auth-page,
.public-page {
  padding-top: 36px;
}

.auth-shell {
  min-height: calc(100vh - 72px);
  display: grid;
  place-items: center;
}

.auth-panel {
  width: min(460px, 100%);
  padding: 26px;
}

.auth-copy {
  margin-bottom: 18px;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form label {
  font-size: 12px;
  color: var(--muted);
  display: block;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.auth-form input {
  width: 100%;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-family: inherit;
  background: #fff;
}

.auth-form input:focus {
  outline: 2px solid rgba(31, 122, 109, 0.25);
  border-color: rgba(31, 122, 109, 0.5);
}

.auth-form .btn {
  width: 100%;
}

.public-header {
  margin-bottom: 18px;
}

@keyframes lift {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  body {
    padding: 18px;
  }

  .site-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .cards {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }
}
