/* FST – Flight School Tool */
:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --nav-bg: #0b1f33;
  --nav-text: #cbd5e1;
  --nav-active: #ffffff;
  --accent: #0f766e;
  --accent-soft: #ccfbf1;
  --ok: #15803d;   --ok-bg: #dcfce7;
  --warn: #b45309; --warn-bg: #fef3c7;
  --bad: #b91c1c;  --bad-bg: #fee2e2;
  --none: #475569; --none-bg: #e2e8f0;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .08);
  font-size: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; margin: 0 0 .25rem; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
h3 { font-size: .95rem; margin: 1rem 0 .5rem; }
.muted { color: var(--muted); }
.small { font-size: .85em; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

/* Layout */
.layout { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; background: linear-gradient(to right, var(--nav-bg) 250px, var(--bg) 250px); }
.sidebar { background: var(--nav-bg); color: var(--nav-text); padding: 1rem .75rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: .6rem; color: #fff; font-weight: 700; font-size: 1.1rem; padding: .25rem .5rem 1rem; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, #14b8a6, #0ea5e9); display: grid; place-items: center; font-size: .9rem; }
.brand small { display: block; font-weight: 400; font-size: .72rem; color: var(--nav-text); }
.nav-group { margin-bottom: .35rem; }
.nav-group > summary { list-style: none; cursor: pointer; padding: .45rem .5rem; border-radius: 6px; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: #94a3b8; display: flex; justify-content: space-between; }
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary::after { content: "▸"; transition: transform .15s; }
.nav-group[open] > summary::after { transform: rotate(90deg); }
.nav-group a { display: block; color: var(--nav-text); padding: .38rem .5rem .38rem 1rem; border-radius: 6px; font-size: .92rem; }
.nav-group a:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.nav-group a.active { background: rgba(20,184,166,.18); color: var(--nav-active); box-shadow: inset 3px 0 0 #14b8a6; }
.main { min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: .7rem 1.5rem; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.topbar .org { font-weight: 600; }
.topbar .user-menu { display: flex; gap: 1rem; align-items: center; }
.content { padding: 1.5rem; max-width: 1500px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-head .actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* Cards / grid */
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.1rem; min-width: 0; }
.card > h2 { display: flex; justify-content: space-between; align-items: center; }
.card > h2 a { font-size: .8rem; font-weight: 500; }
.stat { font-size: 1.6rem; font-weight: 700; }
.stat-label { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { padding: .5rem .6rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
table.data th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: #f8fafc; white-space: nowrap; }
table.data tbody tr:hover { background: #f8fafc; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data tfoot td { font-weight: 700; border-top: 2px solid var(--border); }
table.compact th, table.compact td { padding: .3rem .45rem; }
tr.is-cancelled td { color: var(--muted); text-decoration: line-through; }

/* Badges */
.badge { display: inline-block; padding: .12rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-expired { background: var(--bad-bg); color: var(--bad); }
.badge-none { background: var(--none-bg); color: var(--none); }
.badge-info { background: #e0f2fe; color: #0369a1; }
.dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; margin-right: .35rem; vertical-align: middle; }

/* Buttons & forms */
.btn { display: inline-flex; align-items: center; gap: .35rem; padding: .45rem .9rem; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: .9rem; cursor: pointer; font-weight: 500; line-height: 1.2; }
.btn:hover { text-decoration: none; background: #f1f5f9; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #115e59; }
.btn-danger { color: var(--bad); border-color: #fecaca; }
.btn-danger:hover { background: var(--bad-bg); }
.btn-sm { padding: .25rem .55rem; font-size: .8rem; }
form.inline { display: inline; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: .8rem 1rem; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-all { grid-column: 1 / -1; }
.field label { display: block; font-size: .8rem; font-weight: 600; color: #334155; margin-bottom: .25rem; }
.field .help { font-size: .75rem; color: var(--muted); margin-top: .2rem; }
.field .errorlist { color: var(--bad); font-size: .8rem; margin: .2rem 0 0; padding: 0; list-style: none; }
.field.checkbox { display: flex; align-items: center; gap: .5rem; }
.field.checkbox label { margin: 0; font-weight: 500; }
input[type=text], input[type=email], input[type=number], input[type=date], input[type=time], input[type=datetime-local], input[type=password], input[type=url], input[type=file], select, textarea {
  width: 100%; padding: .45rem .6rem; border: 1px solid #cbd5e1; border-radius: 7px; font: inherit; background: #fff; color: var(--text);
}
select[multiple] { min-height: 7rem; }
textarea { min-height: 5rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid #99f6e4; border-color: var(--accent); }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem 1rem 1rem; margin: 0 0 1rem; background: var(--surface); }
legend { font-weight: 700; padding: 0 .4rem; font-size: .9rem; }
.form-actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1rem; }
.filters { display: flex; gap: .6rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: 1rem; background: var(--surface); padding: .75rem; border: 1px solid var(--border); border-radius: var(--radius); }
.filters .field { min-width: 140px; }

/* Messages */
.messages { list-style: none; padding: 0; margin: 0 0 1rem; }
.messages li { padding: .65rem .9rem; border-radius: 8px; margin-bottom: .4rem; border: 1px solid; }
.messages .success { background: var(--ok-bg); border-color: #bbf7d0; color: #14532d; }
.messages .error { background: var(--bad-bg); border-color: #fecaca; color: #7f1d1d; }
.messages .warning { background: var(--warn-bg); border-color: #fde68a; color: #78350f; }
.messages .info { background: #e0f2fe; border-color: #bae6fd; color: #0c4a6e; }
.alert { padding: .65rem .9rem; border-radius: 8px; margin-bottom: .75rem; border: 1px solid; }
.alert-error { background: var(--bad-bg); border-color: #fecaca; color: #7f1d1d; }
.alert-warning { background: var(--warn-bg); border-color: #fde68a; color: #78350f; }

/* Tabs */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; flex-wrap: wrap; }
.tabs a { padding: .55rem .9rem; color: var(--muted); border-bottom: 2px solid transparent; font-weight: 500; }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }
.tabs a:hover { text-decoration: none; color: var(--text); }

/* Kalender (Zeitstrahl) */
.cal-toolbar { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: .75rem; }
.cal-toolbar .seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.cal-toolbar .seg a { padding: .4rem .7rem; color: var(--text); background: var(--surface); border-right: 1px solid var(--border); }
.cal-toolbar .seg a:last-child { border-right: 0; }
.cal-toolbar .seg a.active { background: var(--accent); color: #fff; }
.timeline { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; }
.tl-day-head { padding: .45rem .75rem; background: #f8fafc; border-bottom: 1px solid var(--border); font-weight: 700; position: sticky; left: 0; }
.tl-row { display: grid; grid-template-columns: 170px 1fr; border-bottom: 1px solid var(--border); min-height: 44px; }
.tl-row:last-child { border-bottom: 0; }
.tl-label { padding: .45rem .6rem; border-right: 1px solid var(--border); background: #fcfcfd; position: sticky; left: 0; z-index: 2; font-size: .85rem; }
.tl-label strong { display: block; }
.tl-track { position: relative; min-width: 700px; background-image: repeating-linear-gradient(to right, transparent 0, transparent calc(var(--hour-w) - 1px), #eef2f7 calc(var(--hour-w) - 1px), #eef2f7 var(--hour-w)); cursor: pointer; }
.tl-hours { display: grid; grid-template-columns: 170px 1fr; border-bottom: 1px solid var(--border); font-size: .72rem; color: var(--muted); position: sticky; top: 0; background: #fff; z-index: 3; }
.tl-hours .scale { position: relative; height: 22px; min-width: 700px; }
.tl-hours .scale span { position: absolute; top: 4px; transform: translateX(-50%); }
.tl-booking { position: absolute; top: 4px; bottom: 4px; border-radius: 6px; color: #fff; padding: 2px 6px; font-size: .75rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; box-shadow: 0 1px 2px rgba(0,0,0,.2); z-index: 1; }
.tl-booking:hover { text-decoration: none; filter: brightness(1.08); z-index: 5; }
.tl-booking small { opacity: .9; }
.tl-now { position: absolute; top: 0; bottom: 0; width: 2px; background: #ef4444; z-index: 4; }
.tl-unavailable { background: repeating-linear-gradient(45deg, #fee2e2, #fee2e2 6px, #fff 6px, #fff 12px); }

/* Kanban */
.kanban { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 1rem; overflow-x: auto; }
.kanban .col { background: #eef2f7; border-radius: var(--radius); padding: .6rem; min-height: 200px; }
.kanban .col h3 { margin: .2rem .2rem .6rem; }
.kanban .item { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: .55rem .65rem; margin-bottom: .5rem; box-shadow: var(--shadow); }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #0b1f33 0%, #0f766e 100%); }
.login-card { background: #fff; padding: 2rem; border-radius: 14px; width: 360px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }

.progress { height: 8px; border-radius: 99px; background: #e2e8f0; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.empty { color: var(--muted); padding: 1rem 0; text-align: center; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; background: var(--bg); }
  .sidebar { position: static; height: auto; }
  .grid-2 { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
}
@media print {
  .sidebar, .topbar, .no-print, .filters { display: none !important; }
  .layout { display: block; }
  .content { padding: 0; }
  .card { box-shadow: none; }
}
