/* TelDrive UI Design System — Material Design 3 */
/* ============================================================
     TelDrive Material You Redesign
     Drop-in CSS replacement.
     Keeps existing HTML structure and JS hooks intact.
  ============================================================ */

  :root {
    color-scheme: dark;

    /* Material-ish color system */
    --md-bg: #101318;
    --md-surface: #14171d;
    --md-surface-1: #1a1d24;
    --md-surface-2: #20242c;
    --md-surface-3: #272b35;
    --md-surface-container: #1b1f27;
    --md-surface-container-high: #232833;
    --md-surface-container-highest: #2b303c;

    --md-primary: #adc6ff;
    --md-primary-container: #284777;
    --md-on-primary: #062f63;
    --md-on-primary-container: #d7e3ff;

    --md-secondary: #c0c7dd;
    --md-secondary-container: #3f4759;
    --md-on-secondary-container: #dce2f9;

    --md-tertiary: #dfbde6;
    --md-tertiary-container: #593f5f;

    --md-error: #ffb4ab;
    --md-error-container: #93000a;
    --md-success: #8bd8b7;
    --md-warning: #f4cf65;

    --md-on-bg: #e2e2e9;
    --md-on-surface: #e3e2e9;
    --md-on-surface-variant: #c4c6d0;
    --md-outline: #8e9099;
    --md-outline-variant: #444752;

    --md-state-hover: rgba(173, 198, 255, .08);
    --md-state-focus: rgba(173, 198, 255, .16);
    --md-state-pressed: rgba(173, 198, 255, .20);
    --md-state-selected: rgba(173, 198, 255, .18);

    --bg-base: var(--md-bg);
    --bg-surface: var(--md-surface);
    --bg-elevated: var(--md-surface-container);
    --bg-overlay: var(--md-surface-container-high);
    --bg-hover: var(--md-state-hover);
    --bg-active: var(--md-state-selected);

    --primary: var(--md-primary);
    --primary-light: #d7e3ff;
    --primary-dark: #8fb2f6;
    --secondary: #82d6e3;
    --accent: var(--md-tertiary);
    --danger: var(--md-error);
    --success: var(--md-success);
    --warning: var(--md-warning);

    --text-primary: var(--md-on-surface);
    --text-secondary: var(--md-on-surface-variant);
    --text-muted: #8e9099;

    --border: rgba(196, 198, 208, .12);
    --border-focus: rgba(173, 198, 255, .70);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .28);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, .28);
    --shadow-lg: 0 12px 28px rgba(0, 0, 0, .38);

    --radius-xs: 8px;
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 28px;
    --radius-full: 999px;

    --font-sans: 'DM Sans', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-display: 'Space Grotesk', var(--font-sans);
    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

    --sidebar-w: 280px;
    --header-h: 64px;
    --transition-fast: 120ms ease;
    --transition: 180ms ease;
    --spring: 280ms cubic-bezier(.2, 0, 0, 1);
  }

  /* Reset */
  *, *::before, *::after {
    box-sizing: border-box;
  }

  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  body {
    margin: 0;
    background:
      radial-gradient(circle at top left, rgba(173, 198, 255, .10), transparent 34rem),
      radial-gradient(circle at bottom right, rgba(130, 214, 227, .08), transparent 36rem),
      var(--md-bg);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }

  button,
  input,
  select {
    font: inherit;
  }

  button {
    border: 0;
    background: transparent;
    cursor: pointer;
  }

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

  ::selection {
    background: rgba(173, 198, 255, .28);
  }

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

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

  ::-webkit-scrollbar-thumb {
    background: rgba(196, 198, 208, .22);
    border-radius: var(--radius-full);
  }

  ::-webkit-scrollbar-thumb:hover {
    background: rgba(196, 198, 208, .34);
  }

  body::before,
  body::after {
    content: none;
  }

  /* App shell */
  #app {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    height: 100vh;
  }

  #app.auth-mode {
    grid-template-columns: 1fr;
  }

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

  /* Sidebar */
  .sidebar {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 16px 12px;
    overflow: hidden;
    background: rgba(20, 23, 29, .86);
    border-right: 1px solid var(--border);
    backdrop-filter: blur(18px);
  }

  .sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 8px 18px;
    border-bottom: 1px solid var(--border);
  }

  .logo-icon {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 16px;
    font-size: 22px;
    background:
      linear-gradient(135deg, rgba(173, 198, 255, .95), rgba(130, 214, 227, .95));
    color: #08233f;
    box-shadow: 0 8px 22px rgba(0, 0, 0, .26);
  }

  .logo-text {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -.04em;
  }

  .logo-text span {
    color: var(--primary);
  }

  .sidebar-logo div[style] {
    color: var(--text-muted) !important;
  }

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

  .nav-label {
    margin: 18px 10px 8px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
  }

  .nav-label:first-child {
    margin-top: 4px;
  }

  .nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 44px;
    padding: 0 14px;
    margin: 2px 0;
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    transition:
      background-color var(--transition),
      color var(--transition),
      transform var(--transition-fast);
  }

  .nav-item:hover {
    background: var(--md-state-hover);
    color: var(--text-primary);
  }

  .nav-item:active {
    transform: scale(.985);
    background: var(--md-state-pressed);
  }

  .nav-item.active {
    color: var(--md-on-primary-container);
    background: var(--md-primary-container);
  }

  .nav-item.active::before {
    content: none;
  }

  .nav-item .nav-icon {
    width: 24px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    font-size: 18px;
  }

  .nav-badge {
    margin-left: auto;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    color: var(--md-on-primary);
    background: var(--md-primary);
    font-size: 11px;
    font-weight: 800;
  }

  .storage-widget {
    margin: 4px 0 12px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: var(--md-surface-container);
    box-shadow: var(--shadow-sm);
  }

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

  .storage-label {
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
  }

  .storage-value {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 11px;
  }

  .storage-bar {
    height: 8px;
    overflow: hidden;
    border-radius: var(--radius-full);
    background: rgba(196, 198, 208, .12);
  }

  .storage-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--md-primary), #82d6e3);
    transition: width 520ms cubic-bezier(.2, 0, 0, 1);
  }

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

  .user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 58px;
    padding: 10px;
    border-radius: 22px;
    background: var(--md-surface-container-high);
    border: 1px solid transparent;
    transition:
      background-color var(--transition),
      border-color var(--transition);
  }

  .user-card:hover {
    background: var(--md-surface-container-highest);
    border-color: var(--border);
  }

  .user-avatar {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 50%;
    color: var(--md-on-primary);
    background: var(--md-primary);
    font-size: 15px;
    font-weight: 800;
  }

  .user-info {
    flex: 1;
    min-width: 0;
  }

  .user-name {
    overflow: hidden;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .user-handle {
    color: var(--text-muted);
    font-size: 12px;
  }

  .user-menu-btn {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: var(--text-secondary);
  }

  .user-menu-btn:hover {
    background: var(--md-state-hover);
    color: var(--text-primary);
  }

  /* Header */
  .header {
    height: var(--header-h);
    min-height: var(--header-h);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 24px;
    background: rgba(16, 19, 24, .76);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(18px);
  }

  .breadcrumbs {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex: 1;
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 600;
  }

  .breadcrumb-item {
    max-width: 220px;
    overflow: hidden;
    padding: 6px 8px;
    border-radius: var(--radius-full);
    white-space: nowrap;
    text-overflow: ellipsis;
    transition:
      color var(--transition),
      background-color var(--transition);
  }

  .breadcrumb-item:hover {
    color: var(--text-primary);
    background: var(--md-state-hover);
  }

  .breadcrumb-item.active {
    color: var(--text-primary);
  }

  .breadcrumb-sep {
    opacity: .55;
  }

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

  /* Toolbar */
  .toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    border-bottom: 1px solid var(--border);
    background: rgba(16, 19, 24, .48);
  }

  .toolbar-left,
  .toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .toolbar-left {
    min-width: 0;
    flex: 1;
  }

  .search-wrap {
    position: relative;
    flex: 1;
    max-width: 460px;
  }

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

  .search-input {
    width: 100%;
    min-height: 44px;
    padding: 0 16px 0 46px;
    border: 1px solid transparent;
    border-radius: var(--radius-full);
    outline: none;
    color: var(--text-primary);
    background: var(--md-surface-container-high);
    font-size: 14px;
    transition:
      border-color var(--transition),
      background-color var(--transition),
      box-shadow var(--transition);
  }

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

  .search-input:hover {
    background: var(--md-surface-container-highest);
  }

  .search-input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 4px rgba(173, 198, 255, .14);
  }

  /* Buttons */
  .btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 18px;
    overflow: hidden;
    border-radius: var(--radius-full);
    font-size: 14px;
    font-weight: 800;
    white-space: nowrap;
    transition:
      transform var(--transition-fast),
      background-color var(--transition),
      box-shadow var(--transition),
      border-color var(--transition),
      color var(--transition);
  }

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

  .btn:active {
    transform: translateY(0) scale(.98);
  }

  .btn-primary {
    color: var(--md-on-primary);
    background: var(--md-primary);
    box-shadow: var(--shadow-sm);
  }

  .btn-primary:hover {
    background: #c7d8ff;
    box-shadow: var(--shadow-md);
  }

  .btn-ghost {
    color: var(--md-primary);
    background: transparent;
    border: 1px solid var(--md-outline-variant);
  }

  .btn-ghost:hover {
    color: var(--md-on-primary-container);
    background: var(--md-state-hover);
    border-color: rgba(173, 198, 255, .32);
  }

  .btn-danger {
    color: var(--md-error);
    background: rgba(255, 180, 171, .10);
    border: 1px solid rgba(255, 180, 171, .24);
  }

  .btn-danger:hover {
    background: rgba(255, 180, 171, .16);
  }

  .btn-sm {
    min-height: 36px;
    padding: 0 14px;
    font-size: 13px;
  }

  .btn-icon {
    width: 40px;
    height: 40px;
    display: inline-grid;
    place-items: center;
    border: 1px solid transparent;
    border-radius: 50%;
    color: var(--text-secondary);
    background: transparent;
    font-size: 18px;
    transition:
      background-color var(--transition),
      color var(--transition),
      border-color var(--transition),
      transform var(--transition-fast);
  }

  .btn-icon:hover {
    color: var(--text-primary);
    background: var(--md-state-hover);
  }

  .btn-icon:active {
    transform: scale(.96);
  }

  .btn-icon.active {
    color: var(--md-on-primary-container);
    background: var(--md-primary-container);
    border-color: transparent;
  }

  /* Content */
  .content-area {
    position: relative;
    flex: 1;
    overflow-y: auto;
    padding: 24px;
  }

  .section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 24px 0 12px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
  }

  .section-title:first-child {
    margin-top: 0;
  }

  .section-title::after {
    content: "";
    height: 1px;
    flex: 1;
    background: var(--border);
  }

  /* Grid view */
  .file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(172px, 1fr));
    gap: 14px;
  }

  .file-card {
    position: relative;
    min-height: 158px;
    padding: 16px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 24px;
    background: var(--md-surface-container);
    box-shadow: none;
    cursor: pointer;
    transition:
      transform var(--transition),
      background-color var(--transition),
      border-color var(--transition),
      box-shadow var(--transition);
    animation: none;
  }

  .file-card::before {
    content: "";
    position: absolute;
    inset: 0;
    opacity: 0;
    background: var(--md-state-hover);
    transition: opacity var(--transition);
    pointer-events: none;
  }

  .file-card:hover {
    transform: translateY(-2px);
    background: var(--md-surface-container-high);
    border-color: rgba(173, 198, 255, .28);
    box-shadow: var(--shadow-md);
  }

  .file-card:hover::before {
    opacity: 1;
  }

  .file-card.selected {
    border-color: rgba(173, 198, 255, .70);
    background: rgba(173, 198, 255, .16);
    box-shadow: 0 0 0 3px rgba(173, 198, 255, .12);
  }

  .file-card-check {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 22px;
    height: 22px;
    display: none;
    place-items: center;
    border-radius: 50%;
    color: var(--md-on-primary);
    background: var(--md-primary);
    font-size: 12px;
    font-weight: 900;
    z-index: 2;
  }

  .file-card.selected .file-card-check {
    display: grid;
  }

  .file-icon {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    margin-bottom: 16px;
    border-radius: 18px;
    font-size: 30px;
    background: rgba(173, 198, 255, .12) !important;
  }

  .file-name {
    position: relative;
    z-index: 1;
    margin-bottom: 6px;
    overflow: hidden;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 800;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .file-meta {
    position: relative;
    z-index: 1;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 11px;
  }

  /* List view */
  .file-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .file-list-header {
    display: grid;
    grid-template-columns: minmax(220px, 2fr) minmax(90px, 1fr) minmax(120px, 1fr) minmax(90px, 1fr) 92px;
    gap: 12px;
    padding: 0 16px 10px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
  }

  .file-row {
    display: grid;
    grid-template-columns: minmax(220px, 2fr) minmax(90px, 1fr) minmax(120px, 1fr) minmax(90px, 1fr) 92px;
    align-items: center;
    gap: 12px;
    min-height: 58px;
    padding: 8px 12px;
    border: 1px solid transparent;
    border-radius: 18px;
    background: transparent;
    cursor: pointer;
    transition:
      background-color var(--transition),
      border-color var(--transition),
      transform var(--transition-fast);
    animation: none;
  }

  .file-row:hover {
    background: var(--md-state-hover);
    border-color: var(--border);
  }

  .file-row:active {
    transform: scale(.995);
  }

  .file-row.selected {
    background: rgba(173, 198, 255, .16);
    border-color: rgba(173, 198, 255, .50);
  }

  .file-row-name {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
  }

  .file-row-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 14px;
    background: var(--md-surface-container-high);
    font-size: 20px;
  }

  .file-row-text {
    min-width: 0;
  }

  .file-row-filename {
    overflow: hidden;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 800;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .file-row-type {
    overflow: hidden;
    color: var(--text-muted);
    font-size: 12px;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .file-row-cell {
    overflow: hidden;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 12px;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

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

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

  .file-row-action-btn {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: var(--text-secondary);
    background: transparent;
    font-size: 14px;
    transition:
      background-color var(--transition),
      color var(--transition);
  }

  .file-row-action-btn:hover {
    color: var(--text-primary);
    background: var(--md-state-hover);
  }

  /* Empty state */
  .empty-state {
    min-height: 460px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    text-align: center;
    padding: 48px 20px;
  }

  .empty-icon {
    width: 96px;
    height: 96px;
    display: grid;
    place-items: center;
    border-radius: 30px;
    background: var(--md-surface-container-high);
    font-size: 46px;
    opacity: 1;
  }

  .empty-title {
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 900;
    letter-spacing: -.03em;
  }

  .empty-desc {
    max-width: 360px;
    color: var(--text-muted);
    font-size: 14px;
  }

  /* Drop overlay */
  .drop-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    pointer-events: none;
    background: rgba(16, 19, 24, .78);
    backdrop-filter: blur(14px);
  }

  .drop-overlay.active {
    display: flex;
    pointer-events: all;
  }

  .drop-ring {
    width: 196px;
    height: 196px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 2px dashed rgba(173, 198, 255, .78);
    border-radius: 46px;
    background: rgba(173, 198, 255, .10);
    animation: pulse 1400ms ease-in-out infinite;
  }

  .drop-ring-icon {
    font-size: 52px;
  }

  .drop-ring-text {
    color: var(--md-primary);
    font-size: 16px;
    font-weight: 900;
  }

  @keyframes pulse {
    0%, 100% {
      box-shadow: 0 0 0 0 rgba(173, 198, 255, .18);
    }

    50% {
      box-shadow: 0 0 0 18px rgba(173, 198, 255, 0);
    }
  }

  /* Upload panel */
  .upload-panel {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 100;
    width: min(380px, calc(100vw - 32px));
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 28px;
    background: var(--md-surface-container-high);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    pointer-events: none;
    transform: translateY(18px) scale(.98);
    transition:
      opacity var(--spring),
      transform var(--spring);
  }

  .upload-panel.visible {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0) scale(1);
  }

  .upload-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--md-surface-container-highest);
  }

  .upload-panel-title {
    font-size: 15px;
    font-weight: 900;
  }

  .upload-panel-close {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: var(--text-secondary);
  }

  .upload-panel-close:hover {
    color: var(--text-primary);
    background: var(--md-state-hover);
  }

  .upload-panel-body {
    max-height: 300px;
    overflow-y: auto;
    padding: 12px 16px;
  }

  .upload-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
  }

  .upload-item + .upload-item {
    border-top: 1px solid var(--border);
  }

  .upload-item-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 16px;
    background: var(--md-surface-container);
    font-size: 22px;
  }

  .upload-item-info {
    flex: 1;
    min-width: 0;
  }

  .upload-item-name {
    overflow: hidden;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .upload-item-prog {
    margin-top: 6px;
  }

  .upload-bar {
    height: 6px;
    overflow: hidden;
    border-radius: var(--radius-full);
    background: rgba(196, 198, 208, .14);
  }

  .upload-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--md-primary), #82d6e3);
    transition: width 220ms ease;
  }

  .upload-item-status {
    margin-top: 4px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 11px;
  }

  .upload-item-badge {
    flex: 0 0 auto;
    padding: 4px 9px;
    border-radius: var(--radius-full);
    font-size: 10px;
    font-weight: 900;
  }

  .badge-done {
    color: var(--success);
    background: rgba(139, 216, 183, .14);
  }

  .badge-error {
    color: var(--danger);
    background: rgba(255, 180, 171, .14);
  }

  .badge-up {
    color: var(--md-primary);
    background: rgba(173, 198, 255, .14);
  }

  /* Modal */
  .modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, .54);
    backdrop-filter: blur(8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
  }

  .modal-backdrop.open {
    opacity: 1;
    pointer-events: all;
  }

  .modal {
    position: relative;
    width: min(100%, 460px);
    padding: 28px;
    border: 1px solid var(--border);
    border-radius: 30px;
    background: var(--md-surface-container-high);
    box-shadow: var(--shadow-lg);
    transform: translateY(14px) scale(.96);
    transition: transform var(--spring);
  }

  .modal-backdrop.open .modal {
    transform: translateY(0) scale(1);
  }

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

  .modal-title {
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -.035em;
  }

  .modal-close {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 50%;
    color: var(--text-secondary);
    background: transparent;
  }

  .modal-close:hover {
    color: var(--text-primary);
    background: var(--md-state-hover);
  }

  .modal-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  .modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 26px;
  }

  /* Forms */
  .form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .form-label {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .04em;
  }

  .form-input {
    width: 100%;
    min-height: 44px;
    padding: 0 14px;
    border: 1px solid var(--md-outline-variant);
    border-radius: 16px;
    outline: none;
    color: var(--text-primary);
    background: var(--md-surface-container);
    font-size: 14px;
    transition:
      border-color var(--transition),
      background-color var(--transition),
      box-shadow var(--transition);
  }

  .form-input:hover {
    background: var(--md-surface-container-high);
  }

  .form-input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 4px rgba(173, 198, 255, .14);
  }

  .form-hint {
    color: var(--text-muted);
    font-size: 12px;
  }

  select.form-input {
    appearance: none;
    padding-right: 36px !important;
    background-image:
      linear-gradient(45deg, transparent 50%, var(--text-secondary) 50%),
      linear-gradient(135deg, var(--text-secondary) 50%, transparent 50%);
    background-position:
      calc(100% - 18px) 18px,
      calc(100% - 13px) 18px;
    background-size: 5px 5px;
    background-repeat: no-repeat;
  }

  /* Toast */
  .toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
  }

  .toast {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 420px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 18px;
    color: var(--text-primary);
    background: var(--md-surface-container-high);
    box-shadow: var(--shadow-lg);
    pointer-events: all;
    font-size: 14px;
    animation: toastIn 220ms cubic-bezier(.2, 0, 0, 1) both;
  }

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

  .toast-icon {
    flex: 0 0 auto;
    font-size: 18px;
  }

  .toast-msg {
    flex: 1;
  }

  .toast-close {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: var(--text-muted);
  }

  .toast-close:hover {
    color: var(--text-primary);
    background: var(--md-state-hover);
  }

  .toast-success {
    border-color: rgba(139, 216, 183, .30);
  }

  .toast-error {
    border-color: rgba(255, 180, 171, .32);
  }

  .toast-info {
    border-color: rgba(173, 198, 255, .32);
  }

  .toast-warning {
    border-color: rgba(244, 207, 101, .32);
  }

  @keyframes toastIn {
    from {
      opacity: 0;
      transform: translateX(18px) scale(.98);
    }

    to {
      opacity: 1;
      transform: translateX(0) scale(1);
    }
  }

  @keyframes toastOut {
    to {
      opacity: 0;
      transform: translateX(18px) scale(.98);
    }
  }

  /* Context menu */
  .ctx-menu {
    position: fixed;
    z-index: 400;
    min-width: 208px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--md-surface-container-high);
    box-shadow: var(--shadow-lg);
    animation: ctxIn 120ms ease both;
  }

  @keyframes ctxIn {
    from {
      opacity: 0;
      transform: scale(.96);
    }

    to {
      opacity: 1;
      transform: scale(1);
    }
  }

  .ctx-item {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 40px;
    padding: 0 12px;
    border-radius: 14px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition:
      background-color var(--transition),
      color var(--transition);
  }

  .ctx-item:hover {
    color: var(--text-primary);
    background: var(--md-state-hover);
  }

  .ctx-item.danger:hover {
    color: var(--danger);
    background: rgba(255, 180, 171, .10);
  }

  .ctx-item span {
    width: 22px;
    display: inline-grid;
    place-items: center;
    font-size: 17px;
  }

  .ctx-divider {
    height: 1px;
    margin: 6px;
    background: var(--border);
  }

  /* Auth */
  .auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
      radial-gradient(circle at 20% 0%, rgba(173, 198, 255, .14), transparent 30rem),
      radial-gradient(circle at 80% 100%, rgba(130, 214, 227, .10), transparent 34rem),
      var(--md-bg);
  }

  .auth-card {
    width: min(100%, 440px);
    padding: 34px;
    border: 1px solid var(--border);
    border-radius: 34px;
    background: var(--md-surface-container-high);
    box-shadow: var(--shadow-lg);
  }

  .auth-logo {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 34px;
  }

  .auth-logo-icon {
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    border-radius: 20px;
    color: var(--md-on-primary);
    background: linear-gradient(135deg, var(--md-primary), #82d6e3);
    font-size: 28px;
    box-shadow: var(--shadow-md);
  }

  .auth-title {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -.04em;
  }

  .auth-subtitle {
    color: var(--text-muted);
    font-size: 14px;
  }

  .auth-step-title {
    margin-bottom: 6px;
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 900;
    letter-spacing: -.03em;
  }

  .auth-step-desc {
    margin-bottom: 24px;
    color: var(--text-secondary);
    font-size: 14px;
  }

  .phone-input-wrap {
    display: flex;
    gap: 10px;
  }

  .phone-flag {
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 0 14px;
    border: 1px solid var(--md-outline-variant);
    border-radius: 16px;
    color: var(--text-secondary);
    background: var(--md-surface-container);
    font-size: 14px;
    white-space: nowrap;
  }

  .otp-inputs {
    display: flex;
    justify-content: center;
    gap: 10px;
  }

  .otp-digit {
    width: 52px;
    height: 60px;
    border: 1px solid var(--md-outline-variant);
    border-radius: 18px;
    outline: none;
    color: var(--text-primary);
    background: var(--md-surface-container);
    text-align: center;
    font-family: var(--font-mono);
    font-size: 24px;
    font-weight: 900;
    transition:
      border-color var(--transition),
      box-shadow var(--transition),
      background-color var(--transition);
  }

  .otp-digit:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 4px rgba(173, 198, 255, .14);
  }

  .auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 22px 0;
  }

  .auth-divider-line {
    height: 1px;
    flex: 1;
    background: var(--border);
  }

  .auth-divider-text {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
  }

  .config-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 32px;
    padding: 0 12px;
    border: 1px solid rgba(130, 214, 227, .28);
    border-radius: var(--radius-full);
    color: #82d6e3;
    background: rgba(130, 214, 227, .10);
    font-family: var(--font-mono);
    font-size: 11px;
    cursor: pointer;
    transition:
      background-color var(--transition),
      border-color var(--transition);
  }

  .config-chip:hover {
    background: rgba(130, 214, 227, .16);
    border-color: rgba(130, 214, 227, .42);
  }

  /* Selection bar */
  .selection-bar {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--md-surface-container-high);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateX(-50%) translateY(80px);
    transition:
      opacity var(--spring),
      transform var(--spring);
  }

  .selection-bar.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }

  .selection-count {
    padding: 0 8px;
    color: var(--md-primary);
    font-size: 13px;
    font-weight: 900;
  }

  .selection-sep {
    width: 1px;
    height: 24px;
    background: var(--border);
  }

  /* Ripple */
  .ripple {
    position: relative;
    overflow: hidden;
  }

  .ripple-effect {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, .18);
    transform: scale(0);
    animation: ripple-anim 420ms ease-out;
    pointer-events: none;
  }

  @keyframes ripple-anim {
    to {
      opacity: 0;
      transform: scale(4);
    }
  }

  /* Progress */
  .top-progress {
    position: fixed;
    inset: 0 0 auto 0;
    height: 3px;
    z-index: 999;
    pointer-events: none;
    background: transparent;
  }

  .top-progress-bar {
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--md-primary), #82d6e3);
    box-shadow: 0 0 12px rgba(173, 198, 255, .45);
    transition: width 240ms ease;
  }

  /* Helpers */
  .hidden {
    display: none !important;
  }

  .flex {
    display: flex;
  }

  .items-center {
    align-items: center;
  }

  .gap-2 {
    gap: 8px;
  }

  .ml-auto {
    margin-left: auto;
  }

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

  .text-danger {
    color: var(--danger);
  }

  .text-success {
    color: var(--success);
  }

  .font-mono {
    font-family: var(--font-mono);
  }

  .text-xs {
    font-size: 11px;
  }

  .text-sm {
    font-size: 12.5px;
  }

  .fw-6 {
    font-weight: 600;
  }

  .mt-2 {
    margin-top: 8px;
  }

  .w-full {
    width: 100%;
  }

  .text-center {
    text-align: center;
  }

  /* Skeleton */
  .skeleton {
    border-radius: var(--radius-sm);
    background:
      linear-gradient(
        90deg,
        var(--md-surface-container) 25%,
        var(--md-surface-container-high) 50%,
        var(--md-surface-container) 75%
      );
    background-size: 200% 100%;
    animation: shimmer 1200ms infinite;
  }

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

    100% {
      background-position: -200% 0;
    }
  }

  /* Responsive */
  @media (max-width: 1024px) {
    :root {
      --sidebar-w: 250px;
    }

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

    .toolbar {
      flex-wrap: wrap;
    }

    .toolbar-right {
      margin-left: auto;
    }
  }

  @media (max-width: 768px) {
    #app {
      grid-template-columns: 1fr;
    }

    .sidebar {
      display: none;
    }

    .sidebar.mobile-open {
      position: fixed;
      inset: 0 auto 0 0;
      z-index: 500;
      display: flex;
      width: min(var(--sidebar-w), 86vw);
      box-shadow: var(--shadow-lg);
    }

    .header {
      padding-inline: 16px;
    }

    .toolbar {
      padding: 12px 16px;
    }

    .toolbar-left,
    .toolbar-right {
      width: 100%;
    }

    .search-wrap {
      max-width: none;
    }

    .content-area {
      padding: 16px;
    }

    .file-list-header {
      display: none;
    }

    .file-row {
      grid-template-columns: 1fr auto;
    }

    .file-row-cell {
      display: none;
    }

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

    .selection-bar {
      left: 12px;
      right: 12px;
      bottom: 16px;
      justify-content: center;
      flex-wrap: wrap;
      border-radius: 24px;
      transform: translateY(80px);
    }

    .selection-bar.visible {
      transform: translateY(0);
    }

    .toast-container {
      left: 12px;
      right: 12px;
      top: 12px;
    }

    .toast {
      min-width: 0;
      width: 100%;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      scroll-behavior: auto !important;
      animation-duration: .01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: .01ms !important;
    }
  }

/* ============================================================
   TelDrive Brand & Icon Assets
   ============================================================ */
.asset-logo-mark {
  width: 72%;
  height: 72%;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, .22));
}
.logo-icon,
.auth-logo-icon {
  overflow: hidden;
  background: linear-gradient(135deg, rgba(173, 198, 255, .18), rgba(130, 214, 227, .12)) !important;
  border: 1px solid rgba(173, 198, 255, .28);
}
.ui-icon {
  width: 1.25em;
  height: 1.25em;
  display: inline-block;
  vertical-align: -0.22em;
  color: currentColor;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav-icon .ui-icon,
.btn .ui-icon,
.btn-icon .ui-icon,
.file-row-action-btn .ui-icon,
.toast-icon .ui-icon {
  width: 20px;
  height: 20px;
}
.file-svg-icon {
  width: 34px;
  height: 34px;
  color: var(--md-primary);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.file-icon .file-svg-icon {
  width: 36px;
  height: 36px;
}
.file-row-icon .file-svg-icon,
.upload-item-icon .file-svg-icon {
  width: 24px;
  height: 24px;
}
.toast-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
