/* ── TOKENS ─────────────────────────────────────────────────────────────── */
:root {
    --bg:        #1a1a1a;
    --surface:   #222222;
    --surface2:  #2a2a2a;
    --border:    #333333;
    --border2:   #3d3d3d;
    --accent:    #c8a060;
    --accent-d:  #9a7840;
    --text:      #dddddd;
    --muted:     #888888;
    --green:     #5a9e6f;
    --red:       #b84040;
    --amber:     #b87830;
    --admin:     #8a7ab8;
    --mono:      'Courier New', Courier, monospace;
    --radius:    5px;
    --radius-lg: 8px;
}

/* ── RESET ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; }

body {
    display: flex;
    height: 100vh;
    overflow: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── SIDEBAR ────────────────────────────────────────────────────────────── */
.sidebar {
    flex-shrink: 0;
    width: 220px;
    height: 100vh;
    background: #1e1e1e;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: width 0.2s ease;
    overflow: hidden;
    z-index: 50;
}

body.sidebar-collapsed .sidebar { width: 52px; }

.sidebar-brand {
    flex-shrink: 0;
    height: 52px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    border-bottom: 1px solid var(--border);
    gap: 0;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar-brand { text-decoration: none; }
.sidebar-brand:hover { text-decoration: none; }
.brand-icon  { color: var(--accent); font-weight: 700; font-family: var(--mono); font-size: 1.1rem; }
.brand-text  { color: var(--text);   font-weight: 700; font-family: var(--mono); font-size: 1.05rem; letter-spacing: 0.03em; }
.brand-short { display: none; }

body.sidebar-collapsed .brand-text  { display: none; }
body.sidebar-collapsed .brand-icon  { display: none; }
body.sidebar-collapsed .brand-short {
    display: block;
    color: var(--accent);
    font-weight: 700;
    font-family: var(--mono);
    font-size: 1rem;
    letter-spacing: 0.05em;
    width: 100%;
    text-align: center;
}

.sidebar-nav {
    flex: 1;
    padding: 10px 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: var(--muted);
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.15s, background 0.15s;
    position: relative;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    font-size: 0.9rem;
    font-family: inherit;
}

.sidebar-item:hover { color: var(--text); background: var(--surface2); text-decoration: none; }

.sidebar-item.active {
    color: var(--accent);
    background: rgba(200,160,96,0.08);
    border-left: 3px solid var(--accent);
    padding-left: 13px;
}

.sidebar-item.admin-item:hover  { color: var(--admin); }
.sidebar-item.admin-item.active { color: var(--admin); border-left-color: var(--admin); background: rgba(138,122,184,0.08); }

.sidebar-icon {
    flex-shrink: 0;
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

.sidebar-label { flex: 1; }

/* Tooltip when collapsed */
body.sidebar-collapsed .sidebar-item { padding: 10px 0; justify-content: center; }
body.sidebar-collapsed .sidebar-label { display: none; }
body.sidebar-collapsed .sidebar-item.active { border-left: none; padding-left: 0; border-bottom: 2px solid var(--accent); }

.sidebar-item[title]:hover::after {
    content: attr(title);
    position: absolute;
    left: 58px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--surface2);
    border: 1px solid var(--border2);
    color: var(--text);
    padding: 4px 10px;
    border-radius: var(--radius);
    font-size: 0.82rem;
    white-space: nowrap;
    pointer-events: none;
    z-index: 999;
    display: none;
}

body.sidebar-collapsed .sidebar-item[title]:hover::after { display: block; }

.sidebar-footer {
    flex-shrink: 0;
    border-top: 1px solid var(--border);
    padding: 8px 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    color: var(--muted);
    font-size: 0.82rem;
    white-space: nowrap;
    overflow: hidden;
}

body.sidebar-collapsed .sidebar-user { justify-content: center; padding: 8px 0; }
body.sidebar-collapsed .sidebar-user .sidebar-label { display: none; }

.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 8px 16px;
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.85rem;
    gap: 8px;
    transition: color 0.15s;
    white-space: nowrap;
}

.sidebar-toggle:hover { color: var(--text); }

