/* FileGator-inspired UI (Bulma/Buefy look) — primary #34B891 */
@font-face {
  font-family: "Font Awesome 5 Free";
  font-style: normal;
  font-weight: 900;
  src: url("../fonts/fa-solid-900.woff2") format("woff2"),
       url("../fonts/fa-solid-900.woff") format("woff");
}
@font-face {
  font-family: "Font Awesome 5 Free";
  font-style: normal;
  font-weight: 400;
  src: url("../fonts/fa-regular-400.woff2") format("woff2"),
       url("../fonts/fa-regular-400.woff") format("woff");
}

:root {
  --fg-primary: #48a8d8;
  --fg-primary-dark: #2f7fad;
  --fg-primary-soft: rgba(72, 168, 216, 0.14);
  --fg-accent: #fca830;
  --fg-accent-dark: #e08a14;
  --fg-ink: #1a2a36;
  --fg-muted: #6b7c88;
  --fg-line: #d5e0e8;
  --fg-bg: #fff;
  --fg-soft: #f3f8fb;
  --fg-danger: #e11d48;
  --fg-link: #2f7fad;
  --font: "Vazirmatn", BlinkMacSystemFont, -apple-system, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--fg-ink);
  background: var(--fg-bg);
  line-height: 1.5;
  font-size: 16px;
}
a { color: var(--fg-link); text-decoration: none; }
a:hover { color: var(--fg-primary-dark); }
button, input, select, textarea { font: inherit; color: inherit; }

.fa, .fas {
  font-family: "Font Awesome 5 Free";
  font-weight: 900;
  font-style: normal;
  display: inline-block;
  width: 1.15em;
  text-align: center;
}
.far { font-family: "Font Awesome 5 Free"; font-weight: 400; font-style: normal; }

/* ——— Top navbar (FileGator Menu.vue) ——— */
.fg-navbar {
  background: #fff;
  border-bottom: 1px solid var(--fg-line);
  padding: 0.55rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 40;
}
.fg-navbar .logo img {
  display: block;
  height: 2.75rem;
  width: auto;
  max-width: 200px;
}
.fg-nav-end {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1.1rem;
  flex: 1 1 auto;
  justify-content: flex-end;
  margin-inline-end: 0.25rem;
}
.fg-nav-end a,
.fg-nav-end button.linkish {
  color: var(--fg-ink);
  font-weight: 500;
  background: none;
  border: 0;
  padding: 0.35rem 0;
  cursor: pointer;
}
.fg-nav-end a:hover,
.fg-nav-end button.linkish:hover,
.fg-nav-end a.is-active {
  color: var(--fg-primary);
}
.fg-nav-aside {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 0 0 auto;
  order: 3;
}
.fg-burger {
  display: none;
  background: none;
  border: 0;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--fg-ink);
}

/* Profile chip + usage ring + dropdown */
.user-menu { position: relative; }
.user-chip {
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  border-radius: 50%;
}
.user-chip:focus-visible {
  outline: 2px solid var(--fg-primary);
  outline-offset: 2px;
}
.user-ring {
  --pct: 0;
  --ring: var(--fg-primary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  padding: 2.5px;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--ring) calc(var(--pct) * 1%), #e6e8eb 0);
  box-sizing: border-box;
}
.user-ring.is-ok { --ring: var(--fg-primary); }
.user-ring.is-warn { --ring: #f2a93b; }
.user-ring.is-critical { --ring: var(--fg-danger); }
.user-ring.is-lg {
  width: 48px;
  height: 48px;
  padding: 3px;
}
.user-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #48a8d8;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  letter-spacing: 0.02em;
  box-shadow: inset 0 0 0 2px #fff;
  overflow: hidden;
  padding: 0;
}
.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
}
.user-ring.is-lg .user-avatar { font-size: 0.95rem; }

.user-menu-panel {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: min(300px, calc(100vw - 20px));
  background: #fff;
  border: 1px solid var(--fg-line);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(10, 10, 10, 0.14);
  z-index: 50;
  overflow: hidden;
  padding: 0.35rem 0;
}
.user-menu.open .user-menu-panel { display: block; }
.user-menu-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem 0.75rem;
}
.user-menu-id {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}
.user-menu-id strong {
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-menu-id .muted {
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role-pill {
  align-self: flex-start;
  margin-top: 0.25rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--fg-primary-dark);
  background: var(--fg-primary-soft);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
}
.user-menu-usage {
  margin: 0 0.75rem 0.5rem;
  padding: 0.7rem 0.75rem;
  border-radius: 8px;
  background: var(--fg-soft);
}
.user-menu-usage-top,
.user-menu-usage-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.82rem;
}
.user-menu-usage-top {
  font-weight: 600;
  margin-bottom: 0.25rem;
}
.user-menu-usage-meta {
  color: var(--fg-muted);
  margin-bottom: 0.45rem;
  font-size: 0.78rem;
}
.user-menu-usage .usage-bar { margin-top: 0; height: 7px; }
.user-menu-links {
  display: flex;
  flex-direction: column;
  padding: 0.25rem 0;
  border-top: 1px solid var(--fg-line);
}
.user-menu-links a {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 1rem;
  color: var(--fg-ink);
  font-weight: 500;
}
.user-menu-links a:hover {
  background: var(--fg-soft);
  color: var(--fg-primary);
}
.user-menu-links a i {
  width: 1.1em;
  color: var(--fg-muted);
}
.user-menu-links a:hover i { color: var(--fg-primary); }
.user-menu-foot {
  border-top: 1px solid var(--fg-line);
  padding: 0.25rem 0;
}
.user-menu-foot form { margin: 0; }
.user-menu-foot button {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.7rem 1rem;
  background: none;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  color: var(--fg-danger);
  text-align: right;
}
.user-menu-foot button:hover { background: #fff5f7; }

/* ——— Page shell ——— */
.fg-page {
  min-height: calc(100vh - 64px);
}
.fg-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px 80px;
}
#browser {
  margin: 20px auto 80px;
}

/* ——— Explorer chrome (Win11-inspired, FileGator theme) ——— */
.fg-explorer {
  background: #fff;
  border: 1px solid var(--fg-line);
  border-radius: 8px;
  overflow: visible;
}
.fg-explorer .fg-listing {
  overflow: auto;
  position: relative;
  z-index: 1;
}

