@import "tailwindcss";

:root {
  /* Default/fallback Light (macOS Light Mode) */
  --main-bg: 0 0% 98%;
  --sidebar-bg: 0 0% 95% / 0.8;
  --sidebar-glass: 0 0% 95% / 0.8;
  --border-color: 0 0% 88%;
  --item-hover: 0 0% 0% / 0.05;
  --item-selected: 211 100% 50%;
  --accent-color: 211 100% 50%;
  --stripe-bg: 0 0% 0% / 0.04;

  --text-primary: 0 0% 10%;
  --text-secondary: 0 0% 40%;
  --text-muted: 0 0% 55%;
  --bg-modal: 0 0% 100%;
  --bg-input: 0 0% 100%;
  --border-modal: 0 0% 85%;
  --surface-raised: 0 0% 100%;
  --surface-overlay: 0 0% 100% / 0.95;
  --shadow-color: 220 10% 20% / 0.1;
  --sidebar-shell-bg: 0 0% 92%;
  --sidebar-panel-bg: 0 0% 95%;
  --workspace-bg: 0 0% 98%;
  --statusbar-bg: 0 0% 96%;
  --sidebar-border: 0 0% 0% / 0.12;
  --sidebar-hover: 0 0% 0% / 0.06;
}

.theme-light {
  color-scheme: light;
  --main-bg: 0 0% 98%;
  --sidebar-bg: 0 0% 95% / 0.8;
  --sidebar-glass: 0 0% 95% / 0.8;
  --border-color: 0 0% 88%;
  --item-hover: 0 0% 0% / 0.05;
  --item-selected: 211 100% 50%;
  --accent-color: 211 100% 50%;
  --stripe-bg: 0 0% 0% / 0.04;
  --text-primary: 0 0% 10%;
  --text-secondary: 0 0% 40%;
  --text-muted: 0 0% 55%;
  --bg-modal: 0 0% 100%;
  --bg-input: 0 0% 100%;
  --border-modal: 0 0% 85%;
  --surface-raised: 0 0% 100%;
  --surface-overlay: 0 0% 100% / 0.95;
  --shadow-color: 220 10% 20% / 0.1;
  --sidebar-shell-bg: 0 0% 92%;
  --sidebar-panel-bg: 0 0% 95%;
  --workspace-bg: 0 0% 98%;
  --statusbar-bg: 0 0% 96%;
  --sidebar-border: 0 0% 0% / 0.12;
  --sidebar-hover: 0 0% 0% / 0.06;
}

.theme-dark {
  color-scheme: dark;
  --main-bg: 0 0% 11%;
  --sidebar-bg: 0 0% 13%;
  --sidebar-glass: 0 0% 13%;
  --surface-raised: 0 0% 12%;
  --surface-overlay: 0 0% 14%;
  --border-color: 0 0% 100% / 0.10;
  --border-modal: 0 0% 100% / 0.14;
  --item-hover: 0 0% 100% / 0.07;
  --item-selected: 211 100% 56%;
  --accent-color: 211 100% 56%;
  --stripe-bg: 0 0% 100% / 0.04;
  --text-primary: 0 0% 91%;
  --text-secondary: 0 0% 75%;
  --text-muted: 0 0% 50%;
  --bg-modal: 0 0% 13%;
  --bg-input: 0 0% 16%;
  --shadow-color: 0 0% 0% / 0.30;
  --status-completed: 136 62% 48%;
  --status-paused: 0 0% 56%;
  --status-downloading: 211 100% 56%;
  --status-failed: 0 62% 58%;
  --sidebar-shell-bg: 0 0% 11%;
  --sidebar-panel-bg: 0 0% 13%;
  --workspace-bg: 0 0% 11%;
  --statusbar-bg: 0 0% 11%;
  --sidebar-border: 0 0% 100% / 0.11;
  --sidebar-hover: 0 0% 100% / 0.07;
}