body.sidebar-collapsed .sidebar-toggle { padding: 8px 0; }

.toggle-icon { transition: transform 0.2s; font-size: 0.75rem; }
body.sidebar-collapsed .toggle-icon { transform: rotate(180deg); }
body.sidebar-collapsed .toggle-label { display: none; }

/* ── APP CONTENT ────────────────────────────────────────────────────────── */
.app-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100vh;
    min-width: 0;
}

.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 32px 28px;
    width: 100%;
    min-width: 0;
}

/* ── FLASH MESSAGES ─────────────────────────────────────────────────────── */
.flash-container { margin-bottom: 20px; }
.flash {
    padding: 10px 16px;
    border-radius: var(--radius);
    margin-bottom: 8px;
    font-size: 0.875rem;
}
.flash-success { background: rgba(90,158,111,0.15); border: 1px solid var(--green);  color: var(--green); }
.flash-error   { background: rgba(184,64,64,0.15);  border: 1px solid var(--red);    color: var(--red);   }
.flash-warning { background: rgba(184,120,48,0.15); border: 1px solid var(--amber);  color: var(--amber); }

/* ── PAGE HEADER ────────────────────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 28px;
    gap: 16px;
}

.page-header h1 { font-size: 1.5rem; font-weight: 700; }
.page-sub { color: var(--muted); margin-top: 4px; font-size: 0.875rem; }
.back-link { display: inline-block; color: var(--muted); font-size: 0.82rem; margin-bottom: 6px; }
.back-link:hover { color: var(--accent); }
.accent { color: var(--accent); }
.muted  { color: var(--muted); }
.mono   { font-family: var(--mono); font-size: 0.88em; }

/* ── SECTION ────────────────────────────────────────────────────────────── */
.section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
    margin-bottom: 20px;
}

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

.section-header h2 {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

/* ── STAT ROW ───────────────────────────────────────────────────────────── */
.stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 3px solid var(--accent);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
}

.stat-card-admin { border-top-color: var(--admin); }
.stat-value { font-size: 1.9rem; font-weight: 700; font-family: var(--mono); }
.stat-label { font-size: 0.75rem; color: var(--muted); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.05em; }

/* ── DATA TABLE ─────────────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }

.data-table th {
    text-align: left;
    padding: 7px 12px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    border-bottom: 1px solid var(--border2);
}

.data-table td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
    vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface2); }
.action-cell { white-space: nowrap; }

/* ── TAGS / BADGES ──────────────────────────────────────────────────────── */
.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: capitalize;
}

.tag-cat {
    background: rgba(200,160,96,0.12);
    color: var(--accent);
    border: 1px solid rgba(200,160,96,0.25);
}

.badge-admin {
    background: rgba(138,122,184,0.15);
    color: var(--admin);
    border: 1px solid rgba(138,122,184,0.3);
    font-size: 0.68rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 3px;
    letter-spacing: 0.06em;
}

