/* -----------------------------------------------------------
   Jobee Drive — design tokens
   ----------------------------------------------------------- */

:root {
  /* canvas */
  --bg:           #F7F6FB;
  --bg-soft:      #F1EEF7;
  --panel:        #FFFFFF;

  /* surfaces */
  --border:       #E5E1EE;
  --border-soft:  #EFECF5;
  --hover:        #F4F1FA;
  --shadow-sm:    0 1px 2px rgb(28 22 49 / 0.04);
  --shadow-md:    0 4px 14px -2px rgb(28 22 49 / 0.07), 0 1px 4px rgb(28 22 49 / 0.04);
  --shadow-lg:    0 24px 48px -12px rgb(28 22 49 / 0.20), 0 8px 16px -8px rgb(28 22 49 / 0.08);

  /* ink */
  --text:         #1C1631;
  --text-soft:    #3F3656;
  --muted:        #75708A;
  --muted-soft:   #A8A3BB;

  /* accent (jobee.bg primary purple #8163B7) */
  --accent:       #8163B7;
  --accent-hi:    #6B4FA0;
  --accent-tint:  #EFEAF7;
  --accent-fg:    #FFFFFF;

  /* secondary (jobee bee honey-yellow #ffb72f) — used sparingly */
  --honey:        #FFB72F;
  --honey-hi:     #E89F12;
  --honey-tint:   #FFF3D2;

  /* semantic */
  --danger:       #E01010;
  --danger-tint:  #FCE4E4;
  --success:      #2E8540;
  --success-tint: #DCF2DF;
  --info:         #00B1F1;
  --info-tint:    #D6F1FB;

  /* type */
  --font-sans:    "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono:    "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* geometry */
  --r-sm:         6px;
  --r-md:         10px;
  --r-lg:         14px;
  --r-xl:         20px;
  --r-full:       9999px;

  /* layout */
  --sidebar-w:    248px;
  --topbar-h:     60px;
}

@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url('https://fonts.bunny.net/geist/files/geist-latin-wght-normal.woff2') format('woff2-variations');
}
@font-face {
  font-family: 'Geist Mono';
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url('https://fonts.bunny.net/geist-mono/files/geist-mono-latin-wght-normal.woff2') format('woff2-variations');
}

/* -----------------------------------------------------------
   Reset & base
   ----------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14.5px;
  line-height: 1.5;
  letter-spacing: -0.005em;
  font-feature-settings: "ss01", "cv11";
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; transition: color 120ms ease; }
a:hover { color: var(--accent); }

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

::selection { background: var(--accent-tint); color: var(--accent-hi); }

/* -----------------------------------------------------------
   App layout — sidebar + main
   ----------------------------------------------------------- */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 24px;
}
.sidebar-brand img { height: 28px; width: auto; }
.sidebar-brand .word {
  font-weight: 600;
  font-size: 15.5px;
  letter-spacing: -0.01em;
}

.sidebar-section {
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
  padding: 14px 12px 8px;
}

.sidebar-search { padding: 0 4px 8px; }
.sidebar-search input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  border-radius: var(--r-md);
  font-size: 13px;
  color: var(--text);
}
.sidebar-search input::placeholder { color: var(--muted-soft); }
.sidebar-search input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--panel);
  box-shadow: 0 0 0 3px var(--accent-tint);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r-md);
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 500;
  transition: background 120ms ease, color 120ms ease;
}
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.active { background: var(--accent-tint); color: var(--accent-hi); }
.nav-item.active svg { color: var(--accent); }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--muted); }
.nav-item.active:hover { background: var(--accent-tint); }

.sidebar-spacer { flex: 1; }

