/* =========================================
   VEXIORIQ DESIGN SYSTEM — Media Manager
   ========================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --bg-page: #171717;
  --bg-surface: #1B1B1B;
  --bg-card: #222222;
  --bg-input: #171717;
  --bg-elevated: #2A2A2A;

  --border-default: #343434;
  --border-hover: #404040;
  --border-subtle: rgba(52, 52, 52, 0.7);
  --border-focus: #6FAF82;

  --text-primary: #F2F2F2;
  --text-secondary: #E5E5E5;
  --text-tertiary: #9B9B9C;
  --text-muted: #717078;
  --text-white: #ffffff;

  --accent-green: #6FAF82;
  --accent-green-bg: rgba(6, 95, 70, 0.2);
  --accent-green-border: rgba(6, 95, 70, 0.4);
  --accent-gold: #C4A45D;
  --accent-gold-bg: rgba(196, 164, 93, 0.1);
  --accent-gold-border: rgba(196, 164, 93, 0.2);
  --accent-red: #C96B6B;
  --accent-red-bg: rgba(201, 107, 107, 0.1);
  --accent-red-border: rgba(201, 107, 107, 0.2);

  --white-02: rgba(255, 255, 255, 0.02);
  --white-04: rgba(255, 255, 255, 0.04);
  --white-05: rgba(255, 255, 255, 0.05);
  --white-06: rgba(255, 255, 255, 0.06);
  --white-08: rgba(255, 255, 255, 0.08);
  --white-10: rgba(255, 255, 255, 0.1);
  --white-15: rgba(255, 255, 255, 0.15);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 12px 40px rgba(0, 0, 0, 0.6);

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 24px;
  --radius-full: 9999px;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;

  --sidebar-width: 260px;
  --header-height: 60px;
  --panel-width: 320px;
}

/* =========================================
   RESET & BASE
   ========================================= */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-page);
  color: var(--text-secondary);
  line-height: 1.6;
  min-height: 100vh;
  overflow: hidden;
}

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

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

ul, ol {
  list-style: none;
}

::selection {
  background: var(--accent-green);
  color: var(--bg-page);
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-hover);
}

/* =========================================
   TYPOGRAPHY
   ========================================= */

.text-xs { font-size: 0.75rem; line-height: 1.5; }
.text-sm { font-size: 0.875rem; line-height: 1.5; }
.text-base { font-size: 1rem; line-height: 1.6; }
.text-lg { font-size: 1.125rem; line-height: 1.5; }
.text-xl { font-size: 1.25rem; line-height: 1.4; }
.text-2xl { font-size: 1.5rem; line-height: 1.3; }
.text-3xl { font-size: 2rem; line-height: 1.2; }
.text-4xl { font-size: 2.5rem; line-height: 1.1; }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }
.font-mono { font-family: var(--font-mono); }

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-muted { color: var(--text-muted); }
.text-white { color: var(--text-white); }
.text-green { color: var(--accent-green); }
.text-gold { color: var(--accent-gold); }
.text-red { color: var(--accent-red); }

.tracking-tight { letter-spacing: -0.025em; }
.tracking-wide { letter-spacing: 0.025em; }
.tracking-wider { letter-spacing: 0.05em; }
.tracking-widest { letter-spacing: 0.1em; }
.uppercase { text-transform: uppercase; }

/* =========================================
   LAYOUT
   ========================================= */

.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  transition: transform var(--transition-slow);
  z-index: 30;
}

.sidebar-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border-default);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-brand-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: var(--white-08);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-brand-icon svg {
  width: 18px;
  height: 18px;
  color: var(--accent-green);
}

.sidebar-brand-text {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.sidebar-brand-badge {
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--white-04);
  border: 1px solid var(--border-default);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.sidebar-section {
  margin-bottom: 8px;
}

.sidebar-section-label {
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 8px 12px 6px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-tertiary);
  transition: all var(--transition-fast);
  cursor: pointer;
  position: relative;
}

