/*
 * Archiv — Gestaltung
 *
 * Grundgedanke: EIN Satz oben, der die Lage sagt, darunter die Naechte als
 * Reihe. Farbe wird nur eingesetzt, wo sie etwas bedeutet — nicht zur Zierde.
 *
 * Gebaut fuer den grossen Schirm: breite Flaeche, ab 1500px zwei Spalten
 * nebeneinander, damit zwei Wochen ohne Scrollen zu sehen sind. Auf dem Handy
 * fallen die Spalten uebereinander — aber der Desktop ist der Hauptfall.
 */

:root {
  --bg:        #070a10;
  --bg-soft:   #0d121b;
  --line:      #1c2532;
  --line-soft: #141c27;
  --text:      #dbe3f0;
  --muted:     #7b8798;
  --faint:     #4d5768;

  --good:  #3fd6a8;
  --warn:  #e8b45a;
  --bad:   #ff6b7a;
  --cyan:  #4ad6e8;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Ein sehr dezenter Schimmer oben — genug, damit die Flaeche nicht tot wirkt. */
body::before {
  content: "";
  position: fixed; inset: 0 0 auto 0; height: 340px; pointer-events: none;
  background: radial-gradient(120% 100% at 50% -40%, rgba(74,214,232,.10), transparent 70%);
}

.wrap { max-width: 86rem; margin: 0 auto; padding: 2.4rem 1.6rem 4rem; position: relative; }

/* ------------------------------------------------------------- Kopfzeile */

header { display: flex; align-items: baseline; gap: .8rem; margin-bottom: 1.6rem; }
h1 { font-size: 1.15rem; font-weight: 650; margin: 0; letter-spacing: -.01em; }
h1 span { color: var(--cyan); }
header .sub { color: var(--faint); font-size: .82rem; }
header .right { margin-left: auto; color: var(--faint); font-size: .78rem; }

/* --------------------------------------------------------------- Zustand */

.state {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.1rem 1.2rem;
  margin-bottom: 1.8rem;
  background: linear-gradient(180deg, var(--bg-soft), rgba(13,18,27,.4));
  display: flex; align-items: center; gap: .9rem;
}
.state .dot { width: .7rem; height: .7rem; border-radius: 50%; flex: none; }
.state .msg { font-size: 1.05rem; font-weight: 600; }
.state .note { color: var(--muted); font-size: .85rem; margin-left: auto; text-align: right; }

.state.good .dot { background: var(--good); box-shadow: 0 0 14px rgba(63,214,168,.55); }
.state.warn .dot { background: var(--warn); box-shadow: 0 0 14px rgba(232,180,90,.5); }
.state.bad  .dot { background: var(--bad);  box-shadow: 0 0 14px rgba(255,107,122,.55); }
.state.good { border-color: rgba(63,214,168,.28); }
.state.warn { border-color: rgba(232,180,90,.28); }
.state.bad  { border-color: rgba(255,107,122,.30); }

/* ---------------------------------------------------------------- Naechte */

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

/* Viel Platz: zwei Naechte nebeneinander. Erst ab dieser Breite, sonst
   werden die Plaetze zu schmal fuer Groesse UND Pruefsumme. */
@media (min-width: 1500px) {
  .nights { grid-template-columns: 1fr 1fr; gap: .5rem .9rem; }
}

.night {
  display: grid;
  grid-template-columns: 10rem 1fr 1fr;
  gap: .6rem;
  align-items: stretch;
  padding: .7rem .8rem;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(13,18,27,.55);
}
.night.gap { border-color: rgba(255,107,122,.25); background: rgba(40,14,18,.28); }
.night.today { border-color: rgba(74,214,232,.22); }

.when { display: flex; flex-direction: column; justify-content: center; }
.when .day  { font-weight: 600; font-size: .95rem; }
.when .date { color: var(--faint); font-size: .78rem; font-variant-numeric: tabular-nums; }

/* Ein Platz je Archivart. Leer = gestrichelter Rahmen, damit die Luecke
   sichtbar ist statt einfach zu fehlen. */
.slot {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: .5rem .65rem;
  display: flex; flex-direction: column; gap: .15rem;
  min-height: 3.6rem;
}
.slot .head { display: flex; align-items: center; gap: .4rem; font-size: .78rem; color: var(--muted); }
.slot .size { font-size: .95rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.slot .sum  { font: 11.5px/1.3 ui-monospace, "Cascadia Code", Consolas, monospace; color: var(--faint); }
.slot .when-time { color: var(--faint); font-size: .76rem; font-variant-numeric: tabular-nums; }

.slot.empty {
  border-style: dashed;
  border-color: rgba(255,107,122,.35);
  color: var(--bad);
  align-items: center; justify-content: center;
  font-size: .85rem;
}
.slot.changed { border-color: rgba(232,180,90,.55); }

/* Zusaetzliche Laeufe eines Tages — etwa von Hand angestossene. Sie gehoeren
   in die Zeile, sollen sie aber nicht dominieren. */
.extra {
  grid-column: 1 / -1;
  margin-top: .15rem;
  color: var(--faint); font-size: .76rem;
  display: flex; flex-wrap: wrap; gap: .1rem .6rem;
}
.extra span { font-variant-numeric: tabular-nums; }

.tag {
  font-size: .66rem; letter-spacing: .06em; text-transform: uppercase;
  padding: .05rem .35rem; border-radius: 4px; border: 1px solid var(--line);
  color: var(--faint);
}
.tag.changed { color: var(--warn); border-color: rgba(232,180,90,.45); }

.acts { display: flex; gap: .35rem; margin-top: auto; padding-top: .35rem; }
.acts button {
  font: inherit; font-size: .74rem;
  background: transparent; color: var(--muted);
  border: 1px solid var(--line); border-radius: 6px;
  padding: .12rem .45rem; cursor: pointer;
}
.acts button:hover { color: var(--text); border-color: var(--faint); }
.acts button.danger:hover { color: var(--bad); border-color: rgba(255,107,122,.5); }

/* ---------------------------------------------------------------- Meldung */

.flash {
  border: 1px solid var(--line); border-radius: 10px;
  padding: .7rem .9rem; margin-bottom: 1.2rem; font-size: .9rem;
}
.flash.ok  { border-color: rgba(63,214,168,.35); color: var(--good); }
.flash.err { border-color: rgba(255,107,122,.35); color: var(--bad); }
.flash code {
  display: block; margin-top: .5rem; color: var(--text);
  font: 12px/1.5 ui-monospace, Consolas, monospace;
  background: rgba(0,0,0,.35); padding: .5rem .6rem; border-radius: 6px;
  overflow-x: auto; white-space: pre;
}

footer { margin-top: 2.5rem; color: var(--faint); font-size: .76rem; }

/* --------------------------------------------------------------- Handy
 *
 * Zwei Plaetze nebeneinander sind auf einem Telefon zu schmal fuer Groesse
 * UND Pruefsumme, und die Knoepfe waren mit ~20px zu klein zum Treffen.
 * Also: alles untereinander, Knoepfe auf Fingergroesse, Datum als eine Zeile.
 */
@media (max-width: 760px) {
  .wrap { padding: 1.2rem .9rem 3rem; }

  header { flex-wrap: wrap; gap: .4rem .8rem; }
  header .right { margin-left: 0; width: 100%; }

  .state { flex-wrap: wrap; padding: .9rem 1rem; gap: .6rem; }
  .state .msg  { font-size: 1rem; }
  .state .note { margin-left: 0; width: 100%; text-align: left; font-size: .8rem; }

  .night { grid-template-columns: 1fr; gap: .45rem; padding: .6rem .7rem; }
  .when {
    flex-direction: row; align-items: baseline; gap: .5rem;
    padding-bottom: .1rem;
  }

  .slot { min-height: 0; }
  .slot .size { font-size: 1rem; }

  /* Fingergerecht: 44px sind die uebliche Mindestgroesse fuer Tippziele. */
  .acts { gap: .4rem; }
  .acts form { flex: 1; }
  .acts button {
    width: 100%; min-height: 44px; font-size: .82rem; border-radius: 8px;
  }
}

/* Sehr schmal: die Pruefsumme tritt zurueck, sie ist Beiwerk. */
@media (max-width: 400px) {
  .slot .sum { display: none; }
}