/* ── STATUS PILLS ───────────────────────────────────────────────────────── */
.status-pill {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-running, .status-pending { background: rgba(90,158,111,0.15); color: var(--green); }
.status-stopped, .status-cancelled { background: rgba(100,100,100,0.15); color: var(--muted); }
.status-warn    { background: rgba(184,120,48,0.15);  color: var(--amber); }
.status-unknown { background: rgba(40,40,40,0.8);     color: var(--muted); border: 1px solid var(--border2); }
.status-error   { background: rgba(184,64,64,0.15);   color: var(--red); }

/* ── BUTTONS ────────────────────────────────────────────────────────────── */
.btn-primary, .btn-secondary, .btn-danger, .btn-warning {
    display: inline-block;
    padding: 7px 16px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: opacity 0.15s;
    line-height: 1.4;
    font-family: inherit;
}

.btn-primary   { background: var(--accent);    color: #1a1a1a; }
.btn-secondary { background: var(--surface2);  color: var(--text); border: 1px solid var(--border2); }
.btn-danger    { background: rgba(184,64,64,0.2);  color: var(--red);   border: 1px solid rgba(184,64,64,0.35); }
.btn-warning   { background: rgba(184,120,48,0.2); color: var(--amber); border: 1px solid rgba(184,120,48,0.35); }

.btn-primary:hover   { opacity: 0.88; text-decoration: none; }
.btn-secondary:hover { background: var(--border2); text-decoration: none; }
.btn-danger:hover    { background: rgba(184,64,64,0.32); text-decoration: none; }
.btn-warning:hover   { background: rgba(184,120,48,0.32); text-decoration: none; }

.btn-full { width: 100%; text-align: center; }

.btn-xs {
    padding: 3px 9px;
    font-size: 0.76rem;
    border-radius: 3px;
    cursor: pointer;
    border: none;
    font-weight: 600;
    line-height: 1.5;
    font-family: inherit;
}

button:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── FORMS ──────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }

.form-group label {
    display: block;
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    margin-bottom: 5px;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
select,
textarea {
    width: 100%;
    padding: 7px 11px;
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.875rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}

input:focus, select:focus, textarea:focus { border-color: var(--accent); }
select option { background: var(--surface2); }

.inline-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.inline-form input[type="text"], .inline-form input[type="password"] { width: auto; flex: 1; min-width: 130px; }

.checkbox-label { display: flex; align-items: center; gap: 6px; font-size: 0.875rem; cursor: pointer; white-space: nowrap; }
.checkbox-label input { width: auto; }

.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 14px; }
.form-group-sm { max-width: 100px; }

/* ── LOGIN PAGE ─────────────────────────────────────────────────────────── */
body.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    overflow: hidden;
}

body.login-body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 40px 40px;
    opacity: 0.3;
    pointer-events: none;
}

.login-wrap {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 360px;
    padding: 20px;
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: var(--radius-lg);
    padding: 34px 30px;
}

.login-header { text-align: center; margin-bottom: 26px; }

.login-logo {
    font-size: 1.4rem;
    font-weight: 700;
    font-family: var(--mono);
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}

.login-sub { color: var(--muted); font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.08em; }

.login-error {
    background: rgba(184,64,64,0.12);
    border: 1px solid rgba(184,64,64,0.3);
    color: var(--red);
    padding: 8px 12px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    margin-bottom: 14px;
}

/* ── CHANGE PW ──────────────────────────────────────────────────────────── */
.centered-form { display: flex; justify-content: center; padding-top: 48px; }

.form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 30px;
    width: 100%;
    max-width: 400px;
}

.form-card h2 { margin-bottom: 6px; }
.form-card-sub { color: var(--muted); font-size: 0.875rem; margin-bottom: 20px; }

/* ── ADMIN NAV CARDS ────────────────────────────────────────────────────── */
.admin-nav-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 24px; }

.admin-nav-card {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 3px solid var(--admin);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
    text-decoration: none;
    transition: border-color 0.15s, transform 0.1s;
}

.admin-nav-card:hover { transform: translateY(-2px); text-decoration: none; border-color: var(--admin); }
.admin-nav-icon  { font-size: 1.3rem; color: var(--admin); margin-bottom: 8px; }
.admin-nav-label { font-weight: 700; font-size: 0.95rem; color: var(--text); margin-bottom: 4px; }
.admin-nav-desc  { font-size: 0.8rem; color: var(--muted); }

/* ── NOTICE BANNER ──────────────────────────────────────────────────────── */
.notice-banner {
    background: rgba(184,120,48,0.08);
    border: 1px solid rgba(184,120,48,0.25);
    border-left: 4px solid var(--amber);
    color: var(--amber);
    padding: 10px 16px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    margin-bottom: 20px;
}

/* ── RESET FORM (inline) ────────────────────────────────────────────────── */
.reset-form { display: inline-flex; align-items: center; gap: 6px; margin-left: 4px; }
.reset-form input { width: 150px; padding: 3px 8px; font-size: 0.78rem; }

/* ── SERVER FORM ────────────────────────────────────────────────────────── */
.server-form .form-group { margin-bottom: 0; }
.server-form > .form-group { margin-bottom: 14px; }
.server-form > button { margin-top: 4px; }

