/* ── Variables ── */
:root {
  --sidebar-bg: #1e293b;
  --sidebar-hover: #334155;
  --sidebar-active: #4f46e5;
  --sidebar-width: 220px;
  --topbar-h: 56px;
  --primary: #4f46e5;
  --primary-h: #4338ca;
  --danger: #ef4444;
  --success: #22c55e;
  --warn: #f59e0b;
  --bg: #f1f5f9;
  --bg-card: #ffffff;
  --text: #0f172a;
  --text-sm: #475569;
  --border: #e2e8f0;
  --shadow: 0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.08);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -2px rgba(0,0,0,.1);
  --radius: 8px;
  --thumb-w: 196px;
  --thumb-h: 147px;
  --thumb-gap: 8px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body { font-family: system-ui, -apple-system, sans-serif; font-size: 14px; color: var(--text); background: var(--bg); }
a { color: inherit; text-decoration: none; }
img { display: block; }
button { cursor: pointer; border: none; background: none; font: inherit; }
input, select, textarea { font: inherit; }

/* ── Layout ── */
#layout { display: flex; flex-direction: column; height: 100vh; }

#topbar {
  height: var(--topbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  flex-shrink: 0;
  z-index: 100;
}

#logo {
  font-weight: 700;
  font-size: 16px;
  color: var(--primary);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}
#logo svg { width: 24px; height: 24px; }

#main { display: flex; flex: 1; overflow: hidden; }

#sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  padding: 8px 0;
}

