/* Stage Manager — basisstijl
   Handgeschreven CSS, bewust zonder buildstap. Aanpassen betekent dit bestand
   uploaden en ASSET_VERSION in .env ophogen. */

:root {
    /* Achtergronden: zwart, met stapsgewijs lichtere vlakken */
    --bg:        #000000;   /* pagina */
    --surface:   #0F0F0F;   /* kaarten en panelen */
    --surface-2: #161616;   /* invoervelden, knoppen */
    --surface-3: #1F1F1F;   /* hover */
    --line:      #2A2A2A;   /* randen */
    --line-soft: #1C1C1C;   /* lichte scheidingslijnen in tabellen */

    /* Oude namen blijven werken; sommige schermen gebruiken ze rechtstreeks. */
    --navy-900: var(--bg);
    --navy-800: var(--surface);
    --navy-700: var(--surface);
    --navy-600: var(--line-soft);
    --navy-500: var(--line);

    --accent:      #F5821F;
    --accent-dark: #C9660F;
    --accent-soft: rgba(245, 130, 31, 0.14);

    --white:  #FFFFFF;
    --muted:  #A6A6A6;
    --dim:    #6E6E6E;

    --green: #3FB77E;
    --amber: #F0B429;
    --red:   #E2574C;

    --radius: 8px;
    --radius-lg: 12px;

    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--white);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.6;
    -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { font-weight: 500; margin: 0 0 12px; line-height: 1.25; }
h1 { font-size: 24px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }

p { margin: 0 0 12px; }

.muted { color: var(--muted); }
.dim   { color: var(--dim); }
.small { font-size: 13px; }
.mono  { font-family: var(--mono); }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }

/* ------------------------------------------------------------------ layout */

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar-inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 24px;
    min-height: 58px;
}

.brand {
    color: var(--white);
    font-weight: 500;
    font-size: 17px;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand span { color: var(--accent); }

.nav {
    display: flex;
    gap: 2px;
    flex: 1;
    align-items: center;
    min-width: 0;
}

.nav a,
.uitklap-knop {
    color: var(--muted);
    padding: 8px 11px;
    border-radius: var(--radius);
    font-size: 15px;
    white-space: nowrap;
    background: none;
    border: none;
    font-family: var(--font);
    cursor: pointer;
    line-height: 1.6;
}

.nav a:hover,
.uitklap-knop:hover { background: var(--surface-2); color: var(--white); text-decoration: none; }
.nav > a.active { background: var(--accent); color: #000; }

/* ------------------------------------------------------------ uitklapmenu */

.uitklap { position: relative; }

.uitklap.actief > .uitklap-knop { background: var(--accent); color: #000; }
.uitklap .pijl { font-size: 10px; opacity: .7; margin-left: 2px; }

.uitklap-inhoud {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 190px;
    max-width: min(280px, calc(100vw - 32px));
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 5px;
    z-index: 40;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .6);
}

/* Zit de knop rechts in beeld, dan klapt het menu naar links open zodat het
   niet buiten het scherm valt. */
.uitklap.rechts .uitklap-inhoud { left: auto; right: 0; }

.uitklap.open .uitklap-inhoud { display: block; }

.uitklap-inhoud a {
    display: block;
    padding: 9px 12px;
    border-radius: var(--radius);
    color: var(--muted);
    font-size: 15px;
}
.uitklap-inhoud a:hover { background: var(--surface-2); color: var(--white); }
.uitklap-inhoud a.active { color: var(--accent); }

/* --------------------------------------------------------- menuknop */

.menuknop {
    display: none;
    background: none;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 9px 10px;
    cursor: pointer;
    flex-shrink: 0;
}

.menuknop span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--white);
    border-radius: 2px;
}
.menuknop span + span { margin-top: 4px; }

.gebruikersnaam { color: var(--muted); white-space: nowrap; }
.gebruikersnaam:hover { color: var(--white); }

.topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 14px;
    color: var(--muted);
}

.clock { font-family: var(--mono); font-size: 15px; color: var(--white); }

.container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 28px 20px 64px;
}

.container-narrow { max-width: 560px; }

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

/* ------------------------------------------------------------------- cards */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
    margin-bottom: 18px;
}

.card-tight { padding: 14px 16px; }

.card h2:first-child, .card h3:first-child { margin-top: 0; }

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
}

/* ------------------------------------------------------------------- forms */

label {
    display: block;
    font-size: 14px;
    color: var(--muted);
    margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
select,
textarea {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--white);
    font-family: var(--font);
    font-size: 16px;
    padding: 11px 13px;
    outline: none;
}

textarea { min-height: 110px; resize: vertical; line-height: 1.5; }

input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

input::placeholder, textarea::placeholder { color: var(--dim); }

/* Datum- en tijdvelden tonen hun icoon standaard donker op donker */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    filter: invert(1) opacity(0.5);
    cursor: pointer;
}

.field { margin-bottom: 16px; }

.checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: var(--white);
    font-size: 15px;
}
.checkbox input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--accent); }
.checkbox label { margin: 0; color: var(--white); font-size: 15px; }