.storage-card {
  margin: 12px 4px 4px;
  padding: 12px 14px;
  background: linear-gradient(135deg, var(--accent-tint) 0%, var(--honey-tint) 100%);
  border: 1px solid #DDD0EE;
  border-radius: var(--r-md);
}
.storage-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent-hi);
  text-transform: uppercase;
}
.storage-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.storage-bar {
  margin-top: 8px;
  height: 5px;
  background: rgba(255, 255, 255, 0.55);
  border-radius: var(--r-full);
  overflow: hidden;
}
.storage-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-hi));
  border-radius: inherit;
  transition: width 200ms ease;
}
.storage-bar-fill.is-warn { background: linear-gradient(90deg, var(--honey-hi), #B45309); }
.storage-bar-fill.is-full { background: linear-gradient(90deg, var(--danger), #7F1D1D); }
.storage-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.sidebar-foot {
  padding: 12px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 32px; height: 32px;
  border-radius: var(--r-full);
  background: linear-gradient(135deg, var(--accent), var(--accent-hi));
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600;
  font-size: 12px;
}
.sidebar-foot .who { flex: 1; min-width: 0; }
.sidebar-foot .who strong { font-size: 13px; font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-foot .who span { font-size: 11px; color: var(--muted); }

/* main column */
.main {
  min-width: 0;
  padding: 32px 40px 64px;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-title {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.page-sub {
  color: var(--muted);
  font-size: 13.5px;
  margin-top: 4px;
}

/* -----------------------------------------------------------
   Panels & cards
   ----------------------------------------------------------- */

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
}
.panel-pad-sm { padding: 16px; }
.panel-tight  { padding: 14px 18px; }

/* -----------------------------------------------------------
   Buttons
   ----------------------------------------------------------- */

.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  padding: 8px 14px;
  font-size: 13.5px;
  font-weight: 500;
  border-radius: var(--r-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 120ms ease, border-color 120ms ease, transform 80ms ease, color 120ms ease;
  text-decoration: none;
}
.btn:hover { background: var(--hover); border-color: #DCDAD2; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 15px; height: 15px; }

.btn-primary {
  background: var(--text);
  color: white;
  border-color: var(--text);
}
.btn-primary:hover { background: #27272A; border-color: #27272A; color: white; }

.btn-accent {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
}
.btn-accent:hover { background: var(--accent-hi); border-color: var(--accent-hi); color: white; }

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

.btn-danger {
  color: var(--danger);
  background: transparent;
  border-color: transparent;
}
.btn-danger:hover { background: var(--danger-tint); border-color: var(--danger-tint); }

.btn-sm {
  padding: 5px 10px;
  font-size: 12.5px;
}

.btn-icon {
  padding: 7px;
  width: 32px; height: 32px;
  justify-content: center;
}

/* -----------------------------------------------------------
   Forms
   ----------------------------------------------------------- */

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-soft);
  margin-bottom: 6px;
  letter-spacing: -0.005em;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 14px;
  color: var(--text);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--text);
  box-shadow: 0 0 0 3px rgb(20 20 23 / 0.06);
}
.field input::placeholder { color: var(--muted-soft); }

.input-inline {
  padding: 7px 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 13.5px;
  color: var(--text);
}
.input-inline:focus {
  outline: none;
  border-color: var(--text);
  box-shadow: 0 0 0 3px rgb(20 20 23 / 0.06);
}

/* -----------------------------------------------------------
   Alerts
   ----------------------------------------------------------- */

.alert {
  padding: 12px 14px;
  border-radius: var(--r-md);
  margin-bottom: 16px;
  font-size: 13.5px;
  border: 1px solid transparent;
}
.alert-error { background: var(--danger-tint); color: var(--danger); border-color: rgb(239 68 68 / 0.18); }
.alert-ok    { background: var(--success-tint); color: var(--success); border-color: rgb(34 197 94 / 0.18); }

/* -----------------------------------------------------------
   Drive — toolbar, breadcrumb, dropzone, file rows
   ----------------------------------------------------------- */

.crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
}
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--text); }
.crumbs strong { color: var(--text); font-weight: 600; }
.crumbs .sep { color: var(--muted-soft); font-size: 11px; }

.toolbar {
  display: flex; gap: 8px; align-items: center;
  margin-bottom: 16px;
}
.toolbar .spacer { flex: 1; }

.dropzone {
  position: relative;
  border: 1.5px dashed var(--border);
  border-radius: var(--r-lg);
  background: var(--panel);
  padding: 32px 24px;
  text-align: center;
  transition: border-color 150ms ease, background 150ms ease;
  margin-bottom: 20px;
  cursor: pointer;
}
.dropzone:hover { border-color: var(--accent); background: #FBF9FF; }
.dropzone.is-over { border-color: var(--accent); background: var(--accent-tint); }
.dropzone .dz-title {
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 4px;
}
.dropzone .dz-sub {
  font-size: 12.5px;
  color: var(--muted);
}
.dropzone .dz-icon {
  width: 36px; height: 36px;
  margin: 0 auto 10px;
  color: var(--muted);
}
.dropzone .dz-actions {
  display: inline-flex;
  gap: 8px;
  margin-top: 12px;
}

/* file/folder list */
.list { display: flex; flex-direction: column; }
.list-head {
  display: grid;
  grid-template-columns: 36px 1fr 100px 140px 140px;
  gap: 12px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 10px 14px 8px;
  border-bottom: 1px solid var(--border-soft);
}
.row {
  display: grid;
  grid-template-columns: 36px 1fr 100px 140px 140px;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: var(--r-md);
  transition: background 120ms ease;
}
.row.is-selected { background: var(--accent-tint); }
.check-cell { display: flex; align-items: center; justify-content: center; }
.check-cell input[type="checkbox"] {
  width: 16px; height: 16px;
  cursor: pointer;
  accent-color: var(--accent);
  opacity: 0;
  transition: opacity 100ms ease;
}
.row:hover .check-cell input[type="checkbox"],
.row.is-selected .check-cell input[type="checkbox"],
.list-head .check-cell input[type="checkbox"] { opacity: 1; }
.select-all-cb { accent-color: var(--accent); cursor: pointer; }
.row:hover { background: var(--hover); }
.row + .row { border-top: 1px solid var(--border-soft); }
.row .name {
  display: flex; align-items: center; gap: 12px;
  min-width: 0;
}
.row .name a, .row .name span.fname {
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row .name a.fname-link { cursor: pointer; }
.row .name a.fname-link:hover { color: var(--accent); }

/* star button */
.star-btn {
  color: var(--muted-soft) !important;
  font-size: 16px !important;
  line-height: 1;
  padding: 5px 8px !important;
  min-width: 28px;
  transition: color 120ms ease, transform 80ms ease;
}
.star-btn:hover { color: var(--honey-hi) !important; transform: scale(1.05); }
.star-btn.is-on { color: var(--honey-hi) !important; }
.star.is-on { color: var(--honey-hi); font-size: 16px; }
.row .icon {
  width: 32px; height: 32px;
  flex-shrink: 0;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-soft);
}
.row .icon.folder { background: var(--accent-tint); color: var(--accent); }
.row .icon.file   { background: var(--bg-soft); color: var(--muted); }
.row .icon svg { width: 18px; height: 18px; }
.row .meta { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.row .actions { display: flex; gap: 6px; justify-content: flex-end; }
.row .actions form { display: inline-flex; }

/* file-type icon palette by kind (used in both list & grid views) */
.icon.k-image    { background: #ECFDF5; color: #047857; }
.icon.k-video    { background: #FEF2F2; color: #B91C1C; }
.icon.k-audio    { background: #F5F3FF; color: #6D28D9; }
.icon.k-pdf      { background: #FEF2F2; color: #B91C1C; }
.icon.k-doc      { background: #EFF6FF; color: #1D4ED8; }
.icon.k-sheet    { background: #ECFDF5; color: #047857; }
.icon.k-slides   { background: #FFF7ED; color: #C2410C; }
.icon.k-archive  { background: var(--honey-tint); color: var(--honey-hi); }
.icon.k-code     { background: #F1F5F9; color: #334155; }
.icon.k-text     { background: var(--bg-soft); color: var(--text-soft); }
.icon.k-file     { background: var(--bg-soft); color: var(--muted); }
.icon.k-folder   { background: var(--accent-tint); color: var(--accent-hi); }

/* grid view */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}
.tile {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
  position: relative;
}
.tile:hover {
  border-color: #DCDAD2;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.tile .thumb {
  aspect-ratio: 4 / 3;
  background: var(--bg-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.tile .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--bg-soft);
}
.tile .thumb .big-icon {
  width: 44px; height: 44px;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
}
.tile .thumb .big-icon svg { width: 22px; height: 22px; }

.tile a.tile-link {
  display: flex;
  flex-direction: column;
  flex: 1;
  color: inherit;
}

.tile .meta-bar {
  padding: 10px 12px 12px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.tile .meta-bar .info { flex: 1; min-width: 0; }
.tile .meta-bar .info .name {
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.tile .meta-bar .info .sub {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
}

.tile-check {
  position: absolute;
  top: 8px; left: 8px;
  z-index: 2;
  width: 24px; height: 24px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: var(--r-sm);
  border: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 100ms ease;
}
.tile:hover .tile-check,
.tile.is-selected .tile-check { opacity: 1; }
.tile-check input { width: 14px; height: 14px; accent-color: var(--accent); cursor: pointer; margin: 0; }
.tile.is-selected { outline: 2px solid var(--accent); outline-offset: -1px; }

.tile-menu {
  position: absolute;
  top: 8px; right: 8px;
  opacity: 0;
  transition: opacity 120ms ease;
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(4px);
  border-radius: var(--r-md);
  padding: 4px;
  border: 1px solid var(--border-soft);
}
.tile:hover .tile-menu, .tile-menu:focus-within { opacity: 1; }
.tile-menu button, .tile-menu form button {
  width: 26px; height: 26px;
  padding: 0;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
}
.tile-menu button:hover { background: var(--hover); color: var(--text); }
.tile-menu .danger:hover { background: var(--danger-tint); color: var(--danger); }
.tile-menu svg { width: 14px; height: 14px; }

/* sort menu */
.sort-menu summary::-webkit-details-marker { display: none; }
.sort-pop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 180px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  padding: 6px;
  z-index: 20;
  display: flex;
  flex-direction: column;
}
.sort-pop a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--text);
}
.sort-pop a:hover { background: var(--hover); color: var(--text); }
.sort-pop a.active { background: var(--accent-tint); color: var(--accent-hi); font-weight: 600; }

/* view switcher */
.view-toggle {
  display: inline-flex;
  background: var(--bg-soft);
  border-radius: var(--r-md);
  padding: 3px;
  gap: 2px;
}
.view-toggle button {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 5px 9px;
  border-radius: 7px;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.view-toggle button:hover { color: var(--text); }
.view-toggle button.active {
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.view-toggle svg { width: 14px; height: 14px; }

.empty {
  text-align: center;
  padding: 64px 24px;
  color: var(--muted);
}
.empty svg { width: 48px; height: 48px; color: var(--muted-soft); margin-bottom: 12px; }
.empty .empty-title { font-size: 16px; color: var(--text-soft); font-weight: 500; margin-bottom: 4px; }
.empty .empty-sub   { font-size: 13.5px; color: var(--muted); }

/* upload queue */
.queue { margin-bottom: 16px; }
.queue-row {
  display: flex; align-items: center; gap: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 16px;
  margin-bottom: 8px;
}
.queue-row .info { flex: 1; min-width: 0; }
.queue-row .info .name { font-weight: 500; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-row .info .name .size { color: var(--muted); font-weight: 400; }
.queue-row .info .name .rel-path { color: var(--muted); font-weight: 400; }
.queue-row .bar-wrap {
  margin-top: 6px;
  background: var(--bg-soft);
  border-radius: var(--r-full);
  height: 5px;
  overflow: hidden;
}
.queue-row .bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-hi));
  border-radius: inherit;
  width: 0%;
  transition: width 140ms ease;
}
.queue-row .status { font-size: 12px; color: var(--muted); margin-top: 6px; }
.queue-row .pct { min-width: 44px; font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--muted); text-align: right; }

/* -----------------------------------------------------------
   Login & share auth — centered card
   ----------------------------------------------------------- */

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(120% 80% at 50% 0%, var(--bg-soft) 0%, var(--bg) 60%);
}
.auth-card {
  width: 100%; max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 32px;
  box-shadow: var(--shadow-lg);
}
.auth-card .brand {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 24px;
}
.auth-card .brand img { height: 32px; }
.auth-card .brand .name { font-size: 14px; color: var(--muted); }
.auth-card h1 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}
.auth-card .lede {
  color: var(--muted);
  font-size: 13.5px;
  margin-bottom: 24px;
}

/* -----------------------------------------------------------
   Shares list table
   ----------------------------------------------------------- */

.shares-table {
  width: 100%;
  border-collapse: collapse;
}
.shares-table th {
  font-weight: 600;
  font-size: 11.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-soft);
}
.shares-table td {
  padding: 14px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
  font-size: 14px;
}
.shares-table tr:last-child td { border-bottom: none; }
.shares-table code {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-soft);
  background: var(--bg-soft);
  padding: 3px 8px;
  border-radius: var(--r-sm);
}

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--r-full);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.pill::before {
  content: "";
  display: block; width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.pill-ok       { color: var(--success); background: var(--success-tint); }
.pill-revoked  { color: var(--muted); background: var(--bg-soft); }
.pill-expired  { color: var(--muted); background: var(--bg-soft); }
.pill-file     { color: var(--info); background: var(--info-tint); }
.pill-folder   { color: var(--accent-hi); background: var(--accent-tint); }

/* -----------------------------------------------------------
   Admin users
   ----------------------------------------------------------- */

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto auto;
  gap: 10px;
  align-items: end;
}
.admin-grid .field { margin: 0; }

/* -----------------------------------------------------------
   Public share landing
   ----------------------------------------------------------- */

.public-topbar {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex; align-items: center; gap: 12px;
}
.public-topbar img { height: 28px; }
.public-topbar .spacer { flex: 1; }
.public-topbar .badge {
  font-size: 11.5px;
  color: var(--muted);
  padding: 4px 10px;
  background: var(--bg-soft);
  border-radius: var(--r-full);
}

.public-container {
  max-width: 720px;
  margin: 48px auto;
  padding: 0 24px;
}
.public-hero {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 56px 32px;
  text-align: center;
  box-shadow: var(--shadow-md);
}
.public-hero .file-icon {
  width: 64px; height: 64px;
  margin: 0 auto 20px;
  background: var(--accent-tint);
  color: var(--accent-hi);
  border-radius: var(--r-lg);
  display: flex; align-items: center; justify-content: center;
}
.public-hero .file-icon svg { width: 30px; height: 30px; }
.public-hero h2 {
  font-size: 22px; font-weight: 600;
  letter-spacing: -0.015em;
  margin-bottom: 4px;
  word-break: break-word;
}
.public-hero .public-meta { color: var(--muted); font-size: 13.5px; margin-bottom: 28px; }

.public-folder-header {
  display: flex; align-items: center; gap: 16px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--border-soft);
}
.public-folder-header .file-icon { margin: 0; width: 48px; height: 48px; }
.public-folder-header h2 { font-size: 18px; font-weight: 600; flex: 1; min-width: 0; }
.public-folder-list { padding: 8px; }
.public-folder-list .row { grid-template-columns: 1fr 100px auto; }

/* -----------------------------------------------------------
   Modal
   ----------------------------------------------------------- */

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgb(20 20 23 / 0.40);
  backdrop-filter: blur(2px);
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-backdrop.open { display: flex; }
.modal {
  width: 100%; max-width: 460px;
  background: var(--panel);
  border-radius: var(--r-xl);
  padding: 28px;
  box-shadow: var(--shadow-lg);
  animation: modal-pop 180ms cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes modal-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal h3 {
  font-size: 17px; font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}
.modal .modal-sub { color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.modal-actions {
  display: flex; gap: 8px; justify-content: flex-end;
  margin-top: 12px;
}
.modal-link {
  display: flex; gap: 8px; align-items: center;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  padding: 8px 12px;
  margin-top: 8px;
}

.move-picker {
  margin-top: 14px;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  overflow: hidden;
}
.move-crumbs {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--muted);
  border-bottom: 1px solid var(--border-soft);
  background: var(--panel);
  flex-wrap: wrap;
}
.move-crumbs a { color: var(--muted); }
.move-crumbs a:hover { color: var(--text); }
.move-crumbs strong { color: var(--text); }
.move-crumbs .sep { font-size: 10px; color: var(--muted-soft); }
.move-list {
  max-height: 280px;
  overflow-y: auto;
  background: var(--panel);
}
.move-list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
  transition: background 100ms ease;
}
.move-list-item:hover { background: var(--hover); }
.move-list-item:last-child { border-bottom: none; }
.move-list-item .icon {
  width: 28px; height: 28px;
  background: var(--accent-tint);
  color: var(--accent-hi);
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
}
.move-list-item .icon svg { width: 16px; height: 16px; }
.move-empty { padding: 20px 14px; text-align: center; color: var(--muted); font-size: 13px; }

.versions-list {
  margin: 14px 0 8px;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  max-height: 360px;
  overflow-y: auto;
}
.versions-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-soft);
}
.versions-row:last-child { border-bottom: none; }
.versions-row.is-current { background: var(--accent-tint); }
.versions-row .info { flex: 1; min-width: 0; }
.versions-row .info strong { font-size: 13.5px; }
.versions-row .info .sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.versions-row .actions { display: flex; gap: 6px; }

.share-tabs {
  display: flex;
  gap: 4px;
  margin: 14px 0 18px;
  border-bottom: 1px solid var(--border);
}
.share-tab {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 9px 14px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 100ms ease, border-color 100ms ease;
}
.share-tab:hover { color: var(--text); }
.share-tab.active { color: var(--accent-hi); border-bottom-color: var(--accent); }
.modal-link code {
  flex: 1; min-width: 0;
  font-family: var(--font-mono);
  font-size: 12.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* floating bulk-action bar */
.bulk-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: var(--text);
  color: white;
  padding: 10px 16px;
  border-radius: var(--r-lg);
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-lg);
  z-index: 30;
  transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1);
}
.bulk-bar.open { transform: translateX(-50%) translateY(0); }
.bulk-count { font-weight: 600; font-size: 13.5px; }
.bulk-actions { display: flex; gap: 6px; }
.bulk-actions .btn {
  background: rgba(255, 255, 255, 0.10);
  color: white;
  border-color: rgba(255, 255, 255, 0.18);
}
.bulk-actions .btn:hover { background: rgba(255, 255, 255, 0.18); border-color: rgba(255, 255, 255, 0.30); color: white; }
.bulk-actions .btn-danger { color: #FCA5A5; }
.bulk-actions .btn-danger:hover { background: rgba(239, 68, 68, 0.25); border-color: rgba(239, 68, 68, 0.4); color: white; }
.bulk-actions .btn-ghost { background: transparent; border-color: transparent; color: rgba(255, 255, 255, 0.7); }
.bulk-actions .btn-ghost:hover { color: white; background: rgba(255, 255, 255, 0.08); border-color: transparent; }

/* When master select-all-cb checkbox is checked, force all row checkboxes visible. */
.list-head .check-cell input[type="checkbox"]:checked ~ * { opacity: 1; }

/* (mobile rules consolidated at the bottom of the file) */

/* preview modal — fullscreen-ish viewer */
.preview-backdrop { padding: 0; }
.preview-shell {
  position: relative;
  width: 100%;
  max-width: 1100px;
  height: calc(100vh - 64px);
  background: var(--panel);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  margin: 32px;
  overflow: hidden;
}

/* Floating close button — always pinned to top-right of the shell, on top of
   everything (image, video etc.). Solves the iOS Safari case where the inline
   button in preview-head could be pushed off-screen by a long title. */
.preview-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 15;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(20, 20, 35, 0.7);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: background 120ms ease, transform 80ms ease;
}
.preview-close:hover  { background: rgba(20, 20, 35, 0.9); }
.preview-close:active { transform: scale(0.94); }
.preview-close svg    { width: 20px; height: 20px; }
.preview-head {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 64px 14px 20px;   /* right padding leaves room for floating close button */
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.preview-title {
  font-weight: 600;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
}
.preview-meta {
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
}
.preview-actions { display: flex; gap: 8px; }
.preview-body {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1a1424;
  overflow: auto;
}
.preview-body img,
.preview-body video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.preview-body embed,
.preview-body iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}
.preview-text {
  align-self: stretch;
  margin: 0;
  padding: 20px 24px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  background: #fbfaf6;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  overflow: auto;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
}
.preview-loading,
.preview-text-loading {
  color: var(--muted-soft);
  font-size: 13px;
}
.preview-audio {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 40px;
}
.preview-audio .audio-art {
  width: 160px; height: 160px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-hi));
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 80px;
}
.preview-audio audio { width: 360px; }
.preview-fallback {
  text-align: center;
  padding: 60px 30px;
  color: var(--bg-soft);
}
.preview-fallback h3 { color: white; margin-bottom: 8px; font-size: 18px; }
.preview-fallback p { color: var(--muted-soft); }
.preview-fallback-icon {
  width: 80px; height: 80px;
  margin: 0 auto 20px;
  border-radius: var(--r-lg);
  background: var(--panel);
  display: flex; align-items: center; justify-content: center;
  font-size: 36px;
}