/* ── EMPTY STATE ────────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 36px 20px;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    font-size: 0.875rem;
}

/* ── DESIGN PAGE ────────────────────────────────────────────────────────── */
body.design-mode .app-content { overflow: hidden; }

.design-page {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100vh;
}

/* Toolbar */
.design-toolbar {
    flex-shrink: 0;
    height: 48px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 14px;
    overflow-x: auto;
    overflow-y: hidden;
}

.design-name-input {
    width: 180px;
    padding: 5px 9px;
    font-size: 0.85rem;
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    color: var(--text);
    outline: none;
    font-family: inherit;
}

.design-name-input:focus { border-color: var(--accent); }

.toolbar-sep { width: 1px; height: 24px; background: var(--border2); margin: 0 4px; flex-shrink: 0; }
.toolbar-sep.flex-grow { flex: 1; background: none; width: auto; }

.btn-tool {
    flex-shrink: 0;
    padding: 5px 12px;
    border-radius: var(--radius);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--border2);
    background: var(--surface2);
    color: var(--muted);
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    font-family: inherit;
    line-height: 1.4;
}

.btn-tool:hover { color: var(--text); border-color: var(--border2); background: var(--border); }
.btn-tool.active { color: var(--accent); border-color: var(--accent); background: rgba(200,160,96,0.1); }
.btn-tool.btn-primary-tool { color: var(--accent); border-color: rgba(200,160,96,0.4); }
.btn-tool.btn-primary-tool:hover { background: rgba(200,160,96,0.15); }
.btn-tool.btn-danger-tool { color: var(--red); border-color: rgba(184,64,64,0.35); }
.btn-tool.btn-danger-tool:hover { background: rgba(184,64,64,0.12); }

.toolbar-select {
    padding: 5px 9px;
    font-size: 0.82rem;
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    color: var(--text);
    outline: none;
    max-width: 160px;
}

.toolbar-group { display: flex; align-items: center; gap: 4px; }

.mode-hint { font-size: 0.78rem; color: var(--muted); white-space: nowrap; font-style: italic; }

/* Design body */
.design-body { flex: 1; display: flex; overflow: hidden; }

/* Palette */
.design-palette {
    flex-shrink: 0;
    width: 110px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 10px 8px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.palette-heading {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    padding: 2px 4px 6px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
}

.palette-item {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 8px;
    border-radius: var(--radius);
    font-size: 0.78rem;
    color: var(--text);
    cursor: grab;
    border: 1px solid var(--border);
    background: var(--surface2);
    transition: border-color 0.12s;
    user-select: none;
    white-space: nowrap;
}

.palette-item:hover { border-color: var(--pc); }
.palette-item:active { cursor: grabbing; }

.palette-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--pc);
    flex-shrink: 0;
}

/* Workspace */
.design-workspace {
    flex: 1;
    position: relative;
    overflow: hidden;
    background-color: var(--bg);
    background-image: radial-gradient(circle, #2e2e2e 1px, transparent 1px);
    background-size: 24px 24px;
    cursor: default;
}

.conn-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
}

.conn-svg line { pointer-events: stroke; }

.node-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Canvas nodes */
.canvas-node {
    position: absolute;
    width: 90px;
    height: 72px;
    background: var(--surface);
    border: 1px solid var(--border2);
    border-top: 3px solid var(--nc, var(--accent));
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: grab;
    user-select: none;
    transition: box-shadow 0.12s, border-color 0.12s;
    pointer-events: all;
}

.canvas-node:hover {
    border-color: var(--nc, var(--accent));
    box-shadow: 0 0 0 1px var(--nc, var(--accent)), 0 4px 12px rgba(0,0,0,0.5);
}

.canvas-node.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent), 0 4px 16px rgba(200,160,96,0.15);
}

.canvas-node.connect-source {
    box-shadow: 0 0 0 2px var(--accent);
    animation: node-pulse 1.2s ease-in-out infinite;
}

@keyframes node-pulse {
    0%, 100% { box-shadow: 0 0 0 2px var(--accent); }
    50% { box-shadow: 0 0 0 5px rgba(200,160,96,0.25); }
}

.canvas-node:active { cursor: grabbing; }

