:root {
  --bg: #020617;
  --bg-soft: #0f172a;
  --panel: rgba(15, 23, 42, 0.88);
  --panel-strong: rgba(15, 23, 42, 0.96);
  --border: rgba(71, 85, 105, 0.85);
  --border-soft: rgba(71, 85, 105, 0.45);

  --text-main: #e5e7eb;
  --text-sub: #cbd5e1;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent: #38bdf8;
  --accent-soft: rgba(56, 189, 248, 0.25);
  --accent-strong: rgba(56, 189, 248, 0.95);

  --locked: #16a34a;
  --unlocked: #f97316;
  --none-bg: rgba(30, 41, 59, 0.65);

  --full-orgasm: #ef4444;
  --ruined-orgasm: #a855f7;
  --caged-orgasm: #f59e0b;
  --no-cum: #22c55e;
  --hygiene-unlock: #38bdf8;

  --success-soft: rgba(34, 197, 94, 0.12);
  --warning-soft: rgba(249, 115, 22, 0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(circle at top, rgba(56, 189, 248, 0.08), transparent 30%),
    linear-gradient(180deg, #020617 0%, #020617 100%);
  color: var(--text-main);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body { padding: 18px; }

.app-shell {
  max-width: 1320px;
  margin: 0 auto;
  background: linear-gradient(180deg, rgba(2,6,23,0.96), rgba(15,23,42,0.94));
  border: 1px solid rgba(71, 85, 105, 0.8);
  border-radius: 20px;
  box-shadow:
    0 22px 60px rgba(0, 0, 0, 0.48),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
  overflow: hidden;
}

.app-content { padding: 22px 20px 24px; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.22);
}

header { display: grid; gap: 14px; margin-bottom: 14px; }
.hero { display: grid; gap: 10px; }

h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-weight: 750;
  color: #f8fafc;
}

.hero-kicker {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}

.subtitle {
  max-width: 840px;
  font-size: 13px;
  line-height: 1.72;
  color: var(--text-sub);
  white-space: pre-line;
}

.status-strip {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 10px;
}

.status-box {
  background: rgba(15,23,42,0.92);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 13px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 76px;
}

.status-box.primary {
  background:
    radial-gradient(circle at top right, rgba(34,197,94,0.10), transparent 35%),
    rgba(15,23,42,0.95);
}

.status-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.status-value { font-size: 18px; font-weight: 700; color: #f8fafc; }
.status-subtext { font-size: 11px; color: var(--text-muted); }

.top-bar {
  margin-top: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.year-select {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-muted);
}

.year-input,
.btn,
#loginUser,
#loginPass {
  background: #020617;
  color: var(--text-main);
  border: 1px solid rgba(148,163,184,0.6);
  border-radius: 10px;
  font-size: 12px;
}

.year-input { width: 88px; padding: 7px 9px; }

.btn {
  padding: 7px 11px;
  cursor: pointer;
  transition: transform 0.08s ease, border-color 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.btn:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-soft);
  transform: translateY(-0.5px);
}

.view-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.view-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(22,163,74,0.12);
  border: 1px solid rgba(22,163,74,0.45);
  color: #dcfce7;
  font-size: 11px;
}

.view-badge.readonly {
  background: rgba(148,163,184,0.12);
  border-color: rgba(148,163,184,0.35);
  color: #e2e8f0;
}

.view-dot { width: 8px; height: 8px; border-radius: 999px; background: currentColor; }

#loginForm { display: flex; align-items: center; gap: 6px; font-size: 11px; flex-wrap: wrap; }
#loginUser, #loginPass { width: 106px; padding: 6px 8px; }

.section-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.grid-card { margin-top: 14px; overflow-x: auto; }

.grid-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.grid-help {
  max-width: 680px;
  color: var(--text-sub);
  font-size: 11px;
  line-height: 1.55;
  margin-top: -4px;
}

.event-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.filter-chip {
  min-width: 28px;
  min-height: 26px;
  padding: 5px 8px;
  border-radius: 999px;
  border: 1px solid rgba(71,85,105,0.75);
  background: rgba(15,23,42,0.78);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
}

.filter-chip:hover { border-color: var(--accent); color: #f8fafc; }
.filter-chip.active {
  background: rgba(56,189,248,0.16);
  border-color: rgba(56,189,248,0.75);
  color: #e0f2fe;
  box-shadow: 0 0 0 1px rgba(56,189,248,0.1);
}


.grid-header-row,
.grid-body {
  display: grid;
  grid-template-columns: 84px repeat(31, minmax(22px, 1fr));
  gap: 4px;
  min-width: 920px;
}

.grid-header-row { margin-bottom: 6px; }

.grid-header-cell,
.month-label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
  border-radius: 8px;
  font-size: 10px;
  color: var(--text-muted);
  background: rgba(15,23,42,0.4);
  border: 1px solid rgba(55,65,81,0.45);
}