/* ——— Large upload dropzone (above path bar) ——— */
.ex-dropzone {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 132px;
  margin: 12px 12px 0;
  padding: 1.25rem 1.5rem;
  border: 2px dashed var(--fg-primary);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(52, 184, 145, 0.1) 0%, rgba(52, 184, 145, 0.03) 100%);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
  user-select: none;
}
.ex-dropzone:hover,
.ex-dropzone:focus-visible {
  background: rgba(52, 184, 145, 0.14);
  border-color: var(--fg-primary-dark);
  outline: none;
  box-shadow: 0 0 0 3px rgba(52, 184, 145, 0.18);
}
.ex-dropzone.is-active {
  background: rgba(52, 184, 145, 0.2);
  border-color: var(--fg-primary-dark);
  border-style: solid;
  box-shadow: 0 8px 28px rgba(52, 184, 145, 0.25);
  transform: scale(1.01);
}
.ex-dropzone-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.1rem;
  text-align: right;
  pointer-events: none;
}
.ex-dropzone-inner > i {
  font-size: 2.75rem;
  color: var(--fg-primary);
  flex: 0 0 auto;
}
.ex-dropzone-text {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.ex-dropzone-text strong {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--fg-primary-dark);
  line-height: 1.3;
}
.ex-dropzone-text span {
  font-size: 0.92rem;
  color: var(--fg-muted);
  line-height: 1.45;
}
.ex-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.65rem;
  border-bottom: 1px solid var(--fg-line);
  background: #fafafa;
  flex-wrap: wrap;
}
.ex-nav-btns {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex: 0 0 auto;
}
/* در RTL دکمه‌های مسیر باید سمت چپ صفحه باشند (مثل اکسپلورر) */
html[dir="rtl"] .ex-nav-btns {
  order: 3;
  margin-inline-start: auto;
}
html[dir="rtl"] .ex-address {
  order: 1;
}
html[dir="rtl"] .ex-search {
  order: 2;
}
.ex-icon-btn {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border: 0;
  background: transparent;
  border-radius: 6px;
  color: var(--fg-ink);
  cursor: pointer;
  text-decoration: none;
  padding: 0;
}
.ex-icon-btn:hover:not(:disabled) {
  background: var(--fg-primary-soft);
  color: var(--fg-primary-dark);
}
.ex-icon-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.ex-address {
  flex: 1 1 220px;
  min-width: 160px;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  height: 34px;
  padding: 0 0.65rem;
  border: 1px solid var(--fg-line);
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
}
.ex-address-ico { color: var(--fg-primary); flex: 0 0 auto; }
.ex-crumbs {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  overflow: hidden;
  white-space: nowrap;
  font-size: 0.9rem;
  min-width: 0;
}
.ex-crumbs a {
  color: var(--fg-ink);
  font-weight: 600;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ex-crumbs a:hover { color: var(--fg-primary); }
.ex-crumb-sep {
  color: var(--fg-muted);
  font-size: 0.7rem;
  display: inline-flex;
}
.ex-crumb-ws { color: var(--fg-muted); font-size: 0.85rem; }
.ex-search {
  display: flex;
  align-items: stretch;
  flex: 0 1 220px;
  min-width: 140px;
  height: 34px;
  border: 1px solid var(--fg-line);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}
.ex-search-input {
  border: 0 !important;
  box-shadow: none !important;
  height: 100% !important;
  min-height: 0 !important;
  width: 0;
  flex: 1 1 auto;
  padding: 0 0.65rem !important;
  font-size: 0.88rem;
}
.ex-search .ex-icon-btn {
  width: 34px;
  height: 100%;
  border-radius: 0;
  border-right: 1px solid var(--fg-line);
  color: var(--fg-primary);
}

.ex-command {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid var(--fg-line);
  background: #fff;
  flex-wrap: nowrap;
  /* overflow-x:auto منوی dropdown را می‌بُرد — اسکرول فقط در موبایل */
  overflow: visible;
  position: relative;
  z-index: 60;
}
.ex-cmd-group {
  display: flex;
  align-items: center;
  gap: 0.1rem;
  flex: 0 0 auto;
  position: relative;
  z-index: 1;
}
.ex-cmd-end { margin-inline-start: auto; }
.ex-sep {
  width: 1px;
  height: 22px;
  background: var(--fg-line);
  margin: 0 0.35rem;
  flex: 0 0 auto;
}
.ex-cmd {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  height: 34px;
  padding: 0 0.55rem;
  border: 0;
  background: transparent;
  border-radius: 6px;
  color: var(--fg-ink);
  cursor: pointer;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 500;
  white-space: nowrap;
}
.ex-cmd i { color: #5a5a5a; width: 1.05em; text-align: center; }
.ex-cmd:hover:not(:disabled) {
  background: var(--fg-soft);
  color: var(--fg-primary-dark);
}
.ex-cmd:hover:not(:disabled) i { color: var(--fg-primary); }
.ex-cmd:disabled {
  opacity: 0.38;
  cursor: default;
}
.ex-cmd.is-danger:hover:not(:disabled) { color: var(--fg-danger); background: #fff5f7; }
.ex-cmd.is-danger:hover:not(:disabled) i { color: var(--fg-danger); }
.ex-cmd-new {
  background: var(--fg-primary-soft);
  color: var(--fg-primary-dark);
  font-weight: 700;
}
.ex-cmd-new i { color: var(--fg-primary); }
.ex-cmd-new:hover:not(:disabled) {
  background: rgba(52, 184, 145, 0.22);
}
.ex-caret { font-size: 0.7rem; opacity: 0.7; width: auto !important; }
.ex-menu { position: relative; z-index: 1; }
.ex-menu.open { z-index: 80; }
.ex-menu .menu-panel {
  left: auto;
  right: 0;
  min-width: 180px;
  z-index: 90;
}
.ex-menu .menu-panel .is-active-item {
  color: var(--fg-primary);
  font-weight: 700;
  background: var(--fg-primary-soft);
}
body.multi-select-on [data-multi-toggle].ex-cmd {
  background: var(--fg-primary-soft);
  color: var(--fg-primary-dark);
}
body.multi-select-on [data-multi-toggle].ex-cmd i { color: var(--fg-primary); }

/* (removed multi-mode toggle — FileGator-style always-on checkboxes) */

.ex-status {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.85rem;
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid var(--fg-line);
  background: #fcfcfc;
  font-size: 0.82rem;
  color: var(--fg-muted);
  min-height: 36px;
  position: relative;
  z-index: 1;
}
.ex-status .ex-clip,
.ex-status .ex-multi {
  margin: 0;
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
}
.fg-explorer .fg-listing {
  border: 0;
  border-radius: 0;
  min-height: 280px;
}
.fg-explorer .fg-table-wrap {
  border: 0;
  border-radius: 0;
}
.fg-explorer .fg-grid {
  border: 0;
  border-radius: 0;
}

#browser .fg-row-between { display: none; }

/* ——— Breadcrumb (legacy pages) ——— */
.fg-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.95rem;
}
.fg-breadcrumb a { font-weight: 700; color: var(--fg-primary); }
.fg-breadcrumb .sep { color: var(--fg-line); margin: 0 0.15rem; }
.fg-tools {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.fg-tools a {
  color: var(--fg-ink);
  padding: 0.25rem;
}
.fg-tools a:hover { color: var(--fg-primary); }

.fg-row-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ——— Multi actions (FileGator #multi-actions) ——— */
#multi-actions {
  min-height: 55px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1rem 0 0.5rem;
}
#multi-actions .fg-action {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  color: var(--fg-ink);
  font-weight: 500;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0.25rem 0.35rem;
}
#multi-actions .fg-action:hover { color: var(--fg-primary); }
#multi-actions .fg-action.is-danger:hover { color: var(--fg-danger); }
#multi-actions [data-bulk-idle],
#multi-actions [data-bulk-bar] {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.85rem;
}
#multi-actions [data-bulk-idle][hidden],
#multi-actions [data-bulk-bar][hidden] {
  display: none !important;
}

/* ——— Table (Buefy-like) ——— */
.fg-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--fg-line);
  border-radius: 4px;
  background: #fff;
}
.fg-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}
.fg-table th,
.fg-table td {
  padding: 0.75em 1em;
  border-bottom: 1px solid var(--fg-line);
  text-align: right;
  vertical-align: middle;
}
.fg-table thead th {
  background: #fff;
  color: var(--fg-ink);
  font-weight: 700;
  border-bottom: 2px solid var(--fg-line);
  white-space: nowrap;
}
.fg-table tbody tr:hover { background: #fafafa; }
.fg-table tr.is-selected { background: var(--fg-primary-soft); }
.fg-table tr.drop-hover { outline: 2px solid var(--fg-primary); background: var(--fg-primary-soft); }
.fg-table .col-check { width: 3rem; }
.fg-table .col-size { width: 8rem; white-space: nowrap; }
.fg-table .col-time { width: 11rem; white-space: nowrap; color: var(--fg-muted); font-size: 0.9rem; }
.fg-table .col-actions { width: 3.5rem; text-align: center; }
.fg-table [data-row] { cursor: default; user-select: none; }

/* Listing */
.fg-listing {
  position: relative;
  min-height: 200px;
}

/* Grid view */
.fg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--fg-line);
  border-radius: 4px;
  background: #fff;
}
.fg-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 1rem 0.6rem 0.75rem;
  border: 1px solid transparent;
  border-radius: 6px;
  text-align: center;
  user-select: none;
  cursor: default;
  min-height: 120px;
}
.fg-card:hover { background: #fafafa; }
.fg-card.is-selected {
  background: var(--fg-primary-soft);
  border-color: var(--fg-primary);
}
.fg-card.drop-hover {
  outline: 2px solid var(--fg-primary);
  background: var(--fg-primary-soft);
}
.fg-card .name {
  color: #373737;
  text-decoration: none;
  word-break: break-word;
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}
.fg-card .name i { font-size: 2rem; }
.fg-card small { color: var(--fg-muted); font-size: 0.75rem; }
.fg-card .card-check {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
}
.fg-card.type-back {
  text-decoration: none;
  color: var(--fg-muted);
  justify-content: center;
}

/* Multi / clipboard banners — never override [hidden] */
.multi-banner,
.clip-banner {
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  width: 100%;
  margin: 0 0 12px;
  padding: 0.55rem 0.85rem;
  border-radius: 4px;
  background: var(--fg-primary-soft);
  border: 1px solid rgba(52, 184, 145, 0.35);
  font-size: 0.9rem;
}
.multi-banner:not([hidden]),
.clip-banner:not([hidden]) {
  display: flex;
}
.clip-banner { background: #fff8e8; border-color: #f0d78c; }
.fg-action.is-active { color: var(--fg-primary); font-weight: 700; }
body.multi-select-on [data-listing] [data-row] { cursor: default; }

/* Context menu */
.ctx-menu {
  position: fixed;
  z-index: 200;
  min-width: 180px;
  background: #fff;
  border: 1px solid var(--fg-line);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(10, 10, 10, 0.14);
  padding: 0.35rem 0;
  display: flex;
  flex-direction: column;
}
.ctx-menu[hidden] { display: none !important; }
.ctx-menu button {
  background: none;
  border: 0;
  text-align: right;
  padding: 0.55rem 1rem;
  cursor: pointer;
  color: var(--fg-ink);
  font: inherit;
}
.ctx-menu button:hover { background: #f5f5f5; color: var(--fg-primary); }
.ctx-menu button.danger { color: var(--fg-danger); }
.ctx-menu button.danger:hover { background: #fff5f5; }

.help-shortcuts {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  display: grid;
  gap: 0.55rem;
  font-size: 0.95rem;
}
.help-shortcuts kbd {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border: 1px solid var(--fg-line);
  border-bottom-width: 2px;
  border-radius: 3px;
  background: #fafafa;
  font-size: 0.8rem;
  font-family: ui-monospace, monospace;
}
.file-row a.name,
.file-row .name {
  color: #373737;
  word-break: break-all;
  display: inline-block;
}
.file-row.type-dir a.name { font-weight: 700; }
.file-row.type-back a.name { font-weight: 700; color: var(--fg-muted); }

.fg-icon-btn {
  background: #fff;
  border: 1px solid var(--fg-line);
  border-radius: 4px;
  width: 2rem;
  height: 2rem;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  color: var(--fg-ink);
  padding: 0;
}
.fg-icon-btn:hover {
  border-color: var(--fg-primary);
  color: var(--fg-primary);
}

#bottom-info {
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--fg-muted);
  font-size: 0.9rem;
  border-top: 1px solid var(--fg-line);
  background: #fcfcfc;
}
.fg-explorer #bottom-info {
  padding: 10px 16px 14px;
}

/* ——— Forms / buttons (Bulma-ish) ——— */
.button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5em 1em;
  border-radius: 4px;
  border: 1px solid transparent;
  background: #fff;
  border-color: var(--fg-line);
  color: var(--fg-ink);
  cursor: pointer;
  font-weight: 500;
  line-height: 1.5;
  text-decoration: none;
}
.button:hover, .btn:hover { border-color: #b5b5b5; color: var(--fg-ink); }
.button.is-primary, .btn.btn-primary, .btn:not(.btn-secondary):not(.btn-ghost):not(.btn-danger):not(.btn-block):not(.linkish) {
  background: var(--fg-primary);
  border-color: transparent;
  color: #fff;
}
.button.is-primary:hover, .btn.btn-primary:hover {
  background: var(--fg-primary-dark);
  color: #fff;
}
.btn-secondary, .button.is-light {
  background: #fff;
  border-color: var(--fg-line);
  color: var(--fg-ink);
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--fg-ink);
}
.btn-danger, .button.is-danger {
  background: var(--fg-danger);
  border-color: transparent;
  color: #fff;
}
.btn-sm, .button.is-small { font-size: 0.85rem; padding: 0.35em 0.75em; }
.btn-block { width: 100%; }
.btn-block.btn, .button.is-primary.btn-block {
  background: var(--fg-primary);
  color: #fff;
  border-color: transparent;
}