.node-short {
    font-size: 0.82rem;
    font-weight: 700;
    font-family: var(--mono);
    color: var(--nc, var(--accent));
    letter-spacing: 0.05em;
    pointer-events: none;
}

.node-label {
    font-size: 0.68rem;
    color: var(--muted);
    margin-top: 3px;
    pointer-events: none;
}

.node-del-btn {
    position: absolute;
    top: 2px;
    right: 4px;
    background: none;
    border: none;
    color: var(--muted);
    font-size: 0.65rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.1s, color 0.1s;
    padding: 0 2px;
    line-height: 1;
    pointer-events: all;
}

.canvas-node:hover .node-del-btn { opacity: 1; }
.node-del-btn:hover { color: var(--red); }

/* Design toast */
.design-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 10px 18px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 1000;
    transition: opacity 0.4s;
    pointer-events: none;
}

.design-toast.hidden { opacity: 0; }
.toast-ok  { background: rgba(90,158,111,0.2); border: 1px solid var(--green); color: var(--green); }
.toast-error { background: rgba(184,64,64,0.2); border: 1px solid var(--red); color: var(--red); }

/* ── DEPLOY PAGE ────────────────────────────────────────────────────────── */
.deploy-grid { display: grid; grid-template-columns: 360px 1fr; gap: 20px; align-items: start; }
@media (max-width: 860px) { .deploy-grid { grid-template-columns: 1fr; } }

.deploy-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 3px solid var(--accent);
    border-radius: var(--radius-lg);
    padding: 22px;
}

.deploy-card h3 {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 14px;
}

.design-select { margin-bottom: 10px; }

.design-meta {
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 16px;
    min-height: 1.4em;
}

.deploy-status-msg {
    margin-top: 12px;
    font-size: 0.85rem;
    min-height: 1.2em;
}

/* ── DASHBOARD ──────────────────────────────────────────────────────────── */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 20px;
    align-items: start;
}

@media (max-width: 920px) {
    .dashboard-grid { grid-template-columns: 1fr; }
}

/* ── ANNOUNCEMENTS ──────────────────────────────────────────────────────── */
.ann-compose textarea {
    resize: vertical;
    min-height: 72px;
    font-family: inherit;
}

.ann-compose-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 4px;
}

.ann-feed { display: flex; flex-direction: column; gap: 10px; }

.ann-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--border2);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    transition: border-left-color 0.15s;
}

.ann-card.ann-pinned {
    border-left-color: var(--accent);
    background: rgba(200,160,96,0.04);
}

.ann-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.ann-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.pin-badge {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--accent);
    background: rgba(200,160,96,0.12);
    border: 1px solid rgba(200,160,96,0.25);
    padding: 1px 6px;
    border-radius: 3px;
    flex-shrink: 0;
}

.ann-actions { display: flex; gap: 4px; flex-shrink: 0; }

.ann-body {
    font-size: 0.875rem;
    color: var(--muted);
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}

.ann-meta {
    margin-top: 10px;
    font-size: 0.75rem;
    color: var(--border2);
}

.design-name-link { color: var(--text); font-weight: 500; }
.design-name-link:hover { color: var(--accent); text-decoration: none; }

/* ── CATALOG ────────────────────────────────────────────────────────────── */
.catalog-filters {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.filter-btn {
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--border2);
    background: var(--surface2);
    color: var(--muted);
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    font-family: inherit;
}

.filter-btn:hover  { color: var(--text); border-color: var(--border2); background: var(--border); }
.filter-btn.active { color: var(--accent); border-color: var(--accent); background: rgba(200,160,96,0.1); }

.catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 16px;
}

.catalog-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 3px solid var(--border2);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: transform 0.12s, box-shadow 0.12s;
}

.catalog-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}