.month-label {
  justify-content: flex-start;
  padding-left: 8px;
  font-size: 11px;
  color: #e2e8f0;
  background: rgba(15,23,42,0.7);
}

.day-cell {
  position: relative;
  min-height: 22px;
  border-radius: 7px;
  overflow: hidden;
  border: 1px solid rgba(71,85,105,0.6);
  background: var(--none-bg);
  cursor: pointer;
  transition: box-shadow 0.1s ease, transform 0.08s ease, border-color 0.12s ease, opacity 0.12s ease, filter 0.12s ease;
}

.day-cell.empty { background: transparent; border: none; cursor: default; }
.day-cell:hover { box-shadow: 0 0 0 1px var(--accent-strong); transform: translateY(-0.6px); }
.day-cell.readonly { cursor: default; }
.day-cell.readonly:hover { box-shadow: none; transform: none; }

.day-main-locked {
  background:
    radial-gradient(circle at 20% 10%, rgba(34,197,94,0.4), transparent 55%),
    linear-gradient(135deg, #16a34a, #15803d);
  border-color: rgba(22,163,74,0.95);
}

.day-main-unlocked {
  background:
    radial-gradient(circle at 20% 10%, rgba(251,146,60,0.5), transparent 55%),
    linear-gradient(135deg, #f97316, #ea580c);
  border-color: rgba(249,115,22,0.95);
}

.day-today {
  box-shadow:
    0 0 0 1px rgba(56,189,248,0.95),
    0 0 0 3px rgba(56,189,248,0.35);
}

.extra-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 13px;
  height: 13px;
  padding: 0 3px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  line-height: 1;
  font-weight: 800;
  color: #020617;
  box-shadow: 0 0 0 1px rgba(2,6,23,0.75), 0 4px 8px rgba(0,0,0,0.25);
}

.extra-full_orgasm { background: var(--full-orgasm); }
.extra-ruined_orgasm { background: var(--ruined-orgasm); }
.extra-caged_orgasm { background: var(--caged-orgasm); }
.extra-hygiene_unlock { background: var(--hygiene-unlock); }

.day-cell.filter-dimmed { opacity: 0.28; filter: saturate(0.55); }
.day-cell.filter-match {
  box-shadow: 0 0 0 1px rgba(248,250,252,0.65), 0 0 14px rgba(56,189,248,0.18);
  z-index: 1;
}

.legend-row { margin-top: 12px; }
.legend-block { display: grid; gap: 10px; }
.legend-group { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: center; }
.legend-group-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-sub); margin-right: 2px; }

.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(15,23,42,0.9);
  border: 1px solid rgba(55,65,81,0.9);
  font-size: 11px;
  color: var(--text-muted);
}

.legend-swatch-main { width: 14px; height: 14px; border-radius: 4px; border: 1px solid #4b5563; background: var(--none-bg); }
.legend-swatch-main.locked { background: var(--locked); }
.legend-swatch-main.unlocked { background: var(--unlocked); }

.legend-event-badge {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  line-height: 1;
  font-weight: 800;
  color: #020617;
  box-shadow: 0 0 0 1px rgba(2,6,23,0.75);
}

.legend-event-full { background: var(--full-orgasm); }
.legend-event-ruined { background: var(--ruined-orgasm); }
.legend-event-caged { background: var(--caged-orgasm); }
.legend-event-hygiene { background: var(--hygiene-unlock); }

.bottom-layout {
  display: grid;
  grid-template-columns: 1.1fr 1.35fr;
  gap: 14px;
  margin-top: 14px;
}

.stack { display: grid; gap: 14px; }
.panel-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-muted); margin-bottom: 8px; }
.protocol-copy { display: grid; gap: 10px; font-size: 12px; line-height: 1.65; color: var(--text-sub); }
.protocol-list { margin: 0; padding-left: 18px; display: grid; gap: 6px; color: var(--text-sub); font-size: 12px; line-height: 1.55; }

.social-list { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.social-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--text-muted); }

.social-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(15,23,42,0.9);
  border: 1px solid rgba(148,163,184,0.45);
  font-size: 11px;
  color: #e5e7eb;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, transform 0.05s, box-shadow 0.1s;
}

