/* ============================================
   STOCKER PLACE - MAIN STYLES
   Uses tokens from design-system.css
   ============================================ */

:root {
  /* Legacy aliases (for backward compatibility) */
  --bg: var(--color-bg-base);
  --panel: var(--color-bg-surface);
  --panel-elevated: var(--color-bg-elevated);
  --panel-highlight: var(--color-bg-highlight);
  --text: var(--color-text-primary);
  --text-secondary: var(--color-text-secondary);
  --muted: var(--color-text-muted);
  --accent: var(--color-brand-primary);
  --accent-2: var(--color-brand-secondary);
  --border: var(--color-border-default);
  --border-strong: var(--color-border-strong);
  --border-hover: var(--color-border-hover);
  --shadow: rgba(0, 0, 0, 0.45);
  
  /* Legacy semantic aliases */
  --color-bg: var(--color-bg-base);
  --color-surface: var(--color-bg-surface);
  --color-surface-elevated: var(--color-bg-elevated);
  --color-surface-highlight: var(--color-bg-highlight);
  --color-text: var(--color-text-primary);
  --color-accent: var(--color-brand-primary);
  --color-accent-strong: var(--color-brand-secondary);
  --color-border: var(--color-border-default);

  /* Legacy elevation */
  --shadow-1: 0 0 0 1px rgba(255,255,255,0.02) inset;
  --shadow-2: var(--shadow-xl);
  --shadow-3: var(--shadow-2xl);

  /* Legacy motion */
  --motion-fast: var(--duration-fast);
  --motion-base: var(--duration-normal);
  --motion-slow: var(--duration-slow);
  --ease-standard: var(--ease-default);
}

* {
  box-sizing: border-box;
}

body.dark {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button,
select,
input {
  font: inherit;
}

.app {
  min-height: 100vh;
  padding: 48px 40px 40px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 80px;
}

.content {
  display: flex;
  flex-direction: column;
  gap: 28px;
  width: min(1080px, 100%);
}

.logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 12px 0 6px;
}

.logo {
  height: 56px;
  opacity: 0.9;
}

.logo-link {
  display: block;
  transition: opacity 0.2s ease;
}

.logo-link:hover {
  opacity: 0.8;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: 
    0 0 0 1px rgba(255,255,255,0.02) inset,
    0 20px 50px var(--shadow);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  width: 100%;
  overflow: hidden;
}

.title {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.4px;
}

.title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.title-row .title {
  flex: 1;
}

.help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  flex-shrink: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.toolbar-main .search-box {
  flex: 0 1 200px;
  min-width: 120px;
}

.toolbar-spacer {
  flex: 1;
  min-width: 8px;
}

.deploy-info {
  position: absolute;
  top: 12px;
  right: 24px;
  font-size: 11px;
  color: var(--muted);
  opacity: 0.7;
}

.deploy-info:hover {
  opacity: 1;
}

/* Hide button labels on smaller screens */
@media (max-width: 1100px) {
  .toolbar-main .btn .btn-label {
    display: none;
  }
  
  .toolbar-main .btn {
    width: 40px;
    min-width: 40px;
    max-width: 40px;
    padding: 0;
  }
  
  .toolbar-main .btn i {
    font-size: 18px;
  }
  
  .toolbar-main .search-box {
    flex: 1 1 150px;
  }
  
  /* Ensure Owner and Account buttons are same size */
  .toolbar-main .owner-btn,
  .toolbar-main .account-btn {
    width: 40px;
    min-width: 40px;
    max-width: 40px;
  }
}

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

