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

/* ============================================================
   DESIGN SYSTEM - CSS VARIABLES
   ============================================================ */
:root {
  --bg:           #080b14;
  --surface:      #0f1220;
  --surface-2:    #161926;
  --surface-3:    #1e2333;
  --border:       rgba(255,255,255,0.07);
  --border-hover: rgba(255,255,255,0.15);
  --accent:       #6366f1;
  --accent-2:     #a855f7;
  --accent-glow:  rgba(99,102,241,0.25);
  --text:         #e2e8f0;
  --text-muted:   #64748b;
  --text-subtle:  #475569;
  --success:      #22c55e;
  --success-bg:   rgba(34,197,94,0.12);
  --error:        #ef4444;
  --error-bg:     rgba(239,68,68,0.12);
  --warning:      #f59e0b;
  --warning-bg:   rgba(245,158,11,0.12);
  --info:         #3b82f6;
  --info-bg:      rgba(59,130,246,0.12);

  /* File type colors */
  --color-folder: #6366f1;
  --color-image:  #ec4899;
  --color-video:  #ef4444;
  --color-audio:  #f97316;
  --color-doc:    #3b82f6;
  --color-code:   #22c55e;
  --color-zip:    #eab308;
  --color-other:  #64748b;

  --radius:    10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow:    0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 48px rgba(0,0,0,0.6);
  --transition: 0.2s ease;

  --sidebar-w: 240px;
  --header-h:  64px;
  --nav-h:     64px;
}

/* ============================================================
   LIGHT THEME OVERRIDES
   ============================================================ */
[data-theme="light"] {
  --bg:           #f5f7fb;
  --surface:      #ffffff;
  --surface-2:    #eef1f7;
  --surface-3:    #e2e7f0;
  --border:       rgba(0,0,0,0.08);
  --border-hover: rgba(0,0,0,0.18);
  --accent-glow:  rgba(99,102,241,0.12);
  --text:         #0f172a;
  --text-muted:   #64748b;
  --text-subtle:  #94a3b8;
  --success-bg:   rgba(34,197,94,0.1);
  --error-bg:     rgba(239,68,68,0.1);
  --warning-bg:   rgba(245,158,11,0.1);
  --info-bg:      rgba(59,130,246,0.1);
  --shadow:       0 4px 24px rgba(0,0,0,0.07);
  --shadow-lg:    0 8px 48px rgba(0,0,0,0.13);
}

/* Component overrides that use hardcoded colours */
[data-theme="light"] .login-card {
  background: rgba(255,255,255,0.92);
  border-color: rgba(0,0,0,0.07);
  box-shadow: 0 8px 40px rgba(0,0,0,0.1), 0 0 0 1px rgba(99,102,241,0.07);
}
[data-theme="light"] .orb-1 { opacity: 0.12; }
[data-theme="light"] .orb-2 { opacity: 0.10; }

[data-theme="light"] .modal {
  box-shadow: 0 16px 48px rgba(0,0,0,0.14);
}
[data-theme="light"] .context-menu {
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}
[data-theme="light"] .drop-overlay {
  background: rgba(245,247,251,0.92);
}
[data-theme="light"] .toast {
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}
[data-theme="light"] .sidebar-overlay {
  background: rgba(15,23,42,0.35);
}
[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: var(--surface-3);
}
[data-theme="light"] .nav-item.active {
  background: rgba(99,102,241,0.1);
}
[data-theme="light"] .file-grid-item:hover,
[data-theme="light"] .file-list-row:hover {
  background: var(--surface-2);
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; font-size: 15px; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }
img { max-width: 100%; display: block; }
ul, ol { list-style: none; }

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-subtle); }

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 1.375rem; font-weight: 600; letter-spacing: -0.01em; }
h3 { font-size: 1.125rem; font-weight: 600; }
h4 { font-size: 0.9375rem; font-weight: 500; }

.text-muted  { color: var(--text-muted); }
.text-subtle { color: var(--text-subtle); }
.text-sm     { font-size: 0.8125rem; }
.text-xs     { font-size: 0.75rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }

