/* Gemeinsam für Stunden- und Projektübersicht: Farben, Grundlagen, Kopfzeile, Konto-Menü,
   Meldung und Sicherheitsfrage. Wird vor dem style.css der jeweiligen Seite geladen. Regeln: DESIGN.md */
:root {
    --bg: #f3f5f7;
    --surface: #ffffff;
    --surface-2: #f7f9fa;
    --border: #e4e9ed;
    --border-strong: #d2dae0;
    --text: #0f1c24;
    --text-2: #475862;
    --muted: #7b8a94;
    --brand: #0a7483;
    --brand-hover: #085f6b;
    --brand-soft: #e7f3f4;
    --danger: #c2414b;
    --danger-soft: #fdf1f2;
    --success: #16825d;
    --success-soft: #e8f5ef;
    --radius-lg: 16px;
    --radius: 10px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow: 0 1px 3px rgba(16, 24, 40, .05), 0 10px 30px -12px rgba(16, 24, 40, .12);
    --shadow-lg: 0 24px 60px -20px rgba(16, 24, 40, .25);
    --ring: 0 0 0 3px rgba(10, 116, 131, .16);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    min-height: 100vh;
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 14px;
    line-height: 1.45;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    padding-bottom: 56px;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease; }
[hidden] { display: none !important; }
:focus-visible { outline: none; box-shadow: var(--ring); }

.icon { width: 16px; height: 16px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon.icon-inline { width: 1em; height: 1em; vertical-align: -0.125em; }

/* ---------- Buttons ---------- */
.btn-ghost {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    height: 36px; padding: 0 12px;
    background: var(--surface); color: var(--text-2); text-decoration: none;
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 500; white-space: nowrap;
}
.btn-ghost:hover { color: var(--text); border-color: #b3bfc7; background: var(--surface-2); }
.btn-primary {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    height: 36px; padding: 0 14px;
    background: var(--brand); color: #fff;
    border: 1px solid var(--brand); border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 600;
}
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-primary:disabled { background: var(--surface-2); border-color: var(--border); color: var(--muted); cursor: default; }
.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; padding: 0;
    background: var(--surface); color: var(--text-2);
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
}
.icon-btn:hover { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); }

/* ---------- Kopfzeile: Marke links, Reiter mittig, Aktionen rechts ---------- */
.app-bar {
    position: sticky; top: 0; z-index: 50;
    display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px;
    height: 64px; padding: 0 clamp(16px, 3vw, 40px); margin-bottom: 28px;
    background: rgba(255, 255, 255, .85);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { width: 30px; height: 30px; flex: 0 0 auto; }
.brand-name { font-size: 15px; font-weight: 700; letter-spacing: -.2px; }
.app-nav { justify-self: center; display: flex; gap: 2px; padding: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px; }
.tab-btn { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px; background: transparent; border: 0; border-radius: var(--radius-sm); color: var(--text-2); font-size: 13px; font-weight: 500; text-decoration: none; }
.tab-btn:hover { color: var(--text); }
.tab-btn.active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(16, 24, 40, .1); }
.app-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
/* Neu laden mit Auto-Refresh bzw. Datenstand als eine Gruppe im Stil der Leiste */
.refresh-box { display: flex; align-items: center; gap: 2px; padding: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; }
/* background-color statt background: das Auswahlfeld behält sein Pfeil-Bild */
.refresh-box .btn-ghost, .refresh-box select { height: 30px; border: 0; border-radius: 7px; background-color: transparent; box-shadow: none; font-size: 13px; }
.refresh-box .btn-ghost:hover, .refresh-box select:hover { background-color: var(--surface); }
.reload-btn:disabled { opacity: .6; cursor: progress; }
.reload-btn:disabled .icon { animation: reload-spin 1s linear infinite; }
@keyframes reload-spin { to { transform: rotate(360deg); } }
.fetched-at { color: var(--muted); font-size: 12px; white-space: nowrap; }
/* Mittlere Breiten: Aktionen rechts nur als Symbole (Text im title), Konto nur mit Kürzel, damit die
   sieben Reiter und die Aktionen in eine Zeile passen und rechts nichts abgeschnitten wird */
@media (max-width: 1720px) {
    .app-bar .app-actions .btn-ghost span, .account-chip > span:not(.account-avatar) { display: none; }
    .tab-btn { padding: 0 11px; }
}
/* Reiter in eigene Zeile, sobald sie mit den Aktionen nicht mehr in eine passen */
@media (max-width: 1440px) {
    .app-bar { grid-template-columns: auto 1fr; height: auto; padding-top: 10px; padding-bottom: 10px; row-gap: 10px; }
    .app-nav { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; }
    .app-nav .tab-btn { flex: 1; justify-content: center; }
}
/* Handy: vier Reiter passen nur ohne Icons und mit weniger Abstand in eine Zeile */
@media (max-width: 560px) {
    .app-nav { min-width: 0; overflow-x: auto; }
    .app-nav .tab-btn { gap: 0; padding: 0 6px; font-size: 12px; }
    .app-nav .tab-btn .icon { display: none; }
}

/* ---------- Konto-Menü (Name, E-Mail, Abmelden) ---------- */
.account { position: relative; }
.account-chip { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 10px 0 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; font-weight: 600; }
.account-chip:hover, .account-chip[aria-expanded="true"] { background: var(--bg); }
.account-chip .icon { color: var(--muted); }
.account-avatar { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 999px; background: var(--brand); color: #fff; font-size: 12px; }
.account-pop { position: absolute; right: 0; top: 48px; z-index: 60; width: 280px; padding: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); }
.account-who { display: flex; flex-direction: column; padding: 10px 12px 12px; border-bottom: 1px solid #eef1f3; }
.account-who span { color: var(--muted); font-size: 13px; word-break: break-all; }
.account-item, .account-logout { display: flex; align-items: center; gap: 10px; width: 100%; height: 42px; margin-top: 6px; padding: 0 12px; background: none; border: 0; border-radius: var(--radius-sm); font-weight: 500; }
.account-item:hover { background: var(--bg); }
.account-item .icon { color: var(--muted); }
.account-logout { color: var(--danger); }
.account-logout:hover { background: var(--danger-soft); }
.account-item:not([hidden]) + .account-logout { margin-top: 0; }

/* ---------- Meldung unten im Fenster (notify) und Sicherheitsfrage (askConfirm) ---------- */
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 1000; max-width: min(92vw, 520px); padding: 11px 16px 11px 14px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; background: #0f1c24; color: #fff; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 13px; font-weight: 500; }
.toast::before { content: ""; flex: 0 0 8px; height: 8px; border-radius: 999px; background: #4fb0b9; }
.toast.error::before { background: #f08a92; }
.confirm-backdrop { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 16px; background: rgba(15, 28, 36, .45); }
.confirm-box { width: min(100%, 420px); padding: 22px; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); }
.confirm-box p { font-size: 15px; line-height: 1.5; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* Handy: Kopfzeile nur mit Symbolen */
@media (max-width: 640px) {
    .app-bar { margin-bottom: 20px; }
    .brand-name, .app-bar .btn-ghost span, .fetched-at { display: none; }
    .app-actions { gap: 6px; }
    .account-chip > span:not(.account-avatar) { display: none; }
}