/* tiny utilities */
.muted    { color: var(--muted); }
.row-flex { display: flex; align-items: center; gap: 12px; }
.gap-sm   { gap: 6px; }
.no-margin { margin: 0; }
.mt-md    { margin-top: 16px; }
.mt-lg    { margin-top: 24px; }

/* -----------------------------------------------------------
   Mobile topbar + hamburger (hidden on desktop)
   ----------------------------------------------------------- */
.mobile-topbar { display: none; }
.sidebar-backdrop { display: none; }

@media (max-width: 900px) {
  .mobile-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    padding: 10px 14px;
    position: sticky;
    top: 0;
    z-index: 25;
  }
  .mobile-topbar .hamburger {
    width: 38px; height: 38px;
    border: 1px solid var(--border);
    background: var(--panel);
    border-radius: var(--r-md);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    color: var(--text);
    padding: 0;
  }
  .mobile-topbar .hamburger svg { width: 20px; height: 20px; }
  .mobile-topbar .mobile-brand {
    display: flex; align-items: center; gap: 8px;
    color: var(--text);
    font-weight: 600;
    font-size: 15px;
    text-decoration: none;
  }
  .mobile-topbar .mobile-brand img { height: 26px; }

  /* App becomes single column; sidebar is a slide-out drawer */
  .app { grid-template-columns: 1fr; }

  .sidebar {
    position: fixed;
    top: 0; bottom: 0; left: 0;
    width: 280px;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1);
    height: 100vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    flex-direction: column;
  }
  .sidebar.is-open { transform: translateX(0); }

  .sidebar-backdrop {
    position: fixed; inset: 0;
    background: rgba(20, 20, 35, 0.45);
    backdrop-filter: blur(2px);
    z-index: 45;
    display: none;
    opacity: 0;
    transition: opacity 200ms ease;
  }
  .sidebar-backdrop.is-open { display: block; opacity: 1; }

  /* Main area: tighter padding, leave space below for floating bar */
  .main { padding: 16px 14px 100px; max-width: 100%; }

  /* Page header stacks vertically */
  .page-header {
    align-items: flex-start;
    gap: 10px;
  }
  .page-title { font-size: 22px; }
  .page-sub { font-size: 12.5px; }
  .page-header .row-flex { width: 100%; }

  /* List rows: 3 columns (checkbox / name / actions); hide size+date */
  .list-head, .row {
    grid-template-columns: 30px 1fr auto !important;
    column-gap: 8px;
  }
  .list-head .meta-h, .row .meta { display: none; }
  .actions { gap: 3px; }
  .actions .btn-sm { padding: 5px 8px; font-size: 12px; }

  /* Grid tiles: tighter */
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }

  /* Always show checkboxes on touch (no hover) */
  .row .check-cell input[type="checkbox"] { opacity: 0.7; }
  .tile-check { opacity: 0.7; }

  /* Modals: bottom-sheet style on phones */
  .modal-backdrop:not(.preview-backdrop) {
    padding: 12px;
    align-items: flex-end;
  }
  .modal {
    max-width: 100%;
    padding: 20px;
    max-height: 90vh;
    overflow-y: auto;
  }

  /* Preview modal: fullscreen on phones */
  .preview-shell {
    margin: 0;
    border-radius: 0;
    height: 100vh;
    max-width: 100%;
  }
  .preview-head { padding: 10px 56px 10px 14px; gap: 10px; }
  .preview-title { font-size: 14px; }
  .preview-meta { display: none; }
  .preview-close { top: 8px; right: 8px; width: 38px; height: 38px; }

  /* Floating bulk bar — full width on phone */
  .bulk-bar {
    bottom: 12px;
    left: 12px;
    right: 12px;
    transform: translateY(150%);
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
  }
  .bulk-bar.open { transform: translateY(0); }
  .bulk-actions { gap: 4px; flex: 1; flex-wrap: wrap; justify-content: flex-end; }
  .bulk-count { font-size: 12.5px; }

  /* Dropzone: tighter */
  .dropzone { padding: 22px 14px; }
  .dropzone .dz-actions { flex-wrap: wrap; }

  /* Tables: horizontal scroll */
  .shares-table { display: block; overflow-x: auto; white-space: nowrap; max-width: 100%; }
  .shares-table thead, .shares-table tbody, .shares-table tr { display: table; min-width: 100%; }
  .shares-table code { max-width: 180px; display: inline-block; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }

  /* Admin form grid → stacked */
  .admin-grid { grid-template-columns: 1fr; gap: 8px; }
  .admin-grid .field { width: 100%; }

  /* Toolbar + page-header row-flex containers wrap */
  .toolbar { flex-wrap: wrap; }
  .row-flex { flex-wrap: wrap; }

  /* Sort menu pop: align right when near edge */
  .sort-pop { right: 0; left: auto; }

  /* Auth pages */
  .auth-shell { padding: 16px; }
  .auth-card { padding: 24px; }

  /* Public share page */
  .public-folder-header { flex-wrap: wrap; padding: 16px; }
  .public-hero { padding: 32px 20px; }
  .public-container { margin: 24px auto; padding: 0 16px; }
}

/* Phones in portrait: even tighter */
@media (max-width: 480px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .list-head, .row {
    padding: 10px 8px;
    font-size: 13px;
  }
  /* Hide rename + move (✎ →) buttons on very small screens — accessible via long-press in v3 */
  .row .actions .btn-sm[title="Преименувай"],
  .row .actions .btn-sm[title="Премести"],
  .row .actions .btn-sm[title="Версии"] { display: none; }
  .public-folder-header h2 { font-size: 16px; }
  .modal { padding: 18px; }
  .auth-card { padding: 20px; border-radius: var(--r-md); }
}