/* ============================================================
   LOGIN PAGE — FULL SCREEN
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: var(--bg);
}

/* Animated gradient orbs */
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  pointer-events: none;
}
.orb-1 {
  width: 520px; height: 520px;
  background: radial-gradient(circle, #6366f1 0%, transparent 70%);
  top: -140px; left: -140px;
  animation: orbFloat1 12s ease-in-out infinite alternate;
}
.orb-2 {
  width: 460px; height: 460px;
  background: radial-gradient(circle, #a855f7 0%, transparent 70%);
  bottom: -120px; right: -120px;
  animation: orbFloat2 10s ease-in-out infinite alternate;
}

@keyframes orbFloat1 {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(60px, 40px) scale(1.08); }
}
@keyframes orbFloat2 {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(-50px, -30px) scale(1.1); }
}

/* Glassmorphism login card */
.login-card {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 420px;
  margin: 1rem;
  padding: 2.5rem 2rem;
  background: rgba(15, 18, 32, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(99,102,241,0.1);
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  margin-bottom: 1.75rem;
}
.login-logo svg { width: 36px; height: 36px; color: var(--accent); }
.login-logo span {
  font-size: 1.1875rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-heading {
  text-align: center;
  margin-bottom: 0.375rem;
  font-size: 1.5rem;
  font-weight: 700;
}
.login-subheading {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 2rem;
}

/* OTP Input boxes */
.otp-container {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}
.otp-input {
  width: 48px; height: 56px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1.375rem;
  font-weight: 600;
  text-align: center;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  caret-color: transparent;
}
.otp-input:focus {
  border-color: var(--accent);
  background: var(--surface-3);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.otp-input.filled {
  border-color: rgba(99,102,241,0.5);
  background: var(--surface-3);
}

/* Login button */
.btn-login {
  width: 100%;
  padding: 0.8125rem 1.25rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: opacity var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 4px 20px rgba(99,102,241,0.35);
}
.btn-login:hover:not(:disabled) {
  opacity: 0.92;
  transform: translateY(-1px);
  box-shadow: 0 6px 28px rgba(99,102,241,0.45);
}
.btn-login:active:not(:disabled) { transform: translateY(0); }
.btn-login:disabled { opacity: 0.55; cursor: not-allowed; }

/* Spinner */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  display: none;
}
.spinner.visible { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Error message */
.login-error {
  margin-top: 0.875rem;
  padding: 0.625rem 0.875rem;
  background: var(--error-bg);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: var(--radius);
  color: var(--error);
  font-size: 0.8125rem;
  text-align: center;
  display: none;
}
.login-error.visible { display: block; }

/* Setup link */
.login-footer {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-muted);
}
.login-footer a {
  color: var(--accent);
  font-weight: 500;
  transition: color var(--transition);
}
.login-footer a:hover { color: var(--accent-2); }

/* ============================================================
   APP LAYOUT
   ============================================================ */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform var(--transition);
  z-index: 100;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar-logo svg { width: 18px; height: 18px; color: #fff; }
.sidebar-title {
  font-size: 0.9375rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0.75rem 0;
  overflow-y: auto;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
  text-decoration: none;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover {
  background: var(--surface-2);
  color: var(--text);
}
.nav-item.active {
  background: rgba(99,102,241,0.15);
  color: var(--accent);
}

.sidebar-footer {
  padding: 1rem 0.75rem 1.25rem;
  border-top: 1px solid var(--border);
}

/* Storage stats in sidebar */
.storage-stats {
  padding: 0.75rem 0.875rem;
  background: var(--surface-2);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
}
.storage-stats-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.storage-stats-label span:last-child { color: var(--text); font-weight: 500; }

.progress-bar {
  height: 4px;
  background: var(--surface-3);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 99px;
  transition: width 0.5s ease;
}
.progress-fill.warn { background: linear-gradient(90deg, var(--warning), #f97316); }
.progress-fill.danger { background: linear-gradient(90deg, var(--error), #f97316); }

.btn-logout {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  width: 100%;
  padding: 0.625rem 0.875rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.btn-logout svg { width: 16px; height: 16px; }
.btn-logout:hover {
  background: var(--error-bg);
  color: var(--error);
  border-color: rgba(239,68,68,0.3);
}

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ============================================================
   HEADER / TOOLBAR
   ============================================================ */
.app-header {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1.25rem;
  flex-shrink: 0;
}

.hamburger {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.375rem;
  border-radius: var(--radius);
  transition: background var(--transition), color var(--transition);
}
.hamburger:hover { background: var(--surface-2); color: var(--text); }
.hamburger svg { width: 20px; height: 20px; }

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.breadcrumb-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.875rem;
  white-space: nowrap;
}
.breadcrumb-item a, .breadcrumb-item span {
  color: var(--text-muted);
  padding: 0.25rem 0.375rem;
  border-radius: 6px;
  transition: background var(--transition), color var(--transition);
}
.breadcrumb-item a:hover { background: var(--surface-2); color: var(--text); }
.breadcrumb-item.active span { color: var(--text); font-weight: 500; }
.breadcrumb-sep {
  color: var(--text-subtle);
  font-size: 0.75rem;
  user-select: none;
}

/* Header actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* View toggle */
.view-toggle {
  display: flex;
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 2px;
  border: 1px solid var(--border);
}
.view-btn {
  padding: 0.3125rem 0.5rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  border-radius: 7px;
  transition: background var(--transition), color var(--transition);
  display: flex;
  align-items: center;
}
.view-btn svg { width: 16px; height: 16px; }
.view-btn.active {
  background: var(--surface-3);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4375rem;
  padding: 0.5rem 0.875rem;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  font-weight: 500;
  border: 1px solid transparent;
  transition: background var(--transition), color var(--transition), border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  white-space: nowrap;
  cursor: pointer;
}
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 12px rgba(99,102,241,0.3);
}
.btn-primary:hover {
  opacity: 0.9;
  box-shadow: 0 4px 20px rgba(99,102,241,0.4);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: var(--surface-3);
  border-color: var(--border-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}

.btn-danger {
  background: var(--error-bg);
  color: var(--error);
  border-color: rgba(239,68,68,0.2);
}
.btn-danger:hover {
  background: rgba(239,68,68,0.2);
  border-color: rgba(239,68,68,0.35);
}

.btn-icon {
  padding: 0.4375rem;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  border-radius: var(--radius);
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-icon svg { width: 16px; height: 16px; }
.btn-icon:hover { background: var(--surface-2); color: var(--text); }
.btn-icon.danger:hover { background: var(--error-bg); color: var(--error); }
.btn-icon.success:hover { background: var(--success-bg); color: var(--success); }

.btn-sm { padding: 0.3125rem 0.625rem; font-size: 0.75rem; }
.btn-sm svg { width: 13px; height: 13px; }

/* ============================================================
   FORM INPUTS
   ============================================================ */
.form-group { margin-bottom: 1rem; }
.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.375rem;
}
.form-input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.875rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-input::placeholder { color: var(--text-subtle); }
.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-input:hover:not(:focus) { border-color: var(--border-hover); }

select.form-input { cursor: pointer; }
select.form-input option { background: var(--surface-2); }

/* ============================================================
   FILE AREA (SCROLL CONTAINER)
   ============================================================ */
.file-area {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  position: relative;
}

/* ============================================================
   DRAG & DROP OVERLAY
   ============================================================ */
.drop-overlay {
  position: absolute;
  inset: 0;
  background: rgba(99,102,241,0.08);
  border: 2px dashed var(--accent);
  border-radius: var(--radius-lg);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  pointer-events: none;
  margin: 0.75rem;
}
.drop-overlay.active { display: flex; }
.drop-overlay-inner {
  text-align: center;
  pointer-events: none;
}
.drop-overlay-inner svg {
  width: 48px; height: 48px;
  color: var(--accent);
  margin: 0 auto 0.75rem;
  opacity: 0.8;
}
.drop-overlay-inner p {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--accent);
}

/* ============================================================
   FILE GRID VIEW
   ============================================================ */
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 0.75rem;
}

.file-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 0.875rem 0.875rem;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), transform var(--transition), box-shadow var(--transition);
  position: relative;
  user-select: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.5rem;
}
.file-card:hover {
  background: var(--surface-2);
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.file-card.selected {
  border-color: var(--accent);
  background: rgba(99,102,241,0.1);
}

.file-icon {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.file-icon svg { width: 26px; height: 26px; }

.file-icon.folder  { background: rgba(99,102,241,0.15); color: var(--color-folder); }
.file-icon.image   { background: rgba(236,72,153,0.15); color: var(--color-image); }
.file-icon.video   { background: rgba(239,68,68,0.15);  color: var(--color-video); }
.file-icon.audio   { background: rgba(249,115,22,0.15); color: var(--color-audio); }
.file-icon.doc     { background: rgba(59,130,246,0.15); color: var(--color-doc); }
.file-icon.code    { background: rgba(34,197,94,0.15);  color: var(--color-code); }
.file-icon.zip     { background: rgba(234,179,8,0.15);  color: var(--color-zip); }
.file-icon.other   { background: rgba(100,116,139,0.15); color: var(--color-other); }

.file-name {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text);
  word-break: break-word;
  line-height: 1.35;
  max-height: 2.7em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.file-meta {
  font-size: 0.6875rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ============================================================
   FILE LIST VIEW
   ============================================================ */
.file-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.file-list-header {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto;
  gap: 0.75rem;
  padding: 0.375rem 0.875rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.25rem;
}

.file-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.5rem 0.875rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition);
  user-select: none;
  border: 1px solid transparent;
}
.file-row:hover {
  background: var(--surface-2);
  border-color: var(--border);
}
.file-row.selected {
  background: rgba(99,102,241,0.08);
  border-color: rgba(99,102,241,0.25);
}

.file-row-name {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-width: 0;
}
.file-row-name .file-icon {
  width: 34px; height: 34px;
  border-radius: 8px;
  flex-shrink: 0;
}
.file-row-name .file-icon svg { width: 17px; height: 17px; }
.file-row-name span {
  font-size: 0.875rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-row-size, .file-row-date {
  font-size: 0.8125rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.file-row-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  opacity: 0;
  transition: opacity var(--transition);
}
.file-row:hover .file-row-actions { opacity: 1; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
  min-height: 320px;
}
.empty-state-icon {
  width: 72px; height: 72px;
  background: var(--surface-2);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
  border: 1px solid var(--border);
}
.empty-state-icon svg { width: 32px; height: 32px; color: var(--text-subtle); }
.empty-state h3 { font-size: 1.0625rem; margin-bottom: 0.375rem; }
.empty-state p { color: var(--text-muted); font-size: 0.875rem; max-width: 280px; }

/* ============================================================
   MODALS
   ============================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.modal-backdrop.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  width: 100%;
  max-width: 460px;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95) translateY(10px);
  transition: transform 0.2s ease;
}
.modal-backdrop.open .modal { transform: scale(1) translateY(0); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.modal-title { font-size: 1.0625rem; font-weight: 600; }
.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.25rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  display: flex;
  align-items: center;
}
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.modal-close svg { width: 18px; height: 18px; }

.modal-body { margin-bottom: 1.25rem; }
.modal-footer {
  display: flex;
  gap: 0.625rem;
  justify-content: flex-end;
}

/* QR code container */
.qr-container {
  display: flex;
  justify-content: center;
  padding: 1rem;
  background: var(--surface-2);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  margin-bottom: 1rem;
}
.qr-container img { border-radius: 8px; max-width: 200px; }

/* Share link display */
.share-link-box {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.share-link-input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-family: monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  outline: none;
}

/* ============================================================
   CONTEXT MENU
   ============================================================ */
.context-menu {
  position: fixed;
  z-index: 300;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.375rem;
  min-width: 168px;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255,255,255,0.04);
  display: none;
  animation: menuIn 0.12s ease;
}
.context-menu.visible { display: block; }

@keyframes menuIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

.ctx-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5625rem 0.75rem;
  border-radius: 8px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition);
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}
.ctx-item svg { width: 15px; height: 15px; flex-shrink: 0; color: var(--text-muted); }
.ctx-item:hover { background: var(--surface-2); }
.ctx-item.danger { color: var(--error); }
.ctx-item.danger svg { color: var(--error); }
.ctx-item.danger:hover { background: var(--error-bg); }
.ctx-divider {
  height: 1px;
  background: var(--border);
  margin: 0.25rem 0;
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  pointer-events: all;
  animation: toastIn 0.3s cubic-bezier(0.34,1.56,0.64,1);
  max-width: 320px;
}
.toast.exit { animation: toastOut 0.2s ease forwards; }

.toast-icon { width: 18px; height: 18px; flex-shrink: 0; }
.toast.success { border-color: rgba(34,197,94,0.3); }
.toast.success .toast-icon { color: var(--success); }
.toast.error   { border-color: rgba(239,68,68,0.3); }
.toast.error   .toast-icon { color: var(--error); }
.toast.info    { border-color: rgba(99,102,241,0.3); }
.toast.info    .toast-icon { color: var(--accent); }

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

/* ============================================================
   UPLOAD DROPZONE (TRANSFER PAGE)
   ============================================================ */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-xl);
  padding: 3.5rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  background: var(--surface);
  position: relative;
  overflow: hidden;
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--accent);
  background: rgba(99,102,241,0.04);
}
.upload-zone.dragover {
  background: rgba(99,102,241,0.08);
}
.upload-zone-icon {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, rgba(99,102,241,0.2), rgba(168,85,247,0.2));
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
}
.upload-zone-icon svg { width: 30px; height: 30px; color: var(--accent); }
.upload-zone h3 { font-size: 1.0625rem; margin-bottom: 0.375rem; }
.upload-zone p { color: var(--text-muted); font-size: 0.875rem; }
.upload-zone p span { color: var(--accent); font-weight: 500; }

