:root {
  --ink: #f4efe4;
  --ink-dim: #c9c2b3;
  --bg: #1b201d;
  --bg-panel: #242a25;
  --bg-panel-raised: #2c332d;
  --line: #3a4139;
  --amber: #e8a33d;
  --amber-dim: #a97729;
  --teal: #4d9a83;
  --teal-dim: #2f5f50;
  --red: #d0685a;
  --radius: 10px;
  --mono: 'JetBrains Mono', 'Courier New', monospace;
  --sans: 'Inter', 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-image:
    radial-gradient(circle at 15% 10%, rgba(232,163,61,0.05), transparent 40%),
    radial-gradient(circle at 85% 90%, rgba(77,154,131,0.06), transparent 40%);
}

button, input, select, textarea { font-family: inherit; }

a { color: var(--amber); }

.hidden { display: none !important; }

/* ---- Layout shell ---- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-panel);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar .brand {
  font-family: var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 13px;
  color: var(--amber);
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.brand .venue-name {
  color: var(--ink);
  text-transform: none;
  letter-spacing: normal;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 16px;
}

.venue-switcher {
  background: var(--bg-panel-raised);
  border: 1px solid var(--line);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 700;
  font-size: 15px;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.venue-switcher:focus { outline: 2px solid var(--amber); }

.user-chip {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-dim);
  border: 1px solid var(--line);
  padding: 6px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.topbar nav { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

.tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink-dim);
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.tab-btn.active {
  background: var(--bg-panel-raised);
  border-color: var(--line);
  color: var(--amber);
}
.tab-btn:hover { color: var(--ink); }

.logout-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-dim);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}
.logout-btn:hover { border-color: var(--red); color: var(--red); }

main { max-width: 780px; margin: 0 auto; padding: 22px 18px 80px; }

/* ---- Login ---- */

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px 28px;
}

.login-card .mark {
  font-family: var(--mono);
  color: var(--amber);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 12px;
  margin-bottom: 4px;
}

.login-card h1 {
  margin: 0 0 22px;
  font-size: 22px;
}

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 12px;
  color: var(--ink-dim);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.field input, .field select, .field textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 8px;
  padding: 12px 12px;
  font-size: 15px;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--amber);
  outline-offset: 1px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--amber);
  color: #1b1610;
  border: none;
  padding: 12px 18px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
}
.btn:hover { background: #f3ae4d; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn.secondary:hover { border-color: var(--amber); color: var(--amber); }
.btn.danger { background: var(--red); color: #2a1210; }
.btn.full { width: 100%; }

.error-msg {
  background: rgba(208,104,90,0.12);
  border: 1px solid var(--red);
  color: #f0a99f;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 14px;
}

/* ---- Date bar ---- */

.date-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.date-bar .date-label {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--ink-dim);
}
.date-bar .date-label strong { color: var(--ink); font-family: var(--sans); font-size: 16px; }
.date-nav { display: flex; gap: 6px; }
.date-nav button {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  color: var(--ink);
  width: 34px; height: 34px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
}
.date-nav button:hover { border-color: var(--amber); }

.progress-strip {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 20px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-dim);
}
.progress-track {
  flex: 1; height: 6px; border-radius: 3px; background: var(--bg-panel-raised); overflow: hidden;
}
.progress-fill { height: 100%; background: var(--teal); }

/* ---- Category sections ---- */

.category-block { margin-bottom: 26px; }
.category-title {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 12px;
  color: var(--amber-dim);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.category-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* ---- Task card ---- */

.task-card {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  transition: border-color 0.15s ease;
}
.task-card.done {
  border-color: var(--teal-dim);
  background: linear-gradient(180deg, rgba(77,154,131,0.08), transparent 60%), var(--bg-panel);
}

.check-btn {
  flex-shrink: 0;
  width: 42px; height: 42px;
  border-radius: 10px;
  border: 2px solid var(--line);
  background: var(--bg);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: transparent;
  font-size: 20px;
  margin-top: 2px;
}
.check-btn:hover { border-color: var(--amber); }
.task-card.done .check-btn {
  background: var(--teal);
  border-color: var(--teal);
  color: #0d201a;
}

.task-body { flex: 1; min-width: 0; }
.task-title-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
}
.task-title { font-weight: 700; font-size: 15.5px; }
.task-time { font-family: var(--mono); font-size: 12px; color: var(--ink-dim); white-space: nowrap; }
.task-desc { font-size: 13.5px; color: var(--ink-dim); margin-top: 3px; }

