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

:root {
    --sidebar-w:  240px;
    --topbar-h:   60px;

    /* Brand colors — Zentra ICT */
    --c-blue:       #2563eb;
    --c-blue-dark:  #1d4ed8;
    --c-blue-light: #eff6ff;
    --c-blue-mid:   #dbeafe;

    /* Sidebar — light */
    --c-sidebar-bg:     #ffffff;
    --c-sidebar-border: #e8f0fe;
    --c-sidebar-txt:    #4b5563;
    --c-sidebar-hov:    #eff6ff;
    --c-sidebar-act-bg: #eff6ff;
    --c-sidebar-act:    #2563eb;

    /* Content */
    --c-bg:       #f0f5ff;
    --c-surface:  #ffffff;
    --c-border:   #dbeafe;
    --c-text:     #0f172a;
    --c-text-2:   #4b5563;
    --c-text-3:   #94a3b8;

    /* Status */
    --c-green:    #059669;
    --c-green-bg: #d1fae5;
    --c-amber:    #d97706;
    --c-amber-bg: #fef3c7;
    --c-red:      #dc2626;
    --c-red-bg:   #fee2e2;
    --c-purple:   #7c3aed;
    --c-purple-bg:#ede9fe;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(37,99,235,.08);
    --shadow:    0 2px 8px rgba(37,99,235,.10);
    --shadow-md: 0 4px 16px rgba(37,99,235,.12);
    --shadow-lg: 0 8px 32px rgba(37,99,235,.15);

    /* Radius */
    --r-sm: 6px;
    --r:    10px;
    --r-md: 12px;
    --r-lg: 16px;
    --r-xl: 24px;

    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, sans-serif;
}

html, body {
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    color: var(--c-text);
    background: var(--c-bg);
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; }
svg { display: inline-block; flex-shrink: 0; }

/* ── App shell ─────────────────────────────────────────────── */
.app-shell { display: flex; min-height: 100vh; }

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--c-sidebar-bg);
    border-right: 1px solid var(--c-sidebar-border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 16px 16px;
    border-bottom: 1px solid var(--c-sidebar-border);
}

.brand-icon { width: 32px; height: 32px; flex-shrink: 0; }

.brand-name { font-size: 15px; font-weight: 800; color: var(--c-text); letter-spacing: -.02em; }
.brand-sub  { font-size: 10.5px; color: var(--c-text-3); font-weight: 500; letter-spacing: .02em; }

.sidebar-nav {
    flex: 1;
    padding: 12px 10px 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border-radius: var(--r-sm);
    color: var(--c-sidebar-txt);
    font-size: 13.5px;
    font-weight: 500;
    transition: background .15s, color .15s;
}

.nav-item svg { width: 15px; height: 15px; flex-shrink: 0; }
.nav-item:hover  { background: var(--c-sidebar-hov); color: var(--c-blue); }
.nav-item.active { background: var(--c-sidebar-act-bg); color: var(--c-blue); font-weight: 600; }

.sidebar-footer { padding: 10px; border-top: 1px solid var(--c-sidebar-border); }
.nav-logout:hover { background: #fef2f2; color: var(--c-red); }

/* ── Main wrap ─────────────────────────────────────────────── */
.main-wrap {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ── Topbar ────────────────────────────────────────────────── */
.topbar {
    position: sticky;
    top: 0;
    height: var(--topbar-h);
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 50;
}

.topbar-title { font-size: 16px; font-weight: 700; letter-spacing: -.02em; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.admin-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: var(--c-blue-light);
    border: 1px solid var(--c-blue-mid);
    border-radius: 99px;
    font-size: 12px;
    font-weight: 600;
    color: var(--c-blue);
}

.admin-badge svg { width: 13px; height: 13px; }

/* ── Content ───────────────────────────────────────────────── */
.content {
    flex: 1;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.content-bare {
    padding: 0;
    gap: 0;
    overflow: hidden;
}

/* ── Alert ─────────────────────────────────────────────────── */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--r);
    font-size: 13.5px;
    line-height: 1.5;
}

.alert svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: var(--c-green-bg);  color: #065f46; border: 1px solid #a7f3d0; }
.alert-error   { background: var(--c-red-bg);    color: #991b1b; border: 1px solid #fca5a5; }

.alert-float {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 200;
    max-width: 380px;
    box-shadow: var(--shadow-md);
    animation: slideUp .25s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Stats ─────────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

.stat-card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-sm);
}

.stat-icon {
    width: 42px; height: 42px;
    border-radius: var(--r);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg { width: 18px; height: 18px; }
.stat-icon-blue   { background: var(--c-blue-light); color: var(--c-blue);   }
.stat-icon-green  { background: var(--c-green-bg);   color: var(--c-green);  }
.stat-icon-amber  { background: var(--c-amber-bg);   color: var(--c-amber);  }
.stat-icon-purple { background: var(--c-purple-bg);  color: var(--c-purple); }

.stat-value { font-size: 26px; font-weight: 800; color: var(--c-text); line-height: 1; }
.stat-label { font-size: 12px; color: var(--c-text-2); font-weight: 500; margin-top: 3px; }

/* ── Card ──────────────────────────────────────────────────── */
.card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-narrow { max-width: 780px; }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--c-border);
    gap: 12px;
    flex-wrap: wrap;
}

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