/* Upload progress overlay */
.upload-progress {
  position: absolute;
  inset: 0;
  background: var(--surface);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2rem;
  border-radius: var(--radius-xl);
}
.upload-progress.visible { display: flex; }
.upload-progress-bar {
  width: 100%;
  max-width: 320px;
  height: 6px;
  background: var(--surface-3);
  border-radius: 99px;
  overflow: hidden;
}
.upload-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 99px;
  transition: width 0.15s ease;
}
.upload-progress-text {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-align: center;
}
.upload-progress-text strong { color: var(--text); }

/* ============================================================
   RAM STATS BAR
   ============================================================ */
.ram-stats {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.ram-stats-icon {
  width: 40px; height: 40px;
  background: rgba(99,102,241,0.15);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ram-stats-icon svg { width: 20px; height: 20px; color: var(--accent); }
.ram-stats-info { flex: 1; min-width: 0; }
.ram-stats-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8125rem;
  margin-bottom: 0.375rem;
}
.ram-stats-label .ram-title { font-weight: 600; }
.ram-stats-label .ram-value { color: var(--text-muted); }

/* ============================================================
   TRANSFER CARDS
   ============================================================ */
.transfers-section {
  margin-top: 1.5rem;
}
.section-title {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-subtle);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.section-badge {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 1px 8px;
  font-size: 0.6875rem;
  color: var(--text-muted);
}

.transfer-list {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.transfer-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.125rem;
  display: flex;
  align-items: center;
  gap: 0.875rem;
  transition: border-color var(--transition), background var(--transition);
  animation: cardIn 0.25s ease;
}
.transfer-card:hover {
  border-color: var(--border-hover);
  background: var(--surface-2);
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.transfer-card .file-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  flex-shrink: 0;
}
.transfer-card .file-icon svg { width: 21px; height: 21px; }

.transfer-info { flex: 1; min-width: 0; }
.transfer-name {
  font-size: 0.875rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 0.2rem;
}
.transfer-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.transfer-timer {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--warning);
}
.transfer-timer svg { width: 11px; height: 11px; }
.transfer-timer.urgent { color: var(--error); }