.sidebar-link:hover {
  color: var(--text-secondary);
  background: var(--white-05);
}

.sidebar-link.active {
  color: var(--text-primary);
  background: var(--white-08);
}

.sidebar-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}

.sidebar-link.active svg {
  opacity: 1;
}

.sidebar-link-count {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--white-04);
  padding: 1px 8px;
  border-radius: var(--radius-full);
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border-default);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  color: var(--text-tertiary);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.sidebar-user:hover {
  background: var(--white-05);
  color: var(--text-secondary);
}

.sidebar-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--white-08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.main-header {
  height: var(--header-height);
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  background: var(--bg-surface);
  flex-shrink: 0;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.875rem;
  min-width: 0;
}

.breadcrumb-item {
  color: var(--text-muted);
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--transition-fast);
  padding: 2px 4px;
  border-radius: var(--radius-sm);
}

.breadcrumb-item:hover {
  color: var(--text-secondary);
}

.breadcrumb-item.current {
  color: var(--text-primary);
  font-weight: 500;
}

.breadcrumb-sep {
  color: var(--text-muted);
  opacity: 0.5;
  font-size: 0.75rem;
}

.header-search {
  position: relative;
  flex: 1;
  max-width: 400px;
}

.header-search input {
  width: 100%;
  height: 36px;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  padding: 0 12px 0 36px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  outline: none;
}

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

.header-search input:focus {
  border-color: var(--border-hover);
  box-shadow: 0 0 0 2px rgba(111, 175, 130, 0.1);
}

.header-search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border-default);
  background: var(--bg-surface);
  flex-shrink: 0;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.content-area {
  flex: 1;
  overflow: auto;
  padding: 20px 24px;
}

.detail-panel {
  width: var(--panel-width);
  background: var(--bg-surface);
  border-left: 1px solid var(--border-default);
  overflow-y: auto;
  flex-shrink: 0;
  display: none;
}

.detail-panel.visible {
  display: block;
}

/* =========================================
   BUTTONS
   ========================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  border-radius: var(--radius-full);
  transition: all var(--transition-base);
  white-space: nowrap;
  outline: none;
  position: relative;
  overflow: hidden;
}

.btn:active {
  transform: scale(0.98);
}

.btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.btn-primary {
  background: var(--text-white);
  color: var(--bg-page);
  padding: 8px 20px;
  font-size: 0.875rem;
  box-shadow: var(--shadow-md), 0 0 20px rgba(255, 255, 255, 0.1);
}

.btn-primary:hover {
  box-shadow: var(--shadow-lg), 0 0 30px rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0) scale(0.98);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
  padding: 8px 20px;
  font-size: 0.875rem;
}

.btn-secondary:hover {
  border-color: var(--border-hover);
  background: var(--bg-card);
}

.btn-ghost {
  color: var(--text-muted);
  padding: 6px 12px;
  font-size: 0.8125rem;
}

.btn-ghost:hover {
  color: var(--text-secondary);
  background: var(--white-05);
}

.btn-danger {
  background: var(--accent-red-bg);
  color: var(--accent-red);
  border: 1px solid var(--accent-red-border);
  padding: 8px 20px;
  font-size: 0.875rem;
}

.btn-danger:hover {
  background: rgba(201, 107, 107, 0.2);
}

.btn-sm {
  padding: 5px 14px;
  font-size: 0.8125rem;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-md);
}

.btn-icon-sm {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--radius-sm);
}

.btn-icon svg {
  width: 18px;
  height: 18px;
}

.btn-icon-sm svg {
  width: 16px;
  height: 16px;
}

.btn-icon:hover {
  background: var(--white-06);
  color: var(--text-secondary);
}

.btn-icon-sm:hover {
  background: var(--white-06);
  color: var(--text-secondary);
}

.view-toggle {
  display: flex;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.view-toggle-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.view-toggle-btn:hover {
  color: var(--text-secondary);
  background: var(--white-05);
}

.view-toggle-btn.active {
  color: var(--text-primary);
  background: var(--white-08);
}

.view-toggle-btn svg {
  width: 16px;
  height: 16px;
}

/* =========================================
   FORMS / INPUTS
   ========================================= */

