html, body {
    height: 100%;
    margin: 0;
    font-family: Arial, sans-serif;
    background: #0b0f14;
    color: #e6e6e6;
}

section {
    display: none;
}

section.active {
    display: block;
}

/* Layout */
#layout {
    display: flex;
    min-height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
}

/* Sidebar */
#sidebar {
    flex: 0 0 200px;
    width: 200px;
    min-width: 200px;
    max-width: 200px;

    background: #111826;
    border-right: 1px solid #1f2a3a;

    padding: 16px;
    box-sizing: border-box;
}

/* Sidebar header */
#sidebar h1 {
    font-size: 16px;
    margin: 0;
}

#sidebar p {
    color: #8aa0b6;
    font-size: 12px;
}

/* Nav */
nav ul {
    list-style: none;
    padding: 0;
    margin-top: 12px;
}

nav li {
    margin: 10px 0;
}

nav a {
    display: block;
    padding: 6px 8px;
    font-size: 14px;
    border-radius: 8px;

    text-decoration: none;
    color: #cbd5e1;

    transition: background 0.15s ease, color 0.15s ease;
}

nav a:hover {
    background: #1b2a3d;
    color: #ffffff;
}

/* Main content */
#content {
    flex: 1;
    padding: 30px;
    min-width: 0;
}

/* Sections */
section {
    margin-bottom: 40px;
}

/* Forms */
input, textarea, select, button {
    background: #111826;
    border: 1px solid #243244;
    color: #e6e6e6;

    padding: 8px;
    border-radius: 6px;

    margin-top: 6px;
    display: block;
}

button {
    cursor: pointer;
    background: #2563eb;
    border: none;
}

button:hover {
    background: #1d4ed8;
}

/* Table */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

th, td {
    border-bottom: 1px solid #1f2a3a;
    padding: 10px;
    text-align: left;
}

th {
    color: #93a4b8;
}

/* Footer */
#sidebar footer {
    font-size: 12px;
    color: #64748b;
}

/* Topbar (mobile only) */
#topbar {
    display: none;
}

#menu-toggle {
    background: none;
    border: none;
    color: #e6e6e6;
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    width: auto;
    margin: 0;
    line-height: 1;
}

#menu-toggle:hover {
    background: none;
}

.topbar-title {
    font-size: 16px;
    font-weight: 600;
    color: #e6e6e6;
}

/* Sidebar overlay (mobile only) */
#sidebar-overlay {
    display: none;
}

html, body {
    height: 100%;
    margin: 0;
    font-family: Arial, sans-serif;
    background: #0b0f14;
    color: #e6e6e6;
}

/* Center layout */
body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

header {
    text-align: center;
    margin-bottom: 20px;
}

header h1 {
    margin: 0;
    font-size: 22px;
}

header p {
    color: #8aa0b6;
    font-size: 13px;
    margin-top: 6px;
}

/* Login box */
#login {
    width: 320px;
    background: #111826;
    border: 1px solid #1f2a3a;
    padding: 6px;
    border-radius: 10px;

    /* safety net */
    display: block;
    box-sizing: border-box;
}

#login h2 {
    margin: 6px 0;
}

label {
    font-size: 13px;
    color: #93a4b8;
}

.form-hint {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 12px;
    line-height: 1.4;
}

.form-hint a {
    color: #60a5fa;
}

input, select {
    width: 100%;
    margin-top: 6px;
    margin-bottom: 12px;

    padding: 10px;
    border-radius: 6px;

    border: 1px solid #243244;
    background: #0b0f14;
    color: #e6e6e6;
    box-sizing: border-box;
}

select {
    cursor: pointer;
    appearance: auto;
}

button {
    width: 100%;
    padding: 10px;

    background: #2563eb;
    border: none;
    border-radius: 6px;

    color: white;
    cursor: pointer;
}

button:hover {
    background: #1d4ed8;
}

footer {
    margin-top: 20px;
    font-size: 12px;
    color: #64748b;
}

body.layout-page {
    display: block;
    align-items: unset;
    justify-content: unset;
}

body.login-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

body.login-page > header {
    text-align: center;
    margin-bottom: 20px;
}

body.login-page > header h1 {
    margin: 0;
    font-size: 22px;
}

body.login-page > header p {
    color: #8aa0b6;
    font-size: 13px;
    margin-top: 6px;
}

body.login-page main {
    width: 100%;
    display: flex;
    justify-content: center;
}