label { display: block; font-weight: 600; margin-bottom: 0.35rem; font-size: 0.9rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="search"], input[type="url"], input[type="color"], input[type="file"],
select, textarea {
  width: 100%;
  padding: 0.55em 0.75em;
  border: 1px solid var(--fg-line);
  border-radius: 4px;
  background: #fff;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--fg-primary);
  box-shadow: 0 0 0 0.125em rgba(52, 184, 145, 0.25);
}
.stack { display: grid; gap: 1rem; }
.check-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
}
.check-row input { width: auto; }

.alert {
  padding: 0.85rem 1rem;
  border-radius: 4px;
  margin: 0.75rem 0;
  border: 1px solid transparent;
}
.alert-ok { background: #effaf5; border-color: #a8e6cf; color: #257953; }
.alert-error { background: #feecf0; border-color: #f5c2cd; color: #cc0f35; }
.muted { color: var(--fg-muted); }
code {
  background: var(--fg-soft);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  font-size: 0.9em;
}

/* ——— Modals ——— */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.modal-root[hidden] { display: none !important; }
/* نوار ابزار و منو نباید روی بک‌دراپ مودال بمانند */
body.modal-open .ex-command,
body.modal-open .ex-menu,
body.modal-open .ex-menu .menu-panel,
body.modal-open .menu.open {
  z-index: 1 !important;
  pointer-events: none;
}
body.modal-open .ex-command.has-open-menu {
  overflow-x: auto;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 10, 0.55);
}
.modal {
  position: relative;
  z-index: 1;
  width: min(480px, 100%);
  background: #fff;
  border-radius: 6px;
  padding: 1.5rem;
  box-shadow: 0 8px 24px rgba(10, 10, 10, 0.2);
}
.modal h3 { margin: 0 0 1rem; font-size: 1.25rem; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

/* ——— Dropdown menu ——— */
.menu { position: relative; display: inline-block; }
.menu.open { z-index: 100; }
.menu-panel {
  display: none;
  position: absolute;
  left: 0;
  top: 100%;
  margin-top: 4px;
  min-width: 180px;
  background: #fff;
  border: 1px solid var(--fg-line);
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(10, 10, 10, 0.16);
  z-index: 120;
  padding: 0.35rem 0;
}
.menu.open .menu-panel { display: block; }
.menu-panel a,
.menu-panel button {
  display: block;
  width: 100%;
  text-align: right;
  padding: 0.5rem 1rem;
  background: none;
  border: 0;
  cursor: pointer;
  color: var(--fg-ink);
  font: inherit;
}
.menu-panel a:hover,
.menu-panel button:hover { background: var(--fg-soft); color: var(--fg-primary); }
.menu-panel .danger,
.menu-panel button.danger { color: var(--fg-danger); }

/* ——— Login (FileGator) ——— */
#login {
  padding: 120px 20px;
  display: flex;
  justify-content: center;
}
#login .box {
  width: min(380px, 100%);
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(10, 10, 10, 0.1);
  border: 1px solid var(--fg-line);
  padding: 30px;
}
#login .logo {
  width: min(280px, 100%);
  display: inline-block;
}
#login .has-text-centered { text-align: center; }
#login .is-flex { display: flex; }
#login .is-justify-end { justify-content: flex-end; }

