/* ==========================================================================
   Share247 — Dark Modern Cloud Vault Stylesheet
   Full viewport table view with hover actions, pill search bar,
   prominent navbar upload button, and zero sidebar / footer clutter.
   ========================================================================== */

:root {
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Dark Theme Palette */
  --bg-app: #121316;
  --bg-surface: #1a1b1e;
  --bg-surface-hover: #26282c;
  --bg-surface-active: #2f3237;
  --bg-search: #24262b;
  --bg-search-focus: #2f3238;

  --border-subtle: #27292d;
  --border-divider: #202225;

  --text-primary: #ededed;
  --text-secondary: #c2c5c9;
  --text-muted: #888c94;

  /* Accent Colors */
  --accent-cyan: #38bdf8;
  --accent-blue: #3b82f6;
  --accent-green: #22c55e;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-purple: #a855f7;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;
  --radius-pill: 9999px;
}

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

[hidden] {
  display: none !important;
}

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  font-family: var(--font-family);
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 1px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ==========================================================================
   TOP NAVIGATION BAR (Only Navbar, No Footer, No Sidebar)
   ========================================================================== */
.navbar {
  height: 64px;
  background-color: var(--bg-app);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  gap: 1.5rem;
  flex-shrink: 0;
  z-index: 20;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 180px;
}

.brand-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  user-select: none;
  color: inherit;
  text-decoration: none;
}

.brand-icon {
  flex-shrink: 0;
}

.brand-name {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

/* Center Search Box */
.nav-center {
  flex: 1;
  max-width: 640px;
}

.search-box {
  width: 100%;
}

.search-box form {
  display: flex;
  align-items: center;
  background-color: var(--bg-search);
  border-radius: var(--radius-pill);
  height: 42px;
  padding: 0 1.15rem;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
  border: 1px solid transparent;
}

.search-box form:focus-within {
  background-color: var(--bg-search-focus);
  border-color: #3b4252;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.search-icon {
  color: var(--text-muted);
  margin-right: 0.75rem;
  flex-shrink: 0;
}

.search-box input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.925rem;
  font-family: inherit;
}

/* Hide native WebKit search cancel button to prevent duplicate X icons */
.search-box input[type="search"]::-webkit-search-decoration,
.search-box input[type="search"]::-webkit-search-cancel-button,
.search-box input[type="search"]::-webkit-search-results-button,
.search-box input[type="search"]::-webkit-search-results-decoration {
  -webkit-appearance: none;
  display: none;
}

.search-box input::placeholder {
  color: var(--text-muted);
}

.btn-clear-search {
  color: var(--text-muted);
  font-size: 1.25rem;
  padding: 0.25rem;
  border-radius: 50%;
}

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

/* Nav Right: Upload Button & Controls */
.nav-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Prominent Navbar Upload Button */
.btn-upload {
  background-color: #ffffff;
  color: #121316;
  font-weight: 600;
  font-size: 0.875rem;
  height: 38px;
  padding: 0 1.25rem;
  border-radius: var(--radius-lg);
  gap: 0.45rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-upload:hover {
  background-color: #f4f4f5;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.btn-upload:active {
  transform: translateY(1px);
}

/* Navbar Share Link Button */
.btn-add-link {
  display: inline-flex;
  align-items: center;
  background-color: rgba(6, 182, 212, 0.12);
  color: #22d3ee;
  border: 1px solid rgba(6, 182, 212, 0.35);
  font-weight: 600;
  font-size: 0.875rem;
  height: 38px;
  padding: 0 1.15rem;
  border-radius: var(--radius-lg);
  gap: 0.45rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: all 0.15s ease;
  white-space: nowrap;
  cursor: pointer;
}

.btn-add-link:hover {
  background-color: rgba(6, 182, 212, 0.22);
  border-color: #22d3ee;
  color: #67e8f9;
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.35);
}

.btn-add-link:active {
  transform: translateY(1px);
}

/* Navbar Share Text Button */
.btn-add-text {
  display: inline-flex;
  align-items: center;
  background-color: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
  font-weight: 600;
  font-size: 0.875rem;
  height: 38px;
  padding: 0 1.1rem;
  border-radius: var(--radius-lg);
  gap: 0.45rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: all 0.15s ease;
  white-space: nowrap;
  cursor: pointer;
}

.btn-add-text:hover {
  background-color: rgba(56, 189, 248, 0.22);
  border-color: #38bdf8;
  color: #7dd3fc;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.3);
}

.btn-add-text:active {
  transform: translateY(1px);
}

/* Status Pill */
.nav-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #71717a;
}

.nav-status-pill.status-supabase .status-dot {
  background: #22c55e;
  box-shadow: 0 0 6px #22c55e;
}

.nav-status-pill.status-local .status-dot {
  background: #eab308;
}

.nav-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--text-secondary);
  transition: background-color 0.15s ease;
}

.nav-icon-btn:hover {
  background-color: var(--bg-surface-hover);
  color: var(--text-primary);
}

/* ==========================================================================
   MAIN VIEWPORT TABLE
   ========================================================================== */
.vault-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: var(--bg-app);
}

.subnav-guide-link {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.subnav-guide-link:hover,
.subnav-guide-link:focus-visible {
  color: var(--accent-cyan);
  background-color: var(--bg-surface-hover);
  border-color: var(--border-subtle);
}

/* Subnav / Title bar */
.vault-subnav {
  height: 48px;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-subtle);
}

.subnav-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.view-title {
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text-primary);
}

.view-subtitle {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.subnav-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.item-count {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.subnav-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--text-secondary);
}

.subnav-btn:hover {
  background-color: var(--bg-surface-hover);
  color: var(--text-primary);
}

/* Canonical Visually Hidden Helper & Skip Link */
.visually-hidden:where(:not(:focus-within, :active)) {
  position: absolute;
  clip-path: inset(50%);
  overflow: hidden;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  white-space: nowrap;
}

.skip-link:focus,
.skip-link:focus-visible {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 100;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-md);
  background-color: var(--accent-cyan);
  color: #090b10;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

/* ==========================================================================
   SHARE TEXT MODAL
   ========================================================================== */
dialog.text-dialog {
  max-width: 560px;
}

.dialog-title-icon.icon-text-modal {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.25);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.2);
}

.text-dialog-field {
  margin-bottom: 0.75rem;
}

.text-dialog-grow {
  width: 100%;
  background-color: #12141a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.text-dialog-grow:focus-within {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.22);
}