.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-tertiary);
}

.input {
  height: 40px;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 0 14px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  outline: none;
  width: 100%;
}

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

.input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(111, 175, 130, 0.15);
}

.input-lg {
  height: 48px;
  font-size: 1rem;
  padding: 0 16px;
}

.input-with-icon {
  position: relative;
}

.input-with-icon .input {
  padding-left: 40px;
}

.input-with-icon svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23717078' viewBox='0 0 16 16'%3E%3Cpath d='M4.427 6.427l3.396 3.396a.25.25 0 00.354 0l3.396-3.396A.25.25 0 0011.396 6H4.604a.25.25 0 00-.177.427z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* =========================================
   CARDS
   ========================================= */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: 20px;
  transition: all var(--transition-slow);
}

.card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
}

.card-clickable {
  cursor: pointer;
}

.card-clickable:hover {
  transform: translateY(-2px);
}

.card-clickable:active {
  transform: translateY(0);
}

/* =========================================
   FILE GRID
   ========================================= */

.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.file-tile {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
  display: flex;
  flex-direction: column;
}

.file-tile:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.file-tile.selected {
  border-color: var(--accent-green);
  box-shadow: 0 0 0 2px rgba(111, 175, 130, 0.2);
}

.file-tile-checkbox {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-default);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition-fast);
  z-index: 5;
}

.file-tile:hover .file-tile-checkbox,
.file-tile.selected .file-tile-checkbox {
  opacity: 1;
}

.file-tile.selected .file-tile-checkbox {
  background: var(--accent-green);
  border-color: var(--accent-green);
}

.file-tile.selected .file-tile-checkbox svg {
  display: block;
}

.file-tile-checkbox svg {
  width: 12px;
  height: 12px;
  color: white;
  display: none;
}

.file-tile-preview {
  height: 140px;
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.file-tile-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.file-tile-preview .file-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-tile-preview .file-icon svg {
  width: 40px;
  height: 40px;
  color: var(--text-muted);
  opacity: 0.5;
}

.file-tile-preview .folder-icon svg {
  width: 48px;
  height: 48px;
  color: var(--accent-gold);
  opacity: 0.7;
}

.file-tile-info {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.file-tile-name {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-tile-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* =========================================
   FILE LIST
   ========================================= */

.file-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.file-list-header {
  display: grid;
  grid-template-columns: 40px 1fr 120px 140px 120px;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-default);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.file-list-row {
  display: grid;
  grid-template-columns: 40px 1fr 120px 140px 120px;
  gap: 12px;
  padding: 10px 16px;
  align-items: center;
  border-bottom: 1px solid var(--border-default);
  cursor: pointer;
  transition: background var(--transition-fast);
  font-size: 0.875rem;
}

.file-list-row:last-child {
  border-bottom: none;
}

.file-list-row:hover {
  background: var(--white-04);
}

.file-list-row.selected {
  background: rgba(111, 175, 130, 0.08);
}

.file-list-row .file-icon-sm {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--white-04);
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-list-row .file-icon-sm svg {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}

.file-list-row .file-icon-sm.folder svg {
  color: var(--accent-gold);
}

.file-list-row .file-name {
  font-weight: 500;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-list-row .file-size,
.file-list-row .file-modified,
.file-list-row .file-type {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.file-list-row .file-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.file-list-row:hover .file-actions {
  opacity: 1;
}

/* =========================================
   DETAIL PANEL
   ========================================= */

.detail-panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.detail-panel-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.detail-preview {
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-page);
  border-bottom: 1px solid var(--border-default);
  min-height: 200px;
}

.detail-preview img {
  max-width: 100%;
  max-height: 300px;
  border-radius: var(--radius-md);
  object-fit: contain;
}

.detail-preview .file-icon-lg {
  display: flex;
  align-items: center;
  justify-content: center;
}

.detail-preview .file-icon-lg svg {
  width: 64px;
  height: 64px;
  color: var(--text-muted);
  opacity: 0.3;
}

.detail-info {
  padding: 16px 20px;
}

.detail-info-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-default);
  gap: 12px;
}

.detail-info-row:last-child {
  border-bottom: none;
}

.detail-info-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.detail-info-value {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-align: right;
  word-break: break-all;
}

.detail-actions {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-url {
  padding: 12px 20px;
  border-top: 1px solid var(--border-default);
}

.detail-url-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.detail-url-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 8px 12px;
}

.detail-url-text {
  flex: 1;
  font-size: 0.8125rem;
  font-family: var(--font-mono);
  color: var(--text-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* =========================================
   MODALS
   ========================================= */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.modal-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 520px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  transform: translateY(20px) scale(0.98);
  transition: transform var(--transition-base);
}

.modal-overlay.visible .modal {
  transform: translateY(0) scale(1);
}

.modal-header {
  padding: 20px 24px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-default);
}

.modal-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--white-06);
  color: var(--text-secondary);
}