.breadcrumb-item {
  background: var(--panel-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  font-size: 13px;
}

.breadcrumb-item:hover {
  border-color: var(--border-hover);
  background: var(--panel-highlight);
}

.breadcrumb-divider {
  color: var(--muted);
  display: inline-flex;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  flex: 1;
}

.toolbar-actions .search-box {
  flex: 1;
  min-width: 200px;
  max-width: 320px;
}

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

.uploads-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.uploads-container:empty {
  display: none;
}

.upload-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: var(--panel-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  animation: slideIn 0.25s ease;
}

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

.upload-card.completed {
  border-color: #22c55e40;
  background: rgba(34, 197, 94, 0.05);
}

.upload-card.error {
  border-color: #ef444440;
  background: rgba(239, 68, 68, 0.05);
}

.upload-card .upload-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.upload-card .upload-name {
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.upload-card .upload-size {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.upload-card .upload-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.upload-card .upload-percent {
  font-size: 13px;
  color: var(--accent-2);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-width: 45px;
  text-align: right;
}

.upload-card .upload-state {
  font-size: 12px;
  color: var(--muted);
}

.upload-card.completed .upload-state {
  color: #22c55e;
}

.upload-card.error .upload-state {
  color: #ef4444;
}

.upload-card .progress-bar {
  position: relative;
  height: 28px;
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.08);
  padding: 4px;
  overflow: hidden;
}

.upload-card .progress-value {
  height: 100%;
  width: 0%;
  border-radius: 100px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 20px -6px var(--accent);
  transition: width 0.3s ease;
}

.upload-card.completed .progress-value {
  background: linear-gradient(135deg, #22c55e, #4ade80);
  box-shadow: 0 6px 20px -6px #22c55e;
}

.upload-card.error .progress-value {
  background: linear-gradient(135deg, #ef4444, #f87171);
  box-shadow: 0 6px 20px -6px #ef4444;
}

.search-box {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--panel-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0 var(--space-4);
  height: 40px;
  min-width: 280px;
  transition: border-color 0.15s;
}

.search-box:focus-within {
  border-color: var(--border-strong);
}

.search-box input {
  background: transparent;
  border: none;
  color: var(--text);
  outline: none;
  width: 100%;
  min-width: 180px;
  font-size: 14px;
}

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

.search-results {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.5);
  display: grid;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
}

.search-results.hidden {
  display: none;
}

.search-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.3px;
}

.search-results-list {
  display: grid;
  gap: 16px;
  max-height: 320px;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.search-results-list::-webkit-scrollbar {
  display: none;
}

.search-section h4 {
  margin: 0 0 8px;
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.6px;
}

.search-item {
  background: var(--panel-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  color: var(--text);
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.search-item:hover {
  border-color: var(--border-hover);
  background: var(--panel-highlight);
}

.search-actions {
  display: inline-flex;
  gap: 8px;
}

/* Старые стили сортировки - больше не нужны */
.sortable {
  cursor: pointer;
}

.sort-indicator {
  display: inline-flex;
  color: var(--muted);
  flex-shrink: 0;
}

.sortable.active .sort-indicator {
  color: var(--accent);
}

.btn {
  height: 40px;
  padding: 0 var(--space-4);
  border-radius: var(--radius-lg);
  border: 1px solid transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: filter 0.15s, transform 0.1s, box-shadow 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  white-space: nowrap;
}

.btn:hover {
  filter: brightness(1.08);
  box-shadow: 0 4px 16px rgba(52, 123, 191, 0.25);
}

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

.btn.secondary {
  background: var(--panel-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
}

.btn.secondary:hover {
  border-color: var(--accent);
  background: rgba(52, 123, 191, 0.1);
  color: var(--text);
}

/* Icon-only button variant */
.btn.icon-only {
  width: 40px;
  padding: 0;
}

.btn.icon-only i {
  font-size: 18px;
}

.btn.danger {
  background: #b91c1c;
  border-color: #b91c1c;
}

.btn.danger:hover {
  background: #dc2626;
  box-shadow: 0 4px 16px rgba(185, 28, 28, 0.3);
}

.btn.fullwidth {
  width: 100%;
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 24px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: color 0.2s, background 0.2s;
}

.icon-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.icon-btn.close-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 22px;
}

.icon-btn.close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  text-align: center;
  color: var(--muted);
  background: var(--panel-elevated);
  transition: border-color 0.15s, background 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  cursor: pointer;
}

.url-upload-inline {
  display: flex;
  gap: var(--space-2);
  width: 100%;
  max-width: 500px;
  height: 40px;
  background: var(--panel);
  padding: var(--space-1);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  transition: border-color 0.2s;
}

.url-upload-inline:focus-within {
  border-color: rgba(255, 255, 255, 0.4);
}

.url-upload-inline .input.small {
  flex: 1;
  height: 100%;
  background: transparent;
  border: none !important;
  padding: 0 var(--space-3);
  font-size: 13px;
  color: var(--text);
  border-radius: var(--radius-lg);
  box-shadow: none !important;
  outline: none !important;
}

.url-upload-inline .btn.small {
  height: 32px;
  padding: 0 var(--space-4);
  border-radius: var(--radius-lg);
  font-size: 12px;
  white-space: nowrap;
}

.drop-text {
  pointer-events: none;
}

.dropzone.dragover {
  border-color: var(--accent);
  background: rgba(52, 123, 191, 0.08);
}

.status {
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
}

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.table-wrap::-webkit-scrollbar {
  display: none;
}

.table thead {
  background: var(--panel-elevated);
}

.table thead th {
  padding: 12px 16px;
  text-align: left;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  cursor: default;
  transition: color 0.2s;
  vertical-align: middle;
}

.table thead th.col-type {
  padding: 12px 8px 12px 16px;
  text-align: center;
  vertical-align: middle;
}

.table thead th.col-type .th-type-label {
  display: block;
  max-width: 64px;
  margin: 0 auto;
  line-height: 1.2;
  font-size: 10px;
  letter-spacing: 0.08em;
}

.table thead th.col-size,
.table thead th.col-date {
  text-align: right;
}

.table thead th.col-name {
  text-align: left;
  padding-left: 18px;
}

.table thead th.col-actions {
  text-align: right;
  padding-right: 20px;
}

.table thead th:hover {
  color: var(--text);
}

.table thead th.sortable {
  cursor: pointer;
}

.table thead th .sort-indicator {
  display: inline-flex;
  color: var(--muted);
  margin-left: 4px;
}

.table thead th.sortable.active .sort-indicator {
  color: var(--accent);
}

.table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  background: var(--panel);
}

.table col.col-type { width: 76px; }
/* Уже колонка имени — больше воздуха у превью и меньше «простыня» имени */
.table col.col-name { width: 26%; min-width: 0; max-width: 360px; }
.table col.col-size { width: 96px; }
.table col.col-date { width: 104px; }
/* PDF + ссылка + …; иначе пересечение с датой при overflow:hidden на td */
.table col.col-actions { width: 252px; }

.table td.col-date {
  padding-right: 16px;
  white-space: nowrap;
  box-sizing: border-box;
}

.table td.col-size,
.table td.col-date {
  text-align: right;
}

.table td.col-name {
  text-align: left;
  vertical-align: middle;
  min-width: 0;
  max-width: min(360px, 46vw);
  overflow: hidden;
  padding-left: 18px;
  padding-right: 16px;
}

.table td.col-actions {
  text-align: right;
  overflow: visible;
  padding-left: 12px;
  vertical-align: middle;
}

.table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  overflow: hidden;
  position: relative;
}

.table td.col-type {
  width: 76px;
  padding: 14px 14px 14px 0;
  text-align: center;
  overflow: visible;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}

.table td.col-type .row-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  line-height: 1;
  vertical-align: middle;
  width: 18px;
  height: 18px;
}

.table td.col-type .folder-type-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.table td.col-type .folder-type-slot .row-icon {
  width: 26px;
  height: 26px;
  font-size: 26px;
}

.table td.col-type .file-cover-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  background: rgba(255, 255, 255, 0.03);
  color: inherit;
  cursor: pointer;
  width: 56px;
  height: 56px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
  vertical-align: middle;
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}

.table td.col-type .file-cover-slot--empty {
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.14);
}

.table td.col-type .file-cover-slot--empty:hover {
  border-color: rgba(88, 160, 255, 0.55);
  background: rgba(88, 160, 255, 0.08);
  box-shadow: 0 0 0 1px rgba(88, 160, 255, 0.12);
}

.table td.col-type .file-cover-slot:not(.file-cover-slot--empty):hover {
  border-color: rgba(88, 160, 255, 0.45);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.table td.col-type .file-cover-slot:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.table td.col-type .file-cover-slot.cover-dragover {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-style: solid;
  border-color: var(--accent);
}

.table td.col-type .file-cover-slot .row-cover-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.table td.col-type .file-cover-slot .row-icon {
  width: 26px;
  height: 26px;
  font-size: 26px;
  opacity: 0.85;
}

.table td.col-type .file-cover-slot--empty .row-icon {
  color: rgba(139, 184, 217, 0.65);
}

/* Полноразмерное превью обложки при hover (тот же URL, что у миниатюры — кеш браузера) */
.cover-hover-popover {
  position: fixed;
  z-index: 10040;
  left: 0;
  top: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.12s ease, visibility 0.12s ease;
}

.cover-hover-popover.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

@media (prefers-reduced-motion: reduce) {
  .cover-hover-popover {
    transition: none;
  }
}

.cover-hover-popover-inner {
  padding: 6px;
  background: var(--panel-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-2), 0 16px 48px rgba(0, 0, 0, 0.45);
}

.cover-hover-popover-img {
  display: block;
  max-width: min(560px, calc(100vw - 24px));
  max-height: min(72vh, 900px);
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: center;
}

/* Цвета иконок */
.row-icon.icon-folder,
.search-item .ph-folder,
.folder-node .ph-folder {
  color: #e6b44c;
}

.row-icon.icon-file,
.search-item .ph-file {
  color: #8bb8d9;
}

.table td:first-child {
  padding-left: 20px;
  text-align: center;
}

.table tbody tr {
  border-bottom: 1px solid var(--border);
}

.table tbody tr:last-child {
  border-bottom: none;
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table td:last-child {
  padding-right: 20px;
}

.table tbody tr {
  transition: background 0.12s ease;
}

.table tbody tr:hover {
  background: var(--panel-highlight);
}

.table td.col-size,
.table td.col-date {
  white-space: nowrap;
}

.row-name {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  color: inherit;
  background: transparent;
  border: none;
  cursor: pointer;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 0;
  height: auto;
  line-height: 1.4;
  text-align: left;
}

.row-name .row-icon,
.action-btn .btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  line-height: 1;
}

.table td.col-name .row-name span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
  line-height: 1.45;
  vertical-align: middle;
  font-weight: 500;
  font-size: 14px;
  color: var(--text);
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
  min-width: 0;
}

.row-empty .empty-message {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  padding: 32px 16px;
}

.row-load-more .load-more-cell {
  text-align: center;
  padding: 16px;
}

.row-load-more .btn.fullwidth {
  max-width: 400px;
}

.action-btn {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--panel-elevated);
  color: var(--text-secondary);
  padding: var(--space-2) var(--space-3);
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  font-size: 12px;
  white-space: nowrap;
}