/* ——— Public gate / login ——— */
body:has(.gate) {
  background: #e7f2f8;
  margin: 0;
}
.gate {
  min-height: 100dvh;
  min-height: 100vh;
  box-sizing: border-box;
  padding: 1.5rem 1rem;
  display: flex;
  justify-content: center;
}
.gate-card {
  width: min(680px, 100%);
  margin-block: auto;
  background: #fff;
  border: 1px solid #cfe0ea;
  border-radius: 16px;
  box-shadow: 0 12px 36px rgba(20, 48, 72, 0.08);
  overflow: hidden;
  flex-shrink: 0;
}
.gate-head {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid #d7e6ef;
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(252, 168, 48, 0.14), transparent 42%),
    linear-gradient(180deg, #f7fbfe 0%, #eef5fa 100%);
}
.gate-brand {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  flex: 0 0 auto;
  order: 2;
  color: #0c3c6c;
  text-decoration: none;
  min-width: 0;
  direction: ltr;
}
.gate-brand img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
  filter: drop-shadow(0 3px 8px rgba(12, 60, 108, 0.12));
}
.gate-brand-name {
  font-size: 1.2rem;
  font-weight: 800;
  color: #0c3c6c;
  letter-spacing: -0.02em;
  white-space: nowrap;
  line-height: 1.1;
}
.gate-nav {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-start;
  align-items: center;
  gap: 0.1rem;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  flex: 1 1 auto;
  order: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.gate-nav::-webkit-scrollbar { display: none; }
.gate-nav a {
  color: #3d5564;
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 700;
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}
.gate-nav a:hover {
  background: rgba(72, 168, 216, 0.14);
  color: var(--fg-primary-dark, #2f7fad);
}
.gate-nav a[aria-current="page"] {
  background: rgba(72, 168, 216, 0.18);
  color: var(--fg-primary-dark, #2f7fad);
}

.gate-login {
  padding: 1.35rem 1.25rem 1.4rem;
  border-bottom: 1px solid #e6eef4;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #fff;
}
.gate-login > .alert {
  width: min(380px, 100%);
  box-sizing: border-box;
}
.gate-login-title {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  margin-bottom: 1.15rem;
  width: min(380px, 100%);
}
.gate-login-title h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  color: #163246;
  letter-spacing: -0.02em;
}
.gate-login-title p {
  margin: 0;
  font-size: 0.88rem;
  color: #6b7c88;
  line-height: 1.55;
}
.gate-badge {
  display: none;
}
.gate-form {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  width: min(380px, 100%);
}
.gate-form-row {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.gate-form label,
.gate-field {
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
}
.gate-form label > span:not(.gate-field-top):not(.gate-pass),
.gate-field > span:not(.gate-field-top):not(.gate-pass) {
  font-size: 0.84rem;
  font-weight: 700;
  color: #3d5564;
}
.gate-field-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.gate-field-top > span {
  font-size: 0.84rem;
  font-weight: 700;
  color: #3d5564;
}
.gate-captcha-q {
  display: block;
  width: 100%;
  direction: rtl;
  text-align: right;
  unicode-bidi: isolate;
  font-size: 0.84rem;
  font-weight: 700;
  color: #3d5564;
}
.gate-forgot {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--fg-primary-dark, #2f7fad);
  text-decoration: none;
}
.gate-forgot:hover { text-decoration: underline; }
.gate-form input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #d5e2ea;
  border-radius: 10px;
  padding: 0.72rem 0.9rem;
  font: inherit;
  font-size: 0.95rem;
  background: #f7fafc;
  color: #163246;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.gate-form input::placeholder { color: #9aadb8; }
.gate-form input:focus {
  outline: none;
  background: #fff;
  border-color: var(--fg-primary, #48a8d8);
  box-shadow: 0 0 0 3px rgba(72, 168, 216, 0.16);
}
.gate-pass {
  position: relative;
  display: block;
}
.gate-pass input {
  padding-left: 2.75rem;
}
.gate-pass-toggle {
  position: absolute;
  top: 50%;
  left: 0.45rem;
  transform: translateY(-50%);
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #6b7c88;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}
.gate-pass-toggle:hover {
  background: rgba(72, 168, 216, 0.12);
  color: var(--fg-primary-dark, #2f7fad);
}
.gate-pass-toggle.is-on {
  color: var(--fg-primary-dark, #2f7fad);
}
.gate-form-actions {
  display: none;
}
.gate-submit {
  margin-top: 0.2rem;
  width: 100%;
  border: 0;
  border-radius: 10px;
  background: var(--fg-primary, #48a8d8);
  color: #fff;
  font: inherit;
  font-weight: 800;
  font-size: 0.95rem;
  padding: 0.78rem 1.1rem;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(47, 127, 173, 0.22);
  transition: background 0.15s ease, transform 0.15s ease;
}
.gate-submit:hover { background: var(--fg-primary-dark, #2f7fad); }
.gate-submit:active { transform: translateY(1px); }
.gate-alt {
  margin: 0;
  text-align: center;
  font-size: 0.86rem;
  color: #6b7c88;
  line-height: 1.5;
}
.gate-alt a {
  color: var(--fg-primary-dark, #2f7fad);
  font-weight: 700;
  text-decoration: none;
}
.gate-alt a:hover { text-decoration: underline; }
.gate-signup {
  margin: 0.15rem 0 0;
  text-align: center;
  font-size: 0.88rem;
  color: #6b7c88;
}
.gate-signup a {
  color: var(--fg-primary-dark, #2f7fad);
  font-weight: 700;
  text-decoration: none;
}
.gate-signup a:hover { text-decoration: underline; }
.gate-form-links {
  display: none;
}

.gate-block {
  padding: 1.05rem 1.25rem 1.15rem;
  border-bottom: 1px solid #eef3f0;
}
.gate-block h2 {
  margin: 0 0 0.75rem;
  font-size: 0.98rem;
  font-weight: 800;
  color: #1f2d28;
}
.gate-block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.gate-block-head h2 {
  margin: 0;
}
.gate-block-more {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--fg-primary-dark);
  text-decoration: none;
  white-space: nowrap;
}
.gate-block-more:hover { text-decoration: underline; }
.gate-news a {
  color: inherit;
  text-decoration: none;
}
.gate-news a:hover { color: var(--fg-primary); text-decoration: underline; }
.gate-news-all {
  margin: 0.75rem 0 0;
  text-align: center;
}
.gate-news-all a {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--fg-primary-dark);
  text-decoration: none;
}
.gate-news-all a:hover { text-decoration: underline; }

.gate-card-news {
  width: min(680px, 100%);
}
.gate-news-page {
  padding: 1.25rem 1.25rem 1.4rem;
}
.gate-news-lead {
  margin: -0.35rem 0 1.1rem;
  font-size: 0.9rem;
  color: #7a8a83;
  line-height: 1.6;
}
.gate-news-full {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  max-height: min(70vh, 820px);
  overflow-y: auto;
  padding-inline-end: 0.25rem;
}
.gate-news-full li {
  padding: 1rem 1.05rem;
  background: #f7fbf9;
  border: 1px solid #e4ece8;
  border-radius: 10px;
  scroll-margin-top: 1rem;
}
.gate-news-full .gate-news-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.45rem;
}
.gate-news-full strong {
  font-size: 1.02rem;
  color: var(--fg-primary-dark);
}
.gate-news-full time {
  font-size: 0.78rem;
  color: #7a8a83;
  flex-shrink: 0;
}
.gate-news-full p {
  margin: 0;
  font-size: 0.92rem;
  color: #4a5c54;
  line-height: 1.75;
  white-space: pre-wrap;
}

.gate-empty {
  margin: 0;
  font-size: 0.88rem;
  color: #7a8a83;
  padding: 0.35rem 0;
}
.gate-news {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.gate-news li {
  padding: 0.65rem 0.75rem;
  background: #f7fbf9;
  border: 1px solid #e4ece8;
  border-radius: 9px;
}
.gate-news-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}
.gate-news strong {
  font-size: 0.92rem;
  color: var(--fg-primary-dark);
}
.gate-news time {
  font-size: 0.75rem;
  color: #7a8a83;
  flex-shrink: 0;
}
.gate-news p {
  margin: 0;
  font-size: 0.88rem;
  color: #5a6b64;
  line-height: 1.55;
  white-space: pre-wrap;
}

.gate-card:has(#gate-pricing) {
  width: min(720px, 100%);
}

.gate-price-label {
  margin: 0 0 0.55rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #5a6b64;
}
.gate-price-label-spaced {
  margin-top: 1rem;
}
.gate-prices {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.6rem;
}
.gate-prices li {
  padding: 0.8rem 0.85rem;
  background: #f7fbf9;
  border: 1px solid #e4ece8;
  border-radius: 9px;
}
.gate-price-main {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.gate-prices strong {
  font-size: 0.92rem;
  color: var(--fg-primary-dark);
}
.gate-price-amount {
  font-size: 0.86rem;
  font-weight: 800;
  color: #1f2d28;
  white-space: nowrap;
}
.gate-prices p {
  margin: 0;
  font-size: 0.82rem;
  color: #7a8a83;
  line-height: 1.5;
}
.gate-price-cta {
  margin: 0.85rem 0 0;
  font-size: 0.84rem;
  color: #5a6b64;
  line-height: 1.65;
}
.gate-price-cta a {
  color: var(--fg-primary-dark);
  font-weight: 700;
  text-decoration: none;
}
.gate-price-cta a:hover { text-decoration: underline; }

/* Pricing — clean responsive board */
.gate-pricing {
  background: transparent;
}
.gp-hint {
  margin: -0.35rem 0 0.85rem;
  font-size: 0.8rem;
  color: #7a8a83;
}
.gp-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.15rem;
  margin-bottom: 1rem;
  padding: 0;
  background: transparent;
  border: 0;
}
.gp-tab {
  border: 0;
  background: transparent;
  color: #7a8a83;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 0.35rem 0.65rem;
  border-radius: 0;
  cursor: pointer;
  position: relative;
}
.gp-tab.is-on {
  color: var(--fg-primary-dark);
  background: transparent;
  box-shadow: none;
}
.gp-tab.is-on::after {
  content: "";
  position: absolute;
  inset-inline: 0.45rem;
  bottom: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--fg-primary);
}
.gp-panel { display: none; }
.gp-panel.is-on { display: block; }
.gp-panel-title {
  margin: 0 0 0.75rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #5a6b64;
}
.gp-board {
  display: block;
}
.gp-axis { display: none; }
.gp-track {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  gap: 0.25rem 0.5rem;
  overflow: visible;
  padding: 0;
}
.gp-col {
  width: auto;
  flex: none;
  margin: 0;
  padding: 0.85rem 0.55rem 0.7rem;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  transition: background 0.18s ease, color 0.18s ease;
}
.gp-panel[data-gp-panel="packs"] .gp-col {
  grid-template-rows: none;
}
.gp-col:hover {
  background: rgba(52, 184, 145, 0.06);
  transform: none;
  border-color: transparent;
}
.gp-col.is-on {
  border: 0;
  background: var(--fg-primary-soft);
  box-shadow: none;
}
.gp-col-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0;
  border: 0;
  position: relative;
  min-height: 0;
  width: 100%;
}
.gp-orb {
  width: 2.85rem;
  height: 2.85rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #5ed4a8, var(--fg-primary-dark));
  color: #fff;
  font-size: 1rem;
  box-shadow: none;
}
.gp-col-head strong {
  font-size: 0.9rem;
  font-weight: 800;
  color: #1f2d28;
  line-height: 1.25;
}
.gp-badge {
  position: static;
  font-style: normal;
  font-size: 0.66rem;
  font-weight: 800;
  color: var(--fg-primary-dark);
  background: transparent;
  padding: 0;
  border-radius: 0;
}
.gp-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.12rem;
  width: 100%;
  border: 0;
  border-top: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: #3d4f47;
  padding: 0.15rem 0;
  min-height: 0;
}
.gp-cell::before {
  content: attr(data-label);
  font-size: 0.68rem;
  font-weight: 700;
  color: #8a9a93;
}
.gp-cell-price {
  flex-direction: column;
  gap: 0.1rem;
}
.gp-cell-price .money-toman {
  flex-direction: column;
  gap: 0.1rem;
}
.gp-cell-price .money-num {
  font-size: 1rem;
  font-weight: 800;
  color: #1f2d28;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.gp-col.is-on .gp-cell-price .money-num {
  color: var(--fg-primary-dark);
}
.money-toman {
  display: inline-flex;
  flex-direction: row;
  align-items: baseline;
  justify-content: center;
  gap: 0.3rem;
  direction: rtl;
  unicode-bidi: isolate;
}
.money-toman .money-num {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}
.money-toman .money-unit {
  font-size: 0.72em;
  font-weight: 700;
  color: #7a8a83;
}
.gp-cta {
  margin-top: 1.1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  flex-direction: row;
}
.gp-cta p {
  margin: 0;
  flex: 1 1 12rem;
  font-size: 0.82rem;
  color: #5a6b64;
  line-height: 1.55;
  order: 1;
}
.gp-cta-btn {
  order: 2;
  margin-inline-start: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--fg-primary);
  color: #fff !important;
  text-decoration: none !important;
  font-weight: 800;
  font-size: 0.9rem;
  padding: 0.65rem 1.15rem;
  border-radius: 10px;
  box-shadow: 0 8px 18px rgba(42, 154, 120, 0.22);
  flex-shrink: 0;
}
.gp-cta-btn:hover { background: var(--fg-primary-dark); }

@media (max-width: 720px) {
  .gp-track {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }
  .gp-col {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    text-align: start;
    gap: 0.35rem 0.75rem;
    padding: 0.85rem 0.35rem;
    border-radius: 0;
    border-bottom: 1px solid #eef3f0;
  }
  .gp-col:last-child { border-bottom: 0; }
  .gp-col.is-on {
    background: transparent;
    box-shadow: inset 3px 0 0 var(--fg-primary);
  }
  .gp-col-head {
    flex-direction: row;
    width: auto;
    gap: 0.55rem;
    flex: 1 1 auto;
    justify-content: flex-start;
  }
  .gp-orb {
    width: 2.2rem;
    height: 2.2rem;
    font-size: 0.85rem;
  }
  .gp-badge { margin-inline-start: 0.15rem; }
  .gp-cell {
    flex: 0 0 auto;
    width: auto;
    flex-direction: row;
    gap: 0.3rem;
    padding: 0;
    align-items: baseline;
  }
  .gp-cell::before {
    content: none;
  }
  .gp-cell-price {
    flex-direction: row;
    align-items: baseline;
    gap: 0.25rem;
    margin-inline-start: auto;
  }
  .gp-cell:not(.gp-cell-price) {
    font-size: 0.75rem;
    color: #7a8a83;
  }
  .gp-cell[data-label="میانگین روزانه"],
  .gp-cell[data-label="نوع"] {
    display: none;
  }
  .gp-cta {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
  }
  .gp-cta p { order: 1; flex: 1 1 auto; }
  .gp-cta-btn {
    order: 2;
    margin-inline-start: auto;
    align-self: center;
    width: auto;
  }
}

.gate-feats {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.gate-feats li {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 0.75rem;
  align-items: start;
}
.gate-feats i {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--fg-primary-soft);
  color: var(--fg-primary-dark);
  font-size: 0.95rem;
}
.gate-feats strong {
  display: block;
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--fg-primary-dark);
  margin-bottom: 0.15rem;
}
.gate-feats p {
  margin: 0;
  font-size: 0.86rem;
  color: #5a6b64;
  line-height: 1.55;
}

.gate-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.35rem 0.45rem;
  padding: 0.85rem 1rem 1rem;
  font-size: 0.8rem;
  color: #4a5a54;
  background: #fafcfb;
}
.gate-foot a {
  color: #4a5a54;
  text-decoration: none;
}
.gate-foot a:hover {
  color: var(--fg-primary-dark);
  text-decoration: underline;
}
.gate-dot { color: #9aa8a1; }

/* legal pages */
.lp {
  min-height: 100dvh;
  min-height: 100vh;
  padding: 1.75rem 1.15rem;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #e8efeb;
  box-sizing: border-box;
}
.lp-frame { width: min(640px, 100%); display: flex; flex-direction: column; gap: 0.75rem; }
.lp-top, .lp-box {
  background: #fff;
  border: 1px solid #d5e0db;
  border-radius: 14px;
  padding: 1rem 1.15rem;
}
.lp-top { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 0.75rem; }
.lp-brand { display: flex; align-items: center; justify-content: center; width: 100%; color: #1f2d28; text-decoration: none; }
.lp-brand img { width: min(280px, 88%); height: auto; max-height: 96px; object-fit: contain; display: block; }
.lp-links a { color: #5a6b64; text-decoration: none; font-size: 0.86rem; font-weight: 600; }
.lp-box-head h1 { margin: 0; font-size: 1.15rem; }
.lp-legal-body { color: #5a6b64; line-height: 1.8; font-size: 0.95rem; }
.lp-foot {
  text-align: center;
  font-size: 0.8rem;
  color: #4a5a54;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem;
}
.lp-foot a { color: inherit; text-decoration: none; }
.lp-foot-sep { color: #9aa8a1; }

@media (max-width: 560px) {
  .gate {
    padding: 1rem 0.85rem;
  }
  .gate-card { width: 100%; }
  .gate-head {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 0.75rem;
  }
  .gate-nav {
    justify-content: flex-start;
    width: auto;
  }
  .gate-nav a {
    font-size: 0.78rem;
    padding: 0.35rem 0.5rem;
  }
  .gate-login {
    padding: 1.25rem 1.1rem 1.3rem;
  }
  .gate-block { padding-left: 1.1rem; padding-right: 1.1rem; }
  .gate-brand { justify-content: center; order: 2; }
  .gate-brand img {
    width: 44px;
    height: 44px;
  }
  .gate-brand-name {
    font-size: 1.05rem;
  }
}
/* ——— Dropzone ——— */
.browser, #dropzone { position: relative; min-height: 50vh; }
.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  place-items: center;
  background: rgba(52, 184, 145, 0.12);
  border: 3px dashed var(--fg-primary);
}
.drop-overlay:not([hidden]) { display: grid; }
.drop-overlay-card {
  background: #fff;
  color: var(--fg-primary-dark);
  font-weight: 700;
  font-size: 1.25rem;
  padding: 2rem 2.5rem;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(10, 10, 10, 0.15);
}
.drop-info { margin: 20% auto; text-align: center; font-size: 1.4rem; color: var(--fg-primary); }

.upload-rename-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-height: 220px;
  overflow: auto;
  padding: 0.15rem 0;
}
.upload-rename-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--fg-line);
  border-radius: 6px;
  background: var(--fg-soft);
}
.upload-rename-meta {
  font-size: 0.78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.upload-rename-input {
  width: 100%;
  font: inherit;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--fg-line);
  border-radius: 4px;
  background: #fff;
}

.color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}
.color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 2px solid transparent;
  background: var(--swatch);
  cursor: pointer;
  padding: 0;
  box-shadow: inset 0 0 0 1px rgba(10, 10, 10, 0.12);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.color-swatch:hover {
  transform: scale(1.08);
}
.color-swatch.is-active {
  border-color: var(--fg-ink);
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--swatch);
}
.color-swatch[data-color="#111827"].is-active {
  border-color: #111827;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #64748b;
}
.color-swatch[data-color="#eab308"] {
  box-shadow: inset 0 0 0 1px rgba(10, 10, 10, 0.18);
}

/* ——— Misc pages inside FG shell ——— */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 1.5rem 0 1rem;
}
.topbar h1 { margin: 0; font-size: 1.6rem; }
.crumb, .topbar .crumb { color: var(--fg-muted); font-size: 0.9rem; margin-top: 0.25rem; }
.panel {
  background: #fff;
  border: 1px solid var(--fg-line);
  border-radius: 6px;
  padding: 1.25rem;
}
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

/* ——— Photo gallery (compact mosaic) ——— */
.photo-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.55rem;
  margin-top: 0.25rem;
}
.photo-tile {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  background: #e8eef3;
  border: 1px solid #d7e2ea;
  text-decoration: none;
  color: inherit;
  isolation: isolate;
  padding: 0;
  cursor: pointer;
  font: inherit;
  text-align: start;
}
.photo-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 0.2s ease;
}
.photo-tile:hover img {
  transform: scale(1.04);
}
.photo-tile-cap {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  padding: 1.4rem 0.55rem 0.45rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(transparent, rgba(10, 28, 40, 0.72));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}
.photo-tile:hover .photo-tile-cap,
.photo-tile:focus-visible .photo-tile-cap {
  opacity: 1;
}
@media (max-width: 720px) {
  .photo-gallery {
    grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
    gap: 0.4rem;
  }
  .photo-tile {
    border-radius: 8px;
  }
  .photo-tile-cap {
    opacity: 1;
    font-size: 0.68rem;
    padding: 1.1rem 0.4rem 0.35rem;
  }
}
@media (min-width: 1100px) {
  .photo-gallery {
    grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
  }
}

