/* ==========================================================================
   Kosha FileShare — Premium Modern Design System
   ========================================================================== */

:root {
  --bg-main: #0a0e17;
  --bg-gradient: radial-gradient(1200px circle at 50% 0%, #1e293b 0%, #0f172a 45%, #020617 100%);
  --card-bg: rgba(15, 23, 42, 0.78);
  --card-border: rgba(255, 255, 255, 0.1);
  --card-hover-border: rgba(59, 130, 246, 0.35);
  --item-bg: rgba(30, 41, 59, 0.55);
  --item-border: rgba(255, 255, 255, 0.08);
  --item-hover-bg: rgba(30, 41, 59, 0.85);
  --item-hover-border: rgba(59, 130, 246, 0.4);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;
  
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-gradient: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  --primary-shadow: 0 4px 20px rgba(37, 99, 235, 0.38);
  
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
}

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

body {
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 32px 16px 60px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* --- Main Card Container --- */
.card {
  width: 100%;
  max-width: 880px;
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  padding: 32px 36px;
  box-shadow: 0 30px 70px -15px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.05);
  margin-top: 10px;
  transition: all 0.3s ease;
}

@media (max-width: 640px) {
  .card {
    padding: 20px 16px;
    border-radius: var(--radius-lg);
  }
}

/* --- Header Bar --- */
.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-wrap: wrap;
}

.brand {
  display: flex;
  flex-direction: column;
}

.brand h1 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  background: linear-gradient(135deg, #ffffff 30%, #93c5fd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.brand .sub {
  margin: 3px 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* --- Auth Nav & User Badge --- */
.auth-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-auth {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-main);
  padding: 8px 16px;
  font-size: 0.85rem;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.18s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-auth:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
  transform: translateY(-1px);
}

.btn-auth-primary {
  background: var(--primary-gradient);
  border: none;
  color: #fff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.btn-auth-primary:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.5);
  color: #fff;
}

.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: #fff;
}

.user-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
}

.user-info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.user-stats {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 400;
}

.btn-user-action {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  font-size: 0.78rem;
  border-radius: 8px;
  transition: all 0.15s ease;
  line-height: 1;
}

.btn-user-action:hover {
  background: rgba(59, 130, 246, 0.25);
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.4);
}

.vpn-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: #34d399;
  font-size: 0.76rem;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
}

/* Guest Banner */
.guest-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12) 0%, rgba(139, 92, 246, 0.12) 100%);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

.guest-banner-icon {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
}

.guest-banner-content {
  flex: 1;
}

.guest-banner-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 3px;
}

.guest-banner-text {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.guest-banner-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .guest-banner {
    flex-direction: column;
    align-items: flex-start;
  }
  .guest-banner-actions {
    width: 100%;
  }
  .guest-banner-actions button {
    flex: 1;
  }
}

.btn-logout {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  font-size: 0.85rem;
  border-radius: 6px;
  transition: all 0.15s ease;
  line-height: 1;
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ff8080;
}

/* --- View Tabs (Segmented Control) --- */
.view-tabs {
  display: flex;
  gap: 6px;
  background: rgba(0, 0, 0, 0.35);
  padding: 6px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  margin-bottom: 24px;
}

.view-tab {
  flex: 1;
  padding: 10px 16px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.view-tab:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.view-tab.active {
  background: var(--primary-gradient);
  color: #fff;
  box-shadow: var(--primary-shadow);
}

.tab-badge {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 700;
}

/* --- Form Options Grid --- */
.opts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.opt {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.opt select,
.opt input[type="text"],
.opt input[type="password"],
.opt input[type="number"] {
  width: 100%;
  padding: 11px 14px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.88rem;
  font-family: inherit;
  outline: none;
  transition: all 0.15s ease;
}

.custom-ttl-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.custom-ttl-row input[type="number"] {
  width: 90px;
  flex: 0 0 90px;
}

.custom-ttl-row select {
  flex: 1;
}

.opt select:focus,
.opt input:focus {
  border-color: var(--primary);
  background: rgba(0, 0, 0, 0.5);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.opt select option {
  background: #0f172a;
  color: #f8fafc;
}

.encryption-notice {
  font-size: 0.82rem;
  color: #10b981;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* --- Dropzone --- */
.dropzone {
  border: 2px dashed rgba(59, 130, 246, 0.35);
  background: rgba(59, 130, 246, 0.03);
  border-radius: var(--radius-lg);
  padding: 42px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.08);
  transform: translateY(-2px);
}

.dropzone-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: var(--primary);
}

.dropzone-text-main {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.dropzone-text-sub {
  font-size: 0.84rem;
  color: var(--text-muted);
}

/* --- Link Input (Result Card) --- */
.link-input {
  width: 100%;
  border: 1px solid rgba(59, 130, 246, 0.35);
  border-radius: 8px;
  padding: 9px 12px;
  background: rgba(0, 0, 0, 0.45);
  color: #93c5fd;
  font-family: 'Menlo', 'Consolas', monospace;
  font-size: 0.83rem;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.15s;
}

.link-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.link-input-vpn {
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.3);
}

.file-pick {
  display: none;
}

/* --- Buttons --- */
.btn-primary {
  width: 100%;
  padding: 14px 20px;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  background: var(--primary-gradient);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: var(--primary-shadow);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 25px rgba(37, 99, 235, 0.5);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-cancel {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-cancel:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #ff9999;
}

/* --- Progress Bar --- */
.progress-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
}

.progress-wrap {
  flex: 1;
  height: 10px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
  border-radius: 999px;
  transition: width 0.15s ease;
}

.status {
  margin-top: 14px;
  font-size: 0.86rem;
  color: var(--text-muted);
  text-align: center;
}

.status.error { color: var(--danger); }
.status.ok { color: var(--success); }

/* --- Upload Result Card --- */
.result {
  margin-top: 24px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.result .row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.88rem;
}

.result .row:last-of-type {
  border-bottom: none;
}

.result .row span {
  color: var(--text-muted);
  font-weight: 500;
  min-width: 90px;
}

.result .row strong {
  color: var(--text-main);
  word-break: break-all;
}

/* ==========================================================================
   User Files Panel & Organization
   ========================================================================== */

.files-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* --- Folders Bar (Chips) --- */
.folders-bar-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 8px 12px;
}

.folders-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: thin;
  padding-bottom: 2px;
}

