/* ============================================================
   plan.labsupport.at – Stylesheet (minimalistisch, Labsupport-Look)
   ============================================================ */
:root {
    --navy:        #262673;   /* Labsupport-Marineblau */
    --navy-dark:   #1b1b55;
    --navy-soft:   #ecedf6;
    --ink:         #232733;
    --muted:       #6b7686;
    --line:        #e6e8ef;
    --bg:          #f6f7f9;
    --card:        #ffffff;
    --red:         #c0392b;  --red-bg:   #fbecea;
    --amber:       #9a6700;  --amber-bg: #fbf3e2;
    --green:       #1d7a46;  --green-bg: #e7f5ec;
    --radius:      10px;
    --shadow:      0 1px 2px rgba(20,24,40,.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--navy); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; font-weight: 650; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; font-weight: 600; margin: 1.75rem 0 .75rem; color: var(--ink); }
small { color: var(--muted); }

/* ---------- Topbar ---------- */
.topbar {
    display: flex; align-items: center; gap: 1.25rem;
    background: var(--card); border-bottom: 1px solid var(--line);
    padding: 0 1.75rem; height: 64px; position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: .6rem; }
.brand:hover { text-decoration: none; }
.brand-logo { height: 38px; width: auto; display: block; }
.brand-sub { color: var(--muted); font-size: .8rem; border-left: 1px solid var(--line); padding-left: .6rem; }
.mainnav { display: flex; gap: .15rem; margin-left: 1rem; }
.mainnav a { color: var(--muted); padding: .5rem .9rem; border-radius: 8px; font-weight: 500; font-size: .92rem; }
.mainnav a:hover { background: var(--bg); color: var(--ink); text-decoration: none; }
.mainnav a.active { color: var(--navy); background: var(--navy-soft); }
.userbox { margin-left: auto; display: flex; align-items: center; gap: .75rem; color: var(--muted); font-size: .88rem; }

/* ---------- Layout ---------- */
.container { max-width: 1120px; margin: 1.75rem auto; padding: 0 1.75rem; }
.appfooter { text-align: center; color: var(--muted); font-size: .78rem; padding: 2rem 0 2.5rem; }
.pagehead { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.breadcrumb { color: var(--muted); font-size: .85rem; margin-bottom: .6rem; }
.breadcrumb a { color: var(--muted); }

/* ---------- Seiten-Banner (unterscheidet Seitentypen) ---------- */
.pagebanner {
    display: flex; align-items: center; gap: 1rem;
    background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--navy);
    border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1.25rem; box-shadow: var(--shadow);
}
.pagebanner-icon { width: 46px; height: 46px; border-radius: 11px; background: var(--navy-soft); color: var(--navy); display: grid; place-items: center; flex: 0 0 auto; }
.pagebanner h1 { font-size: 1.3rem; }
.pagebanner-sub { color: var(--muted); font-size: .88rem; margin-top: .1rem; }
.pagebanner-actions { margin-left: auto; display: flex; gap: .5rem; flex-wrap: wrap; }
/* Variante: Wartung (grün) */
.pagebanner.service { border-left-color: var(--green); }
.pagebanner.service .pagebanner-icon { background: var(--green-bg); color: var(--green); }
@media (max-width: 640px) {
    .pagebanner { flex-wrap: wrap; }
    .pagebanner-actions { margin-left: 0; width: 100%; }
}