.hint { font-size: 13px; color: var(--dim); margin-top: 6px; }

.error-text { color: var(--red); font-size: 13px; margin-top: 6px; }

/* ----------------------------------------------------------------- buttons */

.btn {
    display: inline-block;
    background: var(--surface-2);
    color: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 11px 18px;
    font-size: 15px;
    font-family: var(--font);
    cursor: pointer;
    text-align: center;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:active { transform: translateY(1px); }

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #000;
    font-weight: 500;
}
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }

.btn-quiet { background: transparent; border-color: var(--line); color: var(--muted); }
.btn-quiet:hover { background: var(--surface-2); color: var(--white); }

.btn-danger { background: transparent; border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: var(--red); color: var(--white); }

.btn-small { padding: 6px 12px; font-size: 13px; }
.btn-block { display: block; width: 100%; }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* --------------------------------------------------------------- meldingen */

.alert {
    border-radius: var(--radius);
    padding: 13px 16px;
    margin-bottom: 18px;
    font-size: 15px;
    border-left: 3px solid transparent;
    background: var(--surface);
    border-top: 1px solid var(--line);
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}
.alert-success { border-left-color: var(--green); }
.alert-error   { border-left-color: var(--red); }
.alert-info    { border-left-color: var(--accent); }
.alert-warning { border-left-color: var(--amber); }

.alert ul { margin: 6px 0 0; padding-left: 20px; }

/* ------------------------------------------------------------------ badges */

.badge {
    display: inline-block;
    font-size: 12px;
    padding: 3px 9px;
    border-radius: var(--radius);
    background: var(--surface-3);
    color: var(--white);
    white-space: nowrap;
}
.badge-accent  { background: var(--accent); color: #000; }
.badge-green   { background: var(--green);  color: #000; }
.badge-red     { background: var(--red);    color: #fff; }
.badge-amber   { background: var(--amber);  color: #000; }
.badge-quiet   { background: transparent; border: 1px solid var(--line); color: var(--muted); }

/* ------------------------------------------------------------------ tabels */

table { width: 100%; border-collapse: collapse; font-size: 15px; }

th {
    text-align: left;
    font-weight: 500;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--dim);
    padding: 0 12px 10px;
    border-bottom: 1px solid var(--line);
}

td { padding: 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }

tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }

.table-wrap { overflow-x: auto; }

/* Invoervelden binnen een tabel wat compacter */
td input[type="text"],
td input[type="time"],
td input[type="number"],
td select {
    padding: 8px 10px;
    font-size: 15px;
}

/* ------------------------------------------------------------------ diverse */

.copybox {
    display: flex;
    gap: 8px;
    align-items: stretch;
    margin-top: 10px;
}
.copybox input {
    font-family: var(--mono);
    font-size: 13px;
}

pre.output {
    background: #000;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px;
    font-family: var(--mono);
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--muted);
    overflow-x: auto;
    max-height: 420px;
    white-space: pre-wrap;
    word-break: break-word;
}

.check-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 11px 0;
    border-top: 1px solid var(--line-soft);
}
.check-row:first-child { border-top: none; }
.check-mark { font-size: 16px; line-height: 1.4; width: 20px; flex-shrink: 0; }
.check-ok   { color: var(--green); }
.check-bad  { color: var(--red); }

.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 32px;
}
.auth-brand {
    text-align: center;
    font-size: 22px;
    font-weight: 500;
    margin-bottom: 4px;
}
.auth-brand span { color: var(--accent); }
.auth-sub { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 26px; }

.stack > * + * { margin-top: 10px; }

/* Vanaf hier past de balk niet meer op één regel: menu inklappen. */
@media (max-width: 1080px) {
    .topbar-inner {
        flex-wrap: wrap;
        padding: 10px 16px;
        gap: 10px;
        align-items: center;
    }

    /* Volgorde op de bovenste regel: naam links, dan gegevens, knop rechts. */
    .brand       { order: 1; }
    .topbar-right { order: 2; margin-left: auto; }
    .menuknop    { order: 3; display: block; }

    .nav {
        display: none;
        order: 4;
        width: 100%;
        flex: 1 0 100%;
        flex-direction: column;
        align-items: stretch;
        text-align: left;
        gap: 2px;
        padding-top: 8px;
        margin-top: 2px;
        border-top: 1px solid var(--line);
    }

    .nav.open { display: flex; }

    .nav > a,
    .nav .uitklap-knop {
        display: block;
        width: 100%;
        padding: 12px;
        text-align: left;
    }

    .nav .uitklap { width: 100%; }

    /* In het hoofdmenu schuift het submenu open in plaats van eroverheen. */
    .nav .uitklap-inhoud {
        position: static;
        display: none;
        border: none;
        box-shadow: none;
        padding: 0 0 4px 14px;
        background: none;
        min-width: 0;
        max-width: none;
    }

    .nav .uitklap.open .uitklap-inhoud { display: block; }

    .clock { display: none; }
}