#sidebar header {
    text-align: left;
    margin-bottom: 8px;
}

.inline-form {
    margin-top: 10px;
}

.inline-form button {
    margin: 0;
}

.flash-message {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #334155;
    background: #1e293b;
    color: #d1d5db;
}

.flash-message.fade-out {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.flash-close {
    background: none;
    border: none;
    color: #93a4b8;
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    flex-shrink: 0;
    width: auto;
    margin: 0;
}

.flash-close:hover {
    color: #fff;
}

.status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    text-transform: capitalize;
    border: 1px solid transparent;
}

.status-pending {
    background: #3f2f1b;
    color: #facc15;
    border-color: #713f12;
}

.status-approved {
    background: #1f3d2d;
    color: #86efac;
    border-color: #166534;
}

.status-printing {
    background: #1e3a5f;
    color: #93c5fd;
    border-color: #1e40af;
}

.status-finished {
    background: #1f3d2d;
    color: #86efac;
    border-color: #166534;
}

.status-declined {
    background: #3f1d1d;
    color: #fca5a5;
    border-color: #991b1b;
}

.row-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.row-actions button {
    width: auto;
    margin: 0;
    padding: 8px 10px;
}

.approve-button {
    background: #15803d;
}

.approve-button:hover {
    background: #166534;
}

.decline-button {
    background: #b91c1c;
}

.decline-button:hover {
    background: #991b1b;
}

.secondary-button {
    background: #1f2937;
    border: 1px solid #334155;
}

.secondary-button:hover {
    background: #334155;
}

.disclaimer {
    margin: 10px 0;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #92400e;
    background: #2d1f0e;
    color: #fbbf24;
    font-size: 13px;
}

td a {
    color: #60a5fa;
    text-decoration: none;
}

td a:hover {
    text-decoration: underline;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 0 14px;
    color: #cbd5e1;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.status-removed {
    background: #2d1f2d;
    color: #c084fc;
    border-color: #7e22ce;
}

/* Modal overlay */
.modal-overlay {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #111826;
    border: 1px solid #1f2a3a;
    border-radius: 10px;
    padding: 20px;
    width: 80%;
    max-width: 800px;
    max-height: 90vh;
    position: relative;
    overflow-y: auto;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 16px;
    font-size: 24px;
    cursor: pointer;
    color: #93a4b8;
}

.modal-close:hover {
    color: #fff;
}

#preview-container {
    width: 100%;
    height: 500px;
    background: #0b0f14;
    border-radius: 8px;
}

.preview-button {
    width: auto;
}

textarea {
    background: #0b0f14;
    border: 1px solid #243244;
    color: #e6e6e6;
    padding: 8px;
    border-radius: 6px;
    margin-top: 6px;
    display: block;
    width: 100%;
    box-sizing: border-box;
    resize: vertical;
    font-family: inherit;
    font-size: 13px;
}

.action-cell {
    white-space: nowrap;
}

.action-cell form {
    display: inline;
}

.action-cell button {
    display: inline-block;
    width: auto;
    margin: 0 2px;
}

/* Home page */
.hero {
    margin-bottom: 24px;
}

.hero h2 {
    margin: 0 0 6px;
    font-size: 22px;
}

.hero p {
    margin: 0;
    color: #93a4b8;
    font-size: 14px;
}

.stats-row {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.stat-card {
    flex: 1;
    background: #111826;
    border: 1px solid #1f2a3a;
    border-radius: 10px;
    padding: 16px;
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: #e6e6e6;
}

.stat-label {
    display: block;
    font-size: 12px;
    color: #64748b;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-pending .stat-number {
    color: #facc15;
}

.stat-approved .stat-number {
    color: #86efac;
}

.stat-printing .stat-number {
    color: #93c5fd;
}

.stat-finished .stat-number {
    color: #86efac;
}

.stat-printer .stat-number {
    color: #60a5fa;
    font-size: 22px;
}

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

@media (max-width: 768px) {
    .stats-row {
        flex-wrap: wrap;
    }
    .stat-card {
        flex: 1 1 calc(50% - 6px);
    }
    .info-grid {
        grid-template-columns: 1fr;
    }
}

.info-card {
    background: #111826;
    border: 1px solid #1f2a3a;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
}

.info-card h3 {
    margin: 0 0 10px;
    font-size: 15px;
    color: #cbd5e1;
}

.info-card p {
    margin: 6px 0;
    font-size: 13px;
    color: #94a3b8;
    line-height: 1.5;
}

.info-card a {
    color: #60a5fa;
}

.activity-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.activity-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #1f2a3a;
    font-size: 13px;
}

