@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --bg: #12151a;
  --bg2: #1a1f27;
  --bg3: #232a34;
  --line: #2e3744;
  --text: #e8edf4;
  --muted: #9aa7b8;
  --accent: #d4a017;
  --accent2: #f0c14b;
  --danger: #e05a5a;
  --ok: #3dbf8a;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --radius: 14px;
  --font: 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(212, 160, 23, 0.12), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(61, 191, 138, 0.08), transparent 45%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { color: var(--accent2); text-decoration: none; }
button, input { font: inherit; }

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(420px, 100%);
  background: linear-gradient(180deg, var(--bg2), #151a21);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 36px 32px 28px;
  box-shadow: var(--shadow);
}
.brand {
  font-weight: 700;
  letter-spacing: 0.02em;
  font-size: 1.35rem;
  margin: 0 0 6px;
}
.brand span { color: var(--accent2); }
.sub {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0 0 28px;
}
label {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0 0 8px;
}
.field { margin-bottom: 16px; }
input[type="text"], input[type="password"] {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 12px 14px;
  outline: none;
}
input:focus { border-color: var(--accent); }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 10px;
  padding: 11px 16px;
  cursor: pointer;
  font-weight: 600;
  transition: transform .12s ease, opacity .12s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  width: 100%;
  background: linear-gradient(180deg, var(--accent2), var(--accent));
  color: #1a1405;
  margin-top: 8px;
}
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}
.btn-danger { background: var(--danger); color: #fff; }
.btn-ok { background: var(--ok); color: #062418; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.alert {
  background: rgba(224, 90, 90, 0.12);
  border: 1px solid rgba(224, 90, 90, 0.35);
  color: #ffb4b4;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}
.alert.ok {
  background: rgba(61, 191, 138, 0.12);
  border-color: rgba(61, 191, 138, 0.35);
  color: #9df0c8;
}

.app {
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 18px 60px;
}
.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.topbar h1 {
  margin: 0;
  font-size: 1.25rem;
}
.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--muted);
  font-family: var(--mono);
}
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger);
}
.dot.on { background: var(--ok); box-shadow: 0 0 0 4px rgba(61,191,138,.15); }

.panel {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,0.02);
}
.crumbs {
  flex: 1;
  min-width: 200px;
  font-family: var(--mono);
  font-size: 0.86rem;
  color: var(--muted);
  word-break: break-all;
}
.crumbs a { color: var(--accent2); }
.crumbs .sep { margin: 0 6px; opacity: .5; }

table.files {
  width: 100%;
  border-collapse: collapse;
}
table.files th, table.files td {
  text-align: start;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}
table.files th {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  background: rgba(0,0,0,.15);
}
table.files tr:hover td { background: rgba(255,255,255,0.02); }
.name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
}
.icon {
  width: 28px; height: 28px; border-radius: 8px;
  display: grid; place-items: center;
  font-size: 0.75rem; font-weight: 700;
  background: var(--bg3); color: var(--muted);
}
.icon.dir { color: var(--accent2); background: rgba(212,160,23,.12); }
.mono { font-family: var(--mono); font-size: 0.84rem; color: var(--muted); }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.actions .btn { padding: 7px 10px; font-size: 0.8rem; }

.modal-bg {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  display: none; place-items: center;
  padding: 20px; z-index: 50;
}
.modal-bg.open { display: grid; }
.modal {
  width: min(440px, 100%);
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px;
  box-shadow: var(--shadow);
}
.modal h3 { margin: 0 0 8px; }
.modal p { color: var(--muted); margin: 0 0 16px; font-size: 0.9rem; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

.empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
}
.footer-note {
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

@media (max-width: 720px) {
  table.files th:nth-child(3),
  table.files td:nth-child(3) { display: none; }
}

.top-actions { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.badge {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: .06em;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(61,191,138,.15);
  color: var(--ok);
  border: 1px solid rgba(61,191,138,.35);
}
.setup-card { width: min(480px, 100%); }
.qrbox {
  width: 196px; height: 196px;
  margin: 0 auto 16px;
  padding: 8px;
  background: #fff;
  border-radius: 12px;
  display: grid; place-items: center;
}
.qrbox img { display:block; }
.secret-line { text-align:center; word-break:break-all; margin: 0 0 16px; }
.backup-box {
  background: var(--bg3);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 0.85rem;
}
.backup-box ul { margin: 8px 0 0; padding: 0 18px; columns: 2; }
.backup-box li { margin-bottom: 4px; }

.dropzone {
  margin: 0 16px 12px;
  border: 1.5px dashed var(--line);
  border-radius: 12px;
  padding: 22px 16px;
  text-align: center;
  color: var(--muted);
  transition: border-color .15s, background .15s;
  cursor: pointer;
}
.dropzone p { margin: 0; font-size: 0.9rem; }
.dropzone.active, .dropzone:hover {
  border-color: var(--accent);
  background: rgba(212,160,23,.06);
  color: var(--text);
}
.progress-wrap { margin-top: 14px; }
.progress {
  height: 6px;
  background: var(--bg3);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 6px;
}
.progress i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--ok));
  border-radius: 999px;
  transition: width .2s ease;
}
.progress i.indeterminate {
  width: 40% !important;
  animation: indet 1.1s ease-in-out infinite;
}
@keyframes indet {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(280%); }
}
.toolbar .btn-primary { width: auto; margin-top: 0; }
.modal label { margin-top: 4px; }
.modal input[type="text"],
.modal input[type="url"],
.modal input[type="password"] {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 12px 14px;
  outline: none;
  margin-bottom: 4px;
}
