:root {
    --bg: #111316;
    --panel: rgba(18, 21, 24, 0.84);
    --panel-soft: rgba(29, 33, 38, 0.82);
    --line: rgba(214, 196, 167, 0.18);
    --line-strong: rgba(214, 196, 167, 0.36);
    --text: #f1ece1;
    --muted: #b7aea1;
    --accent: #d6b67e;
    --signal: #7ea6d6;
    --shadow: 0 24px 60px rgba(0, 0, 0, 0.36);
    --danger-bg: rgba(118, 34, 34, 0.28);
    --danger-line: rgba(208, 115, 115, 0.42);
    --danger-text: #ffd4d4;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    min-height: 100vh;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--text);
    background:
        linear-gradient(180deg, rgba(214, 182, 126, 0.05), transparent 18%),
        linear-gradient(90deg, rgba(126, 166, 214, 0.08), transparent 32%),
        repeating-linear-gradient(
            90deg,
            rgba(255, 255, 255, 0.018) 0,
            rgba(255, 255, 255, 0.018) 1px,
            transparent 1px,
            transparent 96px
        ),
        linear-gradient(180deg, #16191d 0%, #101214 100%);
}

body.admin-login {
    background:
        radial-gradient(circle at top left, rgba(214, 182, 126, 0.08), transparent 22%),
        repeating-linear-gradient(
            0deg,
            rgba(255, 255, 255, 0.018) 0,
            rgba(255, 255, 255, 0.018) 1px,
            transparent 1px,
            transparent 88px
        ),
        linear-gradient(180deg, #171a1e 0%, #101214 100%);
}

body.admin-dashboard {
    background:
        linear-gradient(180deg, rgba(214, 182, 126, 0.05), transparent 16%),
        repeating-linear-gradient(
            90deg,
            rgba(255, 255, 255, 0.014) 0,
            rgba(255, 255, 255, 0.014) 1px,
            transparent 1px,
            transparent 92px
        ),
        linear-gradient(180deg, #171a1d 0%, #0f1113 100%);
}

a {
    color: var(--text);
}

h1,
h2,
h3,
h4,
h5 {
    margin: 0;
    max-width: none;
}

h1 {
    font-size: clamp(42px, 5vw, 72px);
    line-height: 0.96;
}

h2 {
    font-size: clamp(32px, 3.8vw, 56px);
    line-height: 1.02;
}

h3 {
    font-size: clamp(26px, 3vw, 42px);
    line-height: 1.08;
}

h4 {
    font-size: clamp(22px, 2.2vw, 32px);
    line-height: 1.14;
}

h5 {
    font-size: clamp(18px, 1.6vw, 24px);
    line-height: 1.22;
}

.page-shell {
    width: min(1200px, calc(100% - 40px));
    margin: 0 auto;
}

.page-shell-wide {
    width: min(1240px, calc(100% - 40px));
    margin: 0 auto;
}

.eyebrow {
    color: var(--accent);
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.lead {
    color: var(--muted);
    font-size: 16px;
    line-height: 1.7;
}

.panel {
    border: 1px solid var(--line);
    background: var(--panel);
    backdrop-filter: blur(8px);
    box-shadow: var(--shadow);
}

.panel-soft {
    border: 1px solid var(--line);
    background:
        linear-gradient(180deg, rgba(214, 182, 126, 0.06), transparent 18%),
        var(--panel-soft);
    backdrop-filter: blur(8px);
    box-shadow: var(--shadow);
}

.button {
    min-height: 50px;
    padding: 0 16px;
    border: 1px solid var(--line-strong);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: pointer;
    font-size: 15px;
    transition: background 120ms ease, transform 120ms ease, border-color 120ms ease;
}

.button:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(214, 196, 167, 0.5);
    transform: translateY(-1px);
}

.button.primary {
    background: linear-gradient(90deg, rgba(155, 111, 64, 0.96), rgba(214, 182, 126, 0.92));
    color: #18130f;
    border-color: rgba(214, 182, 126, 0.82);
    font-weight: 600;
}

.button.primary:hover {
    background: linear-gradient(90deg, rgba(170, 122, 68, 0.98), rgba(225, 193, 140, 0.94));
}

.button.disabled {
    pointer-events: none;
    opacity: 0.48;
}

.button-key {
    color: rgba(23, 19, 15, 0.72);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.button:not(.primary) .button-key {
    color: var(--muted);
}

.error-box {
    display: none;
    margin-bottom: 16px;
    padding: 12px 14px;
    border: 1px solid var(--danger-line);
    background: var(--danger-bg);
    color: var(--danger-text);
    font-size: 14px;
    line-height: 1.6;
}

.field-label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.text-input {
    width: 100%;
    min-height: 48px;
    padding: 0 14px;
    margin-bottom: 18px;
    border: 1px solid var(--line-strong);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    font-size: 15px;
    outline: none;
}

.text-input:focus {
    border-color: rgba(214, 182, 126, 0.72);
    box-shadow: inset 0 0 0 1px rgba(214, 182, 126, 0.32);
}

.text-area {
    width: 100%;
    min-height: 120px;
    padding: 12px 14px;
    margin-bottom: 18px;
    border: 1px solid var(--line-strong);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    font-size: 14px;
    line-height: 1.7;
    outline: none;
    resize: vertical;
}

.text-area:focus {
    border-color: rgba(214, 182, 126, 0.72);
    box-shadow: inset 0 0 0 1px rgba(214, 182, 126, 0.32);
}

.metric-grid {
    display: grid;
    gap: 14px;
}

.metric-card {
    border: 1px solid var(--line);
    padding: 16px;
    background: rgba(255, 255, 255, 0.02);
    min-height: 120px;
}

.metric-label {
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.metric-value {
    font-size: 22px;
    line-height: 1.2;
    word-break: break-word;
}

.metric-subvalue {
    margin-top: 10px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
}

.terminal-block {
    border: 1px solid var(--line);
    background: rgba(10, 12, 14, 0.76);
    padding: 16px;
    font-family: "Courier New", Courier, monospace;
    font-size: 13px;
    line-height: 1.8;
    color: #d9d2c7;
    white-space: pre-wrap;
}

.terminal-block .prompt {
    color: var(--signal);
}

.terminal-block .accent {
    color: var(--accent);
}

.topbar,
.footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.topbar {
    padding: 18px 0;
}

.footer {
    padding: 0 0 22px;
    color: rgba(183, 174, 161, 0.72);
}

.brand {
    display: flex;
    gap: 14px;
    align-items: center;
}

.brand-mark {
    width: 12px;
    height: 12px;
    border: 1px solid var(--accent);
    box-shadow: inset 0 0 0 2px rgba(214, 182, 126, 0.12);
}

.admin-landing-page {
    min-height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr auto;
}

.admin-landing-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(340px, 0.9fr);
    gap: 24px;
    align-items: stretch;
    padding: 18px 0 36px;
}

.admin-landing-intro,
.admin-landing-portal {
    min-height: 560px;
}

.admin-landing-intro {
    padding: 40px 42px 34px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.admin-landing-title {
    max-width: 9ch;
    position: relative;
    z-index: 1;
}

.admin-landing-lead {
    max-width: 52ch;
    margin-top: 20px;
    position: relative;
    z-index: 1;
}

.admin-landing-meta {
    margin-top: 34px;
    padding-top: 22px;
    border-top: 1px solid var(--line);
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 18px;
    position: relative;
    z-index: 1;
}

.admin-landing-meta-value {
    font-size: 15px;
    line-height: 1.5;
}

.admin-landing-intro::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, transparent 0, transparent calc(100% - 220px), rgba(214, 182, 126, 0.08) calc(100% - 220px), rgba(214, 182, 126, 0.08) calc(100% - 219px), transparent calc(100% - 219px)),
        linear-gradient(180deg, transparent 0, transparent calc(100% - 180px), rgba(126, 166, 214, 0.08) calc(100% - 180px), rgba(126, 166, 214, 0.08) calc(100% - 179px), transparent calc(100% - 179px)),
        linear-gradient(135deg, transparent 0, transparent 71%, rgba(214, 182, 126, 0.1) 71%, rgba(214, 182, 126, 0.1) 71.35%, transparent 71.35%),
        repeating-linear-gradient(
            90deg,
            transparent 0,
            transparent 108px,
            rgba(255, 255, 255, 0.03) 108px,
            rgba(255, 255, 255, 0.03) 109px
        );
    opacity: 0.8;
    pointer-events: none;
}

.admin-landing-intro::after {
    content: "";
    position: absolute;
    top: 34px;
    right: 34px;
    width: 160px;
    height: 160px;
    border-top: 1px solid rgba(214, 182, 126, 0.34);
    border-right: 1px solid rgba(214, 182, 126, 0.34);
    clip-path: polygon(34% 0, 100% 0, 100% 66%);
    opacity: 0.8;
    pointer-events: none;
}

.admin-landing-portal {
    padding: 28px;
    display: grid;
    grid-template-rows: auto auto 1fr auto;
    gap: 18px;
}

.admin-landing-portal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.admin-landing-portal-title {
    font-size: 24px;
    line-height: 1.2;
    margin: 0;
}

.admin-landing-portal-copy {
    margin: 0;
    color: var(--muted);
    line-height: 1.7;
    font-size: 15px;
}

.admin-landing-button-stack {
    display: grid;
    gap: 14px;
    align-content: end;
}

.admin-landing-button-stack .button {
    justify-content: space-between;
}

.admin-landing-status {
    border-top: 1px solid var(--line);
    padding-top: 18px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.7;
}

.admin-landing-status strong {
    color: var(--text);
    font-weight: 600;
}

.admin-login-layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(360px, 460px);
    gap: 24px;
    align-items: stretch;
    padding: 28px 0;
}

.admin-login-intro {
    padding: 36px 40px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 620px;
}

.admin-login-title {
    max-width: 8ch;
}

.admin-login-lead {
    margin-top: 18px;
    max-width: 42ch;
    line-height: 1.75;
}

.admin-login-facts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    padding-top: 22px;
    border-top: 1px solid var(--line);
}

.admin-login-form-shell {
    padding: 26px;
    display: grid;
    align-content: center;
}

.admin-login-form-head {
    margin-bottom: 24px;
}

.admin-login-form-copy {
    margin: 10px 0 0;
    color: var(--muted);
    line-height: 1.7;
    font-size: 15px;
}

.admin-login-actions {
    display: grid;
    gap: 12px;
    margin-top: 6px;
}

.admin-login-footnote {
    margin-top: 18px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.7;
}

.admin-dashboard-page {
    min-height: 100vh;
    padding: 24px 0 28px;
}

.admin-console {
    min-height: 100vh;
    padding: 24px 0 28px;
}

.admin-console-shell {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    min-height: calc(100vh - 52px);
}

.admin-console-sidebar {
    border-right: 1px solid var(--line);
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    background:
        linear-gradient(180deg, rgba(214, 182, 126, 0.05), transparent 20%),
        rgba(9, 11, 13, 0.42);
}

.admin-console-brand {
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.admin-console-title {
    font-size: clamp(38px, 4vw, 62px);
    line-height: 0.95;
}

.admin-console-subtitle {
    margin-top: 10px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

.admin-console-nav {
    display: grid;
    gap: 10px;
}

.admin-console-nav-item {
    min-height: 46px;
    padding: 0 14px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text);
    text-align: left;
    cursor: pointer;
    transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.admin-console-nav-item:hover {
    border-color: rgba(214, 196, 167, 0.48);
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(1px);
}

.admin-console-nav-item.is-active {
    border-color: rgba(214, 182, 126, 0.74);
    background:
        linear-gradient(90deg, rgba(214, 182, 126, 0.18), rgba(255, 255, 255, 0.03));
}

.admin-console-sidebar-foot {
    margin-top: auto;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.admin-console-identity {
    font-size: 18px;
    line-height: 1.3;
}

.admin-console-identity-sub {
    margin-top: 4px;
    color: var(--muted);
    font-size: 13px;
}

.admin-console-main {
    padding: 24px;
}

.admin-console-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 20px;
    align-items: start;
}

.admin-console-header-title {
    font-size: clamp(34px, 4vw, 52px);
    line-height: 1.02;
}

.admin-console-header-copy {
    max-width: 62ch;
    margin: 14px 0 0;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.75;
}

.console-message {
    margin: 18px 0 0;
    padding: 14px 16px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
}

.console-message.is-success {
    border-color: rgba(126, 214, 165, 0.4);
    background: rgba(33, 78, 56, 0.22);
}

.console-message.is-error {
    border-color: var(--danger-line);
    background: var(--danger-bg);
    color: var(--danger-text);
}

.admin-pane {
    display: none;
    margin-top: 20px;
}

.admin-pane.is-active {
    display: block;
}

.admin-pane-head {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 16px;
    margin-bottom: 16px;
}

.admin-console-overview-grid,
.admin-console-opensearch-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    margin-bottom: 18px;
}

.admin-console-two-column,
.admin-console-workbench {
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(320px, 0.9fr) minmax(0, 1.3fr);
}

.admin-console-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.admin-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 12px;
    align-items: start;
    margin-bottom: 18px;
}

.admin-toolbar .text-input {
    margin-bottom: 0;
}

.admin-list,
.admin-user-list,
.admin-script-list {
    display: grid;
    gap: 12px;
}

.admin-list-empty {
    padding: 18px;
    border: 1px dashed var(--line-strong);
    color: var(--muted);
    font-size: 14px;
    line-height: 1.7;
}

.admin-list-item,
.admin-script-card {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text);
    text-align: left;
    cursor: pointer;
    transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.admin-list-item.no-click {
    cursor: default;
}

.admin-list-item:hover,
.admin-script-card:hover {
    border-color: rgba(214, 196, 167, 0.48);
    background: rgba(255, 255, 255, 0.05);
}

.admin-list-item.is-active {
    border-color: rgba(214, 182, 126, 0.68);
    background: linear-gradient(90deg, rgba(214, 182, 126, 0.1), rgba(255, 255, 255, 0.03));
}

.admin-list-item-head,
.admin-script-card-head {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 8px;
    font-size: 13px;
}

.admin-list-item-head strong,
.admin-script-card-head strong {
    font-size: 16px;
    line-height: 1.4;
}

.admin-list-item-copy,
.admin-script-card-copy {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.7;
}

.admin-list-item-meta,
.admin-script-card-meta {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.admin-form-grid.compact .text-input,
.admin-form-grid.compact .text-area {
    margin-bottom: 14px;
}

.admin-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 6px;
}

.admin-code-area {
    font-family: "Courier New", Courier, monospace;
    font-size: 13px;
}

.admin-inline-check {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 6px 0 8px;
    color: var(--muted);
    font-size: 13px;
}

.admin-user-card {
    padding: 16px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.02);
}