/* ── Table ─────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

.table th {
    padding: 9px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    color: var(--c-text-2);
    text-transform: uppercase;
    letter-spacing: .06em;
    background: var(--c-blue-light);
    border-bottom: 1px solid var(--c-border);
}

.table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f5ff;
    vertical-align: middle;
}

.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: #fafcff; }

.demo-name { font-weight: 600; }
.demo-desc { font-size: 12px; color: var(--c-text-3); margin-top: 2px; }

.url-link {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: var(--c-blue);
    font-weight: 500;
    font-size: 12.5px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    transition: color .15s;
}

.url-link:hover { color: var(--c-blue-dark); text-decoration: underline; }
.url-link svg { width: 9px; height: 9px; opacity: .7; }

.date-cell { color: var(--c-text-3); font-size: 12px; white-space: nowrap; }
.actions-col { width: 1%; white-space: nowrap; }
.actions-cell { white-space: nowrap; }

/* ── Badges ────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    letter-spacing: .01em;
}

.badge svg { width: 10px; height: 10px; }
.badge-green { background: var(--c-green-bg); color: #065f46; }
.badge-gray  { background: #f1f5f9;           color: #475569; }
.badge-blue  { background: var(--c-blue-light); color: var(--c-blue); }
.badge-amber { background: var(--c-amber-bg);   color: #92400e; }

.badge-btn { cursor: pointer; border: none; transition: opacity .15s; }
.badge-btn:hover { opacity: .8; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--r-sm);
    font-size: 13px;
    font-weight: 600;
    border: 1px solid transparent;
    transition: background .15s, border-color .15s, color .15s;
    white-space: nowrap;
}

.btn svg { width: 14px; height: 14px; }

.btn-primary { background: var(--c-blue); color: #fff; border-color: var(--c-blue); }
.btn-primary:hover { background: var(--c-blue-dark); border-color: var(--c-blue-dark); }

.btn-ghost { background: transparent; color: var(--c-text-2); border-color: var(--c-border); }
.btn-ghost:hover { background: var(--c-blue-light); color: var(--c-blue); border-color: var(--c-blue-mid); }

.btn-danger { background: var(--c-red-bg); color: var(--c-red); border-color: #fca5a5; }
.btn-danger:hover { background: var(--c-red); color: #fff; border-color: var(--c-red); }

.btn-full { width: 100%; justify-content: center; padding: 10px 16px; font-size: 14px; }
.btn-sm   { padding: 5px 12px; font-size: 12.5px; }
.btn-xs   { padding: 4px 9px; font-size: 12px; }

.btn-icon-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px; height: 26px;
    background: transparent;
    border: none;
    color: var(--c-text-3);
    border-radius: var(--r-sm);
    transition: background .15s, color .15s;
}

.btn-icon-danger:hover { background: var(--c-red-bg); color: var(--c-red); }
.btn-icon-danger svg { width: 13px; height: 13px; }

.btn-copy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px; height: 28px;
    background: transparent;
    border: 1px solid var(--c-border);
    border-radius: var(--r-sm);
    color: var(--c-text-2);
    transition: background .15s, color .15s;
    flex-shrink: 0;
}

.btn-copy:hover { background: var(--c-blue-light); color: var(--c-blue); border-color: var(--c-blue); }
.btn-copy svg { width: 12px; height: 12px; }

/* ── Forms ─────────────────────────────────────────────────── */
.form-body { padding: 20px; display: flex; flex-direction: column; gap: 18px; }

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

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group-center { justify-content: center; }

