/* ===================================================
   airdatahub UI — the shared look for every page.
   Loaded after apppacker-style.css, shared-styles.css and the shell styles in app.html,
   so it re-points their tokens and restyles the shell and the common building blocks.
   Wayfinding look: dark rail, sign yellow for "you are here" and the main action,
   monospace for codes (IATA, ICAO, registrations, frequencies, times).
   =================================================== */

:root {
  /* palette */
  --bg: #f3f5f8;
  --bg-card: #ffffff;
  --bg-hover: #eef1f5;
  --text: #141a22;
  --text-muted: #5d6877;
  --border: #dde2e9;
  --primary: #1d5fa8;            /* links and interactive accents inside pages */
  --primary-hover: #174d89;
  --primary-light: rgba(29, 95, 168, 0.10);
  --sign: #f2c230;               /* "you are here" and the main action */
  --sign-ink: #141a22;
  --rail: #141a22;
  --rail-ink: #c9d1dc;
  --rail-dim: #6b7686;
  --ok: #1f8a4c;   --ok-bg: #e3f3ea;
  --warn: #b56b00; --warn-bg: #fbf0dc;
  --crit: #c23434; --crit-bg: #fbe4e4;

  /* type */
  --f-display: "Archivo", "Arial Narrow", system-ui, sans-serif;
  --f-body: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-data: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* shape: quiet surfaces, hairlines instead of shadows */
  --radius: 10px;
  --radius-sm: 8px;
  --radius-md: 10px;
  --shadow-sm: none;
  --shadow-md: 0 4px 14px rgba(20, 26, 34, 0.08);
  --shadow-lg: 0 12px 32px rgba(20, 26, 34, 0.14);
  --shadow-hover: 0 4px 14px rgba(20, 26, 34, 0.08);
  --glass-bg: var(--bg);
  --glass-border: var(--border);
  --glass-blur: none;
  --glass-shadow: none;

  /* Metronic variables older pages still read: point them at the tokens above */
  --kt-primary: var(--primary);
  --kt-primary-light: var(--primary-light);
  --kt-border-color: var(--border);
  --kt-card-bg: var(--bg-card);
  --kt-secondary-bg: var(--bg-hover);
  --kt-light: var(--bg-hover);
  --kt-input-bg: var(--bg-card);
  --kt-input-color: var(--text);
  --kt-app-bg-color: var(--bg);
  --foreground: var(--text);
  --secondary-foreground: var(--text-muted);
  --muted-foreground: var(--text-muted);
}

.dark,
[data-theme="dark"] {
  --bg: #0d1117;
  --bg-card: #151b23;
  --bg-card-hover: #1b222c;
  --bg-hover: #1b222c;
  --text: #e6ebf1;
  --text-muted: #8d99a8;
  --border: #252e3a;
  --primary: #6aa8f0;
  --primary-hover: #8bbcf4;
  --primary-light: rgba(106, 168, 240, 0.14);
  --accent: #6aa8f0;
  --sign: #f2c230;
  --sign-ink: #141a22;
  --rail: #090c11;
  --rail-ink: #aab4c1;
  --rail-dim: #5f6b7b;
  --ok: #4cc77d;   --ok-bg: #12301f;
  --warn: #f0a33a; --warn-bg: #33250d;
  --crit: #f26d6d; --crit-bg: #3a1717;
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.55);
  --glass-bg: var(--bg);
  --glass-border: var(--border);
  color-scheme: dark;
}

/* ===== Base ===== */
body,
.dark body,
[data-theme="dark"] body {
  font-family: var(--f-body);
  background: var(--bg);
  color: var(--text);
}
h1, h2, h3, .header-title, .kt-card-title, .kt-modal-title {
  font-family: var(--f-display);
  font-stretch: 85%;
  text-wrap: balance;
}
code, kbd, pre, .ac-mono, .mono { font-family: var(--f-data); }
table { font-variant-numeric: tabular-nums; }
a { color: var(--primary); }
:focus-visible { outline: 2px solid var(--sign); outline-offset: 2px; }