.admin-user-card-head {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 12px;
}

.admin-user-card-head span {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.admin-markdown-viewer {
    margin: 0;
    min-height: 520px;
    max-height: 70vh;
    overflow: auto;
    padding: 18px;
    border: 1px solid var(--line);
    background: rgba(10, 12, 14, 0.76);
    color: #ddd5ca;
    font-family: "Courier New", Courier, monospace;
    font-size: 13px;
    line-height: 1.8;
    white-space: pre-wrap;
    word-break: break-word;
}

.admin-markdown-viewer h1,
.admin-markdown-viewer h2,
.admin-markdown-viewer h3,
.admin-markdown-viewer h4,
.admin-markdown-viewer h5,
.admin-markdown-viewer h6 {
    margin: 0 0 14px;
    line-height: 1.2;
}

.admin-markdown-viewer p,
.admin-markdown-viewer ul,
.admin-markdown-viewer ol,
.admin-markdown-viewer blockquote,
.admin-markdown-viewer pre,
.admin-markdown-viewer table {
    margin: 0 0 16px;
}

.admin-markdown-viewer ul,
.admin-markdown-viewer ol {
    padding-left: 20px;
}

.admin-markdown-viewer blockquote {
    padding-left: 14px;
    border-left: 2px solid var(--line-strong);
    color: var(--muted);
}

.admin-markdown-viewer code {
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-family: "Courier New", Courier, monospace;
    font-size: 12px;
}

.admin-markdown-viewer .markdown-pre {
    padding: 14px;
    overflow: auto;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--line);
}