.action-btn--compact {
  padding: 8px;
  min-width: 36px;
  justify-content: center;
  gap: 0;
}

.action-btn--compact .btn-icon {
  font-size: 18px;
}

.action-btn:hover {
  border-color: var(--border-hover);
  background: var(--panel-highlight);
  color: var(--text);
}

.action-btn:disabled {
  opacity: 0.72;
  cursor: not-allowed;
}

.action-btn.is-loading {
  color: #ffd8d8;
  background: rgba(176, 44, 44, 0.14);
  border-color: rgba(239, 68, 68, 0.35);
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.08) inset;
}

.action-btn.is-loading .btn-icon {
  color: #ffb7b7;
}

.action-btn.danger {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.action-btn.danger:hover {
  background: rgba(185, 28, 28, 0.2);
  border-color: rgba(185, 28, 28, 0.55);
  color: #f0b4b4;
}

.table td.col-actions .row-actions .action-btn {
  flex-shrink: 0;
  padding: 5px 8px;
}

.table td.col-actions .row-actions .action-btn--compact {
  padding: 8px;
}

.table td.col-actions .row-actions .action-btn .btn-icon {
  font-size: 16px;
}

.table td.col-actions .row-actions .action-btn--compact .btn-icon {
  font-size: 18px;
}

.action-btn[data-action='pdf'] {
  color: #e8a0a0;
}

.action-btn[data-action='pdf']:hover {
  color: #ffb4b4;
  border-color: rgba(232, 93, 93, 0.45);
}

.btn.is-copied,
.action-btn.is-copied {
  border-color: rgba(34, 197, 94, 0.45);
  background: rgba(34, 197, 94, 0.12);
  color: #d7fbe2;
}

.btn.is-copied i,
.action-btn.is-copied .btn-icon {
  color: #6ee7a0;
}

.highlight {
  border-left: 3px solid var(--accent);
  background: rgba(58, 135, 207, 0.08) !important;
}

.folder-tree {
  display: grid;
  gap: var(--space-1);
}

.folder-node {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.folder-node:hover {
  background: var(--panel-elevated);
  color: var(--text);
}

.folder-node .node-label {
  flex: 1;
  font-size: 13px;
}

.folder-node.active {
  background: var(--panel-highlight);
  color: var(--text);
}

.folder-children {
  margin-left: var(--space-3);
  border-left: 1px solid var(--border);
  padding-left: var(--space-3);
  display: grid;
  gap: var(--space-1);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  z-index: 100;
}
.modal.hidden { display: none; }
.modal-content {
  width: 720px;
  max-width: 95vw;
  max-height: 90vh;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: 
    0 0 0 1px rgba(255,255,255,0.02) inset,
    0 32px 72px rgba(0,0,0,.6);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  position: relative;
  isolation: isolate;
}

.modal-content .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.modal-content .modal-body::-webkit-scrollbar {
  display: none;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
  gap: var(--space-3);
  position: relative;
  z-index: 2;
  background: linear-gradient(180deg, rgba(20, 23, 30, 0.88), rgba(20, 23, 30, 0.72));
  backdrop-filter: blur(18px) saturate(145%);
  -webkit-backdrop-filter: blur(18px) saturate(145%);
}

.modal-header::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -24px;
  height: 24px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(8, 10, 16, 0.26), transparent);
}
.modal-header .header-actions { display: inline-flex; gap: var(--space-2); align-items: center; }
.modal-title { margin: 0; font-size: 20px; font-weight: 600; }
.icon-btn { background: transparent; border: none; color: var(--muted); font-size: 24px; cursor: pointer; line-height: 1; transition: color 0.15s; }
.icon-btn:hover { color: var(--text); }
.modal-body { padding: var(--space-6); overflow: visible; display: grid; gap: var(--space-4); }
.trash-actions { display: flex; justify-content: flex-end; gap: var(--space-2); }
.trash-actions .btn { padding: var(--space-3) var(--space-4); }

.modal .table {
  table-layout: fixed;
}

.modal .table td.col-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 0; /* Важно для работы text-overflow в table-layout: fixed */
}