.folders-bar::-webkit-scrollbar {
  height: 4px;
}

.folders-bar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
}

.folder-chip,
.chip-title-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  font-family: inherit;
}

.folder-chip:hover,
.chip-title-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.folder-chip.active,
.folder-chip-item.active .chip-title-btn {
  background: rgba(59, 130, 246, 0.2);
  border-color: var(--primary);
  color: #93c5fd;
}

.chip-count {
  background: rgba(0, 0, 0, 0.35);
  color: var(--text-muted);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
}

.folder-chip-item {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 0 4px 0 0;
  transition: all 0.15s ease;
}

.folder-chip-item.active {
  background: rgba(59, 130, 246, 0.15);
  border-color: var(--primary);
}

.folder-chip-item .chip-title-btn {
  background: transparent;
  border: none;
  padding: 6px 6px 6px 10px;
}

.chip-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.chip-action-btn {
  background: transparent;
  border: none;
  color: var(--text-subtle);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  font-size: 0.75rem;
  transition: all 0.15s ease;
  line-height: 1;
}

.chip-action-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.chip-action-btn.del:hover {
  color: #ff8080;
  background: rgba(239, 68, 68, 0.2);
}

.btn-new-folder {
  background: rgba(59, 130, 246, 0.12);
  border: 1px dashed rgba(59, 130, 246, 0.4);
  color: #93c5fd;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.btn-new-folder:hover {
  background: rgba(59, 130, 246, 0.25);
  border-color: var(--primary);
  color: #fff;
}

/* --- Files Toolbar --- */
.files-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 240px;
}

.search-input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 9px 14px 9px 36px;
  background: rgba(0, 0, 0, 0.35);
  color: var(--text-main);
  font-size: 0.86rem;
  font-family: inherit;
  outline: none;
  transition: all 0.15s ease;
}

.search-input:focus {
  border-color: var(--primary);
  background: rgba(0, 0, 0, 0.5);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.85rem;
  pointer-events: none;
}

.files-summary {
  font-size: 0.84rem;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}

/* --- File List & Cards --- */
.file-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 560px;
  overflow-y: auto;
  padding-right: 4px;
}

.file-list::-webkit-scrollbar {
  width: 6px;
}

.file-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  background: var(--item-bg);
  border: 1px solid var(--item-border);
  border-radius: var(--radius-md);
  transition: all 0.18s ease;
}

.file-item:hover {
  background: var(--item-hover-bg);
  border-color: var(--item-hover-border);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px -6px rgba(0, 0, 0, 0.45);
}

.file-meta-col {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 1;
}