.transfer-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

/* Transfer page empty state */
.transfer-empty {
  text-align: center;
  padding: 2.5rem 1rem;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
}
.transfer-empty svg {
  width: 36px; height: 36px;
  margin: 0 auto 0.75rem;
  opacity: 0.4;
}
.transfer-empty p { font-size: 0.875rem; line-height: 1.6; }

/* ============================================================
   PAGE HEADER (transfer page)
   ============================================================ */
.page-header {
  padding: 1.25rem 1.25rem 0;
  flex-shrink: 0;
}
.page-header h2 { font-size: 1.1875rem; margin-bottom: 0.25rem; }
.page-header p { color: var(--text-muted); font-size: 0.8125rem; }

/* ============================================================
   MOBILE BOTTOM NAV
   ============================================================ */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 150;
  align-items: flex-start;
  justify-content: space-around;
  padding: 0 0.5rem;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.625rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  border: none;
  background: transparent;
  text-decoration: none;
  transition: color var(--transition);
  min-width: 60px;
  text-align: center;
}
.mobile-nav-item svg { width: 22px; height: 22px; }
.mobile-nav-item.active { color: var(--accent); }

/* Sidebar overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 90;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

/* ============================================================
   LOADING STATES
   ============================================================ */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius);
}
@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

.loading-row {
  height: 48px;
  border-radius: var(--radius);
  margin-bottom: 4px;
}
.loading-card {
  height: 130px;
  border-radius: var(--radius-lg);
}