.sidebar-section { padding: 8px 12px 4px; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: #64748b; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: #94a3b8;
  font-size: 13px;
  cursor: pointer;
  border-radius: 6px;
  margin: 1px 8px;
  transition: background .15s, color .15s;
  user-select: none;
}
.nav-item:hover { background: var(--sidebar-hover); color: #e2e8f0; }
.nav-item.active { background: var(--sidebar-active); color: #fff; }
.nav-item .icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-divider { height: 1px; background: #334155; margin: 8px 16px; }

#sidebar-bottom { margin-top: auto; padding-bottom: 8px; }

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  color: #94a3b8;
  font-size: 12px;
  margin: 1px 8px;
  border-radius: 6px;
  cursor: pointer;
}
.user-chip:hover { background: var(--sidebar-hover); }
.user-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  flex-shrink: 0;
}
.user-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#content { flex: 1; overflow: hidden; display: flex; flex-direction: column; }

/* ── Filter bar ── */
#filter-bar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
#filter-bar.hidden { display: none; }

.filter-select {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  outline: none;
}
.filter-select:focus { border-color: var(--primary); }

/* Desplegables con casillas */
.filter-dd { position: relative; }
.filter-dd > summary { list-style: none; user-select: none; }
.filter-dd > summary::-webkit-details-marker { display: none; }
.filter-dd > summary::after { content: ' ▾'; color: var(--text-sm); }
.dd-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 300;
  min-width: 240px;
  max-height: 360px;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  padding: 6px;
}
.dd-actions { display: flex; gap: 6px; padding: 2px 4px 6px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.dd-actions button {
  border: none; background: none; color: var(--primary);
  font-size: 12px; cursor: pointer; padding: 2px 4px;
}
.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}
.check-row:hover { background: var(--bg); }
.check-row input { accent-color: var(--primary); cursor: pointer; }
.check-row span:nth-child(2) { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.check-count { font-size: 11px; color: var(--text-sm); }
.check-only {
  display: none;
  border: none; background: none; padding: 0 2px;
  font-size: 11px; color: var(--primary); cursor: pointer;
}
.check-row:hover .check-only { display: inline; }
.check-row:hover .check-count { display: none; }
@media (hover: none) { .check-only { display: inline; } }
.sidebar-kinds .dd-actions { border-color: #334155; }
.sidebar-kinds .dd-actions button, .sidebar-kinds .check-only { color: #a5b4fc; }
.check-empty { padding: 8px; font-size: 12px; color: var(--text-sm); }
.only-mobile { display: none; }

/* Tipos en el menú lateral (fondo oscuro) */
.sidebar-kinds { padding: 0 8px; }
.sidebar-kinds .check-row { color: #94a3b8; padding: 5px 8px; }
.sidebar-kinds .check-row:hover { background: var(--sidebar-hover); color: #e2e8f0; }
.sidebar-kinds .check-count { color: #64748b; }
#classify-status { padding: 4px 16px 0; font-size: 11px; color: #64748b; line-height: 1.4; }
#classify-status:empty { display: none; }

.filter-date {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  color: var(--text);
}
.filter-date:focus { border-color: var(--primary); }

.filter-search { display: flex; flex: 0 1 240px; min-width: 150px; margin: 0; }
.filter-search input {
  width: 100%;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  color: var(--text);
  background: var(--surface, #fff);
}
.filter-search input:focus { border-color: var(--primary); }
.filter-search input.busy { background-image: linear-gradient(90deg, transparent, rgba(79,70,229,.15), transparent); background-size: 200% 100%; animation: search-busy 1.2s linear infinite; }
@keyframes search-busy { from { background-position: 200% 0; } to { background-position: -200% 0; } }

#filter-tags-wrap { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.tag-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: .15s;
}
.tag-chip.active { border-color: currentColor; }

#btn-clear-filters {
  margin-left: auto;
  color: var(--text-sm);
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 6px;
}
#btn-clear-filters:hover { background: var(--border); }

#filter-count {
  font-size: 12px;
  color: var(--text-sm);
  white-space: nowrap;
}

/* ── View container ── */
#view-container { flex: 1; overflow: hidden; position: relative; }

/* ── Gallery ── */
#gallery-wrap {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
}
#gallery-wrap.empty-state > .empty-box {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(420px, 90%);
}

#gallery-inner { position: relative; width: 100%; }

.thumb-card {
  position: absolute;
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
  user-select: none;
}
.thumb-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.thumb-card.selected { outline: 3px solid var(--primary); outline-offset: -1px; }
.thumb-card.selected .thumb-check { opacity: 1; }

.thumb-img-wrap {
  width: 100%;
  height: calc(100% - 36px);
  overflow: hidden;
  background: #e2e8f0;
  display: flex; align-items: center; justify-content: center;
}
.thumb-img-wrap img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity .2s;
}
.thumb-img-wrap img.loaded { opacity: 1; }
.thumb-img-placeholder {
  font-size: 24px;
  color: #94a3b8;
}

.thumb-info {
  height: 36px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-sm);
  overflow: hidden;
}
.thumb-project-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.thumb-date { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.thumb-meta { white-space: nowrap; color: #64748b; font-variant-numeric: tabular-nums; }
.thumb-locate {
  border: none;
  background: none;
  padding: 2px;
  margin-right: -4px;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  border-radius: 4px;
  opacity: 0;
  transition: opacity .15s;
}
.thumb-card:hover .thumb-locate, .thumb-locate:focus-visible { opacity: 1; }
.thumb-locate:hover { background: var(--bg); }
@media (hover: none) { .thumb-locate { opacity: 1; } }

.thumb-check {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid white;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity .15s;
  color: white;
  font-size: 12px;
}
.thumb-card:hover .thumb-check { opacity: .6; }

.thumb-video {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 2px 7px;
  border-radius: 10px;
  background: rgba(15, 23, 42, .75);
  color: #fff;
  font-size: 11px;
  pointer-events: none;
}

/* ── Empty state ── */
.empty-box {
  text-align: center;
  padding: 40px 20px;
}
.empty-box .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-box h2 { font-size: 18px; font-weight: 600; margin-bottom: 6px; }
.empty-box p { color: var(--text-sm); margin-bottom: 20px; font-size: 14px; }

/* ── Loading progress ── */
#indexing-progress {
  position: fixed;
  bottom: 72px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  z-index: 200;
  min-width: 260px;
  max-width: 400px;
}
#indexing-progress.hidden { display: none; }
.progress-bar-wrap { flex: 1; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--primary); transition: width .3s; }

/* ── Map view ── */
#map-container { width: 100%; height: 100%; }

/* ── Projects view ── */
#projects-view { display: flex; height: 100%; overflow: hidden; }
#projects-list {
  width: 300px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#projects-map { flex: 1; }