/* ---------- Cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; margin-bottom: 1.25rem; }
.card-pad { padding: 1.25rem; }

/* ---------- Stat tiles ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.05rem 1.15rem; box-shadow: var(--shadow); }
.stat .num { font-size: 1.85rem; font-weight: 700; line-height: 1; color: var(--ink); }
.stat .lbl { color: var(--muted); font-size: .82rem; margin-top: .4rem; }
.stat.red .num { color: var(--red); }
.stat.amber .num { color: var(--amber); }
@media (max-width: 720px) { .stats { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: .4rem; background: var(--navy); color: #fff; border: 1px solid var(--navy); padding: .55rem 1rem; border-radius: 8px; font-weight: 600; cursor: pointer; font-size: .9rem; line-height: 1; }
.btn:hover { background: var(--navy-dark); border-color: var(--navy-dark); text-decoration: none; color: #fff; }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--bg); color: var(--ink); }
.btn-danger { background: #fff; color: var(--red); border-color: var(--line); }
.btn-danger:hover { background: var(--red-bg); border-color: var(--red); }
.btn-teal { background: #fff; color: var(--navy); border-color: var(--navy-soft); }
.btn-teal:hover { background: var(--navy-soft); }
.btn-sm { padding: .35rem .65rem; font-size: .82rem; }
.btn-block { width: 100%; justify-content: center; }
.actions { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }

/* ---------- Filter chips ---------- */
.filterbar { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.chip { display: inline-flex; align-items: center; gap: .4rem; padding: .4rem .8rem; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--muted); font-weight: 500; font-size: .88rem; }
.chip:hover { text-decoration: none; border-color: var(--navy); color: var(--navy); }
.chip.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.chip-n { font-size: .75rem; opacity: .8; }
.chip.active .chip-n { opacity: .9; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; }
thead th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border-bottom: 1px solid var(--line); padding: .55rem .65rem; font-weight: 600; }
tbody td { padding: .7rem .65rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbfd; }
.table-wrap { overflow-x: auto; }
.sorth { color: inherit; text-decoration: none; white-space: nowrap; cursor: pointer; }
.sorth:hover { color: var(--navy); text-decoration: none; }
.sorth.active { color: var(--navy); }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: .2rem .55rem; border-radius: 6px; font-size: .76rem; font-weight: 600; white-space: nowrap; }
.badge.overdue { background: var(--red-bg); color: var(--red); }
.badge.soon { background: var(--amber-bg); color: var(--amber); }
.badge.ok { background: var(--green-bg); color: var(--green); }
.badge.none { background: #eef0f4; color: var(--muted); }
.badge.cat { background: var(--navy-soft); color: var(--navy); }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 1.25rem; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
label { display: block; font-weight: 600; font-size: .84rem; margin-bottom: .3rem; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], select, textarea {
    width: 100%; padding: .55rem .65rem; border: 1px solid var(--line); border-radius: 8px; font: inherit; color: var(--ink); background: #fff;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(38,38,115,.12); }
textarea { resize: vertical; min-height: 90px; }
.hint { color: var(--muted); font-size: .8rem; margin-top: .25rem; }
.hint a { color: var(--navy); }
.form-footer { display: flex; gap: .75rem; margin-top: 1.5rem; align-items: center; }
.radio-row { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.radio { display: flex; align-items: center; gap: .45rem; font-weight: 500; cursor: pointer; }
.radio input { width: auto; }
.radio small { color: var(--muted); }
@media (max-width: 640px) { .radio-row { flex-direction: column; gap: .6rem; } }

/* Fieldset-Sektionen im Geräteformular */
.section { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem 1.25rem; margin: 1.5rem 0 0; }
.section legend { font-weight: 600; font-size: .85rem; color: var(--navy); padding: 0 .5rem; }
.section[hidden] { display: none; }

/* ---------- Flash ---------- */
.flash { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-weight: 500; }
.flash-success { background: var(--green-bg); color: var(--green); }
.flash-error { background: var(--red-bg); color: var(--red); }

/* ---------- Auth ---------- */
body.auth { background: var(--bg); min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.auth-wrap { width: 100%; max-width: 380px; padding: 1.5rem; }
.auth-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 2.25rem; box-shadow: 0 10px 30px rgba(20,24,40,.08); }
.auth-logo { text-align: center; margin-bottom: 1.75rem; }
.auth-logo img { height: 46px; width: auto; margin-bottom: .9rem; }
.auth-logo .sub { color: var(--muted); font-size: .9rem; }

/* ---------- Misc ---------- */
.empty { text-align: center; color: var(--muted); padding: 2.5rem 1rem; }
.empty p { margin-bottom: 1rem; }
.muted { color: var(--muted); }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: .5rem 1rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.inline-form { display: inline; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.searchbar { display: flex; gap: .5rem; margin-bottom: 1rem; }
.searchbar input { max-width: 360px; }
code { background: var(--navy-soft); color: var(--navy); padding: .1rem .35rem; border-radius: 4px; font-size: .82em; }

/* Gerätegruppen-Tags */
.grouplist { display: flex; flex-wrap: wrap; gap: .5rem; }
.grouptag { display: inline-flex; align-items: center; gap: .4rem; background: var(--navy-soft); color: var(--navy); border-radius: 999px; padding: .3rem .35rem .3rem .8rem; font-weight: 600; font-size: .86rem; }
.grouptag .inline-form { display: inline-flex; }
.grouptag-x { border: none; background: transparent; color: var(--navy); cursor: pointer; font-size: 1.15rem; line-height: 1; padding: 0 .15rem; border-radius: 50%; }
.grouptag-x:hover:not(:disabled) { color: var(--red); }
.grouptag-x:disabled { color: var(--muted); opacity: .45; cursor: not-allowed; }

/* Inline-Passwort-Reset in Benutzertabelle */
.inline-reset { display: flex; gap: .4rem; align-items: center; }
.inline-reset input { width: 160px; padding: .4rem .55rem; }

/* ---------- Icons ---------- */
.ic { display: inline-block; vertical-align: -.18em; flex: 0 0 auto; }
.btn .ic { vertical-align: middle; }
.filterhint { color: var(--muted); font-size: .8rem; align-self: center; margin-left: .25rem; }

/* Quadratische Icon-Buttons (scharf, einheitlich) */
.iconbtn {
    display: inline-grid; place-items: center; width: 34px; height: 34px;
    border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
    cursor: pointer; padding: 0; line-height: 0;
}
.iconbtn:hover { background: var(--bg); text-decoration: none; color: var(--ink); }
.iconbtn.teal { color: var(--navy); border-color: var(--navy-soft); }
.iconbtn.teal:hover { background: var(--navy-soft); }
.iconbtn.danger { color: var(--red); }
.iconbtn.danger:hover { background: var(--red-bg); border-color: var(--red); }
.col-actions { width: 1%; white-space: nowrap; }

/* ============================================================
   Mobile
   ============================================================ */
@media (max-width: 760px) {
    .topbar { height: auto; min-height: 56px; padding: .55rem .9rem; flex-wrap: wrap; gap: .5rem .9rem; }
    .brand-logo { height: 32px; }
    .brand-sub { display: none; }
    .userbox { margin-left: auto; }
    .username { display: none; }
    .mainnav { order: 3; width: 100%; margin-left: 0; gap: .1rem; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
    .mainnav a { white-space: nowrap; padding: .45rem .7rem; }

    .container { margin: 1rem auto; padding: 0 .9rem; }
    h1 { font-size: 1.25rem; }
    .pagehead { gap: .6rem; }
    .card { padding: 1rem; }

    /* Tabellen als Karten */
    table.responsive thead { display: none; }
    table.responsive, table.responsive tbody, table.responsive tr, table.responsive td { display: block; width: 100%; }
    table.responsive tr { border: 1px solid var(--line); border-radius: 10px; margin-bottom: .75rem; padding: .35rem .15rem; }
    table.responsive tr:hover { background: transparent; }
    table.responsive td { border: none; padding: .4rem .75rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
    table.responsive td::before { content: attr(data-l); font-weight: 600; color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .03em; }
    table.responsive td.col-actions { justify-content: flex-end; padding-top: .5rem; }
    table.responsive td.col-actions::before { content: ""; }
    .col-actions { width: auto; }

    .form-footer { flex-wrap: wrap; }
    .searchbar { flex-wrap: wrap; }
    .searchbar input { max-width: none; flex: 1 1 100%; }
}