.modal .table td.col-date {
  width: 150px;
  text-align: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.modal .table td.col-size {
  width: 100px;
  text-align: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  padding-right: var(--space-4);
}

.modal .table td.col-actions {
  width: 110px;
  text-align: right;
  padding-right: var(--space-4);
}

.modal .table td:last-child {
  justify-content: flex-end;
}

.modal .table button {
  padding: 0;
  width: 36px;
  height: 32px;
}

.modal .table button span {
  display: none;
}

.modal .table button::after {
  display: none;
}

.modal .modal-content {
  width: 760px;
  max-width: 95vw;
}

.modal-content.modal-lg {
  width: 900px;
}

.trash-toolbar {
  display: flex;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.trash-toolbar .search-box {
  flex: 1;
  max-width: 300px;
}

.trash-toolbar .search-box .input {
  width: 100%;
}

.trash-table .col-type {
  width: 40px;
  text-align: center;
  padding-left: var(--space-4);
}

.trash-table .col-name {
  text-align: left;
}

.trash-table .col-date,
.trash-table .col-size {
  text-align: right;
}

.trash-table th.sortable {
  cursor: pointer;
  user-select: none;
}

.trash-table th.sortable:hover {
  color: var(--text);
}

.trash-table th.sortable .sort-indicator::after {
  content: '';
  margin-left: 4px;
}

.trash-table th.sortable.active.asc .sort-indicator::after {
  content: '↑';
  color: var(--accent);
}

.trash-table th.sortable.active.desc .sort-indicator::after {
  content: '↓';
  color: var(--accent);
}

.trash-table td.col-type {
  padding: 8px 8px 8px 16px;
}

.trash-table td.col-type .row-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.trash-table .name-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-confirm {
  width: 420px;
}

.modal-confirm .modal-body {
  padding: 20px 24px;
}

.modal-confirm .modal-body p {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  word-break: break-word;
}

.modal-confirm .modal-footer {
  border-top: none;
  padding-top: 0;
}

.modal-footer {
  padding: var(--space-5) var(--space-6);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  position: relative;
  z-index: 2;
  background: linear-gradient(0deg, rgba(20, 23, 30, 0.9), rgba(20, 23, 30, 0.74));
  backdrop-filter: blur(18px) saturate(145%);
  -webkit-backdrop-filter: blur(18px) saturate(145%);
}

.modal-footer::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: -24px;
  height: 24px;
  pointer-events: none;
  background: linear-gradient(0deg, rgba(8, 10, 16, 0.28), transparent);
}

.modal-open {
  overflow: hidden;
}

.modal-body input.input {
  width: 100%;
  height: 40px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--panel-elevated);
  padding: 0 var(--space-4);
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.modal-body input.input:focus {
  border-color: var(--border-strong);
  outline: none;
  box-shadow: 0 0 0 3px rgba(52, 123, 191, .15);
}

.modal-body textarea.input {
  width: 100%;
  min-height: 88px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--panel-elevated);
  padding: var(--space-3) var(--space-4);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.modal-body textarea.input:focus {
  border-color: var(--border-strong);
  outline: none;
  box-shadow: 0 0 0 3px rgba(52, 123, 191, .15);
}

.icon-btn.ghost {
  border: 1px solid var(--border);
  background: var(--panel-elevated);
  border-radius: var(--radius-sm);
  width: 36px;
  height: 32px;
  padding: 0;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.icon-btn.ghost:hover {
  background: var(--panel-highlight);
  border-color: var(--border-hover);
  color: var(--text);
}

.icon-btn.ghost.danger:hover {
  background: rgba(185, 28, 28, 0.15);
  border-color: rgba(185, 28, 28, 0.5);
  color: #f08080;
}

@media (max-width: 1200px) {
  .app {
    padding: 36px 24px;
  }
}

@media (max-width: 960px) {
  .app {
    padding: 28px 18px;
  }
}

/* Tablet breakpoint */
@media (max-width: 900px) {
  .toolbar-row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  
  .toolbar-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  
  .toolbar-actions .search-box {
    max-width: none;
    width: 100%;
  }
  
  .toolbar-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
    width: 100%;
  }
  
  .toolbar-buttons .btn,
  .toolbar-buttons .icon-btn {
    justify-content: center;
  }
  
  .toolbar-user {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

/* Mobile breakpoint */
@media (max-width: 640px) {
  .app {
    padding: 18px 12px 32px;
  }
  
  .toolbar-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .toolbar-buttons .btn {
    padding: 10px 14px;
    font-size: 13px;
  }
  
  .toolbar-buttons .icon-btn.ghost {
    padding: 10px 12px;
  }
  
  .toolbar-user {
    width: 100%;
    justify-content: flex-start;
  }
  
}

/* Small mobile */
@media (max-width: 400px) {
  .toolbar-main {
    gap: 6px;
  }
  
  .toolbar-main .btn {
    padding: 8px 10px;
  }
}

@media (max-width: 720px) {
  /* Reset table elements to block-level for mobile */
  .table thead {
    display: none;
  }

  .table-wrap {
    overflow-x: visible;
  }

  .table,
  .table tbody {
    display: block;
    width: 100%;
  }

  .table colgroup {
    display: none;
  }

  /* Card-style rows using CSS Grid */
  .table tbody tr {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto auto;
    align-items: center;
    padding: var(--space-4);
    border-bottom: 1px solid var(--border);
    row-gap: var(--space-3);
    column-gap: var(--space-3);
  }

  .table tbody tr:last-child {
    border-bottom: none;
  }

  /* Reset all td styles */
  .table tbody tr td {
    display: flex;
    align-items: center;
    border: none;
    padding: 0;
    width: auto !important;
    min-width: 0;
    text-align: left !important;
  }

  /* Row 1: Preview | Name | Date */
  .table tbody tr td.col-type {
    grid-column: 1;
    grid-row: 1;
  }

  .table tbody tr td.col-type .folder-type-slot {
    width: 48px;
    height: 48px;
  }

  .table tbody tr td.col-type .folder-type-slot .row-icon {
    font-size: 22px;
    width: 22px;
    height: 22px;
  }

  .table tbody tr td.col-type .file-cover-slot {
    width: 48px;
    height: 48px;
  }

  .table tbody tr td.col-type .file-cover-slot .row-icon {
    font-size: 22px;
    width: 22px;
    height: 22px;
  }

  .table tbody tr td.col-name {
    grid-column: 2;
    grid-row: 1;
    font-size: 14px;
    font-weight: 500;
    overflow: hidden;
  }

  .table tbody tr td.col-name .row-name {
    max-width: 100%;
    min-width: 0;
  }

  .table tbody tr td.col-name .row-name span {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Date - right side of row 1 */
  .table tbody tr td.col-date {
    grid-column: 3;
    grid-row: 1;
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
    justify-content: flex-end;
  }

  /* Size - hidden on mobile (not useful without context) */
  .table tbody tr td.col-size {
    display: none;
  }

  /* Row 2: Actions (full width) */
  .table tbody tr td.col-actions {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .table tbody tr .row-actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .table tbody tr .row-actions .action-btn {
    flex: 1 1 auto;
    min-width: 70px;
    justify-content: center;
    padding: var(--space-2) var(--space-3);
  }

  /* Special rows - load more, empty */
  .table tbody tr.row-load-more,
  .table tbody tr.row-empty {
    display: flex;
    justify-content: center;
  }

  .table tbody tr.row-load-more td,
  .table tbody tr.row-empty td {
    flex: 0 0 100% !important;
  }

  .table tbody tr .load-more-cell,
  .table tbody tr .empty-message {
    width: 100%;
    text-align: center;
  }
}

/* ===================================
   BRANDING MODAL STYLES
   =================================== */

.modal-branding {
  max-width: 760px;
  min-height: min(78vh, 740px);
}

.modal-branding .modal-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-branding .modal-title i {
  color: var(--accent);
}

.modal-branding .modal-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.branding-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.branding-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01));
  min-width: 0;
}

.branding-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0;
}

.hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
  margin-bottom: 0;
}

.branding-section--welcome {
  grid-column: 1 / -1;
}

.branding-section .hint,
.settings-form .hint {
  margin-top: 0;
}

.branding-section--pdf .btn {
  align-self: flex-start;
}

.modal-branding.is-loading .logo-preview,
.modal-branding.is-loading .logo-actions .btn,
.modal-branding.is-loading .branding-section--pdf .btn,
.modal-branding.is-loading .color-picker-wrap,
.modal-branding.is-loading #welcome-text {
  background: linear-gradient(110deg, rgba(255, 255, 255, 0.05) 8%, rgba(255, 255, 255, 0.12) 18%, rgba(255, 255, 255, 0.05) 33%);
  background-size: 220% 100%;
  animation: skeleton-wave 1.4s ease-in-out infinite;
  border-color: rgba(255, 255, 255, 0.08);
  color: transparent !important;
}

.modal-branding.is-loading .logo-preview > *,
.modal-branding.is-loading .logo-actions .btn > *,
.modal-branding.is-loading .branding-section--pdf .btn > *,
.modal-branding.is-loading .color-picker-wrap > * {
  opacity: 0;
}

.modal-branding.is-loading #welcome-text::placeholder {
  color: transparent;
}

/* Logo Upload */
.logo-upload-area {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.logo-preview {
  width: 100%;
  height: 108px;
  background: var(--panel-elevated);
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  overflow: hidden;
  transition: border-color 0.15s;
}

.logo-preview:hover {
  border-color: var(--border-hover);
}

.logo-preview.has-logo {
  border-style: solid;
  border-color: var(--border);
  padding: var(--space-4);
}

.logo-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.logo-preview .placeholder-icon {
  font-size: 36px;
  color: var(--muted);
  opacity: 0.5;
}

.logo-preview .placeholder-text {
  font-size: 13px;
  color: var(--muted);
}

.logo-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.logo-actions .btn {
  flex: 1;
  min-width: 0;
}

/* Color Picker */
.color-picker-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.color-picker-wrap input[type="color"] {
  width: 44px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--panel-elevated);
  transition: border-color 0.15s;
}

.color-picker-wrap input[type="color"]:hover {
  border-color: var(--border-hover);
}

.color-picker-wrap input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 3px;
}

.color-picker-wrap input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 4px;
}

.color-picker-wrap .input {
  flex: 1;
  max-width: 120px;
  font-family: ui-monospace, "SF Mono", monospace;
  text-transform: uppercase;
  font-size: 13px;
}

/* Textarea */
.textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

@media (max-width: 720px) {
  .branding-grid {
    grid-template-columns: 1fr;
  }

  .branding-section--welcome {
    grid-column: auto;
  }
}