.text-dialog-grow textarea {
  display: block;
  width: 100%;
  height: auto;
  field-sizing: content;
  min-block-size: 6lh;
  max-block-size: 16lh;
  padding: 0.75rem 0.9rem;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: max(1rem, 0.875rem);
  line-height: 1.55;
  resize: vertical;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.35) transparent;
}

.text-dialog-grow textarea:focus-visible {
  outline: none;
}

.text-dialog-grow textarea::placeholder {
  font-family: var(--font-family);
  color: var(--text-muted);
}

/* Fallback for browsers without field-sizing: content */
@supports not (field-sizing: content) {
  .growable-textarea {
    display: grid;
  }

  .growable-textarea::after,
  .growable-textarea > textarea {
    grid-area: 1 / 1 / 2 / 2;
    font-family: var(--font-mono);
    font-size: max(1rem, 0.875rem);
    line-height: 1.55;
    padding: 0.75rem 0.9rem;
    border: 0;
    word-break: break-word;
  }

  .growable-textarea::after {
    content: attr(data-replicated-value) " ";
    white-space: pre-wrap;
    visibility: hidden;
    min-height: 9rem;
    max-height: 24rem;
    overflow: hidden;
  }

  .growable-textarea > textarea {
    min-height: 9rem;
    max-height: 24rem;
    overflow-y: auto;
    resize: none;
  }
}

.text-dialog-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.45rem;
}

