:root {
  --color-dark: #002C22;
  --color-primary: #004E46;
  --color-accent: #BE0064;
  --color-warm-gray: #EBDCD7;
  --color-light-yellow: #F8F9DF;
  --color-bg: #F5F1EE;
  --color-text: #1A1A1A;
  --color-text-muted: #666;
  --color-border: #DDD4CF;
  --color-captured: #004E46;
  --color-error-cell: #BE0064;
  --color-missing: #D8D0CB;
  --font-main: 'Instrument Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Fira Mono', monospace;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ========================================
   LOGIN
   ======================================== */

.login-overlay {
  position: fixed;
  inset: 0;
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.login-card {
  background: white;
  border-radius: 14px;
  padding: 44px 40px;
  width: 360px;
  box-shadow: 0 4px 32px rgba(0, 44, 34, 0.10);
  border: 1px solid var(--color-border);
}

.login-logo {
  font-size: 22px;
  font-weight: 600;
  color: var(--color-dark);
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.login-subtitle {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-bottom: 20px;
  line-height: 1.5;
}

.login-disclaimer {
  background: #fff8e6;
  border: 1px solid #f3d87a;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 22px;
  font-size: 12px;
  color: #5a4a10;
  line-height: 1.45;
}

.login-disclaimer strong {
  display: block;
  margin-bottom: 6px;
  color: #3a3000;
}

.login-disclaimer p {
  margin: 0;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid var(--color-border);
  border-radius: 8px;
  font-family: var(--font-main);
  font-size: 15px;
  color: var(--color-text);
  background: white;
  outline: none;
  transition: border-color 0.15s;
}

input[type="text"]:focus,
input[type="password"]:focus {
  border-color: var(--color-primary);
}

.error-message {
  color: var(--color-accent);
  font-size: 13px;
  margin-bottom: 10px;
  min-height: 20px;
}

/* ========================================
   BUTTONS
   ======================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 8px;
  font-family: var(--font-main);
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  white-space: nowrap;
  text-decoration: none;
}

.btn:hover { opacity: 0.85; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--color-primary);
  color: white;
}

.btn-accent {
  background: var(--color-accent);
  color: white;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.btn-ghost-dark {
  background: transparent;
  color: var(--color-primary);
  border: 1px solid var(--color-border);
}

.btn-full {
  width: 100%;
  padding: 11px 18px;
  font-size: 15px;
  margin-top: 4px;
}

.btn-sm {
  padding: 3px 8px;
  font-size: 12px;
  border-radius: 6px;
  line-height: 1;
}

.btn-icon {
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 50%;
  font-size: 15px;
  font-weight: 400;
  line-height: 1;
}

/* ========================================
   HEADER
   ======================================== */

.header {
  background: var(--color-dark);
  color: white;
  padding: 0 24px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 rgba(255,255,255,0.05);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.3px;
}

/* Date picker in header */
.date-picker {
  appearance: none;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.10);
  color: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 7px;
  padding: 5px 28px 5px 11px;
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
  outline: none;
  transition: background 0.15s, border-color 0.15s;
  /* Custom arrow */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='rgba(255,255,255,0.6)' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.date-picker:hover {
  background-color: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.35);
}

.date-picker option {
  background: #002C22;
  color: white;
  font-family: var(--font-mono);
}

.header-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

.next-capture-label {
  font-size: 11px;
  font-family: var(--font-mono);
  color: rgba(255, 255, 255, 0.45);
  white-space: nowrap;
}

/* ========================================
   MAIN CONTENT
   ======================================== */

.main-content {
  padding: 24px;
  max-width: none;
}

/* ========================================
   SITE MANAGEMENT
   ======================================== */

.site-management {
  background: white;
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 20px;
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  white-space: nowrap;
}

.sites-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  flex: 1;
}

.site-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--color-warm-gray);
  border-radius: 20px;
  padding: 4px 6px 4px 11px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-dark);
}

.site-tag .btn-icon {
  background: rgba(0, 44, 34, 0.12);
  color: var(--color-dark);
  font-size: 14px;
}