.file-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.file-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.file-name {
  font-weight: 600;
  font-size: 0.94rem;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-subinfo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.file-badge-pill {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 500;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.file-badge-pill.folder-badge {
  background: rgba(59, 130, 246, 0.14);
  color: #93c5fd;
  cursor: pointer;
  transition: all 0.15s ease;
}

.file-badge-pill.folder-badge:hover {
  background: rgba(59, 130, 246, 0.28);
  color: #fff;
}

.file-badge-pill.warning {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.file-badge-pill.enc {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

/* --- Action Buttons in File Item --- */
.file-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-icon {
  padding: 7px 12px;
  font-size: 0.82rem;
  border-radius: 8px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  font-family: inherit;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
  transform: translateY(-1px);
}

.btn-icon-primary {
  background: var(--primary-gradient);
  border: none;
  color: #fff !important;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.35);
}

.btn-icon-primary:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff !important;
}

.btn-icon.delete:hover {
  border-color: var(--danger);
  color: #ff8080;
  background: rgba(239, 68, 68, 0.15);
}

.btn-icon.confirm-del {
  background: rgba(239, 68, 68, 0.25) !important;
  border-color: var(--danger) !important;
  color: #ff8080 !important;
  font-weight: 700 !important;
  animation: shake 0.2s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

.btn-icon.copied {
  background: #059669 !important;
  color: #fff !important;
  border-color: #059669 !important;
}

.empty-files {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-muted);
}

.empty-files-icon {
  font-size: 2.8rem;
  margin-bottom: 12px;
  opacity: 0.8;
}

/* ==========================================================================
   Modals
   ========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1000;
  animation: fadeIn 0.15s ease-out;
}

.auth-or-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 12px;
  color: #64748b;
  font-size: 0.78rem;
}
.auth-or-divider::before,
.auth-or-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
}

.btn-telegram {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px 14px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(180deg, #37aee2 0%, #1e96c8 100%);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(30, 150, 200, 0.35);
  transition: filter 0.15s, transform 0.1s;
}
.btn-telegram:hover {
  filter: brightness(1.06);
  color: #fff;
}
.btn-telegram:active {
  transform: translateY(1px);
}

.auth-telegram-hint {
  margin: 8px 0 10px;
  font-size: 0.74rem;
  line-height: 1.4;
  color: #94a3b8;
  text-align: center;
}

.modal-card {
  width: 100%;
  max-width: 420px;
  max-height: min(92vh, 720px);
  overflow-y: auto;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-lg);
  padding: 26px 28px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.05);
  position: relative;
  animation: modalScale 0.18s ease-out;
}

@keyframes modalScale {
  from { opacity: 0; transform: scale(0.95) translateY(-10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

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

.modal-tabs {
  display: flex;
  gap: 4px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 3px;
}

.modal-tab {
  padding: 7px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.modal-tab.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
}

.btn-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.modal-note {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: -4px 0 16px;
  line-height: 1.4;
}

.login-mode-fieldset {
  margin: 10px 0 4px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
}
.login-mode-fieldset legend {
  padding: 0 6px;
  font-size: 0.85rem;
  color: var(--text-muted, #9aa3b2);
}
.login-mode-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 8px 0 0;
  font-size: 0.9rem;
  cursor: pointer;
}
.login-mode-option input {
  margin-top: 3px;
}

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

.auth-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-muted);
}

.auth-label input {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 11px 14px;
  background: rgba(0, 0, 0, 0.35);
  color: var(--text-main);
  font: inherit;
  font-size: 0.9rem;
  outline: none;
}

.auth-label input:focus {
  border-color: var(--primary);
  background: rgba(0, 0, 0, 0.5);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.auth-error {
  color: var(--danger);
  font-size: 0.84rem;
  min-height: 1.2em;
}

/* --- Move Modal Destination List --- */
.folder-select-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  margin-top: 10px;
}

.folder-select-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 0.88rem;
  font-weight: 500;
}

.folder-select-item:hover {
  background: rgba(59, 130, 246, 0.15);
  border-color: var(--primary);
  color: #93c5fd;
}

.folder-select-item.current {
  background: rgba(59, 130, 246, 0.2);
  border-color: var(--primary);
  color: #93c5fd;
  font-weight: 600;
}

.f-icon { font-size: 1.1rem; }
.f-name { flex: 1; }
.f-check { font-size: 0.78rem; color: #60a5fa; font-weight: 700; }

.toast {
  position: fixed;
  bottom: 28px;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-main);
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6);
  z-index: 2000;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.2s ease-out;
}

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

.key-dropzone:hover {
  border-color: var(--primary) !important;
  background: rgba(59, 130, 246, 0.1) !important;
}

/* --- Multi-file Upload Queue & Telemetry Cards --- */
.upload-queue {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.queue-item {
  background: var(--item-bg);
  border: 1px solid var(--item-border);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.queue-item.done {
  border-color: rgba(16, 185, 129, 0.45);
  background: rgba(16, 185, 129, 0.08);
}

.queue-item.error {
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.08);
}

.queue-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.queue-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  word-break: break-all;
}

.queue-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.queue-controls {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.queue-progress-wrap {
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.queue-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--primary-gradient);
  transition: width 0.15s ease;
}

.queue-item.done .queue-progress-bar {
  background: linear-gradient(135deg, #10b981, #059669);
}

.sort-select {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.35);
  color: var(--text-main);
  font: inherit;
  font-size: 0.82rem;
  outline: none;
}

.admin-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.admin-metric-box {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 8px 10px;
}