/* Branding Button in Actions */
.action-btn.branding {
  color: var(--accent);
}

.action-btn.branding:hover {
  background: rgba(52, 123, 191, 0.1);
}

/* Share Modal */
#shareModal {
  display: none;
}
#shareModal.visible {
  display: flex;
}
.share-modal-content {
  width: 680px;
  min-height: min(72vh, 620px);
}

/* Share Stats */
.share-stats {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
  min-height: 204px;
  display: grid;
  gap: var(--space-4);
}

.share-stats .stats-header {
  margin-bottom: 0;
}

.share-stats .stats-header h3 {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

.stat-card {
  background: var(--bg-light);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  text-align: center;
}

.stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--primary);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.share-stats-placeholder,
.share-stats-content {
  display: grid;
  gap: var(--space-4);
}

.share-stats-placeholder.hidden,
.share-stats-content.hidden {
  display: none;
}

.share-stats-placeholder .stat-card {
  display: grid;
  gap: 12px;
  align-content: center;
}

.share-stats-placeholder .stat-card .skeleton-line {
  margin-inline: auto;
}

.share-stats-placeholder-details {
  display: grid;
  gap: 12px;
}

.share-stats-empty {
  color: var(--text-muted);
  font-size: 0.84rem;
  text-align: center;
  padding: var(--space-3);
}

.stats-details h4 {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  margin: 0 0 var(--space-2);
}

.stats-table {
  width: 100%;
  font-size: 0.8rem;
  border-collapse: collapse;
}

.stats-table th,
.stats-table td {
  padding: var(--space-2);
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.stats-table th {
  font-weight: 500;
  color: var(--text-muted);
}

.stats-table td {
  color: var(--text);
}

.no-stats {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
  padding: var(--space-3);
}

.share-url-row {
  display: flex;
  gap: var(--space-2);
}

.share-url-row input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
  color: var(--text);
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 13px;
}

.share-url-row .btn {
  flex-shrink: 0;
}

.share-settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.share-setting-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0.01));
  min-width: 0;
}

.share-setting-card .form-hint {
  margin-top: 0;
}

.form-hint {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: var(--space-1);
}

#shareModal .form-group {
  margin-bottom: var(--space-5);
}

#shareModal .form-group:last-child {
  margin-bottom: 0;
}

#shareModal label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0;
}

/* Hide default number arrows */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type=number] {
  -moz-appearance: textfield;
}

.number-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.number-input-wrapper input {
  padding-right: 40px !important;
}

.number-input-controls {
  position: absolute;
  right: 1px;
  top: 1px;
  bottom: 1px;
  display: flex;
  flex-direction: column;
  width: 32px;
  border-left: 1px solid var(--border);
  background: var(--panel-elevated);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  overflow: hidden;
}

.num-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  font-size: 10px;
  transition: all 0.15s;
}

.num-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.num-btn:active {
  background: rgba(255, 255, 255, 0.12);
}

.num-btn.up {
  border-bottom: 1px solid var(--border);
}

.num-btn i {
  pointer-events: none;
}

#shareModal input[type="number"],
#shareModal input[type="password"] {
  width: 100%;
  background: var(--panel-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s;
}

#shareModal input[type="number"]:focus,
#shareModal input[type="password"]:focus {
  outline: none;
  border-color: var(--accent);
}

#shareModal input::placeholder {
  color: var(--muted);
}

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

/* ===================================
   ACCOUNT MODAL STYLES
   =================================== */

.account-btn {
  background: linear-gradient(135deg, rgba(52, 123, 191, 0.15), rgba(88, 160, 255, 0.1));
  border: 1px solid var(--accent);
  color: var(--accent-2);
}

.account-btn:hover {
  background: linear-gradient(135deg, rgba(52, 123, 191, 0.25), rgba(88, 160, 255, 0.2));
  color: #fff;
}

.account-btn i {
  font-size: 18px;
}

.modal-account {
  max-width: 688px;
  min-height: min(82vh, 860px);
}

.modal-account .modal-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-account .modal-title i {
  color: var(--accent);
  font-size: 24px;
}

.modal-account .modal-header {
  padding: 20px 24px;
}

.modal-account .modal-body {
  padding: 20px 24px 24px;
  gap: var(--space-3);
  max-height: min(78vh, 820px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.modal-help {
  width: 760px;
  max-width: 95vw;
}

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

.help-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border: 1px solid rgba(52, 123, 191, 0.22);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(52, 123, 191, 0.12), rgba(52, 123, 191, 0.03)),
    var(--panel-elevated);
}

.help-hero-copy {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.help-hero-copy h3 {
  margin: 0;
  font-size: 18px;
}

.help-hero-copy p {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.55;
}

.help-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.help-card {
  display: flex;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: rgba(12, 16, 22, 0.64);
}

.help-card i {
  font-size: 18px;
  color: var(--accent);
  flex-shrink: 0;
  margin-top: 2px;
}

.help-card h4 {
  margin: 0 0 4px;
  font-size: 14px;
}

.help-card p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
}

.tour-overlay {
  position: fixed;
  inset: 0;
  z-index: 10060;
  pointer-events: auto;
}

.tour-overlay.hidden {
  display: none;
}

.tour-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 7, 11, 0.7);
  backdrop-filter: blur(2px);
}

.tour-spotlight {
  position: fixed;
  border-radius: 16px;
  border: 1px solid rgba(88, 160, 255, 0.7);
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.05) inset,
    0 0 0 9999px rgba(4, 7, 11, 0.72),
    0 18px 48px rgba(0, 0, 0, 0.45);
  background: rgba(88, 160, 255, 0.04);
  pointer-events: none;
  transition: top 0.18s ease, left 0.18s ease, width 0.18s ease, height 0.18s ease;
}

.tour-panel {
  position: fixed;
  width: min(360px, calc(100vw - 24px));
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(52, 123, 191, 0.26);
  background:
    linear-gradient(180deg, rgba(17, 23, 32, 0.96), rgba(12, 16, 22, 0.98));
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.03) inset,
    0 24px 60px rgba(0, 0, 0, 0.48);
  color: var(--text);
  pointer-events: auto;
}

.tour-step-count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(52, 123, 191, 0.14);
  color: #a8d2ff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tour-panel h3 {
  margin: 12px 0 8px;
  font-size: 18px;
}

.tour-panel p {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.55;
}

.tour-panel-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
}

