:root {
    --bg: #2c2c2c;
    --ink: #e4e4e4;
    --muted: #bcbcbc;
    --accent: #a8dadc;
    --accent-2: #ffc1cc;
    --card: #353535;
    --border: #444444;
}
* {
    box-sizing: border-box;
}
body {
    margin: 0;
    font-family: "Avenir Next", "Avenir", "Futura", "Trebuchet MS", sans-serif;
    color: var(--ink);
    background: var(--bg);
    padding-left: calc((100vw - 100%) / 2);
    padding-right: calc((100vw - 100%) / 2);
}
header {
    padding: 28px 24px 8px;
    text-align: center;
}
h1 {
    margin: 0 0 6px;
    font-size: 24px;
    letter-spacing: 0.4px;
}
p.sub {
    margin: 0;
    color: var(--muted);
}
main {
    padding: 16px 24px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}
main > * {
    width: min(600px, 100%);
}
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.35);
}
.app-card {
    height: auto;
    display: flex;
    flex-direction: column;
}
.form-body {
    flex: 1;
    overflow: visible;
    padding-right: 4px;
}
.form-footer {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 16px;
}
.advanced-controls {
    margin-top: 16px;
}
#advancedControls > div {
    margin-bottom: 22px;
}
#advancedControls > div:last-child {
    margin-bottom: 0;
}
#advancedControls .grid {
    margin-bottom: 14px;
}
.form-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}
.grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.grid.two-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (max-width: 640px) {
    .grid.two-col {
        grid-template-columns: 1fr;
    }
}
label {
    display: block;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
    margin-bottom: 6px;
}
.slider-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 6px;
}
.slider-row input[type="range"] {
    flex: 1;
}
.slider-row > div {
    min-width: 28px;
    text-align: right;
}
input[type="text"],
input[type="number"],
input[type="range"],
select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-size: 14px;
}
.check-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.segmented {
    display: inline-flex;
    width: 100%;
    background: #2f2f2f;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    height: 36px;
    align-items: stretch;
}
.segmented button {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--muted);
    padding: 0 10px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}
.contour-icons .lucide {
    width: 16px;
    height: 16px;
    stroke-width: 1.8;
}
.segmented button + button {
    border-left: 1px solid var(--border);
}
.segmented button.active {
    background: #464646;
    color: var(--ink);
}
.segmented button:disabled {
    color: #6e6e6e;
    cursor: default;
}
.segmented button.static {
    background: #464646;
    color: var(--ink);
}
.segmented.toggle {
    gap: 0;
}
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}
.subcontrol {
    margin-top: 12px;
}
.check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}
.section-title {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--accent);
    margin: 0 0 10px;
}
.note {
    font-size: 12px;
    color: var(--muted);
    margin-top: 8px;
}
.profile-shell {
    position: fixed;
    top: max(14px, env(safe-area-inset-top));
    right: max(14px, env(safe-area-inset-right));
    z-index: 1200;
}
.profile-button {
    width: 42px;
    height: 42px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #3a3a3a;
    color: var(--ink);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.35);
}
.profile-button:hover {
    background: #474747;
}
.profile-button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.profile-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: min(280px, calc(100vw - 28px));
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--card);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
    padding: 12px;
}
.profile-row {
    margin: 0;
    font-size: 12px;
    color: var(--muted);
    line-height: 1.4;
    word-break: break-word;
}
.profile-link {
    display: inline-block;
    margin-top: 10px;
    font-size: 13px;
}
.profile-form {
    margin-top: 12px;
}
.profile-logout {
    width: 100%;
}
.data-sources {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
    text-align: center;
}
.data-source-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    align-items: center;
}
.data-sources-label {
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 10px;
    display: block;
    margin-bottom: 2px;
}
.data-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #2f2f2f;
    color: var(--muted);
    text-decoration: none;
    font-size: 12px;
    line-height: 1;
}
.data-pill:hover {
    color: #fff;
    background: #3a3a3a;
}
.inline-note {
    font-size: 12px;
    color: var(--muted);
    margin-top: 6px;
}
.btn {
    background: #b39cd0;
    color: #fff;
    border: none;
    padding: 12px 18px;
    font-size: 14px;
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn:visited {
    color: #fff;
}
.btn.secondary {
    background: #3a3a3a;
}
.footer {
    color: var(--muted);
    font-size: 12px;
}
.status {
    margin: 0;
    padding: 10px 12px;
    border-radius: 8px;
    background: #2f2f2f;
    color: var(--muted);
    font-size: 13px;
}
.status.success {
    color: #b8f2c9;
    background: #203328;
}
.status.error {
    color: #ffd4d4;
    background: #3b1f1f;
}
.recent-job-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.recent-job-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid #4a4a4a;
    border-radius: 10px;
    padding: 10px 12px;
    background: rgba(20, 20, 20, 0.16);
}
.recent-job-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
}
.recent-job-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}
.recent-job-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid #575757;
    background: #3e3e3e;
    color: #ececec;
    padding: 6px 12px;
    font-size: 12px;
    line-height: 1;
    text-decoration: none;
}
.recent-job-pill:visited {
    color: #ececec;
}
.recent-job-pill:hover {
    background: #525252;
    border-color: #6e6e6e;
    color: #ffffff;
}
@media (max-width: 640px) {
    .recent-job-row {
        align-items: flex-start;
        flex-direction: column;
    }
    .recent-job-actions {
        justify-content: flex-start;
        width: 100%;
    }
}
a {
    color: #b39cd0;
    text-decoration: none;
}
a:visited {
    color: #b39cd0;
}

.hidden {
    display: none;
}
#parcelAlert {
    min-height: 40px;
}
#parcelAlert.hidden {
    display: block;
    visibility: hidden;
}
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: #3f3f3f;
    outline: none;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #b39cd0;
    border: none;
}
input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #b39cd0;
    border: none;
}
select {
    appearance: none;
}
.hidden {
    display: none;
}
.locked {
    opacity: 0.4;
}
.locked input,
.locked select,
.locked textarea,
.locked button {
    pointer-events: none;
}
body.modal-open {
    overflow: hidden;
}
.preview-modal {
    position: fixed;
    inset: 0;
    z-index: 1400;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.preview-modal.hidden {
    display: none;
}
.preview-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
}
.preview-modal-dialog {
    position: relative;
    z-index: 1;
    width: min(920px, 100vw);
    height: min(640px, 100vh);
    border: 1px solid rgba(228, 228, 228, 0.02);
    border-radius: 12px;
    background: transparent;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow:
        0 0 0 1px rgba(228, 228, 228, 0.015),
        0 10px 20px rgba(0, 0, 0, 0.22);
}
.preview-modal-dialog::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    pointer-events: none;
    background: linear-gradient(
        135deg,
        rgba(179, 156, 208, 0.12),
        rgba(168, 218, 220, 0.08)
    );
    -webkit-mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
}
.preview-modal-frame {
    flex: 1;
    display: block;
    width: 100%;
    border: 0;
    background: transparent;
}
@media (max-width: 640px) {
    .profile-shell {
        top: max(10px, env(safe-area-inset-top));
        right: max(10px, env(safe-area-inset-right));
    }
    .preview-modal-dialog {
        width: 100vw;
        height: 100vh;
        border-radius: 10px;
    }
}