.text-dialog-status-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.text-dialog-options {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.text-dialog-opt-title {
  flex: 1;
  min-width: 150px;
}

.quick-meta-input,
.quick-meta-select,
.duration-select,
.custom-duration-row input,
.custom-duration-row select {
  height: 38px;
  padding: 0 0.75rem;
  background-color: #12141a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.84rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.duration-select {
  width: 100%;
  cursor: pointer;
}

.custom-duration-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.custom-duration-row[hidden] {
  display: none;
}

.custom-duration-row input {
  width: 100%;
  font-family: var(--font-mono);
}

.custom-duration-row select {
  min-width: 112px;
  cursor: pointer;
}

.quick-meta-input {
  width: 100%;
}

.quick-meta-select {
  cursor: pointer;
  font-family: var(--font-mono);
}

.quick-meta-input:focus,
.quick-meta-select:focus,
.duration-select:focus,
.custom-duration-row input:focus,
.custom-duration-row select:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.duration-select option,
.custom-duration-row select option,
.quick-meta-select option {
  background-color: #12141a;
  color: #f8fafc;
}

.quick-text-stats {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.quick-text-shortcut {
  font-size: 0.7rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 5px;
  padding: 0.12rem 0.4rem;
  font-family: var(--font-mono);
}

.btn-quick-clear {
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 0.2rem 0.55rem;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.btn-quick-clear:hover {
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Table Container */
.table-container {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: auto;
}

.vault-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
  user-select: none;
}

/* Sticky Table Header */
.vault-table thead th {
  position: sticky;
  top: 0;
  background-color: var(--bg-app);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.8125rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  z-index: 10;
  white-space: nowrap;
}

.th-content {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
}

.th-expires .th-content {
  cursor: default;
}

.sort-arrow {
  color: var(--accent-cyan);
  transition: transform 0.2s ease, opacity 0.2s ease;
  opacity: 0;
  visibility: hidden;
}

.sort-arrow.active {
  opacity: 1;
  visibility: visible;
}

.th-content:hover .sort-arrow {
  opacity: 0.6;
  visibility: visible;
}

.sort-arrow.desc {
  transform: rotate(180deg);
}

/* Explicit Column Allocations (Sum = 100% so columns never clip on desktop or monitors) */
.th-name, .cell-name {
  width: 42%;
  max-width: 42%;
  overflow: hidden;
  text-align: left;
}

.th-date, .cell-date {
  width: 20%;
  max-width: 20%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.th-expires, .cell-expires {
  width: 14%;
  max-width: 14%;
  white-space: nowrap;
  text-align: left;
}

.th-size, .cell-size {
  width: 9%;
  max-width: 9%;
  white-space: nowrap;
  text-align: left;
}

.th-views, .cell-views {
  width: 7%;
  max-width: 7%;
  white-space: nowrap;
  text-align: left;
}

.cell-views-count {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.cell-views-count svg {
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.th-actions, .cell-actions {
  width: 8%;
  min-width: 108px;
  max-width: 8%;
  text-align: right;
  white-space: nowrap;
}

/* Table Rows */
.vault-table tbody tr {
  height: 48px;
  border-bottom: 1px solid var(--border-divider);
  transition: background-color 0.1s ease;
  position: relative;
}

.vault-table tbody tr:hover {
  background-color: var(--bg-surface-hover);
}

.vault-table tbody td {
  padding: 0 1rem;
  color: var(--text-secondary);
  white-space: nowrap;
  vertical-align: middle;
}

/* Name Column Cell */
.cell-name-content {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  max-width: 100%;
  min-width: 0;
}

.row-file-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
}

/* File icon badges */
.icon-type-blue { background-color: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.icon-type-green { background-color: rgba(34, 197, 94, 0.15); color: #4ade80; }
.icon-type-red { background-color: rgba(244, 63, 94, 0.15); color: #fb7185; }
.icon-type-amber { background-color: rgba(245, 158, 11, 0.15); color: #fcd34d; }
.icon-type-purple { background-color: rgba(168, 85, 247, 0.15); color: #c084fc; }
.icon-type-cyan { background-color: rgba(6, 182, 212, 0.15); color: #22d3ee; }

/* Single-Line Overflow Truncation */
.row-filename {
  display: flex;
  align-items: center;
  white-space: nowrap;
  overflow: hidden;
  min-inline-size: 0;
}

.row-filename > span,
.row-filename > span.row-title-text {
  overflow: hidden;
  text-overflow: ellipsis;
  min-inline-size: 0;
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 400;
}

.row-url-domain {
  display: inline-flex;
  align-items: center;
  font-size: 0.725rem;
  color: #38bdf8;
  background-color: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-pill);
  padding: 0.08rem 0.45rem;
  margin-left: 0.45rem;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 0;
}

.badge-link-size {
  display: inline-flex;
  align-items: center;
  font-size: 0.725rem;
  font-weight: 600;
  color: #22d3ee;
  background-color: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.3);
  padding: 0.12rem 0.5rem;
  border-radius: var(--radius-pill);
  line-height: 1.2;
}

/* Date & Size Columns */
.cell-date, .cell-size {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

/* Expires In Column (7-Day TTL Badge) */
.cell-expires {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.expires-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-pill);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.expires-pill.warning {
  color: #facc15;
  border-color: rgba(250, 204, 21, 0.3);
}

.expires-pill.danger {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.3);
}

/* Row Action Buttons */
.cell-actions {
  text-align: right;
  position: relative;
}

.row-hover-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.vault-table tbody tr:hover .row-hover-actions {
  opacity: 1;
}

.row-action-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--text-secondary);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.row-action-btn:hover {
  background-color: #37393b;
  color: var(--text-primary);
}

/* ==========================================================================
   EMPTY STATE
   ========================================================================== */
.vault-empty-state {
  padding: 6rem 1rem;
  text-align: center;
}

.empty-icon {
  margin-bottom: 1rem;
}

.vault-empty-state h2 {
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.vault-empty-state p {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.empty-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

/* ==========================================================================
   DRAG AND DROP FULLSCREEN OVERLAY
   ========================================================================== */
.drag-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(6, 9, 14, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

.drag-overlay.active {
  display: flex !important;
}

.drag-box {
  background: linear-gradient(150deg, #181d26 0%, #0e1117 100%);
  border: 2px dashed #38bdf8;
  border-radius: 24px;
  width: min(92dvw, 500px);
  padding: clamp(1.75rem, 5vw, 3.5rem) clamp(1.25rem, 6vw, 4.5rem);
  text-align: center;
  color: #f8fafc;
  box-shadow: 
    0 25px 60px rgba(0, 0, 0, 0.8),
    0 0 45px rgba(56, 189, 248, 0.25),
    inset 0 0 30px rgba(56, 189, 248, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  animation: drag-pulse 2.2s ease-in-out infinite;
  pointer-events: none;
}

@keyframes drag-pulse {
  0%, 100% {
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 35px rgba(56, 189, 248, 0.2), inset 0 0 20px rgba(56, 189, 248, 0.06);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 65px rgba(56, 189, 248, 0.38), inset 0 0 35px rgba(56, 189, 248, 0.15);
    transform: scale(1.02);
  }
}

.drag-icon-pulse {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #38bdf8;
  box-shadow: 0 0 24px rgba(56, 189, 248, 0.25);
  margin-bottom: 0.5rem;
}

.drag-box h3 {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #f8fafc;
}

.drag-box p {
  color: #94a3b8;
  font-size: 0.9rem;
}

/* ==========================================================================
   BOTTOM-RIGHT UPLOAD WIDGET
   ========================================================================== */
.upload-widget {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 340px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  z-index: 90;
  overflow: hidden;
  animation: widget-slide-up 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes widget-slide-up {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.upload-widget-header {
  height: 44px;
  background-color: #24262b;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
}

.widget-close-btn {
  font-size: 1.25rem;
  color: var(--text-muted);
  padding: 0.25rem;
  border-radius: 50%;
}

.widget-close-btn:hover {
  color: var(--text-primary);
}

.upload-widget-body {
  padding: 1rem;
}

.widget-file-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.widget-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.25rem 0.45rem;
  border-radius: var(--radius-sm);
  background-color: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}

.widget-file-info {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8125rem;
}

.widget-filename {
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}

.widget-percent {
  color: var(--accent-cyan);
  font-family: var(--font-mono);
}

/* Styled Accessible Progress Bar */
progress {
  appearance: none;
  border: 0 solid;
  overflow: clip;
  width: 100%;
  height: 6px;
  border-radius: var(--radius-pill);
  background: #27272a;
  display: block;
}

progress::-webkit-progress-bar {
  background: transparent;
}

progress::-webkit-progress-value {
  background: var(--accent-cyan);
  border-radius: var(--radius-pill);
  transition: width 0.25s ease;
}

progress::-moz-progress-bar {
  background: var(--accent-cyan);
  border-radius: var(--radius-pill);
  transition: width 0.25s ease;
}

/* ==========================================================================
   MODAL DIALOGS (Glassmorphism & High-Contrast Design)
   ========================================================================== */
dialog {
  margin: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 0;
  background: linear-gradient(165deg, rgba(24, 28, 38, 0.98) 0%, rgba(13, 16, 22, 0.98) 100%);
  color: var(--text-primary);
  box-shadow: 
    0 0 0 1px rgba(255, 255, 255, 0.04),
    0 25px 65px -15px rgba(0, 0, 0, 0.85),
    0 0 40px -10px rgba(56, 189, 248, 0.15);
  max-width: 490px;
  width: min(94dvw, 490px);
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
  overflow-x: hidden !important;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
  animation: modal-enter 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

dialog::-webkit-scrollbar {
  width: 5px;
  height: 0px !important;
}

dialog::-webkit-scrollbar-horizontal {
  display: none !important;
  height: 0px !important;
  width: 0px !important;
}

dialog::-webkit-scrollbar-track {
  background: transparent;
}

dialog::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
}

@keyframes modal-enter {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(12px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  background: radial-gradient(circle at center, rgba(15, 23, 42, 0.72) 0%, rgba(2, 6, 23, 0.9) 100%);
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  overflow: hidden;
  overscroll-behavior: contain;
}

.dialog-box {
  padding: 1.4rem 1.5rem;
  overflow-x: hidden;
  max-width: 100%;
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.dialog-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.dialog-title-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dialog-title-icon.icon-details {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.25);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.2);
}

.dialog-title-icon.icon-pin-locked {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.25);
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.2);
}

.dialog-title-icon.icon-upload-modal {
  background: rgba(99, 102, 241, 0.12);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.25);
  box-shadow: 0 0 14px rgba(99, 102, 241, 0.2);
}

.dialog-title-icon.icon-link-modal {
  background: rgba(6, 182, 212, 0.12);
  color: #22d3ee;
  border: 1px solid rgba(6, 182, 212, 0.25);
  box-shadow: 0 0 14px rgba(6, 182, 212, 0.2);
}

.dialog-header h3 {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: #f8fafc;
}

.dialog-header .btn-dialog-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s ease;
  cursor: pointer;
  flex-shrink: 0;
}

.dialog-header .btn-dialog-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  transform: rotate(90deg);
}

.dialog-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

/* Modal In-Dialog Drag & Drop Zone */
.modal-dropzone {
  border: 2px dashed rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.03);
  border-radius: 14px;
  padding: 1rem 0.85rem;
  text-align: center;
  cursor: pointer;
  margin-bottom: 1.1rem;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  user-select: none;
}

.modal-dropzone:hover,
.modal-dropzone.dragover {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.08);
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.18);
  transform: translateY(-1px);
}

.dropzone-icon {
  color: #38bdf8;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: float-icon 2.8s ease-in-out infinite;
}

@keyframes float-icon {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.dropzone-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  text-align: center;
  width: 100%;
}

.dropzone-prompt {
  font-size: 0.875rem;
  color: #e2e8f0;
  display: block;
  margin: 0;
  line-height: 1.4;
}

.dropzone-browse {
  color: #38bdf8;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 500;
}

.dropzone-limit {
  font-size: 0.75rem;
  color: #94a3b8;
  display: block;
  margin: 0;
  line-height: 1.3;
}

/* Sleek File Card inside Dialogs */
.dialog-file-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.035) 0%, rgba(255, 255, 255, 0.012) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1.1rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  min-width: 0;
}

.file-badge {
  font-size: 0.725rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.55rem 0.7rem;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.file-badge.icon-type-blue {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.28) 0%, rgba(2, 132, 199, 0.15) 100%);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #38bdf8;
}

.file-badge.icon-type-red {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.28) 0%, rgba(185, 28, 28, 0.15) 100%);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
}

.file-badge.icon-type-green {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.28) 0%, rgba(21, 128, 61, 0.15) 100%);
  border: 1px solid rgba(34, 197, 94, 0.4);
  color: #4ade80;
}

