/* Themes. Colours come from the airline logo: hibiscus #f0145a, sunset #f45a2a, pollen #ffc04e,
   plum #45004a and cream #f9f4ee. html[data-theme] is set by AcarsUI.theme (dark is the default). */
:root, [data-theme="dark"] {
  --bg: #120c1c; --bg-2: #1a0f26; --panel: #241a35; --panel-2: #2f2443; --border: #45345c;
  --text: #f3eaf2; --muted: #a897b1; --accent: #f0145a; --accent-2: #ff6b93; --on-accent: #fff;
  --good: #2fd39b; --warn: #ffb547; --bad: #ff5d4d; --violet: #c9a2ff; --brand: #f0145a;
  --sel: #ffc04e; --route: #ff6b93; --plane: #ff8fb0; --node: #120c1c; --dim: #5d4e6d;
  --grad: linear-gradient(135deg, #f0145a, #f45a2a 60%, #ffc04e);
  --glow: 0 0 0 1px rgba(240, 20, 90, .25), 0 8px 30px -12px rgba(240, 20, 90, .45);
  --tint: rgba(240, 20, 90, .1); --label-bg: rgba(36, 26, 53, .92); --row-line: rgba(255, 255, 255, .05);
  --tiles: dark; color-scheme: dark;
}
[data-theme="light"] {
  --bg: #f9f4ee; --bg-2: #f3e8dc; --panel: #ffffff; --panel-2: #f6efe7; --border: #e8dccf;
  --text: #2b0b30; --muted: #7d6a7f; --accent: #e00f55; --accent-2: #b5084a; --on-accent: #fff;
  --good: #0c9466; --warn: #c26d00; --bad: #d5332a; --violet: #7a3fd6; --brand: #e00f55;
  --sel: #d98a00; --route: #e00f55; --plane: #e00f55; --node: #ffffff; --dim: #b9a9b6;
  --grad: linear-gradient(135deg, #f0145a, #f45a2a 60%, #ffb02e);
  --glow: 0 0 0 1px rgba(224, 15, 85, .15), 0 10px 30px -14px rgba(69, 0, 74, .35);
  --tint: rgba(224, 15, 85, .07); --label-bg: rgba(255, 255, 255, .94); --row-line: rgba(43, 11, 48, .07);
  --tiles: light; color-scheme: light;
}
[data-theme="charcoal"] {
  --bg: #18181a; --bg-2: #1f1f22; --panel: #222225; --panel-2: #2b2b2f; --border: #38383d;
  --text: #ececee; --muted: #9b9ba3; --accent: #ff6a3d; --accent-2: #ff9a72; --on-accent: #1a0a04;
  --good: #3ccf8e; --warn: #ffc04e; --bad: #ff5468; --violet: #b9a3ff; --brand: #f0145a;
  --sel: #ffc04e; --route: #ff8a5c; --plane: #ffb08f; --node: #18181a; --dim: #55555c;
  --grad: linear-gradient(135deg, #f45a2a, #ffc04e);
  --glow: 0 0 0 1px rgba(255, 106, 61, .22), 0 8px 30px -12px rgba(255, 106, 61, .35);
  --tint: rgba(255, 106, 61, .1); --label-bg: rgba(34, 34, 37, .92); --row-line: rgba(255, 255, 255, .05);
  --tiles: dark; color-scheme: dark;
}
:root { --mono: ui-monospace, "Cascadia Mono", Consolas, monospace; }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, "Segoe UI", sans-serif; }
body { transition: background-color .2s, color .2s; }

/* Brand */
.brand-logo { display: block; width: 100%; max-width: 220px; height: auto; border-radius: 12px; box-shadow: 0 6px 20px -10px rgba(0, 0, 0, .5); }
.wordmark { font-weight: 800; letter-spacing: .01em; }
.wordmark b { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* Theme picker */
.theme-pick { display: inline-grid; grid-template-columns: repeat(3, 1fr); gap: 2px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 9px; padding: 2px; }
.theme-pick button { border: 0; background: none; color: var(--muted); font-size: 11px; font-weight: 600; padding: 5px 8px; border-radius: 7px; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; justify-content: center; }
.theme-pick button:hover { color: var(--text); }
.theme-pick button.active { background: var(--panel); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.theme-pick .sw { width: 10px; height: 10px; border-radius: 50%; border: 1px solid rgba(128, 128, 128, .5); }
.theme-pick .sw-dark { background: #241a35; } .theme-pick .sw-light { background: #f9f4ee; } .theme-pick .sw-charcoal { background: #2b2b2f; }
button, select, input, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; }
a { color: var(--accent-2); }
.muted { color: var(--muted); }
.small { font-size: 12px; color: var(--muted); }
.mono { font-family: var(--mono); }
.ok { color: var(--good); } .bad { color: var(--bad); } .warn { color: var(--warn); }
.spacer { flex: 1; }
[hidden] { display: none !important; }

.card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 16px; min-width: 0; box-shadow: 0 1px 2px rgba(0, 0, 0, .06); }
.card-h { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.note-card { margin-bottom: 14px; border-color: var(--warn); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 8px; padding: 9px 14px; font-weight: 600; cursor: pointer; background: var(--panel-2); border: 1px solid var(--border); white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--grad); border-color: transparent; color: #fff; text-shadow: 0 1px 1px rgba(0, 0, 0, .2); box-shadow: var(--glow); }
.btn.primary:hover { filter: brightness(1.08); border-color: transparent; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.good { background: var(--good); border-color: var(--good); color: #04261a; }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.block { width: 100%; }

input[type=text], input[type=password], input[type=number], input[type=email], input:not([type]), select, textarea {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 7px; padding: 8px 10px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
label.field { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.error { color: var(--bad); font-size: 13px; min-height: 1em; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover { background: var(--panel-2); }
.table-wrap { overflow-x: auto; }

.status { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.s-Complete, .s-Accepted { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); }
.s-Rejected { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
.s-Invalidated { background: color-mix(in srgb, var(--muted) 20%, transparent); color: var(--muted); }
.s-Pending { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.a-REJECTED { color: var(--bad); } .a-INVALIDATED { color: var(--muted); } .a-FAILED { color: var(--warn); }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; position: relative; overflow: hidden; }
.stat::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--grad); }
.stat .k { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.stat .v { font-size: 24px; font-weight: 700; margin-top: 2px; }

.detail-head { display: flex; align-items: center; gap: 12px; margin: 4px 0 14px; flex-wrap: wrap; }
.detail-head h2 { font-size: 20px; }
.dgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.wide { grid-column: 1 / -1; }
.kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 14px; }
.kv .k { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.kv .v { font-family: var(--mono); font-weight: 600; }
.pts { display: grid; grid-template-columns: 56px 1fr; gap: 6px 10px; align-items: baseline; }
.pts .p { font-family: var(--mono); font-weight: 700; text-align: right; }
.pts .p.neg { color: var(--bad); } .pts .p.pos { color: var(--good); }
.total { border-top: 1px solid var(--border); margin-top: 10px; padding-top: 10px; display: flex; justify-content: space-between; font-weight: 700; }
.pirep-map { height: 340px; border-radius: 10px; }
.profile svg { width: 100%; height: auto; display: block; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.filters button { background: var(--panel-2); border: 1px solid var(--border); border-radius: 6px; padding: 3px 9px; font-size: 12px; cursor: pointer; color: var(--muted); }
.filters button.active { border-color: var(--accent); color: var(--text); background: var(--tint); }

.log { overflow: auto; font-size: 12.5px; }
.pirep-log { max-height: 480px; }
.le { display: grid; grid-template-columns: 62px 1fr auto; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--row-line); align-items: baseline; }
.le .tm { font-family: var(--mono); color: var(--muted); font-size: 11.5px; }
.tag { font-size: 10px; padding: 2px 6px; border-radius: 4px; background: var(--panel-2); color: var(--muted); white-space: nowrap; }
.tag.t-warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.tag.t-land { background: color-mix(in srgb, var(--violet) 16%, transparent); color: var(--violet); }
.tag.t-good { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); }

.empty { padding: 40px; text-align: center; color: var(--muted); }
.leaflet-container { font: inherit; background: var(--bg-2); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--panel); color: var(--text); border: 1px solid var(--border); }
.leaflet-popup-content { font-size: 13px; line-height: 1.5; }
.leaflet-tooltip.cs-tip { background: var(--label-bg); color: var(--text); border: 1px solid var(--border); box-shadow: none; font-size: 11px; font-weight: 600; padding: 1px 5px; }
.leaflet-tooltip.cs-tip::before { display: none; }
.leaflet-control-zoom a { background: var(--panel) !important; color: var(--text) !important; border-color: var(--border) !important; }
.leaflet-control-attribution { background: var(--label-bg) !important; color: var(--muted) !important; }
.plane-marker { background: none; border: 0; }