.project-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 10px;
}
.project-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}
.project-info { flex: 1; min-width: 0; }
.project-name { font-weight: 600; font-size: 14px; }
.project-meta { font-size: 11px; color: var(--text-sm); }
.project-actions { display: flex; gap: 4px; }

/* ── Sources view ── */
#sources-view { padding: 24px; overflow-y: auto; }
#sources-view h1 { font-size: 20px; font-weight: 700; margin-bottom: 20px; }

.source-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-bottom: 24px; }

.error-log {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
}
.error-log-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.error-log-header h2 { font-size: 14px; font-weight: 600; flex: 1; }
.error-log-header small { font-weight: 400; color: var(--text-sm); }
#error-log-list { max-height: 320px; overflow-y: auto; font-size: 12px; }
.error-log-row { display: flex; gap: 12px; padding: 6px 0; border-top: 1px solid var(--border); }
.error-log-time { flex-shrink: 0; color: var(--text-sm); font-variant-numeric: tabular-nums; }
.error-log-msg { overflow-wrap: anywhere; }
.error-log-msg small { color: var(--text-sm); }
.error-log-empty { color: var(--text-sm); padding: 6px 0; }
#diag-list { max-height: 360px; overflow: auto; }
.diag-table { border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.diag-table th { position: sticky; top: 0; background: var(--surface, #fff); text-align: right; font-weight: 600; color: var(--text-sm); padding: 4px 8px; cursor: help; }
.diag-table td { text-align: right; padding: 4px 8px; border-top: 1px solid var(--border); }
.diag-table th:first-child, .diag-table td:first-child { text-align: left; }

.source-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.source-card-header { display: flex; align-items: flex-start; gap: 10px; }
.source-icon { font-size: 28px; }
.source-info { flex: 1; min-width: 0; }
.source-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-meta { font-size: 11px; color: var(--text-sm); }
.source-status { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; }
.status-dot.ok { background: var(--success); }
.status-dot.indexing { background: var(--warn); animation: pulse 1s infinite; }
.status-dot.error { background: var(--danger); }
.status-dot.pending { background: #94a3b8; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }

.source-actions { display: flex; gap: 6px; }

.source-add-card {
  background: var(--bg-card);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--text-sm);
  transition: .15s;
}
.source-add-card:hover { border-color: var(--primary); color: var(--primary); background: #eef2ff; }
.source-add-card .add-icon { font-size: 32px; }
.source-add-card span { font-size: 13px; font-weight: 500; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: .15s;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn--primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn--primary:hover { background: var(--primary-h); border-color: var(--primary-h); }
.btn--secondary { background: var(--bg-card); color: var(--text); border-color: var(--border); }
.btn--secondary:hover { background: var(--bg); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { background: #dc2626; }
.btn--sm { padding: 4px 10px; font-size: 12px; }
.btn--icon { padding: 6px; border-radius: 6px; }
.btn--icon:hover { background: var(--border); }
.btn:disabled { opacity: .5; cursor: default; }

/* ── Selection bar ── */
#selection-bar {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--sidebar-bg);
  color: #fff;
  border-radius: 999px;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,.3);
  z-index: 300;
  transition: opacity .2s, transform .2s;
}
#selection-bar.hidden { opacity: 0; pointer-events: none; transform: translateX(-50%) translateY(8px); }
#sel-count { font-weight: 600; font-size: 14px; }
#selection-bar .divider { width: 1px; height: 20px; background: #475569; }

/* ── Viewer ── */
#viewer-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.92);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}
#viewer-overlay.hidden { display: none; }

#viewer-img-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  height: 100vh;
}
#viewer-img, #viewer-video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
}
#viewer-video { background: #000; }

#viewer-nav-prev, #viewer-nav-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  cursor: pointer;
  transition: .15s;
  z-index: 10;
}
#viewer-nav-prev:hover, #viewer-nav-next:hover { background: rgba(255,255,255,.3); }
#viewer-nav-prev { left: 12px; }
#viewer-nav-next { right: 12px; }

#viewer-info {
  width: 280px;
  background: #0f172a;
  color: #e2e8f0;
  padding: 60px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  flex-shrink: 0;
}
.viewer-info-row { display: flex; flex-direction: column; gap: 2px; }
.viewer-info-label { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: #64748b; }
.viewer-info-val { font-size: 13px; }
.viewer-info-val.filename { font-weight: 600; word-break: break-all; }

#viewer-close, #viewer-locate {
  position: fixed;
  top: 12px;
  right: 12px;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  cursor: pointer;
  z-index: 10;
  transition: .15s;
}
#viewer-locate { right: 56px; font-size: 16px; }
#viewer-close:hover, #viewer-locate:hover { background: rgba(255,255,255,.3); }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 400;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.modal-header {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  gap: 10px;
}
.modal-header h2 { flex: 1; font-size: 16px; font-weight: 600; }
.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-footer { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

/* ── Form ── */
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 12px; font-weight: 500; color: var(--text-sm); }
.field input, .field select, .field textarea {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  transition: .15s;
  color: var(--text);
  background: var(--bg-card);
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); }