.file-badge.icon-type-amber {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.28) 0%, rgba(180, 83, 9, 0.15) 100%);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fbbf24;
}

.file-badge.icon-type-purple {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.28) 0%, rgba(126, 34, 206, 0.15) 100%);
  border: 1px solid rgba(168, 85, 247, 0.4);
  color: #c084fc;
}

.file-badge.icon-type-cyan {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.28) 0%, rgba(8, 145, 178, 0.15) 100%);
  border: 1px solid rgba(6, 182, 212, 0.4);
  color: #22d3ee;
}

.dialog-file-meta {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.dialog-file-meta h4 {
  font-size: 0.925rem;
  font-weight: 600;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.2rem;
  line-height: 1.35;
}

.dialog-file-meta p {
  font-size: 0.775rem;
  color: #94a3b8;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0;
}

.dialog-field {
  margin-bottom: 1.1rem;
}

.dialog-field label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #cbd5e1;
  margin-bottom: 0.45rem;
}

.dialog-field input {
  width: 100%;
  padding: 0.7rem 0.9rem;
  background-color: #12141a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.875rem;
  outline: none;
  transition: all 0.2s ease;
}

.dialog-field input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.25);
}

.pin-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.btn-toggle-pin {
  position: absolute;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-toggle-pin:hover {
  color: #f8fafc;
  background-color: rgba(255, 255, 255, 0.08);
}

/* PIN Input Field with Centered Digit Styling */
.pin-input-field {
  text-align: center;
  font-size: 1.25rem !important;
  letter-spacing: 0.25em;
  font-weight: 700;
  font-family: var(--font-mono) !important;
  background-color: #0f1218 !important;
  border: 1.5px solid rgba(255, 255, 255, 0.12) !important;
  padding: 0.75rem 1rem !important;
}

.pin-input-field::placeholder {
  letter-spacing: 0.08em;
  font-weight: 400;
  color: #475569;
  font-size: 0.95rem;
}

.pin-input-wrap .pin-input-field {
  padding-right: 44px !important;
}

.pin-input-field:focus {
  border-color: #fbbf24 !important;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25) !important;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.shake {
  animation: shake 0.35s ease-in-out;
}

/* PIN Protected Pill Badge in Table */
.badge-pin-protected {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.45rem;
  border-radius: 9999px;
  background-color: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fbbf24;
  font-size: 0.675rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  line-height: 1;
  vertical-align: middle;
  margin-left: 0.45rem;
}

/* Upload Dialog Access Options */
.access-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.35rem;
}

@media (max-width: 440px) {
  .access-options {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }
}

.access-option-label {
  position: relative;
  cursor: pointer;
  display: block;
}

.access-option-label input[type="radio"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 0 !important;
  height: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
}

.access-option-box {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.8rem 0.85rem;
  background-color: rgba(255, 255, 255, 0.025);
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  transition: all 0.2s ease;
  height: 100%;
}

.access-option-label input[type="radio"]:checked + .access-option-box {
  border-color: #38bdf8;
  background-color: rgba(56, 189, 248, 0.08);
  box-shadow: 0 0 0 1px #38bdf8, 0 4px 14px rgba(56, 189, 248, 0.15);
}

.access-icon {
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
}

.access-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.access-text strong {
  font-size: 0.85rem;
  color: var(--text-primary);
}

.access-text small {
  font-size: 0.725rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.pin-error-msg {
  color: #f87171;
  font-size: 0.8rem;
  font-weight: 500;
  margin-top: 0.4rem;
}

/* Modern Shareable Link Input with Integrated Copy Button */
.input-with-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #0f1217;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 0.35rem;
  transition: all 0.2s ease;
}

.input-with-button:focus-within {
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.25);
}

.input-with-button input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  padding: 0.45rem 0.75rem;
  font-size: 0.85rem;
  color: #e2e8f0;
  outline: none;
  font-family: var(--font-mono);
}

.btn-copy-link {
  background: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%);
  color: #0c121e;
  font-weight: 600;
  font-size: 0.825rem;
  padding: 0.5rem 0.95rem;
  border-radius: 8px;
  transition: all 0.15s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  box-shadow: 0 2px 8px rgba(56, 189, 248, 0.3);
}

.btn-copy-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.45);
}

.btn-copy-link.copied {
  background: linear-gradient(135deg, #15803d 0%, #22c55e 100%);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.35);
}

.dialog-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.45rem;
}

.dialog-switch-hint {
  font-size: 0.8125rem;
  color: #94a3b8;
  text-align: center;
  margin-top: 1.15rem;
  margin-bottom: 0;
}

.btn-switch-modal {
  background: none;
  border: none;
  color: var(--accent-cyan);
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: inherit;
  transition: color 0.15s ease;
}

.btn-switch-modal:hover {
  color: #7dd3fc;
}

/* Modal Actions Footer */
.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
  margin-top: 1.5rem;
  padding-top: 1.15rem;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.btn-action-primary {
  background: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%);
  color: #0c121e;
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.6rem 1.25rem;
  border-radius: 10px;
  gap: 0.45rem;
  box-shadow: 0 2px 10px rgba(56, 189, 248, 0.35);
  transition: all 0.15s ease;
}

