/* ============================================================
   APHETA CLIENT VAULT — Design System
   Inherits all brand tokens from the main site aesthetic.
   Cormorant Garamond (editorial) + Inter (UI)
   Bronze accent: #8a6f48
   ============================================================ */

:root {
  --black:      #0a0a0a;
  --ink:        #1a1a1a;
  --grey-900:   #2a2a2a;
  --grey-700:   #555;
  --grey-500:   #8a8a8a;
  --grey-300:   #d6d6d6;
  --grey-100:   #f3f3f1;
  --paper:      #ffffff;
  --bone:       #fafaf7;
  --accent:     #8a6f48;
  --accent-soft:#b89971;
  --red:        #c0392b;
  --green:      #27ae60;

  --serif:  'Cormorant Garamond', Georgia, serif;
  --sans:   'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  --sidebar-w:  260px;
  --topbar-h:   64px;
  --transition: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out:   cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body { font-family: var(--sans); color: var(--ink); background: var(--bone); }
a    { color: inherit; text-decoration: none; }
button { font-family: var(--sans); cursor: pointer; }
input, textarea, select { font-family: var(--sans); }
img  { display: block; max-width: 100%; }

/* ── Page fade-in ───────────────────────────────────────────────────────────── */
@keyframes pageFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0);   }
}
body { animation: pageFadeIn 0.5s var(--ease-out) both; }

/* ── Spinner ────────────────────────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 0.8s linear infinite; display: inline-block; }

/* ============================================================
   AUTH PAGES (login, invite-accept, forgot, reset)
   ============================================================ */

.auth-page {
  min-height: 100vh;
  background: var(--bone);
  display: flex;
  align-items: stretch;
}

.back-link {
  position: fixed;
  top: 28px;
  left: 32px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--grey-500);
  transition: color var(--transition);
  z-index: 10;
}
.back-link:hover { color: var(--ink); }

.auth-layout {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px 48px;
  gap: 40px;
}

.auth-brand { text-align: center; }
.auth-logo  { height: 52px; display: inline-block; }

/* ── Auth card ──────────────────────────────────────────────────────────────── */
.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--paper);
  border: 1px solid var(--grey-300);
  padding: clamp(36px, 6vw, 56px);
}

.auth-card-header {
  margin-bottom: 36px;
}

.auth-card-header h1 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(28px, 4vw, 40px);
  letter-spacing: -0.01em;
  color: var(--black);
  margin-bottom: 8px;
  line-height: 1.1;
}

.auth-card-header p {
  font-size: 14px;
  color: var(--grey-500);
  font-weight: 300;
  line-height: 1.6;
}

/* ── Form fields ────────────────────────────────────────────────────────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 28px;
}

.field label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--grey-500);
}

.field input,
.field textarea,
.field .select-field {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--grey-300);
  padding: 12px 0;
  font-size: 15px;
  font-weight: 300;
  color: var(--ink);
  width: 100%;
  outline: none;
  transition: border-color var(--transition);
  border-radius: 0;
  -webkit-appearance: none;
}

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

.field input.readonly {
  color: var(--grey-500);
  cursor: default;
}

.field textarea {
  resize: vertical;
  min-height: 80px;
  padding: 8px 0;
}

.field-inner {
  position: relative;
  display: flex;
  align-items: center;
}

.field-inner input { padding-right: 36px; }

.toggle-pass {
  position: absolute;
  right: 0;
  background: none;
  border: none;
  padding: 4px;
  color: var(--grey-500);
  transition: color var(--transition);
  display: flex;
}
.toggle-pass:hover { color: var(--ink); }

/* ── Password strength ──────────────────────────────────────────────────────── */
.pass-strength {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}
.pass-strength-bar {
  flex: 1;
  height: 2px;
  background: var(--grey-300);
  position: relative;
  overflow: hidden;
}
.pass-strength-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.4s var(--ease-out), background 0.3s;
}
.pass-strength-fill.weak   { background: var(--red); }
.pass-strength-fill.fair   { background: #e67e22; }
.pass-strength-fill.good   { background: #f1c40f; }
.pass-strength-fill.strong { background: var(--green); }
.pass-strength-label {
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--grey-500);
  white-space: nowrap;
  min-width: 48px;
}

/* ── Form footer ────────────────────────────────────────────────────────────── */
.form-footer {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 28px;
  margin-top: -16px;
}

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 15px 32px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  border: 1px solid transparent;
  transition: all var(--transition);
  cursor: pointer;
  position: relative;
  white-space: nowrap;
}

