/* ---------------------------------------------------------------
   Portal – Stylesheet
   Bewusst ohne externe Schriftarten (keine Google Fonts):
   vermeidet Drittanbieter-Requests und damit DSGVO-Fragen.
   --------------------------------------------------------------- */

:root {
  --ink:        #14181c;
  --paper:      #e9ecef;
  --surface:    #ffffff;
  --line:       #cfd4d9;
  --muted:      #626c76;
  --accent:     #1f5f8b;
  --accent-dk:  #17496b;
  --error-bg:   #fbeceb;
  --error-line: #b4433a;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* --- Kopfzeile ------------------------------------------------ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.5rem;
  background: var(--ink);
  color: #fff;
}

.topbar .brand {
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.82rem;
  color: #fff;
  text-decoration: none;
}

.topbar .brand:visited {
  color: #fff;
}

.topbar .session {
  font-size: 0.82rem;
  color: #b6bec6;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topbar .session a {
  color: #fff;
  text-decoration: none;
  border-bottom: 1px solid #55606a;
  padding-bottom: 1px;
}

.topbar .session a:hover { border-bottom-color: #fff; }

/* --- Layout --------------------------------------------------- */
.wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  margin: 0 0 0.5rem;
}

h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 2rem;
}

/* --- Login ---------------------------------------------------- */
.login-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  padding: 2rem 1.75rem;
}

.login-card h1 {
  font-size: 1.25rem;
  margin: 0 0 1.5rem;
}

label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 0.7rem 0.75rem;
  font-family: var(--font);
  font-size: 1rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 2px;
  margin-bottom: 1.1rem;
}

input:focus-visible,
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button[type="submit"] {
  width: 100%;
  padding: 0.75rem 1rem;
  font-family: var(--font);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 2px;
  cursor: pointer;
}

button[type="submit"]:hover { background: var(--accent-dk); }

.notice {
  background: var(--error-bg);
  border-left: 3px solid var(--error-line);
  padding: 0.7rem 0.85rem;
  font-size: 0.88rem;
  margin-bottom: 1.25rem;
}

/* --- Kacheln (Produktionsplanung / Share) --------------------- */
.tiles {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

.tile {
  display: block;
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  padding: 2rem 1.75rem 1.75rem;
  text-decoration: none;
  color: inherit;
  min-height: 170px;
  transition: transform 120ms ease, box-shadow 120ms ease, border-left-width 120ms ease;
}

.tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(20, 24, 28, 0.11);
  border-left-width: 10px;
}

.tile .tile-title {
  display: block;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 0.4rem;
}

.tile .tile-desc {
  display: block;
  font-size: 0.9rem;
  color: var(--muted);
}

.tile.disabled {
  border-left-color: var(--line);
  color: var(--muted);
  cursor: not-allowed;
  pointer-events: none;
  background: #f4f6f7;
}

/* --- Dateiliste ----------------------------------------------- */
.filelist {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 0.94rem;
}

.filelist th {
  text-align: left;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--line);
}

.filelist td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e6e9ec;
}

.filelist tr:last-child td { border-bottom: 0; }

.filelist a {
  color: var(--accent-dk);
  font-weight: 600;
  text-decoration: none;
}

.filelist a:hover { text-decoration: underline; }

.filelist .meta {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.82rem;
  white-space: nowrap;
}

.empty {
  background: var(--surface);
  border: 1px dashed var(--line);
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: var(--muted);
}

.back {
  display: inline-block;
  margin-top: 1.75rem;
  font-size: 0.88rem;
  color: var(--accent-dk);
  text-decoration: none;
}

.back:hover { text-decoration: underline; }

