/* Shifter dark theme — neutral interim palette. */

:root {
    /* Surfaces */
    --theme-background: #1f1f1f;
    --theme-bg: #1f1f1f;
    --theme-bg-secondary: #1a1a1a;
    --theme-bg-tertiary: #141414;
    --theme-surface: #151515;
    --theme-surface-hover: #1d1d1d;
    --theme-input-bg: #151515;

    /* Text */
    --theme-text: #eaebeb;
    --theme-text-primary: #eaebeb;
    --theme-secondary-text: #b8b8b8;
    --theme-text-secondary: #b8b8b8;
    --theme-text-muted: #9c9c9c;
    --theme-text-tertiary: #9c9c9c;

    /* Borders */
    --theme-border: #333;
    --theme-border-medium: #484848;

    /* Interaction */
    --theme-hover: rgb(255, 255, 255, 0.08);
    --theme-selected: rgb(148, 163, 184, 0.15);

    /* Accent / state */
    --theme-primary: #94a3b8;
    --theme-brand: #94a3b8;
    --theme-on-background: #94a3b8;
    --theme-success: #22c55e;
    --theme-error: #ff4d4f;
    --theme-warning: #faad14;

    /* Layout */
    --theme-left-nav-width: 56px;
}

html, body {
    min-width: 1024px;
    margin: 0;
    padding: 0;
}

html.theme-dark,
body.theme-dark {
    background: var(--theme-background);
    color: var(--theme-text);
    font-family: Lato, Assistant, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

* {
    box-sizing: border-box;
}

.layout {
    min-height: 100vh;
    margin-left: var(--theme-left-nav-width, 56px);
    transition: margin-left 0.3s ease-in-out;
}

.main {
    padding: 24px;
    background: var(--theme-background);
}

/* Page Header */
.page-header {
    margin-bottom: 24px;
}

.page-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--theme-text);
    margin: 0;
}

/* Cards */
.card {
    background: var(--theme-surface);
    border: 1px solid var(--theme-border);
    border-radius: 4px;
    padding: 16px;
    margin-bottom: 16px;
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--theme-text);
    margin: 0 0 12px;
}

/* Buttons — white pill style. */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 28px;
    min-width: 90px;
    padding: 0 30px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    font-family: Lato, sans-serif;
    cursor: pointer;
    border: none;
    transition: opacity 0.2s ease;
}

.btn,
.btn:hover,
.btn:focus,
.btn:active {
    text-decoration: none;
}

.btn-primary {
    background: #fff;
    color: #000;
}

.btn-primary:disabled {
    opacity: 0.36;
    cursor: not-allowed;
}

.btn-secondary {
    background: #fff;
    color: #000;
    border: 1px solid #fff;
}

.btn-secondary:disabled {
    opacity: 0.36;
    cursor: not-allowed;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--theme-border);
}

.table th {
    font-weight: 600;
    color: var(--theme-text-secondary);
    font-size: 12px;
    text-transform: uppercase;
}

.table td {
    color: var(--theme-text);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
}

.data-table thead tr {
    border-bottom: 1px solid var(--theme-border);
}

.data-table th {
    padding: 8px 12px;
    text-align: left;
    font-size: 12px;
    color: var(--theme-text-secondary);
    text-transform: uppercase;
}

.data-table th.text-center {
    text-align: center;
}

.data-table tbody tr {
    border-bottom: 1px solid var(--theme-border);
}

.data-table td {
    padding: 8px 12px;
}

.data-table td.text-center {
    text-align: center;
}

.data-table td.font-semibold {
    font-weight: 600;
}

.data-table td.text-mono-sm {
    font-family: monospace;
    font-size: 13px;
}

.list-table {
    width: 100%;
    border-collapse: collapse;
}

.list-table thead tr {
    border-bottom: 1px solid var(--theme-border);
}

.list-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--theme-text-secondary);
}

.list-table th.text-center {
    text-align: center;
}

.list-table th.text-right {
    text-align: right;
}

.list-table tbody tr {
    border-bottom: 1px solid var(--theme-border);
}

.list-table tbody tr.is-disabled {
    opacity: 0.5;
}

.list-table td {
    padding: 12px 16px;
}

.list-table td.text-center {
    text-align: center;
}

.list-table td.text-right {
    text-align: right;
}