.admin-metric-label {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.admin-metric-val {
  font-size: 0.92rem;
  font-weight: 700;
  color: #fff;
  margin-top: 2px;
}

.hidden { display: none !important; }

/* ==========================================================================
   UI v2 (2026-11-29) — simpler structure: one obvious action per screen.
   Same visual language (dark glass, blue accent); only layout/logic changed.
   ========================================================================== */

[hidden] { display: none !important; }
.legacy-hidden { display: none !important; }

body { padding: 20px 16px 48px; }

.shell {
  width: 100%;
  max-width: 940px;
  margin: 0 auto;
}

/* ---- Top bar ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 4px 4px 18px;
}
.brand-link { text-decoration: none; color: inherit; }
.brand-link:hover h1 { filter: brightness(1.15); }
.brand .sub { margin: 2px 0 0 2px; }
.brand-switch { color: var(--primary); text-decoration: none; font-size: 0.92em; }
.brand-switch:hover { text-decoration: underline; }

.guest-nav { display: flex; align-items: center; gap: 14px; }
.btn-link-quiet {
  background: none;
  border: none;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.86rem;
  cursor: pointer;
  padding: 6px 4px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.btn-link-quiet:hover { color: #fff; }

/* ---- Account menu ---- */
.user-menu { position: relative; }
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px 5px 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  color: var(--text-main);
  font: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
}
.user-chip:hover { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.25); }
.user-chip .user-name { font-size: 0.88rem; font-weight: 600; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .caret { color: var(--text-muted); font-size: 0.8rem; }

.menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 60;
  min-width: 250px;
  padding: 6px;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-md);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.65);
  animation: fadeIn 0.12s ease-out;
}
.menu-panel-right { left: auto; right: 0; }
.menu-head { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); margin-bottom: 4px; }
.menu-head-title { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-subtle); }
.menu-head .user-stats { font-size: 0.86rem; color: var(--text-main); }
.menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  background: none;
  border: none;
  border-radius: 8px;
  color: var(--text-main);
  font: inherit;
  font-size: 0.88rem;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.menu-item:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.menu-item.danger { color: #f87171; }
.menu-item.danger:hover { background: rgba(239, 68, 68, 0.14); color: #ff9a9a; }
.menu-item.confirm-del { background: rgba(239, 68, 68, 0.22); color: #ff8080; font-weight: 700; }

/* ---- Section tabs ---- */
.view-tabs { margin-bottom: 16px; }
.view-tab { padding: 13px 16px; font-size: 0.98rem; }

/* ---- Main panel ---- */
.panel {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  padding: 28px 32px 30px;
  box-shadow: 0 30px 70px -15px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.05);
}
@media (max-width: 640px) {
  .panel { padding: 18px 14px 22px; border-radius: var(--radius-lg); }
  .brand h1 { font-size: 1.35rem; }
}

/* ---- Hero (guests) ---- */
.hero { text-align: center; margin: 2px 0 22px; }
.hero .guest-banner-title { font-size: 1.55rem; font-weight: 800; letter-spacing: -0.02em; color: #fff; margin: 0 0 6px; }
.hero .guest-banner-text { margin: 0 auto; max-width: 560px; font-size: 0.98rem; color: var(--text-muted); }
.steps { list-style: none; display: flex; justify-content: center; gap: 10px 26px; flex-wrap: wrap; margin: 18px 0 0; padding: 0; }
.steps li { display: inline-flex; align-items: center; gap: 9px; font-size: 0.86rem; color: var(--text-muted); }
.step-num {
  width: 24px; height: 24px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(59, 130, 246, 0.18); border: 1px solid rgba(59, 130, 246, 0.45);
  color: #93c5fd; font-weight: 800; font-size: 0.78rem;
}

/* ---- Dropzone ---- */
.dropzone { padding: 44px 20px 40px; min-height: 250px; gap: 10px; outline: none; }
.dropzone:focus-visible { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.25); }
.dropzone .dropzone-icon { width: 68px; height: 68px; font-size: 2rem; border-radius: 20px; margin-bottom: 4px; }
.dropzone .dropzone-text-main { font-size: 1.3rem; }
.dropzone .dropzone-text-sub { font-size: 0.9rem; }
.dz-btn {
  margin-top: 12px;
  padding: 13px 30px;
  font-size: 1.02rem;
  font-weight: 700;
  color: #fff;
  background: var(--primary-gradient);
  border-radius: var(--radius-md);
  box-shadow: var(--primary-shadow);
  pointer-events: none;
}
.dropzone:hover .dz-btn { box-shadow: 0 6px 25px rgba(37, 99, 235, 0.55); }
.dropzone.dragover { background: rgba(59, 130, 246, 0.14); transform: scale(1.01); }

/* ---- Link options (collapsed) ---- */
.opts-box {
  margin-top: 14px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
}
.opts-box summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  font-size: 0.9rem;
}
.opts-box summary::-webkit-details-marker { display: none; }
.opts-box summary::after { content: "▾"; color: var(--text-muted); transition: transform 0.2s; }
.opts-box[open] summary::after { transform: rotate(180deg); }
.opts-title { font-weight: 600; color: var(--text-main); }
.opts-summary { margin-left: auto; color: var(--text-muted); font-size: 0.82rem; text-align: right; }
.opts-box .opts { padding: 4px 16px 6px; margin-bottom: 0; }
.opts-hint { padding: 0 16px 14px; margin: 4px 0 0; font-size: 0.76rem; color: var(--text-subtle); }

.trust-line { margin: 16px 0 0; text-align: center; font-size: 0.78rem; color: var(--text-subtle); }
.trust-line a { color: var(--text-muted); }
.trust-line a:hover { color: #fff; }

/* ---- Upload list ---- */
.upload-queue { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; }
.queue-item {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  background: var(--item-bg);
  border: 1px solid var(--item-border);
  border-radius: var(--radius-md);
}
.queue-item.done { border-color: rgba(16, 185, 129, 0.45); background: rgba(16, 185, 129, 0.06); }
.queue-item.error { border-color: rgba(239, 68, 68, 0.45); }
.q-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.q-title { font-weight: 700; font-size: 0.96rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-meta { font-size: 0.82rem; color: var(--text-muted); }
.q-meta.ok { color: #34d399; }
.q-meta b { color: #fff; font-family: 'Menlo', 'Consolas', monospace; }
.queue-progress-wrap { height: 8px; margin-top: 4px; }
.q-link { display: flex; gap: 8px; margin-top: 6px; }
.q-link .link-input { flex: 1; min-width: 0; font-size: 0.86rem; }
.q-extra { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 2px; }
.q-act {
  background: none; border: none; padding: 2px 0; font: inherit; font-size: 0.8rem;
  color: var(--text-muted); text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.q-act:hover { color: #fff; }
.q-act.danger:hover, .q-act.confirm-del { color: #f87171; }
.q-act.copied { color: #34d399; }
.queue-controls { display: flex; gap: 6px; flex-shrink: 0; }
@media (max-width: 640px) {
  .queue-item { flex-direction: column; }
  .q-link { flex-direction: column; }
}

/* Primary "copy" button — used for both fresh uploads and the file list */
.btn-copy {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px;
  font: inherit; font-size: 0.88rem; font-weight: 700;
  color: #fff; background: var(--primary-gradient);
  border: none; border-radius: 10px; cursor: pointer; white-space: nowrap;
  box-shadow: 0 3px 14px rgba(37, 99, 235, 0.35);
  transition: all 0.15s ease;
}
.btn-copy:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(37, 99, 235, 0.5); }
.btn-copy.copied { background: #059669; box-shadow: 0 3px 14px rgba(5, 150, 105, 0.4); }

/* ---- My files ---- */
.files-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 22px; align-items: start; }
.folders-side { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 8px; }
.side-title { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-subtle); font-weight: 700; padding: 0 4px; }
.folders-bar { flex-direction: column; align-items: stretch; gap: 4px; overflow: visible; flex: none; }
.folders-bar .folder-chip,
.folders-bar .folder-chip-item {
  display: flex; width: 100%; background: transparent; border: 1px solid transparent; border-radius: 10px;
}
.folders-bar .folder-chip { padding: 9px 12px; font-size: 0.88rem; justify-content: space-between; }
.folders-bar .folder-chip-item { padding: 0 4px 0 0; align-items: center; }
.folders-bar .chip-title-btn { flex: 1; min-width: 0; justify-content: flex-start; padding: 9px 4px 9px 12px; font-size: 0.88rem; border: none; background: transparent; }
.folders-bar .chip-title-btn .chip-name { flex: 1; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.folders-bar .chip-title-btn .chip-count { margin-left: auto; }
.folders-bar .folder-chip:hover, .folders-bar .folder-chip-item:hover { background: rgba(255, 255, 255, 0.06); }
.folders-bar .folder-chip.active, .folders-bar .folder-chip-item.active { background: rgba(59, 130, 246, 0.18); border-color: rgba(59, 130, 246, 0.5); }
.folders-bar .chip-actions { opacity: 0; transition: opacity 0.15s; }
.folders-bar .folder-chip-item:hover .chip-actions,
.folders-bar .folder-chip-item.active .chip-actions,
.folders-bar .folder-chip-item:focus-within .chip-actions { opacity: 1; }
.chip-action-btn { padding: 6px 7px; font-size: 0.85rem; }
.btn-new-folder { width: 100%; justify-content: center; padding: 10px 12px; margin-top: 6px; font-size: 0.86rem; }

.files-main { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.files-toolbar { flex-wrap: nowrap; justify-content: flex-start; }
.search-box { min-width: 0; }
.files-toolbar .sort-select { flex: none; }
.files-summary { margin: -2px 2px 0; font-size: 0.82rem; }
.file-list { max-height: none; overflow: visible; padding-right: 0; gap: 10px; }
.file-row, .file-item { flex-wrap: wrap; row-gap: 12px; transform: none; }
.file-item:hover { transform: none; }
.file-details .file-name { font-size: 0.98rem; }
.file-subinfo .dot { opacity: 0.5; }
.file-actions { flex-wrap: nowrap; }
.file-actions .btn-copy { padding: 9px 14px; font-size: 0.84rem; }
.btn-dl { color: #7dd3fc; }
.more-wrap { position: relative; }
.btn-more { font-size: 1.1rem; padding: 5px 12px; line-height: 1.2; }
.more-wrap .menu-panel { min-width: 280px; }
.file-row.deleting { opacity: 0.4; pointer-events: none; }

.empty-files { padding: 44px 16px; }
.empty-files .empty-title { font-weight: 700; font-size: 1.05rem; color: var(--text-main); margin-bottom: 6px; }
.empty-files .empty-text { max-width: 420px; margin: 0 auto 16px; font-size: 0.88rem; color: var(--text-muted); }

@media (max-width: 760px) {
  .files-layout { grid-template-columns: 1fr; gap: 14px; }
  .folders-side { position: static; }
  .folders-bar { flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
  .folders-bar .folder-chip, .folders-bar .folder-chip-item { width: auto; white-space: nowrap; flex: none; }
  .folders-bar .chip-actions { opacity: 1; }
  .btn-new-folder { width: auto; align-self: flex-start; }
  .files-toolbar { flex-wrap: wrap; }
  .search-box { flex-basis: 100%; }
  .file-actions { width: 100%; }
  .file-actions .btn-copy { flex: 1; }
}

/* ---- Auth dialog extras ---- */
.alt-login { margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.alt-login summary { cursor: pointer; text-align: center; font-size: 0.84rem; color: var(--text-muted); list-style: none; }
.alt-login summary::-webkit-details-marker { display: none; }
.alt-login summary:hover { color: #fff; }
.alt-login[open] summary { margin-bottom: 12px; }
.login-key { margin-top: 14px; }
.forgot-row { text-align: center; margin-top: 8px; }

/* ---- Footer ---- */
.site-footer {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  margin: 18px 6px 0; font-size: 0.78rem; color: var(--text-subtle);
}
.site-footer a { color: var(--text-subtle); text-decoration: underline; text-underline-offset: 3px; }
.site-footer a:hover { color: #fff; }
.footer-links { display: inline-flex; gap: 16px; align-items: center; }
.footer-admin { background: none; border: none; color: #475569; font: inherit; font-size: 0.74rem; cursor: pointer; }
.footer-admin:hover { color: var(--text-muted); }

/* ==========================================================================
   Download page (/s/<token>) and password prompt
   ========================================================================== */
.dl-shell { max-width: 520px; margin: 0 auto; width: 100%; }
.dl-top { display: flex; align-items: center; justify-content: space-between; margin: 4px 4px 16px; }
.dl-top a { color: var(--text-muted); font-size: 0.85rem; text-decoration: none; }
.dl-top a:hover { color: #fff; }
.dl-top .dl-logo { font-weight: 800; font-size: 1.15rem; color: #fff; letter-spacing: -0.02em; }
.dl-card { text-align: center; }
.dl-icon {
  width: 76px; height: 76px; margin: 0 auto 16px; font-size: 2.3rem;
  display: flex; align-items: center; justify-content: center;
  background: rgba(59, 130, 246, 0.12); border: 1px solid rgba(59, 130, 246, 0.3); border-radius: 22px;
}
.dl-name { font-size: 1.25rem; font-weight: 800; color: #fff; word-break: break-word; line-height: 1.35; margin: 0 0 8px; }
.dl-meta { display: inline-flex; gap: 14px; flex-wrap: wrap; justify-content: center; font-size: 0.88rem; color: var(--text-muted); margin-bottom: 24px; }
.dl-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 17px 20px; font: inherit; font-size: 1.15rem; font-weight: 800;
  color: #fff; background: var(--primary-gradient); border: none; border-radius: 14px; cursor: pointer;
  text-decoration: none; box-shadow: var(--primary-shadow); transition: all 0.15s ease;
}
.dl-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 28px rgba(37, 99, 235, 0.55); color: #fff; }
.dl-hint { margin: 14px 0 0; font-size: 0.84rem; color: var(--text-muted); min-height: 1.3em; }
.dl-hint.ok { color: #34d399; }
.dl-hint a { color: #93c5fd; }
.dl-lock { margin: 0 0 16px; font-size: 0.9rem; color: var(--text-muted); }
.dl-pw {
  width: 100%; padding: 14px 16px; margin-bottom: 12px; font: inherit; font-size: 1rem;
  color: var(--text-main); background: rgba(0, 0, 0, 0.4); border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px; outline: none; text-align: center;
}
.dl-pw:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2); }
.dl-error { color: #f87171; font-size: 0.88rem; margin: 0 0 12px; }
.dl-foot { margin-top: 22px; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, 0.07); font-size: 0.84rem; color: var(--text-subtle); }
.dl-foot a { color: #93c5fd; text-decoration: none; font-weight: 600; }
.dl-foot a:hover { text-decoration: underline; }
.q-more { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
.q-more summary { cursor: pointer; font-size: 0.8rem; color: var(--text-muted); text-decoration: underline; text-underline-offset: 3px; list-style: none; }
.q-more summary::-webkit-details-marker { display: none; }
.q-more summary:hover { color: #fff; }
.q-more[open] summary { margin-right: 4px; }
.dl-link { color: #93c5fd; word-break: break-all; }
.dl-shell { margin-top: 5vh; }
/* mobile polish */
@media (max-width: 520px) {
  .topbar { margin-bottom: 12px; }
  .brand .sub { font-size: 0.72rem; }
  .guest-nav { gap: 8px; flex-direction: column; align-items: flex-end; }
  .btn-link-quiet { white-space: nowrap; font-size: 0.76rem; padding: 0; }
  .view-tab { font-size: 0.86rem; padding: 12px 6px; }
  .hero .guest-banner-title { font-size: 1.3rem; }
  .hero .guest-banner-text { font-size: 0.9rem; }
  .steps { gap: 8px 14px; }
  .dropzone { padding: 30px 14px 28px; min-height: 0; }
  .dropzone .dropzone-text-main { font-size: 1.12rem; }
  .opts-box summary { flex-wrap: wrap; }
  .opts-summary { margin-left: 0; text-align: left; flex-basis: 100%; order: 3; }
  .file-meta-col { flex-basis: 100%; }
}
@media (max-width: 760px) {
  .files-layout { grid-template-columns: minmax(0, 1fr); }
  .folders-side, .files-main, .folders-bar { min-width: 0; max-width: 100%; }
  .file-row, .file-item { min-width: 0; }
  .file-actions .btn-copy { min-width: 0; padding: 9px 8px; }
}
/* compact dropzone: one slim row on desktop */
.dropzone { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: 16px; row-gap: 2px; align-items: center; text-align: left; padding: 18px 22px; min-height: 0; }
.dropzone .dropzone-icon { grid-column: 1; grid-row: 1 / span 2; width: 48px; height: 48px; font-size: 1.4rem; border-radius: 14px; margin: 0; }
.dropzone .dropzone-text-main { grid-column: 2; grid-row: 1; font-size: 1.05rem; align-self: end; }
.dropzone .dropzone-text-sub { grid-column: 2; grid-row: 2; font-size: 0.82rem; align-self: start; overflow-wrap: anywhere; }
.dz-btn { grid-column: 3; grid-row: 1 / span 2; margin: 0; padding: 11px 24px; font-size: 0.95rem; }
.dropzone:hover, .dropzone.dragover { transform: none; }
.hero { margin-bottom: 16px; }
.hero .guest-banner-title { font-size: 1.4rem; }
.steps { margin-top: 12px; }
@media (max-width: 560px) {
  .dropzone { grid-template-columns: 1fr; text-align: center; justify-items: center; padding: 18px 14px; row-gap: 6px; }
  .dropzone .dropzone-icon, .dropzone .dropzone-text-main, .dropzone .dropzone-text-sub, .dz-btn { grid-column: 1; grid-row: auto; }
  .dz-btn { margin-top: 6px; }
}
/* ascetic pass */
.brand .sub { display: none; }
.topbar { margin-bottom: 14px; }
.panel { padding: 20px 24px 22px; }
.dropzone .dropzone-text-main { grid-row: 1 / span 2; align-self: center; font-size: 1.02rem; }
.opts-box { margin-top: 10px; }
.opts-box summary { padding: 10px 16px; font-size: 0.86rem; }
.files-summary { font-size: 0.78rem; margin: 0 2px; }
.site-footer { margin-top: 12px; }
.site-footer a { color: var(--text-subtle); }
.dl-meta { margin-bottom: 20px; }
.dl-hint { margin-top: 10px; }
@media (max-width: 560px) {
  .dropzone .dropzone-text-main { grid-row: auto; }
  .panel { padding: 14px 12px 16px; }
}

/* ===== KoshaDrive file manager ===== */
.files-layout { grid-template-columns: 236px minmax(0, 1fr); gap: 24px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; margin-bottom: 14px; }
.side-link, .tree-row {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 9px 10px; border-radius: 10px; border: 1px solid transparent; background: transparent;
  color: var(--text-muted); font: inherit; font-size: 0.9rem; text-align: left; cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s; user-select: none;
}
.side-link:hover, .tree-row:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.side-link.active, .tree-row.active { background: rgba(59, 130, 246, 0.18); border-color: rgba(59, 130, 246, 0.5); color: #bfdbfe; }
.side-link .sn, .tree-row .sn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.si { width: 20px; text-align: center; flex: none; }
.side-count { margin-left: auto; font-size: 0.72rem; font-weight: 700; padding: 1px 7px; border-radius: 6px; background: rgba(0, 0, 0, 0.35); color: var(--text-muted); }
.side-title { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-subtle); font-weight: 700; padding: 6px 10px 4px; }
.folders-bar { gap: 1px; }
.tree-caret { width: 14px; flex: none; text-align: center; font-size: 0.7rem; color: var(--text-subtle); transition: transform 0.12s; }
.tree-caret.open { transform: rotate(90deg); }
.tree-caret.empty { visibility: hidden; }
.tree-row:hover .tree-caret:not(.empty) { color: #fff; }
.drop-hover { outline: 2px dashed var(--primary) !important; outline-offset: -2px; background: rgba(59, 130, 246, 0.16) !important; }
.storage-meter { margin-top: 16px; padding: 12px; border-radius: 12px; background: rgba(0, 0, 0, 0.28); border: 1px solid rgba(255, 255, 255, 0.07); }
.sm-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-subtle); }
.sm-val { font-size: 1.15rem; font-weight: 800; color: #fff; margin: 2px 0; }
.sm-sub { font-size: 0.76rem; color: var(--text-muted); }

.crumbs-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; min-width: 0; }
.crumb { background: none; border: none; font: inherit; font-size: 1.12rem; font-weight: 700; color: var(--text-muted); padding: 4px 8px; border-radius: 8px; cursor: pointer; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumb:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.crumb.last { color: #fff; cursor: default; }
.crumb.last:hover { background: none; }
.crumb-sep { color: var(--text-subtle); }
.crumb-actions { display: flex; align-items: center; gap: 8px; }
.crumb-actions .btn-copy { padding: 9px 16px; }

.action-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border-radius: 12px; border: 1px solid rgba(59, 130, 246, 0.4); background: rgba(59, 130, 246, 0.12); font-size: 0.88rem; }
.action-bar.clip { border-color: rgba(245, 158, 11, 0.45); background: rgba(245, 158, 11, 0.1); }
.action-bar .ab-btns { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.action-bar .btn-copy { padding: 8px 14px; }
.action-bar .btn-copy:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; transform: none; }
.btn-icon.danger { color: #f87171; }
.btn-icon.danger:hover { background: rgba(239, 68, 68, 0.16); border-color: var(--danger); color: #ff9a9a; }
.btn-danger { width: 100%; padding: 12px 16px; font: inherit; font-weight: 700; color: #fff; background: linear-gradient(135deg, #ef4444, #dc2626); border: none; border-radius: var(--radius-md); cursor: pointer; }
.dlg-actions { display: flex; gap: 8px; }
.dlg-actions > * { flex: 1; justify-content: center; }

.folder-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.folder-tiles:empty { display: none; }
.folder-tile { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; background: var(--item-bg); border: 1px solid var(--item-border); border-radius: var(--radius-md); cursor: pointer; transition: border-color 0.15s, background 0.15s; user-select: none; }
.folder-tile:hover { border-color: var(--item-hover-border); background: var(--item-hover-bg); }
.folder-tile.dragging { opacity: 0.45; }
.ft-icon { font-size: 1.7rem; flex: none; }
.ft-body { min-width: 0; flex: 1; }
.ft-name { font-weight: 700; font-size: 0.94rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ft-meta { font-size: 0.76rem; color: var(--text-muted); }
.folder-tile .btn-more { padding: 3px 9px; }

.file-row { display: flex; align-items: center; gap: 12px; flex-wrap: nowrap; cursor: default; user-select: none; }
.file-row .file-meta-col { flex: 1; min-width: 0; }
.file-row.selected { background: rgba(59, 130, 246, 0.16); border-color: rgba(59, 130, 246, 0.55); }
.file-row.dragging { opacity: 0.45; }
.sel-box { flex: none; display: flex; align-items: center; padding: 4px; cursor: pointer; }
.sel-box input { width: 17px; height: 17px; accent-color: var(--primary); cursor: pointer; }
.fav-mark { margin-left: 6px; font-size: 0.8rem; }
.menu-sep { height: 1px; background: rgba(255, 255, 255, 0.08); margin: 4px 6px; }
.file-actions .btn-copy { padding: 8px 14px; }
.drag-ghost { position: fixed; top: -100px; left: -100px; padding: 6px 12px; background: var(--primary); color: #fff; border-radius: 8px; font-weight: 700; font-size: 0.85rem; }
.folder-select-item.disabled { opacity: 0.4; cursor: not-allowed; }
.folder-select-item { align-items: center; }

.upload-dock { position: fixed; right: 18px; bottom: 18px; z-index: 900; width: min(320px, calc(100vw - 36px)); padding: 12px 14px; background: #0f172a; border: 1px solid rgba(59, 130, 246, 0.45); border-radius: 14px; box-shadow: 0 18px 48px rgba(0, 0, 0, 0.6); }
.ud-title { font-weight: 700; font-size: 0.88rem; margin-bottom: 8px; }
.ud-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; margin-bottom: 8px; font-size: 0.8rem; }
.ud-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ud-pct { color: var(--text-muted); }
.ud-row .queue-progress-wrap { grid-column: 1 / -1; }
.ud-more { font-size: 0.76rem; color: var(--text-muted); }

@media (max-width: 760px) {
  .files-layout { grid-template-columns: minmax(0, 1fr); }
  .side-nav { flex-direction: row; overflow-x: auto; margin-bottom: 8px; }
  .side-link { width: auto; white-space: nowrap; flex: none; }
  .side-title { display: none; }
  .folders-bar { flex-direction: row; overflow-x: auto; }
  .tree-row { width: auto; flex: none; white-space: nowrap; padding-left: 10px !important; }
  .tree-caret { display: none; }
  .storage-meter { display: none; }
  .crumb { font-size: 1rem; }
  .file-row { flex-wrap: wrap; }
  .file-row .file-meta-col { flex-basis: calc(100% - 40px); }
  .file-row .file-actions { width: 100%; justify-content: flex-end; }
}
.sm-bar { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); overflow: hidden; margin: 8px 0 6px; }
.sm-bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #3b82f6, #60a5fa); transition: width 0.25s; }
.sm-bar-fill.full { background: linear-gradient(90deg, #f59e0b, #ef4444); }