/* --- Responsiv / Barrierefreiheit ----------------------------- */
@media (max-width: 620px) {
  .tiles { grid-template-columns: 1fr; }
  .wrap  { padding-top: 2rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ===============================================================
   Ergänzungen v2 – Upload, Aktionen, Admin-Bereich
   =============================================================== */

/* Erfolgsmeldung (Gegenstueck zur roten .notice) */
.notice.ok {
  background: #e9f5ee;
  border-left-color: #2e7d4f;
}

/* Breiterer Container fuer die Admin-Tabelle */
.wrap.wide { max-width: 1100px; }

/* --- Upload-Bereich ------------------------------------------- */
.uploader {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.75rem;
}

.uploader label {
  margin-bottom: 0.5rem;
}

.uploader-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.uploader-row input[type="file"] {
  flex: 1 1 260px;
  font-size: 0.9rem;
  padding: 0.4rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #fff;
}

.uploader-row button {
  width: auto;
  padding: 0.6rem 1.4rem;
}

/* --- Aktionsspalten in Tabellen ------------------------------- */
.filelist td.actions,
.filelist th:last-child { white-space: nowrap; }

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

/* kompakte Buttons
   Selektor bewusst "button.btn-mini" (nicht nur ".btn-mini"): braucht
   dieselbe Spezifitaet wie "button[type="submit"]" weiter oben, sonst
   gewinnt dessen width:100% trotz spaeterer Position im Stylesheet.
   Feste Breite (statt auto) -> alle Aktions-Buttons und das
   Passwortfeld sind gleich breit, unabhaengig von der Textlaenge
   ("Datei-Recht entziehen" ist das laengste Label und bestimmt das Mass). */
button.btn-mini {
  width: 13rem;
  white-space: nowrap;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.35rem 0.7rem;
  margin: 0.1rem 0.15rem 0.1rem 0;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 2px;
  cursor: pointer;
}
button.btn-mini:hover { background: var(--accent-dk); }

/* Aus demselben Grund "input.inp-mini": braucht dieselbe Spezifitaet
   wie "input[type="password"]" weiter oben. Gleiche feste Breite wie
   button.btn-mini, damit Feld und "PW setzen"-Button gleich groß sind. */
input.inp-mini {
  width: 13rem;
  display: inline-block;
  font-size: 0.8rem;
  padding: 0.35rem 0.5rem;
  margin: 0.1rem 0;
  border: 1px solid var(--line);
  border-radius: 2px;
  vertical-align: middle;
}

.btn-danger { background: #b4433a; }
.btn-danger:hover { background: #963730; }

/* --- Admin-Tabelle -------------------------------------------- */
.admin-table td { vertical-align: top; }

.actions-col form {
  display: block;
  margin-bottom: 0.2rem;
}

.pill {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}
.pill-on  { background: #e9f5ee; color: #256b43; }
.pill-off { background: #f2e3e2; color: #8a352d; }

.tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0 0.35rem;
  margin-left: 0.4rem;
}

.legend {
  font-size: 0.85rem;
  color: var(--muted);
  margin: -0.5rem 0 1.5rem;
}

/* --- Neuer Benutzer ------------------------------------------- */
.newuser {
  margin-top: 2.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  padding: 1.5rem 1.5rem 1.75rem;
}

.newuser h2 {
  font-size: 1.05rem;
  margin: 0 0 1.25rem;
}

.newuser-form { max-width: 420px; }

.newuser .field { margin-bottom: 1rem; }

.newuser .field.checks label {
  display: block;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  color: var(--ink);
  font-size: 0.92rem;
  margin-bottom: 0.4rem;
}

.newuser .field.checks input { width: auto; margin-right: 0.4rem; }

.newuser button[type="submit"] { width: auto; padding: 0.7rem 1.6rem; }

@media (max-width: 720px) {
  .admin-table, .admin-table thead, .admin-table tbody,
  .admin-table th, .admin-table td, .admin-table tr { display: block; }
  .admin-table thead { display: none; }
  .admin-table tr {
    border: 1px solid var(--line);
    margin-bottom: 1rem;
    padding: 0.5rem;
  }
  .admin-table td { border: 0; padding: 0.35rem 0.5rem; }
  button.btn-mini,
  input.inp-mini { width: 100%; margin-bottom: 0.3rem; }
}