.color-row { display: flex; gap: 6px; flex-wrap: wrap; }
.color-swatch {
  width: 24px; height: 24px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: .1s;
}
.color-swatch.selected { border-color: var(--text); }

/* ── OneDrive folder picker ── */
.folder-picker {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.folder-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  transition: .1s;
}
.folder-item:hover { background: var(--bg); }
.folder-breadcrumb {
  font-size: 12px;
  color: var(--text-sm);
  padding: 6px 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.folder-breadcrumb span { cursor: pointer; }
.folder-breadcrumb span:hover { color: var(--primary); text-decoration: underline; }

/* ── Export dialog ── */
#export-modal .modal { max-width: 440px; }
.export-opt { display: flex; align-items: center; gap: 8px; padding: 4px 0; cursor: pointer; }
.export-opt input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; }
.export-opt label { cursor: pointer; font-size: 13px; }

/* ── Notifications ── */
#notifications {
  position: fixed;
  bottom: 80px;
  right: 16px;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  z-index: 600;
  pointer-events: none;
}
.notification {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  box-shadow: var(--shadow-md);
  max-width: 320px;
  pointer-events: all;
  animation: slideIn .2s ease;
}
.notification.error { border-left-color: var(--danger); }
.notification.success { border-left-color: var(--success); }
.notification.warn { border-left-color: var(--warn); }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* ── Welcome screen ── */
#welcome {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  text-align: center;
}
#welcome h1 { font-size: 28px; font-weight: 700; }
#welcome p { color: var(--text-sm); max-width: 400px; }
#btn-signin {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: #0078d4;
  color: #fff;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: .15s;
}
#btn-signin:hover { background: #006cbd; }
#btn-signin:disabled { opacity: .6; cursor: default; }
.ms-logo { width: 20px; height: 20px; }

/* ── Tags ── */
.tags-wrap { display: flex; gap: 4px; flex-wrap: wrap; }
.tag-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
}

/* ── Spinner ── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive mobile ── */
@media (max-width: 768px) {
  #sidebar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    top: auto;
    width: 100%;
    height: 60px;
    flex-direction: row;
    padding: 0;
    z-index: 200;
    overflow: visible;
  }
  .sidebar-section, .sidebar-divider, #sidebar-bottom, .sidebar-filters { display: none; }
  .only-mobile { display: block; }
  .hide-mobile { display: none; }
  #topbar { height: auto; flex-wrap: wrap; row-gap: 0; padding: 8px 12px 0; }
  #filter-bar {
    order: 3;
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 6px 0 8px;
    border-bottom: none;
  }
  #filter-bar > * { flex-shrink: 0; }
  .user-name { display: none; }
  .dd-panel { position: fixed; left: 12px; right: 12px; top: auto; min-width: 0; }
  .nav-item {
    flex: 1;
    flex-direction: column;
    justify-content: center;
    padding: 6px 4px;
    margin: 0;
    border-radius: 0;
    font-size: 10px;
    gap: 2px;
  }
  .nav-item .icon { font-size: 20px; }
  #main { padding-bottom: 60px; }
  #viewer-info { display: none; }
  #selection-bar { bottom: 72px; }
  #notifications { bottom: 76px; }
  :root { --sidebar-width: 0px; }
}