.table tbody tr:hover {
    background: var(--theme-hover);
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--theme-text);
    margin-bottom: 4px;
}

.form-input {
    width: 100%;
    padding: 8px 12px;
    background: transparent;
    border: 1px solid var(--theme-border);
    border-radius: 4px;
    color: var(--theme-text);
    font-size: 14px;
    font-family: Lato, sans-serif;
}

.form-input:focus {
    outline: none;
    border-color: #94a3b8;
}

/* Checkbox */
.form-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
}

.form-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 2px 0 0;
    accent-color: #94a3b8;
    cursor: pointer;
}

.form-checkbox-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--theme-text);
}

.form-checkbox-help {
    font-size: 12px;
    color: var(--theme-text-secondary);
    margin-top: 2px;
}

/* Range Details */
.range-details {
    background: rgb(255, 255, 255, 0.03);
    border: 1px solid var(--theme-border);
    border-radius: 4px;
    padding: 12px;
}

.range-details-header {
    font-size: 12px;
    font-weight: 600;
    color: var(--theme-text-secondary);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.range-details-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.range-details-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.range-details-label {
    font-size: 11px;
    color: var(--theme-text-secondary);
}

.range-details-value {
    font-size: 13px;
    color: var(--theme-text);
    font-family: monospace;
}

/* Status indicators */
.status {
    display: inline-flex;
    align-items: center;
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
    flex-shrink: 0;
}

.status-online .status-dot,
.status-active .status-dot {
    background: #22c55e;
    box-shadow: 0 0 6px rgb(34, 197, 94, 0.6);
}

.status-offline .status-dot,
.status-paused .status-dot { background: #707070; }

.status-error .status-dot {
    background: #ff4d4f;
    box-shadow: 0 0 6px rgb(255, 77, 79, 0.6);
}

.status-provisioning .status-dot {
    background: #faad14;
    box-shadow: 0 0 8px rgb(250, 173, 20, 0.8);
    animation: pulse-glow 1.5s infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 8px rgb(250, 173, 20, 0.8);
    }

    50% {
        opacity: 0.7;
        box-shadow: 0 0 12px rgb(250, 173, 20, 1);
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 48px;
    color: var(--theme-text-secondary);
}

.empty-state-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--theme-text);
    margin: 16px 0 8px;
}

.empty-state h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--theme-text);
    margin: 16px 0 8px;
}

.empty-state p {
    font-size: 14px;
    color: var(--theme-text-secondary);
    margin: 0;
}

.empty-state-graphic {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 16px;
}

.empty-state-graphic-arc {
    position: absolute;
    inset: 0;
    border: 3px solid var(--theme-border);
    border-radius: 24px;
    border-top-color: transparent;
    border-left-color: transparent;
    transform: rotate(-45deg);
}

.empty-state-graphic-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-state-graphic-icon svg {
    width: 48px;
    height: 48px;
    color: var(--theme-text-secondary);
}

/* Links */
a {
    color: #94a3b8;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #484848;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #575757;
}

/* Utility Classes */

/* Text utilities */
.text-muted { color: var(--theme-text-secondary); }
.text-small { font-size: 12px; }
.text-right { text-align: right; }

/* Margin utilities */
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 12px; }
.mt-lg { margin-top: 16px; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 12px; }
.mb-lg { margin-bottom: 16px; }

/* Padding utilities */
.pl-lg { padding-left: 16px; }