.site-tag .btn-icon:hover {
  background: var(--color-accent);
  color: white;
  opacity: 1;
}

.divider {
  width: 1px;
  height: 28px;
  background: var(--color-border);
  flex-shrink: 0;
}

.add-site-form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.add-site-form input {
  width: 200px;
  padding: 7px 11px;
  font-size: 13px;
}

/* ========================================
   STATUS TABLE
   ======================================== */

.table-section {
  background: white;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  overflow: hidden;
}

.table-wrapper {
  overflow-x: auto;
  overflow-y: visible;
}

.table-wrapper::-webkit-scrollbar {
  height: 7px;
}
.table-wrapper::-webkit-scrollbar-track {
  background: var(--color-bg);
}
.table-wrapper::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 4px;
}

.status-table {
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 11px;
}

/* Sticky site name column – header */
.status-table .col-site {
  background: var(--color-dark);
  color: rgba(255, 255, 255, 0.9);
  padding: 9px 20px;
  text-align: left;
  font-size: 11px;
  font-family: var(--font-main);
  font-weight: 500;
  position: sticky;
  left: 0;
  z-index: 20;
  min-width: 180px;
  white-space: nowrap;
  border-right: 2px solid rgba(255, 255, 255, 0.08);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

/* Hour header */
.status-table .hour-header {
  font-size: 10px;
  color: var(--color-text-muted);
  text-align: center;
  padding: 9px 0 6px;
  width: 44px;
  min-width: 44px;
  font-family: var(--font-mono);
  border-bottom: 2px solid var(--color-border);
  font-weight: 500;
}

.status-table .hour-header.current-hour {
  color: var(--color-accent);
  font-weight: 700;
}

/* Site name cell (body) */
.status-table .site-name-cell {
  padding: 10px 20px;
  font-size: 13px;
  font-family: var(--font-main);
  font-weight: 500;
  color: var(--color-dark);
  position: sticky;
  left: 0;
  background: white;
  z-index: 5;
  border-bottom: 6px solid var(--color-bg);
  border-right: 2px solid var(--color-border);
  white-space: nowrap;
  min-width: 180px;
}

/* Hour cell – tall enough for portrait thumbnails (~2:3 ratio at 44px wide) */
.status-table .hour-cell {
  width: 44px;
  min-width: 44px;
  height: 70px;
  text-align: center;
  vertical-align: middle;
  border-bottom: 6px solid var(--color-bg);
  border-right: 2px solid var(--color-bg);
  padding: 0;
  position: relative;
  overflow: hidden;
}

.status-table .hour-cell.current-time {
  background: rgba(248, 249, 223, 0.8);
}

.status-table .hour-cell.current-time .cell-dot.future {
  background: rgba(190, 0, 100, 0.15);
  outline: 1.5px solid rgba(190, 0, 100, 0.3);
  outline-offset: -1px;
}

.status-table .hour-cell.clickable {
  cursor: pointer;
}

/* Thumbnail hover: accent border */
.status-table .hour-cell.clickable:hover .cell-thumb {
  outline: 2px solid var(--color-accent);
  outline-offset: -2px;
  opacity: 0.85;
}

/* Dot hover (error/missing cells that are clickable) */
.status-table .hour-cell.clickable:hover .cell-dot {
  transform: scale(1.25);
  opacity: 0.9;
}

/* Screenshot thumbnail */
.cell-thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  transition: opacity 0.1s;
}

/* Cell dot indicator (error / missing / future) */
.cell-dot {
  display: block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  margin: auto;
  transition: transform 0.1s;
}

.cell-dot.captured {
  background: var(--color-captured);
}

.cell-dot.error {
  background: var(--color-error-cell);
}

.cell-dot.missing {
  background: var(--color-missing);
}

.cell-dot.future {
  background: #EDE7E3;
}

/* Yesterday columns – slightly muted header text */
.status-table .hour-header.hour-yesterday {
  color: #AAA;
  opacity: 0.65;
}