.admin-markdown-viewer .markdown-pre code {
    padding: 0;
    border: 0;
    background: transparent;
}

.admin-markdown-viewer .markdown-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-markdown-viewer .markdown-table th,
.admin-markdown-viewer .markdown-table td {
    padding: 10px 12px;
    border: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.admin-markdown-viewer .markdown-table th {
    color: var(--accent);
    background: rgba(255, 255, 255, 0.04);
}

.admin-markdown-viewer hr {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 18px 0;
}

.admin-dashboard-masthead {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) auto;
    gap: 20px;
    padding: 28px 30px;
}

.admin-dashboard-title {
    font-size: clamp(34px, 4vw, 54px);
    line-height: 1.02;
    max-width: 10ch;
}

.admin-dashboard-subtitle {
    margin-top: 14px;
    max-width: 56ch;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.75;
}

.admin-dashboard-actions {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    justify-content: flex-end;
    gap: 12px;
}

.admin-dashboard-board {
    margin-top: 18px;
    display: grid;
    gap: 18px;
}

.admin-dashboard-section {
    padding: 24px 26px;
}

.admin-dashboard-section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 18px;
}

.admin-dashboard-section-title {
    margin: 0;
    font-size: 18px;
}

.admin-dashboard-section-note {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
}

.admin-dashboard-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 980px) {
    .admin-login-layout {
        grid-template-columns: 1fr;
    }

    .admin-login-intro {
        min-height: auto;
    }

    .admin-login-facts {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 920px) {
    .admin-landing-hero,
    .admin-dashboard-masthead,
    .admin-console-shell,
    .admin-console-header,
    .admin-console-two-column,
    .admin-console-workbench {
        grid-template-columns: 1fr;
    }

    .admin-landing-intro,
    .admin-landing-portal {
        min-height: auto;
    }

    .admin-dashboard-actions {
        justify-content: flex-start;
    }

    .admin-dashboard-metrics,
    .admin-console-overview-grid,
    .admin-console-opensearch-grid {
        grid-template-columns: 1fr;
    }

    .admin-toolbar {
        grid-template-columns: 1fr;
    }

    .admin-console-main {
        padding: 18px;
    }

    .admin-console-sidebar {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }
}
