/* ── BDA Vault – Styles ──────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --primary:    #ffffff;
  --primary-2:  #f5f5f7;
  --accent:     #0071e3;
  --accent-dim: rgba(0,113,227,.08);
  --bg:         #f5f5f7;
  --surface:    #ffffff;
  --surface-2:  #f2f2f7;
  --border:     rgba(0,0,0,.08);
  --border-hi:  rgba(0,0,0,.14);
  --text:       #1d1d1f;
  --muted:      #6e6e73;
  --radius:     8px;
  --radius-lg:  14px;
  --shadow:     0 1px 4px rgba(0,0,0,.08), 0 0 0 .5px rgba(0,0,0,.06);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.1),  0 0 0 .5px rgba(0,0,0,.06);
}

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

/* ── Custom scrollbar ── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,.15); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,.25); }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.2); }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Fade-in for app content after login ── */
@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
.app-fade-in header,
.app-fade-in main,
.app-fade-in footer {
  animation: fade-in .4s ease-out both;
}
.app-fade-in main  { animation-delay: .05s; }
.app-fade-in footer { animation-delay: .1s; }

/* ── Header ── */
.version-label {
  color: #888;
  -webkit-text-fill-color: #888;
  background: none;
  font-size: .55em;
  font-weight: 700;
  letter-spacing: .15em;
  vertical-align: middle;
}

header {
  background: linear-gradient(180deg, #0f1e33 0%, var(--primary) 100%);
  color: #fff;
  padding: 0 2rem;
  box-shadow: 0 1px 0 var(--border), 0 4px 24px rgba(0,0,0,.5);
  border-bottom: 1px solid rgba(212,164,58,.3);
  position: sticky;
  top: 0;
  z-index: 100;
}

header::after { display: none; }

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 0;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: .85rem;
}

.brand-logo {
  height: 44px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(212,164,58,.2));
  transition: filter .3s ease;
}
.brand-logo:hover {
  filter: drop-shadow(0 0 12px rgba(212,164,58,.5)) drop-shadow(0 0 24px rgba(212,164,58,.2));
}

.brand h1 {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  background: linear-gradient(135deg, #fff 40%, rgba(212,164,58,.8));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;

}

.brand-sub {
  font-size: .62rem;
  color: rgba(255,255,255,.35);
  letter-spacing: .18em;
  text-transform: uppercase;
  font-family: 'Courier New', monospace;
  margin-top: .1rem;
}

/* Stats */
.revit-stats-bar {
  padding: .85rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: .25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.refresh-btn {
  background: none; border: 1px solid rgba(128,128,128,.2); border-radius: 5px;
  width: 1.8rem; height: 1.8rem; font-size: 1rem; cursor: pointer;
  color: var(--muted); display: flex; align-items: center; justify-content: center;
  transition: all .2s; flex-shrink: 0;
}
.refresh-btn:hover { border-color: var(--accent); color: var(--accent); }
.refresh-btn.spinning { animation: spin .4s ease; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.stats {
  display: flex;
  gap: 0;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  border-left: 1px solid var(--border);
  padding: 0 1.4rem;
}

.stat:first-child {
  border-left: none;
  padding-left: 0;
}

.stat-num {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  color: var(--accent);
  font-feature-settings: 'tnum';
}

.stat-lbl {
  font-size: .6rem;
  color: rgba(255,255,255,.35);
  text-transform: uppercase;
  letter-spacing: .12em;
  margin-top: .25rem;
  font-family: 'Courier New', monospace;
}

/* ── Main ── */
main {
  max-width: 1200px;
  margin: 1.25rem auto;
  padding: 0 2rem;
  flex: 1 0 auto;
  width: 100%;
}

/* ── Table scroll wrapper (horizontal overflow on narrow viewports) ── */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ── Coming soon view ── */
.coming-soon-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: 6rem 2rem;
  color: var(--muted);
}

.coming-soon-view p {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.coming-soon-view span {
  font-size: .85rem;
  letter-spacing: .05em;
}

/* ── Header toolbar row ── */
.header-toolbar {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem 0 .75rem;
  border-top: 1px solid rgba(255,255,255,.07);
  flex-wrap: wrap;
}

/* ── Toolbar ── */
.toolbar {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: .75rem;
  flex-wrap: wrap;
}

#search {
  flex: 1;
  min-width: 200px;
  padding: .6rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: .88rem;
  color: var(--text);
  outline: none;
  box-shadow: var(--shadow);
  transition: border-color .2s, box-shadow .2s;
  font-family: 'Inter', sans-serif;
}

#search::placeholder { color: var(--muted); }

#search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(212,164,58,.1);
}

.dl-btn {
  display: inline-block;
  padding: .2rem .55rem;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border-hi);
  color: var(--muted);
  font-size: .8rem;
  text-decoration: none;
  transition: color .15s, border-color .15s;
}

.dl-btn:hover { color: var(--accent); border-color: var(--accent); }

.filters {
  display: flex;
  gap: .35rem;
}

.filter-btn {
  padding: .45rem 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all .18s;
  font-family: 'Courier New', monospace;
}

.filter-btn:hover {
  border-color: var(--border-hi);
  color: var(--text);
}

.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #0c1526;
  font-weight: 700;
}

/* ── Active tag filter bar ── */
#tag-filter-bar {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .75rem;
  font-size: .85rem;
}

.tag-filter-label {
  color: var(--muted);
  font-family: 'Courier New', monospace;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.tag.tag-active {
  background: var(--accent);
  color: #0f172a;
  font-size: .72rem;
}

.clear-tag-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: .8rem;
  padding: .2rem .4rem;
  border-radius: var(--radius);
  transition: color .15s;
}

.clear-tag-btn:hover { color: var(--text); }

/* ── Table ── */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}