.btn-primary {
  background: var(--black);
  border-color: var(--black);
  color: var(--paper);
}
.btn-primary:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.btn-ghost {
  background: transparent;
  border-color: var(--grey-300);
  color: var(--ink);
}
.btn-ghost:hover {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.btn-full  { width: 100%; }
.btn-sm    { padding: 10px 20px; font-size: 10px; }

.btn:disabled { opacity: 0.5; pointer-events: none; }

.btn-spinner { display: none; }
.btn.loading .btn-label  { opacity: 0; }
.btn.loading .btn-spinner { display: flex; position: absolute; }

/* ── Alerts ─────────────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 20px;
  border-left: 3px solid;
}
.alert-error   { background: #fdf2f2; border-color: var(--red);   color: var(--red); }
.alert-warn    { background: #fdf8ed; border-color: #e67e22;      color: #8a4a00; }
.alert-success { background: #f0faf4; border-color: var(--green); color: #1a5f35; }

/* ── Links ──────────────────────────────────────────────────────────────────── */
.link-muted {
  font-size: 12px;
  color: var(--grey-500);
  transition: color var(--transition);
}
.link-muted:hover { color: var(--accent); }

/* ── Auth note ──────────────────────────────────────────────────────────────── */
.auth-note {
  margin-top: 28px;
  font-size: 12px;
  color: var(--grey-500);
  text-align: center;
  line-height: 1.7;
}

/* ── Auth footer ────────────────────────────────────────────────────────────── */
.auth-footer {
  display: flex;
  gap: 12px;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--grey-500);
  text-transform: uppercase;
}

/* ── Invite badge ───────────────────────────────────────────────────────────── */
.invite-badge {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 4px 12px;
  display: inline-block;
  margin-bottom: 20px;
}

/* ── Invite meta block ──────────────────────────────────────────────────────── */
.invite-meta {
  background: var(--bone);
  border-left: 3px solid var(--grey-300);
  padding: 12px 16px;
  margin-bottom: 28px;
  font-size: 13px;
  color: var(--grey-700);
  font-style: italic;
  display: none;
}
.invite-meta.visible { display: block; }

/* ── Success icon ───────────────────────────────────────────────────────────── */
.success-icon { margin-bottom: 20px; }

/* ============================================================
   APP LAYOUT (dashboard, admin, settings)
   ============================================================ */

.app-page {
  display: flex;
  min-height: 100vh;
  background: var(--bone);
}

/* ── Sidebar ────────────────────────────────────────────────────────────────── */
.app-sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--paper);
  border-right: 1px solid var(--grey-300);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
  transition: transform var(--transition);
}

.sidebar-brand {
  padding: 28px 28px 20px;
  border-bottom: 1px solid var(--grey-300);
}
.sidebar-logo { height: 36px; }

.sidebar-nav {
  flex: 1;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--grey-700);
  transition: all var(--transition);
  border-left: 2px solid transparent;
}
.sidebar-link:hover {
  color: var(--ink);
  background: var(--bone);
  border-left-color: var(--grey-300);
}
.sidebar-link.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--bone);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px;
  border-top: 1px solid var(--grey-300);
}

.sidebar-user-avatar {
  width: 34px;
  height: 34px;
  background: var(--accent);
  color: var(--paper);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
}

.sidebar-user-info {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-user-name {
  font-size: 13px;
  font-weight: 400;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--grey-500);
}

.sidebar-logout {
  background: none;
  border: none;
  color: var(--grey-500);
  padding: 4px;
  flex-shrink: 0;
  transition: color var(--transition);
  display: flex;
}
.sidebar-logout:hover { color: var(--red); }

/* ── Main content area ──────────────────────────────────────────────────────── */
.app-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Top bar ────────────────────────────────────────────────────────────────── */
.app-topbar {
  height: var(--topbar-h);
  border-bottom: 1px solid var(--grey-300);
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 40;
}

.sidebar-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
}
.sidebar-toggle span {
  display: block;
  width: 20px;
  height: 1.5px;
  background: var(--ink);
}

.topbar-breadcrumb { flex: 1; display: flex; align-items: center; gap: 12px; }
.topbar-eyebrow {
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--grey-500);
}
.topbar-path {
  font-size: 13px;
  color: var(--grey-700);
}

.topbar-actions { display: flex; gap: 12px; align-items: center; }

/* ── Storage bar ────────────────────────────────────────────────────────────── */
.storage-bar-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 32px;
  border-bottom: 1px solid var(--grey-100);
  background: var(--paper);
}

.storage-bar {
  flex: 1;
  max-width: 300px;
  height: 2px;
  background: var(--grey-100);
  overflow: hidden;
  border-radius: 0;
}