@media (max-width: 720px) {
    .container { padding: 20px 16px 48px; }
    .card { padding: 16px; }
    th, td { padding: 10px 8px; }
    .gebruikersnaam { display: none; }
}

/* ---------------------------------------------------------- informatiestrook */

/* Eén strook in plaats van losse kaarten: bij negen gegevens werden dat drie
   rijen met een halflege staart. */
.infostrook {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    padding: 0;
}

.infoveld {
    padding: 12px 18px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    flex: 1 1 auto;
    min-width: 120px;
}

.infoveld:last-child { border-right: none; }

.infowaarde {
    margin-top: 4px;
    font-size: 15px;
}

.infoveld .badge { margin-top: 5px; }

/* ------------------------------------------------------ knoppen in een menu */

.uitklap-actie {
    display: block;
    width: 100%;
    text-align: left;
    padding: 9px 12px;
    border: none;
    background: none;
    color: var(--muted);
    font: inherit;
    font-size: 15px;
    border-radius: var(--radius);
    cursor: pointer;
}
.uitklap-actie:hover { background: var(--surface-2); color: var(--white); }

@media (max-width: 720px) {
    .infoveld { min-width: 45%; padding: 10px 14px; }
}

/* ------------------------------------------------------------------ venster */

.venster {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 6vh 16px 16px;
    overflow-y: auto;
}

.venster[hidden] { display: none; }

.venster-vulling {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .7);
}

.venster-kaart {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg, 10px);
    padding: 22px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, .6);
}

.venster-kop {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

/* ==========================================================================
   Telefoonformaat (tot 640px)
   ========================================================================== */

/*
 * Tabellen worden kaarten. Horizontaal scrollen werkt op een telefoon niet:
 * je ziet de artiestnaam niet meer zodra je naar de statuskolom veegt.
 *
 * Elke cel toont zijn eigen kopje via data-label. Cellen zonder label — de
 * knoppenkolom bijvoorbeeld — krijgen er geen.
 */
@media (max-width: 640px) {

    .table-wrap { overflow: visible; }

    .table-wrap table,
    .table-wrap thead,
    .table-wrap tbody,
    .table-wrap tr,
    .table-wrap th,
    .table-wrap td {
        display: block;
        width: auto;
    }

    .table-wrap thead { display: none; }

    .table-wrap tr {
        background: var(--surface-2);
        border: 1px solid var(--line);
        border-radius: var(--radius);
        padding: 12px 14px;
        margin-bottom: 10px;
    }

    .table-wrap td {
        border: none;
        padding: 5px 0;
        display: flex;
        gap: 12px;
        align-items: baseline;
        text-align: left !important;
    }

    .table-wrap td[data-label]::before {
        content: attr(data-label);
        flex: 0 0 38%;
        color: var(--muted);
        font-size: 13px;
    }

    /* De eerste cel is de titel van de kaart. */
    .table-wrap td:first-child {
        font-size: 17px;
        font-weight: 500;
        padding-bottom: 8px;
        margin-bottom: 4px;
        border-bottom: 1px solid var(--line);
    }
    .table-wrap td:first-child::before { display: none; }

    /* Knoppen onderaan de kaart, over de volle breedte. */
    .table-wrap td:last-child .btn-row {
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 6px;
        margin-top: 6px;
    }

    .table-wrap td .btn-small { padding: 8px 12px; }

    /* Lege cellen nemen geen ruimte in. */
    .table-wrap td:empty { display: none; }

    /* ------------------------------------------------------------ algemeen */

    .page-head {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .page-head .btn-row { flex-wrap: wrap; }

    .card { padding: 16px 14px; }

    .grid { grid-template-columns: 1fr; }

    /* iOS zoomt in bij velden kleiner dan 16px. */
    input, select, textarea { font-size: 16px; }

    /* Knoppen groot genoeg om met een duim te raken. */
    .btn { padding: 11px 15px; }

    h1 { font-size: 24px; }
    h2 { font-size: 19px; }
}

/* ------------------------------------------------------- kleine telefoons */

@media (max-width: 400px) {
    .container { padding: 16px 12px 40px; }
    .card { padding: 14px 12px; }
    .table-wrap td[data-label]::before { flex-basis: 42%; }
}

/* ==========================================================================
   Ingesloten modus — de pagina staat in een webweergave in de iOS-app
   ========================================================================== */

/*
 * De app heeft zijn eigen navigatiebalk, dus die van de webversie is dubbelop.
 * De balk wordt in de layout overgeslagen; hier vangen we de gevolgen op.
 */
body.ingebed .container {
    /* Zonder balk erboven mag de inhoud dichter naar de rand. */
    padding-top: 16px;
}

/* Links die je uit de app zou laten stappen hebben hier geen zin. */
body.ingebed .terug-naar-dashboard { display: none; }

/* De pagina scrollt in de webweergave zelf; geen dubbele scrollbalk. */
body.ingebed { min-height: auto; }

@media (max-width: 640px) {
    body.ingebed .container { padding-top: 12px; }
}