thead th {
  background: linear-gradient(180deg, #0f1e33 0%, var(--primary) 100%);
  color: rgba(255,255,255,.45);
  font-size: .64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .14em;
  padding: .8rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(212,164,58,.25);
  font-family: 'Courier New', monospace;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .15s, box-shadow .2s, transform .2s;
}

tbody tr:last-child { border-bottom: none; }

tbody tr:hover {
  background: var(--surface-2);
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  transform: translateY(-1px);
}

td {
  padding: .85rem 1rem;
  vertical-align: middle;
}

/* ── Name cell ── */
.col-name { min-width: 220px; }

.file-name-wrap {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
}

.file-icon {
  color: var(--accent);
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: .15rem;
  opacity: .8;
}

.file-name {
  display: block;
  font-weight: 600;
  font-family: 'Courier New', monospace;
  font-size: .82rem;
  color: var(--text);
  letter-spacing: .01em;
}

.file-desc {
  display: block;
  font-size: .76rem;
  color: var(--muted);
  margin-top: .2rem;
  line-height: 1.4;
  font-family: 'Inter', sans-serif;
}

/* ── Tags column ── */
.col-tags { min-width: 140px; }

.col-type {
  font-size: .8rem;
  color: var(--muted);
  white-space: nowrap;
  font-family: 'Courier New', monospace;
}

.col-empty { color: var(--border); }

.col-meta {
  color: var(--muted);
  font-size: .78rem;
  white-space: nowrap;
  font-family: 'Courier New', monospace;
}

.col-action { text-align: right; }

/* ── Tags ── */
.tag {
  display: inline-block;
  padding: .2rem .55rem;
  border-radius: 999px;
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-family: 'Courier New', monospace;
}

.tag-blue   { background: rgba(30,58,95,.6);   color: #7bbdff; border: 1px solid rgba(96,165,250,.2); }
.tag-green  { background: rgba(20,67,42,.6);   color: #5de88a; border: 1px solid rgba(74,222,128,.2); }
.tag-amber  { background: rgba(61,38,0,.6);    color: #fbc93a; border: 1px solid rgba(251,191,36,.2); }
.tag-purple { background: rgba(59,7,100,.6);   color: #d8a8ff; border: 1px solid rgba(168,85,247,.2); }
.tag-gray   { background: rgba(80,80,80,.5);   color: #aaa;    border: 1px solid rgba(150,150,150,.2); }

/* Keyword tag pills */
.tag-pill {
  background: rgba(36,51,70,.8);
  color: #7a9ab8;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  cursor: pointer;
  margin: .12rem .15rem .12rem 0;
  transition: background .15s, color .15s, border-color .15s;
  display: inline-block;
  border-radius: 999px;
  border: 1px solid var(--border-hi);
  font-family: 'Inter', sans-serif;
  font-size: .66rem;
  padding: .18rem .5rem;
}

.tag-pill:hover {
  background: var(--accent);
  color: #0c1526;
  border-color: var(--accent);
}

/* ── Download button ── */
.dl-btn {
  display: inline-block;
  padding: .32rem .8rem;
  background: var(--accent-dim);
  color: var(--accent);
  text-decoration: none;
  border-radius: var(--radius);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .06em;
  transition: all .18s;
  white-space: nowrap;
  border: 1px solid rgba(212,164,58,.3);
  font-family: 'Courier New', monospace;
  text-transform: uppercase;
}

.dl-btn:hover {
  background: var(--accent);
  color: #0c1526;
  border-color: var(--accent);
}

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--muted);
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

/* ── Thumbnail column ── */
.col-thumb {
  width: 56px;
  padding: .5rem .5rem .5rem 1rem;
}

.row-thumb {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: block;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}

.row-thumb:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(212,164,58,.15);
}

.row-thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--primary);
  color: var(--accent);
  font-size: 1.1rem;
  opacity: .7;
}

.file-row { cursor: pointer; }

/* ── Category separator rows ── */
.cat-separator-row td {
  padding: .55rem 1rem .3rem;
  border-bottom: 1px solid var(--border);
}

.cat-separator-row:not(:first-child) td {
  padding-top: 1.1rem;
  border-top: 1px solid var(--border);
}

.cat-separator-label {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-family: 'Courier New', monospace;
  opacity: .7;
}

/* ── Modal overlay ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 18, .82);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1.5rem;
  backdrop-filter: blur(6px);
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 80px rgba(0,0,0,.8), 0 0 0 1px rgba(212,164,58,.08);
  border: 1px solid var(--border-hi);
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: modal-in .2s cubic-bezier(.16,1,.3,1);
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(16px) scale(.96); }
  to   { opacity: 1; transform: none; }
}

.modal-close {
  position: absolute;
  top: .75rem;
  right: .75rem;
  background: rgba(255,255,255,.06);
  border: 1px solid var(--border);
  border-radius: 2px;
  width: 2rem;
  height: 2rem;
  font-size: .9rem;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
  z-index: 10;
}

.modal-close:hover { background: rgba(255,255,255,.12); color: var(--text); }

/* Preview area */
.modal-preview {
  background: var(--primary);
  border-radius: 5px 5px 0 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 110px;
  overflow: hidden;
}

.modal-img {
  width: 100%;
  max-height: 160px;
  object-fit: contain;
  display: block;
}

.modal-preview--empty {
  flex-direction: column;
  gap: .5rem;
}

.modal-placeholder-icon {
  font-size: 3rem;
  color: var(--accent);
  opacity: .25;
}

.modal-placeholder-text {
  font-size: .72rem;
  color: var(--muted);
  font-family: 'Courier New', monospace;
  text-transform: uppercase;
  letter-spacing: .1em;
}

/* Modal body */
.modal-body {
  padding: 1.25rem 1.5rem 1.5rem;
}

.modal-header-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: .75rem;
  flex-wrap: wrap;
}

.modal-filename {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
  word-break: break-all;
  font-family: 'Courier New', monospace;
}

.modal-cat-tag { flex-shrink: 0; }

.modal-ver-badge {
  display: inline-block;
  padding: .15rem .42rem;
  border-radius: 2px;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-family: 'Courier New', monospace;
  background: rgba(45,63,85,.7);
  color: #94a3b8;
  border: 1px solid rgba(45,63,85,1);
  flex-shrink: 0;
}

.modal-ver-badge--updated {
  background: rgba(61,38,0,.7);
  color: #fbbf24;
  border-color: rgba(251,191,36,.25);
}

.modal-type-tag {
  font-size: .72rem;
  color: var(--muted);
  flex-shrink: 0;
  font-family: 'Courier New', monospace;
}

.modal-desc {
  color: var(--muted);
  font-size: .88rem;
  line-height: 1.55;
  margin-bottom: .75rem;
}

.modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  margin-bottom: 1rem;
}

.modal-meta {
  display: flex;
  gap: 1.5rem;
  font-size: .72rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
  font-family: 'Courier New', monospace;
}

.modal-dl-btn {
  display: block;
  text-align: center;
  padding: .7rem 1.5rem;
  background: var(--accent);
  border: none;
  color: #0c1526;
  text-decoration: none;
  border-radius: var(--radius);
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  transition: all .18s;
  word-break: break-all;
  font-family: 'Courier New', monospace;
  box-shadow: 0 2px 12px rgba(212,164,58,.2);
}

.modal-dl-btn:hover { background: #e0b445; box-shadow: 0 4px 16px rgba(212,164,58,.3); }

/* ── Edit button ── */
.modal-edit-btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .28rem .65rem;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-family: 'Courier New', monospace;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all .15s;
  margin-left: auto;
}