.storage-bar-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.8s var(--ease-out);
}

.storage-label {
  font-size: 11px;
  color: var(--grey-500);
  letter-spacing: 0.05em;
  white-space: nowrap;
}

/* ── Vault coming soon ──────────────────────────────────────────────────────── */
.vault-coming-soon {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 32px;
  gap: 20px;
  color: var(--grey-500);
}

.vault-coming-icon { color: var(--grey-300); margin-bottom: 8px; }

.vault-coming-soon h2 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(28px, 3vw, 40px);
  color: var(--ink);
}

.vault-coming-soon p {
  font-size: 15px;
  line-height: 1.7;
  color: var(--grey-500);
  max-width: 420px;
}

.vault-quota-preview {
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.1em;
  margin-top: 8px;
}

/* ── Drop overlay ───────────────────────────────────────────────────────────── */
.drop-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: pageFadeIn 0.2s var(--ease-out) both;
}
.drop-overlay-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  color: var(--accent);
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 300;
}

/* ── Admin ──────────────────────────────────────────────────────────────────── */
.admin-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--grey-300);
  background: var(--paper);
  padding: 0 32px;
}

.admin-tab {
  background: none;
  border: none;
  padding: 16px 24px 14px;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--grey-500);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--transition);
}
.admin-tab:hover  { color: var(--ink); }
.admin-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.admin-tab-content { padding: 32px; }

/* ── Data table ─────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--grey-500);
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--grey-300);
  white-space: nowrap;
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--grey-100);
  color: var(--ink);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--bone); }

.table-empty {
  text-align: center;
  color: var(--grey-500);
  padding: 48px 16px !important;
  font-style: italic;
}

.status-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 0;
}
.status-badge.pending  { background: var(--grey-100); color: var(--grey-700); }
.status-badge.used     { background: #f0faf4; color: #1a5f35; }
.status-badge.expired  { background: #fdf2f2; color: var(--red); }
.status-badge.active   { background: #f0faf4; color: #1a5f35; }
.status-badge.inactive { background: var(--grey-100); color: var(--grey-700); }

.btn-revoke {
  background: none;
  border: 1px solid var(--grey-300);
  color: var(--grey-500);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 5px 12px;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-revoke:hover {
  border-color: var(--red);
  color: var(--red);
}

/* ── Modal ──────────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10,10,10,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
  animation: pageFadeIn 0.2s var(--ease-out) both;
}

.modal {
  background: var(--paper);
  border: 1px solid var(--grey-300);
  padding: 40px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  animation: pageFadeIn 0.3s var(--ease-out) both;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 32px;
}

.modal-header h2 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: 28px;
  color: var(--black);
}

.modal-close {
  background: none;
  border: none;
  color: var(--grey-500);
  padding: 4px;
  cursor: pointer;
  transition: color var(--transition);
}
.modal-close:hover { color: var(--ink); }

/* ── Settings ───────────────────────────────────────────────────────────────── */
.settings-sections {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.settings-section {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 40px;
  padding: 40px 32px;
  border-bottom: 1px solid var(--grey-300);
}

.settings-section-label h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 22px;
  color: var(--black);
  margin-bottom: 8px;
}

.settings-section-label p {
  font-size: 13px;
  color: var(--grey-500);
  line-height: 1.6;
}

.settings-section-form { max-width: 400px; }

/* ── Sessions list ──────────────────────────────────────────────────────────── */
.sessions-list { display: flex; flex-direction: column; gap: 12px; }

.session-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bone);
  border: 1px solid var(--grey-300);
  font-size: 13px;
}

.session-item-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.session-item-device {
  font-weight: 400;
  color: var(--ink);
}

.session-item-meta {
  font-size: 11px;
  color: var(--grey-500);
}

.session-item-current {
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 900px) {
  .app-sidebar {
    transform: translateX(-100%);
  }
  .app-sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 40px rgba(0,0,0,0.1);
  }
  .app-main {
    margin-left: 0;
  }
  .sidebar-toggle {
    display: flex;
  }
  .settings-section {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .admin-tab-content { padding: 20px 16px; }
}

@media (max-width: 600px) {
  .auth-layout { padding: 64px 16px 40px; }
  .auth-card   { padding: 32px 24px; }
  .app-topbar  { padding: 0 16px; }
  .storage-bar-wrap { padding: 10px 16px; }
}

/* ============================================================
   VAULT — File Browser (Phase 2)
   ============================================================ */

/* ── Vault layout ────────────────────────────────────────────────────────────── */
.vault-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.vault-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 32px;
  height: 52px;
  border-bottom: 1px solid var(--grey-100);
  background: var(--paper);
  flex-shrink: 0;
}

