:root {
  --bg: #141414;
  --surface: #1c1c1c;
  --surface2: #202020;
  --surface3: #272727;
  --border: #2c2c2c;
  --border2: #333333;
  --text: #d4d4d4;
  --text-dim: #5a5a5a;
  --text-mid: #888888;
  --accent: #5b8ef0;
  --accent-dim: rgba(91,142,240,0.08);
  --green: #4caf82;
  --red: #e05555;
  --red-dim: rgba(224,85,85,0.09);
  --mono: 'IBM Plex Mono', monospace;
  --sans: 'Inter', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 780px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

/* ── HEADER ── */
header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 36px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.logo {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.03em;
}

.logo span { color: var(--text-mid); font-weight: 400; }

.dot {
  width: 6px;
  height: 6px;
  background: var(--green);
  border-radius: 50%;
  margin-left: auto;
}

/* ── LABEL ── */
.label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

/* ── DROP ZONE ── */
.drop-zone {
  border: 1px dashed var(--border2);
  border-radius: 10px;
  padding: 32px;
  text-align: center;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  margin-bottom: 10px;
  position: relative;
}

.drop-zone:hover,
.drop-zone.drag {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.drop-zone-title {
  font-size: 13px;
  color: var(--text-mid);
  margin-bottom: 4px;
}

.drop-zone-sub {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
}

.file-selected {
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-mid);
}

.progress-wrap {
  height: 2px;
  background: var(--border);
  border-radius: 99px;
  margin-top: 14px;
  overflow: hidden;
  display: none;
}

.progress-bar {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.2s;
}

/* ── FORM ROW ── */
.form-row {
  display: flex;
  gap: 8px;
  margin-bottom: 28px;
}

.id-box {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  flex: 1.3;
  transition: border-color 0.15s;
}

.id-box:focus-within { border-color: var(--accent); }

.id-pre {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  padding: 9px 0 9px 10px;
  white-space: nowrap;
  user-select: none;
  pointer-events: none;
}

.id-box input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  padding: 9px 10px 9px 3px;
  flex: 1;
  min-width: 0;
}

.id-box input::placeholder { color: var(--text-dim); }

input.field {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  padding: 9px 11px;
  flex: 1;
  transition: border-color 0.15s;
}

input.field:focus { border-color: var(--accent); }
input.field::placeholder { color: var(--text-dim); }

button.upload {
  background: var(--surface3);
  border: 1px solid var(--border2);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  padding: 9px 18px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}

button.upload:hover { background: var(--border); border-color: var(--border2); }
button.upload:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── DIVIDER ── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 0 0 20px;
}

/* ── CARD LIST ── */
#vault {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.15s;
}

.card:hover { border-color: var(--border2); }

.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-slug {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 1px;
}

.card-info { flex: 1; min-width: 0; }

.card-date {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  flex-shrink: 0;
}

.card-actions {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
}

.act {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.13s, border-color 0.13s, background 0.13s;
}

.act svg { width: 13px; height: 13px; }
.act:hover { color: var(--text); border-color: var(--border2); background: var(--surface3); }
.act.del:hover { color: var(--red); border-color: var(--red); background: var(--red-dim); }

/* ── LOADSTRING ── */
.ls-row {
  display: flex;
  align-items: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
}

.ls-text {
  flex: 1;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  padding: 7px 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: all;
}

.ls-copy {
  background: transparent;
  border: none;
  border-left: 1px solid var(--border);
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 10px;
  padding: 7px 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  transition: color 0.13s, background 0.13s;
  flex-shrink: 0;
}

.ls-copy svg { width: 12px; height: 12px; }
.ls-copy:hover { color: var(--text); background: var(--surface3); }
.ls-copy.ok { color: var(--green); }

/* ── EMPTY ── */
.empty {
  font-size: 12px;
  color: var(--text-dim);
  font-family: var(--mono);
  text-align: center;
  padding: 40px 0;
  border: 1px dashed var(--border);
  border-radius: 10px;
}

/* ── TOAST ── */
#toast {
  position: fixed;
  bottom: 20px;
  right: 18px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text-mid);
  font-family: var(--mono);
  font-size: 12px;
  padding: 9px 14px;
  border-radius: 8px;
  z-index: 999;
  opacity: 0;
  transform: translateY(5px);
  transition: opacity 0.18s, transform 0.18s;
  pointer-events: none;
  max-width: 300px;
}

#toast.show { opacity: 1; transform: translateY(0); }
#toast.ok { color: var(--green); border-color: rgba(76,175,130,0.3); }
#toast.err { color: var(--red); border-color: rgba(224,85,85,0.3); }

@media (max-width: 580px) {
  .form-row { flex-direction: column; }
  .card-date { display: none; }
}