label { font-size: 13px; font-weight: 600; color: var(--c-text); }
.required { color: var(--c-red); }

input[type="text"],
input[type="password"],
input[type="email"],
input[type="date"],
textarea,
select {
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: var(--r-sm);
    background: #fff;
    color: var(--c-text);
    font-size: 13.5px;
    line-height: 1.5;
    transition: border-color .15s, box-shadow .15s;
    width: 100%;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--c-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}

input:disabled { background: #f8fafc; color: var(--c-text-3); cursor: not-allowed; }
textarea { resize: vertical; min-height: 80px; }

.form-hint { font-size: 12px; color: var(--c-text-3); }
.form-hint-inline { font-size: 12px; color: var(--c-text-3); font-weight: 400; }

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 4px;
    border-top: 1px solid var(--c-border);
}

.input-prefix-wrap, .input-disabled {
    display: flex;
    align-items: center;
    border: 1px solid #cbd5e1;
    border-radius: var(--r-sm);
    overflow: hidden;
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
}

.input-prefix-wrap:focus-within { border-color: var(--c-blue); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.input-disabled { background: #f8fafc; }

.input-prefix {
    padding: 8px 10px;
    background: #f0f5ff;
    border-right: 1px solid #cbd5e1;
    color: var(--c-blue);
    font-weight: 600;
    font-family: monospace;
    white-space: nowrap;
    flex-shrink: 0;
    font-size: 13px;
}

.input-prefix-wrap input, .input-disabled input { border: none !important; box-shadow: none !important; flex: 1; }

.password-wrap { position: relative; display: flex; }
.password-wrap input { padding-right: 40px; }

.password-toggle {
    position: absolute;
    right: 8px; top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--c-text-3);
    display: flex;
    align-items: center;
    padding: 4px;
    border-radius: 4px;
    transition: color .15s;
}

.password-toggle:hover { color: var(--c-blue); }
.password-toggle svg { width: 15px; height: 15px; }

/* Toggle */
.toggle-label { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.toggle-label input[type="checkbox"] { display: none; }

.toggle-switch {
    position: relative;
    width: 40px; height: 22px;
    background: #cbd5e1;
    border-radius: 99px;
    transition: background .2s;
    flex-shrink: 0;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px; left: 3px;
    width: 16px; height: 16px;
    background: white;
    border-radius: 50%;
    transition: transform .2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

.toggle-label input:checked ~ .toggle-switch { background: var(--c-blue); }
.toggle-label input:checked ~ .toggle-switch::after { transform: translateX(18px); }
.toggle-text { font-size: 13px; font-weight: 600; }

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--c-text-2);
}

.checkbox-label input[type="checkbox"] { width: 14px; height: 14px; accent-color: var(--c-blue); }
.mt-sm { margin-top: 8px; }

/* ── Empty state ───────────────────────────────────────────── */
.empty-state {
    padding: 40px 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: var(--c-text-3);
}

.empty-state svg { width: 48px; height: 48px; }
.empty-state-sm { padding: 20px; }

/* ── Page header row ───────────────────────────────────────── */
.page-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    font-weight: 500;
    color: var(--c-text-2);
    transition: color .15s;
}

.back-link:hover { color: var(--c-blue); }
.back-link svg { width: 15px; height: 15px; }
.header-actions { display: flex; gap: 8px; }

/* ── Edit grid ─────────────────────────────────────────────── */
.edit-grid { display: grid; grid-template-columns: 1fr 270px; gap: 20px; align-items: start; }
.edit-col-main { display: flex; flex-direction: column; gap: 20px; }

.url-display { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.url-display-label { color: var(--c-text-3); font-weight: 500; }

/* ── Info card ─────────────────────────────────────────────── */
.info-card { padding: 18px; }
.info-card-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--c-text-3); margin-bottom: 14px; }