/* ——— Gallery lightbox ——— */
.photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.photo-lightbox[hidden] { display: none !important; }
.photo-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 18, 28, 0.78);
  backdrop-filter: blur(4px);
}
.photo-lightbox-shell {
  position: relative;
  z-index: 1;
  width: min(960px, 100%);
  max-height: min(92vh, 900px);
  background: #0f1c26;
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
  color: #fff;
}
.photo-lightbox-bar,
.photo-lightbox-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  background: rgba(255, 255, 255, 0.04);
}
.photo-lightbox-title {
  font-size: 0.92rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.photo-lightbox-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}
.photo-lightbox-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  text-decoration: none;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.45rem 0.7rem;
  cursor: pointer;
}
.photo-lightbox-btn:hover { background: rgba(72, 168, 216, 0.35); }
.photo-lightbox-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 280px;
  display: grid;
  place-items: center;
  padding: 0.75rem 3.2rem;
  background: #08131c;
}
.photo-lightbox-img {
  max-width: 100%;
  max-height: min(72vh, 720px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
  display: block;
}
.photo-lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.photo-lightbox-nav:hover { background: rgba(72, 168, 216, 0.45); }
.photo-lightbox-nav.is-prev { right: 0.65rem; }
.photo-lightbox-nav.is-next { left: 0.65rem; }
.photo-lightbox-foot {
  justify-content: center;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.72);
}
body.photo-lightbox-open {
  overflow: hidden;
}
@media (max-width: 640px) {
  .photo-lightbox {
    padding: 0;
  }
  .photo-lightbox-shell {
    width: 100%;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
  }
  .photo-lightbox-stage {
    padding: 0.5rem 2.6rem;
  }
  .photo-lightbox-btn span { display: none; }
  .photo-lightbox-img {
    max-height: calc(100vh - 7.5rem);
  }
}

