/* Management console: dedicated edit surface shared by service records and
   authority registries. Reuses amendment-* tokens from pages.css; adds the
   sectioned/accordion layout and the unlock gate. */

.manage-hero {
    align-items: start;
    gap: clamp(28px, 4vw, 60px);
}

.manage-retrieve-hero {
    grid-template-columns: minmax(0, 0.92fr) minmax(320px, 0.72fr);
    align-items: center;
}
.manage-retrieve-stack {
    display: grid;
    gap: clamp(16px, 2vw, 22px);
    align-self: start;
}
.manage-retrieve-image {
    aspect-ratio: 1 / 1;
    min-height: 0;
    width: 100%;
}
.manage-retrieve-image img {
    object-position: center;
}

.manage-gate {
    border: 1px solid var(--line);
    border-radius: 3px;
    padding: clamp(20px, 3vw, 32px);
    background:
        linear-gradient(120deg, rgba(184, 155, 94, 0.12), rgba(9, 8, 7, 0) 55%),
        var(--panel-dark);
    color: var(--cream);
}
.manage-gate.is-dismissed {
    opacity: 0.7;
}
.manage-gate h3 {
    margin: 6px 0 10px;
}
.manage-gate .section-lede {
    color: var(--panel-muted);
    margin: 0 0 18px;
}
.manage-gate .record-seal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.manage-gate .record-seal-status {
    min-height: 1.2em;
    margin: 14px 0 0;
    color: var(--gold);
    font-size: 0.9rem;
}
.manage-retrieve-methods {
    display: grid;
    gap: 18px;
}
.manage-retrieve-method {
    display: grid;
    gap: 10px;
    border-top: 1px solid rgba(184, 155, 94, 0.35);
    padding-top: 16px;
}
.manage-retrieve-method:first-child {
    border-top: 0;
    padding-top: 0;
}
.manage-retrieve-method p:not(.record-seal-method-label) {
    margin: 0;
    color: var(--panel-muted);
    font-size: 0.92rem;
}
.record-seal-method-label {
    margin: 0;
    color: var(--gold);
    font: 900 0.66rem/1.3 "Segoe UI", Inter, Arial, sans-serif;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}
.manage-gate .official-command {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 11px 18px;
    border: 1px solid var(--gold);
    border-radius: 3px;
    background: var(--red);
    color: var(--cream);
    font: 900 0.72rem/1 "Segoe UI", Inter, Arial, sans-serif;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
}
.manage-gate .official-command.ghost {
    background: transparent;
    color: var(--gold);
}
.manage-gate .official-command:hover {
    background: var(--gold);
    color: var(--ink);
}
.manage-gate .official-command:disabled {
    opacity: 0.52;
    cursor: not-allowed;
}
.manage-gate [hidden] {
    display: none;
}

/* Correspondence seal form (email + seal word) inside the gate panel. */
.record-seal-correspondence {
    display: grid;
    gap: 14px;
    margin: 16px 0 0;
    padding-top: 16px;
    border-top: 1px solid rgba(184, 155, 94, 0.35);
}
.manage-correspondence-retrieve {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}
.record-seal-correspondence-lede {
    margin: 0;
    color: var(--panel-muted);
    font-size: 0.92rem;
}
.record-seal-field {
    display: grid;
    gap: 7px;
}
.record-seal-field span {
    color: var(--gold);
    font: 900 0.66rem/1.3 "Segoe UI", Inter, Arial, sans-serif;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}
.record-seal-field em {
    margin-left: 6px;
    color: var(--panel-muted);
    font-style: normal;
    font-weight: 700;
    letter-spacing: 0.08em;
}
.record-seal-field input {
    width: 100%;
    box-sizing: border-box;
    min-height: 44px;
    padding: 11px 13px;
    border: 1px solid rgba(184, 155, 94, 0.45);
    border-radius: 3px;
    background: rgba(9, 8, 7, 0.6);
    color: var(--cream);
    font-family: inherit;
    font-size: 0.95rem;
}
.record-seal-field input:focus {
    border-color: var(--gold);
}
.record-seal-field input:focus:not(:focus-visible) {
    outline: none;
}
.record-seal-correspondence .official-command {
    justify-self: start;
}

/* Correspondence address deposited as backup beside the device seal: a single
   quiet line under the gate actions, no extra tab or panel. */