.info-list { display: grid; grid-template-columns: auto 1fr; gap: 9px 14px; font-size: 13px; }
.info-list dt { font-weight: 600; color: var(--c-text-2); white-space: nowrap; }
.info-list dd { color: var(--c-text); }

.info-card-url { margin-top: 18px; display: flex; flex-direction: column; gap: 5px; }

.url-copy-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    background: var(--c-blue-light);
    border: 1px solid var(--c-blue-mid);
    border-radius: var(--r-sm);
    font-size: 12px;
    font-family: monospace;
    color: var(--c-blue);
}

.url-copy-box span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Upload zone ───────────────────────────────────────────── */
.upload-section { padding: 16px 20px; border-bottom: 1px solid var(--c-border); }

.upload-zone {
    position: relative;
    border: 2px dashed var(--c-border);
    border-radius: var(--r);
    padding: 28px 20px;
    text-align: center;
    transition: border-color .2s, background .2s;
    cursor: pointer;
}

.upload-zone:hover, .upload-zone.drag-over {
    border-color: var(--c-blue);
    background: var(--c-blue-light);
}

.file-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.upload-zone-content { pointer-events: none; }
.upload-zone-content svg { width: 36px; height: 36px; margin: 0 auto 10px; }
.upload-title { font-size: 13.5px; font-weight: 600; margin-bottom: 4px; }
.upload-link { color: var(--c-blue); cursor: pointer; pointer-events: all; font-weight: 600; }
.upload-hint { font-size: 12px; color: var(--c-text-3); }

.upload-options { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; gap: 12px; }

/* ── File list ─────────────────────────────────────────────── */
.file-list-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 20px 6px; border-top: 1px solid var(--c-border); }
.file-list-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--c-text-3); }

.file-tree { padding: 4px 12px 12px; max-height: 360px; overflow-y: auto; }

.file-item { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: var(--r-sm); transition: background .1s; font-size: 12.5px; }
.file-item:hover { background: #f0f5ff; }
.file-item svg { width: 13px; height: 13px; color: var(--c-text-3); flex-shrink: 0; }

.file-path { flex: 1; font-family: 'SF Mono', monospace; color: var(--c-text-2); }
.file-size { color: var(--c-text-3); font-size: 11px; white-space: nowrap; }
.file-dir svg { color: var(--c-amber); }
.file-dir .file-path { font-weight: 600; color: var(--c-text); }

/* ── Misc ──────────────────────────────────────────────────── */
.inline-form { display: inline; }
.hidden { display: none !important; }

/* ── Login page ────────────────────────────────────────────── */
.login-body {
    min-height: 100vh;
    background: linear-gradient(150deg, #dce9ff 0%, #f0f5ff 45%, #e8f1ff 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: #fff;
    border: 1px solid var(--c-border);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-lg);
    padding: 40px 36px;
    width: 100%;
    max-width: 400px;
}

.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.login-brand svg { width: 38px; height: 38px; flex-shrink: 0; }
.login-brand-name { font-size: 16px; font-weight: 800; color: var(--c-text); }
.login-brand-sub  { font-size: 11px; color: var(--c-text-3); }

.login-title    { font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 4px; }
.login-subtitle { font-size: 13px; color: var(--c-text-2); margin-bottom: 24px; }
.login-form { display: flex; flex-direction: column; gap: 16px; }

/* ── Demo gate ─────────────────────────────────────────────── */
.gate-body {
    min-height: 100vh;
    background: linear-gradient(150deg, #dce9ff 0%, #f0f5ff 45%, #e8f1ff 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.gate-card {
    background: #fff;
    border: 1px solid var(--c-border);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-lg);
    padding: 44px 40px;
    width: 100%;
    max-width: 420px;
    text-align: center;
}

.gate-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    font-size: 13px;
    font-weight: 700;
    color: var(--c-text-2);
}

.gate-brand svg { width: 26px; height: 26px; }
.gate-icon { margin-bottom: 18px; }
.gate-icon svg { width: 72px; height: 72px; }

