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

:root {
  --bg: #0e131a;
  --surface: #161d27;
  --surface-2: #1c2530;
  --border: #263140;
  --text: #e7ecf2;
  --muted: #8592a3;
  --accent: #4fd1c5;
  --accent-dim: #2b6f68;
  --warn: #f2a65a;
  --danger: #e5605a;
  --radius: 6px;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --display: 'Space Grotesk', sans-serif;
  --body: 'Inter', sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Layout ---------- */
#app { display: none; height: 100vh; grid-template-columns: 240px 1fr; }
#app.active { display: grid; }

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
}
.brand {
  font-family: var(--display);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.02em;
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 0 6px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.brand .tag { font-family: var(--mono); font-size: 10px; color: var(--accent); background: rgba(79,209,197,.12); padding: 2px 6px; border-radius: 4px; letter-spacing: 0.06em; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius);
  color: var(--muted); text-decoration: none; cursor: pointer;
  font-size: 13.5px; font-weight: 500; margin-bottom: 2px;
  border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: rgba(79,209,197,.1); color: var(--accent); }
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }

.sidebar-footer { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); }
.who { font-size: 12px; color: var(--muted); padding: 0 6px 8px; }
.who strong { color: var(--text); display: block; font-size: 13px; }

main { overflow-y: auto; padding: 32px 40px; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-header h1 { font-family: var(--display); font-size: 22px; margin: 0 0 4px; }
.page-header .sub { color: var(--muted); font-size: 13px; }

/* ---------- Buttons ---------- */
.btn {
  font-weight: 600; font-size: 13px; border-radius: var(--radius);
  padding: 8px 14px; border: 1px solid var(--border); cursor: pointer;
  background: var(--surface-2); color: var(--text); display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); color: #06201d; border-color: var(--accent); }
.btn-primary:hover { background: #6adfd4; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Cards / grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 16px; cursor: pointer; transition: border-color .15s;
}
.card:hover { border-color: var(--accent-dim); }
.card-title { font-family: var(--mono); font-weight: 600; font-size: 14px; margin-bottom: 10px; word-break: break-all; }
.card-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.gauge { height: 5px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.gauge-fill { height: 100%; background: var(--accent); }
.gauge-fill.warn { background: var(--warn); }
.gauge-fill.danger { background: var(--danger); }

/* ---------- Table (manifest style) ---------- */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--border); }
td { padding: 9px 10px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
tr:hover td { background: var(--surface-2); }
.key-cell { font-family: var(--mono); font-size: 12.5px; display: flex; align-items: center; gap: 8px; }
.size-cell, .etag-cell { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

.breadcrumb { font-family: var(--mono); font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.breadcrumb button { background: none; border: none; color: var(--accent); cursor: pointer; font-family: var(--mono); font-size: 13px; padding: 0; }

/* ---------- Forms / modals ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: none; align-items: center; justify-content: center; z-index: 50; }
.modal-backdrop.active { display: flex; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 24px; width: 380px; max-width: 90vw; }
.modal h2 { font-family: var(--display); font-size: 16px; margin: 0 0 16px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.field input, .field select { width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; color: var(--text); font-size: 13px; }
.field input:focus, .field select:focus { border-color: var(--accent); outline: none; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.error-text { color: var(--danger); font-size: 12.5px; margin-top: 8px; }
.hint { color: var(--muted); font-size: 12px; margin-top: 6px; }

/* ---------- Login ---------- */
#login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { width: 340px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 32px; }
.login-brand { font-family: var(--display); font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.login-sub { color: var(--muted); font-size: 12.5px; margin-bottom: 24px; }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty svg { width: 40px; height: 40px; margin-bottom: 12px; opacity: .5; }
.empty p { font-size: 13.5px; }

/* ---------- Misc ---------- */
.pill { font-family: var(--mono); font-size: 11px; padding: 2px 7px; border-radius: 10px; background: var(--surface-2); color: var(--muted); }
.pill.ok { color: var(--accent); background: rgba(79,209,197,.1); }
.pill.bad { color: var(--danger); background: rgba(229,96,90,.1); }
.secret-box { font-family: var(--mono); font-size: 12px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; word-break: break-all; margin: 8px 0; }
.toast { position: fixed; bottom: 20px; right: 20px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; font-size: 13px; z-index: 100; box-shadow: 0 4px 20px rgba(0,0,0,.4); }
.upload-drop { border: 1.5px dashed var(--border); border-radius: 8px; padding: 24px; text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 16px; cursor: pointer; }
.upload-drop:hover, .upload-drop.dragover { border-color: var(--accent); color: var(--text); }