.btn-action-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(56, 189, 248, 0.5);
}

.btn-action-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.6rem 1.25rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.15s ease;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: auto;
  height: auto;
}

.btn-action-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

/* ==========================================================================
   TOAST NOTIFICATIONS
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background-color: #27272a;
  color: #ededed;
  border: 1px solid var(--border-subtle);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  animation: toast-in 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   RESPONSIVE LAYOUT BASELINE (Touch hover & access options)
   ========================================================================== */
@media (hover: none) {
  .row-hover-actions {
    opacity: 1 !important;
  }
}

/* ==========================================
   PERFECT WEB LOADER
   ========================================== */
.table-container {
  position: relative;
}

.vault-loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(13, 15, 18, 0.88);
  backdrop-filter: blur(8px);
  z-index: 50;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.vault-loader.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-spinner-wrap {
  position: relative;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.15rem;
}

.loader-glow-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: #38bdf8;
  border-right-color: #818cf8;
  border-bottom-color: #ef4444;
  animation: loader-spin 0.9s cubic-bezier(0.55, 0.15, 0.45, 0.85) infinite;
  filter: drop-shadow(0 0 12px rgba(56, 189, 248, 0.5));
}

.loader-inner-circle {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #181a20;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
  animation: loader-pulse 2s ease-in-out infinite;
}

@keyframes loader-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes loader-pulse {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.08); opacity: 1; }
}

.loader-title {
  font-size: 1rem;
  font-weight: 600;
  color: #f8fafc;
  letter-spacing: 0.02em;
}

.loader-subtitle {
  font-size: 0.8rem;
  color: #94a3b8;
  margin-top: 0.25rem;
}

/* ==========================================================================
   CLASSIC UPLOAD TRACER WIDGET
   ========================================================================== */
.upload-widget.classic-tracer {
  position: fixed;
  bottom: 3.8rem;
  right: 1.5rem;
  width: 360px;
  background: #14161b;
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 10px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.65), 0 0 24px rgba(56, 189, 248, 0.12);
  z-index: 90;
  overflow: hidden;
  animation: widget-slide-up 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.tracer-header-left {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.tracer-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #38bdf8;
  box-shadow: 0 0 8px #38bdf8;
  animation: pulse-dot 1.2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

.tracer-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #f1f5f9;
}

.tracer-percent-badge {
  font-family: monospace;
  font-weight: 700;
  font-size: 0.8rem;
  color: #38bdf8;
}

.tracer-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  overflow: hidden;
  position: relative;
  margin: 0.75rem 0;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4);
}

.tracer-fill {
  height: 100%;
  background: linear-gradient(90deg, #0284c7, #38bdf8, #818cf8);
  border-radius: 9999px;
  position: relative;
  transition: width 0.15s ease-out;
}

.tracer-glow-tip {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 12px;
  background: #ffffff;
  filter: blur(2px);
  border-radius: 9999px;
}

.tracer-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.4rem;
  background: rgba(0, 0, 0, 0.35);
  padding: 0.55rem 0.65rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.tracer-metric-box {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.tracer-metric-label {
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
}

.tracer-metric-val {
  font-size: 0.75rem;
  font-family: monospace;
  font-weight: 600;
  color: #f1f5f9;
  white-space: nowrap;
}

#tracer-size { color: #38bdf8; }
#tracer-speed { color: #4ade80; }
#tracer-eta { color: #fbbf24; }

/* ==========================================================================
   VAULT FOOTER (Full-Width Red Filled Database Trace, No Borders)
   ========================================================================== */
.vault-footer {
  position: relative;
  height: 48px;
  background-color: #0e1014; /* Empty space dark color */
  border: none !important;
  border-top: none !important;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  overflow: hidden;
  user-select: none;
  box-shadow: none !important;
}

/* Red filled space bar expanding across the full width */
.footer-storage-fill {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 0%;
  background: linear-gradient(90deg, #991b1b, #dc2626, #ef4444);
  box-shadow: 4px 0 20px rgba(239, 68, 68, 0.65);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1;
  pointer-events: none;
}

/* Content overlays above the red fill bar */
.footer-content {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 1.5rem;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

.footer-left {
  display: flex;
  align-items: center;
}

.storage-tracker {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.storage-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background-color: rgba(0, 0, 0, 0.35);
  color: #f87171;
  flex-shrink: 0;
}

.storage-details {
  display: flex;
  flex-direction: column;
}

.storage-text-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: #e2e8f0;
  line-height: 1;
}

.storage-title {
  font-weight: 700;
  color: #ffffff;
}

.db-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 9999px;
  background-color: rgba(0, 0, 0, 0.4);
  color: #cbd5e1;
  transition: all 0.2s ease;
}

.db-badge.status-supabase {
  background-color: rgba(34, 197, 94, 0.25);
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.35);
}

.db-badge.status-local {
  background-color: rgba(245, 158, 11, 0.25);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.35);
}

.storage-metric {
  font-family: monospace;
  color: #ffffff;
  font-weight: 600;
}

.storage-percent {
  font-family: monospace;
  color: #fca5a5;
  font-weight: 600;
}

.storage-dot-separator {
  color: rgba(255, 255, 255, 0.4);
}

.storage-files {
  color: #cbd5e1;
}

.footer-right {
  display: flex;
  align-items: center;
}

.creator-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.7);
}

.creator-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
  background-color: rgba(14, 16, 20, 0.7);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.creator-link:hover {
  background-color: rgba(14, 165, 233, 0.3);
  border-color: rgba(56, 189, 248, 0.6);
  color: #38bdf8;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.3);
}

.linkedin-svg {
  color: #38bdf8;
  transition: color 0.2s ease;
}