/* ===== Shell: rail ===== */
.app-sidebar,
.dark .app-sidebar,
[data-theme="dark"] .app-sidebar {
  background: var(--rail);
  color: var(--rail-ink);
  border-right: 0;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.sidebar-logo { border-bottom-color: rgba(255, 255, 255, 0.06); }
.sidebar-user, #sidebar-footer { border-top-color: rgba(255, 255, 255, 0.06); color: var(--rail-ink); }
.sidebar-nav { scrollbar-color: rgba(255, 255, 255, 0.12) transparent; }
.nav-section-label {
  color: var(--rail-dim) !important;
  opacity: 1 !important;
  letter-spacing: 0.14em !important;
}
.app-sidebar .nav-link,
.app-sidebar .nav-sub-link {
  color: var(--rail-ink);
  border-radius: 6px;
  font-size: 13px;
}
.app-sidebar .nav-link:hover,
.app-sidebar .nav-sub-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}
.app-sidebar .nav-link.active,
.app-sidebar .nav-sub-link.active,
.dark .app-sidebar .nav-link.active,
[data-theme="dark"] .app-sidebar .nav-link.active {
  background: var(--sign);
  color: var(--sign-ink);
  font-weight: 600;
  box-shadow: none;
}
.app-sidebar .nav-link.active:hover,
.app-sidebar .nav-sub-link.active:hover { background: var(--sign); color: var(--sign-ink); }
.app-sidebar .nav-accordion-body { border-left-color: rgba(255, 255, 255, 0.08); }
#nav-role-tabbar { border-top-color: rgba(255, 255, 255, 0.06) !important; color: var(--rail-ink); }

/* ===== Shell: header ===== */
.app-header,
.dark .app-header,
[data-theme="dark"] .app-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.app-header.scrolled { box-shadow: 0 1px 0 var(--border); }
.header-title { font-size: 19px; font-weight: 700; letter-spacing: -0.005em; }
.app-footer { background: var(--bg); }

/* ===== Cards ===== */
.kt-card, .card,
.dark .kt-card, .dark .card,
[data-theme="dark"] .kt-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.kt-card:hover, .card:hover { box-shadow: none; transform: none; }
.kt-card-header { border-bottom: 1px solid var(--border); }
.kt-card-title { font-size: 16px; font-weight: 700; }