.theme-dracula {
  color-scheme: dark;
  --main-bg: 231 15% 18%;
  --sidebar-bg: 232 14% 23%;
  --sidebar-glass: 232 14% 23%;
  --surface-raised: 232 14% 23%;
  --surface-overlay: 231 15% 20%;
  --border-color: 232 10% 55% / 0.24;
  --border-modal: 232 10% 65% / 0.26;
  --item-hover: 326 100% 74% / 0.10;
  --item-selected: 326 100% 74%;
  --accent-color: 326 100% 74%;
  --stripe-bg: 0 0% 100% / 0.04;
  --text-primary: 60 30% 96%;
  --text-secondary: 228 14% 74%;
  --text-muted: 229 12% 58%;
  --bg-modal: 232 14% 23%;
  --bg-input: 231 15% 20%;
  --shadow-color: 231 20% 8% / 0.35;
  --status-completed: 135 94% 65%;
  --status-paused: 65 92% 76%;
  --status-downloading: 191 97% 77%;
  --status-failed: 0 100% 67%;
  --sidebar-shell-bg: 231 15% 15%;
  --sidebar-panel-bg: 232 14% 23%;
  --workspace-bg: 231 15% 18%;
  --statusbar-bg: 231 15% 16%;
  --sidebar-border: 326 100% 74% / 0.16;
  --sidebar-hover: 326 100% 74% / 0.10;
}

.theme-nord {
  color-scheme: dark;
  --main-bg: 220 16% 22%;
  --sidebar-bg: 220 17% 27%;
  --sidebar-glass: 220 17% 27%;
  --surface-raised: 220 17% 27%;
  --surface-overlay: 220 16% 24%;
  --border-color: 218 17% 51% / 0.28;
  --border-modal: 218 17% 62% / 0.28;
  --item-hover: 193 43% 67% / 0.12;
  --item-selected: 193 43% 67%;
  --accent-color: 193 43% 67%;
  --stripe-bg: 0 0% 100% / 0.04;
  --text-primary: 218 27% 92%;
  --text-secondary: 219 28% 80%;
  --text-muted: 218 17% 63%;
  --bg-modal: 220 17% 27%;
  --bg-input: 220 16% 24%;
  --shadow-color: 220 25% 10% / 0.34;
  --status-completed: 92 28% 65%;
  --status-paused: 40 71% 73%;
  --status-downloading: 193 43% 67%;
  --status-failed: 354 42% 56%;
  --sidebar-shell-bg: 220 18% 18%;
  --sidebar-panel-bg: 220 17% 27%;
  --workspace-bg: 220 16% 22%;
  --statusbar-bg: 220 18% 19%;
  --sidebar-border: 193 43% 67% / 0.16;
  --sidebar-hover: 193 43% 67% / 0.11;
}

@theme {
  --color-sidebar-bg: hsl(var(--sidebar-bg));
  --color-sidebar-glass: hsl(var(--sidebar-glass));
  --color-main-bg: hsl(var(--main-bg));
  --color-accent: hsl(var(--accent-color));
  --color-border-color: hsl(var(--border-color));
  --color-item-hover: hsl(var(--item-hover));
  --color-item-selected: hsl(var(--item-selected));
  
  --color-text-primary: hsl(var(--text-primary));
  --color-text-secondary: hsl(var(--text-secondary));
  --color-text-muted: hsl(var(--text-muted));
  --color-bg-modal: hsl(var(--bg-modal));
  --color-bg-input: hsl(var(--bg-input));
  --color-border-modal: hsl(var(--border-modal));
  --color-surface-raised: hsl(var(--surface-raised));
  --color-surface-overlay: hsl(var(--surface-overlay));
  --color-bg-context-menu: hsl(var(--surface-overlay));

  /* Apple System Fonts */
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}

@layer base {
  html,
  body {
    width: 100%;
    height: 100%;
  }

  body.is-resizing,
  body.is-resizing * {
    cursor: col-resize !important;
    user-select: none !important;
  }

  body {
    margin: 0;
    background-color: transparent; 
    color: var(--color-text-primary);
    font-family: var(--font-sans);
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    cursor: default;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.2s ease, color 0.2s ease;
  }

  * {
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
  }

  button,
  input,
  select,
  textarea {
    font: inherit;
  }

  button {
    -webkit-tap-highlight-color: transparent;
  }

  button:disabled {
    cursor: default;
  }

  input, textarea {
    user-select: auto;
    -webkit-user-select: auto;
    cursor: text;
  }

  :focus-visible {
    outline: 2px solid hsl(var(--accent-color) / 0.5);
    outline-offset: 2px;
  }

  html[data-font-size="small"] { font-size: 13px; }
  html[data-font-size="standard"] { font-size: 14px; }
  html[data-font-size="large"] { font-size: 16px; }

  ::-webkit-scrollbar {
    width: 6px;
    height: 6px;
  }
  ::-webkit-scrollbar-track {
    background: transparent;
  }
  ::-webkit-scrollbar-thumb {
    background: var(--color-border-color);
    border-radius: 6px;
  }
  ::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-muted);
  }

  ::selection {
    background: hsl(var(--accent-color) / 0.3);
    color: var(--color-text-primary);
  }
}