.modal-edit-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── Edit form ── */
.modal-edit-form {
  display: flex;
  flex-direction: column;
  gap: .7rem;
  margin-bottom: 1rem;
  padding: 1rem;
  background: var(--primary);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.edit-field {
  display: flex;
  flex-direction: column;
  gap: .28rem;
}

.edit-field label {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  font-family: 'Courier New', monospace;
}

.edit-field input,
.edit-field select {
  padding: .45rem .7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  font-size: .88rem;
  outline: none;
  transition: border-color .15s;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.edit-field input:focus,
.edit-field select:focus { border-color: var(--accent); }

.edit-field input:disabled,
.edit-field select:disabled {
  opacity: .4;
  cursor: default;
}

.edit-field select option { background: var(--surface); }

.edit-actions {
  display: flex;
  gap: .6rem;
  justify-content: flex-end;
  margin-top: .2rem;
}

.edit-save-btn {
  padding: .4rem .9rem;
  background: var(--accent);
  color: #0f172a;
  border: none;
  border-radius: var(--radius);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
  font-family: 'Courier New', monospace;
  transition: opacity .15s;
}

.edit-save-btn:hover { opacity: .85; }

.edit-cancel-btn {
  padding: .4rem .9rem;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .72rem;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Courier New', monospace;
  transition: all .15s;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.edit-cancel-btn:hover { color: var(--text); border-color: var(--text); }

.edit-close-btn {
  padding: .4rem .9rem;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .78rem;
  cursor: pointer;
  transition: all .15s;
}
.edit-close-btn:hover { color: #c0392b; border-color: #c0392b; }

/* ── Version history ── */
.modal-history {
  margin-top: 1.25rem;
  border-top: 1px solid var(--border);
  padding-top: .9rem;
}

.history-toggle {
  display: flex;
  align-items: center;
  gap: .45rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-family: 'Courier New', monospace;
  padding: 0;
  transition: color .15s;
}

.history-toggle:hover { color: var(--text); }

.history-toggle-arrow {
  font-size: .55rem;
  transition: transform .2s;
  display: inline-block;
}

.history-toggle-arrow.open { transform: rotate(90deg); }

.history-list {
  margin-top: .75rem;
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

.history-entry {
  display: flex;
  gap: .75rem;
  font-size: .78rem;
  padding: .5rem .6rem;
  background: var(--primary);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.history-ts {
  color: var(--accent);
  font-family: 'Courier New', monospace;
  white-space: nowrap;
  font-size: .68rem;
  padding-top: .05rem;
  flex-shrink: 0;
}

.history-changes {
  color: var(--muted);
  line-height: 1.6;
  font-size: .78rem;
}

.history-change-item strong {
  color: rgba(255,255,255,.5);
  font-family: 'Courier New', monospace;
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-right: .3rem;
}

.history-from {
  text-decoration: line-through;
  opacity: .45;
  margin-right: .25rem;
}

.history-to { color: var(--text); }

/* ── Vault status badge ── */
.vault-status {
  font-size: .68rem;
  font-family: 'Courier New', monospace;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.vault-status--on  { color: #4ade80; }
.vault-status--off { color: var(--muted); }
.vault-status--off:hover { color: var(--accent); }


/* ── Add File button ── */
.add-btn {
  padding: .5rem 1.2rem;
  background: var(--accent);
  color: #0c1526;
  border: none;
  border-radius: var(--radius);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all .18s;
  white-space: nowrap;
  font-family: 'Courier New', monospace;
  box-shadow: 0 2px 12px rgba(212,164,58,.25);
}

.add-btn:hover {
  background: #e0b445;
  box-shadow: 0 4px 18px rgba(212,164,58,.35);
  transform: translateY(-1px);
}

/* ── Upload Modal ── */
.upload-modal {
  max-width: 520px;
  padding: 0;
}

.upload-modal-header {
  padding: 1.25rem 1.5rem .85rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--primary-2) 0%, var(--surface) 100%);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.upload-modal-header h2 {
  font-size: .88rem;
  font-weight: 700;
  color: var(--text);
  font-family: 'Courier New', monospace;
  text-transform: uppercase;
  letter-spacing: .1em;
}

/* Drop zone */
.drop-zone {
  margin: 1.25rem 1.5rem .75rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--primary);
  cursor: pointer;
  transition: border-color .15s, background .15s;
  position: relative;
  overflow: hidden;
}

.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent);
  background: rgba(200,153,42,.05);
}

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

.drop-zone-inner {
  padding: 2rem 1rem;
  text-align: center;
  pointer-events: none;
}

.drop-icon {
  display: block;
  font-size: 2rem;
  color: var(--muted);
  margin-bottom: .5rem;
}

.drop-primary {
  font-size: .9rem;
  color: var(--text);
  margin-bottom: .25rem;
}

.drop-browse {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
}

.drop-secondary {
  font-size: .72rem;
  color: var(--muted);
  font-family: 'Courier New', monospace;
}

/* Selected files list */
.selected-files {
  list-style: none;
  margin: 0 1.5rem .5rem;
  display: flex;
  flex-direction: column;
  gap: .3rem;
}

.selected-files li {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .4rem .7rem;
  font-size: .82rem;
}

.sel-icon { color: var(--accent); }

.sel-name {
  flex: 1;
  font-weight: 500;
  word-break: break-all;
  font-family: 'Courier New', monospace;
  font-size: .78rem;
}

.sel-size {
  color: var(--muted);
  white-space: nowrap;
  font-family: 'Courier New', monospace;
  font-size: .72rem;
}

/* Upload form */
.upload-form {
  padding: .75rem 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .8rem;
}

.upload-field {
  display: flex;
  flex-direction: column;
  gap: .3rem;
}

.upload-field label {
  font-size: .68rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-family: 'Courier New', monospace;
}

.upload-optional {
  font-weight: 400;
  color: var(--muted);
  opacity: .6;
  text-transform: none;
  letter-spacing: 0;
}

.upload-field select,
.upload-field input[type="text"] {
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .88rem;
  color: var(--text);
  background: var(--surface-2);
  outline: none;
  transition: border-color .15s;
}

.upload-field select::placeholder,
.upload-field input[type="text"]::placeholder { color: var(--muted); }

.upload-field select:focus,
.upload-field input[type="text"]:focus { border-color: var(--accent); }

.upload-field select option { background: var(--surface); }

.upload-actions {
  display: flex;
  justify-content: flex-end;
  gap: .6rem;
  margin-top: .25rem;
}

.upload-cancel-btn {
  padding: .48rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  cursor: pointer;
  transition: all .15s;
  font-family: 'Courier New', monospace;
}

.upload-cancel-btn:hover { color: var(--text); border-color: var(--text); }

.upload-submit-btn {
  padding: .48rem 1.25rem;
  background: var(--accent);
  color: #0f172a;
  border: none;
  border-radius: var(--radius);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity .15s;
  font-family: 'Courier New', monospace;
}

.upload-submit-btn:hover  { opacity: .85; }
.upload-submit-btn:disabled { opacity: .4; cursor: default; }

/* Status */
.upload-status {
  margin: 0 1.5rem 1rem;
  padding: .6rem .9rem;
  border-radius: var(--radius);
  font-size: .8rem;
  font-family: 'Courier New', monospace;
}

.upload-status--info    { background: rgba(30,58,95,.4);  color: #60a5fa; border: 1px solid rgba(96,165,250,.2); }
.upload-status--success { background: rgba(20,67,42,.4);  color: #4ade80; border: 1px solid rgba(74,222,128,.2); }
.upload-status--error   { background: rgba(127,29,29,.4); color: #f87171; border: 1px solid rgba(248,113,113,.2); }

/* Manual fallback */
.upload-manual {
  padding: 1.25rem 1.5rem 1.5rem;
}

.upload-manual h3 {
  font-size: .85rem;
  font-weight: 700;
  margin-bottom: .75rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-family: 'Courier New', monospace;
  color: var(--muted);
}

.upload-manual ol {
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .9rem;
  font-size: .85rem;
  line-height: 1.5;
  color: var(--muted);
}

.upload-manual code {
  display: inline-block;
  background: var(--primary);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: .2rem .5rem;
  font-size: .75rem;
  margin: .2rem 0;
  word-break: break-all;
  font-family: 'Courier New', monospace;
  color: var(--accent);
}

.upload-manual pre {
  background: var(--primary);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: .6rem .75rem;
  font-size: .72rem;
  margin: .3rem 0;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--text);
  font-family: 'Courier New', monospace;
}

.copy-btn {
  display: inline-block;
  margin-left: .5rem;
  padding: .15rem .5rem;
  font-size: .68rem;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
  transition: all .15s;
  font-family: 'Courier New', monospace;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.copy-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── Auto-detected badge ── */
.cat-auto-badge {
  display: inline-block;
  font-size: .62rem;
  font-weight: 700;
  background: rgba(20,67,42,.6);
  color: #4ade80;
  padding: .1rem .4rem;
  border-radius: 2px;
  margin-left: .35rem;
  vertical-align: middle;
  font-family: 'Courier New', monospace;
  border: 1px solid rgba(74,222,128,.2);
  text-transform: uppercase;
  letter-spacing: .06em;
}

/* ── Version badge (table column) ── */
.col-version {
  text-align: center;
  white-space: nowrap;
}

.version-badge {
  display: inline-block;
  padding: .15rem .42rem;
  border-radius: 2px;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-family: 'Courier New', monospace;
  background: rgba(45,63,85,.7);
  color: #94a3b8;
  border: 1px solid rgba(45,63,85,1);
  white-space: nowrap;
}

.version-badge--updated {
  background: rgba(61,38,0,.7);
  color: #fbbf24;
  border-color: rgba(251,191,36,.25);
}

/* ── File versions panel (edit modal) ── */
.file-versions {
  margin-top: 1rem;
  border-top: 1px solid var(--border);
  padding-top: .9rem;
}

.file-versions-label {
  display: block;
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  font-family: 'Courier New', monospace;
  margin-bottom: .6rem;
}

.file-version-list {
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

.file-version-item {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .42rem .65rem;
  background: var(--primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.file-version-item--current {
  border-color: rgba(200,153,42,.4);
  background: rgba(200,153,42,.06);
}

.fv-badge {
  font-family: 'Courier New', monospace;
  font-size: .72rem;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
  min-width: 2.2rem;
}

.fv-meta {
  flex: 1;
  color: var(--muted);
  font-size: .72rem;
  font-family: 'Courier New', monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fv-current-label {
  font-size: .6rem;
  color: var(--accent);
  border: 1px solid rgba(200,153,42,.3);
  padding: .1rem .38rem;
  border-radius: 2px;
  font-family: 'Courier New', monospace;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  flex-shrink: 0;
}

.fv-dl {
  font-size: .65rem;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--border);
  padding: .15rem .45rem;
  border-radius: 2px;
  font-family: 'Courier New', monospace;
  text-transform: uppercase;
  letter-spacing: .05em;
  transition: all .15s;
  flex-shrink: 0;
}

.fv-dl:hover { border-color: var(--accent); color: var(--accent); }

.fv-delete-btn {
  flex-shrink: 0;
  background: none;
  border: 1px solid rgba(248,113,113,.25);
  border-radius: 3px;
  color: rgba(248,113,113,.5);
  font-size: .65rem;
  width: 1.6rem;
  height: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .15s;
  font-family: 'Courier New', monospace;
  padding: 0;
}

.fv-delete-btn:hover {
  background: rgba(248,113,113,.1);
  border-color: #f87171;
  color: #f87171;
}

.fv-selectable { cursor: pointer; }
.fv-selectable:hover { background: var(--surface-2); border-color: var(--border); }

.file-version-item--selected {
  border-color: var(--accent) !important;
  background: rgba(200,153,42,.1) !important;
}

.fv-restore-zone {
  margin-top: .6rem;
  padding: .7rem .8rem;
  background: rgba(200,153,42,.07);
  border: 1px solid rgba(200,153,42,.25);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: .45rem;
}

.fv-restore-btn {
  align-self: flex-start;
  padding: .35rem .85rem;
  background: rgba(200,153,42,.15);
  color: var(--accent);
  border: 1px solid rgba(200,153,42,.4);
  border-radius: var(--radius);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
  font-family: 'Courier New', monospace;
  transition: all .15s;
}

.fv-restore-btn:hover   { background: rgba(200,153,42,.28); }
.fv-restore-btn:disabled { opacity: .4; cursor: default; }

.fv-restore-note {
  font-size: .72rem;
  color: var(--muted);
  font-family: 'Courier New', monospace;
  line-height: 1.4;
}

/* ── Delete / archive zone ── */
.delete-zone {
  margin-top: 1rem;
  border-top: 1px solid var(--border);
  padding-top: .9rem;
}

.delete-btn {
  padding: .35rem .8rem;
  background: transparent;
  color: #f87171;
  border: 1px solid rgba(248,113,113,.3);
  border-radius: var(--radius);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
  font-family: 'Courier New', monospace;
  transition: all .15s;
}

.delete-btn:hover {
  background: rgba(248,113,113,.08);
  border-color: #f87171;
}

.delete-confirm {
  margin-top: .65rem;
  padding: .75rem .9rem;
  background: rgba(127,29,29,.2);
  border: 1px solid rgba(248,113,113,.25);
  border-radius: var(--radius);
}

.delete-confirm-msg {
  font-size: .78rem;
  color: #fca5a5;
  margin-bottom: .65rem;
  line-height: 1.5;
}

.delete-confirm-msg code {
  background: rgba(0,0,0,.25);
  border: 1px solid rgba(248,113,113,.2);
  border-radius: 2px;
  padding: .05rem .35rem;
  font-family: 'Courier New', monospace;
  font-size: .75rem;
}

.delete-confirm-actions {
  display: flex;
  gap: .5rem;
  justify-content: flex-end;
}

.delete-confirm-btn {
  padding: .38rem .85rem;
  background: #7f1d1d;
  color: #fecaca;
  border: 1px solid rgba(248,113,113,.35);
  border-radius: var(--radius);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
  font-family: 'Courier New', monospace;
  transition: all .15s;
}

.delete-cancel-btn {
  padding: .38rem .85rem;
  background: transparent;
  color: #888;
  border: 1px solid rgba(150,150,150,.3);
  border-radius: var(--radius);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
  font-family: 'Courier New', monospace;
  transition: all .15s;
}
.delete-cancel-btn:hover { background: rgba(150,150,150,.1); color: #555; }

.delete-confirm-btn:hover   { background: #991b1b; }
.delete-confirm-btn:disabled { opacity: .4; cursor: default; }

.delete-error {
  font-size: .73rem;
  color: #f87171;
  margin-top: .5rem;
  font-family: 'Courier New', monospace;
}

/* ── Footer ── */
footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto 1.5rem;
  padding: 0 2rem;
  color: var(--muted);
  font-size: .68rem;
  width: 100%;
  font-family: 'Courier New', monospace;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.footer-left, .footer-right { flex: 1; }
.footer-center { flex: 1; text-align: center; }
.footer-right { text-align: right; }


/* ── Header — sticky frosted glass ── */
header {
  background: rgba(245,245,247,.82);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(0,0,0,.1);
  box-shadow: none;
  position: sticky;
  top: 0;
  z-index: 50;
}

header::after { display: none; }

.header-toolbar {
  border-top-color: rgba(0,0,0,.07);
}

.brand h1 {
  background: none;
  -webkit-text-fill-color: #1d1d1f;
  color: #1d1d1f;
  font-size: 1.25rem;
  text-shadow: none;
}

.brand-sub  { color: #6e6e73; }
.brand-logo { filter: none; transition: filter .3s ease; }
.brand-logo:hover { filter: drop-shadow(0 0 10px rgba(0,113,227,.25)) drop-shadow(0 0 20px rgba(0,113,227,.1)); }

.stat-num   { color: #0071e3; text-shadow: none; }
.stat-lbl   { color: #6e6e73; }
.stat       { border-left-color: rgba(0,0,0,.08); }

/* ── Table ── */
table {
  box-shadow: var(--shadow-lg);
  border: .5px solid rgba(0,0,0,.08);
}

thead th {
  background: rgba(245,245,247,.9);
  color: #6e6e73;
  border-bottom: .5px solid rgba(0,0,0,.1);
  font-family: -apple-system, 'Inter', sans-serif;
  text-shadow: none;
}

tbody tr:hover { background: rgba(0,113,227,.04); box-shadow: 0 2px 8px rgba(0,0,0,.05); }

.file-name  { color: #1d1d1f; font-family: -apple-system,'Inter',sans-serif; text-shadow: none; }
.file-desc  { color: #6e6e73; font-family: -apple-system,'Inter',sans-serif; }
.col-meta   { color: #6e6e73; font-family: -apple-system,'Inter',sans-serif; }
.col-type   { color: #6e6e73; font-family: -apple-system,'Inter',sans-serif; }

/* ── Tags ── */
.tag-blue   { background: rgba(0,113,227,.1);  color: #0071e3; border: none; border-radius: 6px; }
.tag-green  { background: rgba(52,199,89,.1);  color: #1a8f38; border: none; border-radius: 6px; }
.tag-amber  { background: rgba(255,149,0,.1);  color: #c97500; border: none; border-radius: 6px; }
.tag-purple { background: rgba(175,82,222,.1); color: #9b59b6; border: none; border-radius: 6px; }
.tag-red    { background: rgba(220,38,38,.08); color: #dc2626; border: none; border-radius: 6px; }
.tag-gray   { background: rgba(0,0,0,.05);     color: #6e6e73; border: none; border-radius: 6px; }
.doc-status-approved { background: rgba(22,163,74,.08);  color: #16a34a; border-color: rgba(22,163,74,.2); }
.doc-status-draft    { background: rgba(217,119,6,.08);  color: #b45309; border-color: rgba(217,119,6,.2); }
.doc-status-archived { background: rgba(107,114,128,.08); color: #6b7280; border-color: rgba(107,114,128,.2); }
.dl-btn     { background: rgba(0,0,0,.04); border-color: rgba(0,0,0,.1); color: #6e6e73; }
.dl-btn:hover { color: #0071e3; border-color: #0071e3; }
.tag-pill  { background: rgba(0,0,0,.06); color: #1d1d1f; border: none; border-radius: 999px; }
.tag-pill:hover { background: rgba(0,113,227,.1); color: #0071e3; }
.tag.tag-active { background: #0071e3; color: #fff; }

/* ── Toolbar ── */
#search {
  background: #fff;
  border: .5px solid rgba(0,0,0,.12);
  color: #1d1d1f;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

#search::placeholder { color: #aeaeb2; }
#search:focus {
  border-color: #0071e3;
  box-shadow: 0 0 0 3px rgba(0,113,227,.15);
}

/* ── Filter buttons — macOS segmented control ── */
.filters {
  background: rgba(0,0,0,.06);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}

.filter-btn {
  border: none;
  background: transparent;
  color: #3c3c43;
  border-radius: 999px;
  font-family: -apple-system,'Inter',sans-serif;
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  transition: all .18s;
}

.filter-btn:hover { background: rgba(255,255,255,.5); color: #1d1d1f; }

.filter-btn.active {
  background: #ffffff;
  color: #0071e3;
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0,0,0,.12), 0 0 0 .5px rgba(0,0,0,.06);
}

/* ── Add File button ── */
.add-btn {
  background: #0071e3;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  box-shadow: none;
  font-family: -apple-system,'Inter',sans-serif;
  font-weight: 600;
  letter-spacing: -.01em;
  text-transform: none;
}

.add-btn:hover {
  background: #0077ed;
  box-shadow: 0 2px 8px rgba(0,113,227,.3);
  transform: none;
}

/* ── Download button ── */
.dl-btn {
  background: rgba(0,113,227,.07);
  color: #0071e3;
  border: .5px solid rgba(0,113,227,.2);
  border-radius: 6px;
  font-family: -apple-system,'Inter',sans-serif;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
  font-size: .78rem;
}

.dl-btn:hover { background: #0071e3; color: #fff; border-color: #0071e3; }

/* ── Thumbnail ── */
.row-thumb { border-radius: 8px; border-color: rgba(0,0,0,.08); }
.row-thumb:hover { border-color: #0071e3; box-shadow: 0 0 0 3px rgba(0,113,227,.15); }
.row-thumb-placeholder { border-radius: 8px; background: #f2f2f7; border-color: rgba(0,0,0,.08); color: #0071e3; opacity: 1; }

/* ── Version badges ── */
.version-badge {
  background: rgba(0,0,0,.06);
  color: #6e6e73;
  border: none;
  border-radius: 5px;
}

.version-badge--updated,
.modal-ver-badge--updated {
  background: rgba(0,113,227,.1);
  color: #0071e3;
  border: none;
}

.modal-ver-badge {
  background: rgba(0,0,0,.06);
  color: #6e6e73;
  border: none;
}

/* ── Modal — frosted glass ── */
.modal-overlay {
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal {
  background: rgba(255,255,255,.9);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  box-shadow: 0 24px 64px rgba(0,0,0,.15), 0 0 0 .5px rgba(0,0,0,.1);
  border: none;
}

.modal-preview { background: #f5f5f7; }
.modal-placeholder-icon { color: #0071e3; }
.modal-filename { color: #1d1d1f; }
.modal-desc     { color: #3c3c43; }
.modal-type-tag { color: #6e6e73; }

.modal-dl-btn {
  background: #0071e3;
  color: #ffffff;
  border: none;
  box-shadow: none;
  border-radius: 8px;
  font-family: -apple-system,'Inter',sans-serif;
  font-weight: 600;
  text-transform: none;
  letter-spacing: -.01em;
  font-size: .9rem;
}

.modal-dl-btn:hover { background: #0077ed; box-shadow: 0 2px 8px rgba(0,113,227,.3); }

.modal-btn-row {
  display: flex;
  gap: .75rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(0,0,0,.06);
}
.modal-btn-row .modal-dl-btn { flex: 1; }
.modal-open-btn {
  flex: 1;
  display: block;
  text-align: center;
  padding: .7rem 1rem;
  background: #f5f5f7;
  border: 1.5px solid #0071e3;
  color: #0071e3;
  text-decoration: none;
  border-radius: 8px;
  font-family: -apple-system,'Inter',sans-serif;
  font-weight: 600;
  font-size: .9rem;
  letter-spacing: -.01em;
  transition: all .18s;
}
.modal-open-btn:hover { background: #0071e3; color: #fff; }

.modal-close-btn {
  flex: 0 0 auto;
  padding: .7rem 1rem;
  background: transparent;
  border: 1.5px solid rgba(0,0,0,.14);
  border-radius: 8px;
  color: #6e6e73;
  font-family: -apple-system,'Inter',sans-serif;
  font-weight: 600;
  font-size: .9rem;
  cursor: pointer;
  transition: all .18s;
  white-space: nowrap;
}
.modal-close-btn:hover { border-color: #c0392b; color: #c0392b; }

.modal-preview--pdf {
  min-height: 380px;
  height: 380px;
  background: #fff;
  border-radius: 0;
  padding: 0;
}

.modal-edit-btn {
  border-color: rgba(0,0,0,.12);
  color: #6e6e73;
  border-radius: 6px;
}

.modal-edit-btn:hover { border-color: #0071e3; color: #0071e3; }

.modal-close {
  background: rgba(0,0,0,.06);
  border-color: rgba(0,0,0,.08);
  color: #6e6e73;
}

.modal-close:hover { background: rgba(0,0,0,.1); color: #1d1d1f; }

/* ── Edit form ── */
.modal-edit-form {
  background: rgba(0,0,0,.025);
  border: .5px solid rgba(0,0,0,.08);
}

.edit-field label { color: #6e6e73; }

.edit-field input,
.edit-field select {
  background: #ffffff;
  border: .5px solid rgba(0,0,0,.18);
  color: #1d1d1f;
}

.edit-field input:focus,
.edit-field select:focus {
  border-color: #0071e3;
  box-shadow: 0 0 0 3px rgba(0,113,227,.15);
}

.edit-save-btn {
  background: #0071e3;
  color: #ffffff;
  border-radius: 6px;
  box-shadow: none;
  font-family: -apple-system,'Inter',sans-serif;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
}

.edit-save-btn:hover { opacity: 1; background: #0077ed; }

.edit-cancel-btn {
  border-color: rgba(0,0,0,.14);
  color: #6e6e73;
  font-family: -apple-system,'Inter',sans-serif;
  text-transform: none;
  letter-spacing: 0;
}

.edit-cancel-btn:hover { border-color: rgba(0,0,0,.25); color: #1d1d1f; }

.edit-close-btn {
  border-color: rgba(0,0,0,.14);
  color: #6e6e73;
  font-family: -apple-system,'Inter',sans-serif;
}
.edit-close-btn:hover { color: #c0392b; border-color: #c0392b; }

/* ── Version panel ── */
.file-version-item {
  background: rgba(0,0,0,.025);
  border-color: rgba(0,0,0,.08);
}

.file-version-item--current {
  background: rgba(0,113,227,.05);
  border-color: rgba(0,113,227,.2);
}

.file-version-item--selected {
  border-color: #0071e3 !important;
  background: rgba(0,113,227,.08) !important;
}

.fv-badge        { color: #0071e3; }
.fv-current-label { color: #0071e3; border-color: rgba(0,113,227,.3); }

.fv-restore-zone {
  background: rgba(0,113,227,.05);
  border-color: rgba(0,113,227,.2);
}

.fv-restore-btn {
  background: rgba(0,113,227,.1);
  color: #0071e3;
  border-color: rgba(0,113,227,.3);
}

.fv-restore-btn:hover { background: rgba(0,113,227,.18); }

.fv-dl {
  border-color: rgba(0,0,0,.12);
  color: #6e6e73;
}

.fv-dl:hover { border-color: #0071e3; color: #0071e3; }

.fv-delete-btn {
  border-color: rgba(255,59,48,.2);
  color: rgba(255,59,48,.45);
}

.fv-delete-btn:hover {
  background: rgba(255,59,48,.08);
  border-color: #ff3b30;
  color: #ff3b30;
}

/* ── Delete zone ── */
.delete-btn {
  color: #ff3b30;
  border-color: rgba(255,59,48,.25);
}

.delete-btn:hover { background: rgba(255,59,48,.06); border-color: #ff3b30; }

.delete-confirm {
  background: rgba(255,59,48,.04);
  border-color: rgba(255,59,48,.15);
}

.delete-confirm-btn { background: #ff3b30; border-color: #ff3b30; }
.delete-confirm-btn:hover { background: #e0352b; }

/* ── Upload modal ── */
.upload-modal-header {
  background: rgba(245,245,247,.9);
  border-bottom: .5px solid rgba(0,0,0,.1);
}

.upload-modal-header h2 { color: #1d1d1f; font-family: -apple-system,'Inter',sans-serif; text-transform: none; letter-spacing: -.01em; }

.drop-zone {
  background: #fafafa;
  border-color: rgba(0,0,0,.12);
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: #0071e3;
  background: rgba(0,113,227,.03);
}

.drop-primary  { color: #1d1d1f; font-family: -apple-system,'Inter',sans-serif; }
.drop-secondary { color: #aeaeb2; font-family: -apple-system,'Inter',sans-serif; }
.drop-browse   { color: #0071e3; }

.upload-field label {
  color: #6e6e73;
  font-family: -apple-system,'Inter',sans-serif;
  text-transform: none;
  letter-spacing: 0;
  font-size: .72rem;
  font-weight: 600;
}

.upload-field select,
.upload-field input[type="text"] {
  background: #ffffff;
  border: .5px solid rgba(0,0,0,.18);
  color: #1d1d1f;
}

.upload-field select:focus,
.upload-field input[type="text"]:focus {
  border-color: #0071e3;
  box-shadow: 0 0 0 3px rgba(0,113,227,.15);
}

.upload-submit-btn {
  background: #0071e3;
  color: #ffffff;
  border-radius: 8px;
  font-family: -apple-system,'Inter',sans-serif;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}

.upload-submit-btn:hover { opacity: 1; background: #0077ed; }

.upload-cancel-btn {
  border-color: rgba(0,0,0,.14);
  color: #6e6e73;
  font-family: -apple-system,'Inter',sans-serif;
  text-transform: none;
  letter-spacing: 0;
}

.upload-cancel-btn:hover { border-color: rgba(0,0,0,.25); color: #1d1d1f; }

/* ── History ── */
.history-entry { background: rgba(0,0,0,.025); border-color: rgba(0,0,0,.07); }
.history-ts { color: #0071e3; font-family: -apple-system,'Inter',sans-serif; }
.history-toggle { color: #6e6e73; font-family: -apple-system,'Inter',sans-serif; text-transform: none; letter-spacing: 0; }
.history-toggle:hover { color: #1d1d1f; }

/* ── Empty state ── */
.empty-state { background: #fff; border-color: rgba(0,0,0,.07); }

/* ── Footer ── */
footer { color: #aeaeb2; font-family: -apple-system,'Inter',sans-serif; text-transform: none; letter-spacing: 0; }

/* ── Tag filter bar ── */
.tag-filter-label { color: #6e6e73; font-family: -apple-system,'Inter',sans-serif; }
.clear-tag-btn    { color: #6e6e73; }
.clear-tag-btn:hover { color: #1d1d1f; }

/* ── Vault status ── */
.vault-status--on  { color: #1a8f38; }
.vault-status--off { color: #6b7280; }
.vault-status--off:hover { color: var(--accent); }

/* ── Pip-Boy toggle adapted for light bg ── */

/* ── Mac toggle adapted for light bg ── */

/* ── Auth: role badge ── */
.role-badge {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: .2rem .55rem;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,.15);
  color: rgba(255,255,255,.5);
  white-space: nowrap;
}
.role-badge[data-role="superadmin"] { border-color: #e6a817; color: #e6a817; }
.role-badge[data-role="admin"] { border-color: var(--accent); color: var(--accent); }
.role-badge[data-role="user"]  { border-color: rgba(255,255,255,.2); color: rgba(255,255,255,.4); }

.role-badge[data-role="superadmin"] { border-color: #d4a017; color: #d4a017; background: rgba(212,160,23,.1); }
.role-badge[data-role="admin"] { border-color: #0071e3; color: #0071e3; background: rgba(0,113,227,.07); }
.role-badge[data-role="user"]  { border-color: rgba(0,0,0,.12); color: #6e6e73; }


/* ── Auth: header icon buttons (settings, logout) ── */
.header-icon-btn {
  width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 5px;
  cursor: pointer;
  font-size: 1rem;
  color: rgba(255,255,255,.4);
  transition: all .2s;
  flex-shrink: 0;
}
.header-icon-btn:hover { border-color: var(--accent); color: var(--accent); }

.header-icon-btn       { border-color: rgba(0,0,0,.12); color: rgba(0,0,0,.35); }
.header-icon-btn:hover { border-color: rgba(0,113,227,.4); color: #0071e3; }


/* ── Auth: role-based hiding ── */
body[data-role="user"] .admin-only { display: none !important; }

/* ── Account Management modal ── */
.acct-modal { max-width: 720px; width: 94vw; padding: 1.75rem 2rem 2rem; }
.acct-modal .modal-close {
  top: 1rem; right: 1rem; width: 2rem; height: 2rem;
  border-radius: 6px; font-size: .85rem; border: none;
  background: rgba(128,128,128,.1);
}
.acct-modal .modal-close:hover { background: rgba(128,128,128,.2); }
.acct-tabs {
  display: flex; gap: .5rem; margin-bottom: 1.25rem;
  border-bottom: 1px solid rgba(128,128,128,.15); padding-bottom: .6rem;
}
.acct-tab {
  background: none; border: none; padding: .45rem .9rem; cursor: pointer;
  font-size: .8rem; font-weight: 600; color: rgba(128,128,128,.5);
  border-radius: 6px; transition: all .2s;
}
.acct-tab:hover { color: inherit; }
.acct-tab.active { background: rgba(0,113,227,.1); color: #0071e3; }
.acct-tab-content h3 { font-size: .9rem; font-weight: 600; margin: 1.25rem 0 .6rem; }
.acct-info { background: rgba(128,128,128,.06); border-radius: 8px; padding: .85rem 1rem; margin-bottom: .25rem; }
.acct-info p { margin: .35rem 0; font-size: .85rem; }
.acct-info strong { font-weight: 600; display: inline-block; min-width: 4rem; }
.acct-tab-content .pw-input { margin-bottom: .4rem; }
.acct-tab-content .login-btn { width: 100%; margin-top: .35rem; }
.acct-users-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; }
.acct-users-header h3 { margin: 0; }
.acct-add-btn {
  padding: .35rem .85rem; font-size: .75rem; font-weight: 600; cursor: pointer;
  background: var(--accent, #0071e3); color: #fff; border: none; border-radius: 6px;
  transition: opacity .15s;
}
.acct-add-btn:hover { opacity: .85; }
.acct-user-form { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid rgba(128,128,128,.15); }
.acct-form-actions { display: flex; gap: .5rem; margin-top: .35rem; }
.acct-form-actions .login-btn { flex: 1; }
.acct-cancel-btn { background: rgba(128,128,128,.25) !important; color: inherit !important; }
.acct-cancel-btn:hover { background: rgba(128,128,128,.35) !important; }

.user-table { width: 100%; border-collapse: collapse; font-size: .8rem; table-layout: fixed; }
.user-table th { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid rgba(128,128,128,.2); font-weight: 600; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: rgba(128,128,128,.6); }
.user-table td { padding: .55rem .6rem; border-bottom: 1px solid rgba(128,128,128,.1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-table th:nth-child(1),
.user-table td:nth-child(1) { width: 25%; }
.user-table th:nth-child(2),
.user-table td:nth-child(2) { width: 32%; }
.user-table th:nth-child(3),
.user-table td:nth-child(3) { width: 13%; }
.user-table th:nth-child(4),
.user-table td:nth-child(4) { width: 13%; }
.user-table th:nth-child(5),
.user-table td:nth-child(5) { width: 17%; text-align: right; white-space: nowrap; }
.user-action-btn {
  background: none; border: none; cursor: pointer; padding: .15rem .3rem;
  font-size: .85rem; opacity: .5; transition: opacity .2s;
}
.user-action-btn:hover { opacity: 1; }
.role-select {
  background: transparent; border: 1px solid rgba(128,128,128,.25); border-radius: 4px;
  padding: .2rem .4rem; font-size: .8rem; color: inherit; cursor: pointer;
}
.role-label-super {
  font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: #d4a017; background: rgba(212,160,23,.1); padding: .15rem .45rem; border-radius: 4px;
}

/* ── Archive modal ── */
.archive-modal { max-width: 720px; width: 94vw; padding: 1.75rem 2rem 2rem; }
.archive-modal .modal-close {
  top: 1rem; right: 1rem; width: 2rem; height: 2rem;
  border-radius: 6px; font-size: .85rem; border: none;
  background: rgba(128,128,128,.1);
}
.archive-modal .modal-close:hover { background: rgba(128,128,128,.2); }
.archive-title { font-size: 1rem; font-weight: 600; margin: 0 0 .25rem; }
.archive-sub { font-size: .78rem; color: rgba(128,128,128,.6); margin: 0 0 1rem; }
.archive-table { margin-top: .25rem; }
.archive-action-btn {
  background: none; border: 1px solid rgba(128,128,128,.2); border-radius: 4px;
  cursor: pointer; padding: .2rem .4rem; font-size: .8rem; opacity: .6; transition: all .2s;
  margin-left: .25rem;
}
.archive-action-btn:hover { opacity: 1; }
.archive-action-btn.restore:hover { border-color: #0071e3; color: #0071e3; }
.archive-action-btn.destroy:hover { border-color: #c0392b; color: #c0392b; }

/* ── Under Construction overlay ── */
.construction-overlay {
  position: fixed; inset: 0; z-index: 10000;
  background: #0a0a0a;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.construction-content { text-align: center; }
.construction-title {
  font-size: 1.4rem; font-weight: 300; letter-spacing: .15em; text-transform: uppercase;
  color: rgba(255,255,255,.7); margin: 0 0 .6rem;
}
.construction-sub {
  font-size: .85rem; color: rgba(255,255,255,.25); margin: 0;
}
.construction-footer {
  position: absolute; bottom: 1.5rem; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 2rem;
}
.construction-login {
  font-size: .65rem; color: rgba(255,255,255,.08); cursor: pointer;
  letter-spacing: .05em; transition: color .2s;
}
.construction-login:hover { color: rgba(255,255,255,.3); }
/* ── Login overlay ── */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8,15,28,.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.login-box {
  background: var(--surface);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem 2rem;
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
  box-shadow: var(--shadow-lg);
}

.login-logo { width: 52px; height: 52px; object-fit: contain; margin-bottom: .25rem; }
.login-title { font-size: 1.25rem; font-weight: 700; color: var(--text); letter-spacing: -.01em; }
.login-sub   { font-size: .78rem; color: var(--muted); }

.login-input {
  width: 100%;
  padding: .65rem .9rem;
  background: var(--primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: .88rem;
  margin-top: .25rem;
  outline: none;
  transition: border-color .15s;
}
.login-input:focus { border-color: var(--accent); }

.login-btn {
  width: 100%;
  padding: .65rem;
  background: var(--accent);
  color: #0c1526;
  border: none;
  border-radius: var(--radius);
  font-size: .88rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, opacity .15s;
}
.login-btn:hover { opacity: .9; }

.login-error {
  font-size: .75rem;
  color: #f87171;
  min-height: 1rem;
  text-align: center;
}

.login-success {
  font-size: .75rem;
  color: #34d399;
  text-align: center;
}

.login-forgot {
  text-align: center;
  margin: .25rem 0 0;
  font-size: .75rem;
}
.login-forgot a {
  color: var(--muted);
  text-decoration: none;
}
.login-forgot a:hover {
  text-decoration: underline;
}

/* Mac theme login */
.login-overlay { background: rgba(235,235,240,.7); }
.login-box {
  background: rgba(255,255,255,.92);
  border-color: rgba(0,0,0,.08);
  box-shadow: 0 8px 40px rgba(0,0,0,.16);
}
.login-title { color: #1d1d1f; }
.login-sub   { color: #6e6e73; }
.login-input {
  background: rgba(0,0,0,.04);
  border-color: rgba(0,0,0,.12);
  color: #1d1d1f;
}
.login-input:focus { border-color: #0071e3; box-shadow: 0 0 0 3px rgba(0,113,227,.15); }
.login-btn { background: #0071e3; color: #fff; }
.login-error { color: #ff3b30; }
.login-success { color: #34c759; }
.login-forgot a { color: #6e6e73; }

/* ── Password inputs ── */
.pw-input {
  width: 100%;
  padding: .55rem .8rem;
  background: var(--primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: .85rem;
  outline: none;
  transition: border-color .15s;
}
.pw-input:focus { border-color: var(--accent); }

.pw-input {
  background: rgba(0,0,0,.04);
  border-color: rgba(0,0,0,.12);
  color: #1d1d1f;
}
.pw-input:focus { border-color: #0071e3; box-shadow: 0 0 0 3px rgba(0,113,227,.15); }

/* ── Theme toggle button ── */
.theme-toggle {
  background: none; border: 1px solid rgba(0,0,0,.12); border-radius: 5px;
  width: 2.1rem; height: 2.1rem; font-size: 1rem; cursor: pointer;
  color: rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center;
  transition: all .2s; flex-shrink: 0;
}
.theme-toggle:hover { border-color: rgba(0,113,227,.4); color: #0071e3; }

/* ══════════════════════════════════════════════════════════════
   DARK THEME
   ══════════════════════════════════════════════════════════════ */

[data-theme="dark"] {
  --primary:    #1c1c1e;
  --primary-2:  #2c2c2e;
  --accent:     #0a84ff;
  --accent-dim: rgba(10,132,255,.12);
  --bg:         #161618;
  --surface:    #1c1c1e;
  --surface-2:  #2c2c2e;
  --border:     rgba(255,255,255,.08);
  --border-hi:  rgba(255,255,255,.14);
  --text:       #e5e5e7;
  --muted:      #98989d;
  --shadow:     0 1px 4px rgba(0,0,0,.3), 0 0 0 .5px rgba(255,255,255,.04);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.5), 0 0 0 .5px rgba(255,255,255,.04);
}

/* ── Header ── */
[data-theme="dark"] header {
  background: rgba(28,28,30,.85);
  border-bottom-color: rgba(255,255,255,.08);
}
[data-theme="dark"] header::after { display: none; }
[data-theme="dark"] .header-toolbar { border-top-color: rgba(255,255,255,.06); }
[data-theme="dark"] .brand h1 { background: none; -webkit-text-fill-color: #e5e5e7; color: #e5e5e7; text-shadow: none; }
[data-theme="dark"] .brand-sub { color: #98989d; }
[data-theme="dark"] .version-label { color: #aaa; -webkit-text-fill-color: #aaa; }

/* ── Stats ── */
[data-theme="dark"] .stat-num { color: #0a84ff; text-shadow: none; }
[data-theme="dark"] .stat-lbl { color: #98989d; }
[data-theme="dark"] .stat     { border-left-color: rgba(255,255,255,.08); }

/* ── Table ── */
[data-theme="dark"] table { box-shadow: var(--shadow-lg); border-color: rgba(255,255,255,.06); }
[data-theme="dark"] thead th { background: rgba(44,44,46,.9); color: #98989d; border-bottom-color: rgba(255,255,255,.08); }
[data-theme="dark"] tbody tr:hover { background: rgba(10,132,255,.06); box-shadow: 0 2px 10px rgba(0,0,0,.2); }
[data-theme="dark"] .file-name { color: #e5e5e7; text-shadow: none; }
[data-theme="dark"] .file-desc, [data-theme="dark"] .col-meta, [data-theme="dark"] .col-type { color: #98989d; }

/* ── Tags ── */
[data-theme="dark"] .tag-blue   { background: rgba(10,132,255,.15); color: #4da6ff; }
[data-theme="dark"] .tag-green  { background: rgba(48,209,88,.12);  color: #30d158; }
[data-theme="dark"] .tag-amber  { background: rgba(255,159,10,.12); color: #ff9f0a; }
[data-theme="dark"] .tag-purple { background: rgba(191,90,242,.12); color: #bf5af2; }
[data-theme="dark"] .tag-red    { background: rgba(255,69,58,.1);   color: #ff453a; }
[data-theme="dark"] .tag-gray   { background: rgba(255,255,255,.06); color: #98989d; }
[data-theme="dark"] .tag-pill   { background: rgba(255,255,255,.06); color: #e5e5e7; }
[data-theme="dark"] .tag-pill:hover { background: rgba(10,132,255,.15); color: #4da6ff; }
[data-theme="dark"] .tag.tag-active { background: #0a84ff; color: #fff; }

/* ── Download button ── */
[data-theme="dark"] .dl-btn { background: rgba(10,132,255,.1); color: #0a84ff; border-color: rgba(10,132,255,.25); }
[data-theme="dark"] .dl-btn:hover { background: #0a84ff; color: #fff; border-color: #0a84ff; }

/* ── Search ── */
[data-theme="dark"] #search { background: #2c2c2e; border-color: rgba(255,255,255,.1); color: #e5e5e7; box-shadow: none; }
[data-theme="dark"] #search::placeholder { color: #636366; }
[data-theme="dark"] #search:focus { border-color: #0a84ff; box-shadow: 0 0 0 3px rgba(10,132,255,.2); }

/* ── Filters ── */
[data-theme="dark"] .filters { background: rgba(255,255,255,.06); }
[data-theme="dark"] .filter-btn { color: #98989d; }
[data-theme="dark"] .filter-btn:hover { background: rgba(255,255,255,.08); color: #e5e5e7; }
[data-theme="dark"] .filter-btn.active { background: #2c2c2e; color: #0a84ff; box-shadow: 0 1px 4px rgba(0,0,0,.3); }

/* ── Add File button ── */
[data-theme="dark"] .add-btn { background: #0a84ff; color: #fff; }
[data-theme="dark"] .add-btn:hover { background: #409cff; box-shadow: 0 2px 8px rgba(10,132,255,.3); }

/* ── Thumbnail ── */
[data-theme="dark"] .row-thumb { border-color: rgba(255,255,255,.08); }
[data-theme="dark"] .row-thumb:hover { border-color: #0a84ff; box-shadow: 0 0 0 3px rgba(10,132,255,.2); }
[data-theme="dark"] .row-thumb-placeholder { background: #2c2c2e; border-color: rgba(255,255,255,.08); color: #0a84ff; }

/* ── Version badges ── */
[data-theme="dark"] .version-badge { background: rgba(255,255,255,.06); color: #98989d; }
[data-theme="dark"] .version-badge--updated, [data-theme="dark"] .modal-ver-badge--updated { background: rgba(10,132,255,.15); color: #0a84ff; }
[data-theme="dark"] .modal-ver-badge { background: rgba(255,255,255,.06); color: #98989d; }

/* ── Modal ── */
[data-theme="dark"] .modal-overlay { background: rgba(0,0,0,.55); }
[data-theme="dark"] .modal { background: rgba(36,36,38,.95); box-shadow: 0 24px 64px rgba(0,0,0,.5), 0 0 0 .5px rgba(255,255,255,.08); }
[data-theme="dark"] .modal-preview { background: #1c1c1e; }
[data-theme="dark"] .modal-placeholder-icon { color: #0a84ff; }
[data-theme="dark"] .modal-filename { color: #e5e5e7; }
[data-theme="dark"] .modal-desc { color: #aeaeb2; }
[data-theme="dark"] .modal-type-tag { color: #98989d; }
[data-theme="dark"] .modal-dl-btn { background: #0a84ff; color: #fff; }
[data-theme="dark"] .modal-dl-btn:hover { background: #409cff; }
[data-theme="dark"] .modal-btn-row { border-top-color: rgba(255,255,255,.06); }
[data-theme="dark"] .modal-open-btn { background: #2c2c2e; border-color: #0a84ff; color: #0a84ff; }
[data-theme="dark"] .modal-open-btn:hover { background: #0a84ff; color: #fff; }
[data-theme="dark"] .modal-close-btn { border-color: rgba(255,255,255,.12); color: #98989d; }
[data-theme="dark"] .modal-close-btn:hover { border-color: #ff453a; color: #ff453a; }
[data-theme="dark"] .modal-close { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.08); color: #98989d; }
[data-theme="dark"] .modal-close:hover { background: rgba(255,255,255,.1); color: #e5e5e7; }
[data-theme="dark"] .modal-edit-btn { border-color: rgba(255,255,255,.12); color: #98989d; }
[data-theme="dark"] .modal-edit-btn:hover { border-color: #0a84ff; color: #0a84ff; }
[data-theme="dark"] .modal-preview--pdf { background: #1c1c1e; }

/* ── Edit form ── */
[data-theme="dark"] .modal-edit-form { background: rgba(255,255,255,.03); border-color: rgba(255,255,255,.06); }
[data-theme="dark"] .edit-field label { color: #98989d; }
[data-theme="dark"] .edit-field input, [data-theme="dark"] .edit-field select { background: #1c1c1e; border-color: rgba(255,255,255,.12); color: #e5e5e7; }
[data-theme="dark"] .edit-field input:focus, [data-theme="dark"] .edit-field select:focus { border-color: #0a84ff; box-shadow: 0 0 0 3px rgba(10,132,255,.2); }
[data-theme="dark"] .edit-save-btn { background: #0a84ff; color: #fff; }
[data-theme="dark"] .edit-save-btn:hover { background: #409cff; }
[data-theme="dark"] .edit-cancel-btn { border-color: rgba(255,255,255,.12); color: #98989d; }
[data-theme="dark"] .edit-cancel-btn:hover { border-color: rgba(255,255,255,.2); color: #e5e5e7; }
[data-theme="dark"] .edit-close-btn { border-color: rgba(255,255,255,.12); color: #98989d; }
[data-theme="dark"] .edit-close-btn:hover { color: #ff453a; border-color: #ff453a; }

/* ── Version panel ── */
[data-theme="dark"] .file-version-item { background: rgba(255,255,255,.03); border-color: rgba(255,255,255,.06); }
[data-theme="dark"] .file-version-item--current { background: rgba(10,132,255,.08); border-color: rgba(10,132,255,.2); }
[data-theme="dark"] .file-version-item--selected { border-color: #0a84ff !important; background: rgba(10,132,255,.12) !important; }
[data-theme="dark"] .fv-badge { color: #0a84ff; }
[data-theme="dark"] .fv-current-label { color: #0a84ff; border-color: rgba(10,132,255,.3); }
[data-theme="dark"] .fv-restore-zone { background: rgba(10,132,255,.06); border-color: rgba(10,132,255,.2); }
[data-theme="dark"] .fv-restore-btn { background: rgba(10,132,255,.15); color: #0a84ff; border-color: rgba(10,132,255,.3); }
[data-theme="dark"] .fv-restore-btn:hover { background: rgba(10,132,255,.25); }
[data-theme="dark"] .fv-dl { border-color: rgba(255,255,255,.1); color: #98989d; }
[data-theme="dark"] .fv-dl:hover { border-color: #0a84ff; color: #0a84ff; }
[data-theme="dark"] .fv-delete-btn { border-color: rgba(255,69,58,.2); color: rgba(255,69,58,.45); }
[data-theme="dark"] .fv-delete-btn:hover { background: rgba(255,69,58,.1); border-color: #ff453a; color: #ff453a; }

/* ── Delete zone ── */
[data-theme="dark"] .delete-btn { color: #ff453a; border-color: rgba(255,69,58,.25); }
[data-theme="dark"] .delete-btn:hover { background: rgba(255,69,58,.08); border-color: #ff453a; }
[data-theme="dark"] .delete-confirm { background: rgba(255,69,58,.06); border-color: rgba(255,69,58,.15); }
[data-theme="dark"] .delete-cancel-btn { color: #98989d; border-color: rgba(255,255,255,.1); }
[data-theme="dark"] .delete-cancel-btn:hover { background: rgba(255,255,255,.06); color: #ccc; }
[data-theme="dark"] .delete-confirm-btn { background: #ff453a; border-color: #ff453a; }
[data-theme="dark"] .delete-confirm-btn:hover { background: #e0352b; }

/* ── Upload modal ── */
[data-theme="dark"] .upload-modal-header { background: rgba(44,44,46,.9); border-bottom-color: rgba(255,255,255,.08); }
[data-theme="dark"] .upload-modal-header h2 { color: #e5e5e7; }
[data-theme="dark"] .drop-zone { background: #1c1c1e; border-color: rgba(255,255,255,.1); }
[data-theme="dark"] .drop-zone:hover, [data-theme="dark"] .drop-zone.drag-over { border-color: #0a84ff; background: rgba(10,132,255,.05); }
[data-theme="dark"] .drop-primary { color: #e5e5e7; }
[data-theme="dark"] .drop-secondary { color: #636366; }
[data-theme="dark"] .drop-browse { color: #0a84ff; }
[data-theme="dark"] .upload-field label { color: #98989d; }
[data-theme="dark"] .upload-field select, [data-theme="dark"] .upload-field input[type="text"] { background: #1c1c1e; border-color: rgba(255,255,255,.12); color: #e5e5e7; }
[data-theme="dark"] .upload-field select:focus, [data-theme="dark"] .upload-field input[type="text"]:focus { border-color: #0a84ff; box-shadow: 0 0 0 3px rgba(10,132,255,.2); }
[data-theme="dark"] .upload-submit-btn { background: #0a84ff; color: #fff; }
[data-theme="dark"] .upload-submit-btn:hover { background: #409cff; }
[data-theme="dark"] .upload-cancel-btn { border-color: rgba(255,255,255,.12); color: #98989d; }
[data-theme="dark"] .upload-cancel-btn:hover { border-color: rgba(255,255,255,.2); color: #e5e5e7; }

/* ── History ── */
[data-theme="dark"] .history-entry { background: rgba(255,255,255,.03); border-color: rgba(255,255,255,.06); }
[data-theme="dark"] .history-ts { color: #0a84ff; }
[data-theme="dark"] .history-toggle { color: #98989d; }
[data-theme="dark"] .history-toggle:hover { color: #e5e5e7; }

/* ── Empty state ── */
[data-theme="dark"] .empty-state { background: #1c1c1e; border-color: rgba(255,255,255,.06); }

/* ── Footer ── */
[data-theme="dark"] footer { color: #636366; }

/* ── Tag filter bar ── */
[data-theme="dark"] .tag-filter-label { color: #98989d; }
[data-theme="dark"] .clear-tag-btn { color: #98989d; }
[data-theme="dark"] .clear-tag-btn:hover { color: #e5e5e7; }

/* ── Role badge ── */
[data-theme="dark"] .role-badge { border-color: rgba(255,255,255,.12); color: rgba(255,255,255,.4); }
[data-theme="dark"] .role-badge[data-role="superadmin"] { border-color: #e6a817; color: #e6a817; background: rgba(230,168,23,.12); }
[data-theme="dark"] .role-badge[data-role="admin"] { border-color: #0a84ff; color: #0a84ff; background: rgba(10,132,255,.1); }
[data-theme="dark"] .role-badge[data-role="user"] { border-color: rgba(255,255,255,.12); color: rgba(255,255,255,.35); }

/* ── Header icon buttons ── */
[data-theme="dark"] .header-icon-btn { border-color: rgba(255,255,255,.1); color: rgba(255,255,255,.35); }
[data-theme="dark"] .header-icon-btn:hover { border-color: rgba(10,132,255,.4); color: #0a84ff; }

/* ── Theme toggle ── */
[data-theme="dark"] .theme-toggle { border-color: rgba(255,255,255,.1); color: rgba(255,255,255,.35); }
[data-theme="dark"] .theme-toggle:hover { border-color: rgba(10,132,255,.4); color: #0a84ff; }

/* ── Refresh button ── */
[data-theme="dark"] .refresh-btn { border-color: rgba(255,255,255,.1); color: #98989d; }
[data-theme="dark"] .refresh-btn:hover { border-color: #0a84ff; color: #0a84ff; }

/* ── Login ── */
[data-theme="dark"] .login-overlay { background: rgba(22,22,24,.85); }
[data-theme="dark"] .login-box { background: rgba(44,44,46,.95); border-color: rgba(255,255,255,.08); box-shadow: 0 8px 40px rgba(0,0,0,.4); }
[data-theme="dark"] .login-title { color: #e5e5e7; }
[data-theme="dark"] .login-sub { color: #98989d; }
[data-theme="dark"] .login-input { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.1); color: #e5e5e7; }
[data-theme="dark"] .login-input:focus { border-color: #0a84ff; box-shadow: 0 0 0 3px rgba(10,132,255,.2); }
[data-theme="dark"] .login-btn { background: #0a84ff; color: #fff; }
[data-theme="dark"] .login-error { color: #ff453a; }
[data-theme="dark"] .login-success { color: #30d158; }
[data-theme="dark"] .login-forgot a { color: #98989d; }

/* ── Password inputs ── */
[data-theme="dark"] .pw-input { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.1); color: #e5e5e7; }
[data-theme="dark"] .pw-input:focus { border-color: #0a84ff; box-shadow: 0 0 0 3px rgba(10,132,255,.2); }

/* ── Account modal ── */
[data-theme="dark"] .acct-tab.active { background: rgba(10,132,255,.15); color: #0a84ff; }
[data-theme="dark"] .acct-info { background: rgba(255,255,255,.04); }
[data-theme="dark"] .role-select { background: #1c1c1e; border-color: rgba(255,255,255,.15); color: #e5e5e7; }
[data-theme="dark"] .role-label-super { color: #e6a817; background: rgba(230,168,23,.12); }
[data-theme="dark"] .acct-add-btn { background: #0a84ff; }
[data-theme="dark"] .acct-cancel-btn { background: rgba(255,255,255,.08) !important; }
[data-theme="dark"] .acct-cancel-btn:hover { background: rgba(255,255,255,.12) !important; }
[data-theme="dark"] .acct-user-form { border-top-color: rgba(255,255,255,.08); }

/* ── Archive modal ── */
[data-theme="dark"] .archive-action-btn { border-color: rgba(255,255,255,.12); }
[data-theme="dark"] .archive-action-btn.restore:hover { border-color: #0a84ff; color: #0a84ff; }
[data-theme="dark"] .archive-action-btn.destroy:hover { border-color: #ff453a; color: #ff453a; }

/* ── User table (dark) ── */
[data-theme="dark"] .user-table th { border-bottom-color: rgba(255,255,255,.08); color: #636366; }
[data-theme="dark"] .user-table td { border-bottom-color: rgba(255,255,255,.05); }