.files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
}
.item {
  border: 1px solid var(--fg-line);
  border-radius: 4px;
  padding: 0.75rem;
  background: #fff;
  position: relative;
}
.item-title { font-weight: 700; color: #373737; }
.item-meta { color: var(--fg-muted); font-size: 0.85rem; }
.item-icon {
  width: 42px;
  height: 42px;
  border-radius: 4px;
  background: var(--fg-soft);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.75rem;
  margin-bottom: 0.5rem;
}
.item-icon.is-folder { background: var(--fg-primary-soft); color: var(--fg-primary-dark); }
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--fg-muted); }
.empty h3 { color: var(--fg-ink); margin: 0 0 0.5rem; }
.pager { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.pager a {
  min-width: 2rem;
  height: 2rem;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--fg-line);
  border-radius: 4px;
  color: var(--fg-ink);
}
.pager a.active {
  background: var(--fg-primary);
  border-color: var(--fg-primary);
  color: #fff;
}
.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.5rem 0 1rem;
}
.settings-tabs a {
  padding: 0.4rem 0.85rem;
  border-radius: 4px;
  border: 1px solid var(--fg-line);
  color: var(--fg-ink);
}
.settings-tabs a.active {
  background: var(--fg-primary);
  border-color: var(--fg-primary);
  color: #fff;
}
table:not(.fg-table) {
  width: 100%;
  border-collapse: collapse;
}
table:not(.fg-table) th,
table:not(.fg-table) td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--fg-line);
  text-align: right;
  vertical-align: middle;
}
.data-table .col-compact,
table:not(.fg-table) .col-compact {
  white-space: nowrap;
  width: 1%;
}
.mono-clip {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
  direction: ltr;
  text-align: left;
}
.public-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
  background: var(--fg-soft);
}
.public-card {
  width: min(440px, 100%);
  background: #fff;
  border: 1px solid var(--fg-line);
  border-radius: 6px;
  padding: 1.75rem;
  box-shadow: 0 2px 8px rgba(10,10,10,0.08);
}
.brand-mark { font-weight: 800; color: var(--fg-primary); }
.usage-bar {
  height: 6px;
  background: #e6e8eb;
  border-radius: 99px;
  overflow: hidden;
  margin-top: 0.35rem;
}
.usage-bar span {
  display: block;
  height: 100%;
  background: var(--fg-primary);
  border-radius: inherit;
}
.mobile-nav-btn { display: none; }

.preview-shell { position: relative; overflow: hidden; }
.wm-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 2;
  font-size: clamp(1.4rem, 4vw, 2.4rem);
  font-weight: 800;
  color: rgba(52, 184, 145, 0.2);
  transform: rotate(-18deg);
  user-select: none;
}
.doc-text {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, monospace;
  font-size: 0.92rem;
  line-height: 1.7;
  max-height: 75vh;
  overflow: auto;
  background: var(--fg-soft);
  border-radius: 4px;
  padding: 16px 18px;
}

.toolbar-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: stretch;
}
.toolbar-inline .search-input,
.toolbar-inline select,
.toolbar-inline .search-btn {
  height: 42px;
  min-height: 42px;
  box-sizing: border-box;
  margin: 0;
}
.toolbar-inline select {
  width: auto;
  min-width: 110px;
  padding: 0 0.75em;
}
.search-group {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: stretch;
  flex: 0 1 280px;
  width: 280px;
  max-width: 100%;
  min-width: 180px;
}
.search-group .search-input {
  flex: 1 1 auto;
  min-width: 0;
  width: 0;
  max-width: none;
  border-radius: 4px 0 0 4px;
  border-left: 0;
}
html[dir="rtl"] .search-group .search-input {
  border-radius: 0 4px 4px 0;
  border-left: 1px solid var(--fg-line);
  border-right: 0;
}
.search-group .search-btn {
  flex: 0 0 42px;
  width: 42px;
  max-width: 42px;
  padding: 0;
  border-radius: 0 4px 4px 0;
  background: var(--fg-primary);
  border-color: var(--fg-primary);
  color: #fff;
}
html[dir="rtl"] .search-group .search-btn {
  border-radius: 4px 0 0 4px;
}
.search-group .search-btn:hover {
  background: var(--fg-primary-dark);
  border-color: var(--fg-primary-dark);
  color: #fff;
}
.search-group .search-input:focus {
  z-index: 1;
  position: relative;
}

/* Unsaved changes */
.unsaved-bar {
  position: sticky;
  top: 64px;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 0 0 1rem;
  padding: 0.7rem 0.9rem;
  border-radius: 6px;
  background: #fff8e8;
  border: 1px solid #f0d78c;
  color: #7a5b00;
  font-size: 0.92rem;
  font-weight: 600;
}
.unsaved-bar[hidden],
.unsaved-inline[hidden] {
  display: none !important;
}
.unsaved-inline {
  color: #b8860b;
  font-size: 0.88rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  line-height: 1.2;
  margin: 0;
}
.settings-save-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.settings-save-row .button {
  margin: 0;
}
.button.is-pulse {
  box-shadow: 0 0 0 0 rgba(52, 184, 145, 0.45);
  animation: save-pulse 1.4s ease-out infinite;
}
@keyframes save-pulse {
  0% { box-shadow: 0 0 0 0 rgba(52, 184, 145, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(52, 184, 145, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 184, 145, 0); }
}
@media (max-width: 768px) {
  .unsaved-bar { top: 56px; }
}

/* Product mode picker */
.mode-block { margin-bottom: 0.25rem; }
.mode-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.mode-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--fg-line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.mode-card input { position: absolute; opacity: 0; pointer-events: none; }
.mode-card:hover { border-color: #b5b5b5; }
.mode-card:has(input:checked),
.mode-card.is-selected {
  border-color: var(--fg-primary);
  background: var(--fg-primary-soft);
  box-shadow: inset 0 0 0 1px var(--fg-primary);
}
.mode-card-title {
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--fg-ink);
}
.mode-card-desc {
  font-size: 0.85rem;
  color: var(--fg-muted);
  line-height: 1.45;
}
.settings-divider {
  border: 0;
  border-top: 1px solid var(--fg-line);
  margin: 0.5rem 0 1rem;
}
.branding-block {
  padding: 0.85rem;
  border: 1px solid var(--fg-line);
  border-radius: 10px;
  background: #fafcfb;
}
.branding-logo-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.branding-logo-preview {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border: 1px solid var(--fg-line);
  border-radius: 10px;
  background: #fff;
  padding: 6px;
}
.theme-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}
.theme-swatch {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--fg-line);
  background: var(--sw, #48a8d8);
  cursor: pointer;
  padding: 0;
}
.theme-swatch.is-active {
  box-shadow: 0 0 0 2px var(--fg-primary);
}
.theme-hex-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  max-width: 280px;
}
.theme-hex-row input[type="color"] {
  width: 44px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--fg-line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}
