:root {
  --black: #050607;
  --glass: rgba(0, 0, 0, 0.7);
  --glass-hover: rgba(8, 9, 11, 0.82);
  --line: rgba(255, 255, 255, 0.16);
  --line-soft: rgba(255, 255, 255, 0.08);
  --text: #f5f7f5;
  --muted: #a4a9ad;
  --accent: #d8dce0;
  --accent-dark: #08090a;
  --danger: #ff979a;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--black); }
body {
  position: relative;
  display: flow-root;
  min-height: 100vh;
  margin: 0;
  background-color: #070809;
  background-image: url('/assets/vault-backdrop-dark.webp');
  background-position: center top;
  background-size: cover;
  background-repeat: no-repeat;
  color: var(--text);
  font: 14px Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}
body::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(110deg, rgba(0, 0, 0, 0.44), rgba(0, 0, 0, 0.1) 52%, rgba(0, 0, 0, 0.5));
}

.app-frame {
  position: relative;
  z-index: 1;
  width: min(1500px, calc(100% - 120px));
  margin: 58px auto;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 24px;
  background: rgba(0, 0, 0, 0.84);
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 -1px 0 rgba(255, 255, 255, 0.035);
}
.app-frame::before,
.login-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 150px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,.075), transparent);
  opacity: .45;
}
.window-bar {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 110px 1fr 110px;
  align-items: center;
  height: 48px;
  padding: 0 20px;
  border-bottom: 1px solid rgba(255,255,255,.09);
  background: rgba(255,255,255,.035);
  color: #858c91;
  font-size: 10px;
  text-align: center;
}
.window-controls, .mini-controls { display: flex; align-items: center; gap: 7px; }
.window-controls i, .mini-controls i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #64686c;
  box-shadow: inset 0 1px rgba(255,255,255,.24);
}
.window-controls i:nth-child(2), .mini-controls i:nth-child(2) { background: #858a8f; }
.window-controls i:nth-child(3), .mini-controls i:nth-child(3) { background: #b4b8bc; }
.window-bar small {
  color: #7b858b;
  font: 9px ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .12em;
  text-transform: uppercase;
}

header, main { position: relative; z-index: 1; max-width: 1360px; margin: auto; padding-inline: 36px; }
header { display: flex; align-items: flex-end; justify-content: space-between; padding-top: 38px; padding-bottom: 28px; }
.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font: 10px ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .17em;
  text-transform: uppercase;
}
h1, h2, p { margin-top: 0; }
header h1, .login-card h1 { margin: 0; font-size: clamp(30px, 4vw, 46px); font-weight: 600; line-height: .98; }
h1 span { color: var(--accent); }
h2 { margin: 0; font-size: 19px; font-weight: 600; }
.header-actions { display: flex; align-items: center; gap: 14px; }
.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #c2c8c9;
  font: 9px ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.status-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #c5c9cc; box-shadow: 0 0 8px rgba(255,255,255,.28); }
main { display: grid; gap: 14px; padding-bottom: 38px; }
.view { display: grid; gap: 22px; }

.stats { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }
.stat, .panel, .login-card {
  border: 1px solid var(--line);
  background: var(--glass);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.09), 0 8px 20px rgba(0,0,0,.16);
}
.stat {
  min-height: 116px;
  padding: 17px;
  border-radius: 12px;
  color: var(--text);
  text-align: left;
  transition: border-color .18s ease, background .18s ease;
}
.stat:hover { border-color: rgba(255,255,255,.28); background: var(--glass-hover); }
.stat.active { border-color: rgba(255,255,255,.72); background: rgba(11,12,14,.86); box-shadow: inset 0 1px rgba(255,255,255,.11), 0 0 0 1px rgba(255,255,255,.08); }
.stat strong { display: block; margin: 11px 0 5px; color: #fff; font-size: 23px; }
.stat[data-card="storage"] strong { font-size: 18px; white-space: nowrap; }
.stat small { color: var(--muted); font: 9px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .1em; text-transform: uppercase; }
.panel { padding: 23px; border-radius: 14px; }
.upload-panel { display: grid; grid-template-columns: 1fr 1.8fr; align-items: center; gap: 24px; }
.panel-copy { max-width: 310px; margin: 11px 0 0; color: var(--muted); font-size: 12px; line-height: 1.68; }
.dropzone {
  display: grid;
  min-height: 144px;
  place-content: center;
  gap: 10px;
  padding: 24px;
  border: 1px dashed rgba(255,255,255,.28);
  border-radius: 10px;
  background: rgba(0,0,0,.19);
  color: #d7dcdd;
  text-align: center;
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
.dropzone:hover, .dropzone.drag { border-color: rgba(255,255,255,.68); background: rgba(255,255,255,.035); }
.dropzone input { display: none; }
.dropzone b { color: var(--accent); font-weight: 600; }
.dropzone small { color: var(--muted); font-size: 10px; }
.progress { grid-column: 2; height: 2px; overflow: hidden; background: rgba(255,255,255,.08); }
.progress i { display: block; width: 0; height: 100%; background: #d8dce0; transition: width .15s; }
.upload-panel .message { grid-column: 2; }
.message { min-height: 18px; margin: 0; color: #b8c0c1; font-size: 12px; }
.message.error { color: var(--danger); }

.toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.controls, .actions { display: flex; gap: 7px; }
input, select, button { font: inherit; }
input, select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: none;
  background: rgba(0,0,0,.28);
  color: var(--text);
  transition: border-color .18s, background .18s;
}
input:focus, select:focus { border-color: rgba(255,255,255,.62); background: rgba(0,0,0,.58); }
button {
  padding: 10px 14px;
  border: 1px solid var(--accent);
  border-radius: 7px;
  background: var(--accent);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background .18s;
}
button:hover { background: #f2f4f5; }
button.quiet, .filters button, .actions button { border-color: var(--line); background: rgba(0,0,0,.18); color: #dce0e1; }
.filters { display: flex; gap: 7px; margin: 22px 0 13px; }
.filters button { padding: 7px 11px; font-size: 11px; }
.filters button.active { border-color: rgba(255,255,255,.68); background: rgba(255,255,255,.09); color: #fff; }
.table-wrap { overflow: auto; border: 1px solid var(--line-soft); border-radius: 10px; background: rgba(0,0,0,.15); }
table { width: 100%; min-width: 1110px; border-collapse: collapse; }
th, td { padding: 13px 12px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: middle; }
th { background: rgba(0,0,0,.22); color: #92999e; font: 9px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .11em; text-transform: uppercase; }
td { color: #d1d5d6; font-size: 12px; }
tbody tr { transition: background .16s; }
tbody tr:hover { background: rgba(255,255,255,.035); }
.file { display: flex; align-items: center; gap: 10px; max-width: 240px; }
.thumb { width: 42px; height: 34px; border: 1px solid var(--line); border-radius: 4px; object-fit: cover; }
.icon { display: grid; width: 42px; height: 34px; place-items: center; border: 1px solid var(--line); border-radius: 4px; color: var(--accent); font: 9px ui-monospace, SFMono-Regular, Menlo, monospace; }
.filename { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share { color: var(--accent); font-size: 11px; text-decoration: none; }
.share:hover { text-decoration: underline; }
.actions button { padding: 5px 7px; font-size: 10px; }
.actions .delete { color: var(--danger); }
.empty { padding: 42px; color: var(--muted); text-align: center; }

[hidden] { display: none !important; }
.view-tabs { display: flex; gap: 6px; }
.view-tabs button.active { border-color: rgba(255,255,255,.68); background: rgba(255,255,255,.1); color: #fff; }
.repo-layout { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 14px; align-items: start; }
.repo-sidebar { display: grid; gap: 20px; }
.compact-form { display: grid; gap: 12px; }
.compact-form button { width: 100%; }
.repo-list { display: grid; gap: 7px; }
.repo-list-item, .repo-file { width: 100%; border: 1px solid var(--line-soft); border-radius: 7px; background: rgba(0,0,0,.16); color: var(--text); text-align: left; }
.repo-list-item { display: grid; gap: 5px; padding: 12px; }
.repo-list-item:hover, .repo-file:hover { border-color: rgba(255,255,255,.36); background: rgba(255,255,255,.04); }
.repo-list-item.active, .repo-file.active { border-color: rgba(255,255,255,.65); background: rgba(255,255,255,.08); }
.repo-list-item span, .repo-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 700; }
.repo-list-item small, .repo-file small, .repo-file-list-heading small { color: var(--muted); font: 9px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .07em; }
.repo-list-empty { padding: 18px; }
.repo-workspace { min-height: 660px; }
.repo-empty { padding: 16px 0; }
.repo-toolbar { align-items: flex-start; }
.repo-description { max-width: 520px; margin-top: 10px; }
.repo-actions { display: flex; gap: 8px; margin: 24px 0 14px; }
.repo-browser { display: grid; grid-template-columns: 310px minmax(0, 1fr); min-height: 460px; border: 1px solid var(--line-soft); border-radius: 10px; overflow: hidden; background: rgba(0,0,0,.14); }
.repo-file-list { overflow: auto; border-right: 1px solid var(--line-soft); padding: 9px; }
.repo-file-list-heading { display: flex; justify-content: space-between; padding: 8px 9px 12px; color: #c9cecf; font-size: 11px; font-weight: 700; }
.repo-file { display: grid; gap: 5px; margin-bottom: 6px; padding: 10px; }
.repo-editor { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; gap: 12px; min-width: 0; padding: 16px; }
.editor-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.editor-toolbar strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
textarea { width: 100%; min-height: 290px; resize: vertical; border: 1px solid var(--line); border-radius: 7px; outline: none; background: rgba(0,0,0,.42); color: #e7eaec; padding: 12px; font: 12px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; tab-size: 2; }
textarea:focus { border-color: rgba(255,255,255,.62); background: rgba(0,0,0,.6); }
button:disabled { cursor: not-allowed; opacity: .4; }

.auth { display: grid; place-items: center; padding: 28px; }
.login-card { position: relative; z-index: 1; width: min(450px, 100%); overflow: hidden; padding: 31px; border-radius: 20px; background: rgba(0,0,0,.86); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
.login-card > * { position: relative; z-index: 1; }
.mini-controls { margin-bottom: 42px; }
.login-card h1 { margin-bottom: 15px; }
.muted { max-width: 300px; margin-bottom: 30px; color: var(--muted); line-height: 1.68; }
form { display: grid; gap: 16px; }
label { display: grid; gap: 7px; color: #c9cecf; font: 9px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .1em; text-transform: uppercase; }

@media (max-width: 1100px) {
  .app-frame { width: calc(100% - 30px); margin: 15px auto; }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .repo-layout { grid-template-columns: 270px minmax(0, 1fr); }
}
@media (max-width: 680px) {
  .app-frame { border-radius: 14px; }
  .window-bar { grid-template-columns: 70px 1fr 0; }
  .window-bar small { display: none; }
  header, main { padding-inline: 17px; }
  header { align-items: flex-start; padding-top: 27px; }
  .header-actions { flex-direction: column; align-items: flex-end; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .upload-panel { grid-template-columns: 1fr; padding: 17px; }
  .progress, .upload-panel .message { grid-column: auto; }
  .toolbar { align-items: flex-start; flex-direction: column; }
  .controls { width: 100%; }
  .controls select { flex: 1; }
  .panel { padding: 17px; }
  .login-card { padding: 25px; }
}
