:root {
    color-scheme: dark;
    --ink: #080b0a;
    --panel: #121714;
    --paper: #eee6cf;
    --muted: #9d9787;
    --brass: #d0b979;
    --line: rgba(185, 160, 99, .28);
    --danger: #e29a8f;
}

* { box-sizing: border-box; }
body {
    min-height: 100vh;
    margin: 0;
    display: grid;
    place-items: center;
    padding: 2rem 1rem;
    color: var(--paper);
    background: radial-gradient(circle at 50% 0, #26352f, var(--ink) 42rem);
    font-family: Inter, system-ui, sans-serif;
}
.shell { width: min(520px, 100%); }
.brand {
    display: block;
    margin-bottom: 1.5rem;
    color: var(--brass);
    text-align: center;
    text-decoration: none;
    font-family: Georgia, serif;
    font-size: 1.35rem;
    letter-spacing: .18em;
}
.card {
    padding: clamp(1.5rem, 5vw, 2.5rem);
    border: 1px solid var(--line);
    background: rgba(18, 23, 20, .94);
    box-shadow: 0 24px 70px rgba(0, 0, 0, .45);
}
h1 { margin: 0 0 .5rem; font-family: Georgia, serif; font-weight: 500; }
h2 { margin: 0; font-family: Georgia, serif; font-weight: 500; }
hr { margin: 2rem 0; border: 0; border-top: 1px solid var(--line); }
.lede, .meta { color: var(--muted); }
form { display: grid; gap: 1.1rem; margin-top: 1.75rem; }
label { display: grid; gap: .45rem; font-size: .88rem; }
input, textarea {
    width: 100%;
    padding: .85rem .95rem;
    border: 1px solid var(--line);
    border-radius: 2px;
    color: var(--paper);
    background: #0b0f0d;
    font: inherit;
}
textarea { resize: vertical; }
input:focus, textarea:focus { outline: 2px solid var(--brass); outline-offset: 1px; }
button, .button {
    padding: .9rem 1.1rem;
    border: 1px solid var(--brass);
    color: #0b0f0d;
    background: var(--brass);
    font: 600 .85rem/1 Inter, system-ui, sans-serif;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}
.secondary { color: var(--paper); background: transparent; }
.actions { display: flex; gap: .75rem; align-items: center; margin-top: 1rem; }
.actions > * { flex: 1; }
.actions form { display: block; margin: 0; }
.actions .button,
.actions button { display: block; width: 100%; }
.field-error { color: var(--danger); font-size: .8rem; }
.notice { padding: .8rem; border: 1px solid var(--line); color: var(--brass); background: rgba(208,185,121,.07); }
.footer { margin-top: 1.25rem; color: var(--muted); text-align: center; font-size: .9rem; }
.footer a { color: var(--brass); }
.launcher-resume {
    display: block;
    margin-top: 1.75rem;
    box-shadow: 0 0 0 rgba(208, 185, 121, 0);
    animation: launcher-button-glow 1.5s ease-in-out infinite;
}
@keyframes launcher-button-glow {
    0%, 100% { box-shadow: 0 0 6px rgba(208, 185, 121, .3); }
    50% { box-shadow: 0 0 22px rgba(208, 185, 121, .9), 0 0 42px rgba(208, 185, 121, .35); }
}
@media (prefers-reduced-motion: reduce) {
    .launcher-resume { animation: none; box-shadow: 0 0 14px rgba(208, 185, 121, .65); }
}
.identity { padding: 1rem; border: 1px solid var(--line); background: #0b0f0d; }
.identity strong { display: block; }
.identity span { color: var(--muted); font-size: .85rem; }
.session-list { display: grid; gap: .75rem; margin: 1rem 0; }
.session {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--line);
    background: #0b0f0d;
}
.session > div { display: grid; gap: .2rem; }
.session small { color: var(--muted); }
.session form { display: block; margin: 0; }
.session .compact { width: auto; padding: .65rem .8rem; }
.current-session { color: var(--brass); font-size: .75rem; }
.audit-list { display: grid; margin-top: 1rem; border-top: 1px solid var(--line); }
.audit-event {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: .9rem 0;
    border-bottom: 1px solid var(--line);
}
.audit-event > div { display: grid; gap: .15rem; }
.audit-event small { color: var(--muted); }
.audit-client { text-align: right; }
.wide { width: min(1100px, 100%); }
.panel-heading { display: flex; justify-content: space-between; align-items: start; gap: 1rem; }
.compact-link { flex: 0 0 auto; min-width: 0; }
.heading-actions { display: flex; gap: .75rem; align-items: center; }
.search-form { grid-template-columns: 1fr auto; align-items: end; }
.table-wrap { margin-top: 1.5rem; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .75rem; border-bottom: 1px solid var(--line); text-align: left; }
th { color: var(--muted); font-size: .75rem; text-transform: uppercase; }
td a { color: var(--brass); }
.order-form { display: block; margin-top: 0; }
.order-actions { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 1rem; }
.order-actions button { flex: 0 0 auto; }
.order-actions button:disabled { cursor: default; opacity: .45; }
.mod-order-row { transition: background-color .12s ease, opacity .12s ease; }
.mod-order-row.dragging { opacity: .45; }
.mod-order-row.drag-target { background: rgba(208, 185, 121, .1); }
.drag-handle { min-width: 2.25rem; padding: .55rem .65rem; cursor: grab; color: var(--brass); background: transparent; }
.drag-handle:active { cursor: grabbing; }
.detail-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; margin: 1.5rem 0; }
.detail-grid > div { display: grid; padding: 1rem; border: 1px solid var(--line); background: #0b0f0d; }
.detail-grid small { color: var(--muted); }
.staff-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.staff-actions form { align-content: start; padding: 1rem; border: 1px solid var(--line); }
select { padding: .85rem .95rem; border: 1px solid var(--line); color: var(--paper); background: #0b0f0d; font: inherit; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.checkbox-label { display: flex; align-items: center; align-self: end; min-height: 3rem; }
.checkbox-label input { width: auto; }
.toggle-field { grid-template-columns: auto auto 1fr; align-items: center; align-self: end; min-height: 3rem; cursor: pointer; }
.toggle-field input[type="checkbox"] { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.toggle-control { position: relative; width: 2.75rem; height: 1.45rem; border: 1px solid var(--line); border-radius: 999px; background: #0b0f0d; transition: .15s; }
.toggle-control::after { position: absolute; top: .2rem; left: .2rem; width: .95rem; height: .95rem; border-radius: 50%; background: var(--muted); content: ""; transition: .15s; }
.toggle-field input[type="checkbox"]:checked ~ .toggle-control { border-color: var(--brass); background: rgba(208,185,121,.15); }
.toggle-field input[type="checkbox"]:checked ~ .toggle-control::after { transform: translateX(1.25rem); background: var(--brass); }
.toggle-field input[type="checkbox"]:focus-visible ~ .toggle-control { outline: 2px solid var(--brass); outline-offset: 2px; }
.toggle-field strong, .toggle-field small, .table-credit { display: block; }
.toggle-field small, .table-credit { margin-top: .2rem; color: var(--muted); }
.lookup-row { display: flex; align-items: center; gap: .8rem; }
.manifest-form .compact-button { padding: .65rem .8rem; }
.manifest-form .compact-button:disabled { cursor: wait; opacity: .6; }
.lookup-success { color: var(--brass); }
.choice-badge { display: inline-block; padding: .25rem .45rem; border: 1px solid currentColor; border-radius: 999px; font-size: .65rem; font-weight: 700; }
.choice-badge.optional { color: var(--brass); }
.choice-badge.required { color: var(--muted); }
.dependency-picker { border: 1px solid var(--line); background: #0b0f0d; }
.dependency-picker summary { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem .95rem; cursor: pointer; }
.dependency-picker summary::marker { color: var(--brass); }
.dependency-picker summary small { color: var(--muted); }
.dependency-options { display: grid; max-height: 18rem; overflow-y: auto; border-top: 1px solid var(--line); }
.dependency-option { display: grid; grid-template-columns: auto 1fr; align-items: center; padding: .75rem .95rem; border-bottom: 1px solid rgba(185, 160, 99, .14); cursor: pointer; }
.dependency-option:last-child { border-bottom: 0; }
.dependency-option:hover { background: rgba(208,185,121,.05); }
.dependency-option input { width: auto; }
.dependency-option strong, .dependency-option small { display: block; }
.dependency-option small { margin-top: .18rem; color: var(--muted); }
.manifest-form { gap: 0; margin-top: 0; }
.manifest-form input, .manifest-form textarea, .manifest-form select { border-radius: 4px; }
.manifest-form select { width: 100%; }
.manifest-section { display: grid; gap: 1rem; padding: 1.65rem 0; border-top: 1px solid var(--line); }
.manifest-form > .manifest-section:first-of-type { padding-top: 0; border-top: 0; }
.manifest-section-heading { display: grid; gap: .3rem; }
.manifest-section-heading h2 { margin: 0; color: var(--paper); font-size: 1.2rem; }
.manifest-section-heading p { margin: 0; line-height: 1.5; }
.launcher-options { display: grid; gap: .8rem; margin-top: .25rem; }
.launcher-option, .optional-settings { padding: 1rem; border: 1px solid var(--line); border-radius: 5px; background: #0b0f0d; }
.publish-option { min-height: 4rem; }
.optional-settings { display: grid; gap: .8rem; }
.optional-settings-heading { display: grid; gap: .2rem; padding-bottom: .8rem; border-bottom: 1px solid rgba(185, 160, 99, .16); }
.optional-settings-heading strong { font-size: .88rem; }
.optional-settings-heading small { color: var(--muted); font-size: .78rem; }
.optional-settings .toggle-field { min-height: 2.7rem; }
.optional-default-setting { padding-top: .8rem; border-top: 1px solid rgba(185, 160, 99, .16); }
.optional-default-setting.is-disabled { opacity: .48; cursor: not-allowed; }
.lookup-row { flex-wrap: wrap; }
.empty-state { margin: 0; padding: 1rem; border: 1px dashed var(--line); border-radius: 4px; background: rgba(11, 15, 13, .45); }
.validation-errors:empty { display: none; }
.validation-errors { display: grid; gap: .35rem; }
.manifest-actions { display: flex; justify-content: flex-end; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.manifest-actions button { min-width: 9rem; }
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; margin-top: 2rem; padding: 1.15rem; border: 1px solid rgba(226, 154, 143, .45); border-radius: 5px; background: rgba(113, 51, 45, .12); }
.danger-zone h2 { color: var(--danger); font-size: 1.05rem; }
.danger-zone p { margin: .35rem 0 0; }
.danger-zone form { margin: 0; }
.manifest-form button { justify-self: start; }
code { color: var(--paper); }
.danger { border-color: var(--danger); color: var(--paper); background: #71332d; }
.error-notice { color: var(--danger); }
.legal-page { display: block; }
.legal-shell { width: min(960px, 100%); margin: 0 auto; }
.legal-card { padding: clamp(1.25rem, 4vw, 2.5rem); }
.legal-heading { display: flex; justify-content: space-between; gap: 2rem; align-items: start; }
.legal-heading h1 { max-width: 34rem; }
.legal-kicker { margin: 0 0 .45rem; color: var(--brass); font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.legal-meta { flex: 0 0 auto; margin: 0; padding: .8rem 1rem; border: 1px solid var(--line); background: #0b0f0d; }
.legal-meta div { display: grid; grid-template-columns: 4.5rem 1fr; gap: .75rem; }
.legal-meta div + div { margin-top: .35rem; }
.legal-meta dt { color: var(--muted); }
.legal-meta dd { margin: 0; }
.legal-document { max-height: 55vh; margin-top: 1.5rem; padding: clamp(1rem, 3vw, 2rem); overflow-y: auto; border: 1px solid var(--line); background: #0b0f0d; line-height: 1.65; }
.legal-document:focus { outline: 2px solid var(--brass); outline-offset: 2px; }
.legal-document section + section { margin-top: 2rem; padding-top: 2rem; border-top: 1px solid var(--line); }
.legal-document h2 { color: var(--brass); font-size: 1.08rem; }
.legal-document p { margin: .8rem 0 0; }
.legal-document section:nth-of-type(9) p,
.legal-document section:nth-of-type(10) p { letter-spacing: .01em; }
.legal-acceptance { gap: .75rem; margin-top: 1.25rem; }
.legal-confirmation { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: .75rem; padding: .8rem; border: 1px solid var(--line); background: rgba(208,185,121,.035); line-height: 1.45; cursor: pointer; }
.legal-confirmation input { width: 1.05rem; height: 1.05rem; margin-top: .15rem; accent-color: var(--brass); }
.piracy-confirmation { border-color: rgba(226,154,143,.55); background: rgba(113,51,45,.1); }
.legal-decline { margin: .2rem 0 0; color: var(--muted); text-align: center; font-size: .85rem; }
.legal-decline a, .legal-public-footer a { color: var(--brass); }
.legal-public-footer { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1.25rem; color: var(--muted); font-size: .88rem; }
@media (max-width: 720px) {
    .detail-grid, .staff-actions, .form-grid { grid-template-columns: 1fr; }
    .panel-heading, .audit-event { align-items: stretch; flex-direction: column; }
    .heading-actions { align-items: stretch; flex-direction: column; }
    .order-actions { align-items: stretch; flex-direction: column; }
    .manifest-actions { justify-content: stretch; }
    .manifest-actions button { width: 100%; }
    .danger-zone { align-items: stretch; flex-direction: column; }
    .danger-zone button { width: 100%; }
    .audit-client { text-align: left; }
    .legal-heading, .legal-public-footer { flex-direction: column; }
    .legal-meta { width: 100%; }
    .legal-document { max-height: 50vh; }
}
