*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
:root {
    --bg: #3d352e;
    --bg2: #4a4039;
    --bg3: #5e544a;
    --border: #6b5f54;
    --border2: #8a7e72;
    --text: #ebe5db;
    --text2: #9a8a78;
    --text3: #7d6e5e;
    --text-high: #faf7f2;
    --amber: #c49a5a;
    --amber2: #a67832;
    --green: #4a5c42;
    --red: #c07868;
    --blue: #6b7d8e;
    --cyan: #556677;
    --mono: "DM Mono", monospace;
    --sans: "DM Sans", sans-serif;
    color-scheme: dark light;
}

@media (prefers-color-scheme: light) {
    :root {
        --bg: #f5efe6;
        --bg2: #faf7f2;
        --bg3: #ebe5db;
        --border: #ddd5ca;
        --border2: #9a8a78;
        --text: #3d352e;
        --text2: #5e544a;
        --text3: #8a7e72;
        --text-high: #2d2520;
        --amber: #c49a5a;
        --amber2: #8c6e3a;
        --green: #4a5c42;
        --red: #805850;
        --blue: #556677;
        --cyan: #6b7d8e;
        color-scheme: light;
    }
}
body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
}
a {
    color: var(--blue);
    text-decoration: none;
}

#app {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}
#sidebar {
    background: var(--bg2);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
#main {
    overflow: hidden;
}

#header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border);
}
.logo {
    font-family: var(--sans);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--text-high);
}
.logo span {
    color: var(--amber);
}
.logo-sub {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text3);
    letter-spacing: 0.15em;
    margin-top: 2px;
}

#airport-section {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.field-label {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.12em;
    color: var(--text3);
    text-transform: uppercase;
    margin-bottom: 6px;
}
.icao-row {
    display: flex;
    gap: 8px;
}
#icao-input {
    max-width: 120px;
    background: var(--bg3);
    border: 1px solid var(--border2);
    color: var(--text-high);
    font-family: var(--mono);
    font-size: 15px;
    letter-spacing: 0.2em;
    padding: 8px 10px;
    border-radius: 4px;
    outline: none;
    text-transform: uppercase;
}
#icao-input:focus {
    border-color: var(--amber);
    box-shadow: 0 0 0 2px rgba(232, 168, 37, 0.15);
}
#icao-btn {
    background: var(--amber);
    color: #000;
    border: none;
    font-family: var(--sans);
    font-weight: 700;
    font-size: 13px;
    padding: 8px 14px;
    border-radius: 4px;
    cursor: pointer;
}
#icao-btn:hover {
    background: var(--amber2);
}
#airport-name {
    font-size: 12px;
    color: var(--text2);
    margin-top: 6px;
    font-family: var(--mono);
}

#nav {
    padding: 12px 12px 0;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-family: var(--sans);
    font-size: 14px;
    font-weight: 500;
    color: var(--text2);
    margin-bottom: 2px;
    transition:
        background 0.15s,
        color 0.15s;
    user-select: none;
}
.nav-item:hover {
    background: var(--bg3);
    color: var(--text);
}
.nav-item.active {
    background: rgba(232, 168, 37, 0.1);
    color: var(--amber);
}
.nav-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--border2);
    flex-shrink: 0;
}
.nav-item.active .nav-dot {
    background: var(--amber);
}

#clock-bar {
    margin-top: auto;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
}
.clock-time {
    font-family: var(--mono);
    font-size: 22px;
    color: var(--text-high);
    letter-spacing: 0.1em;
}
.clock-label {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text3);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-top: 2px;
}

.panel {
    display: none;
    padding: 28px 32px;
    height: 100vh;
    overflow-y: auto;
}
.panel.active {
    display: block;
}
.panel-title {
    font-family: var(--sans);
    font-size: 26px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--text-high);
    margin-bottom: 4px;
}
.panel-sub {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text3);
    letter-spacing: 0.1em;
    margin-bottom: 24px;
}

.card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 18px 20px;
    margin-bottom: 16px;
}
.card-title {
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.1em;
    color: var(--text3);
    text-transform: uppercase;
    margin-bottom: 12px;
}

