:root {
    --bg: #0e1218;
    --panel: #121a24;
    --panel-soft: #162131;
    --panel-hover: #1b2a3e;
    --border: #263648;
    --border-soft: rgba(120, 150, 185, .18);
    --text: #e9eef5;
    --muted: #93a8bd;
    --accent: #8b5cf6;
    --accent-2: #1aebff;
    --danger: #ff5d73;
    --success: #48d597;
    --sidebar: 252px;
    --sidebar-compact: 72px;
    --radius: 14px;
    --shadow: 0 16px 42px rgba(0, 0, 0, .28);
    color-scheme: dark;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(139, 92, 246, .10), transparent 32rem),
        radial-gradient(circle at bottom right, rgba(26, 235, 255, .07), transparent 28rem),
        var(--bg);
    font-family: "Segoe UI", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button, summary, label.upload-button { -webkit-tap-highlight-color: transparent; }

.shell { min-height: 100vh; }
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1000;
    width: var(--sidebar);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: rgba(11, 17, 26, .97);
    border-right: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: width .18s ease, transform .18s ease;
}
.brand {
    min-height: 68px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 13px 12px;
    border-bottom: 1px solid var(--border-soft);
}
.brand-mark {
    position: relative;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    overflow: hidden;
    border: 1px solid rgba(139, 92, 246, .38);
    border-radius: 12px;
    background: linear-gradient(145deg, rgba(139, 92, 246, .25), rgba(26, 235, 255, .08));
    box-shadow: inset 0 0 14px rgba(139, 92, 246, .16);
}
.brand-mark span { position: absolute; display: block; background: linear-gradient(135deg, #b59cff, var(--accent-2)); }
.brand-mark span:nth-child(1) { width: 21px; height: 5px; left: 9px; top: 22px; border-radius: 0 0 8px 8px; }
.brand-mark span:nth-child(2) { width: 12px; height: 12px; left: 8px; top: 13px; border-radius: 50%; }
.brand-mark span:nth-child(3) { width: 17px; height: 17px; right: 7px; top: 10px; border-radius: 50%; }
.brand-mark.large { width: 48px; height: 48px; flex-basis: 48px; border-radius: 15px; }
.brand-mark.large span:nth-child(1) { width: 26px; height: 6px; left: 10px; top: 27px; }
.brand-mark.large span:nth-child(2) { width: 14px; height: 14px; left: 10px; top: 16px; }
.brand-mark.large span:nth-child(3) { width: 21px; height: 21px; right: 8px; top: 12px; }
.brand-text { min-width: 0; flex: 1; line-height: 1.12; }
.brand-text strong { display: block; color: #fff; font-size: 17px; font-weight: 900; }
.brand-text small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.sidebar-toggle {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--panel);
    color: var(--text);
    cursor: pointer;
    font-size: 23px;
}
.sidebar-toggle:hover { background: var(--panel-hover); border-color: rgba(139, 92, 246, .55); }
.navigation { flex: 1; overflow-y: auto; padding: 10px 8px; }
.nav-section { margin: 17px 10px 7px; color: #6f8299; font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.nav-item {
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 2px 0;
    padding: 7px 9px;
    border: 1px solid transparent;
    border-radius: 12px;
    color: var(--text);
    text-decoration: none;
}
.nav-item:hover { background: var(--panel-soft); border-color: var(--border-soft); }
.nav-item.active {
    background: linear-gradient(90deg, rgba(139, 92, 246, .28), rgba(26, 235, 255, .08));
    border-color: rgba(139, 92, 246, .55);
    box-shadow: inset 3px 0 0 var(--accent);
}
.nav-icon {
    position: relative;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 10px;
    background: rgba(255,255,255,.035);
}
.folder-icon::before { content: ""; position: absolute; left: 6px; top: 11px; width: 22px; height: 15px; border-radius: 3px; background: linear-gradient(135deg, #9f83ff, #5edff0); }
.folder-icon::after { content: ""; position: absolute; left: 7px; top: 8px; width: 10px; height: 6px; border-radius: 3px 3px 0 0; background: #a990ff; }
.user-icon::before { content: ""; position: absolute; left: 12px; top: 7px; width: 10px; height: 10px; border-radius: 50%; background: #a990ff; }
.user-icon::after { content: ""; position: absolute; left: 7px; bottom: 6px; width: 20px; height: 11px; border-radius: 10px 10px 5px 5px; background: linear-gradient(135deg, #9274f5, #43dbe9); }
.users-icon::before, .users-icon::after { content: ""; position: absolute; border-radius: 50%; background: #a990ff; }
.users-icon::before { width: 9px; height: 9px; left: 7px; top: 8px; box-shadow: 11px 0 0 #56dce9; }
.users-icon::after { width: 12px; height: 9px; left: 5px; top: 20px; border-radius: 8px 8px 3px 3px; box-shadow: 12px 0 0 #56dce9; }
.nav-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 680; }
.sidebar-user {
    min-height: 70px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border-top: 1px solid var(--border-soft);
    background: rgba(18, 26, 36, .72);
}
.avatar {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(139, 92, 246, .5);
    border-radius: 12px;
    background: linear-gradient(145deg, rgba(139,92,246,.42), rgba(26,235,255,.18));
    color: #fff;
    font-weight: 900;
}
.avatar.small { width: 32px; height: 32px; flex-basis: 32px; border-radius: 10px; }
.sidebar-user-text { min-width: 0; flex: 1; }
.sidebar-user-text strong, .sidebar-user-text small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-text small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.logout-button { width: 33px; height: 33px; border: 1px solid var(--border); border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; font-size: 20px; }
.logout-button:hover { border-color: var(--danger); color: var(--danger); }

.main { min-height: 100vh; margin-left: var(--sidebar); transition: margin-left .18s ease; }
.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    min-height: 64px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 22px;
    border-bottom: 1px solid var(--border-soft);
    background: rgba(14, 18, 24, .82);
    backdrop-filter: blur(14px);
}
.mobile-menu { display: none; }
.page-heading { min-width: 0; flex: 1; }
.page-heading h1 { margin: 0; color: #fff; font-size: 19px; line-height: 1.2; }
.page-heading p { margin: 4px 0 0; overflow: hidden; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.secure-pill { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid rgba(72,213,151,.28); border-radius: 999px; background: rgba(72,213,151,.08); color: #aaf1d0; font-size: 11px; font-weight: 800; letter-spacing: .04em; }
.secure-pill span, .login-security span { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 10px rgba(72,213,151,.7); }
.content { width: 100%; max-width: 1600px; margin: 0 auto; padding: 24px; }

body.sidebar-compact .sidebar { width: var(--sidebar-compact); }
body.sidebar-compact .main { margin-left: var(--sidebar-compact); }
body.sidebar-compact .brand { padding-inline: 15px; }
body.sidebar-compact .brand-text, body.sidebar-compact .nav-label, body.sidebar-compact .nav-section, body.sidebar-compact .sidebar-user-text { display: none; }
body.sidebar-compact .sidebar-toggle { position: absolute; left: 19px; top: 77px; transform: rotate(180deg); }
body.sidebar-compact .navigation { padding-top: 50px; }
body.sidebar-compact .nav-item { justify-content: center; padding-inline: 8px; }
body.sidebar-compact .sidebar-user { justify-content: center; padding-inline: 7px; flex-wrap: wrap; }
body.sidebar-compact .logout-button { width: 38px; }

.card { border: 1px solid var(--border); border-radius: var(--radius); background: linear-gradient(180deg, rgba(20,29,41,.96), rgba(16,24,34,.96)); box-shadow: 0 12px 28px rgba(0,0,0,.18); }
.card-heading { min-height: 72px; display: flex; align-items: center; gap: 12px; padding: 17px 19px; border-bottom: 1px solid var(--border-soft); }
.card-heading h2 { margin: 0; color: #fff; font-size: 16px; }
.card-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.heading-icon { position: relative; width: 38px; height: 38px; flex: 0 0 38px; border: 1px solid rgba(139,92,246,.32); border-radius: 12px; background: rgba(139,92,246,.12); }
.heading-icon::before, .heading-icon::after { content: ""; position: absolute; }
.heading-icon.password::before { width: 18px; height: 14px; left: 9px; top: 17px; border-radius: 3px; background: linear-gradient(135deg, #a990ff, #56dce9); }
.heading-icon.password::after { width: 11px; height: 10px; left: 12px; top: 8px; border: 2px solid #a990ff; border-bottom: 0; border-radius: 8px 8px 0 0; }
.heading-icon.connect::before { width: 20px; height: 2px; left: 9px; top: 18px; background: #6ddce9; transform: rotate(-35deg); }
.heading-icon.connect::after { width: 8px; height: 8px; left: 6px; top: 21px; border-radius: 50%; background: #a990ff; box-shadow: 17px -12px 0 #6ddce9; }
.heading-icon.key::before { width: 12px; height: 12px; left: 7px; top: 8px; border: 3px solid #a990ff; border-radius: 50%; }
.heading-icon.key::after { width: 18px; height: 4px; left: 16px; top: 20px; background: #6ddce9; transform: rotate(44deg); border-radius: 3px; }
.heading-icon.add-user::before, .heading-icon.users::before { width: 11px; height: 11px; left: 8px; top: 7px; border-radius: 50%; background: #a990ff; }
.heading-icon.add-user::after { width: 18px; height: 10px; left: 5px; bottom: 7px; border-radius: 9px 9px 3px 3px; background: #a990ff; box-shadow: 15px -5px 0 -3px #63ddea; }
.heading-icon.users::before { box-shadow: 13px 0 0 #63ddea; }
.heading-icon.users::after { width: 13px; height: 9px; left: 5px; bottom: 7px; border-radius: 8px 8px 3px 3px; background: #a990ff; box-shadow: 13px 0 0 #63ddea; }

label { display: flex; flex-direction: column; gap: 7px; color: #c6d3e2; font-size: 12px; font-weight: 700; }
input, select, textarea {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    outline: none;
    background: #0d151f;
    color: var(--text);
    font-weight: 500;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: rgba(139,92,246,.8); box-shadow: 0 0 0 3px rgba(139,92,246,.12); }
label small { color: var(--muted); font-weight: 400; line-height: 1.45; }
.form-stack { display: grid; gap: 15px; }
.form-stack.compact { padding: 20px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; padding: 20px; }
.span-2 { grid-column: 1 / -1; }
.form-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-top: 4px; }
.form-footer p { margin: 0; color: var(--muted); font-size: 11px; }
.button {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 14px;
    border: 1px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none;
    font-weight: 750;
    transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
.button:hover { transform: translateY(-1px); }
.button.primary { background: linear-gradient(135deg, #815cf0, #6477ed); color: #fff; box-shadow: 0 8px 20px rgba(103,78,220,.24); }
.button.primary:hover { background: linear-gradient(135deg, #936ff8, #6589f5); }
.button.secondary { border-color: var(--border); background: var(--panel-soft); color: var(--text); }
.button.secondary:hover { border-color: rgba(139,92,246,.55); background: var(--panel-hover); }
.button.danger { border-color: rgba(255,93,115,.35); background: rgba(255,93,115,.12); color: #ffb4bf; }
.button.success { border-color: rgba(72,213,151,.35); background: rgba(72,213,151,.12); color: #aaf1d0; }
.button.small { min-height: 32px; padding: 6px 10px; font-size: 11px; }
.button.wide, .wide { width: 100%; }
.flash-stack { display: grid; gap: 8px; margin-bottom: 16px; }
.flash { padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-soft); }
.flash.error { border-color: rgba(255,93,115,.45); background: rgba(255,93,115,.1); color: #ffc1c9; }
.flash.success { border-color: rgba(72,213,151,.42); background: rgba(72,213,151,.1); color: #b7f4d8; }

.file-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.breadcrumbs { min-width: 0; display: flex; align-items: center; gap: 7px; overflow: hidden; color: var(--muted); }
.breadcrumbs a { overflow: hidden; color: #c7d5e5; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.breadcrumbs a:hover { color: var(--accent-2); }
.toolbar-actions { display: flex; gap: 9px; flex: 0 0 auto; }
.action-popover { position: relative; }
.action-popover summary, .row-menu summary, .manage-panel summary { list-style: none; }
.action-popover summary::-webkit-details-marker, .row-menu summary::-webkit-details-marker, .manage-panel summary::-webkit-details-marker { display: none; }
.popover-form { position: absolute; top: calc(100% + 8px); right: 0; z-index: 20; width: 280px; display: grid; gap: 11px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: #111b27; box-shadow: var(--shadow); }
.upload-button { position: relative; }
.upload-button form, .upload-button input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.file-card { overflow: visible; }
.table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 12px 15px; border-bottom: 1px solid var(--border); color: #72869c; font-size: 10px; letter-spacing: .07em; text-align: left; text-transform: uppercase; }
.data-table td { padding: 12px 15px; border-bottom: 1px solid var(--border-soft); color: #b9c8d8; vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: rgba(139,92,246,.035); }
.file-table th:nth-child(2) { width: 170px; }
.file-table th:nth-child(3) { width: 105px; }
.actions-column { width: 74px; }
.file-name { min-width: 180px; display: flex; align-items: center; gap: 11px; color: var(--text); text-decoration: none; }
.file-name:hover strong { color: var(--accent-2); }
.file-name.disabled { color: var(--muted); }
.file-name small { display: block; color: var(--muted); font-size: 10px; }
.file-symbol { position: relative; width: 32px; height: 32px; flex: 0 0 32px; border: 1px solid var(--border-soft); border-radius: 9px; background: rgba(255,255,255,.03); }
.file-symbol.folder::before { content: ""; position: absolute; left: 5px; top: 11px; width: 22px; height: 15px; border-radius: 3px; background: linear-gradient(135deg,#9476f2,#57d7e6); }
.file-symbol.folder::after { content: ""; position: absolute; left: 6px; top: 8px; width: 10px; height: 6px; border-radius: 3px 3px 0 0; background: #a98ff8; }
.file-symbol.document::before { content: ""; position: absolute; left: 8px; top: 5px; width: 16px; height: 21px; border-radius: 3px; background: #d2deeb; }
.file-symbol.document::after { content: ""; position: absolute; right: 7px; top: 5px; border-top: 6px solid #667c91; border-left: 6px solid transparent; }
.file-symbol.document.text-document::before { background: linear-gradient(160deg, #eef5fb, #a9dce6); }
.file-symbol.document.text-document { border-color: rgba(26,235,255,.24); box-shadow: inset 0 0 12px rgba(26,235,255,.06); }
.file-symbol.document.text-document::after { border-top-color: #568ea0; }
.file-symbol.link::before { content: "↗"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 17px; }
.row-menu { position: relative; }
.row-menu > summary { width: 34px; height: 30px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 9px; cursor: pointer; color: var(--muted); }
.row-menu-panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: 235px; display: grid; gap: 7px; padding: 10px; border: 1px solid var(--border); border-radius: 11px; background: #101a26; box-shadow: var(--shadow); }
.row-menu-panel > a, .row-menu-panel button { width: 100%; min-height: 34px; padding: 7px 9px; border: 0; border-radius: 8px; background: transparent; color: var(--text); cursor: pointer; text-align: left; text-decoration: none; }
.row-menu-panel > a:hover, .row-menu-panel button:hover { background: var(--panel-hover); }
.row-menu-panel .danger-text { color: #ff9aaa; }
.rename-form { display: grid; grid-template-columns: 1fr auto; gap: 5px; }
.rename-form input { min-height: 34px; padding: 6px 8px; font-size: 11px; }
.rename-form button { width: auto; }
.empty-state { height: 300px; text-align: center; }
.empty-state strong, .empty-state p { display: block; }
.empty-state strong { margin-top: 14px; color: #dce8f5; font-size: 16px; }
.empty-state p { color: var(--muted); }
.empty-folder { position: relative; width: 70px; height: 54px; display: inline-block; border-radius: 9px; background: linear-gradient(135deg,rgba(139,92,246,.7),rgba(26,235,255,.55)); opacity: .8; }
.empty-folder::before { content: ""; position: absolute; width: 27px; height: 12px; left: 4px; top: -7px; border-radius: 7px 7px 0 0; background: #8d72e5; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.editor-card { min-height: calc(100vh - 113px); display: flex; flex-direction: column; overflow: hidden; }
.editor-toolbar { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 15px; border-bottom: 1px solid var(--border); background: rgba(10,17,25,.56); }
.editor-file-heading { min-width: 0; display: flex; align-items: center; gap: 11px; }
.editor-file-heading > div { min-width: 0; }
.editor-file-heading strong, .editor-file-heading small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.editor-file-heading strong { color: #fff; font-size: 14px; }
.editor-file-heading small { margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 500; }
.editor-actions { display: flex; flex: 0 0 auto; gap: 8px; }
.editor-area { min-height: 420px; flex: 1; gap: 0; }
.editor-area textarea { height: 100%; min-height: 420px; padding: 20px; border: 0; border-radius: 0; resize: none; background: #09111a; color: #dce8f5; caret-color: var(--accent-2); font-family: "Cascadia Code", "Fira Code", Consolas, "Courier New", monospace; font-size: 14px; font-weight: 450; line-height: 1.55; tab-size: 4; white-space: pre; overflow: auto; }
.editor-area textarea:focus { border-color: transparent; box-shadow: inset 0 0 0 1px rgba(139,92,246,.45); }
.editor-status { min-height: 36px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 7px 13px; border-top: 1px solid var(--border); background: rgba(16,25,36,.96); color: var(--muted); font-size: 10px; }
.editor-status [data-editor-state].changed { color: #ffd68a; }
.editor-status [data-editor-state].saved { color: #aaf1d0; }
kbd { padding: 2px 5px; border: 1px solid #3a4a5d; border-bottom-width: 2px; border-radius: 5px; background: #182332; color: #dbe7f4; font-family: inherit; font-size: 9px; }

.account-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; }
.connection-list { display: grid; gap: 12px; padding: 20px; }
.connection-list > div { padding: 13px; border: 1px solid var(--border-soft); border-radius: 10px; background: rgba(8,15,23,.45); }
.connection-list span, .connection-list code { display: block; }
.connection-list span { margin-bottom: 6px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
code { overflow-wrap: anywhere; color: #c8f8ff; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; }
.inline-form { display: flex; gap: 12px; padding: 18px; }
.inline-form textarea { flex: 1; }
.key-list { display: grid; gap: 8px; padding: 0 18px 18px; }
.key-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 11px 12px; border: 1px solid var(--border-soft); border-radius: 10px; background: rgba(8,15,23,.42); }
.muted-note { margin: 0; padding: 14px 18px; color: var(--muted); line-height: 1.55; }

.admin-layout { display: grid; gap: 18px; }
.users-card { overflow: visible; }
.admin-table th:nth-child(2) { width: 80px; }
.admin-table th:nth-child(3), .admin-table th:nth-child(4) { width: 110px; }
.admin-table th:last-child { width: 110px; }
.user-cell { min-width: 190px; display: flex; align-items: center; gap: 10px; }
.user-cell strong, .user-cell small { display: block; }
.user-cell small { max-width: 330px; margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.status-badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 999px; font-size: 10px; font-weight: 800; }
.status-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; }
.status-badge.on { background: rgba(72,213,151,.1); color: #aaf1d0; }
.status-badge.on::before { background: var(--success); }
.status-badge.off { background: rgba(255,93,115,.1); color: #ffb4bf; }
.status-badge.off::before { background: var(--danger); }
.root-protected { color: var(--muted); font-size: 11px; }
.manage-panel { position: relative; }
.manage-panel-body { position: absolute; right: 0; top: calc(100% + 7px); z-index: 40; width: min(440px, calc(100vw - 35px)); display: grid; gap: 14px; padding: 16px; border: 1px solid var(--border); border-radius: 13px; background: #101a26; box-shadow: var(--shadow); }
.manage-panel-body h3 { margin: 0; color: #fff; }
.mini-form { display: grid; grid-template-columns: 1fr 1fr auto; align-items: end; gap: 8px; padding-bottom: 13px; border-bottom: 1px solid var(--border-soft); }
.mini-form input, .mini-form select { min-height: 36px; padding: 7px 9px; }
.mini-form.key-generator { grid-template-columns: 1fr 1fr; }
.mini-form.key-generator button { grid-column: 1/-1; }
.mini-form.identity-form { grid-template-columns: 1fr 1fr auto; }
.identity-note { grid-column: 1/-1; color: var(--muted); }

.error-card { max-width: 620px; margin: 8vh auto; padding: 40px; text-align: center; }
.error-card > strong { display: block; color: rgba(139,92,246,.55); font-size: 84px; line-height: 1; }
.error-card h2 { color: #fff; }
.error-card p { margin-bottom: 24px; color: var(--muted); }

.login-body { overflow-x: hidden; }
.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0,1.05fr) minmax(440px,.95fr); }
.login-copy { display: flex; flex-direction: column; justify-content: center; padding: clamp(38px,8vw,120px); background: radial-gradient(circle at 28% 30%,rgba(139,92,246,.18),transparent 23rem); }
.login-brand { display: flex; align-items: center; gap: 12px; color: #e9f1fb; font-size: 15px; font-weight: 850; letter-spacing: .04em; }
.login-copy h1 { margin: 45px 0 25px; color: #fff; font-size: clamp(50px,6vw,88px); line-height: .98; letter-spacing: -.055em; }
.login-copy h1 em { color: transparent; background: linear-gradient(100deg,#a58aff,#56dce9); -webkit-background-clip: text; background-clip: text; font-style: normal; }
.login-copy > p { max-width: 600px; margin: 0; color: #a7b7c9; font-size: clamp(16px,1.5vw,20px); line-height: 1.65; }
.protocol-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 38px; }
.protocol-list span { padding: 7px 11px; border: 1px solid var(--border); border-radius: 999px; background: rgba(20,29,41,.62); color: #9fb0c3; font-family: ui-monospace,monospace; font-size: 11px; }
.login-panel { display: grid; place-items: center; padding: 30px; border-left: 1px solid var(--border-soft); background: rgba(9,14,21,.45); }
.client-login-shell { grid-template-columns: 1fr; }
.client-login-shell .login-panel { border-left: 0; }
.login-card { width: min(100%,450px); padding: 30px; border: 1px solid var(--border); border-radius: 20px; background: linear-gradient(160deg,rgba(22,32,46,.96),rgba(13,20,30,.96)); box-shadow: 0 30px 70px rgba(0,0,0,.38); }
.login-card-header { display: flex; align-items: center; gap: 14px; margin-bottom: 25px; }
.login-card-header h2 { margin: 0; color: #fff; font-size: 24px; }
.login-card-header p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.lock-mark { position: relative; width: 47px; height: 47px; flex: 0 0 47px; border: 1px solid rgba(139,92,246,.42); border-radius: 14px; background: rgba(139,92,246,.13); }
.lock-mark::before { content: ""; position: absolute; left: 13px; bottom: 9px; width: 21px; height: 18px; border-radius: 4px; background: linear-gradient(135deg,#a68aff,#59dcea); }
.lock-mark::after { content: ""; position: absolute; left: 17px; top: 8px; width: 13px; height: 13px; border: 3px solid #a68aff; border-bottom: 0; border-radius: 9px 9px 0 0; }
.login-security { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 18px; color: #778ba0; font-size: 10px; }

.mobile-scrim { display: none; }
@media (max-width: 920px) {
    .login-shell { grid-template-columns: 1fr; }
    .login-copy { min-height: 41vh; padding: 42px 28px; }
    .login-copy h1 { margin: 30px 0 16px; }
    .login-panel { min-height: 59vh; border: 0; border-top: 1px solid var(--border-soft); }
    .sidebar { transform: translateX(-105%); }
    .main, body.sidebar-compact .main { margin-left: 0; }
    body.mobile-menu-open .sidebar { width: min(var(--sidebar),86vw); transform: translateX(0); }
    body.mobile-menu-open .mobile-scrim { position: fixed; inset: 0; z-index: 900; display: block; background: rgba(0,0,0,.58); backdrop-filter: blur(2px); }
    .mobile-menu { width: 38px; height: 38px; display: inline-grid; place-items: center; flex: 0 0 38px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); color: var(--text); cursor: pointer; }
    .sidebar-toggle { display: none; }
    .account-grid { grid-template-columns: 1fr; }
    .span-2 { grid-column: auto; }
}
@media (max-width: 650px) {
    .content { padding: 15px; }
    .topbar { padding: 9px 14px; }
    .secure-pill { display: none; }
    .file-toolbar { align-items: stretch; flex-direction: column; }
    .toolbar-actions { width: 100%; }
    .toolbar-actions > * { flex: 1; }
    .toolbar-actions .button { width: 100%; }
    .file-table th:nth-child(2), .file-table td:nth-child(2) { display: none; }
    .file-table th:nth-child(3), .file-table td:nth-child(3) { width: 76px; }
    .data-table th, .data-table td { padding: 10px; }
    .form-grid { grid-template-columns: 1fr; padding: 15px; }
    .form-grid .span-2 { grid-column: auto; }
    .form-footer { align-items: stretch; flex-direction: column; }
    .inline-form, .key-row { align-items: stretch; flex-direction: column; }
    .admin-table th:nth-child(2), .admin-table td:nth-child(2), .admin-table th:nth-child(4), .admin-table td:nth-child(4) { display: none; }
    .mini-form, .mini-form.key-generator, .mini-form.identity-form { grid-template-columns: 1fr; }
    .mini-form button, .mini-form.key-generator button, .mini-form.identity-form button { grid-column: auto; }
    .identity-note { grid-column: auto; }
    .login-card { padding: 22px; }
    .login-panel { padding: 22px 16px; }
    .editor-card { min-height: calc(100vh - 98px); }
    .editor-toolbar { align-items: stretch; flex-direction: column; }
    .editor-actions { display: grid; grid-template-columns: 1fr 1fr; }
    .editor-actions .button:first-child { grid-column: 1/-1; }
    .editor-status { align-items: flex-start; flex-direction: column; gap: 5px; }
    .editor-area textarea { min-height: 55vh; padding: 14px; font-size: 13px; }
}