/* ===== Buttons ===== */
.kt-btn {
  border-radius: var(--radius-sm);
  font-family: var(--f-body);
  font-weight: 600;
  box-shadow: none;
}
.kt-btn-primary,
.dark .kt-btn-primary,
[data-theme="dark"] .kt-btn-primary {
  background: var(--sign);
  border-color: var(--sign);
  color: var(--sign-ink);
  background-image: none;
  box-shadow: none;
}
.kt-btn-primary:hover { background: #e4b41f; border-color: #e4b41f; color: var(--sign-ink); }
.kt-btn-outline,
.kt-btn-secondary,
.kt-btn-light-primary,
.kt-btn-light-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
}
.kt-btn-outline:hover,
.kt-btn-secondary:hover,
.kt-btn-light-primary:hover,
.kt-btn-light-secondary:hover { border-color: var(--text-muted); background: var(--bg-card); color: var(--text); }
.kt-btn-danger { background: var(--crit); border-color: var(--crit); color: #fff; }
.kt-btn-success { background: var(--ok); border-color: var(--ok); color: #fff; }

/* ===== Badges: small uppercase pills, colour says the state ===== */
.kt-badge {
  border-radius: 999px;
  font-family: var(--f-body);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 0;
}
.kt-badge-success, .dark .kt-badge-success, [data-theme="dark"] .kt-badge-success { background: var(--ok-bg); color: var(--ok); }
.kt-badge-warning, .dark .kt-badge-warning, [data-theme="dark"] .kt-badge-warning { background: var(--warn-bg); color: var(--warn); }
.kt-badge-danger, .dark .kt-badge-danger, [data-theme="dark"] .kt-badge-danger { background: var(--crit-bg); color: var(--crit); }
.kt-badge-primary { background: var(--primary-light); color: var(--primary); }

/* ===== Inputs ===== */
.kt-input, .kt-select, input[type="text"].kt-input, input[type="search"] {
  border-radius: var(--radius-sm);
}
.kt-input:focus, .kt-select:focus { border-color: var(--text-muted); box-shadow: 0 0 0 2px color-mix(in srgb, var(--sign) 45%, transparent); }

/* ===== Tables ===== */
.kt-table th, table.table th {
  font-family: var(--f-body);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ===== Modals, dropdowns, toasts ===== */
.kt-modal-content, .dark .kt-modal-content, [data-theme="dark"] .kt-modal-content,
.kt-dropdown-menu, .kt-toast, .dark .kt-toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* ===== Mobile tab bar and its sheets ===== */
.mobile-bottom-nav,
.dark .mobile-bottom-nav,
[data-theme="dark"] .mobile-bottom-nav {
  background: var(--rail);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.mobile-nav-tab { color: var(--rail-ink); }
.mobile-nav-tab.active { color: var(--sign); }
.mobile-nav-popover,
.dark .mobile-nav-popover,
[data-theme="dark"] .mobile-nav-popover {
  background: var(--bg-card);
  border: 1px solid var(--border);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* ===== Page template (new pages): header · toolbar · content ===== */
.ui-page { display: flex; flex-direction: column; gap: 16px; }
.ui-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.ui-head > div:first-child { min-width: 0; }
.ui-eyebrow { font: 600 11px/1 var(--f-body); letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); }
.ui-title { margin: 6px 0 2px; font: 750 28px/1.1 var(--f-display); font-stretch: 82%; letter-spacing: -0.005em; }
.ui-sub { color: var(--text-muted); font-size: 13px; }
.ui-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.ui-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ui-search { flex: 1 1 260px; display: flex; align-items: center; gap: 8px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 10px; height: 36px; }
.ui-search input { border: 0; outline: 0; background: none; flex: 1; min-width: 0; color: var(--text); }
.ui-chip { border: 1px solid var(--border); background: var(--bg-card); color: var(--text); border-radius: 999px; padding: 5px 11px; font-size: 12px; font-weight: 600; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.ui-chip .n { font: 500 11px var(--f-data); color: var(--text-muted); }
.ui-chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.ui-chip.on .n { color: inherit; opacity: 0.7; }
.ui-split { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .ui-split { grid-template-columns: 1fr; } }
.ui-panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; min-width: 0; }
.ui-sec { font: 600 11px/1 var(--f-body); letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); margin: 0 0 10px; }
.ui-list { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.ui-row { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--border); cursor: pointer; }
.ui-row:last-child { border-bottom: 0; }
.ui-row:hover { background: color-mix(in srgb, var(--sign) 8%, transparent); }
.ui-row.on { box-shadow: inset 3px 0 0 var(--sign); background: color-mix(in srgb, var(--sign) 12%, transparent); }
.ui-code { font: 600 15px var(--f-data); letter-spacing: 0.02em; }
.ui-pill { font: 600 10px/1 var(--f-body); letter-spacing: 0.06em; text-transform: uppercase; padding: 4px 7px; border-radius: 999px; white-space: nowrap; }
.ui-pill.ok { background: var(--ok-bg); color: var(--ok); }
.ui-pill.warn { background: var(--warn-bg); color: var(--warn); }
.ui-pill.crit { background: var(--crit-bg); color: var(--crit); }
.ui-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px 18px; }
.ui-fact span { display: block; font: 600 10px/1.4 var(--f-body); letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); }
.ui-fact b { font: 500 15px/1.35 var(--f-data); }
.ui-sign { background: var(--rail); color: #fff; border-radius: 8px; padding: 10px 14px; display: inline-flex; gap: 12px; align-items: baseline; }
.ui-sign .big { font: 700 34px/1 var(--f-display); font-stretch: 80%; color: var(--sign); letter-spacing: 0.03em; }
.ui-sign .small { font: 500 13px var(--f-data); color: #aab4c1; }
.ui-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ui-table th { text-align: left; font: 600 10px var(--f-body); letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); padding: 0 8px 8px 0; border-bottom: 1px solid var(--border); }
.ui-table td { padding: 8px 8px 8px 0; border-bottom: 1px solid var(--border); }
.ui-table tr:last-child td { border-bottom: 0; }
.ui-table td.m { font-family: var(--f-data); }
/* Sub-pages of one area (Airports: Liste · Karte; Places: Liste · Import · Karly) */
.ui-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.ui-tabs::-webkit-scrollbar { display: none; }
.ui-tabs a { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px; font-size: 13.5px; font-weight: 600; color: var(--text-muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.ui-tabs a.on { color: var(--text); border-bottom-color: var(--sign); }
.ui-tabs a:active { background: var(--bg-hover); }

/* ── Inbox drawer (header bell) ── */
.icon-btn { position: relative; }
.ib-count { position: absolute; top: -2px; right: -4px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: var(--crit); color: #fff; font: 600 10px/17px var(--f-data); text-align: center; pointer-events: none; }
#notifications_drawer { display: flex; flex-direction: column; background: var(--bg-card); color: var(--text); overflow: hidden; }
#notifications_drawer.hidden { display: none; }
.ib-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 10px; border-bottom: 1px solid var(--border); }
.ib-title { font: 700 17px var(--f-display); }
.ib-sub { font-size: 12px; color: var(--text-muted); }
.ib-filters { display: flex; gap: 6px; padding: 10px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.ib-list { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.ib-day { position: sticky; top: 0; z-index: 1; background: var(--bg-card); padding: 10px 16px 4px; font: 600 10px var(--f-body); letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); }
.ib-item { display: flex; align-items: stretch; border-bottom: 1px solid var(--border); }
.ib-main { flex: 1; min-width: 0; display: flex; gap: 10px; align-items: flex-start; text-align: left; padding: 11px 6px 11px 16px; background: none; border: 0; color: inherit; cursor: pointer; }
.ib-main:active { background: var(--bg-hover); }
.ib-mark { flex: none; width: 4px; align-self: stretch; border-radius: 2px; background: var(--border); }
.lv-ok .ib-mark { background: var(--ok); }
.lv-warn .ib-mark { background: var(--warn); }
.lv-crit .ib-mark { background: var(--crit); }
.lv-info .ib-mark { background: var(--primary); }
.ib-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ib-t { font-size: 13.5px; font-weight: 500; }
.ib-item.unread .ib-t { font-weight: 700; }
.ib-item:not(.unread) .ib-text { opacity: 0.7; }
.ib-b { font-size: 12.5px; color: var(--text-muted); white-space: pre-line; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ib-meta { font: 11px var(--f-data); color: var(--text-muted); }
.ib-meta b { color: var(--primary); font-weight: 600; }
.ib-del { flex: none; min-width: 44px; padding: 0 10px; border: 0; background: none; color: var(--text-muted); cursor: pointer; font-size: 12px; font-weight: 600; }
.ib-del.armed { background: var(--crit-bg); color: var(--crit); }
.ib-empty { padding: 48px 16px; text-align: center; color: var(--text-muted); font-size: 13px; }
.ib-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
.ib-foot .kt-btn { justify-content: center; }
.ib-foot .kt-btn.armed { border-color: var(--crit); color: var(--crit); }
#notifications_drawer { position: fixed; }
.ib-detail { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; background: var(--bg-card); }
.ib-detail[hidden] { display: none; }
.ib-dhead { padding: 10px 8px; border-bottom: 1px solid var(--border); }
.ib-dbody { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; border-left: 4px solid var(--primary); }
.ib-dbody.lv-ok { border-left-color: var(--ok); }
.ib-dbody.lv-warn { border-left-color: var(--warn); }
.ib-dbody.lv-crit { border-left-color: var(--crit); }
.ib-dtitle { font: 700 18px/1.25 var(--f-display); margin: 0; text-wrap: balance; }
.ib-dtext { font-size: 14px; line-height: 1.5; white-space: pre-line; word-break: break-word; }
.ib-changes { margin: 0; padding-left: 18px; list-style: disc; font-size: 13.5px; line-height: 1.5; display: flex; flex-direction: column; gap: 4px; }
.ib-facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0; font-size: 13px; }
.ib-facts dt { color: var(--text-muted); }
.ib-facts dd { margin: 0; font-family: var(--f-data); }
.ib-img { max-width: 100%; border-radius: var(--radius-sm); }

/* ── Sidebar: flat groups, count pills, avatar menu (nav.js) ── */
.nav-group { margin-bottom: 10px; }
.app-sidebar .nav-section-label { padding: 8px 10px 5px; font: 600 10px/1 var(--f-body); text-transform: uppercase; }
.app-sidebar .nav-item { margin-bottom: 1px; }
.app-sidebar .nav-link { padding: 7px 10px; gap: 10px; }
.app-sidebar .nav-link > span:not(.nav-pill) { flex: 1; min-width: 0; }
.nav-pill { margin-left: auto; font: 600 10px/1 var(--f-data); background: rgba(255, 255, 255, 0.1); color: var(--rail-ink); padding: 3px 6px; border-radius: 999px; }
.nav-pill.warn { background: color-mix(in srgb, var(--sign) 24%, transparent); color: var(--sign); }
.app-sidebar .nav-link.active .nav-pill { background: rgba(20, 26, 34, 0.15); color: var(--sign-ink); }
#sidebar-footer:empty { display: none; }
.app-sidebar .sidebar-user { padding: 8px 10px 10px; }
.nav-me { position: relative; }
.nav-me-btn { width: 100%; display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 7px 8px; border-radius: 8px; cursor: pointer; color: var(--rail-ink); text-align: left; }
.nav-me-btn:hover, .nav-me-btn[aria-expanded="true"] { background: rgba(255, 255, 255, 0.06); }
.nav-me-btn img, .nav-me-initial { flex: none; width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.nav-me-initial { display: grid; place-items: center; background: var(--sign); color: var(--sign-ink); font: 700 14px var(--f-display); }
.nav-me-who { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 1px; }
.nav-me-who b { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-me-who small { font-size: 11px; color: var(--rail-dim); }
.nav-me-caret { font-size: 11px; color: var(--rail-dim); transition: transform 0.15s; }
.nav-me-btn[aria-expanded="false"] .nav-me-caret { transform: rotate(180deg); }
.nav-me-menu { position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); z-index: 30; background: var(--bg-card); color: var(--text); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 14px 36px rgba(0, 0, 0, 0.35); padding: 6px; display: flex; flex-direction: column; }
.nav-me-menu[hidden] { display: none; }
.nav-me-menu a, .nav-me-menu button { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; font-size: 13px; color: var(--text); text-decoration: none; background: none; border: 0; cursor: pointer; text-align: left; width: 100%; }
.nav-me-menu a i, .nav-me-menu button i { width: 16px; text-align: center; color: var(--text-muted); }
.nav-me-menu a:hover, .nav-me-menu button:hover, .nav-me-menu a.active { background: color-mix(in srgb, var(--sign) 16%, transparent); }
.nav-me-menu hr { border: 0; border-top: 1px solid var(--border); margin: 5px 4px; }
.nav-me-menu .danger, .nav-me-menu .danger i { color: var(--crit); }
body.sidebar-collapsed .app-sidebar .nav-section-label,
body.sidebar-collapsed .app-sidebar .nav-pill { display: none; }

/* ── Header theme toggle: one tap cycles Hell → Dunkel → System ── */
.icon-btn.theme-toggle { width: auto; border-radius: 999px; gap: 6px; padding: 0 10px; display: inline-flex; align-items: center; }
.theme-toggle-label { font: 600 11px var(--f-body); color: var(--text-muted); min-width: 3.4em; text-align: left; }
@media (max-width: 480px) { .theme-toggle-label { display: none; } .icon-btn.theme-toggle { padding: 0; width: 36px; justify-content: center; } }

/* ── Flight timeline side panel (flight-timeline.js) ── */
.ft-root[hidden] { display: none; }
.ft-root { position: fixed; inset: 0; z-index: 10050; }
html.ft-lock { overflow: hidden; }
.ft-backdrop { position: absolute; inset: 0; background: rgba(8, 12, 18, 0.45); opacity: 0; transition: opacity 0.2s; }
.ft-root.open .ft-backdrop { opacity: 1; }
.ft-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(460px, 100%); background: var(--bg); color: var(--text); border-left: 1px solid var(--border); box-shadow: -18px 0 48px rgba(0, 0, 0, 0.25); display: flex; flex-direction: column; transform: translateX(100%); transition: transform 0.22s ease; padding-top: env(safe-area-inset-top, 0px); }
.ft-root.open .ft-panel { transform: none; }
.ft-head { padding: 16px 18px 12px; border-bottom: 1px solid var(--border); background: var(--bg-card); display: flex; flex-direction: column; gap: 12px; }
.ft-grip { display: none; }
.ft-titlebar { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.ft-eyebrow { font: 600 10px var(--f-body); letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); }
.ft-title { margin: 2px 0 0; font: 700 26px/1.1 var(--f-data); }
.ft-sub { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; }
.ft-close { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border); background: var(--bg); color: var(--text); cursor: pointer; display: grid; place-items: center; }
.ft-stats { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.ft-stats div { flex: none; display: flex; flex-direction: column; gap: 1px; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--bg-hover); min-width: 84px; }
.ft-stats b { font: 700 17px var(--f-data); }
.ft-stats span { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.ft-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 6px 18px calc(18px + env(safe-area-inset-bottom, 0px)); }
.ft-day { position: sticky; top: 0; z-index: 1; background: var(--bg); padding: 12px 0 6px; font: 600 11px var(--f-body); letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); }
.ft-seg { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); padding: 12px 14px; margin-bottom: 8px; display: flex; flex-direction: column; gap: 10px; }
.ft-seg.is-open { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); }
.ft-segtop { display: flex; gap: 6px; flex-wrap: wrap; }
.ft-pill { font: 600 11px var(--f-body); padding: 2px 8px; border-radius: 999px; background: var(--bg-hover); color: var(--text-muted); }
.ft-pill.ok { background: var(--ok-bg); color: var(--ok); }
.ft-pill.warn { background: var(--warn-bg); color: var(--warn); }
.ft-pill.live { background: color-mix(in srgb, var(--primary) 16%, transparent); color: var(--primary); }
.ft-route { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; }
.ft-st { display: flex; flex-direction: column; gap: 1px; min-width: 58px; }
.ft-st.r { text-align: right; align-items: flex-end; }
.ft-st .code { font: 700 22px/1 var(--f-display); font-stretch: 85%; }
.ft-st .time { font: 600 14px var(--f-data); }
.ft-st .time s { color: var(--text-muted); font-weight: 400; margin-right: 4px; }
.ft-st .meta { font-size: 11px; color: var(--text-muted); min-height: 14px; }
.ft-line { position: relative; height: 26px; display: flex; align-items: center; justify-content: center; }
.ft-line span { position: absolute; left: 0; right: 0; top: 50%; height: 2px; background: var(--border); }
.ft-seg.is-open .ft-line span { background: linear-gradient(90deg, var(--primary), var(--border)); }
.ft-line i { position: relative; font-style: normal; color: var(--primary); background: var(--bg-card); padding: 0 6px; font-size: 14px; }
.ft-line em { position: absolute; top: 100%; font: normal 11px var(--f-data); color: var(--text-muted); white-space: nowrap; transform: translateY(-4px); }
.ft-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.ft-chips span { font: 11.5px var(--f-data); padding: 2px 8px; border-radius: 999px; background: var(--bg-hover); }
.ft-actions { display: flex; gap: 8px; align-items: center; border-top: 1px dashed var(--border); padding-top: 8px; }
.ft-actions button { border: 1px solid var(--border); background: none; color: var(--text); border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 600; cursor: pointer; }
.ft-actions button.danger { color: var(--crit); border-color: color-mix(in srgb, var(--crit) 40%, var(--border)); }
.ft-id { margin-left: auto; font: 11px var(--f-data); color: var(--text-muted); }
.ft-empty { padding: 40px 10px; text-align: center; color: var(--text-muted); font-size: 14px; }
@media (max-width: 640px) {
  .ft-panel { top: auto; left: 0; width: 100%; height: 88vh; border-left: 0; border-top: 1px solid var(--border); border-radius: 16px 16px 0 0; transform: translateY(100%); padding-top: 0; box-shadow: 0 -18px 48px rgba(0, 0, 0, 0.25); }
  .ft-head { border-radius: 16px 16px 0 0; padding-top: 8px; }
  .ft-grip { display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--border); margin: 0 auto 4px; }
}