.record-seal-deposit {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid rgba(184, 155, 94, 0.35);
}
.record-seal-deposit-line {
    margin: 0 0 10px;
    color: var(--panel-muted);
    font-size: 0.9rem;
}
.record-seal-deposit[hidden] {
    display: none;
}
.security-ledger {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
.security-seal-card {
    display: grid;
    gap: 12px;
    align-content: start;
    min-width: 0;
    border-top: 1px solid rgba(184, 155, 94, 0.35);
    padding-top: 16px;
}
.security-seal-card p:not(.record-seal-method-label) {
    margin: 0;
    color: var(--panel-muted);
    font-size: 0.92rem;
}
.security-contact-form {
    display: grid;
    gap: 12px;
}
.security-seal-card .official-command {
    justify-self: start;
}
.security-seal-card-danger {
    border-top-color: rgba(168, 70, 70, 0.55);
}
.security-visibility-toggle {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    justify-self: start;
    position: relative;
}
.security-visibility-toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.security-visibility-slider {
    flex: 0 0 auto;
    width: 44px;
    height: 24px;
    border: 1px solid rgba(184, 155, 94, 0.55);
    border-radius: 999px;
    background: rgba(20, 17, 12, 0.6);
    position: relative;
    transition: background 160ms ease, border-color 160ms ease;
}
.security-visibility-slider::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--panel-muted);
    transition: transform 160ms ease, background 160ms ease;
}
.security-visibility-toggle input:checked + .security-visibility-slider {
    background: var(--gold-soft);
    border-color: var(--gold);
}
.security-visibility-toggle input:checked + .security-visibility-slider::after {
    transform: translateX(20px);
    background: var(--gold);
}
.security-visibility-toggle input:focus-visible + .security-visibility-slider {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}
.security-visibility-toggle input:disabled + .security-visibility-slider {
    opacity: 0.5;
}
.security-visibility-state {
    font: 900 0.72rem/1.35 "Segoe UI", Inter, Arial, sans-serif;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--gold);
}
@media (max-width: 560px) {
    .manage-gate .record-seal-actions .official-command,
    .record-seal-deposit .official-command,
    .security-seal-card .official-command {
        width: 100%;
    }
    .record-seal-correspondence .official-command {
        justify-self: stretch;
    }
}
@media (max-width: 780px) {
    .security-ledger {
        grid-template-columns: 1fr;
    }
}

.manage-public-reference {
    margin: 16px 0 0;
}
.manage-public-reference a {
    color: var(--gold);
    font: 900 0.72rem/1.35 "Segoe UI", Inter, Arial, sans-serif;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-decoration: none;
}
.manage-public-reference a:hover,
.manage-public-reference a:focus-visible {
    color: var(--cream);
    text-decoration: underline;
    text-underline-offset: 4px;
}
#amendment-console {
    scroll-margin-top: 96px;
}

/* Tabbed editor */
.manage-console .amendment-status {
    margin-bottom: 16px;
}
.manage-tabs {
    counter-reset: manage-tab;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 0 0 24px;
    border: 1px solid var(--gold-soft);
    border-radius: 3px;
    background:
        linear-gradient(180deg, rgba(184, 155, 94, 0.06), rgba(9, 8, 7, 0)),
        rgba(9, 8, 7, 0.28);
    overflow: hidden;
}
.manage-tab {
    counter-increment: manage-tab;
    appearance: none;
    position: relative;
    display: grid;
    align-content: center;
    justify-items: start;
    gap: 4px;
    min-height: 58px;
    border: 0;
    border-right: 1px solid rgba(184, 155, 94, 0.2);
    border-radius: 0;
    padding: 10px 14px 10px 16px;
    background: transparent;
    color: var(--panel-muted);
    font: 900 0.68rem/1.15 "Segoe UI", Inter, Arial, sans-serif;
    letter-spacing: 0.11em;
    text-align: left;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color 0.16s ease, color 0.16s ease;
}
.manage-tab:last-child {
    border-right: 0;
}
.manage-tab::before {
    content: counter(manage-tab, decimal-leading-zero);
    color: var(--gold);
    font-size: 0.58rem;
    letter-spacing: 0.14em;
    opacity: 0.7;
}
.manage-tab::after {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 2px;
    background: transparent;
}
.manage-tab:hover {
    background: rgba(184, 155, 94, 0.09);
    color: var(--cream);
}
.manage-tab.is-active {
    color: var(--cream);
    background: rgba(184, 155, 94, 0.13);
}
.manage-tab.is-active::before {
    opacity: 1;
}
.manage-tab.is-active::after {
    background: var(--gold);
}
.manage-tab:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: -3px;
}

.manage-panel {
    display: grid;
    gap: 20px;
    animation: manage-fade 0.18s ease-out;
}
.manage-panel[hidden] {
    display: none;
}
@keyframes manage-fade {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: none; }
}
.manage-panel-head {
    border-left: 2px solid var(--gold);
    padding-left: 14px;
}
.manage-panel-head h3 {
    margin: 0 0 4px;
    color: var(--cream);
    font-size: 1.15rem;
}
.manage-panel-head p {
    margin: 0;
    color: var(--panel-muted);
    font-size: 0.92rem;
}

/* Save form inside its tab panel */
.manage-form {
    max-width: none;
    margin: 0;
}
.manage-subsection {
    border-top: 1px solid var(--gold-soft);
    padding-top: 18px;
    display: grid;
    gap: 14px;
}
.manage-form .amendment-actions {
    margin-top: 4px;
    border-top: 1px solid var(--gold-soft);
    padding-top: 18px;
}

.manage-feed-preview {
    margin-bottom: 4px;
}

@media (max-width: 1120px) {
    .manage-hero,
    .manage-retrieve-hero {
        grid-template-columns: 1fr;
    }
    .manage-hero:not(.manage-retrieve-hero) .manage-gate {
        order: -1;
    }
    .manage-retrieve-stack {
        justify-self: stretch;
    }
    .manage-retrieve-hero .manage-retrieve-image {
        min-height: 0;
    }
}
@media (max-width: 560px) {
    .manage-tabs {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .manage-tab {
        min-height: 62px;
        padding: 10px 12px;
    }
    .manage-tab:nth-child(2n) {
        border-right: 0;
    }
    .manage-tab:nth-child(-n + 2) {
        border-bottom: 1px solid rgba(184, 155, 94, 0.2);
    }
}
