:root {
  color-scheme: dark;
  --bg: #10141c;
  --panel: #171d27;
  --panel-2: #1c2430;
  --line: #2b3442;
  --text: #eef2f8;
  --muted: #8c98a9;
  --accent: #9c7bff;
  --accent-2: #7354e8;
  --green: #63d7aa;
  --red: #ff777e;
  font-family: "Segoe UI", Arial, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--bg); color: var(--text); }
button, input, select { font: inherit; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
.boot { min-height: 100vh; display: flex; gap: 14px; align-items: center; justify-content: center; color: var(--muted); }
.brand-mark { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 12px; background: linear-gradient(140deg, #ab91ff, #704fe6); color: white; font: 800 24px "Segoe UI", sans-serif; box-shadow: 0 8px 26px #7956ed44; }
.brand-lockup { display: flex; align-items: center; gap: 12px; }
.brand-lockup strong { display: block; font: 800 13px "Segoe UI", sans-serif; letter-spacing: .13em; }
.brand-lockup small { display: block; color: var(--muted); margin-top: 3px; font-size: 11px; }
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 28px 16px; background: radial-gradient(ellipse at 50% 0%, #312656 0, transparent 48%), var(--bg); }
.auth-card { width: min(100%, 430px); padding: 36px; border: 1px solid var(--line); border-radius: 18px; background: #171d27f5; box-shadow: 0 24px 90px #0006; }
.auth-card .brand-lockup { margin-bottom: 42px; }
.eyebrow { color: #aa96ef; font-size: 10px; font-weight: 700; letter-spacing: .16em; }
h1, h2, h3, p { margin-top: 0; }
.auth-card h1 { margin: 10px 0 8px; font: 700 27px "Segoe UI", sans-serif; letter-spacing: -.04em; }
.muted, .page-heading p, .section-heading p { color: var(--muted); font-size: 13px; line-height: 1.65; }
.form-stack { display: grid; gap: 17px; margin-top: 26px; }
.form-stack label, .key-label { display: grid; gap: 8px; color: #d6deea; font-size: 12px; font-weight: 600; }
.form-stack input, .key-label input, .select-wrap select { width: 100%; height: 43px; padding: 0 13px; border: 1px solid #303a49; border-radius: 8px; outline: 0; background: #111720; color: var(--text); transition: border-color .16s, box-shadow .16s; }
.form-stack input:focus, .key-label input:focus, .select-wrap select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #9c7bff22; }
.hint { margin-left: 5px; color: var(--muted); font-weight: 400; }
.button { min-height: 38px; padding: 0 14px; border: 1px solid transparent; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; cursor: pointer; font-size: 12px; font-weight: 700; transition: background .16s, transform .16s, border-color .16s; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { opacity: .55; cursor: wait; }
.button-primary { background: linear-gradient(135deg, #9877ff, #7454e7); color: white; box-shadow: 0 5px 16px #7150df35; }
.button-primary:hover:not(:disabled) { background: linear-gradient(135deg, #a68aff, #8263f4); }
.button-secondary { border-color: #343e4d; background: #202834; color: #d9e0ea; }
.button-secondary:hover:not(:disabled) { border-color: #59677b; background: #26313e; }
.form-error { min-height: 16px; margin: -5px 0 0; color: var(--red); font-size: 12px; }
.auth-foot { margin: 25px 0 0; padding-top: 17px; border-top: 1px solid var(--line); color: #737f90; font-size: 11px; line-height: 1.6; }
.layout { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 3; width: 240px; display: flex; flex-direction: column; padding: 25px 16px 16px; border-right: 1px solid #252d39; background: #131821; }
.sidebar > .brand-lockup { padding: 0 10px 37px; }
.sidebar-label { padding: 0 12px; color: #667284; font-size: 9px; font-weight: 700; letter-spacing: .16em; }
.nav-list { display: grid; gap: 6px; margin-top: 13px; }
.nav-item { width: 100%; height: 42px; padding: 0 12px; display: flex; align-items: center; gap: 11px; border: 0; border-radius: 8px; background: transparent; color: #9ba6b7; text-align: left; font-size: 12px; cursor: pointer; }
.nav-item:hover { background: #202733; color: var(--text); }
.nav-item.active { background: #28223f; color: #c1aeff; font-weight: 600; }
.nav-icon { width: 18px; color: #8e9aad; font-size: 16px; text-align: center; }
.nav-item.active .nav-icon { color: #ad94ff; }
.nav-count { margin-left: auto; color: #768397; font-size: 10px; }
.sidebar-bottom { margin-top: auto; }
.storage-card { display: flex; align-items: center; gap: 12px; margin-bottom: 17px; padding: 13px; border: 1px solid #2b3340; border-radius: 10px; background: #191f29; }
.storage-icon { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 8px; background: #283426; color: var(--green); }
.storage-card strong, .storage-card small, .profile strong, .profile small { display: block; }
.storage-card strong { font-size: 12px; }
.storage-card small, .profile small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.profile { display: flex; align-items: center; gap: 10px; padding: 13px 5px 0; border-top: 1px solid #29313d; }
.avatar { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: #34445a; color: #dce5f2; font-size: 12px; font-weight: 700; }
.profile strong { max-width: 110px; overflow: hidden; color: #dfe5ee; font-size: 11px; text-overflow: ellipsis; }
.icon-button { width: 33px; height: 33px; display: inline-grid; place-items: center; border: 1px solid transparent; border-radius: 7px; background: transparent; color: #96a2b3; cursor: pointer; font-size: 16px; }
.icon-button:hover { border-color: #394454; background: #262f3c; color: white; }
.icon-button.danger:hover { border-color: #67363d; background: #3a242b; color: var(--red); }
.logout-button { margin-left: auto; font-size: 18px; }
.main { min-height: 100vh; margin-left: 240px; }
.topbar { height: 62px; padding: 0 38px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #252d39; background: #121720; }
.breadcrumbs { display: flex; align-items: center; gap: 10px; color: #818d9e; font-size: 11px; }
.breadcrumbs i { color: #4c5766; font-style: normal; }
.breadcrumbs strong { color: #dce2eb; font-weight: 600; }
.secure-badge { display: flex; align-items: center; gap: 7px; color: #94a1b0; font-size: 10px; }
.secure-badge span, .status-pill i { width: 6px; height: 6px; display: inline-block; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px #63d7aa66; }
.content { width: min(100%, 1230px); margin: 0 auto; padding: 35px 38px 56px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 27px; }
.page-heading h1 { margin: 7px 0 5px; font: 700 26px "Segoe UI", sans-serif; letter-spacing: -.04em; }
.page-heading p { margin-bottom: 0; }
.page-heading > .button { min-height: 40px; }
.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.stat-card { min-height: 133px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 11px; background: linear-gradient(150deg, #1a212d, #171d27); }
.stat-top { display: flex; align-items: center; justify-content: space-between; color: #a2adbd; font-size: 11px; }
.stat-icon { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 7px; font-size: 15px; }
.stat-icon.violet { background: #34284f; color: #b49bff; }
.stat-icon.blue { background: #1e3547; color: #80c4ef; }
.stat-icon.green { background: #233d35; color: #74d8ae; }
.stat-card > strong { display: block; margin-top: 9px; font: 700 24px "Segoe UI", sans-serif; }
.stat-card > small { display: block; margin-top: 3px; color: #778395; font-size: 10px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; margin: 33px 0 15px; }
.section-heading h2 { margin: 0 0 5px; font: 700 15px "Segoe UI", sans-serif; }
.section-heading p { margin: 0; font-size: 11px; }
.text-button { padding: 5px 0; border: 0; background: none; color: #b09aff; cursor: pointer; font-size: 11px; font-weight: 600; }
.text-button span { margin-left: 7px; }
.server-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.server-card { min-width: 0; padding: 17px; border: 1px solid var(--line); border-radius: 10px; background: #171e28; transition: border-color .16s, transform .16s; }
.server-card:hover { transform: translateY(-2px); border-color: #4a3c6d; }
.server-card-top { display: flex; align-items: center; justify-content: space-between; }
.server-mark { width: 34px; height: 34px; display: inline-grid; place-items: center; flex: 0 0 auto; border: 1px solid #493c6c; border-radius: 9px; background: #28213d; color: #b39aff; font-size: 17px; }
.status-pill { display: flex; align-items: center; gap: 6px; padding: 5px 8px; border: 1px solid #29483d; border-radius: 20px; background: #1b302a; color: #8bd1b2; font-size: 9px; }
.status-pill i { width: 5px; height: 5px; }
.server-card h3 { margin: 16px 0 4px; overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.server-slug { margin: 0; color: #798596; font: 10px ui-monospace, monospace; }
.server-card-meta { display: flex; gap: 18px; margin: 17px 0 13px; color: #96a2b2; font-size: 10px; }
.server-open { width: 100%; padding: 11px 0 0; display: flex; align-items: center; justify-content: space-between; border: 0; border-top: 1px solid #2b3441; background: none; color: #ad97fa; cursor: pointer; font-size: 10px; font-weight: 600; }
.info-banner { display: flex; gap: 12px; margin-top: 25px; padding: 15px 17px; border: 1px solid #39334e; border-radius: 9px; background: #211e2c; }
.info-icon { width: 19px; height: 19px; display: grid; flex: 0 0 auto; place-items: center; border: 1px solid #8271ae; border-radius: 50%; color: #bdadf4; font: 700 12px serif; }
.info-banner strong { font-size: 11px; }
.info-banner p { margin: 5px 0 0; color: #9692a5; font-size: 10px; line-height: 1.6; }
.server-list { display: grid; gap: 9px; }
.server-row { min-width: 0; padding: 13px 15px; display: flex; align-items: center; gap: 14px; border: 1px solid var(--line); border-radius: 10px; background: #171e28; }
.server-row-name { min-width: 130px; flex: 1; }
.server-row-name strong, .server-row-name small, .server-row-count strong, .server-row-count small { display: block; }
.server-row-name strong { font-size: 12px; }
.server-row-name small { margin-top: 5px; color: #788496; font: 10px ui-monospace, monospace; }
.server-row-count { min-width: 78px; }
.server-row-count strong { font-size: 11px; }
.server-row-count small { margin-top: 4px; color: #7e8999; font-size: 9px; }
.server-actions { display: flex; align-items: center; gap: 3px; }
.server-actions .button { min-height: 32px; }
.library-toolbar { display: flex; align-items: end; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 10px 10px 0 0; background: #171d27; }
.select-wrap { width: min(260px, 55%); display: grid; gap: 6px; color: #8793a4; font-size: 9px; }
.select-wrap select { height: 35px; padding: 0 10px; font-size: 11px; }
.toolbar-spacer { flex: 1; }
.file-count { padding-bottom: 9px; color: #8d99a9; font-size: 10px; }
.folder-crumbs { min-height: 42px; padding: 0 15px; border: 1px solid var(--line); border-top: 0; background: #151b24; }
.folder-crumbs button { padding: 4px; border: 0; background: none; color: #a998e8; cursor: pointer; font-size: 10px; }
.folder-grid { display: flex; flex-wrap: wrap; gap: 9px; padding: 15px 0 0; }
.folder-card { min-width: 155px; padding: 11px; display: flex; align-items: center; gap: 9px; border: 1px solid #303a48; border-radius: 8px; background: #1a222d; cursor: pointer; text-align: left; }
.folder-card > span { color: #c2a454; font-size: 16px; }
.folder-card strong { min-width: 0; overflow: hidden; flex: 1; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.folder-card small { color: #788497; font-size: 9px; }
.folder-card:hover { border-color: #6b5a9c; }
.upload-zone { min-height: 130px; margin-top: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; border: 1px dashed #465165; border-radius: 10px; background: #151b25; color: #c4cbd7; transition: border .16s, background .16s; }
.upload-zone.dragging { border-color: var(--accent); background: #201d30; }
.upload-icon { width: 29px; height: 29px; display: grid; place-items: center; border: 1px solid #4d436b; border-radius: 8px; background: #28213e; color: #b49cff; font-size: 17px; }
.upload-zone strong { font-size: 11px; }
.upload-zone > span { color: #7f8a9b; font-size: 9px; }
.inline-button { padding: 0; border: 0; background: none; color: #b19bff; cursor: pointer; font-size: inherit; }
.asset-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.asset-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: #171e28; }
.asset-preview { height: 145px; display: grid; place-items: center; overflow: hidden; background: #111720; }
.asset-preview img { width: 100%; height: 100%; object-fit: cover; }
.file-placeholder { width: 53px; height: 53px; display: grid; place-items: center; border: 1px solid #44386b; border-radius: 14px; background: #29213e; color: #c1adff; font: 700 12px "Segoe UI", sans-serif; }
.asset-info { padding: 11px 12px 6px; }
.asset-info strong { display: block; overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.asset-info small { display: block; margin-top: 5px; color: #7f8a9a; font-size: 9px; }
.asset-actions { padding: 8px 10px 10px; display: flex; gap: 6px; }
.asset-actions .button { min-height: 30px; flex: 1; padding: 0 7px; font-size: 9px; }
.empty-state { grid-column: 1 / -1; padding: 34px 18px; border: 1px dashed #394454; border-radius: 10px; background: #161c26; text-align: center; }
.empty-state.compact { margin-top: 15px; }
.empty-illustration { width: 43px; height: 43px; margin: 0 auto 12px; display: grid; place-items: center; border-radius: 12px; background: #29223e; color: #b69fff; font-size: 20px; }
.empty-state h3 { margin: 0 0 6px; font: 600 13px "Segoe UI", sans-serif; }
.empty-state p { margin: 0 0 14px; color: var(--muted); font-size: 10px; }
.empty-state .button { min-height: 34px; }
.modal-backdrop { position: fixed; inset: 0; z-index: 10; padding: 20px; display: grid; place-items: center; overflow-y: auto; background: #05070bd9; backdrop-filter: blur(5px); }
.modal { width: min(100%, 480px); padding: 22px; border: 1px solid #3a4352; border-radius: 13px; background: #1a212c; box-shadow: 0 25px 90px #0009; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.modal-head h2 { margin: 0; font: 700 16px "Segoe UI", sans-serif; }
.modal-body > .muted { margin: 0; }
.modal-body .form-stack { margin-top: 19px; }
.modal-actions { display: flex; justify-content: end; gap: 8px; margin-top: 3px; }
.success-banner { display: flex; gap: 12px; margin: 14px 0 18px; padding: 13px; border: 1px solid #2d5848; border-radius: 8px; background: #1d3129; }
.success-banner > span { width: 23px; height: 23px; display: grid; place-items: center; border-radius: 50%; background: #285d48; color: #8be0b8; }
.success-banner strong { font-size: 11px; }
.success-banner p { margin: 4px 0 0; color: #9ab6a9; font-size: 10px; line-height: 1.5; }
.key-label { margin-bottom: 9px; }
.key-label input { font: 10px ui-monospace, monospace; }
.full-button { width: 100%; }
.config-box { margin-top: 16px; padding: 13px; border: 1px solid #343d4a; border-radius: 8px; background: #121821; }
.config-box strong { display: block; margin-bottom: 9px; font-size: 10px; }
.config-box code { color: #b4a1f2; font: 9px/1.8 ui-monospace, monospace; overflow-wrap: anywhere; }
.toast { position: fixed; right: 22px; bottom: 20px; z-index: 20; max-width: min(420px, calc(100vw - 32px)); padding: 12px 16px; border: 1px solid #3f4a5b; border-radius: 8px; background: #202936; box-shadow: 0 10px 35px #0006; color: #e7edf5; font-size: 11px; opacity: 0; pointer-events: none; transform: translateY(8px); transition: opacity .2s, transform .2s; }
.toast-visible { opacity: 1; transform: translateY(0); }
.toast-error { border-color: #754148; background: #38252d; color: #ffc2c4; }

@media (max-width: 900px) {
  .sidebar { width: 205px; }
  .main { margin-left: 205px; }
  .content { padding-right: 24px; padding-left: 24px; }
  .topbar { padding: 0 24px; }
  .asset-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .server-row { gap: 9px; }
}

@media (max-width: 650px) {
  .sidebar { position: static; width: auto; height: auto; padding: 12px 15px; display: block; border-right: 0; border-bottom: 1px solid #252d39; }
  .sidebar > .brand-lockup { padding: 0 3px 12px; }
  .sidebar-label, .sidebar-bottom { display: none; }
  .nav-list { display: flex; gap: 4px; margin: 0; overflow-x: auto; }
  .nav-item { width: auto; height: 36px; flex: 1; justify-content: center; gap: 6px; white-space: nowrap; }
  .nav-count { margin-left: 0; }
  .main { margin-left: 0; }
  .topbar { height: 46px; padding: 0 16px; }
  .content { padding: 24px 15px 40px; }
  .page-heading { align-items: start; flex-direction: column; gap: 14px; }
  .page-heading h1 { font-size: 23px; }
  .stats-grid { grid-template-columns: 1fr; gap: 9px; }
  .stat-card { min-height: 103px; }
  .server-grid { grid-template-columns: 1fr; }
  .server-row { flex-wrap: wrap; }
  .server-row-name { min-width: calc(100% - 60px); }
  .server-row-count { flex: 1; padding-left: 48px; }
  .server-actions { width: 100%; justify-content: end; }
  .library-toolbar { flex-wrap: wrap; }
  .select-wrap { width: 100%; }
  .toolbar-spacer { display: none; }
  .file-count { margin-left: auto; }
  .asset-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .asset-preview { height: 115px; }
  .asset-actions .button { font-size: 8px; }
  .auth-card { padding: 27px 22px; }
}

@media (max-width: 390px) {
  .asset-grid { grid-template-columns: 1fr; }
  .secure-badge { font-size: 0; }
}