/* Vertical separator at midnight boundary */
.status-table .hour-header.hour-day-start,
.status-table .hour-cell.hour-day-start {
  border-left: 2px solid var(--color-border);
}

/* ---- Rolling 24h: date label row above hour numbers ---- */
.status-table .date-label-row th {
  padding: 5px 0 3px;
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.2px;
  border-bottom: none;
  background: var(--color-dark);
}

.status-table .date-label {
  color: rgba(255, 255, 255, 0.5);
}

.status-table .date-label-yesterday {
  color: rgba(255, 255, 255, 0.3);
}

.status-table .date-label-today {
  color: rgba(255, 255, 255, 0.7);
}

/* ========================================
   TABLE LEGEND
   ======================================== */

.table-legend {
  display: flex;
  gap: 18px;
  padding: 10px 20px;
  border-top: 1px solid var(--color-border);
  background: var(--color-bg);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--color-text-muted);
  font-family: var(--font-main);
}

.legend-item .cell-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* ========================================
   SITE TAG – INLINE DELETE CONFIRM
   ======================================== */

.site-tag-confirming {
  background: #FAE8EC;
  gap: 6px;
  padding: 4px 8px 4px 11px;
}

.site-tag-confirming span {
  font-size: 12px;
  color: var(--color-accent);
}

.confirm-delete {
  background: var(--color-accent) !important;
  color: white !important;
  font-size: 11px !important;
  width: auto !important;
  border-radius: 4px !important;
  padding: 2px 8px !important;
}

.cancel-delete {
  background: rgba(0,0,0,0.08) !important;
  color: var(--color-text-muted) !important;
  font-size: 11px !important;
}

/* ========================================
   PROGRESSIVE LOADING (detail page)
   ======================================== */

.site-column-body img { transition: filter 0.35s ease, transform 0.35s ease; }
.site-column-body img.thumb-loading {
  filter: blur(6px);
  transform: scale(1.02);
}

/* ========================================
   DETAIL PAGE
   ======================================== */

body.detail-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: #1A1A1A;
}

.detail-header {
  background: var(--color-dark);
  color: white;
  padding: 0 20px;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* Centred group: [← 13:00]  [title]  [15:00 →] */
.detail-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  justify-content: center;
}

.detail-title {
  font-size: 15px;
  font-weight: 500;
  font-family: var(--font-mono);
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.9);
  white-space: nowrap;
}

/* Hour navigation buttons */
.hour-nav-btn {
  font-family: var(--font-mono);
  font-size: 12px;
  min-width: 100px;
  white-space: nowrap;
}

.hour-nav-btn:disabled {
  opacity: 0.2;
  cursor: default;
  pointer-events: none;
}

.detail-grid {
  display: flex;
  gap: 12px;
  padding: 12px;
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  align-items: stretch;
}

.detail-grid::-webkit-scrollbar {
  height: 8px;
}
.detail-grid::-webkit-scrollbar-track {
  background: #111;
}
.detail-grid::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 4px;
}

.site-column {
  flex: 0 0 390px;
  width: 390px;
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.site-column-header {
  padding: 9px 14px;
  background: var(--color-primary);
  color: white;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-main);
  flex-shrink: 0;
  letter-spacing: 0.2px;
}

.site-column-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  background: #F8F6F4;
}

.site-column-body::-webkit-scrollbar {
  width: 5px;
}
.site-column-body::-webkit-scrollbar-track {
  background: #eee;
}
.site-column-body::-webkit-scrollbar-thumb {
  background: #bbb;
  border-radius: 3px;
}

.site-column-body img {
  width: 390px;
  display: block;
}

.no-screenshot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: var(--color-text-muted);
  font-size: 13px;
  gap: 8px;
  background: #F8F6F4;
}

.no-screenshot:not(:empty)::before {
  content: none; /* suppress the '–' when error text is shown */
}

.no-screenshot:empty::before,
.no-screenshot::before {
  content: '–';
  font-size: 32px;
  opacity: 0.3;
}