.tour-panel-actions-left,
.tour-panel-actions-right {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Loading State */
.account-loading {
  display: grid;
  gap: 14px;
  padding: 0;
  color: var(--muted);
}

.account-loading-label {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.account-skeleton {
  display: grid;
  gap: 18px;
}

.account-skeleton-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 20px 22px;
  background: linear-gradient(135deg, rgba(52, 123, 191, 0.07) 0%, rgba(88, 160, 255, 0.03) 100%);
  border: 1px solid rgba(52, 123, 191, 0.18);
  border-radius: var(--radius-lg);
}

.account-skeleton-meta,
.account-skeleton-section,
.account-skeleton-usage,
.account-skeleton-form {
  display: grid;
  gap: 12px;
}

.account-skeleton-pills,
.account-skeleton-heading,
.account-skeleton-plan-row,
.account-skeleton-form-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.account-skeleton-section {
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}

.account-skeleton-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.account-skeleton-usage-item {
  display: grid;
  gap: 10px;
}

.skeleton-line,
.skeleton-circle,
.skeleton-pill,
.skeleton-bar,
.skeleton-field {
  display: block;
  background: linear-gradient(110deg, rgba(255, 255, 255, 0.05) 8%, rgba(255, 255, 255, 0.12) 18%, rgba(255, 255, 255, 0.05) 33%);
  background-size: 220% 100%;
  animation: skeleton-wave 1.4s ease-in-out infinite;
}

.skeleton-circle {
  border-radius: 999px;
}

.skeleton-circle--avatar {
  width: 64px;
  height: 64px;
}

.skeleton-line {
  height: 12px;
  border-radius: 999px;
}

.skeleton-line--title {
  width: min(180px, 70%);
  height: 18px;
}

.skeleton-line--body {
  width: min(260px, 82%);
}

.skeleton-line--icon {
  width: 18px;
}

.skeleton-line--heading {
  width: 140px;
}

.skeleton-line--label {
  width: 130px;
}

.skeleton-pill {
  height: 24px;
  width: 72px;
  border-radius: 999px;
}

.skeleton-pill--wide {
  width: 112px;
}

.skeleton-pill--button {
  width: 118px;
  height: 40px;
}

.skeleton-pill--plan {
  width: 92px;
  height: 36px;
}

.skeleton-bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
}

.skeleton-field {
  width: 100%;
  height: 40px;
  border-radius: var(--radius-md);
}

.skeleton-field--compact {
  max-width: 180px;
}

.skeleton-field--textarea {
  height: 88px;
}

@keyframes skeleton-wave {
  0% {
    background-position: 100% 50%;
  }
  100% {
    background-position: -100% 50%;
  }
}

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

.ph-spin {
  animation: spin 1s linear infinite;
}

/* Account Content */
.account-content {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Profile Header Card - New Design */
.profile-header-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  padding: 20px 22px;
  background: linear-gradient(135deg, rgba(52, 123, 191, 0.08) 0%, rgba(88, 160, 255, 0.04) 100%);
  border: 1px solid rgba(52, 123, 191, 0.2);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-3);
}

.profile-avatar-large {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(52, 123, 191, 0.3);
}

.profile-avatar-large i {
  font-size: 32px;
  color: #fff;
}

.profile-avatar-large img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.profile-name-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: 2px;
}

.profile-header-info .profile-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.admin-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-radius: 100px;
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.admin-badge i {
  font-size: 12px;
}

.profile-header-info .profile-email {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.profile-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.meta-divider {
  color: var(--muted);
  font-size: 10px;
}

.member-since {
  font-size: 12px;
  color: var(--muted);
}

/* Sign Out Button */
.signout-btn {
  position: static;
  align-self: start;
  padding: var(--space-2) var(--space-3);
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
  font-size: 12px;
  gap: 6px;
}

.signout-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: #ef4444;
  color: #f87171;
}

.signout-btn i {
  font-size: 14px;
}

.account-section {
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}

.account-section:first-child {
  padding-top: 10px;
}

.account-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.section-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: 12px;
}

.section-header i {
  color: var(--accent);
  font-size: 18px;
}

.section-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text);
}

.section-hint {
  font-size: 12px;
  color: var(--muted);
  margin: -4px 0 12px;
}

.section-inline-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin: 0 0 12px;
}

/* Form Row */
.form-row {
  display: flex;
  gap: var(--space-4);
}

.form-group-wide {
  flex: 1.6;
}

.form-group-compact {
  flex: 1;
  min-width: 220px;
}

.form-group-half {
  flex: 1;
}

/* Profile Card - Legacy (keeping for compatibility) */
.profile-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--panel-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.profile-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.profile-avatar i {
  font-size: 28px;
  color: #fff;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.profile-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-email {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-provider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.provider-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 11px;
  color: var(--text-secondary);
}

.provider-badge i {
  font-size: 12px;
}

.provider-badge.google { border-color: #4285f4; color: #4285f4; }
.provider-badge.github { border-color: #6e5494; color: #a78bfa; }
.provider-badge.apple { border-color: #a2a2a2; color: #a2a2a2; }

.member-since {
  font-size: 11px;
  color: var(--muted);
}

/* Plan Card */
.plan-card {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  min-width: 0;
}

.plan-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  color: #fff;
  text-transform: capitalize;
}

.plan-badge i {
  font-size: 16px;
}

.plan-badge.pro {
  background: linear-gradient(135deg, #8b5cf6, #a78bfa);
}

.plan-badge.team {
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
}

.plan-expires {
  font-size: 12px;
  color: var(--muted);
}

/* Usage Grid */
.usage-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.usage-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(13, 17, 24, 0.64);
}

.usage-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.usage-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 13px;
  color: var(--text);
}

.usage-label i {
  color: var(--muted);
  font-size: 14px;
}

.usage-values {
  font-size: 12px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
}

.usage-bar {
  height: 6px;
  background: var(--panel-elevated);
  border: 1px solid var(--border);
  border-radius: 100px;
  overflow: hidden;
}

.usage-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 100px;
  transition: width 0.4s ease;
}

.usage-fill.warning {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.usage-fill.danger {
  background: linear-gradient(90deg, #ef4444, #f87171);
}

.share-overview {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid rgba(52, 123, 191, 0.22);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(52, 123, 191, 0.12), rgba(52, 123, 191, 0.03)),
    var(--panel-elevated);
}

.share-overview-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: 12px;
}

.share-overview-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
}

.share-overview-title i {
  color: var(--accent);
  font-size: 16px;
}

.share-overview-caption {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}

.share-overview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
}

.share-overview-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(9, 12, 18, 0.45);
}

.share-overview-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.share-overview-label {
  font-size: 12px;
  color: var(--muted);
}