@layer components {
  /* macOS Surfaces */
  .app-surface {
    background: hsl(var(--surface-raised));
    border: 1px solid hsl(var(--border-color));
    box-shadow:
      inset 0 1px 0 hsl(0 0% 100% / 0.055),
      0 18px 50px hsl(var(--shadow-color));
    border-radius: 10px;
  }

  .app-card {
    background: hsl(var(--surface-raised));
    border: 1px solid hsl(var(--border-color));
    box-shadow:
      inset 0 1px 0 hsl(0 0% 100% / 0.055),
      0 18px 50px hsl(var(--shadow-color));
    border-radius: 10px;
    transition: none;
  }

  .app-control {
    min-height: 28px;
    border: 1px solid hsl(var(--border-modal));
    border-radius: 6px;
    background: hsl(var(--bg-input));
    color: hsl(var(--text-primary));
    transition: border-color 100ms ease;
  }

  .app-control:hover:not(:disabled) {
    border-color: hsl(var(--text-muted));
  }

  .app-control:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px hsl(var(--accent-color) / 0.2);
    outline: none;
  }

  .app-button {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid hsl(var(--border-modal));
    border-radius: 6px;
    background: hsl(var(--bg-input));
    color: hsl(var(--text-primary));
    font-weight: 500;
    font-size: 13px;
    transition: background-color 100ms ease;
    box-shadow: 0 1px 1px hsl(var(--shadow-color));
  }

  .app-button:hover:not(:disabled) {
    background: hsl(var(--item-hover));
  }

  .app-button:active:not(:disabled) {
    background: hsl(var(--border-color));
  }

  .app-button-primary {
    border-color: transparent;
    background: var(--color-accent);
    color: white;
  }

  .app-button-primary:hover:not(:disabled) {
    background: hsl(var(--accent-color) / 0.9);
  }

  .app-icon-button {
    display: inline-flex;
    width: 28px;
    height: 28px;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    color: hsl(var(--text-secondary));
    transition: background-color 100ms ease;
  }

  .app-icon-button:hover:not(:disabled) {
    background: hsl(var(--item-hover));
    color: hsl(var(--text-primary));
  }

  .app-icon-button:active:not(:disabled) {
    background: hsl(var(--border-color));
  }

  .app-modal-backdrop {
    background: hsl(0 0% 0% / 0.2);
    animation: fade-in 150ms ease-out;
  }

  .app-modal {
    background: hsl(var(--surface-overlay));
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid hsl(var(--border-modal));
    border-radius: 12px;
    box-shadow: 0 20px 40px hsl(var(--shadow-color));
    animation: modal-in 150ms ease-out;
  }

  .app-toast {
    border: 1px solid hsl(var(--border-modal));
    border-radius: 8px;
    background: hsl(var(--surface-overlay));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    color: hsl(var(--text-primary));
    box-shadow: 0 4px 12px hsl(var(--shadow-color));
    animation: toast-in 200ms ease-out;
  }

  .app-shell {
    background: hsl(var(--main-bg));
  }

  .app-sidebar-shell {
    padding: 9px 0 9px 9px;
    background: transparent;
  }

  .sidebar-resize-handle {
    position: absolute;
    top: 18px;
    right: -4px;
    bottom: 18px;
    z-index: 60;
    width: 8px;
    cursor: col-resize;
  }

  .sidebar-resize-handle::after {
    content: '';
    position: absolute;
    top: 0;
    right: 3px;
    bottom: 0;
    width: 1px;
    background: transparent;
    transition: background-color 100ms ease;
  }

  .sidebar-resize-handle:hover::after,
  body.is-resizing .sidebar-resize-handle::after {
    background: hsl(var(--accent-color) / 0.55);
  }

  .app-sidebar-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;

    background: hsl(var(--sidebar-panel-bg));
    border: 1px solid hsl(var(--sidebar-border));

    border-top-left-radius: 18px;
    border-bottom-left-radius: 18px;
    border-top-right-radius: 17px;
    border-bottom-right-radius: 17px;

    box-shadow:
      inset 0 1px 0 hsl(0 0% 100% / 0.045),
      2px 0 10px hsl(0 0% 0% / 0.20);
  }


  .app-workspace {
    background: hsl(var(--workspace-bg));
  }

  .app-statusbar {
    height: 26px;
    font-size: 10px;
    background: hsl(var(--statusbar-bg));
    border-top: 1px solid hsl(var(--border-color));
    box-shadow: none;
  }

  .sidebar-nav-item {
    height: 31px;
    border-radius: 8px;
    padding: 0 12px;
    margin-bottom: 2px;
    font-size: 12px;
    transition: background-color 100ms ease;
  }

  .sidebar-nav-item[data-active="true"] {
    background: hsl(var(--accent-color)) !important;
    color: white !important;
    box-shadow:
      inset 0 1px 0 hsl(0 0% 100% / 0.12),
      0 1px 0 hsl(0 0% 0% / 0.10);
  }

  .sidebar-nav-item[data-active="true"] svg {
    color: white !important;
  }

  .sidebar-nav-item[data-active="true"] .sidebar-count {
    color: white !important;
    background: hsl(0 0% 100% / 0.16) !important;
  }

  .sidebar-nav-item:not([data-active="true"]):hover {
    background: hsl(var(--sidebar-hover));
    color: hsl(var(--text-primary));
  }

  .sidebar-nav-item svg {
    width: 15px;
    height: 15px;
  }

  .sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
  }

  .sidebar-top-region {
    height: 40px;
    flex-shrink: 0;
    position: relative;
  }

  .sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 6px 10px 10px;
    -ms-overflow-style: none;
    scrollbar-width: none;
  }

  .sidebar-scroll::-webkit-scrollbar {
    display: none;
  }

  .sidebar-footer {
    flex-shrink: 0;
    padding: 7px 10px;
    border-top: 1px solid hsl(var(--sidebar-border));
    background: hsl(var(--sidebar-hover));
  }

  .sidebar-settings-button {
    height: 31px;
    border-radius: 8px;
    font-size: 12px;
    margin-bottom: 0;
  }

  .sidebar-section-label {
    padding: 0 12px;
    margin-bottom: 7px;
    font-size: 9px;
    line-height: 1;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: hsl(var(--text-muted));
  }

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

  .sidebar-toggle-button {
    position: absolute;
    top: 11px;
    right: 12px;
    z-index: 50;

    width: 24px;
    height: 24px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border-radius: 6px;
    color: hsl(var(--text-secondary));
    background: transparent;
  }

  .sidebar-toggle-button:hover {
    background: hsl(var(--sidebar-hover));
    color: hsl(var(--text-primary));
  }

  .settings-view,
  .settings-scroll {
    background: transparent;
  }

  .settings-toolbar {
    border-bottom: 1px solid hsl(var(--border-color));
  }

  .settings-tab-strip {
    padding: 16px 32px;
  }

  .settings-tab-button {
    min-height: 64px;
    border-radius: 8px;
    transition: none;
  }

  .settings-tab-button[data-active="true"] {
    background: hsl(var(--accent-color));
    box-shadow: none;
    color: white;
  }

  .settings-pane {
    padding: 0;
    background: transparent;
  }

  .settings-content-shell {
    padding: 32px;
  }

  .settings-title {
    margin: 0 0 24px;
    font-size: 28px;
    line-height: 1.15;
    font-weight: 650;
    letter-spacing: -0.025em;
  }

  .settings-section-title {
    margin: 0 0 7px 12px;
    font-size: 12px;
    line-height: 1.2;
    font-weight: 600;
    color: hsl(var(--text-secondary));
  }

  .mac-settings-group {
    background: hsl(var(--bg-modal));
    border-radius: 9px;
    border: 1px solid hsl(var(--border-color));
    box-shadow: none;
    overflow: hidden;
    margin-bottom: 24px;
  }

  .mac-settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 44px;
    padding: 9px 14px;
    border-bottom: 1px solid hsl(var(--border-color));
  }
  
  .mac-settings-row:last-child {
    border-bottom: none;
  }

  .settings-row-label {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
    font-size: 13px;
    color: hsl(var(--text-primary));
  }

  .settings-row-label small {
    font-size: 11px;
    line-height: 1.25;
    font-weight: 400;
    color: hsl(var(--text-muted));
  }

  .settings-radio-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
    font-size: 13px;
  }

  .settings-choice-row {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    align-items: start;
    justify-content: initial;
  }

  .settings-radio-group label {
    display: flex;
    align-items: center;
    gap: 7px;
  }

  .settings-radio-group input {
    accent-color: hsl(var(--accent-color));
  }

  .theme-option-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(72px, 1fr));
    gap: 7px;
    width: 100%;
  }

  .theme-option {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 58px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 6px;
    border: 1px solid hsl(var(--border-modal));
    border-radius: 7px;
    background: hsl(var(--bg-input));
    color: hsl(var(--text-secondary));
    font-size: 11px;
    font-weight: 500;
    text-align: center;
  }

  .theme-option:hover {
    background: hsl(var(--item-hover));
    color: hsl(var(--text-primary));
  }

  .theme-option[data-active="true"] {
    border-color: hsl(var(--accent-color));
    color: hsl(var(--text-primary));
    box-shadow: 0 0 0 1px hsl(var(--accent-color));
  }

  .theme-option input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
  }

  .theme-option-preview {
    display: flex;
    width: 30px;
    height: 16px;
    overflow: hidden;
    border: 1px solid hsl(var(--border-modal));
    border-radius: 5px;
    box-shadow: 0 1px 2px hsl(var(--shadow-color));
  }

  .theme-option-preview span {
    flex: 1;
  }

  .settings-group-footer {
    margin: 0;
    padding: 9px 14px;
    border-top: 1px solid hsl(var(--border-color));
    font-size: 11px;
    line-height: 1.35;
    color: hsl(var(--text-muted));
  }

  /* macOS Switch */
  .mac-switch {
    appearance: none;
    width: 36px;
    height: 20px;
    background: hsl(var(--border-color));
    border-radius: 20px;
    position: relative;
    cursor: default;
    outline: none;
    transition: background 0.2s ease;
  }
  .mac-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
    transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  .mac-switch:checked {
    background: var(--color-accent);
  }
  .mac-switch:checked::after {
    transform: translateX(16px);
  }
  .downloads-view {
    background: hsl(var(--main-bg));
  }

  .main-titlebar {
    height: 52px;
    display: flex;
    align-items: center;
    padding: 0 18px;
    border-bottom: 1px solid hsl(var(--border-color));
    background: hsl(var(--statusbar-bg));
  }

  .main-titlebar-title {
    font-size: 14px;
    font-weight: 700;
    color: hsl(var(--text-primary));
    letter-spacing: -0.01em;
  }

  .main-control-group {
    margin-left: auto;
    height: 28px;
    display: inline-flex;
    align-items: center;
    overflow: hidden;
    border-radius: 15px;
    border: 1px solid hsl(var(--border-modal));
    background: hsl(var(--bg-input));
  }

  .main-control-button {
    width: 30px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: hsl(var(--text-secondary));
    border-right: 1px solid hsl(var(--border-color));
  }

  .main-control-button svg {
    width: 14px;
    height: 14px;
  }

  .main-control-button:last-child {
    border-right: 0;
  }

  .main-control-button:hover:not(:disabled) {
    background: hsl(var(--item-hover));
    color: hsl(var(--text-primary));
  }

  .main-control-button.primary {
    color: hsl(var(--accent-color));
  }

  .main-control-button:disabled {
    opacity: 0.38;
  }

  .downloads-content-header {
    height: 58px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    background: hsl(var(--main-bg));
  }

  .downloads-title {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 17px;
    line-height: 1;
    font-weight: 700;
    color: hsl(var(--text-primary));
    letter-spacing: -0.02em;
  }

  .downloads-count {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: hsl(var(--text-secondary));
    background: hsl(var(--item-hover));
  }

  .downloads-table {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    background: hsl(var(--main-bg));
  }

  .downloads-empty-state {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px;
    color: hsl(var(--text-muted));
    text-align: center;
  }

  .downloads-empty-state > svg {
    width: 38px;
    height: 38px;
    margin-bottom: 12px;
    stroke-width: 1.35;
    color: hsl(var(--text-muted));
  }

  .downloads-empty-title {
    margin-bottom: 5px;
    color: hsl(var(--text-secondary));
    font-size: 15px;
    font-weight: 600;
  }

  .downloads-empty-description {
    max-width: 360px;
    font-size: 12px;
    line-height: 1.45;
  }

  .keyboard-symbol {
    color: hsl(var(--text-secondary));
    font-size: 13px;
    font-weight: 600;
  }

  .download-table-header {
    height: 32px;
    display: grid;
    align-items: center;
    column-gap: 0;
    padding: 0 16px;
    border-bottom: 1px solid hsl(var(--border-color));
    color: hsl(var(--text-primary));
    font-size: 12px;
    font-weight: 600;
  }

  .download-table-scroll {
    flex: 1;
    min-height: 0;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .download-table-header,
  .download-row {
    width: max-content;
    min-width: 100%;
  }

  .download-table-header > div {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
    min-width: 0;
  }

  .download-table-header > div:not(:first-child) {
    border-left: 1px solid hsl(var(--border-color));
    padding-left: 12px;
  }

  .column-resize-handle {
    position: absolute;
    top: 0;
    right: -4px;
    bottom: 0;
    z-index: 5;
    width: 8px;
    cursor: col-resize;
  }

  .column-resize-handle:hover {
    background: hsl(var(--accent-color) / 0.18);
  }

  .download-table-body {
    height: 100%;
    overflow: hidden;
  }

  .download-row {
    height: 32px;
    display: grid;
    align-items: center;
    padding: 0 16px;
    margin: 2px 12px;
    border-radius: 6px;
    color: hsl(var(--text-primary));
    font-size: 12px;
  }

  .download-row:nth-child(even) {
    background: hsl(var(--stripe-bg));
  }

  .download-row:hover {
    background: hsl(var(--item-hover));
  }

  .download-file-cell {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
  }

  .download-file-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: hsl(var(--text-primary));
    font-weight: 650;
  }

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

  .download-cell-right {
    text-align: right;
    display: flex;
    justify-content: flex-end;
    align-items: center;
  }

  .download-empty-row {
    color: hsl(var(--text-muted));
  }

  .download-empty-row .download-file-name {
    color: hsl(var(--text-muted));
    font-weight: 500;
  }

  .download-ghost-row {
    height: 32px;
    margin: 2px 12px;
    border-radius: 6px;
    flex-shrink: 0;
  }

  .download-ghost-row.striped {
    background: hsl(var(--stripe-bg));
  }

  .download-status-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-right: 12px;
  }

  .download-status-cell > span {
    min-width: 48px;
    flex-shrink: 0;
    font-size: 10px;
    font-variant-numeric: tabular-nums;
  }

  .download-progress-track {
    width: 100%;
    min-width: 58px;
    height: 14px;
    border-radius: 4px;
    overflow: hidden;
    background: hsl(var(--border-color));
    box-shadow: inset 0 1px 1px hsl(0 0% 0% / 0.22);
  }

  .download-progress-fill {
    height: 100%;
    border-radius: inherit;
    background: hsl(var(--status-downloading));
  }

  .download-progress-fill.paused {
    background: hsl(28 95% 56%);
  }

  .download-status {
    font-weight: 500;
  }

  .download-status-paused {
    color: hsl(var(--status-paused));
    font-weight: 600;
  }

  .download-status-completed {
    color: hsl(var(--status-completed));
    font-weight: 700;
  }

  .download-status-failed {
    color: hsl(var(--status-failed));
    font-weight: 700;
  }
  
  .download-status-downloading {
    color: hsl(var(--status-downloading));
    font-weight: 600;
  }
}

.glass-panel {
  background: var(--color-sidebar-glass);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
}

.glass-card {
  background: hsl(var(--bg-modal) / 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--color-border-color);
  box-shadow: 0 4px 12px hsl(var(--shadow-color));
  border-radius: 8px;
}

.settings-tab-label {
  font-size: 11px;
  font-weight: 500;
}

@media (max-width: 900px) {
  .settings-tab-label {
    font-size: 9px;
    letter-spacing: -0.01em;
  }

  .settings-tab-strip {
    padding-inline: 20px;
  }

  .settings-choice-row {
    grid-template-columns: 120px minmax(0, 1fr);
  }

  .theme-option-grid {
    grid-template-columns: repeat(3, minmax(76px, 1fr));
  }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

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