.no-screenshot:not(:empty) {
  font-size: 12px;
  padding: 20px;
  text-align: center;
  color: var(--color-accent);
  word-break: break-word;
}

/* ========================================
   CAPTURE STATUS TOAST
   ======================================== */

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--color-dark);
  color: white;
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  z-index: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  animation: slideIn 0.2s ease;
}

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

/* ========================================
   DEBUG PAGE
   ======================================== */

.debug-header {
  background: var(--color-dark);
  color: white;
  padding: 0 24px;
  height: 54px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.debug-last-updated {
  margin-left: auto;
  font-size: 11px;
  font-family: var(--font-mono);
  color: rgba(255, 255, 255, 0.35);
  white-space: nowrap;
}

.debug-content {
  padding: 24px;
  max-width: 1100px;
}

.debug-section {
  background: white;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  margin-bottom: 20px;
  overflow: hidden;
}

.debug-section-title {
  padding: 14px 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
}

.debug-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.debug-table th {
  padding: 9px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
  background: #FAFAF9;
}

.debug-table td {
  padding: 9px 16px;
  border-bottom: 1px solid #F5F0ED;
  vertical-align: middle;
  font-family: var(--font-main);
  color: var(--color-text);
}

.debug-table tr:last-child td {
  border-bottom: none;
}

.debug-table .td-mono {
  font-family: var(--font-mono);
  font-size: 12px;
}

.debug-table .td-error {
  color: var(--color-accent);
  font-size: 12px;
  max-width: 400px;
  word-break: break-word;
}

.debug-table .td-success { color: var(--color-captured); font-weight: 600; }
.debug-table .td-muted { color: var(--color-text-muted); }

.stat-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

.stat-badge.good { background: #E6F4F0; color: var(--color-captured); }
.stat-badge.bad  { background: #FAEAEF; color: var(--color-accent); }
.stat-badge.neutral { background: var(--color-warm-gray); color: var(--color-dark); }

/* Explanatory note below a debug section */
.debug-note {
  padding: 10px 20px 14px;
  font-size: 12px;
  color: var(--color-text-muted);
  line-height: 1.5;
  border-top: 1px solid var(--color-border);
}

/* Clickable link inside debug capture log */
.debug-link {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 600;
}
.debug-link:hover {
  text-decoration: underline;
}

/* Server log output block */
.log-output {
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.6;
  color: #A8E6C2;
  background: #001A12;
  padding: 16px 20px;
  margin: 0;
  max-height: 420px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.log-output::-webkit-scrollbar {
  width: 6px;
}
.log-output::-webkit-scrollbar-track {
  background: #001208;
}
.log-output::-webkit-scrollbar-thumb {
  background: #005530;
  border-radius: 3px;
}

.config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1px;
  background: var(--color-border);
}

.config-item {
  background: white;
  padding: 14px 20px;
}

.config-item-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}

.config-item-value {
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--color-dark);
}

/* ========================================
   LOADING STATE
   ======================================== */

.loading-row td {
  text-align: center;
  padding: 40px;
  color: var(--color-text-muted);
  font-family: var(--font-main);
  font-size: 14px;
}

/* ========================================
   VIEW TOGGLE (24t / 8t grid)
   ======================================== */

.view-toggle {
  display: flex;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 7px;
  padding: 3px;
  gap: 2px;
}

.view-toggle-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 9px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  background: transparent;
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 0.3px;
}

.view-toggle-btn.active {
  background: white;
  color: var(--color-dark);
}

.view-toggle-btn:not(.active):hover {
  color: rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.1);
}

/* ========================================
   LARGE GRID VIEW
   ======================================== */

/* Wide hour header for large grid */
.status-table .large-hour-header {
  width: 108px;
  min-width: 108px;
  font-size: 11px;
  padding: 9px 0 6px;
  text-align: center;
  font-family: var(--font-mono);
  color: var(--color-text-muted);
  border-bottom: 2px solid var(--color-border);
  font-weight: 500;
  letter-spacing: 0.3px;
}

