:root {
    --apa-bg: #061523;
    --apa-surface: rgba(14, 34, 54, .88);
    --apa-surface-strong: #102a44;
    --apa-border: rgba(125, 211, 252, .2);
    --apa-text: #eaf7ff;
    --apa-muted: #9db7ca;
    --apa-blue: #54c7f4;
    --apa-cyan: #75e5d5;
    --apa-soft: rgba(84, 199, 244, .12);
    --apa-warn: #fbbf6b;
    --apa-danger: #fb9b9b;
}

.apa-body { min-height: 100vh; margin: 0; overflow-x: hidden; background: var(--apa-bg); color: var(--apa-text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.apa-body #mainNav { background: rgba(6, 21, 35, .94); }
.apa-body [hidden] { display: none !important; }
.apa-main { min-height: 100vh; padding: 104px 0 70px; background: radial-gradient(circle at 13% 4%, rgba(84, 199, 244, .15), transparent 29rem), radial-gradient(circle at 91% 33%, rgba(117, 229, 213, .08), transparent 29rem), linear-gradient(150deg, #061523, #092035 55%, #06131f); }
.apa-main::before { content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .14; background-image: radial-gradient(#fff 1px, transparent 1px); background-size: 88px 88px; mask-image: linear-gradient(to bottom, #000, transparent 72%); }
.apa-shell { position: relative; z-index: 1; width: min(100% - 32px, 920px); margin: auto; }
.apa-hero { display: flex; align-items: flex-start; gap: 18px; margin-bottom: 30px; }
.apa-drop-icon { display: grid; flex: 0 0 62px; width: 62px; height: 62px; place-items: center; border: 1px solid rgba(117, 229, 213, .4); border-radius: 19px; background: rgba(117, 229, 213, .12); color: var(--apa-cyan); font-size: 1.65rem; box-shadow: 0 0 32px rgba(84, 199, 244, .1); }
.apa-eyebrow { margin: 0 0 7px; color: var(--apa-blue); font-size: .7rem; font-weight: 850; letter-spacing: .16em; }
.apa-hero h1 { margin: 0; color: #fff; font-size: clamp(2.2rem, 7vw, 3.8rem); font-weight: 900; letter-spacing: -.07em; line-height: 1; }
.apa-lead { max-width: 650px; margin: 12px 0 0; color: var(--apa-muted); font-size: 1rem; line-height: 1.6; }
.apa-profile-card, .apa-target-card, .apa-log-card, .apa-liquids-card, .apa-safety-card { border: 1px solid var(--apa-border); border-radius: 20px; background: var(--apa-surface); box-shadow: 0 24px 70px rgba(0, 0, 0, .2); }
.apa-profile-card, .apa-log-card, .apa-liquids-card, .apa-safety-card { padding: clamp(20px, 5vw, 32px); }
.apa-section-heading, .apa-card-heading, .apa-target-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; }
.apa-section-heading { margin-bottom: 21px; }
.apa-section-heading h2, .apa-card-heading h2, .apa-target-heading h2, .apa-safety-card h2 { margin: 0; color: #fff; font-size: clamp(1.35rem, 4vw, 1.9rem); letter-spacing: -.045em; }
.apa-local-note, .apa-water-total { color: var(--apa-muted); font-size: .78rem; }
.apa-local-note i { margin-right: 4px; color: var(--apa-cyan); }
.apa-profile-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: end; }
.apa-profile-form label, .apa-log-form label, .apa-scan-form label { display: grid; gap: 6px; }
.apa-profile-form label > span, .apa-log-form label > span, .apa-scan-form label > span { color: #d7e9f4; font-size: .76rem; font-weight: 750; }
.apa-profile-form small, .apa-log-form small, .apa-scan-form small { color: var(--apa-muted); font-size: .7rem; font-weight: 500; }
.apa-profile-form input, .apa-profile-form select, .apa-log-form input, .apa-log-form select, .apa-scan-form input, .apa-scan-form select { width: 100%; min-height: 43px; padding: 9px 10px; border: 1px solid rgba(148, 163, 184, .3); border-radius: 9px; outline: none; background: rgba(0, 0, 0, .17); color: #f4fbff; font: inherit; font-size: .88rem; }
.apa-profile-form input:focus, .apa-profile-form select:focus, .apa-log-form input:focus, .apa-log-form select:focus, .apa-scan-form input:focus, .apa-scan-form select:focus { border-color: var(--apa-blue); box-shadow: 0 0 0 3px var(--apa-soft); }
.apa-profile-form select option, .apa-log-form select option, .apa-scan-form select option { background: #102a44; color: #fff; }
.apa-primary-button, .apa-secondary-button { display: inline-flex; min-height: 43px; align-items: center; justify-content: center; gap: 7px; padding: 9px 14px; border: 0; border-radius: 9px; background: linear-gradient(110deg, #0891b2, #38bdf8); color: #fff; cursor: pointer; font: inherit; font-size: .8rem; font-weight: 850; text-decoration: none; transition: transform .18s, filter .18s; }
.apa-primary-button:hover, .apa-primary-button:focus-visible, .apa-secondary-button:hover, .apa-secondary-button:focus-visible { color: #fff; filter: brightness(1.12); transform: translateY(-1px); }
.apa-form-message { min-height: 1.25em; margin: 12px 0 0; color: var(--apa-warn); font-size: .78rem; }
.apa-dashboard { display: grid; grid-template-columns: minmax(260px, .82fr) minmax(0, 1.18fr); gap: 16px; margin-top: 16px; }
.apa-target-card { align-self: start; padding: 25px; background: linear-gradient(145deg, rgba(18, 68, 91, .94), rgba(12, 43, 67, .9)); }
.apa-target-heading { align-items: flex-start; }
.apa-target-value { display: flex; align-items: baseline; gap: 5px; color: var(--apa-cyan); white-space: nowrap; }
.apa-target-value strong { font-size: clamp(2rem, 6vw, 3.3rem); font-variant-numeric: tabular-nums; letter-spacing: -.07em; }
.apa-target-value span { font-size: .78rem; font-weight: 800; }
.apa-progress-track { height: 11px; margin-top: 28px; overflow: hidden; border-radius: 999px; background: rgba(0, 0, 0, .25); }
.apa-progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--apa-blue), var(--apa-cyan)); box-shadow: 0 0 18px rgba(117, 229, 213, .55); transition: width .3s ease; }
.apa-progress-label { display: flex; justify-content: space-between; gap: 10px; margin-top: 9px; color: #c3dce9; font-size: .76rem; }
.apa-progress-label strong { color: var(--apa-cyan); }
.apa-target-note { min-height: 2.4em; margin: 19px 0 0; color: #b4d0de; font-size: .8rem; line-height: 1.5; }
.apa-profile-summary { margin-top: 16px; padding-top: 13px; border-top: 1px solid rgba(255, 255, 255, .13); color: #d4e8f1; font-size: .75rem; line-height: 1.55; }
.apa-card-heading { align-items: flex-start; margin-bottom: 17px; }
.apa-quick-add { display: flex; flex-wrap: wrap; gap: 7px; }
.apa-quick-add button { display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px; border: 1px solid rgba(117, 229, 213, .3); border-radius: 8px; background: rgba(117, 229, 213, .08); color: #b8f4eb; cursor: pointer; font: inherit; font-size: .74rem; font-weight: 800; }
.apa-quick-add button:hover, .apa-quick-add button:focus-visible { border-color: var(--apa-cyan); background: rgba(117, 229, 213, .16); }
.apa-scan-panel { margin-top: 18px; padding: 16px; border: 1px dashed rgba(84, 199, 244, .35); border-radius: 13px; background: rgba(84, 199, 244, .055); }
.apa-scan-heading { margin-bottom: 8px; }
.apa-scan-heading h3 { margin: 0; color: #fff; font-size: 1.05rem; letter-spacing: -.025em; }
.apa-scan-note { color: var(--apa-cyan); font-size: .74rem; white-space: nowrap; }
.apa-scan-note i { margin-right: 4px; }
.apa-scan-help { margin: 0; color: var(--apa-muted); font-size: .76rem; line-height: 1.5; }
.apa-scan-tip { margin: 9px 0 0; padding: 9px 10px; border-left: 2px solid var(--apa-cyan); border-radius: 0 7px 7px 0; background: rgba(117, 229, 213, .07); color: #c8e9e5; font-size: .74rem; line-height: 1.5; }
.apa-scan-tip i { margin-right: 5px; color: var(--apa-warn); }
.apa-scan-tip strong { color: #fff; }
.apa-scan-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
.apa-camera-button, .apa-scan-reset { display: inline-flex; min-height: 38px; align-items: center; justify-content: center; gap: 7px; padding: 8px 11px; border: 1px solid rgba(84, 199, 244, .5); border-radius: 8px; background: rgba(84, 199, 244, .15); color: var(--apa-blue); cursor: pointer; font-size: .76rem; font-weight: 800; }
.apa-camera-button:hover, .apa-camera-button:focus-within, .apa-scan-reset:hover, .apa-scan-reset:focus-visible { border-color: var(--apa-cyan); background: rgba(117, 229, 213, .14); color: #d7fffa; }
.apa-scan-actions input[type="file"] { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.apa-scan-reset { border-color: rgba(148, 163, 184, .3); background: transparent; color: var(--apa-muted); }
.apa-scan-status { min-height: 1.2em; margin: 10px 0 0; color: #c6e4f1; font-size: .74rem; line-height: 1.45; }
.apa-scan-preview-wrap { margin-top: 10px; overflow: hidden; border-radius: 10px; background: rgba(0, 0, 0, .24); }
.apa-scan-viewport { position: relative; max-height: 260px; overflow: auto; background: rgba(0, 0, 0, .2); }
.apa-scan-preview { display: block; width: 100%; max-width: none; height: auto; object-fit: contain; touch-action: auto; }
.apa-scan-preview.is-selecting { cursor: crosshair; touch-action: none; }
.apa-scan-selection-box { position: absolute; z-index: 2; pointer-events: none; background: rgba(117, 229, 213, .2); border: 2px dashed var(--apa-cyan); box-shadow: 0 0 0 9999px rgba(0, 0, 0, .3); }
.apa-scan-zoom-row { display: grid; grid-template-columns: auto minmax(100px, 1fr) auto; gap: 9px; align-items: center; padding: 10px 10px 0; color: #cfe4ef; font-size: .74rem; }
.apa-scan-zoom-row label { white-space: nowrap; }
.apa-scan-zoom-row label i { margin-right: 4px; color: var(--apa-cyan); }
.apa-scan-zoom-row input { width: 100%; accent-color: var(--apa-cyan); }
.apa-scan-zoom-row output { min-width: 28px; color: var(--apa-cyan); font-weight: 800; text-align: right; }
.apa-scan-pan-help { margin: 7px 10px 0; color: var(--apa-muted); font-size: .7rem; line-height: 1.4; }
.apa-select-button { display: inline-flex; min-height: 36px; align-items: center; justify-content: center; gap: 7px; margin: 10px 4px 0 10px; padding: 8px 11px; border: 1px solid rgba(84, 199, 244, .35); border-radius: 8px; background: rgba(84, 199, 244, .1); color: var(--apa-blue); cursor: pointer; font: inherit; font-size: .74rem; font-weight: 800; }
.apa-select-button:hover, .apa-select-button:focus-visible, .apa-select-button.is-active { border-color: var(--apa-cyan); background: rgba(117, 229, 213, .17); color: #fff; }
.apa-read-button { display: inline-flex; min-height: 36px; align-items: center; justify-content: center; gap: 7px; margin: 10px; padding: 8px 11px; border: 1px solid rgba(117, 229, 213, .35); border-radius: 8px; background: rgba(117, 229, 213, .1); color: #b8f4eb; cursor: pointer; font: inherit; font-size: .74rem; font-weight: 800; }
.apa-read-button:hover, .apa-read-button:focus-visible { border-color: var(--apa-cyan); background: rgba(117, 229, 213, .17); color: #fff; }
.apa-read-button:disabled { cursor: wait; opacity: .65; }
.apa-scan-suggestions { margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, .1); }
.apa-scan-result { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; color: var(--apa-muted); font-size: .76rem; }
.apa-scan-result strong { color: var(--apa-cyan); font-size: 1.2rem; }
.apa-scan-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.apa-scan-chips button { padding: 6px 9px; border: 1px solid rgba(148, 163, 184, .28); border-radius: 7px; background: rgba(255, 255, 255, .05); color: #cfe4ef; cursor: pointer; font: inherit; font-size: .72rem; }
.apa-scan-chips button:hover, .apa-scan-chips button:focus-visible { border-color: var(--apa-cyan); color: #fff; }
.apa-scan-form { display: grid; grid-template-columns: 1fr .7fr 1fr auto; gap: 8px; align-items: end; margin-top: 11px; }
.apa-scan-save-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 10px; }
.apa-scan-save-row > span { color: var(--apa-muted); font-size: .7rem; }
.apa-save-container-button { display: inline-flex; min-height: 35px; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid rgba(117, 229, 213, .35); border-radius: 8px; background: rgba(117, 229, 213, .08); color: #b8f4eb; cursor: pointer; font: inherit; font-size: .73rem; font-weight: 800; }
.apa-save-container-button:hover, .apa-save-container-button:focus-visible { border-color: var(--apa-cyan); background: rgba(117, 229, 213, .16); color: #fff; }
.apa-log-form { display: grid; grid-template-columns: .7fr 1fr auto; gap: 8px; align-items: end; margin-top: 17px; padding-top: 17px; border-top: 1px solid rgba(255, 255, 255, .1); }
.apa-secondary-button { min-height: 43px; background: rgba(84, 199, 244, .14); border: 1px solid rgba(84, 199, 244, .45); color: var(--apa-blue); }
.apa-container-library { margin-top: 17px; padding-top: 17px; border-top: 1px solid rgba(255, 255, 255, .1); }
.apa-container-heading { margin-bottom: 11px; }
.apa-container-heading h3 { margin: 0; color: #fff; font-size: 1rem; letter-spacing: -.025em; }
.apa-container-list { display: grid; gap: 6px; }
.apa-container-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 10px; border: 1px solid rgba(117, 229, 213, .14); border-radius: 9px; background: rgba(117, 229, 213, .045); }
.apa-container-details { display: grid; gap: 2px; min-width: 0; }
.apa-container-details strong { overflow: hidden; color: #f3fffd; font-size: .8rem; text-overflow: ellipsis; white-space: nowrap; }
.apa-container-details span { color: var(--apa-muted); font-size: .7rem; }
.apa-container-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; }
.apa-container-add { display: inline-flex; min-height: 34px; align-items: center; gap: 5px; padding: 7px 9px; border: 1px solid rgba(117, 229, 213, .4); border-radius: 7px; background: rgba(117, 229, 213, .13); color: #b8f4eb; cursor: pointer; font: inherit; font-size: .72rem; font-weight: 850; }
.apa-container-add:hover, .apa-container-add:focus-visible { border-color: var(--apa-cyan); background: rgba(117, 229, 213, .2); color: #fff; }
.apa-container-remove { padding: 4px; border: 0; background: transparent; color: var(--apa-danger); cursor: pointer; font: inherit; font-size: .7rem; }
.apa-container-remove:hover, .apa-container-remove:focus-visible { color: #fff; }
.apa-entries { display: grid; gap: 5px; margin-top: 17px; }
.apa-entry { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 8px; background: rgba(255, 255, 255, .045); color: #cfe4ef; font-size: .76rem; }
.apa-entry i { margin-right: 5px; color: var(--apa-cyan); }
.apa-entry strong { color: #fff; }
.apa-entry button { border: 0; background: transparent; color: #fb9b9b; cursor: pointer; font-size: .78rem; }
.apa-liquids-card { margin-top: 16px; }
.apa-info-icon { color: var(--apa-blue); font-size: 1.2rem; }
.apa-liquid-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 19px; }
.apa-liquid-grid p { margin: 0; padding: 14px; border-radius: 11px; background: rgba(255, 255, 255, .045); color: var(--apa-muted); font-size: .8rem; line-height: 1.55; }
.apa-liquid-grid i { margin-right: 5px; color: var(--apa-cyan); }
.apa-liquid-grid .apa-warning i { color: var(--apa-warn); }
.apa-safety-card { margin-top: 16px; border-color: rgba(251, 191, 107, .25); background: rgba(88, 62, 33, .2); }
.apa-safety-card h2 { color: #ffd18a; font-size: 1.1rem; }
.apa-safety-card h2 i { margin-right: 7px; }
.apa-safety-card p { margin: 10px 0 0; color: #d7c4a5; font-size: .78rem; line-height: 1.6; }
.apa-safety-card .apa-safety-small { color: #bda98a; font-size: .73rem; }
.apa-sources { margin: 18px 0 0; color: #718da1; font-size: .73rem; line-height: 1.6; text-align: center; }

@media (max-width: 780px) {
    .apa-main { padding-top: 88px; }
    .apa-shell { width: min(100% - 24px, 920px); }
    .apa-profile-form { grid-template-columns: repeat(2, 1fr); }
    .apa-dashboard { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    .apa-hero { gap: 13px; }
    .apa-drop-icon { flex-basis: 50px; width: 50px; height: 50px; border-radius: 15px; font-size: 1.35rem; }
    .apa-hero h1 { font-size: 2.15rem; }
    .apa-profile-form, .apa-log-form, .apa-scan-form, .apa-liquid-grid { grid-template-columns: 1fr; }
    .apa-profile-form .apa-primary-button, .apa-log-form .apa-secondary-button { width: 100%; }
    .apa-card-heading, .apa-section-heading { align-items: flex-start; flex-direction: column; }
    .apa-scan-form .apa-secondary-button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .apa-progress-track span, .apa-primary-button, .apa-secondary-button { transition: none; }
}
