:root {
  --bg-0: #f4f1e8;
  --bg-1: #f9f8f3;
  --ink: #1f2b21;
  --ink-muted: #455a48;
  --line: #c9d1c4;
  --brand: #1f8a5b;
  --brand-strong: #125439;
  --warn: #8a3d1f;
  --ignore: #8a8f98;
  --review: #f1b40f;
  --shadow: 0 16px 35px rgba(31, 43, 33, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: radial-gradient(circle at 15% 15%, #fffdf8, #efe9db 50%, #e4dbc8);
  font-family: "Space Grotesk", sans-serif;
}

.bg-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(31, 43, 33, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 43, 33, 0.03) 1px, transparent 1px);
  background-size: 28px 28px;
}

.app-shell {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 1.25rem 1.5rem;
  display: grid;
  gap: 1rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.kicker {
  margin: 0;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
  font-size: 0.72rem;
}

h1,
h2 {
  margin: 0;
}

.subtitle {
  margin: 0.4rem 0 0;
  color: var(--ink-muted);
}

.panel {
  border: 1px solid var(--line);
  background: var(--bg-1);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 1rem;
}

.controls-row,
.auth-actions,
.detail-actions,
.event-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}

.detail-actions {
  margin-bottom: 0.6rem;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 0.55rem 0.85rem;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
}

.btn-primary:hover {
  background: var(--brand-strong);
}

.btn-ghost,
.btn-status {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.grid-layout {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

@media (min-width: 1000px) {
  .grid-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

.grid-layout > .panel {
  min-width: 0;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: auto repeat(6, minmax(68px, 1fr));
  gap: 0.3rem;
  min-width: 0;
}

.calendar-panel {
  display: flex;
  flex-direction: column;
}

.calendar-panel .month-grid {
  flex: 1;
}

.cal-dow-header {
  text-align: center;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
  padding: 0.2rem 0 0.35rem;
}

.cal-empty {
  border-radius: 8px;
}

.day-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 0.35rem 0.4rem;
  cursor: pointer;
  text-align: left;
  width: 100%;
  height: 100%;
}

.day-card .date {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
}

.day-card .meta {
  margin-top: 0.15rem;
  color: var(--ink-muted);
  font-size: 0.7rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.day-card.has-events {
  background: #e3f4ea;
  border-color: #8ecfae;
}

.day-card.review {
  border-left: 5px solid var(--review);
}

.day-card.active {
  outline: 2px solid var(--brand);
}

.day-card.future,
.day-card:disabled {
  background: #ecebe7;
  color: #808680;
  border-color: #d4d6d0;
  cursor: not-allowed;
}

.day-card.future .meta,
.day-card:disabled .meta {
  color: #8f948d;
}

.table-wrap {
  overflow-x: auto;
  overflow-y: auto;
  height: 45vh;
  max-height: 45vh;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: max-content;
  border-collapse: collapse;
  min-width: 760px;
}

thead th {
  position: sticky;
  top: 0;
  background: var(--bg-1);
  z-index: 1;
}

th,
td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 0.55rem;
  vertical-align: middle;
}

td.recording-key {
  min-width: 360px;
  white-space: nowrap;
}

tr.event-row {
  cursor: pointer;
}

tr.event-row.selected td {
  background: rgba(31, 138, 91, 0.1);
}

th.col-check,
td.col-check {
  width: 2rem;
  text-align: center;
  padding: 0.35rem;
}

.row-check {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
  accent-color: var(--brand);
}

.selection-count {
  font-size: 0.82rem;
  color: var(--ink-muted);
  margin-left: 0.25rem;
}

.event-filters {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
  margin: 0.25rem 0 0.5rem;
  font-size: 0.85rem;
}

.event-filters label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--ink-muted);
}

.event-filters input[type="checkbox"] {
  accent-color: var(--brand);
}

.event-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

tr.event-row.status-IGNORE {
  opacity: 0.5;
}

tr.event-row.status-REVIEW {
  background: #fff8dc;
}

#detail-video {
  margin-top: 0.8rem;
  width: 100%;
  background: #000;
  border-radius: 10px;
}

#detail-json {
  margin-top: 0.8rem;
  max-height: 340px;
  overflow: auto;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #172218;
  color: #e9f0e6;
  padding: 0.8rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.82rem;
}

.mono,
#auth-state,
#status-banner {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.82rem;
}

.status-banner {
  min-height: 1.1rem;
  color: var(--warn);
}