.status-table .large-hour-header.current-hour {
  color: var(--color-accent);
  font-weight: 700;
}

/* Large cell body */
.status-table .large-hour-cell {
  width: 108px;
  min-width: 108px;
  height: 168px;
  text-align: center;
  vertical-align: middle;
  border-bottom: 1px solid #F0E8E4;
  border-right: 1px solid #F0E8E4;
  padding: 0;
  position: relative;
  overflow: hidden;
}

.status-table .large-hour-cell.clickable {
  cursor: pointer;
}

/* Thumbnail in large cell */
.large-cell-thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  transition: opacity 0.1s;
}

/* Hover effect on large cells */
.status-table .large-hour-cell.clickable:hover .large-cell-thumb {
  outline: 2px solid var(--color-accent);
  outline-offset: -2px;
  opacity: 0.85;
}

.status-table .large-hour-cell.clickable:hover .cell-dot {
  transform: scale(1.3);
  opacity: 0.9;
}

/* ========================================
   ARCHIVE PAGE
   ======================================== */

.archive-calendar-section {
  background: white;
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 20px;
  border: 1px solid var(--color-border);
  max-width: 420px;
}

.archive-month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.archive-month-label {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-dark);
  letter-spacing: -0.3px;
}

.archive-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.archive-cal-weekday {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-align: center;
  padding: 4px 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-family: var(--font-mono);
}

.archive-cal-day {
  text-align: center;
  padding: 8px 4px;
  font-size: 13px;
  font-family: var(--font-mono);
  border-radius: 6px;
  color: var(--color-text-muted);
  user-select: none;
}

.archive-cal-empty {
  visibility: hidden;
}

.archive-cal-has-data {
  background: var(--color-primary);
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.12s, transform 0.1s;
}

.archive-cal-has-data:hover {
  opacity: 0.82;
  transform: scale(1.08);
}

.archive-cal-today {
  outline: 2px solid var(--color-accent);
  outline-offset: -2px;
}

.archive-cal-selected {
  background: var(--color-dark) !important;
  color: white !important;
  box-shadow: 0 2px 8px rgba(0, 44, 34, 0.25);
}

.archive-day-header {
  padding: 12px 20px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
}

/* ========================================
   MANAGE SITES MODAL
   ======================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 44, 34, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 6vh 20px 20px;
  z-index: 2000;
  overflow-y: auto;
}

.modal-overlay[hidden] {
  display: none;
}

.modal-card {
  background: white;
  border-radius: 12px;
  width: 100%;
  max-width: 560px;
  box-shadow: 0 12px 48px rgba(0, 44, 34, 0.25);
  border: 1px solid var(--color-border);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
}

.modal-header h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-dark);
  margin: 0;
  letter-spacing: -0.3px;
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
  color: var(--color-text-muted);
  padding: 0 4px;
}

.modal-close:hover {
  color: var(--color-dark);
}

.modal-body {
  padding: 8px 22px 22px;
  max-height: 72vh;
  overflow-y: auto;
}

.modal-section {
  padding: 14px 0;
  border-bottom: 1px solid var(--color-border);
}

.modal-section:last-child {
  border-bottom: none;
}

.modal-section h3 {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 4px;
}

.modal-hint {
  font-size: 12px;
  color: var(--color-text-muted);
  margin: 0 0 10px;
  line-height: 1.4;
}

.modal-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 13px;
}

.modal-list-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.modal-list-label {
  color: var(--color-text);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-list-meta {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.modal-list-empty {
  font-size: 13px;
  color: var(--color-text-muted);
  font-style: italic;
  padding: 10px 0;
}

.drag-handle {
  color: #bbb;
  cursor: grab;
  font-size: 14px;
  line-height: 1;
  user-select: none;
  padding: 0 2px;
}

.draggable-item {
  cursor: grab;
}

.draggable-item .modal-list-label {
  flex: 1;
}

.draggable-item.dragging {
  opacity: 0.4;
  cursor: grabbing;
}

.draggable-item.drop-target {
  border-color: var(--color-primary);
  background: #E6F0EC;
}

.modal-add-form {
  display: flex;
  gap: 8px;
}

.modal-add-form input {
  flex: 1;
  padding: 8px 12px;
  border: 1.5px solid var(--color-border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  background: white;
}

.modal-add-form input:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* ========================================
   ADMIN PANEL
   ======================================== */