/* Inline spinner */
.inline-spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  margin: 2rem auto;
}

/* ============================================================
   MISC UTILITIES
   ============================================================ */
.divider {
  height: 1px;
  background: var(--border);
  margin: 1rem 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-error   { background: var(--error-bg);   color: var(--error); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-info    { background: var(--info-bg);    color: var(--info); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
}

.hint {
  font-size: 0.75rem;
  color: var(--text-subtle);
  line-height: 1.5;
}
.hint a { color: var(--accent); }

/* Expiry selector */
.expiry-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.625rem;
}
.expiry-btn {
  padding: 0.375rem 0.75rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}
.expiry-btn:hover { border-color: var(--accent); color: var(--accent); }
.expiry-btn.selected {
  background: rgba(99,102,241,0.15);
  border-color: var(--accent);
  color: var(--accent);
}

/* ============================================================
   RESPONSIVE — TABLET (max 1024px)
   ============================================================ */
@media (max-width: 1024px) {
  :root { --sidebar-w: 210px; }

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

/* ============================================================
   RESPONSIVE — MOBILE (max 768px)
   ============================================================ */
@media (max-width: 768px) {
  :root { --header-h: 56px; }

  /* Sidebar becomes a slide-in drawer */
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }

  /* Show hamburger */
  .hamburger { display: flex; }

  /* Show mobile nav */
  .mobile-nav { display: flex; }

  /* Add bottom padding so content isn't hidden behind mobile nav */
  .file-area { padding-bottom: calc(var(--nav-h) + 1rem); }
  .transfer-content { padding-bottom: calc(var(--nav-h) + 1rem); }

  /* Hide sidebar storage stats actions on mobile (shown in mobile nav) */
  .sidebar-footer .btn-logout { display: none; }

  /* Compact header */
  .app-header { padding: 0 0.875rem; gap: 0.5rem; }

  /* Hide breadcrumb text overflow */
  .breadcrumb { max-width: calc(100vw - 200px); }

  /* Adjust header buttons */
  .btn-text { display: none; }
  .btn-primary.upload-btn .btn-text { display: none; }

  /* File grid smaller cards */
  .file-grid {
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
    gap: 0.5rem;
  }
  .file-card { padding: 0.75rem 0.625rem; }
  .file-icon { width: 44px; height: 44px; }
  .file-icon svg { width: 22px; height: 22px; }

  /* List view: hide date column */
  .file-list-header,
  .file-row {
    grid-template-columns: 2fr 1fr auto;
  }
  .file-list-header .col-date,
  .file-row-date { display: none; }
  .file-row-actions { opacity: 1; }

  /* Modals full-screen on mobile */
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal {
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    max-width: 100%;
    padding: 1.5rem 1.25rem;
  }

  /* Transfer cards compact */
  .transfer-card { padding: 0.875rem; }

  /* RAM stats compact */
  .ram-stats { padding: 0.75rem 1rem; }

  /* Upload zone compact */
  .upload-zone { padding: 2.5rem 1rem; }

  /* Toast at bottom center */
  .toast-container {
    bottom: calc(var(--nav-h) + 1rem);
    left: 1rem;
    right: 1rem;
    align-items: center;
  }
  .toast { max-width: 100%; width: 100%; }

  /* Login card */
  .login-card { padding: 2rem 1.375rem; }
  .otp-input { width: 42px; height: 50px; font-size: 1.25rem; }
  .otp-container { gap: 0.375rem; }
}

@media (max-width: 400px) {
  .otp-input { width: 36px; height: 46px; font-size: 1.125rem; }
  .otp-container { gap: 0.25rem; }
  .file-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
}

/* ============================================================
   PAGE-SPECIFIC LAYOUT HELPERS
   ============================================================ */
.transfer-page .main-content {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.transfer-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
}

/* Focus outline (accessibility) */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Selection color */
::selection { background: rgba(99,102,241,0.3); }

/* ---- Theme toggle button ---- */
.theme-toggle {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-hover); }