.vault-breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--grey-500);
  overflow: hidden;
}

.vault-crumb {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--transition);
  font-size: 13px;
}
.vault-crumb:hover { color: var(--accent); }
.vault-crumb.active { color: var(--ink); font-weight: 400; cursor: default; }
.vault-crumb.active:hover { color: var(--ink); }

.vault-crumb-sep { color: var(--grey-300); font-size: 11px; margin: 0 2px; }

.vault-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* View toggle */
.view-toggle {
  display: flex;
  border: 1px solid var(--grey-300);
}
.view-toggle-btn {
  background: none;
  border: none;
  padding: 6px 10px;
  color: var(--grey-500);
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
}
.view-toggle-btn.active { background: var(--ink); color: var(--paper); }
.view-toggle-btn:not(.active):hover { color: var(--ink); }

/* Sort button */
.sort-select {
  background: none;
  border: none;
  border-bottom: 1px solid var(--grey-300);
  padding: 6px 4px;
  font-size: 11px;
  color: var(--grey-500);
  cursor: pointer;
  outline: none;
  letter-spacing: 0.05em;
}

/* New folder button */
.btn-new-folder {
  background: none;
  border: 1px solid var(--grey-300);
  color: var(--grey-700);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 6px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition);
}
.btn-new-folder:hover { border-color: var(--accent); color: var(--accent); }

/* ── File list view ──────────────────────────────────────────────────────────── */
.vault-content {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

/* List view */
.file-list {
  width: 100%;
}

.file-list-header {
  display: grid;
  grid-template-columns: 40px 1fr 120px 160px 80px;
  gap: 0;
  padding: 0 32px;
  border-bottom: 1px solid var(--grey-300);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 5;
}
.file-list-header-cell {
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--grey-500);
  padding: 10px 8px;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.file-list-header-cell:hover { color: var(--ink); }
.file-list-header-cell.sort-active { color: var(--accent); }

.file-row {
  display: grid;
  grid-template-columns: 40px 1fr 120px 160px 80px;
  gap: 0;
  padding: 0 32px;
  border-bottom: 1px solid var(--grey-100);
  cursor: pointer;
  transition: background var(--transition);
  align-items: center;
  min-height: 48px;
}
.file-row:hover { background: var(--bone); }
.file-row.selected { background: rgba(138,111,72,0.06); }

.file-row-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--grey-400);
  flex-shrink: 0;
}
.file-row-icon .folder-icon { color: var(--accent); }

.file-row-name {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  padding: 0 8px;
}
.file-row-name-text {
  font-size: 13px;
  font-weight: 400;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-row-name-sub {
  font-size: 10px;
  color: var(--grey-500);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.file-row-size {
  font-size: 12px;
  color: var(--grey-500);
  padding: 0 8px;
  text-align: right;
}

.file-row-date {
  font-size: 12px;
  color: var(--grey-500);
  padding: 0 8px;
}

.file-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  padding: 0 0 0 8px;
  opacity: 0;
  transition: opacity var(--transition);
}
.file-row:hover .file-row-actions { opacity: 1; }

.row-action-btn {
  background: none;
  border: none;
  padding: 6px;
  color: var(--grey-500);
  cursor: pointer;
  transition: color var(--transition);
  display: flex;
  align-items: center;
  border-radius: 0;
}
.row-action-btn:hover { color: var(--ink); }
.row-action-btn.danger:hover { color: var(--red); }

/* ── Grid view ───────────────────────────────────────────────────────────────── */
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  padding: 24px 32px;
}

.file-card {
  background: var(--paper);
  border: 1px solid var(--grey-300);
  padding: 20px 16px 16px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}
.file-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 20px rgba(138,111,72,0.08);
}
.file-card.selected { border-color: var(--accent); background: rgba(138,111,72,0.04); }

.file-card-icon { color: var(--grey-400); }
.file-card-icon .folder-icon { color: var(--accent); }

.file-card-name {
  font-size: 12px;
  color: var(--ink);
  word-break: break-word;
  line-height: 1.4;
  max-width: 100%;
}

.file-card-meta {
  font-size: 10px;
  color: var(--grey-500);
  letter-spacing: 0.05em;
}

.file-card-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  opacity: 0;
  transition: opacity var(--transition);
}
.file-card:hover .file-card-actions { opacity: 1; }