.metar-raw {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text2);
    background: var(--bg3);
    padding: 10px 14px;
    border-radius: 4px;
    word-break: break-all;
    line-height: 1.7;
    margin-bottom: 16px;
    border-left: 3px solid var(--border2);
}
.wx-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}
.wx-cell {
    background: var(--bg3);
    border-radius: 5px;
    padding: 12px 14px;
    position: relative;
}
.wx-val {
    font-family: var(--mono);
    font-size: 18px;
    color: var(--text-high);
    line-height: 1.1;
}
.wx-unit {
    font-size: 10px;
    color: var(--text3);
    margin-top: 2px;
    font-family: var(--mono);
}
.wx-arrow {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    color: var(--green);
}
.wx-label {
    font-size: 11px;
    color: var(--text2);
    margin-top: 4px;
}

.suit-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 5px;
    border: 1px solid var(--border);
    margin-bottom: 14px;
}
.suit-score {
    font-family: var(--sans);
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
    min-width: 44px;
}
.suit-label {
    font-family: var(--sans);
    font-size: 15px;
    font-weight: 600;
}
.suit-detail {
    font-size: 12px;
    color: var(--text2);
    margin-top: 2px;
}

.taf-block {
    font-family: var(--mono);
    font-size: 11px;
    line-height: 1.8;
    color: var(--text2);
    white-space: pre-wrap;
    word-break: break-all;
}
.taf-period {
    color: var(--cyan);
}
.taf-wind {
    color: var(--amber);
}
.taf-vis {
    color: var(--green);
}

.sun-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}
.sun-cell {
    background: var(--bg3);
    border-radius: 5px;
    padding: 14px 16px;
}
.sun-time {
    font-family: var(--mono);
    font-size: 20px;
    color: var(--text-high);
}
.sun-lbl {
    font-size: 11px;
    color: var(--text2);
    margin-top: 4px;
}
.sun-accent {
    color: var(--amber2);
}
.timeline {
    position: relative;
    height: 40px;
    background: var(--bg3);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 8px;
}
.timeline-band {
    position: absolute;
    height: 100%;
}
.timeline-now {
    position: absolute;
    top: 0;
    width: 2px;
    height: 100%;
    background: var(--text-high);
    z-index: 10;
}
.sun-pos-row {
    display: flex;
    gap: 16px;
}
.sun-pos-cell {
    background: var(--bg3);
    border-radius: 5px;
    padding: 12px 16px;
    flex: 1;
}

.notam-item {
    border-left: 3px solid var(--border2);
    padding: 10px 14px;
    margin-bottom: 10px;
    background: var(--bg3);
    border-radius: 0 5px 5px 0;
}
.notam-item.critical {
    border-left-color: var(--red);
}
.notam-item.caution {
    border-left-color: var(--amber);
}
.notam-item.info {
    border-left-color: var(--blue);
}
.notam-id {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text3);
    margin-bottom: 4px;
}
.notam-text {
    font-size: 12px;
    line-height: 1.6;
    color: var(--text2);
}

.checklist-group {
    margin-bottom: 20px;
}
.checklist-group-title {
    font-family: var(--sans);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--text3);
    text-transform: uppercase;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.checklist-group-count {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text3);
}
.check-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.1s;
    user-select: none;
}
.check-item:hover {
    background: var(--bg3);
}
.check-item.done .check-label {
    color: var(--text3);
    text-decoration: line-through;
}
.check-box {
    width: 18px;
    height: 18px;
    border: 1px solid var(--border2);
    border-radius: 3px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.check-item.done .check-box {
    background: var(--green);
    border-color: var(--green);
}
.check-tick {
    color: #000;
    font-size: 11px;
    display: none;
}
.check-item.done .check-tick {
    display: block;
}
.check-label {
    font-size: 13px;
    color: var(--text);
}
.check-note {
    font-size: 11px;
    color: var(--text3);
    margin-left: auto;
}
.cl-progress {
    height: 3px;
    background: var(--border);
    border-radius: 2px;
    margin-bottom: 6px;
    overflow: hidden;
}
.cl-progress-fill {
    height: 100%;
    background: var(--green);
    border-radius: 2px;
    transition: width 0.3s;
}
.cl-pct {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text3);
    margin-bottom: 16px;
}
#cl-reset {
    background: none;
    border: 1px solid var(--border);
    color: var(--text2);
    font-family: var(--mono);
    font-size: 11px;
    padding: 6px 14px;
    border-radius: 4px;
    cursor: pointer;
}
#cl-reset:hover {
    color: var(--text);
    border-color: var(--border2);
}