.social-link:hover { background: rgba(15,23,42,1); border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-soft); transform: translateY(-0.5px); }
.social-icon { width: 18px; height: 18px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 700; color: #020617; }
.icon-recon { background: #f97316; }
.icon-twitter { background: #0ea5e9; }
.icon-bluesky { background: #38bdf8; }
.icon-telegram { background: #229ED9; }

.registry-id {
  font-size: 11px;
  color: #e5e7eb;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(15,23,42,0.9);
  border: 1px solid rgba(148,163,184,0.45);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.registry-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; }
.registry-value { font-weight: 600; }
.social-note { font-size: 10px; color: var(--text-muted); margin-top: 8px; line-height: 1.55; }

.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; font-size: 11px; }
.stat-column { display: flex; flex-direction: column; gap: 6px; }
.stat-group-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-sub); margin-bottom: 2px; }

.stat-box {
  background: rgba(15,23,42,0.9);
  border-radius: 10px;
  border: 1px solid rgba(55,65,81,0.9);
  padding: 7px 9px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 58px;
  justify-content: center;
}

.stat-label { color: var(--text-muted); font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; }
.stat-value { font-size: 16px; font-weight: 700; color: #f8fafc; }

.cell-tooltip {
  position: fixed;
  pointer-events: none;
  background: rgba(15,23,42,0.98);
  border-radius: 10px;
  border: 1px solid rgba(148,163,184,0.6);
  padding: 8px 10px;
  font-size: 11px;
  color: var(--text-main);
  box-shadow:
    0 14px 30px rgba(0,0,0,0.8),
    0 0 0 1px rgba(15,23,42,0.9);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.08s ease-out, transform 0.08s ease-out;
  z-index: 999;
  white-space: normal;
  max-width: 280px;
}

.cell-tooltip.visible { opacity: 1; transform: translateY(0); }
.cell-tooltip-title { font-weight: 800; margin-bottom: 4px; color: #f8fafc; }
.cell-tooltip-line { color: var(--text-muted); line-height: 1.45; }
.cell-tooltip-hint {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(71,85,105,0.55);
  color: var(--text-sub);
  font-size: 10px;
  line-height: 1.35;
}


@media (max-width: 1100px) {
  .status-strip { grid-template-columns: repeat(2, 1fr); }
  .bottom-layout { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  body { padding: 12px; }
  .app-content { padding: 16px 12px 18px; }
  .grid-card-head { flex-direction: column; }
  .event-filters { justify-content: flex-start; }
  .grid-header-row,
  .grid-body { grid-template-columns: 70px repeat(31, minmax(20px, 1fr)); min-width: 820px; }
  .month-label { font-size: 10px; }
  .stats-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  body { padding: 8px; }
  .status-strip { grid-template-columns: 1fr; }
  h1 { font-size: 23px; }
  .subtitle { font-size: 12px; }
}

.login-form-hidden {
  display: none !important;
}

.admin-toggle {
  opacity: 0.72;
}

.admin-toggle:hover {
  opacity: 1;
}

/* UI polish package: hero, filters, recent entries, profile chips */
.hero-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.keytag-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border-radius: 999px;
  background: rgba(56,189,248,0.12);
  border: 1px solid rgba(56,189,248,0.45);
  color: #e0f2fe;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.keytag-badge span {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.keytag-badge strong {
  font-size: 13px;
  letter-spacing: 0.04em;
}

.subtitle {
  display: grid;
  gap: 6px;
  white-space: normal;
}

.subtitle p {
  margin: 0;
}

.year-select {
  padding: 7px;
  border-radius: 14px;
  background: rgba(15,23,42,0.62);
  border: 1px solid rgba(71,85,105,0.55);
}

.year-current {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  padding: 0 4px 0 2px;
}

.year-current span {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.year-current strong {
  font-size: 18px;
  color: #f8fafc;
  letter-spacing: -0.02em;
}

.admin-toggle {
  background: transparent;
  border-color: rgba(148,163,184,0.28);
  opacity: 0.48;
  font-size: 11px;
  padding-inline: 9px;
}

.admin-toggle:hover {
  opacity: 1;
  background: rgba(15,23,42,0.8);
}

.admin-login-panel:not(.login-form-hidden) {
  display: flex;
  padding: 7px;
  border-radius: 14px;
  background: rgba(2,6,23,0.82);
  border: 1px solid rgba(71,85,105,0.7);
}

.event-filter-panel {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.filter-chip {
  min-width: auto;
  min-height: 28px;
  padding: 6px 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.filter-chip span {
  width: 17px;
  height: 17px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.12);
  color: #f8fafc;
  font-size: 9px;
}

.compact-legend .legend-block,
.compact-legend.legend-block {
  gap: 6px;
}

.stats-card,
.recent-card,
.info-layout {
  margin-top: 14px;
}

.recent-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.recent-row {
  display: grid;
  gap: 6px;
  padding: 9px 10px;
  border-radius: 12px;
  background: rgba(15,23,42,0.9);
  border: 1px solid rgba(55,65,81,0.85);
}

.recent-date {
  color: var(--text-muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.recent-body {
  display: grid;
  gap: 4px;
}

.recent-main {
  color: #f8fafc;
  font-size: 13px;
  font-weight: 750;
}

.recent-sub {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 11px;
  min-height: 18px;
}

.recent-event-badge {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  line-height: 1;
  font-weight: 800;
  color: #020617;
  box-shadow: 0 0 0 1px rgba(2,6,23,0.75);
}

.recent-empty {
  grid-column: 1 / -1;
  color: var(--text-muted);
  font-size: 12px;
  padding: 8px 2px;
}

.info-layout {
  grid-template-columns: 1fr 1fr;
}

.social-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.social-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(15,23,42,0.9);
  border: 1px solid rgba(148,163,184,0.42);
  color: #e5e7eb;
  text-decoration: none;
  font-size: 11px;
  transition: background 0.15s, border-color 0.15s, transform 0.05s, box-shadow 0.1s;
}

.social-chip:hover {
  background: rgba(15,23,42,1);
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-soft);
  transform: translateY(-0.5px);
}

.registry-card {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 12px;
  background: rgba(2,6,23,0.45);
  border: 1px solid rgba(148,163,184,0.34);
}

@media (max-width: 1100px) {
  .recent-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  .event-filter-panel { justify-content: flex-start; }
  .info-layout { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .hero-topline { gap: 10px; }
  .keytag-badge { width: fit-content; }
  .year-select { width: 100%; }
  .year-current { width: 100%; }
  .recent-list { grid-template-columns: 1fr; }
}

/* Interaction, accessibility, and responsive refinements */
[hidden] { display: none !important; }

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

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
  box-shadow: none;
}

.app-notice {
  position: fixed;
  top: 14px;
  left: 50%;
  z-index: 1200;
  max-width: min(480px, calc(100vw - 28px));
  padding: 10px 14px;
  border: 1px solid rgba(56,189,248,0.55);
  border-radius: 12px;
  background: rgba(15,23,42,0.98);
  box-shadow: 0 18px 50px rgba(0,0,0,0.55);
  color: #e0f2fe;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -10px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.app-notice.visible { opacity: 1; transform: translate(-50%, 0); }
.app-notice.success { border-color: rgba(34,197,94,0.65); color: #dcfce7; }
.app-notice.error { border-color: rgba(239,68,68,0.72); color: #fee2e2; }

.year-select {
  min-width: 214px;
  justify-content: center;
}

.year-select strong {
  min-width: 54px;
  text-align: center;
  color: #f8fafc;
  font-size: 18px;
}

.year-arrow {
  width: 34px;
  padding-inline: 0;
  font-size: 16px;
}

.grid-card { overflow: visible; }

.grid-scroll {
  max-width: 100%;
  overflow-x: auto;
  padding: 2px 1px 8px;
  scrollbar-color: rgba(56,189,248,0.55) rgba(15,23,42,0.7);
  scrollbar-width: thin;
}

.grid-scroll::-webkit-scrollbar { height: 8px; }
.grid-scroll::-webkit-scrollbar-track { background: rgba(15,23,42,0.7); border-radius: 99px; }
.grid-scroll::-webkit-scrollbar-thumb { background: rgba(56,189,248,0.55); border-radius: 99px; }

.grid-scroll-cue {
  display: none;
  margin: -3px 0 8px;
  color: var(--text-muted);
  font-size: 10px;
}

.grid-scroll-cue span { color: var(--accent); font-size: 14px; }

.month-label,
.month-header {
  position: sticky;
  left: 0;
  z-index: 4;
  box-shadow: 5px 0 8px rgba(2,6,23,0.7);
}

.month-header { z-index: 5; background: #111a2f; }
.month-label { background: #111a2f; }

.day-cell {
  appearance: none;
  width: 100%;
  padding: 0;
  color: inherit;
}

.day-cell.readonly { cursor: pointer; }
.day-cell.readonly:hover {
  box-shadow: 0 0 0 1px var(--accent-strong);
  transform: translateY(-0.6px);
}

.day-cell:focus-visible {
  outline: 2px solid #f8fafc;
  outline-offset: 1px;
  z-index: 6;
}

.day-main-unlocked {
  background:
    repeating-linear-gradient(135deg, transparent 0 5px, rgba(255,255,255,0.28) 5px 7px),
    radial-gradient(circle at 20% 10%, rgba(251,146,60,0.5), transparent 55%),
    linear-gradient(135deg, #f97316, #ea580c);
}

.legend-swatch-main.unlocked {
  background:
    repeating-linear-gradient(135deg, transparent 0 4px, rgba(255,255,255,0.38) 4px 6px),
    var(--unlocked);
}

.recent-row {
  width: 100%;
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.recent-row:hover {
  border-color: rgba(56,189,248,0.7);
  background: rgba(15,23,42,1);
}

.recent-toggle { display: none; margin-top: 10px; width: 100%; }

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
  padding: 4px 2px 0;
  color: var(--text-dim);
  font-size: 10px;
}

.admin-access { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

.admin-login-panel:not(.login-form-hidden) {
  align-items: flex-end;
  padding: 10px;
}

.admin-login-panel label {
  display: grid;
  gap: 4px;
  color: var(--text-muted);
  font-size: 10px;
}

.admin-login-panel input {
  width: 145px;
  padding: 7px 9px;
}

.form-status {
  align-self: center;
  max-width: 230px;
  color: var(--text-muted);
  font-size: 10px;
}

.form-status.error,
.dialog-status.error { color: #fca5a5; }

.day-dialog {
  width: min(460px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  padding: 18px;
  border: 1px solid rgba(71,85,105,0.95);
  border-radius: 18px;
  background: #0f172a;
  color: var(--text-main);
  box-shadow: 0 30px 90px rgba(0,0,0,0.78);
}

.day-dialog::backdrop { background: rgba(2,6,23,0.76); backdrop-filter: blur(4px); }

.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.dialog-header h2 { margin: 2px 0 0; color: #f8fafc; font-size: 20px; }
.dialog-kicker { color: var(--accent); font-size: 10px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }

.dialog-close {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(148,163,184,0.45);
  border-radius: 10px;
  background: rgba(2,6,23,0.7);
  color: var(--text-main);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.day-summary { display: grid; gap: 8px; margin-top: 16px; }
.day-summary > div { display: flex; justify-content: space-between; gap: 18px; padding: 9px 10px; border: 1px solid var(--border-soft); border-radius: 10px; background: rgba(2,6,23,0.42); }
.day-summary span { color: var(--text-muted); font-size: 11px; }
.day-summary strong { max-width: 65%; text-align: right; color: #f8fafc; font-size: 12px; overflow-wrap: anywhere; }
.dialog-readonly-hint { margin-top: 14px; color: var(--text-muted); font-size: 11px; text-align: center; }

.day-edit-form { display: grid; gap: 7px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border-soft); }
.day-edit-form label { color: var(--text-sub); font-size: 11px; }
.day-edit-form select,
.day-edit-form textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid rgba(148,163,184,0.55);
  border-radius: 10px;
  background: #020617;
  color: var(--text-main);
}
.day-edit-form textarea { resize: vertical; min-height: 72px; }
.dialog-status { min-height: 16px; color: var(--text-muted); font-size: 11px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.btn-primary { border-color: rgba(56,189,248,0.75); background: rgba(56,189,248,0.13); color: #e0f2fe; }

@media (max-width: 980px) {
  .grid-scroll-cue { display: block; }
}

@media (max-width: 640px) {
  .status-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .status-box { min-height: 96px; padding: 10px; }
  .status-value { font-size: 16px; }
  .status-subtext { font-size: 10px; line-height: 1.35; }

  .top-bar { align-items: center; }
  .year-select { width: auto; min-width: 0; }
  .view-controls { margin-left: auto; }

  .stat-box {
    min-height: 44px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }
  .stat-label { max-width: 72%; }
  .stat-value { flex: none; text-align: right; font-size: 15px; }

  .recent-row { grid-template-columns: 92px 1fr; align-items: center; }
  .recent-list:not(.expanded) .recent-row:nth-child(n+5) { display: none; }
  .recent-toggle:not([hidden]) { display: block; }

  .site-footer { align-items: flex-start; flex-direction: column; }
  .admin-access { width: 100%; justify-content: flex-start; }
  .admin-login-panel:not(.login-form-hidden) { width: 100%; align-items: stretch; flex-direction: column; }
  .admin-login-panel label,
  .admin-login-panel input { width: 100%; }
  .form-status { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}