/* Flexbox utilities */
.flex-row {
    display: flex;
    flex-direction: row;
    align-items: center;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

/* Gap utilities */
.gap-sm { gap: 8px; }
.gap-md { gap: 12px; }
.gap-lg { gap: 16px; }

/*
 * Extracted utilities — replacements for inline style="" attributes.
 * Each class reproduces the exact declarations it replaces so rendering
 * is unchanged.
 */

/* Display */
.d-none { display: none; }
.d-inline { display: inline; }

/* Width */
.w-full { width: 100%; }
.w-100px { width: 100px; }

/* Flex / grid */
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.items-end { align-items: flex-end; }

.flex-between-center {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flex-fields-sm {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.flex-fields-md {
    display: flex;
    gap: 12px;
    margin-bottom: 8px;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }

/* Margin */
.m-0 { margin: 0; }
.mb-0 { margin-bottom: 0; }
.ml-sm { margin-left: 8px; }

/* Padding */
.p-0 { padding: 0; }
.p-xs { padding: 6px; }
.p-lg { padding: 16px; }

/* Text */
.text-left { text-align: left; }
.text-mono { font-family: monospace; }

.text-mono-sm {
    font-family: monospace;
    font-size: 13px;
}
.break-all { word-break: break-all; }
.text-accent { color: var(--theme-on-background); }

/* Borders */
.border-bottom { border-bottom: 1px solid var(--theme-border); }
.border-top { border-top: 1px solid var(--theme-border); }

/* Form labels */
.field-label {
    font-size: 13px;
    display: block;
    margin-bottom: 4px;
}

.label-compact {
    font-size: 12px;
    font-weight: 600;
}

/* JS-toggled collapsible panels (hidden until .is-open is added) */
.collapse-panel {
    display: none;
    padding: 12px;
    border-top: 1px solid var(--theme-border);
}

.collapse-panel-mt {
    display: none;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--theme-border);
}

.collapse-panel.is-open,
.collapse-panel-mt.is-open { display: block; }

/* Compact data table (smaller font, no cell chrome) */
.table-compact {
    width: 100%;
    font-size: 13px;
    border-collapse: collapse;
}

/* Compact button (used in dense table rows) */
.btn-tight {
    height: auto;
    padding: 0.125rem 0.5rem;
}

/* App template inline-style replacements (issue #789) */

.messages-container {
    padding: 0 24px;
}

.message-banner {
    display: block;
    margin-bottom: 8px;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}

.badge-default {
    background: #336;
    color: #fff;
    margin-left: 8px;
}

.badge-custom {
    background: #2d4d2d;
    color: #fff;
    margin-left: 8px;
}

.badge-disabled {
    background: #4d2d2d;
    color: #fff;
    margin-left: 4px;
}

.badge-staff-only {
    background: #4d4020;
    color: #fff;
    margin-left: 4px;
}

.toggle-btn {
    font-size: 12px;
    height: 24px;
    padding: 0 10px;
    border-radius: 12px;
    min-width: 70px;
}

.toggle-btn-on {
    background: #2d5030;
    color: #fff;
    border: 1px solid #4a804a;
}

.toggle-btn-off {
    background: #502d2d;
    color: #fff;
    border: 1px solid #804a4a;
}

.toggle-btn-staff {
    background: #504020;
    color: #fff;
    border: 1px solid #806030;
}

.toggle-btn-public {
    background: #3a3a3a;
    color: #fff;
    border: 1px solid #555;
}

.btn-row-action {
    font-size: 12px;
    height: 24px;
    padding: 0 10px;
    border-radius: 12px;
    min-width: auto;
}

.btn-delete {
    background: #502828;
    color: #fff;
    border: 1px solid #803838;
}

.meta-table {
    width: 100%;
}

.meta-table th {
    padding: 4px 0;
}

.meta-table th.label-col {
    width: 140px;
}

.meta-table th.label-col-narrow {
    width: 120px;
}

.meta-table td {
    padding: 4px 0;
}

.table-scroll {
    overflow-x: auto;
}

.link-semibold {
    font-weight: 600;
}

.text-yes {
    color: #4ade80;
}

.flex-end {
    justify-content: flex-end;
}

.card-flush {
    padding: 0;
    overflow: hidden;
}

.card-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.btn-add-sm {
    font-size: 12px;
    height: 28px;
}

.form-group-compact {
    margin-bottom: 8px;
}

.form-label-inline {
    margin-bottom: 0;
}

.form-label-sm {
    margin-bottom: 0;
    font-size: 13px;
}

.dc-config-panel {
    margin-top: 8px;
    padding: 8px;
    background: rgb(100, 100, 255, 0.05);
    border-radius: 4px;
}

.instance-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.instance-card-title {
    font-size: 14px;
}

.btn-remove-sm {
    font-size: 11px;
    height: 22px;
    padding: 0 8px;
    border-radius: 11px;
    min-width: auto;
}

.inline-fields-mt {
    margin-top: 4px;
}

.yaml-preview {
    background: var(--theme-surface);
    border: 1px solid var(--theme-border);
    border-radius: 4px;
    padding: 16px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.5;
    color: var(--theme-text);
    white-space: pre-wrap;
}

.mono-id-secondary {
    font-family: monospace;
    color: var(--theme-text-secondary);
}