/* Settings Form */
.settings-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-form .form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-form label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.settings-form .input {
  background: var(--panel-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 var(--space-4);
  height: 40px;
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.15s;
}

.settings-form .input:focus {
  outline: none;
  border-color: var(--accent);
}

.settings-form .textarea {
  resize: vertical;
  min-height: 72px;
  height: auto;
  padding: var(--space-3) var(--space-4);
  line-height: 1.5;
  border-radius: var(--radius-md);
}

.modal-account .logo-preview {
  height: 92px;
}

.modal-account .settings-form .input {
  height: 38px;
}

.modal-account .settings-form .textarea {
  min-height: 72px;
}

.modal-account .color-picker-wrap {
  gap: 10px;
}

.modal-account .color-picker-wrap input[type="color"] {
  width: 40px;
  height: 38px;
}

/* Admin badge */
.admin-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: 100px;
  font-size: 10px;
  font-weight: 600;
  color: #f87171;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

@media (max-width: 640px) {
  .title-row {
    align-items: flex-start;
  }

  .modal-account {
    max-width: 100%;
  }

  .modal-help .modal-body {
    padding: 18px;
  }

  .help-hero {
    flex-direction: column;
  }

  .help-hero .btn {
    width: 100%;
    justify-content: center;
  }

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

  .modal-account .modal-body {
    padding: 18px;
    max-height: calc(100vh - 120px);
  }

  .account-skeleton-hero {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .account-skeleton-plan-row,
  .account-skeleton-form-row {
    flex-direction: column;
    align-items: stretch;
  }

  .skeleton-field--compact {
    max-width: none;
  }
  
  .profile-header-card {
    grid-template-columns: 1fr;
    text-align: center;
    justify-items: center;
    padding: 18px;
  }
  
  .profile-avatar-large {
    width: 64px;
    height: 64px;
  }
  
  .profile-avatar-large span {
    font-size: 28px !important;
  }
  
  .profile-header-info .profile-name {
    font-size: 18px;
  }
  
  .profile-meta {
    justify-content: center;
  }

  .profile-header-info {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .signout-btn {
    width: 100%;
    justify-content: center;
  }

  .plan-row {
    flex-direction: column;
    align-items: stretch;
  }

  .usage-grid,
  .share-overview-grid {
    grid-template-columns: 1fr;
  }

  .section-inline-actions {
    justify-content: stretch;
  }

  .section-inline-actions .btn {
    width: 100%;
  }
  
  .signout-btn {
    position: static;
    margin-top: var(--space-3);
    width: 100%;
    justify-content: center;
  }
  
  .profile-card {
    flex-direction: column;
    text-align: center;
  }
  
  .profile-provider {
    justify-content: center;
  }
  
  .plan-card {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .form-row {
    flex-direction: column;
    gap: 0;
  }

  .form-group-compact {
    min-width: 0;
  }

  .section-inline-actions .btn {
    flex: 1 1 180px;
    justify-content: center;
  }

  .share-overview-header {
    flex-direction: column;
  }

  .share-overview-caption {
    text-align: left;
  }

  .share-overview-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .share-settings-grid {
    grid-template-columns: 1fr;
  }
}

/* ===================================
   TOOLBAR ROW
   =================================== */

.toolbar-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.toolbar-user {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

/* ===================================
   OWNER BUTTON
   =================================== */

.owner-btn {
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  border: none;
  color: #1a1a1f;
}

.owner-btn:hover {
  filter: brightness(1.1);
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.3);
}

.owner-btn i {
  font-size: 16px;
}

/* ===================================
   PLAN ROW & UPGRADE
   =================================== */

.plan-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.plan-row .plan-card {
  margin-bottom: 0;
}

.upgrade-btn {
  background: linear-gradient(135deg, #8b5cf6, #a78bfa);
  border: none;
}

.upgrade-btn:hover {
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.3);
}

/* Upgrade Plans Grid */
.upgrade-plans {
  margin-bottom: var(--space-4);
  padding: var(--space-4);
  background: var(--panel-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
}

.plan-option {
  position: relative;
  padding: var(--space-4);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color 0.2s;
}

.plan-option:hover {
  border-color: var(--accent);
}

.plan-option.featured {
  border-color: #8b5cf6;
  background: linear-gradient(180deg, rgba(139, 92, 246, 0.1), transparent);
}

.plan-option-badge {
  position: absolute;
  top: -10px;
  right: 12px;
  padding: 2px 10px;
  background: linear-gradient(135deg, #8b5cf6, #a78bfa);
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
}

.plan-option-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: var(--space-3);
}

.plan-option-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.plan-option-price {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent-2);
}

.plan-option-price small {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}

.plan-features {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-4);
}

.plan-features li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.plan-features li i {
  color: #22c55e;
  font-size: 14px;
}

.select-plan-btn {
  width: 100%;
}

/* ===================================
   OWNER DASHBOARD MODAL
   =================================== */

.modal-owner {
  max-width: 1000px;
  width: 95vw;
  height: 85vh;
  display: flex;
  flex-direction: column;
}

.modal-owner .modal-header {
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

.modal-owner .modal-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-owner .modal-title i {
  color: #f59e0b;
  font-size: 24px;
}

.owner-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Owner Navigation */
.owner-nav {
  width: 200px;
  flex-shrink: 0;
  padding: var(--space-3);
  background: var(--bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.owner-nav::-webkit-scrollbar {
  display: none;
}

.owner-nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}

.owner-nav-item:hover {
  background: var(--panel-elevated);
  color: var(--text);
}

.owner-nav-item.active {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(251, 191, 36, 0.1));
  color: #fbbf24;
}

.owner-nav-item i {
  font-size: 18px;
  width: 20px;
}

/* Owner Content */
.owner-content {
  flex: 1;
  padding: var(--space-5);
  overflow-y: auto;
  min-width: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.owner-content::-webkit-scrollbar {
  display: none;
}

.owner-tab {
  display: none;
}

.owner-tab.active {
  display: block;
}

.owner-tab h3 {
  margin: 0 0 var(--space-5);
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.owner-tab h4 {
  margin: var(--space-5) 0 var(--space-3);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.owner-tab h4:first-of-type {
  margin-top: 0;
}

/* Stats Cards */
.stats-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-4);
}

.stat-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--panel-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.stat-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: var(--radius-sm);
  font-size: 22px;
  color: #fff;
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

/* Revenue Card */
.revenue-card {
  padding: var(--space-5);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(16, 185, 129, 0.05));
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: var(--radius-md);
  text-align: center;
}

.revenue-value {
  display: block;
  font-size: 36px;
  font-weight: 700;
  color: #22c55e;
  line-height: 1;
}

.revenue-breakdown {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-top: var(--space-2);
}

/* Activity List */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.activity-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--panel-elevated);
  border-radius: var(--radius-sm);
}

.activity-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-size: 16px;
}

.activity-text {
  flex: 1;
  font-size: 13px;
  color: var(--text-secondary);
}

.activity-text strong {
  color: var(--text);
}

.activity-time {
  font-size: 11px;
  color: var(--muted);
}

.activity-empty {
  text-align: center;
  padding: var(--space-6);
  color: var(--muted);
}

/* Users Table */
.tab-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
}

.tab-header h3 {
  margin: 0;
}

.tab-actions {
  display: flex;
  gap: var(--space-2);
}