/* Category top-border colours */
.cat-redblue   { border-top-color: #b84040; }
.cat-ctf       { border-top-color: #c8a060; }
.cat-incident  { border-top-color: #b87830; }
.cat-pentest   { border-top-color: #4e8fc8; }
.cat-forensics { border-top-color: #8a7ab8; }
.cat-network   { border-top-color: #4a9e6a; }

.catalog-card-header {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}

.catalog-badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    border: 1px solid;
}

.cat-badge-redblue   { background: rgba(184,64,64,0.12);   color: #b84040; border-color: rgba(184,64,64,0.3); }
.cat-badge-ctf       { background: rgba(200,160,96,0.12);  color: #c8a060; border-color: rgba(200,160,96,0.3); }
.cat-badge-incident  { background: rgba(184,120,48,0.12);  color: #b87830; border-color: rgba(184,120,48,0.3); }
.cat-badge-pentest   { background: rgba(78,143,200,0.12);  color: #4e8fc8; border-color: rgba(78,143,200,0.3); }
.cat-badge-forensics { background: rgba(138,122,184,0.12); color: #8a7ab8; border-color: rgba(138,122,184,0.3); }
.cat-badge-network   { background: rgba(74,158,106,0.12);  color: #4a9e6a; border-color: rgba(74,158,106,0.3); }

.diff-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    border: 1px solid;
}

.diff-beginner     { background: rgba(74,158,106,0.1);   color: #4a9e6a; border-color: rgba(74,158,106,0.25); }
.diff-intermediate { background: rgba(184,120,48,0.1);   color: #b87830; border-color: rgba(184,120,48,0.25); }
.diff-advanced     { background: rgba(184,64,64,0.1);    color: #b84040; border-color: rgba(184,64,64,0.25); }

.catalog-card-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
}

.catalog-card-desc {
    font-size: 0.82rem;
    color: var(--muted);
    line-height: 1.55;
    flex: 1;
}

.catalog-card-meta {
    display: flex;
    gap: 14px;
    font-size: 0.78rem;
    color: var(--border2);
}

.catalog-card-footer {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 10px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.catalog-tags {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    flex: 1;
}

.catalog-tag {
    font-size: 0.68rem;
    color: var(--muted);
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 1px 6px;
    font-family: var(--mono);
}

/* Catalog type badge on deploy page */
.tag-catalog {
    background: rgba(78,143,200,0.12);
    color: #4e8fc8;
    border: 1px solid rgba(78,143,200,0.25);
}

/* ── MODAL ──────────────────────────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.open { display: flex; }

.modal-box {
    background: var(--surface);
    border: 1px solid var(--border2);
    border-top: 3px solid var(--accent);
    border-radius: var(--radius-lg);
    padding: 28px 30px 24px;
    width: 100%;
    max-width: 460px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.6);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.modal-header h3 {
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
}

.modal-close {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1rem;
    cursor: pointer;
    padding: 3px 7px;
    border-radius: var(--radius);
    line-height: 1;
    transition: color 0.12s;
}

.modal-close:hover { color: var(--red); }

.reservation-design-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.modal-sub {
    font-size: 0.82rem;
    color: var(--muted);
    line-height: 1.5;
    margin-bottom: 20px;
}

/* Date/time fields */
.res-fields {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    margin-bottom: 6px;
}

.res-fields .form-group { flex: 1; margin-bottom: 0; }

.res-arrow {
    flex-shrink: 0;
    color: var(--border2);
    font-size: 1.2rem;
    padding-bottom: 9px;
    line-height: 1;
}

.res-dt-input {
    width: 100%;
    padding: 9px 11px;
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.875rem;
    font-family: inherit;
    outline: none;
    color-scheme: dark;
    transition: border-color 0.15s;
}

.res-dt-input:focus { border-color: var(--accent); }

/* Summary strip */
.reservation-summary {
    min-height: 36px;
    margin: 14px 0;
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 500;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

.reservation-summary.has-value {
    border-color: rgba(200,160,96,0.3);
    background: rgba(200,160,96,0.06);
    color: var(--accent);
}

.reservation-summary.has-error {
    border-color: rgba(184,64,64,0.3);
    background: rgba(184,64,64,0.06);
    color: var(--red);
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 4px;
}

.modal-actions .btn-primary,
.modal-actions .btn-secondary { flex: 1; text-align: center; }

/* expired status */
.status-expired { background: rgba(138,122,184,0.15); color: var(--admin); }
