:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --panel: #ffffff;
  --text: #1c1f26;
  --muted: #6b7280;
  --border: #e2e5ea;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --danger: #dc2626;
  --success-bg: #ecfdf5;
  --success-text: #047857;
  --error-bg: #fef2f2;
  --error-text: #b91c1c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

.container.narrow {
  max-width: 420px;
}

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

.site-header h1 {
  font-size: 22px;
  margin: 0;
}

/* Homepage hero background: a fixed, dark, branded look — deliberately
   pinned regardless of the visitor's system light/dark setting, so the
   background image and table contrast stay predictable. */
body.public-bg {
  --panel: #ffffff;
  --text: #1c1f26;
  --muted: #6b7280;
  --border: #e2e5ea;
  background:
    linear-gradient(rgba(8, 10, 14, 0.82), rgba(10, 12, 16, 0.88)),
    url("background.jpg") center / cover fixed no-repeat;
  min-height: 100vh;
}

body.public-bg .container {
  background: rgba(20, 22, 27, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: 16px;
  margin-top: 28px;
  margin-bottom: 28px;
  padding: 24px 20px 32px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

body.public-bg .site-header h1 {
  color: #ffffff;
}

@media (max-width: 640px) {
  body.public-bg {
    background-attachment: scroll;
  }
}

.page-layout {
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

.main-content {
  flex: 1;
  min-width: 0;
}

.sidebar {
  flex: 0 0 180px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: sticky;
  top: 20px;
}

.btn-export {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  color: #fff;
  border: 1px solid transparent;
  transition: filter 0.15s ease;
}

.btn-export:hover {
  filter: brightness(1.08);
}

.btn-export-icon {
  font-size: 16px;
  line-height: 1;
}

.btn-export-pdf {
  background: #dc2626;
}

.btn-export-excel {
  background: #15803d;
}

@media (max-width: 640px) {
  .page-layout {
    flex-direction: column;
  }
  .sidebar {
    order: -1;
    flex-direction: row;
    width: 100%;
    position: static;
    margin-bottom: 4px;
  }
  .btn-export {
    flex: 1;
  }
}

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

.btn-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
}
.btn-link:hover { text-decoration: underline; }

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

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 24px;
}

.panel h2 {
  margin-top: 0;
  font-size: 17px;
}

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

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.results-table th,
.results-table td {
  padding: 10px 12px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.results-table thead th {
  background: #fafbfc;
  font-size: 12px;
  letter-spacing: 0.03em;
  color: var(--muted);
  text-transform: uppercase;
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1;
}

.results-table tbody tr:last-child td { border-bottom: none; }
.results-table tbody tr:hover { background: #fafbfc; }

.results-table td.actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.pending { color: var(--muted); }

.empty {
  padding: 32px;
  color: var(--muted);
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 14px;
}

.pagination a {
  text-decoration: none;
  font-weight: 600;
}

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

.day-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

input[type="text"],
input[type="password"] {
  font-size: 16px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 100%;
  font-variant-numeric: tabular-nums;
}

input[type="text"]:focus,
input[type="password"]:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

label { display: block; font-weight: 500; margin-bottom: 4px; }

button, .btn-danger {
  font-size: 14px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
}

button[type="submit"]:not(.btn-danger) {
  background: var(--accent);
  color: #fff;
}
button[type="submit"]:not(.btn-danger):hover { background: var(--accent-hover); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  padding: 4px 8px;
}
.btn-danger:hover { text-decoration: underline; }

.inline-form { display: inline; margin: 0; }

.mt { margin-top: 12px; }

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

.notice {
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}
.notice-success { background: var(--success-bg); color: var(--success-text); }
.notice-error { background: var(--error-bg); color: var(--error-text); }

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --panel: #1c1f26;
    --text: #e6e7eb;
    --muted: #8b8f98;
    --border: #2b2f38;
    --accent: #3b82f6;
    --accent-hover: #60a5fa;
    --success-bg: #052e21;
    --success-text: #34d399;
    --error-bg: #2e0a0a;
    --error-text: #f87171;
  }
  .results-table thead th { background: #20242c; }
  .results-table tbody tr:hover { background: #20242c; }
}