.admin-content {
  padding: 24px 28px 48px;
  max-width: 1200px;
  margin: 0 auto;
}

.admin-section {
  margin-bottom: 36px;
}

.admin-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin: 0 0 14px;
}

.admin-loading {
  color: var(--color-text-muted);
  font-size: 13px;
}

/* Cards */

.admin-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.admin-card {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 14px 16px;
}

.admin-card-value {
  font-size: 20px;
  font-weight: 600;
  color: var(--color-dark);
  letter-spacing: -0.3px;
}

.admin-card-label {
  font-size: 11px;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

.admin-card-hint {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 6px;
}

/* Inline new-user form */

.admin-inline-form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  margin-bottom: 12px;
}

.admin-inline-form input[type="text"],
.admin-inline-form input[type="password"] {
  padding: 7px 11px;
  border: 1.5px solid var(--color-border);
  border-radius: 6px;
  font-size: 13px;
  background: white;
  width: auto;
  flex: 1;
  min-width: 140px;
}

.admin-inline-form input[type="text"]:focus,
.admin-inline-form input[type="password"]:focus {
  border-color: var(--color-primary);
  outline: none;
}

.admin-checkbox-label {
  font-size: 12px;
  color: var(--color-text-muted);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  user-select: none;
  cursor: pointer;
}

.admin-form-error {
  color: var(--color-accent);
  font-size: 12px;
}

/* Tables */

.admin-table-wrap {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-table thead {
  background: var(--color-bg);
}

.admin-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--color-border);
}

.admin-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.admin-table tbody tr:last-child td {
  border-bottom: none;
}

.admin-cell-strong {
  font-weight: 500;
  color: var(--color-dark);
}

.admin-row-inactive {
  opacity: 0.55;
}

.admin-actions-col { width: 1px; white-space: nowrap; }
.admin-actions-cell {
  white-space: nowrap;
  display: flex;
  gap: 6px;
}

.admin-btn-danger {
  color: var(--color-accent);
  border-color: rgba(190, 0, 100, 0.3);
}

.admin-btn-danger:hover {
  background: rgba(190, 0, 100, 0.08);
}

/* Audit log */

.admin-audit-list {
  list-style: none;
  padding: 0;
  margin: 0;
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  overflow: hidden;
}

.admin-audit-item {
  padding: 9px 14px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  gap: 10px;
  font-size: 12px;
  flex-wrap: wrap;
  align-items: baseline;
}

.admin-audit-item:last-child {
  border-bottom: none;
}

.admin-audit-time {
  font-family: var(--font-mono);
  color: var(--color-text-muted);
  font-size: 11px;
  flex-shrink: 0;
  min-width: 110px;
}

.admin-audit-actor {
  font-weight: 500;
  color: var(--color-dark);
}

.admin-audit-action {
  color: var(--color-text);
}

.admin-audit-target {
  color: var(--color-primary);
  font-weight: 500;
}

.admin-audit-details {
  color: var(--color-text-muted);
  font-size: 11px;
}

.admin-audit-empty {
  padding: 18px 14px;
  color: var(--color-text-muted);
  font-style: italic;
  font-size: 13px;
}

.admin-card-stale {
  background: #fff4e6;
  border-color: #e8b36a;
}

.admin-card-stale .admin-card-hint {
  color: #a65d00;
  font-weight: 500;
}

.user-greeting {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  padding: 0 4px 0 8px;
  white-space: nowrap;
}

.user-greeting strong {
  color: rgba(255, 255, 255, 0.95);
  font-weight: 500;
}

.login-disclaimer p + p {
  margin-top: 6px;
}

.login-disclaimer a {
  color: inherit;
  text-decoration: underline;
}
