/* --------------------------------------------------------------------------
   local cipher
   Cool steel paper, indigo for structure, one deny-red. Monospace throughout;
   hierarchy comes from weight and tracking, not from a second family.
   No webfonts: fetching one would breach connect-src.
   -------------------------------------------------------------------------- */

:root {
    --paper:  #e6eaee;
    --panel:  #f5f7f9;
    --ink:    #14181f;
    --muted:  #5d6b7a;
    --rule:   #a9b4c0;
    --indigo: #23268c;
    --deny:   #a31621;

    --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Berkeley Mono", Menlo,
    Consolas, "DejaVu Sans Mono", monospace;

    --gap: 1.5rem;
}

*, *::before, *::after { box-sizing: border-box; }

/* The display rules below (flex, block, inline-block) would otherwise beat
   the UA's [hidden] { display: none } and un-hide hidden elements. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--mono);
    font-size: 14px;
    line-height: 1.6;
}

code {
    font-family: inherit;
    background: rgba(35, 38, 140, 0.08);
    padding: 0 0.25em;
}

:focus-visible {
    outline: 2px solid var(--indigo);
    outline-offset: 2px;
}

/* --- instrument strip ---------------------------------------------------- */

.strip {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
    display: flex;
    justify-content: flex-end;
    padding: 0.6rem 1.5rem;
    background: var(--ink);
    color: var(--paper);
    border-top: 1px solid var(--ink);
}

.strip__group {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    min-width: 0;
}

.strip__label,
.strip__value {
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.strip__label {
    color: #7f8b99;
    font-weight: 400;
}

.strip__value {
    font-weight: 700;
    color: var(--paper);
    transition: color 140ms linear;
}

.strip__value--alarm { color: #ff6b74; }
.strip__value--ok    { color: #8fd0ff; }

/* --- page ---------------------------------------------------------------- */

.page {
    max-width: 46rem;
    margin: 0 auto;
    padding: 3rem 1.5rem 5rem;
}

.masthead { margin-bottom: 3rem; }

.masthead__title {
    margin: 0 0 0.75rem;
    font-size: clamp(1.75rem, 6vw, 2.5rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.masthead__sub {
    margin: 0;
    max-width: 40rem;
    color: var(--muted);
    font-size: 13px;
}

/* --- fields -------------------------------------------------------------- */

.field { margin-bottom: var(--gap); }

/* The label sits on a hairline that runs to the edge of the panel: a schematic
   caption, and it marks where one field's territory ends and the next begins. */
.field__head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 0.45rem;
    border-bottom: 1px solid var(--rule);
    margin-bottom: 0.6rem;
}

.field__label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.field__meta {
    flex: 1;
    font-size: 11px;
    letter-spacing: 0.1em;
    color: var(--muted);
    text-transform: uppercase;
}

.field__area {
    display: block;
    width: 100%;
    padding: 0.85rem 1rem;
    background: var(--panel);
    color: var(--ink);
    border: 1px solid var(--rule);
    border-radius: 2px;
    font-family: var(--mono);
    font-size: 13px;
    line-height: 1.65;
    resize: vertical;
    transition: border-color 140ms linear, background-color 240ms linear;
}

.field__area::placeholder { color: #97a3b0; }

.field__area:focus { border-color: var(--indigo); }

.field__area--out {
    color: var(--indigo);
    word-break: break-all;
}

.field__area--key { color: var(--deny); }

/* Brief latch when a fresh value lands, so it is obvious which panels changed. */
.field__area--latched { background: #e4e9ff; }

.field__file {
    display: block;
    width: 100%;
    padding: 0.6rem 1rem;
    background: var(--panel);
    color: var(--muted);
    border: 1px solid var(--rule);
    border-radius: 2px;
    font-family: var(--mono);
    font-size: 12px;
}

.field__file::file-selector-button {
    margin-right: 1rem;
    padding: 0.35rem 0.9rem;
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--ink);
    border-radius: 2px;
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
}

.field__input {
    display: block;
    width: 100%;
    padding: 0.85rem 1rem;
    background: var(--panel);
    color: var(--ink);
    border: 1px solid var(--rule);
    border-radius: 2px;
    font-family: var(--mono);
    font-size: 13px;
    line-height: 1.65;
    transition: border-color 140ms linear;
}

.field__input:focus { border-color: var(--indigo); }

/* --- file mode + progress ------------------------------------------------ */

.mode {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.6rem;
}

.mode__option {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    cursor: pointer;
}

.mode__option input { accent-color: var(--indigo); }

.progress {
    display: block;
    width: 100%;
    height: 0.85rem;
    margin-top: 0.75rem;
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid var(--rule);
    border-radius: 2px;
    background: var(--panel);
    accent-color: var(--indigo);
}

.progress::-webkit-progress-bar { background: var(--panel); }
.progress::-webkit-progress-value { background: var(--indigo); }
.progress::-moz-progress-bar { background: var(--indigo); }

.field__note {
    margin: 0.5rem 0 0;
    font-size: 11px;
    line-height: 1.5;
    color: var(--muted);
}

/* --- controls ------------------------------------------------------------ */

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 2rem 0;
}

.button {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    text-align: center;
    text-decoration: none;
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--ink);
    border-radius: 2px;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color 120ms linear, color 120ms linear;
}

.button:hover:not(:disabled) {
    background: var(--ink);
    color: var(--paper);
}

.button--primary {
    background: var(--indigo);
    border-color: var(--indigo);
    color: var(--paper);
}

.button--primary:hover:not(:disabled) {
    background: var(--ink);
    border-color: var(--ink);
}

.button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.button--ghost {
    padding: 0.25rem 0.6rem;
    border-color: var(--rule);
    color: var(--muted);
    font-size: 10px;
    letter-spacing: 0.12em;
}

/* --- alert --------------------------------------------------------------- */

.alert {
    margin: 0 0 var(--gap);
    padding: 0.7rem 1rem;
    background: var(--panel);
    border: 1px solid var(--deny);
    border-left-width: 3px;
    border-radius: 2px;
    color: var(--deny);
    font-size: 12px;
}

.alert[hidden] { display: none; }

/* --- crumbs -------------------------------------------------------------- */

.crumbs {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.crumbs__link {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    text-decoration: none;
    border-bottom: 1px solid var(--rule);
    padding-bottom: 0.1rem;
    transition: color 120ms linear, border-color 120ms linear;
}

.crumbs__link:hover {
    color: var(--indigo);
    border-color: var(--indigo);
}

/* --- cards --------------------------------------------------------------- */

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
    gap: var(--gap);
}

.card {
    display: block;
    padding: 1.25rem 1.5rem;
    background: var(--panel);
    border: 1px solid var(--rule);
    border-radius: 2px;
    text-decoration: none;
    color: var(--ink);
    transition: border-color 120ms linear;
}

.card:hover { border-color: var(--indigo); }

.card__title {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--indigo);
}

.card__sub {
    display: block;
    font-size: 12px;
    line-height: 1.5;
    color: var(--muted);
}

/* --- responsive ---------------------------------------------------------- */

@media (max-width: 40rem) {
    .strip { padding: 0.55rem 1rem; }
    .page { padding: 2rem 1rem 4rem; }
    .actions .button { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}
