/* =====================================================================
   Gestor NAS — Liquid Glass / iOS 26 design system
   Dark mode by default. SF Pro via -apple-system. Safe-area aware.
   ===================================================================== */

:root {
  /* Surfaces */
  --bg: #06070d;
  --bg-2: #0a0c16;
  --glass: rgba(255, 255, 255, 0.072);
  --glass-2: rgba(255, 255, 255, 0.045);
  --glass-strong: rgba(16, 18, 30, 0.62);
  --glass-border: rgba(255, 255, 255, 0.14);
  --glass-border-soft: rgba(255, 255, 255, 0.09);
  --hairline: rgba(255, 255, 255, 0.08);
  --highlight: inset 0 1px 0 rgba(255, 255, 255, 0.18);
  --highlight-strong: inset 0 1px 0 rgba(255, 255, 255, 0.28);

  /* Type */
  --text: #f3f5fb;
  --text-2: #c7cde0;
  --muted: #8a91ad;

  /* Accent (iOS blue family, vivid gradient) */
  --accent: #4d8cff;
  --accent-2: #7b6bff;
  --accent-grad: linear-gradient(135deg, #5b9bff 0%, #6d7bff 100%);
  --accent-soft: rgba(77, 140, 255, 0.18);
  --danger: #ff5d62;
  --danger-grad: linear-gradient(135deg, #ff6b6f 0%, #ff4d6d 100%);
  --ok: #34d27b;

  /* Tint colors for filetype squares */
  --t-blue: #4d8cff;
  --t-green: #34c759;
  --t-purple: #af7bff;
  --t-pink: #ff5fa2;
  --t-red: #ff5d52;
  --t-teal: #2bd4c4;
  --t-gray: #9aa3bd;

  /* Geometry */
  --radius: 20px;
  --radius-lg: 24px;
  --radius-sm: 14px;
  --radius-row: 16px;

  /* Motion */
  --ease-ios: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Safe areas */
  --sat: env(safe-area-inset-top);
  --sab: env(safe-area-inset-bottom);
  --sal: env(safe-area-inset-left);
  --sar: env(safe-area-inset-right);

  --tabbar-h: 60px;
  --sidebar-w: 260px;
}

* { box-sizing: border-box; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 99px; border: 3px solid transparent; background-clip: padding-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body {
  -webkit-touch-callout: none;
  overflow-x: hidden;
}

/* Aurora background — deep near-black with slow-drifting blooms. */
body::before {
  content: "";
  position: fixed;
  inset: -25%;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(46% 38% at 18% 8%, rgba(64, 110, 255, 0.30), transparent 62%),
    radial-gradient(42% 40% at 88% 14%, rgba(150, 90, 255, 0.26), transparent 60%),
    radial-gradient(50% 44% at 60% 100%, rgba(36, 200, 190, 0.16), transparent 62%);
  filter: saturate(125%);
  animation: bgdrift 32s ease-in-out infinite alternate;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(120% 90% at 50% 0%, transparent 55%, rgba(0,0,0,0.45) 100%);
}
@keyframes bgdrift {
  from { transform: translate3d(-2.5%, -1.5%, 0) scale(1); }
  to   { transform: translate3d(2.5%, 2.5%, 0) scale(1.1); }
}

h1, h2, h3 { letter-spacing: -0.02em; margin: 0; }

/* ===== Glass material ===== */
.glass {
  position: relative;
  background: var(--glass);
  border: 1px solid var(--glass-border-soft);
  backdrop-filter: blur(34px) saturate(180%);
  -webkit-backdrop-filter: blur(34px) saturate(180%);
  border-radius: var(--radius);
  box-shadow:
    0 18px 40px -18px rgba(0, 0, 0, 0.65),
    0 2px 10px -6px rgba(60, 90, 200, 0.35),
    var(--highlight);
}

/* ===== Form controls ===== */
button, input, textarea, select { font: inherit; }
input, textarea, select { font-size: 16px; } /* prevent iOS zoom */

input, textarea {
  width: 100%;
  padding: 13px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border-soft);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  transition: border-color .25s var(--ease-ios), box-shadow .25s var(--ease-ios), background .25s var(--ease-ios);
}
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, textarea:focus {
  outline: none;
  border-color: rgba(77, 140, 255, 0.7);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 16px;
  min-height: 44px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border-soft);
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  color: var(--text);
  font-weight: 590;
  font-size: 0.96rem;
  letter-spacing: -0.01em;
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--highlight);
  transition: transform .2s var(--ease-spring), filter .2s var(--ease-ios), background .2s var(--ease-ios);
}
.btn svg { flex: 0 0 auto; }
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: scale(0.97); }