/* When used as a full-width sidebar row */
.theme-toggle.sidebar-row {
  width: 100%;
  justify-content: flex-start;
  gap: 0.625rem;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
}
.theme-toggle.sidebar-row span { font-size: 0.875rem; }

/* Floating theme toggle on login page */
.login-theme-toggle {
  position: fixed;
  top: 1rem; right: 1rem;
  z-index: 200;
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-muted);
  box-shadow: var(--shadow);
  transition: background var(--transition), color var(--transition), transform 0.15s;
}
.login-theme-toggle:hover { color: var(--text); transform: scale(1.08); }
.login-theme-toggle svg { width: 18px; height: 18px; }

/* ---- Public device checkbox (login page) ---- */
.public-device-label {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  line-height: 1.5;
}
.public-device-label input[type="checkbox"] { display: none; }
.public-device-checkmark {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-hover);
  border-radius: 4px;
  background: transparent;
  margin-top: 2px;
  transition: background 0.2s, border-color 0.2s;
  position: relative;
}
.public-device-label input:checked + .public-device-checkmark {
  background: var(--accent);
  border-color: var(--accent);
}
.public-device-label input:checked + .public-device-checkmark::after {
  content: '';
  position: absolute;
  left: 4px; top: 1px;
  width: 5px; height: 9px;
  border: 2px solid #fff;
  border-top: none; border-left: none;
  transform: rotate(45deg);
}
.public-device-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0.6;
  margin-top: 1px;
}