#notes-area {
    width: 100%;
    min-height: 220px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--text);
    font-family: var(--mono);
    font-size: 13px;
    padding: 14px 16px;
    outline: none;
    resize: vertical;
    line-height: 1.7;
}
#notes-area:focus {
    border-color: var(--border2);
}
.notes-hint {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text3);
    margin-top: 8px;
}

.no-data {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text3);
    padding: 12px 0;
}
.error-msg {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--red);
    padding: 10px 14px;
    background: rgba(231, 76, 60, 0.08);
    border-radius: 4px;
    border-left: 3px solid var(--red);
}

::-webkit-scrollbar {
    width: 4px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border2);
    border-radius: 2px;
}

@media (max-width: 700px) {
    #app {
        grid-template-columns: 1fr;
    }
    #sidebar {
        height: auto;
        position: static;
    }
    .panel {
        height: auto;
    }
    .wx-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.cl-actions-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}
.cl-btn {
    font-family: var(--mono);
    font-size: 11px;
    padding: 6px 14px;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid var(--border);
    color: var(--text2);
    background: var(--bg3);
}
.cl-btn:hover {
    color: var(--text);
    border-color: var(--border2);
}
.cl-btn.primary {
    background: var(--amber);
    color: #000;
    border-color: var(--amber);
    font-weight: 600;
}
.cl-btn.primary:hover {
    background: var(--amber2);
}
.cl-btn.danger {
    color: var(--red);
    border-color: var(--red);
    background: transparent;
}
.cl-btn.danger:hover {
    background: rgba(231, 76, 60, 0.1);
}
.cl-btn.icon {
    padding: 4px 6px;
    font-size: 10px;
    min-width: auto;
    line-height: 1;
}
.cl-btn.icon:hover {
    background: var(--bg2);
}
.cl-edit-input {
    background: var(--bg3);
    border: 1px solid var(--border2);
    color: var(--text-high);
    font-family: var(--sans);
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 3px;
    outline: none;
}
.cl-edit-input:focus {
    border-color: var(--amber);
}
.cl-item-actions {
    display: none;
    gap: 4px;
    margin-left: auto;
    align-items: center;
    flex-shrink: 0;
}
.edit-mode .cl-item-actions {
    display: flex;
}
.edit-mode .check-item {
    padding-right: 4px;
}
.edit-mode .check-item:hover {
    background: rgba(232, 168, 37, 0.05);
}
.group-header {
    display: flex;
    align-items: center;
    gap: 8px;
}
.group-actions {
    display: none;
    gap: 4px;
}
.edit-mode .group-actions {
    display: flex;
}
.cl-add-bar {
    display: none;
    margin-top: 8px;
    margin-bottom: 12px;
}
.edit-mode .cl-add-bar {
    display: flex;
    gap: 8px;
}
.cl-group-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}
.cl-group-controls .cl-btn.icon {
    font-size: 10px;
    padding: 2px 5px;
}
.edit-saving {
    opacity: 0.5;
    pointer-events: none;
}
.cl-save-status {
    font-family: var(--mono);
    font-size: 10px;
    padding: 6px 8px;
    color: var(--green);
    display: none;
}
.cl-save-status.error {
    color: var(--red);
}
.ref-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
}
.ref-table th {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.1em;
    color: var(--text3);
    text-align: left;
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
}
.ref-table td {
    font-family: var(--mono);
    font-size: 11px;
    padding: 5px 10px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
.ref-table tr:hover td {
    background: var(--bg3);
}
.ref-table td:first-child {
    color: var(--amber);
    white-space: nowrap;
    min-width: 80px;
}
.ref-table td:last-child {
    color: var(--text2);
}

#ref-filter {
    width: 100%;
    background: var(--bg3);
    border: 1px solid var(--border2);
    color: var(--text-high);
    font-family: var(--mono);
    font-size: 11px;
    padding: 6px 10px;
    border-radius: 4px;
    outline: none;
    margin-bottom: 8px;
    box-sizing: border-box;
}
#ref-filter:focus {
    border-color: var(--amber);
    box-shadow: 0 0 0 2px rgba(232, 168, 37, 0.15);
}
#ref-filter::placeholder {
    color: var(--text3);
}

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-box {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 40px;
    width: 100%;
    max-width: 360px;
}
.login-page .logo {
    font-family: var(--sans);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--text-high);
    text-align: center;
    margin-bottom: 4px;
}
.login-page .logo span {
    color: var(--amber);
}
.login-page .logo-sub {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text3);
    letter-spacing: 0.15em;
    text-align: center;
    margin-bottom: 28px;
}
.login-label {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.12em;
    color: var(--text3);
    text-transform: uppercase;
    margin-bottom: 8px;
}
.login-input {
    width: 100%;
    background: var(--bg3);
    border: 1px solid var(--border2);
    color: var(--text-high);
    font-family: var(--mono);
    font-size: 15px;
    padding: 10px 14px;
    border-radius: 4px;
    outline: none;
    margin-bottom: 16px;
}
.login-input:focus {
    border-color: var(--amber);
    box-shadow: 0 0 0 2px rgba(232, 168, 37, 0.15);
}
.login-btn {
    width: 100%;
    background: var(--amber);
    color: #000;
    border: none;
    font-family: var(--sans);
    font-weight: 700;
    font-size: 14px;
    padding: 10px 14px;
    border-radius: 4px;
    cursor: pointer;
}
.login-btn:hover {
    background: var(--amber2);
}
.login-error {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--red);
    text-align: center;
    margin-bottom: 12px;
    padding: 8px 12px;
    background: rgba(231, 76, 60, 0.08);
    border-radius: 4px;
}