.gate-title    { font-size: 21px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 6px; color: var(--c-text); }
.gate-subtitle { font-size: 13.5px; color: var(--c-text-2); margin-bottom: 22px; }
.gate-form     { text-align: left; display: flex; flex-direction: column; gap: 16px; }
.gate-footer   { margin-top: 22px; font-size: 12px; color: var(--c-text-3); }

/* ── File Manager ──────────────────────────────────────────── */
.fm-card {
    display: flex;
    flex-direction: row;
    height: calc(100vh - var(--topbar-h) - 48px);
    min-height: 400px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

/* Left panel */
.fm-left {
    width: 220px;
    flex-shrink: 0;
    border-right: 1px solid var(--c-border);
    display: flex;
    flex-direction: column;
    background: var(--c-blue-light);
}

.fm-left-head {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 12px 14px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--c-text-3);
    border-bottom: 1px solid var(--c-border);
}

.fm-left-head svg { width: 13px; height: 13px; }

.fm-folder-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px;
}

.fm-folder-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: var(--r-sm);
    color: var(--c-text-2);
    font-size: 13px;
    transition: background .15s, color .15s;
    cursor: pointer;
}

.fm-folder-item svg { width: 14px; height: 14px; flex-shrink: 0; color: var(--c-amber); }
.fm-folder-item:hover { background: #dbeafe; color: var(--c-text); }
.fm-folder-item.active { background: var(--c-blue); color: #fff; }
.fm-folder-item.active svg { color: #bfdbfe; }
.fm-folder-item.active .fm-folder-slug { color: #bfdbfe; }
.fm-folder-item.active .fm-status-dot.dot-active { background: #86efac; }

.fm-folder-meta { flex: 1; min-width: 0; }
.fm-folder-name { display: block; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fm-folder-slug { display: block; font-size: 11px; color: var(--c-text-3); font-family: monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.fm-status-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.dot-active   { background: var(--c-green); }
.dot-inactive { background: #cbd5e1; }

.fm-no-demos { padding: 16px; font-size: 12px; color: var(--c-text-3); text-align: center; }

/* Right panel */
.fm-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.fm-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--c-text-3);
    font-size: 14px;
}

.fm-placeholder svg { width: 64px; height: 64px; }

/* Toolbar */
.fm-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid var(--c-border);
    gap: 12px;
    flex-shrink: 0;
    background: var(--c-surface);
    flex-wrap: wrap;
}

.fm-breadcrumb {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    min-width: 0;
    flex: 1;
}

.fm-bc-home {
    display: flex;
    align-items: center;
    color: var(--c-text-3);
    padding: 3px;
    border-radius: 4px;
    transition: color .15s;
}

.fm-bc-home:hover { color: var(--c-blue); }
.fm-bc-home svg { width: 14px; height: 14px; }

.fm-bc-sep     { color: var(--c-text-3); }
.fm-bc-link    { color: var(--c-blue); font-weight: 500; transition: text-decoration .1s; }
.fm-bc-link:hover { text-decoration: underline; }
.fm-bc-current { font-weight: 700; color: var(--c-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }

.fm-toolbar-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

/* Browser / table */
.fm-browser {
    flex: 1;
    overflow-y: auto;
}

.fm-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 48px 24px;
    color: var(--c-text-3);
    font-size: 14px;
    height: 100%;
}

.fm-empty svg { width: 52px; height: 52px; }

.fm-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

.fm-table th {
    padding: 8px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    color: var(--c-text-2);
    text-transform: uppercase;
    letter-spacing: .06em;
    background: var(--c-blue-light);
    border-bottom: 1px solid var(--c-border);
    position: sticky;
    top: 0;
    z-index: 5;
}

.fm-table td {
    padding: 8px 14px;
    border-bottom: 1px solid #f0f5ff;
    vertical-align: middle;
}

.fm-table tr:last-child td { border-bottom: none; }
.fm-table tbody tr:hover td { background: #fafcff; }

.fm-row-up td { padding: 4px 14px; }
.fm-up-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12.5px;
    color: var(--c-text-3);
    font-weight: 500;
    transition: color .15s;
}
.fm-up-link:hover { color: var(--c-blue); }
.fm-up-link svg { width: 13px; height: 13px; }

.fm-item-dir {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-weight: 600;
    color: var(--c-text);
    transition: color .15s;
}
.fm-item-dir:hover { color: var(--c-blue); }
.fm-item-dir svg { width: 15px; height: 15px; color: #f59e0b; flex-shrink: 0; }

.fm-item-file {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--c-text);
}

/* Extension badges */
.fm-ext-badge {
    display: inline-block;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
    white-space: nowrap;
    font-family: monospace;
    min-width: 30px;
    text-align: center;
    flex-shrink: 0;
}

.fi-html    { background: #fef3c7; color: #92400e; }
.fi-css     { background: #dbeafe; color: #1e40af; }
.fi-js      { background: #fef9c3; color: #854d0e; }
.fi-json    { background: #dcfce7; color: #166534; }
.fi-php     { background: #ede9fe; color: #5b21b6; }
.fi-zip     { background: #fee2e2; color: #991b1b; }
.fi-img     { background: #fce7f3; color: #9d174d; }
.fi-pdf     { background: #fee2e2; color: #991b1b; }
.fi-video   { background: #e0f2fe; color: #075985; }
.fi-font    { background: #f0fdf4; color: #15803d; }
.fi-txt     { background: #f1f5f9; color: #475569; }
.fi-generic { background: #f1f5f9; color: #64748b; }

.fm-col-size  { color: var(--c-text-3); font-size: 12px; white-space: nowrap; }
.fm-col-date  { color: var(--c-text-3); font-size: 12px; white-space: nowrap; }
.fm-col-actions { white-space: nowrap; text-align: right; }

.fm-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px; height: 28px;
    border: none;
    background: transparent;
    border-radius: var(--r-sm);
    color: var(--c-text-3);
    transition: background .15s, color .15s;
}

.fm-action-btn svg { width: 13px; height: 13px; }
.fm-action-btn:hover { background: var(--c-blue-light); color: var(--c-blue); }
.fm-action-danger:hover { background: var(--c-red-bg); color: var(--c-red); }

/* Modal */
.fm-modal {
    border: none;
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    padding: 0;
    width: 100%;
    max-width: 480px;
    background: var(--c-surface);
}

.fm-modal::backdrop { background: rgba(15, 23, 42, .45); }

.fm-modal-box { display: flex; flex-direction: column; }

.fm-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--c-border);
}

.fm-modal-head h3 { font-size: 15px; font-weight: 700; }

.fm-modal-field { padding: 16px 20px 0; }

.fm-modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 20px;
    border-top: 1px solid var(--c-border);
    margin-top: 4px;
}

/* Drop zone */
.fm-drop-zone {
    position: relative;
    margin: 16px 20px 0;
    border: 2px dashed var(--c-border);
    border-radius: var(--r);
    padding: 28px 20px 20px;
    text-align: center;
    transition: border-color .2s, background .2s;
    cursor: pointer;
}

.fm-drop-zone.dragging,
.fm-drop-zone:focus-within {
    border-color: var(--c-blue);
    background: var(--c-blue-light);
}

.fm-drop-zone svg { width: 40px; height: 40px; margin: 0 auto 10px; }
.fm-drop-zone input[type="file"] { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }

.fm-drop-title { font-size: 13.5px; font-weight: 600; margin-bottom: 4px; }
.fm-drop-browse { color: var(--c-blue); cursor: pointer; font-weight: 600; pointer-events: all; position: relative; z-index: 1; }
.fm-drop-hint { font-size: 12px; color: var(--c-text-3); }

.fm-file-pill {
    display: inline-flex;
    align-items: center;
    margin: 4px 3px 0;
    padding: 3px 8px;
    background: var(--c-blue-light);
    border: 1px solid var(--c-blue-mid);
    border-radius: 99px;
    font-size: 11px;
    color: var(--c-blue);
    font-weight: 500;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 1100px) { .edit-grid { grid-template-columns: 1fr; } .edit-col-side { display: none; } }
@media (max-width: 900px)  { .stats-grid { grid-template-columns: repeat(2,1fr); } .form-row { grid-template-columns: 1fr; } }
@media (max-width: 640px)  {
    :root { --sidebar-w: 0px; }
    .sidebar { display: none; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .content { padding: 14px; }
    .topbar { padding: 0 14px; }
}