.activity-list li:last-child {
    border-bottom: none;
}

.activity-file {
    flex: 1;
    color: #e6e6e6;
}

.activity-user {
    color: #64748b;
}

.activity-date {
    color: #64748b;
    font-size: 12px;
}

.steps {
    margin: 0;
    padding-left: 20px;
}

.steps li {
    margin-bottom: 8px;
    font-size: 13px;
    color: #94a3b8;
    line-height: 1.5;
}

.steps li strong {
    color: #cbd5e1;
}

.steps code {
    background: #0b0f14;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 12px;
}

.cmd-block {
    background: #0b0f14;
    color: #e2e8f0;
    padding: 10px 14px;
    border-radius: 6px;
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 12px;
    line-height: 1.5;
    overflow-x: auto;
    white-space: nowrap;
    margin: 8px 0 16px 16px;
    border: 1px solid #1e293b;
    user-select: all;
}

.file-types dt {
    font-size: 13px;
    color: #cbd5e1;
    margin-top: 8px;
}

.file-types dt:first-child {
    margin-top: 0;
}

.file-types dd {
    margin: 2px 0 0 0;
    font-size: 13px;
    color: #64748b;
    line-height: 1.4;
}

.file-types code {
    background: #0b0f14;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 12px;
}

.admin-card {
    border-color: #2563eb;
}

.admin-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.admin-links li {
    margin: 6px 0;
}

.admin-links a {
    font-size: 13px;
}

/* Filament grid */
.filament-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.filament-card {
    background: #111826;
    border: 1px solid #1f2a3a;
    border-radius: 10px;
    padding: 12px;
    cursor: pointer;
    transition: border-color 0.15s ease, transform 0.15s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.filament-card:hover {
    border-color: #2563eb;
    transform: translateY(-2px);
}

.filament-swatch {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 2px solid #1f2a3a;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.filament-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.filament-info strong {
    font-size: 13px;
    color: #e6e6e6;
}

.filament-type {
    font-size: 11px;
    color: #64748b;
}

.filament-hex {
    font-size: 10px;
    color: #475569;
    font-family: monospace;
}

.filament-stock {
    font-size: 11px;
    color: #86efac;
    font-weight: 600;
}

.filament-price {
    font-size: 11px;
    color: #fbbf24;
    font-weight: 600;
}

.no-filaments {
    grid-column: 1 / -1;
    color: #64748b;
    font-size: 14px;
    padding: 20px;
}

/* Admin filament modal */
.filament-modal-content {
    max-width: 500px;
}

.filament-modal-content select {
    width: 100%;
    margin-top: 6px;
    margin-bottom: 12px;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #243244;
    background: #0b0f14;
    color: #e6e6e6;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 13px;
}

.filament-modal-content select option {
    background: #111826;
    color: #e6e6e6;
}

.hex-input-group {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
}

.hex-input-group input[type="color"] {
    width: 48px;
    height: 40px;
    padding: 2px;
    border: 1px solid #243244;
    border-radius: 6px;
    background: #0b0f14;
    cursor: pointer;
    flex-shrink: 0;
    margin: 0;
}

.hex-input-group input[type="text"] {
    flex: 1;
    margin: 0;
}

.filament-modal-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.filament-modal-actions button {
    flex: 1;
}

.primary-button {
    background: #2563eb;
    border: none;
    color: white;
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    width: auto;
    display: inline-block;
}

.primary-button:hover {
    background: #1d4ed8;
}

/* Filament detail modal */
.filament-detail-content {
    max-width: 400px;
    text-align: center;
}

.filament-detail-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    text-align: left;
}

.filament-detail-swatch {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 2px solid #1f2a3a;
    flex-shrink: 0;
}

.filament-detail-info h3 {
    margin: 0 0 4px;
    font-size: 18px;
}

.filament-detail-info p {
    margin: 2px 0;
}

.filament-detail-image {
    margin: 12px 0;
}

.filament-detail-image img {
    max-width: 100%;
    border-radius: 8px;
    border: 1px solid #1f2a3a;
}

.filament-detail-link {
    margin-top: 12px;
}

.filament-detail-link a {
    color: #60a5fa;
    font-size: 14px;
}