.modal-close svg {
  width: 18px;
  height: 18px;
}

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 24px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid var(--border-default);
}

/* =========================================
   UPLOAD DROPZONE
   ========================================= */

.upload-dropzone {
  border: 2px dashed var(--border-default);
  border-radius: var(--radius-xl);
  padding: 48px 24px;
  text-align: center;
  transition: all var(--transition-base);
  cursor: pointer;
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
  border-color: var(--accent-green);
  background: rgba(111, 175, 130, 0.05);
}

.upload-dropzone svg {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
  margin: 0 auto 16px;
}

.upload-dropzone.dragover svg {
  color: var(--accent-green);
}

.upload-dropzone-text {
  font-size: 0.9375rem;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.upload-dropzone-hint {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.upload-progress {
  margin-top: 16px;
}

.upload-progress-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-default);
}

.upload-progress-item:last-child {
  border-bottom: none;
}

.upload-progress-name {
  font-size: 0.875rem;
  color: var(--text-secondary);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-progress-bar {
  width: 100%;
  height: 4px;
  background: var(--white-08);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 4px;
}

.upload-progress-fill {
  height: 100%;
  background: var(--accent-green);
  border-radius: var(--radius-full);
  transition: width var(--transition-base);
}

.upload-progress-status {
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.upload-progress-status.done {
  color: var(--accent-green);
}

.upload-progress-status.error {
  color: var(--accent-red);
}

/* =========================================
   TOASTS / NOTIFICATIONS
   ========================================= */

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 300px;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toastIn 300ms ease forwards;
}

.toast.removing {
  animation: toastOut 200ms ease forwards;
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.toast-success .toast-icon { color: var(--accent-green); }
.toast-error .toast-icon { color: var(--accent-red); }
.toast-warning .toast-icon { color: var(--accent-gold); }
.toast-info .toast-icon { color: var(--text-muted); }

.toast-message {
  flex: 1;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.toast-close {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.toast-close:hover {
  background: var(--white-06);
  color: var(--text-secondary);
}

.toast-close svg {
  width: 14px;
  height: 14px;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(20px); }
}

/* =========================================
   BADGES / TAGS
   ========================================= */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--white-04);
  border: 1px solid var(--border-default);
  color: var(--text-muted);
}

.badge-green {
  background: var(--accent-green-bg);
  border-color: var(--accent-green-border);
  color: var(--accent-green);
}

.badge-gold {
  background: var(--accent-gold-bg);
  border-color: var(--accent-gold-border);
  color: var(--accent-gold);
}

.badge-red {
  background: var(--accent-red-bg);
  border-color: var(--accent-red-border);
  color: var(--accent-red);
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge-dot-pulse {
  animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* =========================================
   EMPTY STATES
   ========================================= */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 24px;
  text-align: center;
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-xl);
  background: var(--white-04);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.empty-state-icon svg {
  width: 28px;
  height: 28px;
  color: var(--text-muted);
}

.empty-state-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.empty-state-text {
  font-size: 0.875rem;
  color: var(--text-muted);
  max-width: 320px;
  margin-bottom: 20px;
}

/* =========================================
   LOADING
   ========================================= */

.loading-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-default);
  border-top-color: var(--accent-green);
  border-radius: 50%;
  animation: spin 600ms linear infinite;
}