.creator-arrow {
  opacity: 0.7;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.creator-link:hover .creator-arrow {
  opacity: 1;
  transform: translate(1px, -1px);
}

/* Footer safe-area base handled cleanly in global responsive breakpoints below */

.badge-flagged {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.6875rem;
  font-weight: 600;
  color: #f87171;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 9999px;
  padding: 0.15rem 0.45rem;
  margin-left: 0.5rem;
  white-space: nowrap;
}

/* ==========================================
   INTERACTIVE IN-APP PREVIEW MODAL SUITE
   ========================================== */

.btn-action-preview {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.65rem 1.1rem;
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-action-preview:hover {
  background: rgba(56, 189, 248, 0.25);
  border-color: var(--accent-cyan);
  transform: translateY(-1px);
}

.preview-modal {
  border: none;
  border-radius: 16px;
  padding: 0;
  background: transparent;
  width: 95vw;
  max-width: 1260px;
  height: 88vh;
  max-height: 920px;
  overflow: hidden;
  box-shadow: 0 30px 80px -15px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
}

.preview-modal::backdrop {
  background: rgba(4, 7, 15, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.preview-modal[open] {
  animation: previewModalZoom 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes previewModalZoom {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.preview-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background: #090e1a;
  border-radius: 16px;
  overflow: hidden;
}

/* Preview Header */
.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  height: 60px;
  background: #0e1526;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  z-index: 20;
}

.preview-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.preview-title-meta-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.preview-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 480px;
}

.preview-meta {
  margin: 0;
  font-size: 0.75rem;
  color: #94a3b8;
  font-family: var(--font-mono);
}

.preview-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-preview-tool {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.8rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}

.btn-preview-tool:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #f8fafc;
  border-color: rgba(255, 255, 255, 0.22);
}

.btn-preview-primary {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.35);
}

.btn-preview-primary:hover {
  background: #38bdf8;
  color: #040812;
  border-color: #38bdf8;
}

.btn-preview-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-left: 0.25rem;
}

.btn-preview-close:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.4);
}

/* Preview Content Body */
.preview-content-area {
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  background: #060911;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
}

/* Loading Spinner inside preview */
.preview-spinner-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  color: #94a3b8;
  font-size: 0.875rem;
}

/* Iframe Embed (PDF, Office Web Viewer, Google Docs) */
.preview-frame {
  width: 100%;
  height: 100%;
  border: none;
  background: #ffffff;
}

/* Image Lightbox View */
.preview-image-container {
  width: 100%;
  height: 100%;
  overflow: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 1.5rem;
  background: 
    radial-gradient(circle, rgba(255,255,255,0.03) 1px, transparent 1px) 0 0 / 20px 20px,
    #060911;
}

.preview-image-elem {
  max-width: 92%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7);
  transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.preview-image-toolbar {
  position: absolute;
  bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 30px;
  padding: 0.35rem 0.75rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  z-index: 10;
}

.preview-img-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.preview-img-btn:hover {
  background: rgba(56, 189, 248, 0.3);
  color: #38bdf8;
}

/* ==========================================
   EXCEL ROW-COLUMN SPREADSHEET VIEW
   ========================================== */

.preview-excel-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #090e1a;
  overflow: hidden;
}

.excel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 1rem;
  background: #0f172a;
  border-bottom: 1px solid #1e293b;
  gap: 1rem;
  flex-shrink: 0;
}

.excel-tabs-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  overflow-x: auto;
  max-width: 60%;
}

.excel-sheet-tab {
  padding: 0.3rem 0.75rem;
  font-size: 0.78125rem;
  font-weight: 500;
  color: #94a3b8;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.excel-sheet-tab:hover {
  color: #f1f5f9;
  border-color: #107c41;
}

.excel-sheet-tab.active {
  background: #107c41;
  color: #ffffff;
  border-color: #107c41;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(16, 124, 65, 0.35);
}

.excel-controls-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.excel-search-box {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #090e1a;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 0.25rem 0.55rem;
}

.excel-search-input {
  background: transparent;
  border: none;
  color: #f8fafc;
  font-size: 0.78125rem;
  outline: none;
  width: 140px;
}

.excel-grid-meta {
  font-size: 0.75rem;
  color: #64748b;
  font-family: var(--font-mono);
  white-space: nowrap;
}

.excel-scroll-area {
  flex: 1;
  overflow: auto;
  position: relative;
  background: #090e1a;
}

.excel-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  text-align: left;
}

.excel-corner {
  position: sticky;
  top: 0;
  left: 0;
  z-index: 25;
  background: #141f32;
  border-right: 1px solid #28374d;
  border-bottom: 1px solid #28374d;
  width: 44px;
  min-width: 44px;
  text-align: center;
  color: #64748b;
  font-size: 0.75rem;
}

.excel-col-head {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #141f32;
  border-right: 1px solid #28374d;
  border-bottom: 1px solid #28374d;
  padding: 0.35rem 0.65rem;
  color: #94a3b8;
  font-weight: 600;
  font-size: 0.75rem;
  text-align: center;
  min-width: 90px;
  user-select: none;
}

.excel-row-num {
  position: sticky;
  left: 0;
  z-index: 15;
  background: #111a2a;
  border-right: 1px solid #28374d;
  border-bottom: 1px solid #1e293b;
  padding: 0.3rem 0.45rem;
  text-align: center;
  color: #64748b;
  font-size: 0.75rem;
  user-select: none;
  width: 44px;
  min-width: 44px;
}

.excel-cell {
  border-right: 1px solid #1a2536;
  border-bottom: 1px solid #1a2536;
  padding: 0.35rem 0.65rem;
  color: #cbd5e1;
  white-space: nowrap;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  background: #090e1a;
}

.excel-table tbody tr:hover .excel-cell {
  background: rgba(16, 124, 65, 0.12);
  color: #f8fafc;
}

.excel-table tbody tr:hover .excel-row-num {
  background: #18253b;
  color: #38bdf8;
}

/* ==========================================
   CODE & TEXT VIEWER
   ========================================== */

.preview-code-container {
  width: 100%;
  height: 100%;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #070b14;
}

.code-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem;
  background: #0d1322;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.code-toolbar-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.78125rem;
  color: #94a3b8;
  font-family: var(--font-mono);
}

