:root {
    --bg-body: #f5f6f8;
    --bg-card: #ffffff;
    --border: #e5e7eb;
    --border-strong: #d5d8de;
    --text: #1f2933;
    --muted: #6b7280;
    --accent: #2ecc71;
    --accent-strong: #24b162;
    --sidebar: #252f40;
    --sidebar-muted: #8d97a7;
    --sidebar-active: #1fb26b;
    --shadow-soft: 0 12px 30px rgba(29, 41, 62, 0.08);
}

* { box-sizing: border-box; }

body {
    background: var(--bg-body);
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
    color: var(--text);
    margin: 0;
}

a { color: inherit; text-decoration: none; }
a:hover { color: inherit; text-decoration: none; }

.app-shell { display: flex; min-height: 100vh; }
.app-main { flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.app-content { flex: 1; padding: 24px 24px 32px; width: 100%; max-width: 1380px; margin: 0 auto; }
.app-footer { padding: 14px 24px 18px; color: var(--muted); font-size: 13px; }

.side-panel {
    width: 240px;
    background: var(--sidebar);
    color: #e8ecf2;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255,255,255,0.04);
}
.side-panel .brand {
    padding: 18px 20px;
    font-weight: 700;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.side-panel .brand .env {
    background: rgba(255,255,255,0.08);
    padding: 6px 10px;
    border-radius: 10px;
    font-size: 12px;
}
.side-nav { padding: 12px 8px; flex: 1; overflow-y: auto; }
.side-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: #d5d9e1;
    border-radius: 10px;
    font-size: 14px;
    transition: background 0.12s ease, color 0.12s ease;
}
.side-nav a .dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.35);
}
.side-nav a.active {
    background: rgba(31, 178, 107, 0.18);
    color: #ffffff;
    box-shadow: inset 0 0 0 1px rgba(31, 178, 107, 0.45);
}
.side-nav a.active .dot { background: var(--accent); }
.side-nav a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.side-nav a.sub {
    padding-left: 26px;
    font-size: 13px;
}
.side-nav a.sub .dot {
    width: 6px;
    height: 6px;
}

.side-nav details.nav-group {
    margin: 2px 0;
}
.side-nav details.nav-group summary {
    list-style: none;
}
.side-nav details.nav-group summary::-webkit-details-marker { display: none; }
.side-nav .nav-group-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: #d5d9e1;
    border-radius: 10px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
}
.side-nav .nav-group-summary .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.35);
}
.side-nav .nav-group-summary .chev {
    margin-left: auto;
    opacity: 0.75;
    font-size: 12px;
    transition: transform 0.12s ease;
}
.side-nav details.nav-group[open] .nav-group-summary .chev {
    transform: rotate(180deg);
}
.side-nav .nav-group-summary:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}
.side-nav details.nav-group.active > .nav-group-summary {
    background: rgba(31, 178, 107, 0.18);
    color: #ffffff;
    box-shadow: inset 0 0 0 1px rgba(31, 178, 107, 0.45);
}
.side-nav details.nav-group.active > .nav-group-summary .dot {
    background: var(--accent);
}
.side-nav .nav-children {
    padding-left: 8px;
    padding-bottom: 6px;
}
.side-panel .side-footer {
    padding: 12px 14px;
    border-top: 1px solid rgba(255,255,255,0.05);
    font-size: 13px;
    color: var(--sidebar-muted);
}

.top-bar {
    height: 64px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 1020;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}
.top-bar .title { font-weight: 700; }
.top-bar .badge-env {
    background: rgba(36, 177, 98, 0.12);
    color: var(--accent-strong);
    padding: 6px 10px;
    border-radius: 10px;
    font-size: 12px;
}

.card-surface {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-soft);
}
.text-muted { color: var(--muted) !important; }
.soft-muted { color: #9aa3b5; }

.btn-ghost {
    border: 1px solid var(--border);
    background: #f7f8fa;
    color: var(--text);
}
.btn-ghost:hover { background: #eef1f6; }

.btn-accent {
    background: var(--accent);
    border: 1px solid var(--accent-strong);
    color: #fff;
}
.btn-accent:hover { background: var(--accent-strong); color: #fff; }

.table-clean {
    width: 100%;
    border-collapse: collapse;
}
.table-clean thead {
    background: #fafbfc;
    border-bottom: 1px solid var(--border);
}
.table-clean th, .table-clean td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    vertical-align: middle;
}
.table-clean tbody tr:hover { background: #f6f9fb; }
.table-clean tbody tr.selected { background: #eef6ff; }

.badge-perm {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #eef2f7;
    color: #4b5563;
    border-radius: 999px;
    padding: 4px 10px;
    font-family: "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 12px;
}

.fm-shell { display: flex; flex-direction: column; gap: 16px; }
.fm-head {
    padding: 16px;
    border-bottom: 1px solid var(--border);
}
.fm-path {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.fm-path .crumb {
    background: #f3f5f8;
    padding: 6px 10px;
    border-radius: 10px;
    font-size: 13px;
}
.fm-path a.crumb { color: inherit; text-decoration: none; }
.fm-path a.crumb:hover { background: #e9edf3; }
.fm-path .crumb-link { color: #0b69ff; text-decoration: none; font-weight: 700; }
.fm-path .crumb-link:hover { text-decoration: underline; }
.fm-path .crumb-sep { color: #94a3b8; padding: 0 4px; }
.fm-path .crumb-current { color: #111827; font-weight: 700; }
.fm-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
    position: relative;
}
.fm-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f9fafb;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    font-weight: 600;
    font-size: 13px;
    color: #364152;
    box-shadow: inset 0 -1px 0 rgba(255,255,255,0.6);
}
.fm-btn:hover { background: #eef1f6; }
.fm-btn.primary { background: var(--accent); color: #fff; border-color: var(--accent-strong); }
.fm-btn.primary:hover { background: var(--accent-strong); }

.fm-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 12px;
}
@media (max-width: 1199px) { .fm-grid { grid-template-columns: 1fr; } }

.fm-side {
    border-right: 1px solid var(--border);
    min-height: 380px;
}
.file-tree { max-height: 70vh; overflow-y: auto; font-size: 13px; }
.file-tree .node { padding: 8px 10px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }
.file-tree .node.active { background: #eef6ff; color: #0b69ff; }
.file-tree .name { cursor: pointer; }

.fm-table-card { overflow: hidden; }
.fm-table-card .table-responsive { max-height: 520px; }

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #eef2f7;
    padding: 6px 10px;
    border-radius: 12px;
    font-size: 12px;
}

.status-success { color: var(--accent-strong); }

#feedbackArea {
    position: fixed;
    top: 82px;
    left: 0;
    right: 0;
    z-index: 1055;
    max-width: 960px;
    margin: 0 auto;
    pointer-events: none;
}
#feedbackArea .alert {
    pointer-events: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.card-hero {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}
.status-badge { font-size: 0.85rem; padding: 0.4em 0.8em; border-radius: 20px; font-weight: 600; }
.bg-success-soft { background-color: #d1fae5; color: #065f46; }
.bg-warning-soft { background-color: #fef3c7; color: #92400e; }
.main-content { min-height: 80vh; padding-bottom: 2rem; }
.guest-body .app-content { padding-top: 80px; }