/* ---- Last login badge (app header) ---- */
.last-login-badge {
  font-size: 0.7rem;
  color: var(--text-muted);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 10px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ============================================================
   NOTES PAGE
   ============================================================ */
.notes-layout { overflow: hidden; }

.notes-container {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-width: 0;
}

/* ── Notes list panel ── */
.notes-list-panel {
  width: 300px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow: hidden;
  transition: transform var(--transition);
}

.notes-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.375rem 1.125rem 1rem;
  flex-shrink: 0;
}
.notes-list-header .hamburger { display: none; }
.notes-list-title {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.notes-search-wrap {
  position: relative;
  padding: 0 0.875rem 0.875rem;
  flex-shrink: 0;
}
.notes-search-wrap svg {
  position: absolute;
  left: 1.625rem;
  top: 50%;
  transform: translateY(-60%);
  width: 14px; height: 14px;
  color: var(--text-muted);
  pointer-events: none;
}
.notes-search {
  width: 100%;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  color: var(--text);
  font-size: 0.8125rem;
  font-family: inherit;
  padding: 0.5rem 0.875rem 0.5rem 2.25rem;
  outline: none;
  transition: border-color var(--transition), background var(--transition);
}
.notes-search:focus {
  border-color: var(--accent);
  background: var(--surface-3);
}
.notes-search::placeholder { color: var(--text-muted); }

.notes-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.25rem 0.625rem 1rem;
}
.notes-list::-webkit-scrollbar { width: 3px; }
.notes-list::-webkit-scrollbar-track { background: transparent; }
.notes-list::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 4px; }

.notes-list-empty {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8125rem;
}
.notes-list-item {
  padding: 0.75rem 0.875rem;
  cursor: pointer;
  border-radius: var(--radius);
  transition: background var(--transition), border-color var(--transition);
  margin-bottom: 0.125rem;
  border: 1.5px solid transparent;
}
.notes-list-item:hover { background: var(--surface-2); }
.notes-list-item.active {
  background: rgba(99,102,241,0.1);
  border-color: rgba(99,102,241,0.2);
}
.notes-list-item-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.2rem;
  line-height: 1.4;
}
.notes-list-item.active .notes-list-item-title { color: var(--accent); }
.notes-list-item-preview {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.3rem;
  line-height: 1.45;
  opacity: 0.8;
}
.notes-list-item-date {
  font-size: 0.6875rem;
  color: var(--text-subtle);
}