/* ── Runway cards ──────────────────────────────────────────────── */
.rwy-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.rwy-card {
    display: grid;
    grid-template-columns: 56px 1fr auto;
    gap: 12px 20px;
    align-items: center;
    padding: 14px 18px;
    border-radius: 5px;
    border: 1px solid var(--border);
    background: var(--bg2);
    transition: border-color 0.15s;
}
.rwy-card.tailwind {
    border-color: #c0392b44;
}
.rwy-ident {
    font-family: var(--mono);
    font-size: 26px;
    font-weight: 500;
    color: var(--text-high);
    line-height: 1;
}
.rwy-meta {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.rwy-heading {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text3);
}
.rwy-dims {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text3);
}
.rwy-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 4px;
}
.tag {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.08em;
    padding: 2px 7px;
    border: 1px solid var(--border);
    border-radius: 3px;
    color: var(--text3);
    text-transform: uppercase;
}
.tag.lit {
    border-color: #4caf8244;
    color: #4caf82;
}
.tag.paved {
    border-color: #33558844;
    color: #7ab0d4;
}
.rwy-wind {
    text-align: right;
}
.hw-value {
    font-family: var(--mono);
    font-size: 20px;
    font-weight: 500;
    color: #4caf82;
    line-height: 1;
}
.hw-value.tailwind-val {
    color: #c0392b;
}
.hw-label {
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #4caf82;
}
.hw-label.tailwind-lbl {
    color: #c0392b;
}
.xw-value {
    font-family: var(--mono);
    font-size: 13px;
    color: var(--text);
    margin-top: 6px;
}
.xw-value.warn {
    color: #e5a020;
}
.xw-value.danger {
    color: #c0392b;
}
.xw-label {
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text);
}
.xw-label.warn {
    color: #e5a020;
}
.xw-label.danger {
    color: #c0392b;
}
.vrb-note {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text3);
    font-style: italic;
}
