/* CMTP Cloud Portal - dark operations theme */

:root {
    --bg: #0e1116;
    --bg-raised: #161b22;
    --bg-input: #0b0f14;
    --border: #262d38;
    --border-strong: #354052;
    --text: #e6edf3;
    --text-muted: #8b949e;
    --accent: #2f81f7;
    --accent-hover: #4a94ff;
    --ok: #3fb950;
    --warn: #d29922;
    --error: #f85149;
    --radius: 8px;
    --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono", Menlo, Consolas, monospace;
}

* {
    box-sizing: border-box;
}

/* Author-level display rules outrank the browser default for [hidden], so
   restate it here - the feed panel and Stop button rely on toggling it. */
[hidden] {
    display: none !important;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

h1 {
    margin: 0 0 4px;
    font-size: 20px;
    font-weight: 600;
}

h2 {
    margin: 0 0 4px;
    font-size: 16px;
    font-weight: 600;
}

p {
    margin: 0;
}

code {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 6px;
}

.muted {
    color: var(--text-muted);
    font-size: 13px;
}

/* ---------- header / footer ---------- */

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 14px 24px;
    background: var(--bg-raised);
    border-bottom: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.brand-name {
    color: var(--text-muted);
    font-size: 13px;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

.session {
    display: flex;
    align-items: center;
    gap: 12px;
}

.session-origin {
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    background: rgba(47, 129, 247, 0.12);
    border: 1px solid rgba(47, 129, 247, 0.35);
    border-radius: 999px;
    padding: 2px 10px;
}

.session-origin.is-admin {
    color: var(--warn);
    background: rgba(210, 153, 34, 0.12);
    border-color: rgba(210, 153, 34, 0.45);
}

.session-user {
    color: var(--text-muted);
    font-size: 13px;
}

.logout-form {
    margin: 0;
}

.site-main {
    flex: 1;
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding-block: 24px;
    padding-inline: 16px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.site-footer {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 14px 24px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 12px;
}

/* ---------- panels ---------- */

.panel {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.feed-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.badge {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 2px 10px;
    white-space: nowrap;
}

/* ---------- system link state ---------- */

.link-state {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 5px 12px;
    white-space: nowrap;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    flex: none;
}

.dot.online {
    background: var(--ok);
    box-shadow: 0 0 0 3px rgba(63, 185, 80, 0.18);
}

.dot.offline {
    background: var(--error);
    box-shadow: 0 0 0 3px rgba(248, 81, 73, 0.18);
}

/* ---------- forms ---------- */

.form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    color: var(--text-muted);
}

.input {
    width: 100%;
    padding: 9px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
}

.input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(47, 129, 247, 0.22);
}

.listen-form {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.field-inline {
    flex: 1 1 240px;
    min-width: 0;
}

.field-inline .input {
    font-family: var(--mono);
    letter-spacing: 0.5px;
}

/* Origin selector, shown to administrators only. */
.field-origin {
    flex: 0 0 auto;
    min-width: 150px;
}

.field-origin .input {
    cursor: pointer;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 18px;
    border-radius: 6px;
    border: 1px solid var(--border-strong);
    background: var(--bg-input);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}

.button:hover {
    border-color: var(--accent);
}

.button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.button-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.button-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.button-quiet {
    background: transparent;
}

.button-block {
    width: 100%;
}

.form-error {
    margin-top: 12px;
    color: var(--error);
    font-size: 13px;
}

.alert {
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 13px;
    margin-bottom: 16px;
}

.alert-error {
    color: #ffc9c6;
    background: rgba(248, 81, 73, 0.12);
    border: 1px solid rgba(248, 81, 73, 0.4);
}

/* ---------- login ---------- */

body.bare {
    justify-content: center;
}

.bare-main {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    padding-block: 32px;
    padding-inline: 16px;
}

.login-panel {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
}

.login-head {
    margin-bottom: 22px;
}

.login-head h1 {
    margin-top: 10px;
}

/* ---------- table ---------- */

.table-scroll {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 6px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th,
.data-table td {
    padding: 9px 12px;
    text-align: left;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    position: sticky;
    top: 0;
    background: var(--bg-input);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:hover td {
    background: rgba(47, 129, 247, 0.06);
}

.data-table td.numeric,
.data-table th.numeric {
    text-align: right;
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
}

.data-table td.time,
.data-table td.serial {
    font-family: var(--mono);
    font-size: 12px;
}

.data-table tr.fresh td {
    animation: flash 1.2s ease-out;
}

@keyframes flash {
    from {
        background: rgba(47, 129, 247, 0.22);
    }

    to {
        background: transparent;
    }
}

.empty-state {
    padding: 22px 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

@media (max-width: 640px) {
    .site-header {
        padding: 12px 16px;
    }

    .panel {
        padding: 16px;
    }

    .listen-form .button {
        flex: 1 1 auto;
    }
}

/* ---------- navigation ---------- */

.site-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    margin-right: auto;
    margin-left: 8px;
}

.site-nav a {
    padding: 5px 10px;
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 13px;
    text-decoration: none;
}

.site-nav a:hover {
    color: var(--text);
    background: var(--bg-input);
}

/* ---------- account management ---------- */

.panel-narrow {
    max-width: 520px;
}

.field-hint {
    color: var(--text-muted);
    font-size: 12px;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.form-inline-grid {
    max-width: 520px;
}

.alert-success {
    color: #b7f0c2;
    background: rgba(63, 185, 80, 0.12);
    border: 1px solid rgba(63, 185, 80, 0.4);
}

.alert-list {
    margin: 0;
    padding-left: 18px;
}

.tag {
    display: inline-block;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 2px 9px;
    white-space: nowrap;
}

.tag-admin {
    color: var(--warn);
    background: rgba(210, 153, 34, 0.12);
    border-color: rgba(210, 153, 34, 0.45);
}

.tag-ok {
    color: var(--ok);
    background: rgba(63, 185, 80, 0.1);
    border-color: rgba(63, 185, 80, 0.35);
}

.tag-warn {
    color: var(--warn);
    background: rgba(210, 153, 34, 0.1);
    border-color: rgba(210, 153, 34, 0.35);
}

.tag-off {
    color: var(--error);
    background: rgba(248, 81, 73, 0.1);
    border-color: rgba(248, 81, 73, 0.35);
}

.button-small {
    padding: 4px 10px;
    font-size: 12px;
}

.row-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin: 0;
}

.actions-col {
    width: 1%;
}

/* ---------- brand lockup ---------- */

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}

.brand-logo {
    width: 56px;
    height: 56px;
    flex: none;
    display: block;
}

.brand-lockup-text {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
}

.brand-wordmark {
    font-size: 27px;
    font-weight: 800;
    letter-spacing: 4px;
    line-height: 1;
    color: var(--text);
}

/* The gradient rule echoes the underline on the Glomental wordmark. */
.brand-rule {
    display: block;
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(90deg, #EF281E 0%, #F4841B 50%, #FDCA00 100%);
}

/* Header-sized variant of the wordmark lockup. */
.brand-lockup-compact {
    gap: 4px;
}

.brand-lockup-compact .brand-wordmark {
    font-size: 17px;
    letter-spacing: 2.5px;
}

.brand-lockup-compact .brand-rule {
    height: 3px;
}

/* ---------- version stamp ---------- */

.version {
    font-family: var(--mono);
    font-size: 11px;
    opacity: 0.75;
}

.bare-version {
    margin-top: 14px;
    text-align: center;
    color: var(--text-muted);
    font-family: var(--mono);
    font-size: 11px;
}

/* ---------- queue depths ---------- */

.depth-col {
    width: 34%;
    min-width: 140px;
}

.depth-track {
    display: block;
    height: 8px;
    border-radius: 4px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    overflow: hidden;
}

.depth-fill {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 4px;
    background: var(--border-strong);
    transition: width 0.4s ease;
}

.depth-fill.has-work {
    background: linear-gradient(90deg, #2f81f7 0%, #d29922 100%);
}

.data-table tfoot th {
    padding: 9px 12px;
    text-align: left;
    color: var(--text);
    font-size: 12px;
    border-top: 1px solid var(--border-strong);
    background: var(--bg-input);
}

.data-table tfoot th.numeric {
    text-align: right;
    font-family: var(--mono);
}

.queue-meta {
    margin-top: 14px;
}