.tab-actions .input {
  width: 200px;
  height: 40px;
  padding: 0 var(--space-4);
  border-radius: var(--radius-md);
  background: var(--panel-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
}

.users-table-wrap {
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.users-table-wrap::-webkit-scrollbar {
  display: none;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
}

.users-table th,
.users-table td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.users-table th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  background: var(--panel-elevated);
}

.users-table td {
  font-size: 13px;
  color: var(--text);
}

.user-cell {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.user-avatar-small {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 12px;
  color: #fff;
}

.user-info-cell {
  min-width: 0;
}

.user-name-cell {
  font-weight: 500;
}

.user-email-cell {
  font-size: 11px;
  color: var(--muted);
}

.user-plan-badge {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
}

.user-plan-badge.free {
  background: var(--panel-elevated);
  color: var(--muted);
}

.user-plan-badge.pro {
  background: rgba(139, 92, 246, 0.2);
  color: #a78bfa;
}

.user-plan-badge.team {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

.pagination {
  display: flex;
  justify-content: center;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

/* Plans Config */
.plans-config {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.plan-config-card {
  padding: var(--space-4);
  background: var(--panel-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.plan-config-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
}

.plan-config-header h4 {
  margin: 0;
  font-size: 16px;
}

.price-input {
  width: 80px;
  height: 36px;
  text-align: right;
  font-weight: 600;
  padding: 0 var(--space-3);
  border-radius: var(--radius-md);
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
}

.plan-config-limits {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.limit-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
}

.limit-row label {
  font-size: 12px;
  color: var(--text-secondary);
}

.limit-row .input {
  width: 100px;
  height: 36px;
  text-align: right;
  padding: 0 var(--space-3);
  font-size: 13px;
  border-radius: var(--radius-md);
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
}

/* Billing */
.billing-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.billing-card {
  padding: var(--space-4);
  background: var(--panel-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.billing-card h4 {
  margin: 0 0 var(--space-2);
  font-size: 12px;
  color: var(--muted);
}

.billing-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
}

.billing-status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 13px;
}

.billing-status i {
  font-size: 10px;
}

.billing-status.connected {
  color: #22c55e;
}

.billing-status.disconnected {
  color: #ef4444;
}

.transactions-list {
  margin-bottom: var(--space-5);
}

.transactions-empty {
  text-align: center;
  padding: var(--space-6);
  color: var(--muted);
  background: var(--panel-elevated);
  border-radius: var(--radius-md);
}

.stripe-config {
  padding: var(--space-4);
  background: var(--panel-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.stripe-config .form-group {
  margin-bottom: var(--space-4);
}

.stripe-config .form-group:last-of-type {
  margin-bottom: var(--space-3);
}

.stripe-config .input {
  height: 40px;
  padding: 0 var(--space-4);
  border-radius: var(--radius-md);
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  width: 100%;
}

.stripe-config label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: var(--space-2);
}

/* Infrastructure */
.infra-status {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
}

.infra-card {
  padding: var(--space-4);
  background: var(--panel-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.infra-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
}

.infra-header i {
  color: var(--accent);
  font-size: 20px;
}

.infra-header h4 {
  margin: 0;
  font-size: 14px;
}

.infra-metric {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-2) 0;
}

.infra-value {
  font-weight: 600;
  color: var(--text);
}

.infra-label {
  font-size: 12px;
  color: var(--muted);
}

.infra-cost {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}

.cost-label {
  font-size: 12px;
  color: var(--muted);
}

.cost-value {
  font-weight: 600;
  color: #22c55e;
}

.total-cost-card {
  margin-top: var(--space-5);
  padding: var(--space-5);
  background: linear-gradient(135deg, rgba(52, 123, 191, 0.1), rgba(88, 160, 255, 0.05));
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  text-align: center;
}

.total-cost-card h4 {
  margin: 0 0 var(--space-2);
  color: var(--text);
}

.total-cost {
  display: block;
  font-size: 32px;
  font-weight: 700;
  color: var(--accent-2);
}

.cost-note {
  margin-top: var(--space-2);
  font-size: 12px;
  color: var(--muted);
}

/* Settings Sections */
.settings-section {
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--border);
}

.settings-section:last-of-type {
  margin-bottom: var(--space-4);
  padding-bottom: 0;
  border-bottom: none;
}

.settings-section h4 {
  margin: 0 0 var(--space-4);
}

.settings-section .input {
  height: 40px;
  padding: 0 var(--space-4);
  border-radius: var(--radius-md);
  background: var(--panel-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  width: 100%;
}

.settings-section .input:focus {
  outline: none;
  border-color: var(--accent);
}

.settings-section .textarea {
  height: auto;
  min-height: 80px;
  padding: var(--space-3) var(--space-4);
  resize: vertical;
}

.settings-section label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: var(--space-2);
}

.settings-section .form-group {
  margin-bottom: var(--space-4);
}

.settings-section .hint {
  margin-top: var(--space-1);
  margin-bottom: 0;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

/* Responsive Owner Modal */
@media (max-width: 768px) {
  .modal-owner {
    height: 95vh;
  }
  
  .owner-layout {
    flex-direction: column;
  }
  
  .owner-nav {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: var(--space-2);
  }
  
  .owner-nav-item {
    padding: var(--space-2) var(--space-3);
    white-space: nowrap;
  }
  
  .owner-nav-item span {
    display: none !important;
  }
  
  .owner-nav-item i {
    margin: 0;
  }
  
  .stats-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Branding Dropzone */
.dropzone-small {
    border: 2px dashed transparent;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    padding: var(--space-2);
    margin: calc(var(--space-2) * -1);
}

.dropzone-small.dragover {
    border-color: var(--accent);
    background: rgba(52, 123, 191, 0.08);
}

.dropzone-small .logo-preview {
    pointer-events: none;
}

/* Trash Header Layout */
#trash-modal .modal-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: var(--space-4);
    align-items: center;
}

.trash-search-box {
    margin: 0 auto;
    width: 100%;
    max-width: 400px;
    height: 40px;
    background: var(--panel-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0 var(--space-4);
    display: flex;
    align-items: center;
}

.trash-search-box input {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    height: auto;
}

.header-left {
    display: flex;
    align-items: center;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.btn.small {
    height: 32px;
    padding: 0 var(--space-3);
    font-size: 12px;
}

/* ===================================
   LOGIN SCREEN STYLES
   =================================== */

.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-6);
    background: var(--bg);
}

.login-screen.hidden {
    display: none;
}

.app.hidden {
    display: none !important;
}

.login-container {
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-6);
}

.login-logo img {
    height: 56px;
    opacity: 0.9;
}

.login-card {
    width: 100%;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    box-shadow: var(--shadow-2);
    text-align: center;
}

.login-card h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: var(--space-2);
    color: var(--text);
}

.login-subtitle {
    color: var(--muted);
    font-size: 14px;
    margin-bottom: var(--space-6);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    width: 100%;
    padding: var(--space-4);
    background: #fff;
    border: 1px solid var(--border);
    color: #1f1f1f;
    font-weight: 500;
}

.btn-google:hover {
    background: #f8f8f8;
    border-color: var(--border-strong);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.login-divider {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    color: var(--muted);
    font-size: 12px;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.email-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.email-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.email-form .input {
    width: 100%;
    padding: var(--space-4);
    background: var(--panel-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text);
    font-size: 15px;
    text-align: center;
}

.email-form .input:focus {
    outline: none;
    border-color: var(--accent);
}

.email-form .btn {
    width: 100%;
    padding: var(--space-4);
}

.login-pin-entry .input {
    width: 100%;
    max-width: 220px;
    padding: var(--space-4);
    background: var(--panel-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text);
    font-size: 20px;
    text-align: center;
    letter-spacing: 0.2em;
}

.login-pin-entry .input:focus {
    outline: none;
    border-color: var(--accent);
}

.login-pin-entry .btn {
    width: 100%;
    max-width: 220px;
}

.login-check-email {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4) 0;
}

.login-check-email.hidden {
    display: none;
}

.check-email-icon {
    font-size: 48px;
}

.login-check-email h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.login-check-email p {
    color: var(--muted);
    font-size: 14px;
    margin: 0;
}

.login-check-email strong {
    color: var(--text);
}

.login-error {
    margin-top: var(--space-4);
    padding: var(--space-3) var(--space-4);
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-sm);
    color: #f87171;
    font-size: 13px;
}

.login-error.hidden {
    display: none;
}

.login-footer {
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

.login-footer a {
    color: var(--text-secondary);
    text-decoration: none;
}

.login-footer a:hover {
    color: var(--accent);
    text-decoration: underline;
}

@media (max-width: 480px) {
    .login-screen {
        padding: var(--space-4);
    }
    
    .login-card {
        padding: var(--space-6);
    }
    
    .login-card h1 {
        font-size: 20px;
    }
}

/* Контекстное меню (обложки, PDF) */
.app-context-menu {
    position: fixed;
    z-index: 10050;
    min-width: 220px;
    padding: 6px 0;
    background: var(--panel-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow-2);
}

.app-context-menu.hidden {
    display: none !important;
}

.app-context-menu-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 14px;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
}

.app-context-menu-item:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.06);
}

.app-context-menu-item.danger {
    color: #f87171;
}

.app-context-menu-item:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