.filament-selection {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #2a3342;
}

.filament-selection h3 {
    margin: 0 0 4px;
    font-size: 15px;
}

.filament-selection .hint {
    font-weight: 400;
    color: #93a4b8;
    font-size: 13px;
}

.filament-selection p {
    margin: 0 0 10px;
    font-size: 13px;
    color: #93a4b8;
}

.filament-row {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-bottom: 6px;
}

.filament-row select {
    flex: 1;
    padding: 6px 8px;
    margin: 0;
}

.filament-row input {
    width: 90px;
    padding: 6px 8px;
    margin: 0;
}

.filament-row button {
    width: auto;
    padding: 4px 10px;
    margin: 0;
    font-size: 14px;
    line-height: 1;
    border-radius: 4px;
    flex-shrink: 0;
}

.filament-usage {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 4px 0;
}

.filament-usage-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 3px;
    line-height: 1.3;
}

.filament-usage-item.sufficient {
    background: rgba(34, 197, 94, 0.08);
    color: #4ade80;
}

.filament-usage-item.insufficient {
    background: rgba(239, 68, 68, 0.08);
    color: #f87171;
}

.usage-swatch {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid rgba(255,255,255,0.15);
}

.usage-label {
    flex-shrink: 0;
}

.filament-grams-input {
    width: 60px !important;
    padding: 2px 6px !important;
    margin: 0 !important;
    font-size: 12px !important;
    border-radius: 3px !important;
    display: inline !important;
}

.usage-stock {
    flex-shrink: 0;
    font-size: 11px;
    opacity: 0.7;
}

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

@media (max-width: 768px) {
    .filament-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
}

/* File name cell truncation */
.file-cell {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
}

/* Notes cell truncation */
.notes-cell {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #93a4b8;
    font-size: 13px;
}

/* ── Review Cards ─────────────────────────────── */
.review-card-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.review-card {
    background: #111826;
    border: 1px solid #1f2a3a;
    border-radius: 10px;
    padding: 14px;
    width: 320px;
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.review-card.status-pending {
    border-color: #854d0e;
}

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

.review-card-id {
    font-weight: 700;
    font-size: 14px;
    color: #cbd5e1;
}

.review-card-body {
    font-size: 13px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.review-card-row {
    color: #93a4b8;
}

.review-card-label {
    color: #64748b;
    font-weight: 600;
    margin-right: 4px;
}

.review-card-file a {
    color: #60a5fa;
    text-decoration: none;
}

/* Used in filament request tables */
.review-filament-swatch {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid rgba(255,255,255,0.15);
}

.review-card-notes {
    color: #94a3b8;
    font-size: 12px;
    line-height: 1.4;
}

.review-card-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.review-card-actions form {
    display: inline-flex;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    width: auto;
}

.review-card-actions button,
.review-card-actions .primary-button {
    width: auto;
    padding: 6px 14px;
    margin: 0;
    font-size: 12px;
    white-space: nowrap;
}

/* Filament picker in review modal */
.pick-filament-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.pick-filament-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #1f2a3a;
    background: #0b0f14;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.pick-filament-card.selected {
    border-color: #2563eb;
    background: rgba(37, 99, 235, 0.08);
}

.pick-filament-card.insufficient {
    border-color: #991b1b;
    background: rgba(153, 27, 27, 0.08);
}

.pick-filament-card.out-of-stock {
    opacity: 0.5;
}

.pick-filament-swatch {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid rgba(255,255,255,0.15);
}

.pick-filament-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.pick-filament-info strong {
    font-size: 13px;
    color: #e6e6e6;
}

.pick-filament-type {
    font-size: 11px;
    color: #64748b;
}

.pick-filament-stock {
    font-size: 11px;
    color: #93a4b8;
}

.pick-filament-price {
    font-size: 11px;
    color: #64748b;
}

.pick-filament-check {
    flex-shrink: 0;
}

.pick-filament-check input {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin: 0;
}

.pick-filament-grams {
    flex-shrink: 0;
}

.pick-filament-grams-input {
    width: 60px;
    padding: 4px 6px;
    margin: 0;
    font-size: 12px;
    border-radius: 4px;
    text-align: right;
}

.review-form-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.review-form-actions button {
    width: auto;
    padding: 8px 20px;
}
/* ── Printer Status ────────────────────────────────────────── */

.status-layout {
    display: flex;
    gap: 20px;
    margin-top: 12px;
}

.camera-panel {
    flex: 1.5;
    min-width: 0;
}

.camera-panel img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: contain;
    border-radius: 10px;
    background: #000;
    border: 1px solid #1f2a3a;
    display: block;
}