.loading-spinner-sm {
  width: 14px;
  height: 14px;
}

.loading-spinner-lg {
  width: 32px;
  height: 32px;
  border-width: 3px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.skeleton {
  background: linear-gradient(90deg, var(--white-04) 25%, var(--white-08) 50%, var(--white-04) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* =========================================
   LOGIN / SETUP
   ========================================= */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-page);
  padding: 24px;
  overflow: auto;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: 40px 32px;
}

.auth-brand {
  text-align: center;
  margin-bottom: 32px;
}

.auth-brand-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  background: var(--white-08);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.auth-brand-icon svg {
  width: 24px;
  height: 24px;
  color: var(--accent-green);
}

.auth-brand-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.auth-brand-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-form .btn-primary {
  width: 100%;
  height: 48px;
  font-size: 0.9375rem;
  margin-top: 8px;
}

.auth-error {
  background: var(--accent-red-bg);
  border: 1px solid var(--accent-red-border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 0.875rem;
  color: var(--accent-red);
  display: none;
}

.auth-error.visible {
  display: block;
}

/* =========================================
   CONTEXT MENU
   ========================================= */

.context-menu {
  position: fixed;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 6px;
  min-width: 200px;
  z-index: 150;
  box-shadow: var(--shadow-lg);
  display: none;
}

.context-menu.visible {
  display: block;
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.context-menu-item:hover {
  background: var(--white-06);
}

.context-menu-item.danger {
  color: var(--accent-red);
}

.context-menu-item svg {
  width: 16px;
  height: 16px;
  opacity: 0.7;
}

.context-menu-sep {
  height: 1px;
  background: var(--border-default);
  margin: 4px 8px;
}

/* =========================================
   DROPDOWN
   ========================================= */

.dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 6px;
  min-width: 180px;
  z-index: 50;
  box-shadow: var(--shadow-lg);
  display: none;
}

.dropdown-menu.visible {
  display: block;
}

/* =========================================
   STATS CARDS
   ========================================= */

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

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all var(--transition-base);
}

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

.stat-card-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.stat-card-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.025em;
  line-height: 1;
}

.stat-card-sub {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* =========================================
   API KEY DISPLAY
   ========================================= */

.api-key-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 10px 14px;
}

.api-key-text {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--text-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.mobile-menu-btn {
  display: none;
}

@media (max-width: 1024px) {
  .detail-panel {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 40;
    box-shadow: var(--shadow-xl);
  }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    z-index: 40;
    box-shadow: var(--shadow-xl);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-menu-btn {
    display: flex;
  }

  .header-search {
    display: none;
  }

  .file-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
  }

  .file-list-header,
  .file-list-row {
    grid-template-columns: 40px 1fr 80px;
  }

  .file-list-header .col-modified,
  .file-list-header .col-type,
  .file-list-row .col-modified,
  .file-list-row .col-type {
    display: none;
  }

  .toolbar {
    flex-wrap: wrap;
    padding: 10px 16px;
  }

  .content-area {
    padding: 16px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .auth-card {
    padding: 28px 20px;
  }

  .file-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================================
   UTILITIES
   ========================================= */

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

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.flex-1 { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }
.w-full { width: 100%; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.hidden { display: none !important; }
.pointer-events-none { pointer-events: none; }
.overflow-hidden { overflow: hidden; }
.relative { position: relative; }