.task-meta {
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--teal);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.photo-badge {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--amber-dim);
  font-family: var(--sans);
  font-size: 11.5px;
  border: 1px solid var(--line);
  padding: 2px 8px;
  border-radius: 999px;
}
.thumb {
  width: 44px; height: 44px; border-radius: 6px; object-fit: cover;
  border: 1px solid var(--line);
  cursor: pointer;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-dim);
}
.empty-state .big { font-size: 36px; margin-bottom: 10px; }

/* ---- Review: week of day-blocks ---- */

.day-block {
  margin-bottom: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.day-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-panel-raised);
  cursor: pointer;
}
.day-block-header .day-title {
  font-weight: 700;
  font-size: 14.5px;
}
.day-block-header .day-title .today-flag {
  color: var(--amber);
  font-family: var(--mono);
  font-size: 11px;
  margin-left: 8px;
}
.day-block-header .day-stat {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink-dim);
}
.day-block-header .day-stat.all-done { color: var(--teal); }
.day-block-header .day-stat.missed { color: var(--red); }
.day-block-body {
  padding: 12px 14px;
  background: var(--bg-panel);
}
.day-block-body.collapsed { display: none; }
.day-block-empty {
  color: var(--ink-dim);
  font-size: 13px;
  padding: 6px 2px;
}

/* ---- Modal (complete task) ---- */

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 100;
}
.modal {
  background: var(--bg-panel-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%; max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal h2 { margin: 0 0 4px; font-size: 18px; }
.modal .sub { color: var(--ink-dim); font-size: 13px; margin-bottom: 18px; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions .btn { flex: 1; }

.file-drop {
  border: 1.5px dashed var(--line);
  border-radius: 10px;
  padding: 18px;
  text-align: center;
  color: var(--ink-dim);
  font-size: 13px;
  cursor: pointer;
}
.file-drop.has-file { border-color: var(--teal); color: var(--teal); }
.file-drop input { display: none; }
.preview-img {
  max-width: 100%; max-height: 160px; border-radius: 8px; margin-top: 10px;
}

/* ---- Admin: manage tasks ---- */

.admin-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px;
}
.template-card {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
}
.template-card.inactive { opacity: 0.5; }
.template-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.template-title { font-weight: 700; font-size: 15px; }
.template-tags { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.tag {
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--ink-dim);
}
.tag.freq { color: var(--amber); border-color: var(--amber-dim); }
.template-actions { display: flex; gap: 6px; }
.icon-btn {
  background: transparent; border: 1px solid var(--line); color: var(--ink-dim);
  width: 32px; height: 32px; border-radius: 7px; cursor: pointer; font-size: 14px;
}
.icon-btn:hover { border-color: var(--amber); color: var(--amber); }
.icon-btn.danger:hover { border-color: var(--red); color: var(--red); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .span-2 { grid-column: span 2; }
@media (max-width: 480px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: span 1; }
}

.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: auto; }

.day-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.day-chip {
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink-dim);
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 12.5px;
  cursor: pointer;
}
.day-chip.selected { background: var(--amber); color: #1b1610; border-color: var(--amber); }

.hint { font-size: 12px; color: var(--ink-dim); margin-top: 4px; }

/* ---- Export ---- */

.export-form {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 20px;
}
.export-preview {
  overflow-x: auto;
}
.export-preview table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.export-preview th, .export-preview td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.export-preview th {
  color: var(--ink-dim);
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: 0.04em;
  font-family: var(--mono);
}
.export-preview .status-done { color: var(--teal); font-weight: 700; }
.export-preview .status-missed { color: var(--red); font-weight: 700; }
.export-preview .status-pending { color: var(--ink-dim); }
.export-summary {
  display: flex;
  gap: 20px;
  margin-bottom: 14px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink-dim);
}

/* ---- Repairs ---- */

.repair-card {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
}
.repair-card.resolved { opacity: 0.65; }
.repair-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.repair-title { font-weight: 700; font-size: 15px; }
.repair-desc { font-size: 13.5px; color: var(--ink-dim); margin-top: 4px; }
.repair-tags { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; align-items: center; }
.repair-meta { font-family: var(--mono); font-size: 11.5px; color: var(--ink-dim); margin-top: 8px; }
.repair-thumb { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line); cursor: pointer; margin-top: 8px; }
.repair-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

.priority-tag.low { color: var(--ink-dim); border-color: var(--line); }
.priority-tag.normal { color: var(--ink-dim); border-color: var(--line); }
.priority-tag.high { color: var(--amber); border-color: var(--amber-dim); }
.priority-tag.urgent { color: var(--red); border-color: var(--red); }

.status-tag.open { color: var(--red); border-color: var(--red); }
.status-tag.in_progress { color: var(--amber); border-color: var(--amber-dim); }
.status-tag.resolved { color: var(--teal); border-color: var(--teal-dim); }