/* ── Empty state ─────────────────────────────────────────────────────────────── */
.vault-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 32px;
  gap: 20px;
  color: var(--grey-500);
  text-align: center;
}
.vault-empty-icon { color: var(--grey-300); margin-bottom: 8px; }
.vault-empty h3 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: 28px;
  color: var(--ink);
}
.vault-empty p {
  font-size: 14px;
  line-height: 1.7;
  max-width: 360px;
}

/* ── Upload progress panel ───────────────────────────────────────────────────── */
.upload-tray {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 320px;
  background: var(--paper);
  border: 1px solid var(--grey-300);
  box-shadow: 0 8px 40px rgba(0,0,0,0.12);
  z-index: 150;
  overflow: hidden;
  animation: pageFadeIn 0.25s var(--ease-out) both;
}
.upload-tray[hidden] { display: none; }

.upload-tray-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--grey-100);
  background: var(--bone);
}
.upload-tray-title {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink);
}
.upload-tray-close {
  background: none;
  border: none;
  color: var(--grey-500);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 2px;
}
.upload-tray-close:hover { color: var(--ink); }

.upload-tray-list { max-height: 280px; overflow-y: auto; }

.upload-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--grey-100);
}
.upload-item:last-child { border-bottom: none; }

.upload-item-info { flex: 1; min-width: 0; }
.upload-item-name {
  font-size: 12px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.upload-item-size { font-size: 10px; color: var(--grey-500); margin-top: 2px; }

.upload-item-bar {
  height: 2px;
  background: var(--grey-100);
  margin-top: 6px;
  overflow: hidden;
}
.upload-item-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s ease;
  width: 0%;
}
.upload-item-fill.done  { background: var(--green); width: 100%; }
.upload-item-fill.error { background: var(--red);   width: 100%; }

.upload-item-status {
  flex-shrink: 0;
  width: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--grey-300);
}
.upload-item-status.done  { color: var(--green); }
.upload-item-status.error { color: var(--red);   }

/* ── Context menu ────────────────────────────────────────────────────────────── */
.ctx-menu {
  position: fixed;
  background: var(--paper);
  border: 1px solid var(--grey-300);
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  z-index: 300;
  min-width: 180px;
  animation: pageFadeIn 0.15s var(--ease-out) both;
  padding: 4px 0;
}
.ctx-menu[hidden] { display: none; }

.ctx-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  transition: background var(--transition);
}
.ctx-item:hover { background: var(--bone); }
.ctx-item.danger { color: var(--red); }
.ctx-item.danger:hover { background: #fdf2f2; }
.ctx-sep { height: 1px; background: var(--grey-100); margin: 4px 0; }

/* ── Rename inline input ─────────────────────────────────────────────────────── */
.rename-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--accent);
  outline: none;
  font-size: 13px;
  color: var(--ink);
  width: 100%;
  padding: 2px 0;
}

/* ── Trash view ──────────────────────────────────────────────────────────────── */
.trash-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 32px;
  background: rgba(192,57,43,0.06);
  border-bottom: 1px solid rgba(192,57,43,0.15);
  font-size: 12px;
  color: var(--red);
}

/* ── New folder modal (inline) ───────────────────────────────────────────────── */
.inline-create-row {
  display: grid;
  grid-template-columns: 40px 1fr 120px 160px 80px;
  gap: 0;
  padding: 0 32px;
  border-bottom: 1px solid var(--grey-100);
  align-items: center;
  background: rgba(138,111,72,0.04);
  min-height: 48px;
}

/* ── Loading skeleton ────────────────────────────────────────────────────────── */
@keyframes shimmer {
  from { background-position: -400px 0; }
  to   { background-position: 400px 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--grey-100) 25%, var(--grey-300) 50%, var(--grey-100) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 0;
}
.skeleton-row {
  height: 48px;
  margin-bottom: 1px;
  width: 100%;
}

/* ── Responsive vault ────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .file-list-header { grid-template-columns: 36px 1fr 80px 56px; }
  .file-list-header .col-date { display: none; }
  .file-row         { grid-template-columns: 36px 1fr 80px 56px; }
  .file-row .file-row-date { display: none; }
  .vault-toolbar    { padding: 0 16px; }
  .file-grid        { padding: 16px; gap: 12px; }
  .upload-tray      { width: calc(100vw - 32px); right: 16px; bottom: 16px; }
}
@media (max-width: 600px) {
  .file-list-header { grid-template-columns: 36px 1fr 56px; }
  .file-list-header .col-size { display: none; }
  .file-row         { grid-template-columns: 36px 1fr 56px; padding: 0 16px; }
  .file-row .file-row-size { display: none; }
  .vault-breadcrumb { font-size: 12px; }
  .storage-bar-wrap { padding: 8px 16px; }
}
