:root {
  --ink: #152033;
  --ink-soft: #3d4a5c;
  --mist: rgba(21, 32, 51, 0.12);
  --panel: rgba(255, 248, 240, 0.78);
  --panel-edge: rgba(255, 255, 255, 0.55);
  --accent: #c45c26;
  --accent-deep: #9a3f14;
  --focus: #1f6f8b;
  --ok: #1f6b4a;
  --err: #a11d2d;
  --mono: "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;
  --display: "Fraunces", Georgia, serif;
  --sans: "Figtree", system-ui, sans-serif;
  --radius: 0.35rem;
  --shell: 42rem;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  color: var(--ink);
  background: #1a2740;
  line-height: 1.5;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 90% 60% at 50% -10%, rgba(255, 186, 120, 0.55), transparent 55%),
    radial-gradient(ellipse 70% 50% at 100% 30%, rgba(31, 111, 139, 0.28), transparent 50%),
    linear-gradient(165deg, #16233a 0%, #243552 38%, #6b5a4a 72%, #e8a06a 100%);
}

.atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none;
}

.shell {
  width: min(100% - 2rem, var(--shell));
  margin-inline: auto;
  padding: clamp(2.5rem, 8vh, 5rem) 0 4rem;
  animation: rise-in 0.7s ease-out both;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(0.85rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.brand {
  margin-bottom: clamp(1.75rem, 4vh, 2.75rem);
}

.brand-with-action {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.brand-kicker {
  margin: 0 0 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 248, 240, 0.72);
}

.brand h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 650;
  font-size: clamp(2.75rem, 9vw, 4.35rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
  color: #fff8f0;
  text-wrap: balance;
}

.brand-line {
  margin: 1rem 0 0;
  max-width: 28rem;
  font-size: 1.08rem;
  color: rgba(255, 248, 240, 0.82);
}

.brand-logout {
  margin-top: 0.35rem;
  color: #fff8f0 !important;
  border-color: rgba(255, 248, 240, 0.28) !important;
}

.brand-logout:hover {
  background: rgba(255, 248, 240, 0.1) !important;
}

.panel {
  padding: 1.35rem 1.25rem 1.4rem;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: calc(var(--radius) + 0.15rem);
  backdrop-filter: blur(10px);
  box-shadow: 0 18px 40px rgba(12, 20, 36, 0.22);
}

.panel-title {
  margin: 0 0 1rem;
  font-family: var(--display);
  font-size: 1.45rem;
  font-weight: 650;
  color: var(--ink);
}

.field-label {
  display: block;
  margin-bottom: 0.55rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
}

#token {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0.85rem 1rem;
  border: 1px solid var(--mist);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.95rem;
}

#token:focus,
#date-filter:focus,
.btn-primary:focus-visible,
.btn-ghost:focus-visible,
.day-row summary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem 1.25rem;
  margin-top: 1.15rem;
}

.btn-primary,
.btn-ghost {
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 650;
  cursor: pointer;
  border-radius: 999px;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.btn-primary {
  appearance: none;
  border: 0;
  padding: 0.72rem 1.35rem;
  color: #fff8f0;
  background: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-deep);
  transform: translateY(-1px);
}

.btn-ghost {
  appearance: none;
  border: 1px solid var(--mist);
  padding: 0.45rem 0.9rem;
  color: var(--ink);
  background: transparent;
}

.btn-ghost:hover {
  background: rgba(21, 32, 51, 0.05);
}

#status,
.archive-status {
  margin: 0;
  min-height: 1.35rem;
  font-size: 0.92rem;
  color: var(--ink-soft);
  transition: color 0.2s ease, opacity 0.2s ease;
}

#status.ok,
.archive-status.ok {
  color: var(--ok);
}

#status.error,
.archive-status.error {
  color: var(--err);
}

.archive-status {
  color: rgba(255, 248, 240, 0.72);
  margin-bottom: 0.35rem;
}

.archive-home {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.archive {
  margin-top: clamp(2.5rem, 6vh, 3.5rem);
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 248, 240, 0.28);
}

.archive-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.archive h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.55rem;
  font-weight: 650;
  color: #fff8f0;
}

.archive-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.75rem;
}

.filter-label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 248, 240, 0.7);
}

#date-filter {
  font-family: var(--sans);
  font-size: 0.9rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid rgba(255, 248, 240, 0.28);
  border-radius: var(--radius);
  background: rgba(255, 248, 240, 0.12);
  color: #fff8f0;
  color-scheme: dark;
}

.archive .btn-ghost {
  color: #fff8f0;
  border-color: rgba(255, 248, 240, 0.28);
}

.archive .btn-ghost:hover {
  background: rgba(255, 248, 240, 0.1);
}

.archive-list {
  display: flex;
  flex-direction: column;
}

.archive-empty {
  margin: 0.75rem 0 0;
  color: rgba(255, 248, 240, 0.72);
}

.day-row {
  border-bottom: 1px solid rgba(255, 248, 240, 0.18);
}

.day-row summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 1rem;
  padding: 0.95rem 0.15rem;
  cursor: pointer;
  list-style: none;
  color: #fff8f0;
}

.day-row summary::-webkit-details-marker {
  display: none;
}

.day-row summary::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  margin-right: 0.15rem;
  border-right: 1.5px solid rgba(255, 248, 240, 0.75);
  border-bottom: 1.5px solid rgba(255, 248, 240, 0.75);
  transform: rotate(-45deg);
  transition: transform 0.2s ease;
}

.day-row[open] summary::before {
  transform: rotate(45deg);
}

.day-date {
  font-weight: 650;
  font-size: 1rem;
}

.day-time {
  font-size: 0.9rem;
  color: rgba(255, 248, 240, 0.68);
}

.day-id {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: rgba(255, 248, 240, 0.5);
}

.day-body {
  padding: 0 0 1.1rem;
  animation: open-soft 0.22s ease-out;
}

@keyframes open-soft {
  from {
    opacity: 0;
    transform: translateY(-0.25rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.day-body pre {
  margin: 0;
  padding: 0.85rem 0.95rem;
  overflow-x: auto;
  border-radius: var(--radius);
  background: rgba(12, 20, 36, 0.72);
  color: #f2ebe3;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.45;
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 1.25rem, var(--shell));
    padding-top: 2rem;
  }

  .brand {
    margin-bottom: 1.35rem;
  }

  .brand h1 {
    font-size: clamp(2.4rem, 12vw, 3.2rem);
  }

  .panel {
    padding: 1.1rem 0.9rem 1.15rem;
  }

  .archive-toolbar {
    align-items: stretch;
  }

  .archive-controls {
    width: 100%;
  }

  .day-id {
    margin-left: 0;
    width: 100%;
  }
}