.btn.primary {
  border: 0;
  color: #fff;
  background: var(--accent-grad);
  box-shadow: 0 12px 26px -12px rgba(77, 110, 255, 0.85), var(--highlight-strong);
}
.btn.danger {
  color: #ffd9da;
  background: rgba(255, 93, 98, 0.16);
  border-color: rgba(255, 93, 98, 0.32);
}
.btn.danger:hover { background: rgba(255, 93, 98, 0.24); }
.btn.block { width: 100%; }
.btn[disabled] { opacity: 0.5; pointer-events: none; }

/* Icon-only round button (44x44). */
.iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--glass-border-soft);
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--highlight);
  transition: transform .2s var(--ease-spring), filter .2s var(--ease-ios), background .2s var(--ease-ios);
}
.iconbtn:hover { filter: brightness(1.15); }
.iconbtn:active { transform: scale(0.92); }
.iconbtn.primary { border: 0; color: #fff; background: var(--accent-grad); box-shadow: 0 10px 22px -12px rgba(77,110,255,0.9), var(--highlight-strong); }
.iconbtn.danger { color: #ffc9cb; background: rgba(255, 93, 98, 0.16); border-color: rgba(255,93,98,0.3); }

/* Compact icon action used inside rows/cards (mini). */
.btn.mini {
  min-height: 36px;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 11px;
  font-size: 0.9em;
  color: var(--text-2);
}
.btn.mini svg { width: 19px; height: 19px; }
.btn.mini.danger { color: #ff9a9d; }

/* ===== Pills / chips ===== */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--glass-border-soft);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-2);
  font-size: 0.85rem;
  font-weight: 560;
}
.pill svg { width: 16px; height: 16px; }
.pill.accent { color: #cfe0ff; background: var(--accent-soft); border-color: rgba(77,140,255,0.3); }

/* ===== Filetype tinted square ===== */
.ficon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: 12px;
  color: #fff;
  box-shadow: var(--highlight), 0 6px 14px -8px rgba(0,0,0,0.6);
}
.ficon svg { width: 22px; height: 22px; }
.tint-blue   { background: linear-gradient(150deg, #5c9bff, #3a72f0); box-shadow: 0 8px 16px -10px rgba(58,114,240,0.9), var(--highlight); }
.tint-green  { background: linear-gradient(150deg, #4fd267, #2aa84a); box-shadow: 0 8px 16px -10px rgba(42,168,74,0.9), var(--highlight); }
.tint-purple { background: linear-gradient(150deg, #bd8bff, #8b5cf6); box-shadow: 0 8px 16px -10px rgba(139,92,246,0.9), var(--highlight); }
.tint-pink   { background: linear-gradient(150deg, #ff7ab3, #ff478f); box-shadow: 0 8px 16px -10px rgba(255,71,143,0.9), var(--highlight); }
.tint-red    { background: linear-gradient(150deg, #ff726a, #ff453a); box-shadow: 0 8px 16px -10px rgba(255,69,58,0.9), var(--highlight); }
.tint-teal   { background: linear-gradient(150deg, #41e0d0, #16b8aa); box-shadow: 0 8px 16px -10px rgba(22,184,170,0.9), var(--highlight); }
.tint-gray   { background: linear-gradient(150deg, #aab2c8, #7d8499); box-shadow: 0 8px 16px -10px rgba(125,132,153,0.8), var(--highlight); }

.muted { color: var(--muted); font-size: 0.86em; }

/* ===== Large-title sticky frosted header ===== */
.lt-header {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: calc(-1 * (16px + var(--sat))) calc(-16px - var(--sar)) 14px calc(-16px - var(--sal));
  padding: calc(14px + var(--sat)) calc(16px + var(--sar)) 12px calc(16px + var(--sal));
  display: flex;
  align-items: flex-end;
  gap: 12px;
  background: linear-gradient(180deg, rgba(8,9,16,0.82), rgba(8,9,16,0.42));
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border-bottom: 1px solid var(--hairline);
}
.lt-title {
  font-size: 33px;
  font-weight: 760;
  letter-spacing: -0.025em;
  line-height: 1.05;
  flex: 1;
  min-width: 0;
}
.lt-actions { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; }

/* ===== Grouped inset list ===== */
.inset-list {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}
.inset-group-title {
  font-size: 0.78rem;
  font-weight: 640;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 4px 6px 8px;
}

/* .row is the list-row primitive used across browser/search/transfers. */
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  min-height: 56px;
  position: relative;
}
.inset-list .row::after {
  content: "";
  position: absolute;
  left: 66px;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--hairline);
}
.inset-list .row:last-child::after { display: none; }
.row .name {
  flex: 1;
  min-width: 0;
  font-weight: 530;
  font-size: 1rem;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row:hover { background: rgba(255, 255, 255, 0.035); }
.row:active { background: rgba(255, 255, 255, 0.06); }

/* Trailing meta (size · date) stacked, right-aligned. */
.row-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  flex: 0 0 auto;
  text-align: right;
}
.row-meta .muted { font-size: 0.78rem; }
.row-chevron { color: var(--muted); display: inline-flex; flex: 0 0 auto; opacity: 0.7; }
.row-chevron svg { width: 18px; height: 18px; }

/* ===== Selection check (circular, animated) ===== */
.selcheck {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  margin: 0;
  border-radius: 50%;
  border: 2px solid var(--glass-border);
  background: rgba(255,255,255,0.04);
  cursor: pointer;
  position: relative;
  transition: transform .2s var(--ease-spring), background .2s var(--ease-ios), border-color .2s var(--ease-ios);
}
.selcheck::after {
  content: "";
  position: absolute;
  left: 7px; top: 3px;
  width: 6px; height: 11px;
  border: solid #fff;
  border-width: 0 2.4px 2.4px 0;
  transform: rotate(45deg) scale(0);
  transition: transform .2s var(--ease-spring);
}
.selcheck:checked {
  background: var(--accent-grad);
  border-color: transparent;
}
.selcheck:checked::after { transform: rotate(45deg) scale(1); }
.selcheck:active { transform: scale(0.88); }

/* ===== Shell: sidebar + content + tab bar ===== */
.app.shell {
  min-height: 100vh;
  min-height: 100dvh;
}
.content {
  padding:
    calc(16px + var(--sat))
    calc(16px + var(--sar))
    calc(var(--tabbar-h) + 18px + var(--sab))
    calc(16px + var(--sal));
}
.view { display: block; }

/* Sidebar (desktop only) */
.sidebar { display: none; }
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 16px; }
.sidebar-logo, .brand-mark {
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #fff;
  background: var(--accent-grad);
  box-shadow: 0 8px 18px -8px rgba(77, 110, 255, 0.8), var(--highlight-strong);
}
.sidebar-logo { width: 38px; height: 38px; border-radius: 12px; font-size: 1.1rem; }
.sidebar-title { font-weight: 700; font-size: 1.08rem; letter-spacing: -0.02em; }
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }

/* Nav items (shared by sidebar + tab bar) */
.navitem {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 46px;
  padding: 10px 13px;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 13px;
  cursor: pointer;
  width: 100%;
  font-size: 1rem;
  font-weight: 560;
  text-align: left;
  transition: transform .2s var(--ease-spring), color .2s var(--ease-ios), background .2s var(--ease-ios);
}
.navitem-icon { display: inline-flex; line-height: 0; }
.navitem-icon svg { width: 23px; height: 23px; }
.navitem:active { transform: scale(0.96); }
.navitem .navitem-icon-filled { display: none; }
.sidebar-nav .navitem .navitem-icon-filled { display: none !important; }
.sidebar-nav .navitem .navitem-icon-line { display: inline-flex; }
.sidebar-nav .navitem.active {
  color: var(--text);
  background: var(--accent-soft);
  box-shadow: var(--highlight);
}
.sidebar-nav .navitem.active .navitem-icon { color: var(--accent); }

/* Tab bar (mobile) */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  padding: 7px calc(8px + var(--sar)) calc(7px + var(--sab)) calc(8px + var(--sal));
  border-radius: 0;
  border: 0;
  border-top: 1px solid var(--glass-border-soft);
  background: var(--glass-strong);
  backdrop-filter: blur(34px) saturate(180%);
  -webkit-backdrop-filter: blur(34px) saturate(180%);
  box-shadow: 0 -8px 24px -16px rgba(0,0,0,0.7);
}
.tabbar .navitem {
  flex-direction: column;
  gap: 3px;
  min-width: 44px;
  min-height: 48px;
  padding: 5px 8px;
  justify-content: center;
  text-align: center;
  border-radius: 14px;
}
.tabbar .navitem-icon svg { width: 26px; height: 26px; }
.tabbar .navitem-label { font-size: 0.64rem; font-weight: 620; letter-spacing: 0; }
.tabbar .navitem.active { color: var(--accent); }
.tabbar .navitem.active .navitem-icon { transform: translateY(-1px); }
.tabbar .navitem.active .navitem-icon-line { display: none; }
.tabbar .navitem.active .navitem-icon-filled { display: inline-flex; }

/* ===== Desktop (>=900px) ===== */
@media (min-width: 900px) {
  .tabbar { display: none; }
  .app.shell {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  }
  .sidebar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: sticky;
    top: calc(16px + var(--sat));
    align-self: start;
    margin: calc(16px + var(--sat)) 0 16px calc(16px + var(--sal));
    padding: 18px 14px;
    height: calc(100dvh - 32px - var(--sat));
    border-radius: var(--radius-lg);
  }
  .content {
    padding:
      calc(18px + var(--sat))
      calc(28px + var(--sar))
      28px 28px;
  }
  .view { max-width: 1120px; margin: 0 auto; }
  .lt-header {
    margin: calc(-1 * (18px + var(--sat))) -28px 18px -28px;
    padding-left: 28px; padding-right: 28px;
  }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}

/* ===== Segmented control (pill track + sliding accent segment) ===== */
.toolbar { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.toolbar-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.segmented {
  display: inline-flex;
  position: relative;
  padding: 3px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border-soft);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.25);
  flex: 0 0 auto;
}
.segmented .seg {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 590;
  border-radius: 9px;
  cursor: pointer;
  transition: color .2s var(--ease-ios), transform .15s var(--ease-spring);
}
.segmented .seg svg { width: 19px; height: 19px; }
.segmented .seg:active { transform: scale(0.95); }
.segmented .seg.active {
  color: #fff;
  background: var(--accent-grad);
  box-shadow: 0 6px 14px -8px rgba(77,110,255,0.8), var(--highlight);
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-wrap: wrap;
  padding: 2px 0;
}
.crumb {
  color: var(--text-2);
  text-decoration: none;
  font-weight: 560;
  font-size: 0.92rem;
  padding: 4px 9px;
  border-radius: 9px;
  transition: background .2s var(--ease-ios), color .2s var(--ease-ios);
}
.crumb:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.crumb:last-child { color: var(--text); }
.crumb-sep { color: var(--muted); display: inline-flex; opacity: 0.5; }
.crumb-sep svg { width: 16px; height: 16px; }

/* ===== Grid cards ===== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.card {
  position: relative;
  padding: 18px 12px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  min-height: 158px;
  border-radius: var(--radius);
  transition: transform .2s var(--ease-spring), background .2s var(--ease-ios);
}
.card:hover { background: rgba(255,255,255,0.05); transform: translateY(-2px); }
.card:active { transform: scale(0.98); }
.card-check { position: absolute; top: 10px; left: 10px; }
.card .ficon { width: 56px; height: 56px; border-radius: 16px; margin-top: 6px; }
.card .ficon svg { width: 30px; height: 30px; }
.card-name {
  width: 100%;
  font-size: 0.9rem;
  font-weight: 540;
  letter-spacing: -0.01em;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  cursor: pointer;
}
.card-meta { font-size: 0.78rem; }
.card-actions { margin-top: auto; display: flex; gap: 5px; opacity: 0; transition: opacity .2s var(--ease-ios); }
.card:hover .card-actions, .card:focus-within .card-actions { opacity: 1; }
@media (hover: none) { .card-actions { opacity: 1; } }

.item-actions { display: inline-flex; gap: 5px; align-items: center; }

/* ===== Floating action bar (multi-select) ===== */
.actionbar {
  position: fixed;
  left: 14px; right: 14px;
  bottom: calc(var(--tabbar-h) + 16px + var(--sab));
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px 10px 18px;
  z-index: 45;
  border-radius: var(--radius);
  animation: rise .3s var(--ease-ios) both;
}
.actionbar .ab-count { font-weight: 620; font-size: 0.92rem; }
@media (min-width: 900px) {
  .actionbar {
    left: auto; right: 28px;
    width: min(560px, calc(100vw - var(--sidebar-w) - 56px));
    bottom: calc(24px + var(--sab));
  }
}

/* ===== Empty / message states ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 48px 24px;
  text-align: center;
}
.empty-state .ficon { width: 64px; height: 64px; border-radius: 20px; opacity: 0.85; }
.empty-state .ficon svg { width: 34px; height: 34px; }
.empty-state-title { font-weight: 620; font-size: 1.05rem; }
.empty-state .muted { font-size: 0.92rem; }

/* ===== Dropzone ===== */
.dropzone { position: relative; border-radius: var(--radius); }
.dropzone.dragover { outline: 2px dashed var(--accent); outline-offset: 5px; }
.dropzone-hint {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 5;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  border-radius: var(--radius);
  font-weight: 640;
  color: var(--text);
  pointer-events: none;
}
.dropzone.dragover .dropzone-hint { display: flex; }

/* ===== Transfers panel ===== */
.transfers {
  position: fixed;
  z-index: 48;
  right: 14px;
  bottom: calc(var(--tabbar-h) + 24px + var(--sab));
  width: min(370px, calc(100vw - 28px));
  max-height: 52vh;
  display: flex;
  flex-direction: column;
  padding: 14px 14px 12px;
  gap: 10px;
  border-radius: var(--radius);
  animation: rise .3s var(--ease-ios) both;
}
@media (min-width: 900px) { .transfers { bottom: calc(24px + var(--sab)); } }
.transfers.hidden { display: none; }
.tr-head { display: flex; align-items: center; gap: 9px; }
.tr-head strong { font-size: 1rem; font-weight: 640; letter-spacing: -0.01em; }
.tr-total { font-size: 0.76rem; }
.tr-list { overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-right: 2px; }
.tr-item { display: flex; flex-direction: column; gap: 7px; }
.tr-row { display: flex; align-items: center; gap: 9px; }
.tr-arrow { flex: 0 0 auto; display: inline-flex; color: var(--accent); }
.tr-arrow svg { width: 18px; height: 18px; }
.tr-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.92rem;
  font-weight: 530;
}
.tr-state { flex: 0 0 auto; font-size: 0.76rem; }
.tr-bar { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.tr-fill { height: 100%; background: var(--accent-grad); border-radius: 99px; transition: width .25s var(--ease-ios); }
.tr-fill.tr-done { background: var(--ok); }
.tr-fill.tr-error { background: var(--danger); }
.tr-fill.tr-cancelled { background: var(--muted); }

@media (max-width: 560px) {
  .transfers { left: 10px; right: 10px; width: auto; bottom: calc(var(--tabbar-h) + 22px + var(--sab)); }
}

/* ===== Modals (viewer/editor) ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(16px + var(--sat)) 16px calc(16px + var(--sab));
  background: rgba(4, 6, 14, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity .25s var(--ease-ios);
}
.modal-overlay.open { opacity: 1; }
.modal {
  width: min(960px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 14px;
  gap: 12px;
  border-radius: var(--radius-lg);
  transform: translateY(28px) scale(0.97);
  transition: transform .34s var(--ease-ios);
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }
.modal-head { display: flex; align-items: center; gap: 9px; }
.modal-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1.05rem;
  font-weight: 640;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 9px;
}
.modal-title .ficon { width: 30px; height: 30px; border-radius: 9px; }
.modal-title .ficon svg { width: 17px; height: 17px; }
.modal-title-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-head a.btn, .modal-head a.iconbtn { display: inline-flex; align-items: center; }

.viewer-body {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.3);
}
.viewer-img { max-width: 100%; max-height: 78vh; object-fit: contain; border-radius: 10px; }
.viewer-video { max-width: 100%; max-height: 78vh; border-radius: 10px; background: #000; }
.viewer-pdf { width: 100%; height: 78vh; border: 0; border-radius: 10px; background: #fff; }
.viewer-audio { display: flex; flex-direction: column; gap: 14px; padding: 28px; align-items: center; }
.viewer-audio-name { font-weight: 620; }
.viewer-msg { padding: 32px; text-align: center; color: var(--muted); line-height: 1.7; }
.viewer-msg a.btn { text-decoration: none; margin-top: 12px; display: inline-flex; }

.viewer-props { padding: 6px 8px 8px; }
.viewer-props.hidden, .editor-status:empty { display: none; }
.props { display: flex; flex-direction: column; gap: 2px; }
.props-row { display: flex; gap: 12px; padding: 9px 4px; border-bottom: 1px solid var(--hairline); }
.props-row:last-child { border-bottom: 0; }
.props-row .muted { flex: 0 0 116px; font-size: 0.86rem; }
.mono, .props-row .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.editor-body { flex: 1; min-height: 0; display: flex; }
.editor-area {
  flex: 1;
  width: 100%;
  min-height: 52vh;
  resize: none;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border-soft);
  background: rgba(0, 0, 0, 0.32);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9rem;
  line-height: 1.55;
  tab-size: 2;
}
.editor-status { font-size: 0.82rem; font-weight: 560; }
.editor-status.ok { color: var(--ok); }
.editor-status.err { color: var(--danger); }

@media (max-width: 560px) {
  .modal { width: 100%; max-height: 100%; }
  .viewer-img, .viewer-video { max-height: 66vh; }
  .viewer-pdf { height: 66vh; }
  .props-row { flex-direction: column; gap: 1px; }
  .props-row .muted { flex: none; }
}

/* ===== Search ===== */
.search-wrap { display: flex; flex-direction: column; gap: 14px; }
.search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 16px;
  border-radius: 999px;
}
.search-icon { display: inline-flex; color: var(--muted); flex: 0 0 auto; }
.search-icon svg { width: 21px; height: 21px; }
.search-field input {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 12px 0;
  box-shadow: none;
  min-height: 46px;
  font-weight: 530;
}
.search-field input:focus { box-shadow: none; background: transparent; }
.search-field input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search-notice { min-height: 1em; padding: 0 6px; font-size: 0.82rem; }
.search-notice:empty { display: none; }
.search-state { padding: 22px 8px; text-align: center; }

.search-row { align-items: center; cursor: pointer; }
.search-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.search-row-main .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 540; }
.search-row-path { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.78rem; }
.search-row-meta { flex: 0 0 auto; text-align: right; font-size: 0.78rem; }
.search-row .row-chevron { margin-left: 2px; }
@media (max-width: 560px) { .search-row-meta { display: none; } }

/* ===== Onboarding / Login ===== */
.onboard {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    calc(28px + var(--sat))
    calc(20px + var(--sar))
    calc(28px + var(--sab))
    calc(20px + var(--sal));
}
.onboard-card {
  width: min(440px, 100%);
  padding: 30px 24px 26px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-radius: var(--radius-lg);
  animation: rise .5s var(--ease-ios) both;
}
.onboard-head { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; }
.brand-mark {
  width: 72px;
  height: 72px;
  border-radius: 22px;
  font-size: 0;
  animation: pop .55s var(--ease-spring) both;
}
.brand-mark svg { width: 38px; height: 38px; }
.onboard-title { font-size: 26px; font-weight: 740; letter-spacing: -0.025em; }
.onboard-sub { color: var(--muted); font-size: 0.95rem; line-height: 1.5; max-width: 36ch; }

/* Grouped inset fields (iOS form) */
.field-group {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--glass-border-soft);
}
.field-group .field { position: relative; }
.field-group .field + .field::before {
  content: "";
  position: absolute;
  left: 15px; right: 0; top: 0;
  height: 1px;
  background: var(--hairline);
}
.field-group input {
  border: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  padding: 15px;
}
.field-group input:focus { box-shadow: none; background: rgba(255,255,255,0.05); }

.check-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 2px 4px;
  font-size: 0.92rem;
  color: var(--text-2);
  cursor: pointer;
}
/* iOS-style toggle */
.switch { position: relative; flex: 0 0 auto; width: 50px; height: 30px; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch-track {
  position: absolute; inset: 0; border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  transition: background .25s var(--ease-ios);
}
.switch-track::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
  transition: transform .25s var(--ease-spring);
}
.switch input:checked + .switch-track { background: var(--ok); }
.switch input:checked + .switch-track::after { transform: translateX(20px); }

.form-msg { font-size: 0.86rem; color: var(--muted); min-height: 1.1em; text-align: center; }
.form-msg.err { color: var(--danger); }
.form-msg.ok { color: var(--ok); }
.form-msg:empty { display: none; }

.settings-actions { display: flex; gap: 10px; }
.settings-actions .btn { flex: 1; }

/* ===== Entrance animations ===== */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { 0% { opacity: 0; transform: scale(0.6); } 100% { opacity: 1; transform: scale(1); } }
@keyframes stagger { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.view > *:not(.lt-header) { animation: rise .34s var(--ease-ios) both; }

/* Staggered row/card entrance (index-based delay, capped). */
.stagger {
  animation: stagger .42s var(--ease-ios) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    animation-delay: 0ms !important;
  }
  body::before { animation: none; }
}