.camera-label {
    font-size: 12px;
    color: #64748b;
    margin-top: 6px;
    text-align: center;
}

.status-panel {
    flex: 1;
    background: #111826;
    border: 1px solid #1f2a3a;
    border-radius: 10px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 240px;
}

.status-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.printer-name {
    font-size: 15px;
    font-weight: 600;
    color: #e2e8f0;
}

.state-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.state-text {
    font-size: 13px;
    font-weight: 500;
    text-transform: capitalize;
}

.state-idle    { color: #eab308; }
.state-printing { color: #22c55e; }
.state-paused  { color: #f97316; }
.state-error   { color: #ef4444; }
.state-error-fatal   { color: #ef4444; }
.state-error-warning { color: #eab308; }
.state-unknown { color: #64748b; }

.status-header .status-badge {
    font-size: 14px;
    padding: 4px 14px;
}

.connection-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.connection-dot.dot-idle {
    background: #eab308;
    box-shadow: 0 0 6px rgba(234, 179, 8, 0.6);
}

.connection-dot.dot-printing {
    background: #22c55e;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
}

.connection-dot.dot-paused {
    background: #f97316;
    box-shadow: 0 0 6px rgba(249, 115, 22, 0.6);
}

.connection-dot.dot-error {
    background: #ef4444;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.6);
}

.connection-dot.dot-unknown {
    background: #64748b;
}

.connection-dot.dot-disconnected {
    background: #64748b;
}

.progress-bar {
    position: relative;
    width: 100%;
    height: 28px;
    background: #1f2a3a;
    border-radius: 14px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #2563eb, #3b82f6);
    border-radius: 14px;
    transition: width 0.5s ease;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.status-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.status-label {
    color: #64748b;
}

.status-value {
    color: #e6e6e6;
    font-weight: 600;
}

.temp-heating {
    color: #f97316;
}

.temp-cooling {
    color: #3b82f6;
}

@media (max-width: 900px) {
    .status-layout {
        flex-direction: column;
    }
    .status-panel {
        min-width: unset;
    }
}

/* ── AMS ─────────────────────────────────────────────────────── */
.ams-section {
    margin-top: 24px;
}
.ams-section h3 {
    margin: 0 0 12px 0;
    font-size: 15px;
    font-weight: 600;
    color: #e2e8f0;
}
.ams-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.ams-card {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    overflow: hidden;
}
.ams-card-inner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
}
.ams-swatch {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    flex-shrink: 0;
    border: 1px solid #475569;
}
.ams-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.ams-label {
    font-size: 12px;
    color: #cbd5e1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ams-remain {
    font-size: 11px;
    color: #64748b;
}

@media (max-width: 600px) {
    .ams-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ── Responsive ≤ 768px ───────────────────────────────────── */
@media (max-width: 768px) {
    .layout-page #layout {
        max-width: 100%;
    }

    #topbar {
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 48px;
        background: #111826;
        border-bottom: 1px solid #1f2a3a;
        z-index: 300;
        align-items: center;
        padding: 0 12px;
        gap: 8px;
    }

    #sidebar {
        position: fixed;
        top: 48px;
        left: -240px;
        width: 240px;
        max-width: 85vw;
        height: calc(100vh - 48px);
        z-index: 200;
        transition: left 0.2s ease;
        border-right: 1px solid #1f2a3a;
        overflow-y: auto;
        flex: none;
    }

    #sidebar.open {
        left: 0;
    }

    #sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 160;
        transition: opacity 0.2s ease;
    }

    #sidebar-overlay.open {
        display: block;
    }

    body.sidebar-open {
        overflow: hidden;
    }

    #content {
        padding: 64px 16px 24px;
    }

    /* Tables scroll horizontally */
    table {
        display: block;
        overflow-x: auto;
    }

    /* Filament row wrap on upload form */
    .filament-row {
        flex-wrap: wrap;
    }

    .filament-row select {
        flex: 1 1 100%;
    }

    .filament-row input {
        flex: 1;
        min-width: 0;
    }

    /* Review form mobile */
    .review-form-row {
        flex-wrap: wrap;
    }

    .review-filaments {
        flex-direction: column;
    }
}
