/* Summary: applicatie stylesheet | layout sidebar | tabellen | formulieren | badges | dialogen */
:root {
    --brand: #1b4f8a;
    --brand-dark: #143c69;
    --brand-light: #eaf1f9;
    --accent: #2ea36b;
    --danger: #c23b3b;
    --warn: #b98700;
    --text: #22303d;
    --muted: #6b7a89;
    --border: #d8e0e8;
    --bg: #f4f6f9;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    font-family: "Segoe UI", system-ui, sans-serif;
    color: var(--text);
    background: var(--bg);
    height: 100%;
    font-size: 15px;
}

h1 { font-size: 1.45rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 1.2rem 0 .6rem; }
a { color: var(--brand); }

/* ---- layout: sidebar + content ---- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 230px;
    flex-shrink: 0;
    background: var(--brand-dark);
    color: #fff;
    display: flex;
    flex-direction: column;
}

.sidebar .brand {
    display: flex; align-items: center; gap: .6rem;
    padding: 1rem;
    font-weight: 700; font-size: 1.05rem;
    background: var(--brand);
}
.sidebar .brand img { width: 30px; height: 30px; }
.sidebar .tenant-name {
    padding: .45rem 1rem; font-size: .8rem; color: #bcd2e8;
    border-bottom: 1px solid rgba(255,255,255,.15);
}

.sidebar nav { flex: 1; padding: .5rem 0; }
.sidebar nav a {
    display: block; padding: .55rem 1rem;
    color: #dbe7f3; text-decoration: none; font-size: .95rem;
}
.sidebar nav a:hover { background: rgba(255,255,255,.08); }
.sidebar nav a.active { background: var(--brand); color: #fff; font-weight: 600; }

.sidebar .user-box {
    padding: .8rem 1rem; font-size: .85rem;
    border-top: 1px solid rgba(255,255,255,.15); color: #bcd2e8;
}
.sidebar .user-box a { color: #fff; }

.content { flex: 1; padding: 1.4rem 1.8rem; min-width: 0; }

/* ---- toolbar boven lijsten ---- */
.toolbar { display: flex; gap: .6rem; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.toolbar input[type="search"], .toolbar input[type="text"] { min-width: 220px; }

/* ---- tabellen ---- */
table.grid { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--border); }
table.grid th, table.grid td { padding: .5rem .65rem; text-align: left; border-bottom: 1px solid var(--border); }
table.grid th { background: var(--brand-light); font-size: .82rem; text-transform: uppercase; letter-spacing: .02em; color: var(--brand-dark); }
table.grid tbody tr:hover { background: #f0f5fb; }
table.grid tr.clickable { cursor: pointer; }
table.grid td.num, table.grid th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---- formulieren ---- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: .8rem 1.2rem; max-width: 1100px; }
.form-grid .full { grid-column: 1 / -1; }
label { display: block; font-size: .82rem; color: var(--muted); margin-bottom: .2rem; }
input, select, textarea {
    width: 100%; padding: .45rem .55rem; font: inherit;
    border: 1px solid var(--border); border-radius: 5px; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
input[type="checkbox"] { width: auto; }
.check-row { display: flex; align-items: center; gap: .45rem; }
.check-row label { margin: 0; color: var(--text); font-size: .95rem; }

/* ---- knoppen ---- */
.btn {
    display: inline-block; padding: .48rem .95rem; border-radius: 5px; border: 1px solid transparent;
    background: var(--brand); color: #fff; font: inherit; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--brand-dark); }
.btn.secondary { background: #fff; color: var(--brand); border-color: var(--brand); }
.btn.secondary:hover { background: var(--brand-light); }
.btn.success { background: var(--accent); }
.btn.danger { background: var(--danger); }
.btn.small { padding: .25rem .6rem; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---- badges & meldingen ---- */
.badge { display: inline-block; padding: .12rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 600; }
.badge.draft { background: #e3e8ee; color: #4a5a6a; }
.badge.confirmed { background: #dcebff; color: #1b4f8a; }
.badge.completed { background: #d9f2e4; color: #1c7a4c; }
.badge.cancelled { background: #f6dede; color: #a02c2c; }

.alert { padding: .7rem 1rem; border-radius: 6px; margin-bottom: 1rem; }
.alert.info { background: var(--brand-light); color: var(--brand-dark); }
.alert.error { background: #f9e2e2; color: #8f2323; }
.alert.success { background: #ddf3e7; color: #1c7a4c; }
.alert.warn { background: #fdf3d7; color: #7c5c00; }
.alert .btn { margin-left: .6rem; }

/* ---- F1 help ---- */
.help-body { max-height: 60vh; overflow-y: auto; padding-right: .4rem; }
.help-body table { border-collapse: collapse; margin: .5rem 0; }
.help-body th, .help-body td { border: 1px solid var(--border); padding: .3rem .6rem; font-size: .88rem; text-align: left; }
.help-body th { background: var(--brand-light); }
.help-body code { background: #eef2f6; padding: .05rem .3rem; border-radius: 4px; font-size: .85em; }
.help-body h3 { margin: .8rem 0 .3rem; font-size: 1rem; }

/* ---- dialoog ---- */
.dialog-backdrop {
    position: fixed; inset: 0; background: rgba(20, 32, 45, .45);
    display: flex; align-items: flex-start; justify-content: center; padding-top: 8vh; z-index: 50;
}
.dialog {
    background: #fff; border-radius: 8px; padding: 1.3rem 1.5rem; width: 90vw; max-width: 1600px;
    max-height: 82vh; overflow: auto; box-shadow: 0 12px 40px rgba(0,0,0,.25);
}
.dialog h2 { margin-top: 0; }
.dialog .actions { display: flex; gap: .6rem; justify-content: flex-end; margin-top: 1.2rem; }

/* ---- dashboard tegels ---- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.tile { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 1rem 1.1rem; }
.tile .value { font-size: 1.9rem; font-weight: 700; color: var(--brand); }
.tile .label { font-size: .85rem; color: var(--muted); }

/* ---- login / landing ---- */
.centered-card {
    max-width: 420px; margin: 9vh auto; background: #fff; border: 1px solid var(--border);
    border-radius: 10px; padding: 2rem;
}
.centered-card .logo { display: flex; align-items: center; gap: .7rem; margin-bottom: 1.3rem; font-size: 1.25rem; font-weight: 700; color: var(--brand-dark); }
.centered-card .logo img { width: 42px; height: 42px; }

.page-message { max-width: 480px; margin: 10vh auto; text-align: center; }

.muted { color: var(--muted); }
.mt { margin-top: 1rem; }

/* regels-editor in orderformulieren */
.lines-editor td { vertical-align: top; }
.lines-editor input, .lines-editor select { min-width: 90px; }

@media (max-width: 800px) {
    .app-shell { flex-direction: column; }
    .sidebar { width: 100%; }
    .content { padding: 1rem; }
}