.code-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-code-copy {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.32rem 0.68rem;
  font-size: 0.75rem;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: #cbd5e1;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-code-copy:hover,
.btn-code-copy[aria-pressed="true"] {
  background: rgba(56, 189, 248, 0.18);
  border-color: rgba(56, 189, 248, 0.6);
  color: #38bdf8;
}

.code-viewport {
  --code-scrollbar-thumb: #334155;
  --code-scrollbar-track: #070b14;
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  line-height: 1.6;
  background: #070b14;
  scrollbar-width: thin;
  scrollbar-color: var(--code-scrollbar-thumb) var(--code-scrollbar-track);
}

@supports not (scrollbar-color: auto) {
  .code-viewport {
    scrollbar-width: auto;
  }
  .code-viewport::-webkit-scrollbar {
    width: 10px;
    height: 10px;
  }
  .code-viewport::-webkit-scrollbar-thumb {
    background: var(--code-scrollbar-thumb);
    border-radius: 6px;
  }
  .code-viewport::-webkit-scrollbar-track {
    background: var(--code-scrollbar-track);
  }
}

/* Aligned 2-column CSS Grid code/text viewer (supports word-wrap without line-number drift) */
.code-grid {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  min-width: 100%;
  width: max-content;
  padding-block: 0.75rem;
}

.code-viewport.is-wrapped .code-grid {
  width: 100%;
}

.code-ln {
  position: sticky;
  left: 0;
  z-index: 2;
  padding: 0 0.8rem 0 0.9rem;
  background: #05080e;
  border-right: 1px solid #1e293b;
  color: #64748b;
  text-align: right;
  user-select: none;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.code-line {
  padding: 0 1.25rem;
  color: #e2e8f0;
  white-space: pre;
  tab-size: 4;
  font-variant-ligatures: none;
}

.code-viewport.is-wrapped .code-line {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Large-file (>5k lines) synchronized gutter + pre fallback */
.code-viewport-fast {
  display: flex;
  align-items: flex-start;
}

.code-gutter {
  position: sticky;
  left: 0;
  z-index: 2;
  flex-shrink: 0;
  padding: 0.85rem 0.8rem 0.85rem 0.9rem;
  background: #05080e;
  border-right: 1px solid #1e293b;
  color: #64748b;
  text-align: right;
  user-select: none;
  font-size: 0.84rem;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
  min-width: 48px;
}

.code-gutter-line {
  display: block;
}

.code-pre {
  flex: 1 0 auto;
  margin: 0;
  padding: 0.85rem 1.25rem;
  color: #e2e8f0;
  font-family: inherit;
  font-size: 0.84rem;
  line-height: 1.6;
  white-space: pre;
  tab-size: 4;
}

.code-viewport.is-wrapped .code-pre {
  flex: 1 1 0;
  min-width: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.code-empty-notice {
  margin: auto;
  padding: 2rem;
  text-align: center;
  color: #64748b;
  font-size: 0.875rem;
}

/* Syntax Highlight Tokens */
.tok-com { color: #64748b; font-style: italic; }
.tok-str { color: #86efac; }
.tok-num { color: #fca5a5; }
.tok-kw  { color: #c084fc; font-weight: 500; }
.tok-type { color: #38bdf8; }
.tok-pre { color: #fbbf24; }
.tok-fn  { color: #93c5fd; }
.tok-key { color: #7dd3fc; }

/* ==========================================
   WEB LINK CARD VIEW
   ========================================== */

.preview-link-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.25rem;
  padding: 2.5rem;
  max-width: 520px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 18px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
}

.preview-link-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #38bdf8;
}

.preview-link-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #f8fafc;
}

.preview-link-url-box {
  display: flex;
  align-items: center;
  background: #090e1a;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 0.5rem 0.85rem;
  width: 100%;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: #38bdf8;
  word-break: break-all;
}

.preview-link-btn-launch {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  background: #38bdf8;
  color: #040812;
  font-weight: 600;
  border-radius: 10px;
  text-decoration: none;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(56, 189, 248, 0.35);
}

.preview-link-btn-launch:hover {
  background: #7dd3fc;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(56, 189, 248, 0.5);
}

/* ==========================================
   404 / NOSUCHKEY ERROR RECOVERY CARD
   ========================================== */

.preview-error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.25rem;
  padding: 2.5rem;
  max-width: 540px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 18px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7);
}

.preview-error-icon-box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.preview-error-state h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  color: #f8fafc;
}

.preview-error-state p {
  margin: 0;
  font-size: 0.875rem;
  color: #94a3b8;
  line-height: 1.5;
}

.preview-error-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.btn-error-purge {
  padding: 0.65rem 1.25rem;
  background: #dc2626;
  color: #ffffff;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-error-purge:hover {
  background: #ef4444;
}

.btn-error-close {
  padding: 0.65rem 1.25rem;
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  font-size: 0.875rem;
  cursor: pointer;
}

.btn-error-close:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ==========================================================================
   COMPREHENSIVE RESPONSIVE BREAKPOINTS (Monitors, Laptops, iPad/Tablets, Phones)
   ========================================================================== */

/* Large Desktops & Wide Monitors (>= 1600px) */
@media (min-width: 1600px) {
  .navbar {
    padding-inline: 2rem;
  }
  .nav-center {
    max-width: 780px;
  }
  .vault-subnav,
  .footer-content {
    padding-inline: 2rem;
  }
  .vault-table th,
  .vault-table td {
    padding-inline: 1.35rem;
  }
  .preview-modal {
    max-width: 1520px;
    height: 90dvh;
    max-height: 1040px;
  }
}

/* Tablets / iPad Landscape & Narrow Laptops (<= 1100px) */
@media (max-width: 1100px) {
  .navbar {
    gap: 1rem;
    padding-inline: 1rem;
  }
  .nav-left {
    min-width: auto;
  }
  .th-name, .cell-name { width: 40%; max-width: 40%; }
  .th-date, .cell-date { width: 22%; max-width: 22%; }
  .th-expires, .cell-expires { width: 13%; max-width: 13%; }
  .th-size, .cell-size { width: 9%; max-width: 9%; }
  .th-views, .cell-views { width: 7%; max-width: 7%; }
  .th-actions, .cell-actions { width: 9%; min-width: 96px; max-width: 9%; }
  .preview-modal {
    width: 96dvw;
    height: 92dvh;
  }
}

/* iPad Portrait & Tablets (<= 900px) */
@media (max-width: 900px) {
  .view-subtitle {
    display: none;
  }
  .vault-subnav {
    padding-inline: 1rem;
  }
  .th-expires, .cell-expires {
    display: none;
  }
  .th-name, .cell-name { width: 44%; max-width: 44%; }
  .th-date, .cell-date { width: 25%; max-width: 25%; }
  .th-size, .cell-size { width: 11%; max-width: 11%; }
  .th-views, .cell-views { width: 8%; max-width: 8%; }
  .th-actions, .cell-actions { width: 12%; min-width: 96px; max-width: 12%; }
  .row-hover-actions {
    opacity: 1 !important;
  }
  .btn-upload, .btn-add-link, .btn-add-text {
    padding: 0 0.85rem;
    font-size: 0.8125rem;
  }
}

/* Mobile Devices & Phablets (<= 680px down to 320px) */
@media (max-width: 680px) {
  .navbar {
    height: auto;
    min-height: 60px;
    flex-wrap: wrap;
    padding: 0.65rem max(0.85rem, env(safe-area-inset-right, 0px)) 0.65rem max(0.85rem, env(safe-area-inset-left, 0px));
    gap: 0.6rem;
  }
  .nav-left {
    min-width: auto;
    flex-shrink: 0;
  }
  .brand-name {
    font-size: 1.05rem;
  }
  .nav-center {
    flex: 1 1 160px;
    min-width: 0;
    max-width: none;
  }
  .search-box form {
    height: 40px;
    padding: 0 0.85rem;
  }
  .nav-right {
    flex: 1 0 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.45rem;
  }
  .btn-upload, .btn-add-link, .btn-add-text {
    width: 100%;
    height: 40px;
    padding: 0 0.5rem;
    justify-content: center;
    font-size: 0.8125rem;
  }

  .vault-subnav {
    height: auto;
    min-height: 44px;
    padding: 0.5rem 0.9rem;
    flex-wrap: wrap;
    gap: 0.4rem;
  }
  .view-title {
    font-size: 0.95rem;
  }
  .subnav-guide-link {
    display: inline-flex;
    font-size: 0.75rem;
    padding: 0.2rem 0.45rem;
  }

  /* Transform Vault Table into Scannable Mobile Cards while Keeping Column Sorting */
  .vault-table {
    display: block;
    width: 100%;
    table-layout: auto;
  }
  .vault-table thead {
    display: block;
    overflow-x: auto;
    background-color: var(--bg-app);
    border-bottom: 1px solid var(--border-subtle);
  }
  .vault-table thead tr {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.4rem 0.75rem;
  }
  .vault-table thead th {
    position: static;
    width: auto !important;
    max-width: none !important;
    flex: 0 0 auto;
    padding: 0.3rem 0.55rem;
    border-bottom: none;
    border-radius: var(--radius-sm);
    background-color: var(--bg-surface);
    font-size: 0.75rem;
  }
  .vault-table thead th.th-expires,
  .vault-table thead th.th-actions {
    display: none;
  }

  .vault-table tbody {
    display: block;
  }
  .vault-table tbody tr {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.75rem;
    height: auto;
    padding: 0.8rem 0.9rem;
  }
  .vault-table tbody td {
    padding: 0;
    white-space: normal;
  }
  .vault-table tbody td.cell-name {
    flex: 1 0 100%;
    width: 100%;
    max-width: 100%;
  }
  .cell-name-content {
    gap: 0.65rem;
    align-items: flex-start;
  }
  .row-file-icon {
    margin-top: 2px;
  }
  .row-filename {
    white-space: normal;
    flex-wrap: wrap;
    gap: 0.25rem 0.4rem;
    overflow: visible;
  }
  .row-filename > span.row-title-text {
    white-space: normal;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.35;
  }
  .vault-table tbody td.cell-date,
  .vault-table tbody td.cell-expires,
  .vault-table tbody td.cell-size,
  .vault-table tbody td.cell-views {
    display: inline-flex;
    align-items: center;
    width: auto;
    max-width: none;
    font-size: 0.76rem;
    color: var(--text-muted);
  }
  .vault-table tbody td.cell-actions {
    margin-inline-start: auto;
    width: auto;
    min-width: auto;
    max-width: none;
  }
  .row-hover-actions {
    opacity: 1 !important;
    gap: 0.3rem;
  }

  .empty-actions {
    flex-direction: column;
    align-items: stretch;
    padding-inline: 1rem;
  }
  .empty-actions > * {
    width: 100%;
  }

  /* Footer & Floating Widgets */
  .vault-footer {
    height: auto;
    padding: 0.55rem 0 max(0.55rem, env(safe-area-inset-bottom, 0px));
  }
  .footer-content {
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
    padding: 0 0.9rem;
  }
  .footer-right {
    justify-content: space-between;
  }
  .upload-widget.classic-tracer {
    width: calc(100dvw - 1.5rem);
    right: 0.75rem;
    left: 0.75rem;
    bottom: 0.75rem;
  }
  .toast-container {
    right: 0.75rem;
    left: 0.75rem;
    bottom: 1rem;
    align-items: stretch;
  }
  .toast {
    max-width: 100%;
  }

  /* Fullscreen Mobile Preview Modal & Inner Toolbars */
  .preview-modal {
    width: 100dvw;
    max-width: none;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
  }
  .preview-shell {
    border-radius: 0;
  }
  .preview-header {
    height: auto;
    min-height: 54px;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.65rem 0.85rem;
  }
  .preview-title-group {
    flex: 1 1 180px;
  }
  .preview-header-actions {
    margin-inline-start: auto;
    flex-wrap: wrap;
  }
  .excel-toolbar {
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
  }
  .excel-tabs-wrap {
    max-width: 100%;
    width: 100%;
  }
  .excel-controls-right {
    width: 100%;
    justify-content: space-between;
  }
  .excel-search-box {
    flex: 1;
  }
  .excel-search-input {
    width: 100%;
  }
  .code-toolbar {
    padding: 0.5rem 0.75rem;
  }
  .preview-link-card,
  .preview-error-state {
    width: min(92dvw, 520px);
    padding: 1.5rem 1.25rem;
  }
  .preview-image-container {
    padding: 0.75rem;
  }
  .preview-image-toolbar {
    bottom: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 92dvw;
  }
  .quick-text-shortcut {
    display: none;
  }
  .dialog-box {
    padding: 1.1rem;
  }
  .dialog-actions > * {
    flex: 1 1 auto;
    justify-content: center;
  }
}

/* Narrow Phones (<= 440px) */
@media (max-width: 440px) {
  .brand-name {
    display: none;
  }
  .vault-table tbody td.cell-actions {
    flex: 1 0 100%;
    margin-inline-start: 0;
    text-align: left;
  }
  .row-hover-actions {
    justify-content: flex-start;
  }
}

/* Touch Devices: Comfortable Tap Targets (WCAG 2.5.5) */
@media (pointer: coarse) {
  .row-action-btn,
  .subnav-btn,
  .btn-dialog-close,
  .btn-preview-close {
    min-width: 40px;
    min-height: 40px;
  }
  .btn-copy-link,
  .btn-preview-tool,
  .btn-action-primary,
  .btn-action-secondary,
  .btn-action-preview {
    min-height: 44px;
  }
}

