:root {
  --navy: #0b1b33;
  --navy-2: #12294a;
  --accent: #2f6fed;
  --accent-soft: #e8effd;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f1f5f9;
  --panel: #ffffff;
  --ok: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --flight: #2563eb;
  --standby: #d97706;
  --office: #7c3aed;
  --vacation: #0d9488;
  --off: #94a3b8;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font: 13px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

button {
  font: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 28px;
  height: 56px;
  padding: 0 20px;
  background: var(--navy);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 30;
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 170px; }
.brand .mark {
  display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--accent); font-size: 15px;
}
.brand b { display: block; font-size: 14px; letter-spacing: .02em; }
.brand small { display: block; color: #93b4e6; font-size: 10px; text-transform: uppercase; letter-spacing: .12em; }

.tabs { display: flex; gap: 4px; flex: 1; }
.tabs button {
  padding: 7px 14px;
  border-radius: 8px;
  color: #b7c7e0;
  font-size: 12.5px;
  letter-spacing: .02em;
}
.tabs button:hover { color: #fff; background: rgba(255,255,255,.07); }
.tabs button.active { color: #fff; background: rgba(47,111,237,.35); box-shadow: inset 0 0 0 1px rgba(120,165,255,.35); }

.toolbar { display: flex; align-items: center; gap: 6px; }
.toolbar .range { min-width: 190px; text-align: center; font-size: 12.5px; color: #dbe7ff; }
.toolbar button {
  width: 28px; height: 28px; border-radius: 7px;
  background: rgba(255,255,255,.08); color: #cfe0ff; font-size: 16px; line-height: 1;
}
.toolbar button:hover { background: rgba(255,255,255,.16); }
.toolbar button.ghost { width: auto; padding: 0 12px; font-size: 12px; }

main { height: calc(100vh - 56px); overflow: hidden; }
#app { height: 100%; }

/* ---------- Доска ---------- */
.board-view { display: flex; height: 100%; }

.flights-panel {
  width: 244px;
  flex: none;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.panel-head {
  padding: 12px 14px 8px;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}
.panel-head .hint {
  display: block;
  margin-top: 4px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  font-size: 11px;
  color: #94a3b8;
}
.flight-list { overflow: auto; padding: 8px; }
.flight-day-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #94a3b8;
  margin: 10px 4px 4px;
}
.flight-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 9px;
  margin-bottom: 5px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--flight);
  border-radius: 8px;
  background: #fff;
  cursor: grab;
  transition: box-shadow .12s, transform .12s;
}
.flight-chip:hover { box-shadow: 0 2px 8px rgba(15,23,42,.10); transform: translateY(-1px); }
.flight-chip:active { cursor: grabbing; }
.flight-chip .fn { font-weight: 650; font-size: 12px; }
.flight-chip .rt { color: var(--muted); font-size: 11px; }
.flight-chip .tm { margin-left: auto; font-variant-numeric: tabular-nums; font-size: 11px; color: #475569; }
.flight-chip .filled { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.flight-chip .empty { width: 7px; height: 7px; border-radius: 50%; background: #f59e0b; }
.flight-chip.assigned { opacity: .62; }

.board-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.board-scroll { flex: 1; overflow: auto; }
.board { min-width: 100%; }

.board-head { display: flex; position: sticky; top: 0; z-index: 10; background: var(--panel); border-bottom: 1px solid var(--line); }
.corner {
  width: 210px; flex: none;
  padding: 10px 14px;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted);
  border-right: 1px solid var(--line);
  background: var(--panel);
}
.day-head {
  flex: 1;
  position: relative;
  padding-bottom: 20px;
  padding: 8px 10px 22px;
  border-right: 1px solid var(--line);
  text-align: center;
  font-size: 11px;
  color: var(--muted);
}
.day-head b { display: block; font-size: 12.5px; color: var(--ink); }
.day-head.weekend { background: #f8fafc; }
.day-head.today { background: var(--accent-soft); }

.rows { position: relative; background: #fff; }
.crew-row { display: flex; border-bottom: 1px solid var(--line); background: #fff; }
.crew-row:hover { background: #fbfdff; }
.crew-cell {
  width: 210px; flex: none;
  padding: 5px 12px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}
.crew-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.crew-sub {
  font-size: 10px; color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding-left: 2px;
}
.crew-cell .code { font-weight: 700; font-size: 12px; letter-spacing: .03em; }
.crew-cell .name { font-size: 11.5px; color: #1e293b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crew-cell .rank {
  font-size: 9.5px; font-weight: 700; letter-spacing: .05em;
  padding: 2px 5px; border-radius: 5px;
  background: #eef2f7; color: #475569;
}
.crew-row.cpt .rank { background: #e0eafc; color: #1d4ed8; }
.crew-row.fo .rank { background: #e6f7ef; color: #047857; }

.row-days { position: relative; display: flex; flex: 1; }
.day-cell {
  flex: 1;
  position: relative;
  border-right: 1px solid var(--line);
  min-height: 46px;
  background-image: linear-gradient(to right, transparent calc(25% - 1px), #eef2f7 25%, transparent calc(25% + 1px));
}
.day-cell.weekend { background-color: #fafbfd; }
.day-cell.drop-target { background-color: #e8f0fe; box-shadow: inset 0 0 0 2px var(--accent); }
.day-cell.weekend.drop-target { background-color: #e8f0fe; }

.ctx-hint { position: absolute; inset: auto 0 0 0; }

.bar {
  position: absolute;
  height: 26px;
  border-radius: 6px;
  background: var(--flight);
  color: #fff;
  font-size: 10.5px;
  font-weight: 600;
  padding: 0 7px;
  display: flex; align-items: center; gap: 5px;
  cursor: pointer;
  overflow: hidden;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(15,23,42,.18);
  border: 1px solid rgba(255,255,255,.25);
}
.bar:hover { filter: brightness(1.08); }
.bar.kind-STANDBY { background: var(--standby); }
.bar.kind-OFFICE { background: var(--office); }
.bar.kind-VACATION { background: var(--vacation); }
.bar.kind-DAY_OFF { background: #cbd5e1; color: #334155; }
.bar.invalid { outline: 2px solid var(--bad); outline-offset: 1px; }
.bar.near { outline: 2px solid #f59e0b; outline-offset: 1px; }
.bar .meta { font-weight: 400; opacity: .85; font-size: 10px; }
.bar .ico { font-size: 9px; opacity: .9; }

.board-tools {
  display: flex; align-items: center; gap: 14px;
  padding: 7px 16px;
  background: var(--panel);
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
}
.legend { display: flex; gap: 14px; margin-left: auto; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }

/* ---------- Нарушения ---------- */
.violations {
  background: var(--panel);
  border-top: 1px solid var(--line);
  max-height: 168px;
  overflow: auto;
  padding: 10px 16px 12px;
}
.violations.empty { padding: 9px 16px; color: var(--muted); }
.violations h4 { margin: 0 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.violation {
  display: flex; gap: 9px; align-items: baseline;
  padding: 4px 0;
  border-bottom: 1px dashed #eef2f7;
  font-size: 12px;
}
.violation:last-child { border-bottom: none; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; margin-top: 4px; }
.dot.error { background: var(--bad); }
.dot.warn { background: var(--warn); }
.violation .who { font-weight: 650; min-width: 44px; }
.violation .when { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 74px; }
.violation .msg { color: #334155; }

/* ---------- Общие панели ---------- */
.page { padding: 20px 24px 40px; overflow: auto; height: 100%; }
.page h2 { margin: 0 0 4px; font-size: 17px; }
.page .sub { color: var(--muted); margin-bottom: 16px; font-size: 12.5px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
table.data { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.data th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--line); background: #f8fafc;
}
table.data td { padding: 8px 12px; border-bottom: 1px solid #f1f5f9; }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: #f8fbff; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.pill { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 600; }
.pill.ok { background: #e7f7ee; color: #15803d; }
.pill.warn { background: #fef3e2; color: #b45309; }
.pill.bad { background: #fdecec; color: #b91c1c; }

.crew-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.crew-card { padding: 14px 16px; }
.crew-card h3 { margin: 0; font-size: 14px; }
.crew-card .meta { color: var(--muted); font-size: 11.5px; margin-bottom: 10px; }
.crew-card ul { list-style: none; margin: 0; padding: 0; }
.crew-card li { display: flex; justify-content: space-between; padding: 4px 0; border-top: 1px solid #f1f5f9; font-size: 12px; }
.crew-card li span:last-child { color: var(--muted); font-variant-numeric: tabular-nums; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: 8px;
  background: var(--accent); color: #fff; font-size: 12.5px; font-weight: 600;
}
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: #fee2e2; color: #b91c1c; }

/* ---------- Drawer ---------- */
.drawer {
  position: fixed; top: 56px; right: 0; bottom: 0;
  width: 380px;
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: -10px 0 30px rgba(15,23,42,.10);
  z-index: 40;
  display: flex; flex-direction: column;
  transform: translateX(0);
  transition: transform .18s ease;
}
.drawer.hidden { transform: translateX(102%); }
.drawer-head { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: flex-start; gap: 10px; }
.drawer-head h3 { margin: 0; font-size: 14px; }
.drawer-head .sub { color: var(--muted); font-size: 11.5px; }
.drawer-head button { margin-left: auto; font-size: 18px; color: var(--muted); line-height: 1; }
.drawer-body { padding: 14px 16px; overflow: auto; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: 12.5px; margin-bottom: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.leg-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid #f1f5f9; font-size: 12px; }
.leg-row .fn { font-weight: 650; }
.leg-row .rt { color: var(--muted); }
.leg-row button { margin-left: auto; color: var(--bad); font-size: 11px; }
.progress { height: 6px; border-radius: 999px; background: #eef2f7; overflow: hidden; margin: 4px 0 12px; }
.progress > i { display: block; height: 100%; background: var(--ok); }
.progress > i.warn { background: var(--warn); }
.progress > i.bad { background: var(--bad); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: #0f172a; color: #fff; padding: 9px 14px; border-radius: 8px;
  font-size: 12.5px; z-index: 60; box-shadow: 0 8px 24px rgba(15,23,42,.25);
}
.toast.hidden { display: none; }
.toast.error { background: #991b1b; }

@media (max-width: 1100px) {
  .flights-panel { width: 200px; }
  .crew-cell, .corner { width: 160px; }
}

.tick { position: absolute; top: 0; bottom: 0; width: 1px; background: #f1f5f9; pointer-events: none; }
.bars { position: absolute; inset: 0; pointer-events: none; }
.bar { pointer-events: auto; }

.hour-scale span {
  position: absolute; bottom: 3px; transform: translateX(-50%);
  font-size: 9px; color: #94a3b8; font-variant-numeric: tabular-nums;
}

/* ---- board toolbar ---- */
.board-toolbar {
  display: flex; align-items: center; gap: 14px;
  padding: 7px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--muted);
}
.board-toolbar .tz { font-variant-numeric: tabular-nums; color: #475569; }
.board-toolbar .tb-field { display: inline-flex; align-items: center; gap: 6px; }
.board-toolbar select {
  font: inherit; padding: 3px 6px; border: 1px solid var(--line);
  border-radius: 6px; background: #fff; color: var(--ink);
}
.tb-btn {
  padding: 4px 10px; border-radius: 6px;
  background: #fff; border: 1px solid var(--line);
  font-weight: 600; color: #1e293b;
}
.tb-btn:hover { border-color: #cbd5e1; }
.tb-btn:disabled { opacity: .6; }
.tb-state { font-weight: 600; }
.tb-state.ok { color: var(--ok); }
.tb-state.warn { color: var(--warn); }
.tb-state.bad { color: var(--bad); }
.tb-spacer { flex: 1; }
.tb-hint { color: #94a3b8; font-size: 11px; }

/* ---- mode toggle ---- */
.mode-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.mode-toggle button { padding: 4px 12px; font-weight: 600; color: var(--muted); background: #fff; font-size: 11.5px; }
.mode-toggle button.active { background: var(--accent); color: #fff; }
.crew-row.acft .code { letter-spacing: .04em; }

/* ---- schedule ---- */
.form-card { padding: 16px 18px; margin-bottom: 14px; }
.form-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px 16px; margin-bottom: 12px;
}
.form-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.form-grid input, .form-grid select {
  font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px;
  text-transform: none; letter-spacing: 0; color: var(--ink); background: #fff;
}
.days-row { display: flex; gap: 8px; margin-bottom: 14px; }
.day-box {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 9px; border: 1px solid var(--line); border-radius: 7px;
  font-size: 11.5px; color: #334155; cursor: pointer;
}
.day-box input { accent-color: var(--accent); }
.form-actions { display: flex; gap: 8px; }
.row-actions { white-space: nowrap; text-align: right; }
.link { color: var(--accent); font-size: 11.5px; font-weight: 600; padding: 2px 4px; }
.link.danger { color: var(--bad); }
.link:hover { text-decoration: underline; }

/* ---- context menu ---- */
.ctx-menu {
  position: fixed; z-index: 100;
  min-width: 170px; padding: 4px;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .14);
}
.ctx-menu button {
  display: block; width: 100%; text-align: left;
  padding: 7px 10px; border-radius: 6px; font-size: 12.5px; color: var(--ink);
}
.ctx-menu button:hover { background: #f1f5f9; }
.ctx-menu button.danger { color: var(--bad); }
.ctx-menu button.danger:hover { background: #fef2f2; }

/* ---- toolbar extras ---- */
.tb-search, .tb-select {
  font: inherit; padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px;
  background: #fff; color: var(--ink); font-size: 11.5px;
}
.tb-search { width: 150px; }
.tb-check { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: #475569; }
.tb-check input { accent-color: var(--accent); }
.tb-chip {
  padding: 3px 8px; border-radius: 999px; background: #f1f5f9; color: #475569;
  font-size: 11px; font-weight: 600;
}
.tb-chip.warn { background: #fef3e2; color: #b45309; }
.empty-row { padding: 18px; color: var(--muted); font-size: 12.5px; }

/* ---- schedule versions ---- */
.version-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; margin-bottom: 14px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
  font-size: 12.5px;
}
.version-bar .vdot { width: 9px; height: 9px; border-radius: 50%; }
.version-bar.published .vdot { background: var(--ok); }
.version-bar.draft .vdot { background: var(--warn); }
.version-bar.draft { border-color: #fcd9a8; background: #fffaf2; }
.version-bar .vname { color: var(--muted); }
.locked { color: #b6c2d2; font-size: 11.5px; }

/* ---- aircraft card ---- */
.acft-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin: 12px 0 16px; }
.acft-head h2 { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.acft-actions { display: flex; gap: 8px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.stat span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.stat b { font-size: 15px; }
.section-title { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 18px 0 8px; }
.alerts-card { padding: 10px 14px; }
.alert-row { display: flex; align-items: baseline; gap: 9px; padding: 5px 0; font-size: 12.5px; border-bottom: 1px dashed #eef2f7; }
.alert-row:last-child { border-bottom: none; }
.alert-row.muted { color: var(--muted); }
.tech-form { padding: 14px 16px; margin-bottom: 16px; }
.tech-form label { display: flex; flex-direction: column; gap: 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 12px; }
.tech-form textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; resize: vertical; }
.acft-cell { cursor: pointer; }
.acft-cell:hover { background: #f8fbff; }
.crew-row.acft.tech { background: #fff6f6; }
.crew-row.acft.tech .code { color: var(--bad); }

/* ---- deferred defects ---- */
.defects-card { padding: 10px 14px; }
.defect-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px dashed #eef2f7; font-size: 12.5px; }
.defect-row:last-of-type { border-bottom: none; }
.defect-row.closed { opacity: .55; }
.defect-title { flex: 1; min-width: 0; }
.defect-meta { color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.defect-form { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.defect-form input { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; }
.defect-form input#defectTitle { flex: 1; min-width: 220px; }
.defect-form input.short { width: 130px; }
.defect-actions { margin-top: 10px; }
.form-hint { font-size: 11px; color: var(--muted); margin-top: 6px; }
#melBulk { width: 100%; font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; }
.doc-missing td { color: var(--muted); }
.docs-card .data th { font-size: 10px; }
.doc-ref { font-size: 10.5px; color: var(--muted); margin-top: 2px; }

/* ---- user chip ---- */
.user-chip { display: inline-flex; align-items: center; gap: 8px; margin-right: 10px; padding: 4px 10px 4px 4px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font-size: 12px; color: #334155; }
.user-chip .avatar { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.user-chip .role { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border-left: 1px solid var(--line); padding-left: 8px; }

/* ---- login ---- */
.login-body { background: #0f1f38; display: grid; place-items: center; min-height: 100vh; margin: 0; }
.login-wrap { width: 100%; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 16px; padding: 28px 26px; box-shadow: 0 24px 60px rgba(0,0,0,.35); }
.login-brand { display: flex; align-items: center; gap: 10px; font-size: 18px; color: #0f1f38; margin-bottom: 18px; }
.login-brand .mark { width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: #fff; display: grid; place-items: center; }
.login-card h1 { margin: 0 0 6px; font-size: 20px; }
.login-sub { margin: 0 0 18px; color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.login-card label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 5px; }
.login-card input { width: 100%; box-sizing: border-box; font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; margin-bottom: 14px; }
.login-card button { width: 100%; padding: 11px; border-radius: 9px; background: var(--accent); color: #fff; font-weight: 700; font-size: 13px; }
.login-card button:disabled { opacity: .6; }
.login-error { margin-top: 12px; color: var(--bad); font-size: 12.5px; }
.login-note { margin-top: 16px; color: #94a3b8; font-size: 11px; line-height: 1.5; }
.hidden { display: none !important; }
.user-chip .logout { width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line); background: #f8fafc; color: #475569; font-size: 12px; line-height: 1; }
.user-chip .logout:hover { background: #fef2f2; color: var(--bad); border-color: #fecaca; }
.user-chip .logout-btn { margin-left: 2px; padding: 4px 10px; border-radius: 999px; border: 1px solid #fecaca; background: #fff5f5; color: #b91c1c; font-size: 11.5px; font-weight: 600; }
.user-chip .logout-btn:hover { background: #fee2e2; }

/* ---- aircraft tabs ---- */
.acft-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 10px 0 16px; }
.acft-tab { padding: 9px 14px; font-size: 12.5px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.acft-tab:hover { color: var(--ink); }
.acft-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-badge { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 999px; background: #eef2f7; color: #475569; font-size: 10.5px; }
.acft-tab.active .tab-badge { background: #e8efff; color: var(--accent); }
.mel-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.mel-chip { padding: 5px 10px; border-radius: 999px; background: #f1f5f9; font-size: 12px; color: #334155; }
.mel-chip b { color: #0f1f38; }
.mel-chip.cat-A { background: #fee2e2; } .mel-chip.cat-B { background: #ffedd5; }
.mel-chip.cat-C { background: #fef9c3; } .mel-chip.cat-D { background: #dcfce7; }
.doc-group td { background: #f8fafc; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 8px 10px; border-top: 1px solid var(--line); }

/* ---- document viewer ---- */
.doc-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: grid; place-items: center; z-index: 200; padding: 24px; }
.doc-modal { width: min(1000px, 100%); height: min(85vh, 900px); background: #fff; border-radius: 14px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.doc-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.doc-modal-actions { display: flex; gap: 8px; align-items: center; }
.doc-modal-body { flex: 1; min-height: 0; background: #f1f5f9; display: grid; place-items: center; overflow: hidden; }
.doc-frame { width: 100%; height: 100%; border: 0; }
.doc-image { width: 100%; height: 100%; object-fit: contain; }
.doc-empty { display: flex; flex-direction: column; gap: 14px; align-items: center; color: var(--muted); font-size: 13px; text-align: center; padding: 24px; }

/* ---- upload progress ---- */
.upload-box { width: min(420px, 80%); display: flex; flex-direction: column; gap: 10px; align-items: center; }
.upload-name { font-size: 12.5px; color: #334155; text-align: center; }
.upload-track { width: 100%; height: 10px; border-radius: 999px; background: #e2e8f0; overflow: hidden; }
.upload-fill { height: 100%; width: 0%; background: var(--accent); border-radius: 999px; transition: width .15s ease; }
.upload-pct { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---- staff ---- */
.staff-head { display: flex; gap: 20px; align-items: flex-start; margin: 12px 0 18px; }
.staff-photo-wrap { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.staff-photo { width: 120px; height: 150px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: #f1f5f9; }
.staff-photo-empty { display: grid; place-items: center; color: var(--muted); font-size: 11.5px; }
.staff-photo-btn { font-size: 11px; padding: 4px 8px; }
.staff-main { flex: 1; }
.staff-thumb { width: 36px; height: 44px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: #f1f5f9; display: inline-grid; place-items: center; }
.staff-thumb-empty { color: var(--muted); font-size: 11px; }
.staff-row { cursor: pointer; }
.staff-row:hover td { background: #f8fbff; }

/* ---- shell / sidebar ---- */
.shell { display: flex; min-height: calc(100vh - 62px); }
.sidebar { width: 214px; flex: none; background: #0f1f38; color: #cbd5e1; padding: 14px 10px 24px; overflow-y: auto; }
.dept { margin-bottom: 18px; }
.dept-title { font-size: 10px; text-transform: uppercase; letter-spacing: .09em; color: #64748b; padding: 0 10px 6px; }
.nav-item { display: block; width: 100%; text-align: left; padding: 7px 10px; border-radius: 7px; color: #cbd5e1; font-size: 12.5px; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--accent); color: #fff; font-weight: 600; }
.nav-soon { font-size: 9px; text-transform: uppercase; letter-spacing: .05em; color: #94a3b8; }
.nav-item.active .nav-soon { color: rgba(255,255,255,.75); }
.main { flex: 1; min-width: 0; padding: 18px 22px 40px; }
.topbar { gap: 18px; }
.topbar .brand { flex: none; }
.crumb { flex: 1; font-size: 12.5px; color: #cbd5e1; }
.crumb-dept { color: #fff; font-weight: 600; }
.crumb-sep { padding: 0 8px; color: #64748b; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-right .toolbar { background: transparent; border: none; padding: 0; }
@media (max-width: 1100px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; display: flex; gap: 6px; overflow-x: auto; padding: 8px 10px; }
  .dept { margin-bottom: 0; display: flex; align-items: center; gap: 4px; }
  .dept-title { display: none; }
  .nav-item { white-space: nowrap; }
}

/* ---- page head ---- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.page-head h2 { margin: 0; font-size: 20px; }
.page-head .sub { margin-top: 3px; }
.sidebar { width: 196px; }
.nav-item.coming { color: #7c8ba1; }
.nav-item.coming:hover { color: #cbd5e1; }
.sidebar-foot { margin-top: 22px; padding: 12px 10px 0; border-top: 1px solid rgba(255,255,255,.08); font-size: 11px; color: #94a3b8; }
.sidebar-foot div { color: #64748b; font-size: 10px; margin-top: 2px; }

/* ---- visual pass ---- */
.topbar { height: 56px; padding: 0 16px; }
.brand b { font-size: 15px; }
.brand small { font-size: 9.5px; }
.main { padding: 20px 24px 48px; }
.page h2 { font-size: 20px; margin-bottom: 4px; }
.page .sub { color: var(--muted); font-size: 12.5px; margin-bottom: 16px; }
.card { border: 1px solid #e6ebf2; border-radius: 10px; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.data th { font-size: 9.5px; letter-spacing: .08em; color: #7b8798; padding: 9px 12px; }
.data td { padding: 10px 12px; font-size: 12.5px; }
.data tbody tr:hover td { background: #f8fafc; }
.btn { height: 32px; padding: 0 12px; border-radius: 8px; font-size: 12.5px; }
.btn.ghost { border: 1px solid var(--line); background: #fff; }
.stat { padding: 14px 16px; }
.stat span { font-size: 10px; }
.stat b { font-size: 17px; }
.stat-grid { gap: 12px; margin-bottom: 16px; }
.section-title { margin: 20px 0 8px; }

/* ---- nav v2: departments + section tabs ---- */
.sidebar { width: 208px; padding: 12px 8px 24px; }
.dept-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px; color: #cbd5e1; font-size: 12.5px; text-align: left; margin-bottom: 2px; }
.dept-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.dept-item.active { background: rgba(47,111,237,.22); color: #fff; font-weight: 600; }
.dept-letter { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; background: rgba(255,255,255,.08); font-size: 11px; font-weight: 700; }
.dept-item.active .dept-letter { background: var(--accent); }
.main { padding: 0 24px 48px; }
.section-nav { display: flex; gap: 2px; margin: 0 -24px 18px; padding: 8px 24px 0; background: #fff; border-bottom: 1px solid var(--line); }
.section-tab { padding: 8px 12px 10px; font-size: 12.5px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.section-tab:hover { color: var(--ink); }
.section-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.sidebar { width: 224px; }
.dept-item { font-size: 12px; }
.dept-letter { width: 26px; height: 26px; font-size: 10px; }

/* ---- accordion sidebar ---- */
.dept-group { margin-bottom: 2px; }
.dept-item { position: relative; }
.dept-label { flex: 1; text-align: left; }
.chev { font-size: 10px; color: #64748b; }
.dept-item.active .chev { color: #cbd5e1; }
.sub { padding: 2px 0 6px; }
.sub-item { display: block; width: 100%; text-align: left; padding: 6px 10px 6px 46px; border-radius: 6px; color: #aebccf; font-size: 12px; }
.sub-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.sub-item.active { background: rgba(47,111,237,.22); color: #fff; font-weight: 600; }

/* ---- home ---- */
.home-item { margin-bottom: 8px; }
.company-card { display: flex; gap: 20px; align-items: center; background: #fff; border: 1px solid #e6ebf2; border-radius: 12px; padding: 20px 22px; margin-bottom: 22px; }
.company-logo { width: 76px; height: 76px; border-radius: 14px; background: #0b1b33; display: grid; place-items: center; overflow: hidden; flex: none; }
.company-logo img { width: 100%; height: 100%; object-fit: contain; }
.company-logo span { font-size: 30px; color: #fff; }
.company-main { flex: 1; }
.company-main h1 { margin: 0; font-size: 22px; }
.company-contacts { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.company-actions { display: flex; gap: 8px; align-items: flex-start; }
.company-actions .btn { display: inline-flex; align-items: center; }
.home-h { font-size: 15px; margin: 0 0 10px; }
.home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.home-tile { text-align: left; background: #fff; border: 1px solid #e6ebf2; border-radius: 12px; padding: 14px 16px; min-height: 108px; display: flex; flex-direction: column; gap: 6px; }
.home-tile:hover { border-color: var(--accent); box-shadow: 0 4px 14px rgba(47,111,237,.08); }
.tile-top { display: flex; align-items: center; gap: 10px; }
.tile-top .dept-letter { background: var(--accent-soft); color: var(--accent); }
.tile-name { font-weight: 700; font-size: 13px; }
.tile-holder { font-size: 11.5px; color: var(--muted); }
.tile-meta { font-size: 11px; color: var(--muted); margin-top: auto; }
.muted { color: var(--muted); }

/* ---- collapsible sidebar ---- */
.icon-btn { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; color: #cbd5e1; font-size: 15px; background: rgba(255,255,255,.06); flex: none; }
.icon-btn:hover { background: rgba(255,255,255,.14); color: #fff; }
.sidebar.collapsed { width: 64px; padding: 12px 8px 24px; }
.sidebar.collapsed .dept-label,
.sidebar.collapsed .chev,
.sidebar.collapsed .sub,
.sidebar.collapsed .sidebar-foot { display: none; }
.sidebar.collapsed .dept-item { justify-content: center; padding: 8px 0; }
.sidebar.collapsed .dept-letter { width: 34px; height: 34px; font-size: 10.5px; }
.sidebar.collapsed .home-item { margin-bottom: 10px; }

/* ---- department icons ---- */
.dept-icon { width: 30px; height: 30px; border-radius: 8px; display: inline-grid; place-items: center; flex: none; }
.dept-icon svg { display: block; }
.sidebar.collapsed .dept-icon { width: 36px; height: 36px; border-radius: 10px; }
.home-tile .dept-icon { width: 32px; height: 32px; border-radius: 9px; }

/* ---- employee filter bar ---- */
.filter-bar { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.filter-bar input, .filter-bar select { height: 32px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; font: inherit; background: #fff; }
.filter-bar input { width: 240px; }

/* ---- visual standards ---- */
.page-head { align-items: flex-start; }
.page-actions { display: flex; gap: 8px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid #eef2f7; }
.card-head b { font-size: 13px; }
.card-head span { font-size: 11px; color: var(--muted); }
.card > table.data { border-radius: 0 0 10px 10px; }
.user-cell { display: flex; align-items: center; gap: 10px; }
.avatar-sm { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 11px; font-weight: 700; flex: none; }
.role-pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 10.5px; font-weight: 600; }
.role-pill.creator { background: #fee2e2; color: #b91c1c; }
.role-pill.dept { background: #fef3c7; color: #b45309; }
.role-pill.user { background: #e2e8f0; color: #475569; }
.btn.tiny { height: 26px; padding: 0 10px; font-size: 11px; }
.empty { padding: 26px; text-align: center; color: var(--muted); font-size: 12.5px; }
.form-grid input, .form-grid select { height: 36px; }
.form-grid { gap: 14px 16px; }
.form-card { padding: 0; }
.form-card .form-grid { padding: 16px 18px 4px; }
.form-card .form-actions { padding: 12px 18px 16px; border-top: 1px solid #eef2f7; margin-top: 8px; }

/* ---- responsive: iPad + mobile ---- */
.nav-backdrop { position: fixed; inset: 0; background: rgba(6,17,35,.55); z-index: 40; }
.nav-backdrop.hidden { display: none; }

@media (max-width: 1024px) {
  .topbar { height: 54px; padding: 0 10px; gap: 10px; }
  .brand small { display: none; }
  .crumb { font-size: 12px; }
  .topbar-right { gap: 6px; }
  .toolbar .range { display: none; }
  .toolbar button { min-width: 34px; height: 34px; }
  .user-chip { padding: 4px 8px; gap: 6px; }
  .user-chip #userName { display: none; }
  .user-chip .role { display: none; }

  .sidebar {
    position: fixed; left: 0; top: 54px; bottom: 0; z-index: 50;
    width: 280px; max-width: 84vw; padding: 12px 10px 24px;
    transform: translateX(-105%); transition: transform .2s ease;
    box-shadow: 8px 0 24px rgba(0,0,0,.25);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar.collapsed { width: 280px; }
  .sidebar.collapsed .dept-label, .sidebar.collapsed .chev, .sidebar.collapsed .sub, .sidebar.collapsed .sidebar-foot { display: block; }
  .sidebar.collapsed .dept-item { justify-content: flex-start; padding: 10px; }
  .sidebar.collapsed .dept-icon { width: 30px; height: 30px; }

  .main { padding: 14px 16px 40px; }
  .section-tab { padding: 10px 10px 12px; }

  .dept-item { padding: 10px; font-size: 13px; }
  .sub-item { padding: 10px 10px 10px 46px; font-size: 13px; }

  .home-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
  .company-card { flex-wrap: wrap; gap: 14px; padding: 16px; }
  .company-actions { width: 100%; justify-content: flex-start; }

  .page-head { flex-direction: column; gap: 10px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }

  .form-grid { grid-template-columns: 1fr; gap: 12px; }
  .filter-bar { flex-wrap: wrap; }
  .filter-bar input { width: 100%; }

  .card { overflow-x: auto; }
  table.data { min-width: 640px; }
  table.data th, table.data td { white-space: nowrap; }
  .row-actions { white-space: nowrap; }
  .row-actions .link, .row-actions .btn { display: inline-flex; align-items: center; min-height: 30px; }

  .staff-head { flex-wrap: wrap; gap: 14px; }
  .staff-photo { width: 96px; height: 120px; }
  .board-view { overflow-x: auto; }
  .board-view > * { min-width: 980px; }

  .btn { height: 38px; }
  .btn.tiny { height: 30px; }
  .link { padding: 8px 4px; display: inline-block; }
}

@media (max-width: 560px) {
  .main { padding: 12px 10px 36px; }
  .home-grid { grid-template-columns: 1fr; }
  .company-logo { width: 60px; height: 60px; }
  .company-main h1 { font-size: 18px; }
  .page h2 { font-size: 18px; }
  .home-tile { min-height: 96px; }
  .toolbar button#todayBtn { display: none; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* responsive fixes */
@media (max-width: 1024px) {
  .sidebar { display: block; overflow-y: auto; }
  .sidebar .dept-group { margin-bottom: 2px; }
  .sidebar .home-item { width: 100%; }
  .user-chip { height: 38px; border-radius: 10px; }
  .logout-btn { height: 28px; padding: 0 10px; font-size: 11px; border-radius: 8px; white-space: nowrap; }
  .user-chip .avatar { width: 24px; height: 24px; }
}
@media (max-width: 560px) {
  .crumb { display: none; }
  .brand b { font-size: 14px; }
  .logout-btn { padding: 0 8px; }
  .user-chip { padding: 3px 5px; }
}

@media (max-width: 1024px) {
  .page-actions { width: auto; }
  .page-actions .btn { flex: none; }
}
@media (min-width: 700px) and (max-width: 1024px) {
  .page-head { flex-direction: row; align-items: flex-start; justify-content: space-between; }
}
@media (max-width: 560px) {
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
}

@media (max-width: 560px) {
  .emp-table { min-width: 0; }
  .emp-table th:nth-child(n+4), .emp-table td:nth-child(n+4) { display: none; }
  .emp-table th, .emp-table td { white-space: normal; }
}

@media (max-width: 560px) {
  table.emp-table { min-width: 0; width: 100%; }
}

@media (max-width: 560px) {
  table.emp-table, table.emp-table th, table.emp-table td { white-space: normal; }
  table.emp-table { width: 100%; min-width: 0; }
}

@media (max-width: 560px) {
  .company-card { padding: 12px; gap: 10px; align-items: center; }
  .company-logo { width: 44px; height: 44px; border-radius: 10px; }
  .company-logo span { font-size: 18px; }
  .company-main h1 { font-size: 16px; margin: 0; }
  .company-main .sub { font-size: 10.5px; }
  .company-contacts { font-size: 10.5px; gap: 4px 10px; margin-top: 4px; }
  .company-actions { gap: 6px; }
  .company-actions .btn { height: 30px; font-size: 11px; }
}

@media (max-width: 560px) {
  .company-card { display: grid; grid-template-columns: 48px 1fr; align-items: start; gap: 8px 12px; padding: 12px; }
  .company-logo { width: 48px; height: 48px; margin-top: 2px; }
  .company-main h1 { font-size: 17px; line-height: 1.2; }
  .company-main .sub { font-size: 10.5px; }
  .company-contacts { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 2px; margin-top: 2px; font-size: 11px; }
  .company-actions { grid-column: 1 / -1; margin-top: 6px; }
}
.role-pill.god, .pill.god { background: #111827; color: #fbbf24; border: 1px solid #f59e0b; letter-spacing: .04em; }
.check-label { flex-direction: row !important; align-items: center; gap: 8px; text-transform: none; letter-spacing: 0; font-size: 12px; color: var(--ink); }
.check-label input { width: 16px; height: 16px; }

/* ---- back navigation ---- */
.page-back { margin-bottom: 10px; }
.back-btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 8px; background: #fff; border: 1px solid var(--line); color: var(--ink); font-size: 12.5px; font-weight: 600; }
.back-btn:hover { border-color: var(--accent); color: var(--accent); }
@media (max-width: 560px) { .back-btn { height: 38px; } }

/* ---- PWA / safe area ---- */
body { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
.main { padding-bottom: calc(48px + env(safe-area-inset-bottom)); }
.topbar { padding-top: env(safe-area-inset-top); }
@media (max-width: 1024px) {
  .sidebar { top: calc(54px + env(safe-area-inset-top)); padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
}

/* ---- offline ---- */
.offline-bar { margin: 0 0 10px; padding: 8px 12px; border-radius: 8px; background: #fef3c7; color: #92400e; font-size: 12px; font-weight: 600; }
.mini-tag { display: inline-block; padding: 1px 7px; border-radius: 999px; background: #eef2f7; color: #475569; font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; margin-right: 4px; }

/* ---- company card v2 ---- */
.company-card { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.company-head { display: flex; align-items: center; gap: 16px; }
.company-identity { flex: 1; min-width: 0; }
.company-identity h1 { margin: 0; font-size: 20px; }
.company-identity .sub { margin-top: 2px; }
.company-contacts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 20px; padding-top: 14px; border-top: 1px solid #eef2f7; }
.contact { display: flex; gap: 9px; align-items: flex-start; min-width: 0; }
.contact svg { color: #64748b; margin-top: 2px; flex: none; }
.contact span { display: block; font-size: 9.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.contact b { display: block; font-size: 12px; font-weight: 500; color: var(--ink); overflow-wrap: anywhere; }
.contact a { color: var(--ink); text-decoration: none; }
.contact a:hover { color: var(--accent); }
@media (max-width: 900px) { .company-contacts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) {
  .company-card { padding: 14px; gap: 12px; }
  .company-head { flex-wrap: wrap; }
  .company-identity h1 { font-size: 17px; }
  .company-actions { width: 100%; }
  .company-contacts { grid-template-columns: 1fr; gap: 8px; }
}
.company-card { align-items: stretch; }
.company-head { align-items: center; }

/* ---- compact company card ---- */
.company-card { padding: 12px 16px; gap: 10px; border-radius: 10px; }
.company-head { gap: 12px; }
.company-logo { width: 50px; height: 50px; border-radius: 11px; }
.company-logo img { width: 100%; height: 100%; object-fit: contain; }
.company-identity h1 { font-size: 18px; line-height: 1.2; }
.company-identity .sub { font-size: 11px; margin-top: 1px; }
.company-actions .btn { height: 30px; padding: 0 10px; font-size: 11.5px; border-radius: 7px; }
.company-actions { gap: 6px; }
.company-contacts { padding-top: 10px; gap: 6px 16px; }
.contact { gap: 7px; }
.contact svg { width: 14px; height: 14px; margin-top: 1px; }
.contact span { font-size: 8.5px; letter-spacing: .06em; }
.contact b { font-size: 11.5px; line-height: 1.35; }
@media (max-width: 560px) {
  .company-card { padding: 12px; }
  .company-logo { width: 44px; height: 44px; }
  .company-identity h1 { font-size: 16px; }
  .company-contacts { gap: 5px; }
}

/* ---- library viewer with outline ---- */
.lib-viewer { position: fixed; inset: 0; z-index: 80; display: grid; grid-template-columns: 320px 1fr; background: #0b1220; }
.lib-side { background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.lib-side-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid #eef2f7; }
.lib-outline { overflow-y: auto; padding: 8px 0 24px; }
.outline-item { display: flex; justify-content: space-between; gap: 10px; width: 100%; text-align: left; padding: 7px 12px; font-size: 12px; color: var(--ink); border-left: 2px solid transparent; }
.outline-item:hover { background: #f1f5f9; }
.outline-item.active { background: var(--accent-soft); border-left-color: var(--accent); color: var(--accent); }
.outline-item span { color: var(--muted); font-size: 10.5px; flex: none; }
.outline-item.static { color: var(--muted); font-weight: 600; }
.lib-main { min-width: 0; min-height: 0; background: #334155; }
.lib-main iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.icon-btn.dark { background: #eef2f7; color: #0f172a; }
@media (max-width: 900px) {
  .lib-viewer { grid-template-columns: 1fr; grid-template-rows: minmax(120px, 34vh) 1fr; }
  .lib-side { border-right: 0; border-bottom: 1px solid var(--line); }
}

/* compact company header only */
.company-card { padding: 9px 16px 10px; gap: 8px; }
.company-head { gap: 10px; }
.company-logo { width: 44px; height: 44px; border-radius: 10px; }
.company-identity h1 { font-size: 18px; line-height: 1.15; }
.company-identity .sub { margin-top: 0; }
.company-contacts { padding-top: 8px; }

/* company card: equal bands, larger logo */
.company-card { padding: 6px 16px; gap: 6px; }
.company-head { min-height: 54px; gap: 12px; }
.company-logo { width: 54px; height: 54px; border-radius: 11px; }
.company-contacts { min-height: 54px; align-items: center; padding-top: 6px; }
.contact { align-items: center; }
.contact span { margin-bottom: 1px; }

/* larger logo, keep bands equal */
.company-head { min-height: 64px; }
.company-logo { width: 64px; height: 64px; border-radius: 12px; }
.company-contacts { min-height: 64px; }

/* ---- department org structure ---- */
.org-card { padding: 14px 16px; margin-bottom: 16px; }
.org-head { display: flex; align-items: center; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid #eef2f7; margin-bottom: 4px; }
.org-legend { margin-left: auto; font-size: 10px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.org-legend .lg { width: 18px; height: 0; border-top: 2px solid #94a3b8; display: inline-block; }
.org-legend .lg.indirect { border-top-style: dashed; }
.org-row { display: flex; align-items: center; gap: 10px; padding: 8px 0 8px 6px; position: relative; }
.org-line { width: 18px; height: 22px; border-left: 2px solid #cbd5e1; border-bottom: 2px solid #cbd5e1; border-bottom-left-radius: 6px; flex: none; }
.org-row.indirect .org-line { border-left-style: dashed; border-bottom-style: dashed; }
.org-who { min-width: 220px; }
.org-rel { font-size: 11px; color: var(--muted); }
.org-vacancies { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 8px; border-top: 1px solid #eef2f7; margin-top: 6px; }
.vacancy-btn { border: 1px dashed #d97706; cursor: pointer; }
.vacancy-btn:hover { background: #fde68a; }

/* deputy shown next to the head */
.org-head-main { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.org-deputy { display: flex; align-items: center; gap: 8px; padding: 4px 10px; border-radius: 8px; background: #f8fafc; }
.org-dep-line { width: 26px; border-top: 2px dashed #94a3b8; flex: none; }
.org-legend .lg.deputy { border-top-style: dashed; border-top-width: 2px; }
@media (max-width: 900px) {
  .org-head { flex-wrap: wrap; }
  .org-deputy { width: 100%; }
}

/* deputy next to the head */
.org-head-main { flex: none; }
.org-deputy { margin-left: 14px; }
.org-dep-line { width: 18px; }
.org-legend { margin-left: auto; }
.org-person { cursor: pointer; border-radius: 8px; }
.org-person:hover { background: #f8fafc; }

/* ---- org chart tree ---- */
.org-tree { display: flex; flex-direction: column; gap: 6px; }
.tree-node { position: relative; }
.tree-card { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 760px; text-align: left; padding: 9px 12px; border: 1px solid #e6ebf2; border-radius: 9px; background: #fff; }
.tree-card:hover { border-color: var(--accent); box-shadow: 0 2px 8px rgba(47,111,237,.08); }
.tree-who { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.tree-who b { font-size: 12.5px; }
.tree-who span { font-size: 11px; color: var(--muted); }
.tree-meta { font-size: 10px; color: var(--muted); white-space: nowrap; }
.tree-meta.dotted { border-top: 1px dashed #94a3b8; padding-top: 1px; }
.tree-node .tree-node { margin-top: 6px; }

/* ---- OM-A style org chart ---- */
.org-card-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.orgtree-wrap { overflow-x: auto; padding: 8px 0 4px; }
.orgtree, .orgtree ul { display: flex; justify-content: center; list-style: none; margin: 0; padding: 0; }
.orgtree li { display: flex; flex-direction: column; align-items: center; position: relative; padding: 18px 6px 0; }
.orgtree li::before, .orgtree li::after { content: ''; position: absolute; top: 0; right: 50%; width: 50%; height: 18px; border-top: 2px solid #b0392f; }
.orgtree li::after { right: auto; left: 50%; border-left: 2px solid #b0392f; }
.orgtree li:only-child::before, .orgtree li:only-child::after { display: none; }
.orgtree li:first-child::before, .orgtree li:last-child::after { border: 0 none; }
.orgtree li:last-child::before { border-right: 2px solid #b0392f; border-radius: 0 6px 0 0; }
.orgtree li:first-child::after { border-radius: 6px 0 0 0; }
.orgtree ul { padding-top: 18px; position: relative; }
.orgtree ul::before { content: ''; position: absolute; top: 0; left: 50%; height: 18px; border-left: 2px solid #b0392f; }
.orgtree > li { padding-top: 0; }
.org-box { display: flex; flex-direction: column; align-items: stretch; width: 150px; background: #fff; border: 1px solid #b0392f; border-radius: 3px; overflow: hidden; text-align: center; box-shadow: 0 1px 2px rgba(15,23,42,.06); }
.org-box-title { background: #a83b33; color: #fff; font-size: 9.5px; line-height: 1.25; font-weight: 600; padding: 6px 6px; min-height: 30px; display: flex; align-items: center; justify-content: center; }
.org-box-name { font-size: 10px; color: #0f172a; padding: 5px 6px; font-weight: 600; }
.org-box-meta { font-size: 8.5px; color: #64748b; padding: 0 6px 5px; }
.org-box.vacant { border-style: dashed; }
.org-box.vacant .org-box-title { background: #fef3c7; color: #92400e; }
.org-box.vacant .org-box-name { color: #b45309; }
.orgtree li:only-child > .org-box { margin: 0 auto; }
.org-card .org-legend { margin-top: 10px; justify-content: flex-end; }
@media print {
  #sidebar, header { display: none !important; }
  .page-back, .page-actions, .org-legend { display: none !important; }
  .content { margin: 0 !important; padding: 0 !important; }
  .orgtree-wrap { overflow: visible; }
}

/* ---- SVG org chart ---- */
.orgchart-wrap { overflow-x: auto; padding: 6px 0 4px; }
.orgchart-svg { width: 100%; height: auto; display: block; }
.og-node { cursor: pointer; }
.og-node:hover > rect:first-of-type { fill: #fff7f6; }
.vacancy-btn { border-color: #94a3b8; color: #475569; }
.vacancy-btn:hover { background: #eef2ff; border-color: #1d4ed8; color: #1d4ed8; }
.org-zoom { display: inline-flex; align-items: center; gap: 4px; margin-left: 10px; }
.zoom-btn { min-width: 26px; height: 24px; padding: 0 6px; border: 1px solid var(--line); border-radius: 6px; background: #fff; font-size: 12px; color: var(--ink); cursor: pointer; }
.zoom-btn:hover { border-color: var(--accent); color: var(--accent); }
.org-card-head { flex-wrap: wrap; gap: 8px; }
.orgchart-svg { margin: 0 auto; }
.orgchart-wrap { text-align: center; }
.orgchart-svg { display: inline-block; vertical-align: top; }
.orgchart-wrap { display: flex; justify-content: safe center; }
.orgchart-wrap > svg { flex: 0 0 auto; }
.og-band-hit { cursor: pointer; }
.og-node { cursor: pointer; }
.org-legend .lg-ceo, .org-legend .lg-director, .org-legend .lg-manager, .org-legend .lg-staff, .org-legend .lg.group { width: 10px; height: 10px; border-radius: 2px; display: inline-block; border-top: 0; }
.org-legend .lg-ceo { background: #0b2a5b; }
.org-legend .lg-director { background: #1d4ed8; }
.org-legend .lg-manager { background: #0e7490; }
.org-legend .lg-staff { background: #475569; }
.org-legend .lg.group { background: #4f46e5; }
.org-legend .lg-form4 { background: #b45309; }
.orgchart-svg { width: 100%; max-width: none; height: auto; }
.orgchart-wrap { justify-content: center; }

/* employee tabs */
.emp-tabs { display: flex; gap: 6px; margin: 10px 0 16px; border-bottom: 1px solid var(--line); }
.emp-tab { padding: 8px 14px; font-size: 12px; color: var(--muted); border-bottom: 2px solid transparent; }
.emp-tab:hover { color: var(--ink); }
.emp-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.pill.flying { background: #dbeafe; color: #1d4ed8; border-color: #bfdbfe; }
.check-line { display: flex; align-items: center; gap: 8px; padding-top: 18px; font-size: 12px; }
textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; color: var(--ink); background: #fff; resize: vertical; }
.roster-grid { width: 100%; border-collapse: collapse; font-size: 11px; }
.roster-grid th { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); font-size: 10px; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.roster-grid td { border-bottom: 1px solid #eef2f7; padding: 6px; vertical-align: top; }
.roster-name { min-width: 150px; }
.roster-cell { min-width: 90px; }
.duty-chip { border-radius: 6px; padding: 4px 6px; font-size: 10px; margin-bottom: 3px; background: #eef2ff; color: #1e3a8a; }
.duty-chip.flight { background: #dbeafe; color: #1d4ed8; }
.duty-chip.standby { background: #fef3c7; color: #92400e; }
.duty-chip.other { background: #f1f5f9; color: #475569; }

.notif-btn { position: relative; margin-right: 10px; font-size: 16px; padding: 4px 8px; border-radius: 8px; background: transparent; color: #e2e8f0; }
.notif-btn:hover { background: rgba(255,255,255,.08); }
.notif-badge { position: absolute; top: -2px; right: -2px; min-width: 16px; height: 16px; border-radius: 8px; background: #ef4444; color: #fff; font-size: 10px; line-height: 16px; text-align: center; display: none; padding: 0 4px; }
.notif-badge.show { display: inline-block; }
.notif-panel { position: fixed; top: 58px; right: 20px; width: 360px; max-height: 60vh; overflow-y: auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px rgba(15,23,42,.18); z-index: 90; }
.notif-panel header { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.notif-item { padding: 10px 12px; border-bottom: 1px solid #eef2f7; font-size: 12px; }
.notif-item b { display: block; margin-bottom: 2px; }
.notif-item.unread { background: #eff6ff; }
.roster-grid td.roster-cell { min-height: 34px; background: #fbfdff; border-right: 1px solid #eef2f7; }
.roster-grid td.roster-cell:empty { min-height: 34px; }

/* Date-range toolbar is desktop-only; on phones/tablets it must not float in the header. */
@media (max-width: 900px) {
  #globalToolbar { display: none !important; }
}

/* Mobile bottom navigation */
.mobile-nav { display: none; }
@media (max-width: 900px) {
  .mobile-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    background: #0b1f3a; border-top: 1px solid rgba(255,255,255,.08);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .mobile-nav button {
    flex: 1; background: transparent; color: #cbd5e1; font-size: 11px;
    padding: 8px 2px; border-radius: 8px; border: 0;
  }
  .mobile-nav button:active { background: rgba(255,255,255,.08); }
  .main { padding-bottom: 64px; }
}

@media (max-width: 900px) {
  .page .card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .page table.data { min-width: 560px; }
  .page { padding-bottom: 12px; }
}
.drop-target { background: #dbeafe !important; outline: 2px dashed #2563eb; }
.duty-chip.conflict { outline: 2px solid #dc2626; outline-offset: 1px; }