/* ── Editor panel ── */
.notes-editor-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  min-width: 0;
}

/* Empty state */
.notes-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.125rem;
  padding: 2rem;
  text-align: center;
}
.notes-empty-icon {
  width: 80px;
  height: 80px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.25rem;
}
.notes-empty-icon svg { width: 36px; height: 36px; opacity: 0.4; color: var(--text-muted); }
.notes-empty h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  letter-spacing: -0.01em;
}
.notes-empty p {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0;
}

/* Editor wrapper — centered max-width on large screens */
.notes-editor {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.notes-editor-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
}

.notes-editor-header {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 1.5rem 2.5rem 0.75rem;
  flex-shrink: 0;
}
.notes-back-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.375rem;
  border-radius: 8px;
  transition: color var(--transition), background var(--transition);
  flex-shrink: 0;
  line-height: 0;
}
.notes-back-btn svg { width: 20px; height: 20px; }
.notes-back-btn:hover { color: var(--text); background: var(--surface-2); }

.notes-title-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 1.75rem;
  font-weight: 700;
  font-family: inherit;
  letter-spacing: -0.03em;
  line-height: 1.2;
  padding: 0.25rem 0;
  min-width: 0;
}
.notes-title-input::placeholder { color: var(--text-subtle); }

.notes-title-divider {
  height: 1px;
  background: var(--border);
  margin: 0 2.5rem;
  flex-shrink: 0;
}

.notes-delete-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.375rem;
  border-radius: 8px;
  transition: color var(--transition), background var(--transition);
  flex-shrink: 0;
  line-height: 0;
}
.notes-delete-btn svg { width: 17px; height: 17px; }
.notes-delete-btn:hover { color: var(--error); background: var(--error-bg); }

.notes-textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.85;
  padding: 1.25rem 2.5rem 1.5rem;
  min-height: 0;
  overflow-y: auto;
}
.notes-textarea::-webkit-scrollbar { width: 3px; }
.notes-textarea::-webkit-scrollbar-track { background: transparent; }
.notes-textarea::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 4px; }
.notes-textarea::placeholder { color: var(--text-muted); opacity: 0.35; }

/* Status bar */
.notes-status-bar {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.625rem 2.5rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.notes-status-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  flex: 1;
}
.notes-sync-badge {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.6875rem;
  color: var(--accent);
  background: rgba(99,102,241,0.1);
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: 20px;
  padding: 0.2rem 0.625rem;
  animation: fadeIn 0.3s ease;
}
.notes-word-count {
  font-size: 0.75rem;
  color: var(--text-subtle);
  white-space: nowrap;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ── Mobile ── */
@media (max-width: 767px) {
  .notes-list-panel {
    width: 100%;
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 10;
    background: var(--bg);
  }
  .notes-list-panel.mobile-hidden { display: none; }
  .notes-editor-panel { width: 100%; }
  .notes-back-btn { display: flex; }
  .notes-list { padding: 0.25rem 0.5rem 4.5rem; }
  .notes-list-header { padding: 1.125rem 1rem 0.875rem; }
  .notes-list-header .hamburger { display: flex; }
  .notes-search-wrap { padding: 0 0.75rem 0.75rem; }
  .notes-search-wrap svg { left: 1.5rem; }
  .notes-editor-header { padding: 1rem 1.125rem 0.625rem; }
  .notes-title-divider { margin: 0 1.125rem; }
  .notes-title-input { font-size: 1.375rem; }
  .notes-textarea { padding: 1rem 1.125rem 1.5rem; font-size: 0.9375rem; }
  .notes-status-bar { padding: 0.5rem 1.125rem; }
}

/* ── Tablet ── */
@media (min-width: 768px) and (max-width: 1023px) {
  .notes-list-panel { width: 240px; }
  .notes-editor-header { padding: 1.25rem 1.75rem 0.75rem; }
  .notes-title-divider { margin: 0 1.75rem; }
  .notes-textarea { padding: 1.125rem 1.75rem; }
  .notes-status-bar { padding: 0.625rem 1.75rem; }
}

/* ---- Inactivity warning modal ---- */
.modal--warning .modal-header {
  border-bottom-color: rgba(245,158,11,0.2);
}
.modal--warning .modal-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