.theme-hex-row input[type="text"] {
  flex: 1;
}
@media (max-width: 720px) {
  .mode-picker { grid-template-columns: 1fr; }
}

/* ——— Settings hub (FileGator-style) ——— */
.settings-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 1.25rem;
  margin: 1.25rem 0 2rem;
  align-items: start;
}
.settings-nav {
  background: #fff;
  border: 1px solid var(--fg-line);
  border-radius: 6px;
  padding: 0.75rem 0;
  position: sticky;
  top: 72px;
  max-height: calc(100vh - 90px);
  overflow: auto;
}
.settings-nav-head {
  padding: 0.5rem 1rem 0.85rem;
  border-bottom: 1px solid var(--fg-line);
  margin-bottom: 0.35rem;
}
.settings-nav-group {
  padding: 0.85rem 1rem 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--fg-muted);
  text-transform: uppercase;
}
.settings-nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 1rem;
  color: var(--fg-ink);
  font-weight: 500;
  border-right: 3px solid transparent;
}
.settings-nav-item i { width: 1.1rem; color: var(--fg-muted); }
.settings-nav-item:hover {
  background: var(--fg-soft);
  color: var(--fg-primary-dark);
}
.settings-nav-item.is-active {
  background: var(--fg-primary-soft);
  border-right-color: var(--fg-primary);
  color: var(--fg-primary-dark);
  font-weight: 700;
}
.settings-nav-item.is-active i { color: var(--fg-primary); }
.settings-main-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.settings-main-head h1 {
  margin: 0;
  font-size: 1.45rem;
}
.settings-form-panel {
  max-width: 640px;
}
.settings-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.75rem;
}
.settings-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.85rem;
  align-items: center;
  padding: 1rem 1.1rem;
  background: #fff;
  border: 1px solid var(--fg-line);
  border-radius: 6px;
  color: var(--fg-ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.settings-card:hover {
  border-color: var(--fg-primary);
  box-shadow: 0 4px 14px rgba(52, 184, 145, 0.12);
  color: var(--fg-ink);
}
.settings-card-ico {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--fg-primary-soft);
  color: var(--fg-primary-dark);
  display: grid;
  place-items: center;
  font-size: 1.1rem;
}
.settings-card-arrow {
  color: var(--fg-line);
}
.settings-card:hover .settings-card-arrow { color: var(--fg-primary); }

.settings-subbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 1rem 0 0.75rem;
  font-size: 0.92rem;
  color: var(--fg-muted);
}
.settings-subbar a {
  color: var(--fg-primary);
  font-weight: 600;
}
.settings-subbar .sep { color: var(--fg-line); }

@media (max-width: 900px) {
  .settings-shell { grid-template-columns: 1fr; }
  .settings-nav {
    position: static;
    max-height: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0.75rem;
  }
  .settings-nav-head { width: 100%; border: 0; margin: 0; padding: 0 0 0.5rem; }
  .settings-nav-group { width: 100%; padding: 0.5rem 0 0.15rem; }
  .settings-nav-item {
    border: 1px solid var(--fg-line);
    border-radius: 4px;
    border-right-width: 1px;
    padding: 0.4rem 0.7rem;
    font-size: 0.88rem;
  }
  .settings-nav-item.is-active { border-color: var(--fg-primary); }
  .settings-cards { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .fg-container { padding: 0 12px 96px; }
  #browser { margin: 16px auto 40px; }

  .fg-burger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
  }
  .fg-navbar {
    flex-wrap: wrap;
    padding: 0.45rem 0.75rem;
    position: sticky;
    top: 0;
  }
  .fg-navbar .logo img { height: 2rem; max-width: 140px; }
  .fg-nav-aside {
    margin-inline-start: auto;
    order: 2;
  }
  .fg-nav-end {
    display: none;
    width: 100%;
    order: 3;
    flex: 1 1 100%;
    justify-content: stretch;
    background: #fff;
    border-top: 1px solid var(--fg-line);
    flex-direction: column;
    align-items: stretch;
    padding: 0.5rem 0 0.25rem;
    gap: 0;
    margin: 0;
  }
  .fg-navbar.is-open .fg-nav-end { display: flex; }
  .fg-nav-end a,
  .fg-nav-end button.linkish {
    display: block;
    padding: 0.75rem 0.25rem;
    border-bottom: 1px solid var(--fg-soft);
    font-size: 1rem;
  }
  .user-menu-panel {
    left: 0;
    right: auto;
  }

  .fg-container {
    padding-left: 10px;
    padding-right: 10px;
    overflow-x: hidden;
  }
  #browser {
    margin: 10px auto 64px;
    max-width: 100%;
  }

  .fg-explorer {
    border-radius: 0;
    margin: 0 -10px;
    width: calc(100% + 20px);
    border-left: 0;
    border-right: 0;
    max-width: none;
  }

  .ex-dropzone {
    min-height: 112px;
    margin: 10px 10px 0;
    padding: 1rem;
  }
  .ex-dropzone-inner {
    flex-direction: column;
    text-align: center;
    gap: 0.55rem;
  }
  .ex-dropzone-inner > i { font-size: 2.2rem; }
  .ex-dropzone-text strong { font-size: 1.05rem; }
  .ex-dropzone-text span { font-size: 0.84rem; }

  .ex-nav {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "addr btns"
      "search search";
    gap: 0.4rem;
    padding: 0.5rem;
  }
  .ex-nav-btns {
    grid-area: btns;
    order: unset;
    margin-inline-start: 0;
    justify-self: start; /* سمت چپ در RTL */
  }
  html[dir="rtl"] .ex-nav-btns {
    order: unset;
    margin-inline-start: 0;
    justify-self: start;
  }
  .ex-address {
    grid-area: addr;
    width: 100%;
    min-width: 0;
    flex: none;
    max-width: 100%;
    order: unset;
  }
  html[dir="rtl"] .ex-address { order: unset; }
  .ex-search {
    grid-area: search;
    width: 100%;
    min-width: 0;
    flex: none;
    max-width: 100%;
    order: unset;
  }
  html[dir="rtl"] .ex-search { order: unset; }
  .ex-crumbs { width: 100%; }
  .ex-crumbs a { max-width: 46vw; }

  .ex-command {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.15rem;
    padding: 0.35rem 0.4rem;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    max-width: 100%;
    z-index: 70;
  }
  .ex-command:has(.menu.open),
  .ex-command.has-open-menu {
    overflow: visible;
  }
  .ex-command::-webkit-scrollbar { display: none; }
  .ex-cmd-group { flex: 0 0 auto; }
  .ex-cmd-end { margin-inline-start: auto; }
  .ex-cmd {
    height: 40px;
    min-width: 40px;
    justify-content: center;
    padding: 0 0.55rem;
  }
  .ex-cmd .ex-lbl,
  .ex-cmd .ex-caret { display: none; }
  .ex-cmd-new {
    padding: 0 0.7rem;
  }
  .ex-cmd-new .ex-lbl { display: inline; }
  .ex-cmd-new .ex-caret { display: inline; font-size: 0.65rem; }

  /* بدون انتخاب: اکشن‌های ویرایش پنهان — فقط جدید/نمایش/بیشتر */
  .ex-command [data-ex-group="edit"],
  .ex-command [data-ex-sep="edit"] {
    display: none;
  }
  /* با انتخاب: اکشن‌ها بیایند جلو، مرتب‌سازی جمع شود */
  body.has-selection .ex-command [data-ex-group="edit"],
  body.has-selection .ex-command [data-ex-sep="edit"] {
    display: flex;
  }
  body.has-selection .ex-command [data-ex-group="view"],
  body.has-selection .ex-command [data-ex-sep="view"],
  body.has-selection .ex-command [data-ex-group="create"] {
    display: none;
  }
  body.has-selection .ex-command {
    position: sticky;
    bottom: 0;
    z-index: 70;
    background: #fff;
    border-top: 1px solid var(--fg-line);
    box-shadow: 0 -6px 18px rgba(10, 10, 10, 0.08);
    padding-bottom: calc(0.35rem + env(safe-area-inset-bottom, 0px));
  }

  .ex-status {
    padding: 0.45rem 0.65rem;
    font-size: 0.8rem;
  }
  .ex-menu .menu-panel,
  .ex-command .menu-panel {
    position: absolute;
    left: auto;
    right: 0;
    top: calc(100% + 4px);
    bottom: auto;
    width: max-content;
    min-width: 180px;
    max-width: min(280px, calc(100vw - 24px));
    max-height: min(50vh, 320px);
    overflow: auto;
    z-index: 200;
  }

  .fg-table-wrap { border-radius: 0; margin: 0; width: 100%; border: 0; overflow-x: auto; }
  .fg-table { min-width: 0; width: 100%; }
  .fg-table th,
  .fg-table td { padding: 0.85rem 0.65rem; }
  .fg-table .col-size,
  .fg-table .col-time { display: none; }
  .fg-table .col-check { width: 2.75rem; }
  .fg-table .col-actions { width: 2.75rem; }
  .fg-table .row-check {
    width: 1.25rem;
    height: 1.25rem;
  }
  .file-row a.name { font-size: 0.95rem; padding: 0.15rem 0; word-break: break-word; }
  .fg-icon-btn { width: 2.4rem; height: 2.4rem; }

  .fg-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.5rem;
    padding: 0.5rem;
  }
  .fg-card {
    min-height: 110px;
    padding: 0.85rem 0.4rem 0.6rem;
  }
  .fg-card .card-check input {
    width: 1.2rem;
    height: 1.2rem;
  }

  #bottom-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 12px 14px 20px;
  }

  .grid-2 { grid-template-columns: 1fr; }
  .topbar h1 { font-size: 1.3rem; }
  .panel { padding: 1rem; }
  .modal-root { padding: 0; align-items: flex-end; }
  .modal {
    width: 100%;
    max-width: none;
    border-radius: 14px 14px 0 0;
    max-height: min(92vh, 100%);
    overflow: auto;
    padding: 1.15rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
  }
  .modal-actions {
    flex-wrap: wrap;
  }
  .modal-actions .button { flex: 1 1 auto; min-height: 44px; }

  .menu-panel {
    left: auto;
    right: 0;
    min-width: 200px;
  }
  .ctx-menu {
    min-width: min(240px, calc(100vw - 16px));
  }
  .ctx-menu button {
    padding: 0.75rem 1rem;
    min-height: 44px;
  }

  .help-shortcuts { font-size: 0.88rem; }
  .drop-info { margin: 30% auto; font-size: 1.1rem; padding: 0 1rem; }
  #login { padding: 40px 16px; }
  #login .box { padding: 22px 18px; }

  .settings-main-head {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  .mode-picker { grid-template-columns: 1fr; }
  .data-table .mono-clip { max-width: 140px; }
  .is-desktop-only { display: none !important; }
}

/* ——— Mobile app shell (bottom tabs + home) ——— */
.m-tabbar {
  display: none;
}

.m-home {
  max-width: 720px;
  margin: 0 auto;
  padding: 0.25rem 0 1.5rem;
}
.m-home-head { margin-bottom: 1.25rem; }
.m-home-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}
.m-home-title-row h1 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--fg-ink);
}
.m-home-tools {
  display: flex;
  align-items: center;
  gap: 0.2rem;
}
.m-home-ico {
  width: 40px;
  height: 40px;
  border: 0;
  background: transparent;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--fg-ink);
  cursor: pointer;
  font-size: 1.05rem;
  text-decoration: none;
}
.m-home-ico:hover {
  background: var(--fg-soft);
  color: var(--fg-primary-dark);
}
.m-home-search {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: var(--fg-soft);
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 0.7rem 0.95rem;
}
.m-home-search:focus-within {
  background: #fff;
  border-color: var(--fg-primary);
  box-shadow: 0 0 0 3px var(--fg-primary-soft);
}
.m-home-search i { color: var(--fg-muted); }
.m-home-search input {
  flex: 1;
  border: 0;
  background: transparent;
  outline: none;
  padding: 0;
  min-width: 0;
}
.m-home-section { margin-bottom: 1.5rem; }
.m-home-sec-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.m-home-sec-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
}
.m-home-sec-head a {
  font-size: 0.88rem;
  font-weight: 600;
}
.m-home-recents {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.m-home-recent {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.45rem 0.35rem;
  border-radius: 12px;
  color: inherit;
  text-decoration: none;
  width: 100%;
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
  text-align: start;
}
.m-home-recent:hover { background: var(--fg-soft); }
.m-home-thumb {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: var(--fg-primary-soft);
  color: var(--fg-primary-dark);
  display: grid;
  place-items: center;
  overflow: hidden;
  font-size: 1.15rem;
}
.m-home-thumb.is-img { background: #e8eeeb; }
.m-home-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.m-home-recent-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}
.m-home-recent-meta strong {
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.m-home-recent-meta span {
  font-size: 0.8rem;
  color: var(--fg-muted);
}
.m-home-ok {
  color: var(--fg-primary);
  font-size: 1rem;
}
.m-home-hscroll {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.35rem;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.m-home-hscroll::-webkit-scrollbar { height: 4px; }
.m-home-share-card,
.m-home-folder-card {
  flex: 0 0 132px;
  scroll-snap-align: start;
  text-decoration: none;
  color: inherit;
}
.m-home-share-ico,
.m-home-folder-ico {
  display: grid;
  place-items: center;
  height: 96px;
  border-radius: 16px;
  background: var(--fg-soft);
  margin-bottom: 0.45rem;
  position: relative;
  font-size: 2rem;
  color: var(--fg-primary);
}
.m-home-share-ico .fa-user-friends {
  position: absolute;
  bottom: 12px;
  left: 14px;
  font-size: 0.85rem;
  color: var(--fg-primary-dark);
  background: #fff;
  border-radius: 99px;
  padding: 0.25rem;
}
.m-home-share-name {
  display: block;
  font-size: 0.86rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.m-home-empty {
  padding: 1.25rem 0.5rem;
  text-align: center;
  color: var(--fg-muted);
}
.m-home-empty p { margin: 0 0 0.75rem; }

.m-home-empty-card {
  display: grid;
  justify-items: center;
  gap: 0.45rem;
  text-align: center;
  padding: 1.75rem 1.15rem;
  border-radius: 18px;
  border: 1px dashed rgba(72, 168, 216, 0.35);
  background:
    radial-gradient(420px 160px at 50% 0%, rgba(72, 168, 216, 0.12), transparent 70%),
    #fff;
}
.m-home-empty-card.is-soft {
  border-color: rgba(19, 39, 52, 0.12);
  background:
    radial-gradient(420px 160px at 50% 0%, rgba(252, 168, 48, 0.1), transparent 70%),
    #fff;
}
.m-home-empty-ico {
  width: 3.4rem;
  height: 3.4rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  margin-bottom: 0.35rem;
  background: rgba(72, 168, 216, 0.14);
  color: var(--fg-primary, #48a8d8);
  font-size: 1.35rem;
}
.m-home-empty-ico.is-folder {
  background: rgba(252, 168, 48, 0.16);
  color: #e08a14;
}
.m-home-empty-card strong {
  font-size: 1.05rem;
  color: var(--fg-ink, #132734);
}
.m-home-empty-card p {
  margin: 0;
  max-width: 28ch;
  color: var(--fg-muted);
  font-size: 0.92rem;
  line-height: 1.6;
}
.m-home-empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: center;
  margin-top: 0.75rem;
}
.m-home-empty-actions .button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

@media (max-width: 768px) {
  body.is-mobile-app .m-tabbar,
  .m-tabbar {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: center;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 80;
    height: calc(52px + env(safe-area-inset-bottom, 0px));
    padding: 0 0 env(safe-area-inset-bottom, 0px);
    background: #fff;
    border-top: 1px solid #e8ecea;
    box-shadow: 0 -1px 0 rgba(16, 40, 32, 0.04);
    overflow: visible;
  }
  body.is-mobile-app .fg-page,
  .fg-page {
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  }
  body.is-mobile-app .fg-navbar .fg-burger {
    display: none;
  }
  body.is-mobile-app .fg-navbar.is-open .fg-nav-end {
    display: none;
  }
  body.is-mobile-app .ex-dropzone {
    display: none;
  }
  body.has-selection .m-tabbar {
    display: none;
  }
  body.has-selection .ex-command {
    bottom: 0;
    padding-bottom: calc(0.35rem + env(safe-area-inset-bottom, 0px));
  }
  body.is-mobile-app #browser {
    margin-bottom: 24px;
  }
}

.m-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.12rem;
  border: 0;
  background: transparent;
  color: #8a9690;
  text-decoration: none;
  font-size: 0.62rem;
  font-weight: 600;
  padding: 0;
  height: 52px;
  cursor: pointer;
  font-family: inherit;
  position: relative;
}
.m-tab i { font-size: 1.2rem; line-height: 1; }
.m-tab.is-active { color: var(--fg-primary-dark); }

/* دایره آپلود: نصفش بالای خط نوار می‌زند، بدون برچسب */
.m-tab-fab {
  overflow: visible;
  z-index: 2;
}
.m-tab-fab-btn {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translate(-50%, -42%);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--fg-primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  box-shadow: 0 4px 14px rgba(52, 184, 145, 0.38);
  border: 3px solid #fff;
  pointer-events: none;
}
.m-tab-fab:active .m-tab-fab-btn {
  transform: translate(-50%, -42%) scale(0.96);
}
.m-tab-fab-label { display: none; }

@media (min-width: 769px) {
  .m-tabbar { display: none !important; }
  .m-home {
    max-width: 880px;
    padding-top: 0.5rem;
  }
  .m-home-recents {
    background: #fff;
    border: 1px solid var(--fg-line);
    border-radius: 16px;
    padding: 0.35rem;
  }
}
