:root {
  --bg: #f4f6f8;
  --bg-elevated: #ffffff;
  --sidebar: #0b1220;
  --sidebar-text: #c7d2e0;
  --sidebar-muted: #7b8ba3;
  --sidebar-active: #122033;
  --text: #0f172a;
  --text-secondary: #475569;
  --muted: #64748b;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --accent: #0f766e;
  --accent-hover: #0d9488;
  --accent-soft: #ecfdf8;
  --accent-ring: rgba(15, 118, 110, 0.22);
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --ok: #15803d;
  --ok-soft: #f0fdf4;
  --warn-soft: #fffbeb;
  --warn: #b45309;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.1);
  --radius: 14px;
  --radius-sm: 10px;
  --font: "Estedad", "Segoe UI", Tahoma, sans-serif;
  --sidebar-w: 260px;
  --scrollbar-size: 10px;
  --scrollbar-track: #eef2f6;
  --scrollbar-thumb: #94a8b8;
  --scrollbar-thumb-hover: #0f766e;
}

@font-face {
  font-family: "Estedad";
  src: url("/fonts/Estedad-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Estedad";
  src: url("/fonts/Estedad-Medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Estedad";
  src: url("/fonts/Estedad-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Estedad";
  src: url("/fonts/Estedad-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

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

[hidden],
.is-hidden {
  display: none !important;
}

html, body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  font-family: var(--font);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

/* Themed scrollbars (Firefox + WebKit) */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

*::-webkit-scrollbar {
  width: var(--scrollbar-size);
  height: var(--scrollbar-size);
}

*::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #a8bac8 0%, var(--scrollbar-thumb) 100%);
  border-radius: 999px;
  border: 2px solid var(--scrollbar-track);
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--accent-hover) 0%, var(--scrollbar-thumb-hover) 100%);
  border: 2px solid var(--scrollbar-track);
  background-clip: padding-box;
}

*::-webkit-scrollbar-corner {
  background: transparent;
}

.sidebar,
.chat-sidebar,
.chat-inbox,
.chat-user-suggest {
  --scrollbar-track: rgba(148, 163, 184, 0.08);
  --scrollbar-thumb: rgba(148, 163, 184, 0.38);
  --scrollbar-thumb-hover: rgba(45, 212, 191, 0.65);
}

.sidebar::-webkit-scrollbar-thumb,
.chat-sidebar::-webkit-scrollbar-thumb,
.chat-inbox::-webkit-scrollbar-thumb,
.chat-user-suggest::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-color: transparent;
}

.sidebar::-webkit-scrollbar-thumb:hover,
.chat-sidebar::-webkit-scrollbar-thumb:hover,
.chat-inbox::-webkit-scrollbar-thumb:hover,
.chat-user-suggest::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
  border-color: transparent;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ========== App shell (SaaS sidebar) ========== */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background:
    radial-gradient(520px 280px at 100% 0%, rgba(20, 184, 166, 0.14), transparent 55%),
    linear-gradient(180deg, #0b1220 0%, #0d1524 55%, #0a101c 100%);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0.85rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  width: var(--sidebar-w);
  max-width: 100%;
  overflow: auto;
  flex-shrink: 0;
  z-index: 30;
  border-inline-end: 1px solid rgba(148, 163, 184, 0.1);
}
.sidebar-top {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.65rem 1.05rem;
  color: #fff;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin: 0 0.15rem 0.85rem;
}
.sidebar-brand:hover { color: #fff; text-decoration: none; }
.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #2dd4bf, #0f766e);
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 8px 18px rgba(15, 118, 110, 0.35);
  position: relative;
}
.brand-mark__glyph {
  width: 16px;
  height: 16px;
  border: 2px solid #fff;
  border-radius: 4px;
  box-shadow: 4px 4px 0 rgba(255, 255, 255, 0.35);
}
.brand-text { display: grid; gap: 0.12rem; min-width: 0; }
.brand-text strong {
  font-size: 0.98rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.brand-text span {
  font-size: 0.74rem;
  color: var(--sidebar-muted);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0 0.15rem;
}
.nav-group {
  display: grid;
  gap: 0.2rem;
}
.nav-section {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  padding: 0.15rem 0.8rem 0.45rem;
  font-weight: 700;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.68rem 0.8rem;
  border-radius: 11px;
  color: #cbd5e1;
  font-size: 0.92rem;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  border: 1px solid transparent;
}
.nav-link:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  text-decoration: none;
}
.nav-link.is-active {
  background: rgba(20, 184, 166, 0.12);
  color: #fff;
  border-color: rgba(45, 212, 191, 0.22);
  box-shadow: inset 3px 0 0 #2dd4bf;
}
.nav-link__label { min-width: 0; }
.nav-ico {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.04);
  color: #94a3b8;
  flex-shrink: 0;
  position: relative;
}
.nav-link:hover .nav-ico,
.nav-link.is-active .nav-ico {
  background: rgba(45, 212, 191, 0.14);
  color: #5eead4;
}
.nav-ico::before,
.nav-ico::after {
  content: "";
  position: absolute;
  box-sizing: border-box;
}
.nav-ico--files::before {
  width: 12px;
  height: 10px;
  border: 1.5px solid currentColor;
  border-radius: 2px;
  box-shadow: 3px -3px 0 -1px currentColor;
}
.nav-ico--chat::before {
  width: 12px;
  height: 9px;
  border: 1.5px solid currentColor;
  border-radius: 3px 3px 3px 1px;
  top: 8px;
  left: 6px;
}
.nav-ico--chat::after {
  width: 9px;
  height: 7px;
  border: 1.5px solid currentColor;
  border-radius: 2px 2px 1px 2px;
  opacity: 0.7;
  top: 12px;
  right: 6px;
}
.nav-ico--users::before {
  width: 7px;
  height: 7px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  top: 6px;
}
.nav-ico--users::after {
  width: 12px;
  height: 6px;
  border: 1.5px solid currentColor;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  bottom: 6px;
}
.nav-ico--settings::before {
  width: 12px;
  height: 12px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2.5px transparent;
}
.nav-ico--settings::after {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}
.nav-ico--guest::before {
  width: 10px;
  height: 10px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  border-top-color: transparent;
  animation: none;
}
.nav-ico--guest::after {
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: currentColor;
  top: 8px;
}
.nav-ico--install::before {
  width: 11px;
  height: 9px;
  border: 1.5px solid currentColor;
  border-radius: 2px;
  top: 9px;
  left: 6px;
}
.nav-ico--install::after {
  width: 1.5px;
  height: 8px;
  background: currentColor;
  top: 4px;
  left: 11px;
  box-shadow:
    -3px 3px 0 -0.2px currentColor,
    3px 3px 0 -0.2px currentColor;
}
.nav-link__badge {
  margin-inline-start: auto;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: #f43f5e;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
}

.sidebar-foot {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.95rem 0.35rem 0.15rem;
  display: grid;
  gap: 0.65rem;
  flex-shrink: 0;
}
.user-card {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: center;
  padding: 0.65rem 0.7rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #14b8a6, #0ea5e9);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: 0 6px 14px rgba(14, 165, 233, 0.22);
}
.user-meta {
  min-width: 0;
  display: grid;
  gap: 0.1rem;
  text-align: start;
  direction: rtl;
}
.user-meta strong {
  display: block;
  color: #fff;
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: start;
}
.user-meta__handle {
  display: block;
  color: var(--sidebar-muted);
  font-size: 0.74rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: start;
  direction: rtl;
  unicode-bidi: isolate;
}
.user-role {
  padding: 0.22rem 0.5rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid transparent;
}
.user-role.is-admin {
  background: rgba(251, 191, 36, 0.12);
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.22);
}
.user-role.is-member {
  background: rgba(45, 212, 191, 0.12);
  color: #5eead4;
  border-color: rgba(45, 212, 191, 0.22);
}
.user-role.is-guest {
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
  border-color: rgba(148, 163, 184, 0.2);
}
.sidebar-logout { margin: 0; }
.sidebar-logout__btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.62rem 0.8rem;
  border-radius: 11px;
  border: 1px solid rgba(248, 113, 113, 0.18);
  background: rgba(248, 113, 113, 0.06);
  color: #fca5a5;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.sidebar-logout__btn:hover {
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.32);
  color: #fecaca;
}
.sidebar-logout__ico {
  width: 14px;
  height: 14px;
  display: inline-block;
  position: relative;
}
.sidebar-logout__ico::before {
  content: "";
  position: absolute;
  inset: 1px 0 1px 2px;
  border: 1.5px solid currentColor;
  border-inline-start: 0;
  border-radius: 0 3px 3px 0;
}
.sidebar-logout__ico::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  width: 8px;
  height: 1.5px;
  background: currentColor;
  transform: translateY(-50%);
  box-shadow: 5px -3px 0 -0.5px currentColor, 5px 3px 0 -0.5px currentColor;
}

.app-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.topbar-mobile {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}
.nav-backdrop {
  display: none;
}
.content {
  flex: 1;
  padding: 1.75rem 1.75rem 2.5rem;
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
}
.content:has(.chat-app) {
  max-width: 1360px;
  padding-top: 1rem;
  padding-bottom: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.app-footer {
  padding: 1rem 1.75rem;
  color: var(--muted);
  font-size: 0.82rem;
  border-top: 1px solid var(--border);
  background: transparent;
}

/* ========== Auth (marketing split) ========== */
.auth-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
}
.auth-panel {
  position: relative;
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #e8eef7;
  background:
    radial-gradient(800px 500px at 20% 10%, rgba(20, 184, 166, 0.28), transparent 55%),
    radial-gradient(700px 400px at 90% 80%, rgba(14, 165, 233, 0.18), transparent 50%),
    linear-gradient(165deg, #0b1220 0%, #111827 55%, #0f172a 100%);
  overflow: hidden;
}
.auth-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse at 30% 20%, black, transparent 70%);
  pointer-events: none;
}
.auth-panel-inner {
  position: relative;
  z-index: 1;
  width: min(100%, 34rem);
  margin-inline: auto;
}
.auth-panel-foot {
  position: absolute;
  inset-inline: 2.5rem;
  bottom: 2rem;
  z-index: 1;
  color: #64748b;
  font-size: 0.85rem;
  text-align: center;
}
.auth-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.8rem;
  color: #cbd5e1;
  margin-bottom: 1.25rem;
}
.auth-panel h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  line-height: 1.25;
  letter-spacing: -0.03em;
  max-width: 16ch;
}
.auth-panel p {
  margin: 0;
  color: #94a3b8;
  font-size: 1.02rem;
  line-height: 1.7;
  max-width: 36ch;
}
.auth-features {
  list-style: none;
  padding: 0;
  margin: 2rem 0 0;
  display: grid;
  gap: 0.75rem;
}
.auth-features li {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  color: #cbd5e1;
  font-size: 0.92rem;
}
.auth-features li span {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(20, 184, 166, 0.2);
  color: #5eead4;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.auth-form-side {
  display: grid;
  place-items: center;
  padding: 2rem 1.25rem;
  background: var(--bg);
}
.auth-card {
  width: min(420px, 100%);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2rem 1.75rem;
  box-shadow: var(--shadow-lg);
}
.auth-card h2 {
  margin: 0 0 0.35rem;
  font-size: 1.45rem;
  letter-spacing: -0.02em;
}
.auth-card .lead {
  margin: 0 0 1.5rem;
  color: var(--muted);
  line-height: 1.6;
}
.auth-switch {
  text-align: center;
  margin-top: 1.25rem;
  color: var(--muted);
  font-size: 0.92rem;
}

/* ========== Content primitives ========== */
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.page-head h1 {
  margin: 0 0 0.3rem;
  font-size: clamp(1.4rem, 2vw, 1.75rem);
  letter-spacing: -0.03em;
  font-weight: 700;
}
.page-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  max-width: 40rem;
}

.segment-tabs {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.28rem;
  border-radius: 12px;
  background: #e8eef5;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.segment-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.15rem;
  padding: 0.4rem 0.95rem;
  border-radius: 9px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}
.segment-tab:hover {
  color: var(--text);
  text-decoration: none;
}
.segment-tab.is-active {
  background: #fff;
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}

.card-title {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 600;
}

.field { margin-bottom: 0.95rem; }
label {
  display: block;
  margin: 0 0 0.4rem;
  color: var(--text-secondary);
  font-size: 0.86rem;
  font-weight: 500;
}
.input, .select, textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--text);
  font: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
  line-height: 1.35;
  min-height: 2.85rem;
  /* Chevron sits on the physical left; pad that side for RTL. */
  padding: 0.7rem 0.95rem 0.7rem 2.55rem;
  background-color: #fff;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--accent) 50%),
    linear-gradient(135deg, var(--accent) 50%, transparent 50%),
    linear-gradient(to right, transparent 0, transparent 100%);
  background-position:
    calc(0.95rem + 3px) calc(50% - 2px),
    0.95rem calc(50% - 2px),
    0 0;
  background-size:
    6px 6px,
    6px 6px,
    100% 100%;
  background-repeat: no-repeat;
  box-shadow: var(--shadow-sm);
}
.select:hover {
  border-color: #99f6e4;
  background-color: #f8fffd;
}
.input:focus, .select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-ring);
}
.select:focus {
  background-color: #fff;
}
.select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background-color: #f8fafc;
}
.select option {
  color: var(--text);
  background: #fff;
  padding: 0.4rem;
}
/* Firefox: hide native arrow so custom chevron shows */
.select::-moz-focus-inner { border: 0; }
.select:-moz-focusring { color: transparent; text-shadow: 0 0 0 var(--text); }
textarea { min-height: 110px; resize: vertical; }
.field-error { color: var(--danger); font-size: 0.82rem; margin-top: 0.3rem; display: block; }
.hint { color: var(--muted); font-size: 0.82rem; margin-top: 0.35rem; line-height: 1.5; }
.muted { color: var(--muted); }
.stack > * + * { margin-top: 0.85rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 0.65rem 1.05rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
  box-shadow: 0 1px 2px rgba(15, 118, 110, 0.2);
}
.btn:hover {
  background: var(--accent-hover);
  color: #fff;
  text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn-secondary {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover {
  background: #f8fafc;
  color: var(--text);
}
.btn-danger {
  background: var(--danger);
  box-shadow: none;
}
.btn-ghost {
  background: transparent;
  color: var(--sidebar-text);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: none;
  width: 100%;
}
.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}
.btn-sm {
  padding: 0.4rem 0.7rem;
  font-size: 0.82rem;
  border-radius: 8px;
}
.btn-block { width: 100%; }
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
  align-items: center;
}
.inline-form { display: inline; margin: 0; }

.alert {
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
  font-size: 0.92rem;
}
.alert-success {
  background: var(--ok-soft);
  border-color: #bbf7d0;
  color: var(--ok);
}
.alert-error {
  background: var(--danger-soft);
  border-color: #fecaca;
  color: var(--danger);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.files-grid {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.15rem;
}

.owners-panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 1rem;
}
.owners-panel__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1.1rem 1.15rem 0.85rem;
}
.owners-panel__head h2 {
  margin: 0 0 0.25rem;
  font-size: 1.1rem;
}
.owners-panel__head p { margin: 0; }
.owners-panel__badge {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  border: 1px solid #99f6e4;
  white-space: nowrap;
}
.owners-panel__toolbar {
  padding: 0 1.15rem 1rem;
}
.owners-panel__search {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  max-width: 28rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #f8fafc;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.owners-panel__search:focus-within {
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-ring);
}
.owners-panel__search-icon {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
}
.owners-panel__search-input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
}
.owners-panel__search-input::placeholder { color: #94a3b8; }
.owners-panel__empty {
  margin: 0;
  padding: 1.5rem 1.15rem 1.75rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
}
.owners-list__head,
.owner-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) 5.75rem 6.25rem;
  gap: 0.85rem;
  align-items: center;
  padding: 0.85rem 1.15rem;
}
.owners-list__head {
  background: #f8fafc;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}
.owners-list__col-user,
.owners-list__col-username,
.owner-row__user,
.owner-row__username {
  text-align: start;
  min-width: 0;
}
.owners-list__col-count,
.owners-list__col-action,
.owner-row__count,
.owner-row__action {
  text-align: center;
  justify-self: center;
}
.owner-row {
  border-bottom: 1px solid var(--border);
  color: inherit;
  text-decoration: none;
  transition: background 0.12s ease;
}
.owner-row.is-hidden,
.owner-row[hidden] {
  display: none !important;
}
.owner-row:last-child { border-bottom: 0; }
.owner-row:hover,
.owner-row:focus-visible {
  background: #f8fffd;
  color: inherit;
  text-decoration: none;
}
.owner-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.owner-row__user {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 0.75rem;
  align-items: center;
  width: 100%;
}
.owner-row__avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 1rem;
  border: 1px solid #99f6e4;
}
.owner-row__identity {
  min-width: 0;
  display: grid;
  gap: 0.12rem;
}
.owner-row__identity strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.98rem;
}
.owner-row__username {
  color: var(--text-secondary);
  font-size: 0.88rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.owner-row__count {
  display: grid;
  justify-items: center;
  gap: 0.05rem;
  padding: 0.35rem 0.5rem;
  border-radius: 10px;
  background: var(--accent-soft);
  border: 1px solid #99f6e4;
  min-width: 3.75rem;
}
.owner-row__count-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.owner-row__count-label {
  font-size: 0.68rem;
  color: var(--muted);
  font-weight: 600;
}
.owner-row__action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 5.5rem;
  padding: 0.45rem 0.7rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.owner-row:hover .owner-row__action,
.owner-row:focus-visible .owner-row__action {
  border-color: #99f6e4;
  background: var(--accent-soft);
  color: var(--accent);
}

@media (max-width: 760px) {
  .owners-list__head { display: none; }
  .owner-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "user count"
      "username username"
      "action action";
    gap: 0.65rem 0.75rem;
    padding: 1rem 1.05rem;
  }
  .owner-row__user { grid-area: user; }
  .owner-row__username { grid-area: username; }
  .owner-row__count { grid-area: count; }
  .owner-row__action { grid-area: action; width: 100%; justify-self: stretch; }
}
.owner-files-bar {
  display: grid;
  gap: 0.85rem;
  margin: 0 0 1rem;
  padding: 1rem 1.15rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.owner-files-bar__crumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--muted);
}
.owner-files-bar__crumb a {
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
}
.owner-files-bar__crumb a:hover { color: var(--accent); }
.owner-files-bar__crumb-sep {
  opacity: 0.45;
  user-select: none;
}
.owner-files-bar__crumb-current {
  color: var(--text);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 16rem;
}
.owner-files-bar__main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}
.owner-files-bar__profile {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 0.85rem;
  align-items: center;
  min-width: 0;
  flex: 1;
}
.owner-files-bar__avatar {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 1.15rem;
  border: 1px solid #99f6e4;
}
.owner-files-bar__text {
  min-width: 0;
  display: grid;
  gap: 0.2rem;
}
.owner-files-bar__text strong {
  font-size: 1.1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.owner-files-bar__sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.45rem;
  color: var(--muted);
  font-size: 0.82rem;
}
.owner-files-bar__sub .dot {
  opacity: 0.45;
  user-select: none;
}
.owner-files-bar__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.owner-files-bar__stat {
  min-width: 4.75rem;
  padding: 0.55rem 0.8rem;
  border-radius: 12px;
  background: var(--accent-soft);
  border: 1px solid #99f6e4;
  text-align: center;
  display: grid;
  gap: 0.1rem;
}
.owner-files-bar__stat strong {
  font-size: 1.15rem;
  color: var(--accent);
  letter-spacing: -0.02em;
}
.owner-files-bar__stat span {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
}
.owner-files-bar__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.owner-files-bar__back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  background: #f8fafc;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.owner-files-bar__back:hover {
  background: var(--accent-soft);
  border-color: #99f6e4;
  color: var(--accent);
  text-decoration: none;
}
.owner-files-bar__back-icon {
  font-size: 0.95rem;
  line-height: 1;
}

@media (max-width: 640px) {
  .owner-files-bar__main { align-items: stretch; }
  .owner-files-bar__stats,
  .owner-files-bar__actions { width: 100%; }
  .owner-files-bar__stat { flex: 1; }
  .owner-files-bar__back { width: 100%; justify-content: center; }
}

.file-list {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1rem;
}
.file-list__head {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 0.85rem;
  align-items: center;
  padding: 0.7rem 1rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.file-list__head-meta { display: none; }
.file-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 0.85rem;
  align-items: center;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s ease;
}
.file-row:last-child { border-bottom: 0; }
.file-row:hover { background: #fafbfc; }
.file-row__type {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  border: 1px solid transparent;
}
.file-type--default,
.file-row__type.file-type--default {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: #ccfbf1;
}
.file-type--image,
.file-row__type.file-type--image {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #dbeafe;
}
.file-type--pdf,
.file-row__type.file-type--pdf {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}
.file-type--archive,
.file-row__type.file-type--archive {
  background: #fff7ed;
  color: #c2410c;
  border-color: #ffedd5;
}
.file-type--video,
.file-row__type.file-type--video {
  background: #f5f3ff;
  color: #6d28d9;
  border-color: #ede9fe;
}
.file-type--audio,
.file-row__type.file-type--audio {
  background: #fdf4ff;
  color: #a21caf;
  border-color: #fae8ff;
}
.file-type--model,
.file-row__type.file-type--model {
  background: #ecfeff;
  color: #0e7490;
  border-color: #a5f3fc;
}
.file-type--doc,
.file-row__type.file-type--doc {
  background: #eff6ff;
  color: #1e40af;
  border-color: #dbeafe;
}
.file-type--sheet,
.file-row__type.file-type--sheet {
  background: #ecfdf5;
  color: #047857;
  border-color: #d1fae5;
}
.file-type--slide,
.file-row__type.file-type--slide {
  background: #fff7ed;
  color: #ea580c;
  border-color: #ffedd5;
}
.file-row__main { min-width: 0; display: grid; gap: 0.3rem; overflow: hidden; }
.file-row__title {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  max-width: 100%;
}
.file-row__title h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  min-width: 0;
  /* Hug content so the shield tag stays next to the name on the RTL start (right). */
  flex: 0 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  direction: ltr;
  unicode-bidi: isolate;
  /* Keep Latin filenames LTR, but pin them to the RTL start (right). */
  text-align: right;
}
.file-row__title .tag {
  flex-shrink: 0;
}
.file-row__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.45rem;
  color: var(--muted);
  font-size: 0.8rem;
}
.file-row__meta .dot { opacity: 0.45; }
.file-actions {
  display: inline-flex;
  align-items: stretch;
  gap: 0;
  padding: 0.2rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.file-action {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 34px;
  padding: 0.35rem 0.7rem;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s ease, color 0.12s ease;
}
.file-action + .file-action {
  margin-inline-start: 0.1rem;
}
.file-action:hover,
.file-action:focus-visible {
  background: #f1f5f9;
  color: var(--text);
  outline: none;
  text-decoration: none;
}
.file-action--primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(15, 118, 110, 0.2);
}
.file-action--primary:hover,
.file-action--primary:focus-visible {
  background: var(--accent-hover);
  color: #fff;
}
.file-action__ico {
  width: 0.95rem;
  height: 0.95rem;
  flex-shrink: 0;
  position: relative;
  opacity: 0.9;
}
.file-action__ico--preview {
  border: 1.5px solid currentColor;
  border-radius: 999px;
}
.file-action__ico--preview::after {
  content: "";
  position: absolute;
  width: 0.28rem;
  height: 0.28rem;
  border-radius: 999px;
  background: currentColor;
  inset-block-start: 50%;
  inset-inline-start: 50%;
  transform: translate(-50%, -50%);
}
.file-action__ico--download {
  border: 1.5px solid currentColor;
  border-top: 0;
  border-radius: 0 0 3px 3px;
  height: 0.55rem;
  margin-top: 0.35rem;
}
.file-action__ico--download::before {
  content: "";
  position: absolute;
  inset-inline-start: 50%;
  inset-block-end: 100%;
  width: 1.5px;
  height: 0.45rem;
  background: currentColor;
  transform: translateX(-50%);
}
.file-action__ico--download::after {
  content: "";
  position: absolute;
  inset-inline-start: 50%;
  inset-block-end: calc(100% - 1px);
  width: 0;
  height: 0;
  border-inline: 0.28rem solid transparent;
  border-block-start: 0.32rem solid currentColor;
  transform: translateX(-50%);
}
.file-action__ico--share {
  border: 1.5px solid currentColor;
  border-radius: 999px;
  width: 0.55rem;
  height: 0.55rem;
  margin: 0.2rem;
}
.file-action__ico--share::before,
.file-action__ico--share::after {
  content: "";
  position: absolute;
  width: 0.45rem;
  height: 0.45rem;
  border: 1.5px solid currentColor;
  border-radius: 999px;
  background: transparent;
}
.file-action__ico--share::before {
  inset-block-start: -0.28rem;
  inset-inline-end: -0.35rem;
}
.file-action__ico--share::after {
  inset-block-end: -0.28rem;
  inset-inline-end: -0.35rem;
}
.file-action__ico--manage {
  border: 1.5px solid currentColor;
  border-radius: 3px;
}
.file-action__ico--manage::before {
  content: "";
  position: absolute;
  inset: 2px;
  border-block: 1.5px solid currentColor;
  border-radius: 1px;
}
.file-row__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: flex-end;
}

.file-dialog {
  border: 0;
  border-radius: 18px;
  padding: 0;
  width: min(420px, calc(100vw - 1.5rem));
  background: transparent;
  box-shadow: var(--shadow-lg);
}
.file-dialog--manage {
  width: min(480px, calc(100vw - 1.5rem));
}
.file-dialog::backdrop { background: rgba(15, 23, 42, 0.45); }
.file-dialog:not([open]) { display: none !important; }
.file-dialog[open],
.file-dialog.is-open {
  display: block !important;
  margin: auto;
}
.file-dialog__card {
  margin: 0;
  padding: 1.15rem 1.2rem 1.2rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 18px;
}
.file-dialog__head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}
.file-dialog__head strong { font-size: 1.02rem; }
.file-dialog__head p {
  margin: 0.25rem 0 0;
  font-size: 0.84rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 16rem;
}
.file-dialog__foot {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}
.file-dialog__split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.file-dialog__split form { margin: 0; }

.manage-panel {
  padding: 0;
  overflow: hidden;
}
.manage-panel__head {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 0.85rem;
  align-items: center;
  padding: 1.1rem 1.15rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}
.manage-panel__type {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid #99f6e4;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.manage-panel__identity {
  min-width: 0;
  display: grid;
  gap: 0.15rem;
}
.manage-panel__identity strong {
  font-size: 0.95rem;
  color: var(--text);
}
.manage-panel__identity p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.manage-panel__close {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}
.manage-panel__close span {
  width: 12px;
  height: 12px;
  display: block;
  background:
    linear-gradient(currentColor, currentColor) center / 1.5px 100% no-repeat,
    linear-gradient(currentColor, currentColor) center / 100% 1.5px no-repeat;
  transform: rotate(45deg);
}
.manage-panel__close:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.manage-section {
  margin: 0;
  padding: 1.1rem 1.15rem;
  border-bottom: 1px solid var(--border);
  display: grid;
  gap: 0.85rem;
}
.manage-section__head h3 {
  margin: 0 0 0.2rem;
  font-size: 0.92rem;
}
.manage-section__head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}
.manage-section__submit {
  justify-self: start;
}
.manage-section .select {
  width: 100%;
}

.manage-access {
  display: grid;
  gap: 0.45rem;
}
.manage-access__option {
  margin: 0;
  cursor: pointer;
}
.manage-access__option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.manage-access__card {
  display: grid;
  gap: 0.15rem;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.manage-access__title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}
.manage-access__desc {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.45;
}
.manage-access__option:hover .manage-access__card {
  border-color: #99f6e4;
}
.manage-access__option input:focus-visible + .manage-access__card {
  box-shadow: 0 0 0 4px var(--accent-ring);
}
.manage-access__option input:checked + .manage-access__card {
  border-color: #5eead4;
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}

.manage-protect {
  position: relative;
}
.manage-protect__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  flex-wrap: wrap;
}
.manage-protect__row strong {
  display: block;
  font-size: 0.92rem;
  margin-bottom: 0.15rem;
}
.manage-protect__row p {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}
.manage-protect__badge {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: var(--ok-soft);
  color: var(--ok);
  border: 1px solid #bbf7d0;
  font-size: 0.72rem;
  font-weight: 700;
  width: fit-content;
}
.manage-protect.is-on {
  background: linear-gradient(180deg, #f0fdf4 0%, #fff 70%);
}

.manage-danger {
  margin: 0;
  padding: 1.05rem 1.15rem 1.15rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  flex-wrap: wrap;
  background: linear-gradient(180deg, #fef2f2 0%, #fff 75%);
}
.manage-danger__copy strong {
  display: block;
  font-size: 0.9rem;
  color: #b91c1c;
  margin-bottom: 0.12rem;
}
.manage-danger__copy p {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

@media (max-width: 760px) {
  .file-list__head { display: none; }
  .file-row {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 0.7rem;
  }
  .file-actions {
    grid-column: 1 / -1;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(4.5rem, 1fr));
    gap: 0.2rem;
  }
  .file-action {
    width: 100%;
    padding-inline: 0.45rem;
  }
  .file-action__label {
    font-size: 0.72rem;
  }
  .file-row__actions {
    grid-column: 1 / -1;
    justify-content: stretch;
  }
  .file-row__actions .btn { flex: 1; }
  .file-dialog__split { grid-template-columns: 1fr; }
}

.file-meta {
  color: var(--muted);
  font-size: 0.82rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.55rem;
  align-items: center;
}
.file-ext {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  height: 26px;
  padding: 0 0.4rem;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.tag {
  display: inline-flex;
  align-items: center;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #dbeafe;
}
.tag-soft {
  background: #f1f5f9;
  color: #475569;
  border-color: #e2e8f0;
}
.tag-shield {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: #fde68a;
}

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  text-align: right;
  padding: 0.9rem 0.65rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.table tr:hover td { background: #f8fafc; }

.chat-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  max-height: 440px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.chat-item {
  padding: 0.8rem 0.9rem;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid var(--border);
}
.chat-item.mine {
  background: var(--accent-soft);
  border-color: #99f6e4;
}
.chat-item .who {
  font-size: 0.76rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.chat-app {
  --chat-sidebar-w: 320px;
  display: grid;
  grid-template-columns: var(--chat-sidebar-w) minmax(0, 1fr);
  height: min(78vh, 820px);
  min-height: 560px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 0.5rem;
}
.chat-sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: linear-gradient(180deg, #0b1220 0%, #111827 100%);
  color: #e2e8f0;
}
.chat-sidebar__head {
  padding: 1.25rem 1.15rem 0.85rem;
}
.chat-sidebar__head h1 {
  margin: 0 0 0.2rem;
  font-size: 1.2rem;
  color: #fff;
  letter-spacing: -0.02em;
}
.chat-sidebar__head p {
  margin: 0;
  color: #94a3b8;
  font-size: 0.82rem;
}

.chat-search {
  padding: 0 1rem 0.85rem;
  position: relative;
  z-index: 12;
}
.chat-search__field {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.75rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.chat-search__field:focus-within {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(94, 234, 212, 0.45);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.18);
}
.chat-search__ico {
  color: #94a3b8;
  font-size: 0.95rem;
}
.chat-search__input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 0.9rem;
  outline: none;
}
.chat-search__input::placeholder { color: #7b8ba3; }

.chat-user-suggest {
  list-style: none;
  margin: 0.45rem 0 0;
  padding: 0.4rem;
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  box-shadow: var(--shadow-lg);
  max-height: min(320px, 42vh);
  overflow: auto;
  position: absolute;
  inset-inline: 1rem;
  z-index: 20;
  border: 1px solid var(--border);
}
.chat-user-suggest[hidden] {
  display: none !important;
}
.chat-user-suggest__status {
  padding: 0.75rem 0.7rem;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
}
.chat-user-suggest__item {
  margin: 0;
}
.chat-user-suggest__btn {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: start;
  padding: 0.6rem 0.55rem;
  border-radius: 12px;
  cursor: pointer;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: center;
  font: inherit;
  color: inherit;
}
.chat-user-suggest__btn:hover,
.chat-user-suggest__btn.is-active,
.chat-user-suggest__btn:focus-visible {
  background: var(--accent-soft);
  outline: none;
}
.chat-user-suggest__profile {
  min-width: 0;
  display: grid;
  gap: 0.12rem;
}
.chat-user-suggest__name {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-user-suggest__handle {
  color: var(--muted);
  font-size: 0.78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-suggest-badge {
  flex-shrink: 0;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #334155;
  font-size: 0.66rem;
  font-style: normal;
  font-weight: 700;
}
.chat-suggest-badge--admin {
  background: var(--accent-soft);
  border-color: #99f6e4;
  color: var(--accent);
}
.chat-suggest-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #ecfdf8, #f0fdfa);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.95rem;
  border: 1px solid #99f6e4;
}
.chat-user-suggest__cta {
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.12s ease;
}
.chat-user-suggest__btn:hover .chat-user-suggest__cta,
.chat-user-suggest__btn.is-active .chat-user-suggest__cta,
.chat-user-suggest__btn:focus-visible .chat-user-suggest__cta {
  opacity: 1;
}

.chat-section-label,
.chat-inbox-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 1.15rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #7b8ba3;
  text-transform: uppercase;
}
.chat-inbox-count {
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: rgba(20, 184, 166, 0.18);
  color: #5eead4;
  display: inline-grid;
  place-items: center;
  font-size: 0.72rem;
}
.chat-inbox {
  list-style: none;
  margin: 0;
  padding: 0 0.55rem 0.85rem;
  overflow: auto;
  flex: 1;
  display: grid;
  gap: 0.2rem;
  align-content: start;
}
.chat-inbox__empty {
  padding: 1.25rem 0.85rem;
  display: grid;
  gap: 0.35rem;
  color: #94a3b8;
  font-size: 0.86rem;
  line-height: 1.55;
}
.chat-inbox__empty strong {
  color: #e2e8f0;
  font-size: 0.92rem;
}
.chat-inbox__item {
  width: 100%;
  border: 0;
  background: transparent;
  border-radius: 14px;
  padding: 0.7rem 0.65rem;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 0.7rem;
  align-items: center;
  cursor: pointer;
  text-align: start;
  font: inherit;
  color: inherit;
  transition: background 0.15s ease;
}
.chat-inbox__item:hover { background: rgba(255, 255, 255, 0.06); }
.chat-inbox__item.is-active {
  background: rgba(20, 184, 166, 0.14);
  box-shadow: inset 3px 0 0 #14b8a6;
}
.chat-inbox__avatar {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: rgba(20, 184, 166, 0.18);
  color: #5eead4;
  font-weight: 700;
}
.chat-inbox__body {
  min-width: 0;
  display: grid;
  gap: 0.2rem;
}
.chat-inbox__top {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: baseline;
}
.chat-inbox__top strong {
  font-size: 0.92rem;
  color: #f8fafc;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-inbox__top time {
  color: #7b8ba3;
  font-size: 0.72rem;
  flex-shrink: 0;
}
.chat-inbox__preview {
  font-size: 0.8rem;
  color: #94a3b8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background:
    linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}
.chat-main__head {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.9rem 1.15rem;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  z-index: 2;
}
.chat-main__peer {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 0.75rem;
  align-items: center;
  min-width: 0;
  flex: 1;
}
.chat-main__avatar {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #0f766e, #134e4a);
  color: #ecfdf8;
  font-weight: 700;
  font-size: 1.05rem;
  flex-shrink: 0;
  box-shadow: 0 8px 18px rgba(15, 118, 110, 0.2);
}
.chat-main__identity {
  min-width: 0;
  display: grid;
  gap: 0.18rem;
}
.chat-main__title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.55rem;
  min-width: 0;
}
.chat-main__identity strong {
  font-size: 1.02rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}
.chat-main__status {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid #99f6e4;
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 700;
  white-space: nowrap;
}
.chat-main__handle {
  color: var(--muted);
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-inline-start: auto;
  flex-shrink: 0;
}
.chat-admin-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-secondary);
  border-radius: 10px;
  padding: 0.4rem 0.65rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.chat-admin-btn:hover:not(:disabled) {
  background: #f8fafc;
  border-color: var(--border-strong);
  color: var(--text);
}
.chat-admin-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.chat-admin-btn--danger {
  color: var(--danger);
  border-color: #fecaca;
  background: var(--danger-soft);
}
.chat-admin-btn--danger:hover:not(:disabled) {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #b91c1c;
}
.chat-admin-btn__ico {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 2px;
  background: currentColor;
  opacity: 0.55;
}
.chat-bubble__meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.2rem;
  margin-top: 0.35rem;
}
.chat-ticks {
  display: inline-flex;
  align-items: center;
  gap: 0;
  margin-inline-start: 0.15rem;
  color: rgba(15, 23, 42, 0.45);
  line-height: 1;
  transition: color 0.15s ease;
}
.chat-bubble.is-mine .chat-ticks {
  color: rgba(255, 255, 255, 0.55);
}
.chat-ticks.is-seen {
  color: #38bdf8;
}
.chat-bubble.is-mine .chat-ticks.is-seen {
  color: #7dd3fc;
}
.chat-ticks__mark {
  display: inline-block;
  width: 0.38rem;
  height: 0.65rem;
  border: solid currentColor;
  border-width: 0 1.7px 1.7px 0;
  transform: rotate(45deg);
  margin-inline-end: -0.08rem;
  box-sizing: border-box;
}
.chat-ticks__mark + .chat-ticks__mark {
  margin-inline-start: 0.02rem;
}
.chat-msg-menu {
  position: relative;
  flex-shrink: 0;
}
.chat-msg-menu__toggle {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}
.chat-msg-menu__toggle:hover,
.chat-msg-menu.is-open .chat-msg-menu__toggle {
  background: rgba(15, 23, 42, 0.06);
  color: var(--text);
}
.chat-bubble.is-mine .chat-msg-menu__toggle {
  color: rgba(255, 255, 255, 0.72);
}
.chat-bubble.is-mine .chat-msg-menu__toggle:hover,
.chat-bubble.is-mine .chat-msg-menu.is-open .chat-msg-menu__toggle {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}
.chat-msg-menu__toggle span,
.chat-msg-menu__toggle span::before,
.chat-msg-menu__toggle span::after {
  content: "";
  width: 3.5px;
  height: 3.5px;
  border-radius: 999px;
  background: currentColor;
  display: block;
  box-shadow: 0 -5px 0 currentColor, 0 5px 0 currentColor;
}
.chat-msg-menu__toggle span::before,
.chat-msg-menu__toggle span::after {
  display: none;
}
.chat-msg-menu__panel {
  position: absolute;
  bottom: calc(100% + 4px);
  inset-inline-end: 0;
  min-width: 8.5rem;
  padding: 0.3rem;
  border-radius: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: 20;
  display: grid;
  gap: 0.15rem;
}
.chat-msg-menu__panel[hidden] {
  display: none !important;
}
.chat-msg-menu__item {
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: start;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}
.chat-msg-menu__item:hover {
  background: var(--accent-soft);
  color: var(--accent);
}
.chat-msg-menu__item--danger {
  color: var(--danger);
}
.chat-msg-menu__item--danger:hover {
  background: rgba(185, 28, 28, 0.08);
  color: var(--danger);
}

.chat-main__empty {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: grid;
  place-items: center;
  padding: 1.5rem 1.25rem;
  background:
    radial-gradient(ellipse 70% 55% at 50% 40%, rgba(15, 118, 110, 0.06), transparent 70%);
}
.chat-idle {
  width: min(100%, 22rem);
  text-align: center;
  display: grid;
  justify-items: center;
  gap: 0.55rem;
}
.chat-idle__mark {
  width: 4.25rem;
  height: 4.25rem;
  margin-bottom: 0.35rem;
  border-radius: 1.35rem;
  background:
    linear-gradient(145deg, rgba(15, 118, 110, 0.14), rgba(15, 118, 110, 0.04)),
    #fff;
  border: 1px solid #ccfbf1;
  box-shadow: var(--shadow-sm);
  position: relative;
}
.chat-idle__mark::before,
.chat-idle__mark::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  background: var(--accent);
  opacity: 0.55;
}
.chat-idle__mark::before {
  width: 1.55rem;
  height: 1.55rem;
  top: 1.15rem;
  inset-inline-start: 1.15rem;
}
.chat-idle__mark::after {
  width: 1.1rem;
  height: 1.1rem;
  bottom: 1.05rem;
  inset-inline-end: 1.05rem;
  opacity: 0.28;
}
.chat-idle h2 {
  margin: 0;
  font-size: 1.12rem;
  letter-spacing: -0.02em;
  color: var(--text);
}
.chat-idle p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
  font-size: 0.9rem;
}

.chat-messages {
  flex: 1;
  overflow: auto;
  padding: 1.25rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(148, 163, 184, 0.18) 1px, transparent 0);
  background-size: 18px 18px;
}
.chat-thread-start {
  margin: auto;
  width: min(100%, 20rem);
  text-align: center;
  display: grid;
  justify-items: center;
  gap: 0.45rem;
  padding: 1.5rem 1.1rem;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
}
.chat-thread-start__avatar {
  width: 3.5rem;
  height: 3.5rem;
  margin-bottom: 0.25rem;
  border-radius: 1.1rem;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #0f766e, #134e4a);
  color: #ecfdf8;
  font-size: 1.25rem;
  font-weight: 700;
  box-shadow: 0 10px 22px rgba(15, 118, 110, 0.22);
}
.chat-thread-start strong {
  font-size: 1.05rem;
  color: var(--text);
}
.chat-thread-start p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.65;
}
.chat-messages__empty {
  margin: auto;
  text-align: center;
}
.chat-bubble {
  max-width: min(78%, 460px);
  padding: 0.7rem 0.85rem 0.5rem;
  border-radius: 18px 18px 18px 8px;
  background: #fff;
  border: 1px solid var(--border);
  align-self: flex-start;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.chat-bubble.is-mine {
  align-self: flex-end;
  background: linear-gradient(165deg, #0f766e 0%, #0f766e 40%, #0d9488 100%);
  border-color: transparent;
  color: #fff;
  border-radius: 18px 18px 8px 18px;
  box-shadow: 0 8px 18px rgba(15, 118, 110, 0.18);
}
.chat-bubble__who {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.2rem;
}
.chat-bubble.is-mine .chat-bubble__who { color: rgba(255, 255, 255, 0.85); }
.chat-bubble__text {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.55;
  font-size: 0.92rem;
}
.chat-bubble__time {
  display: block;
  font-size: 0.68rem;
  color: var(--muted);
  text-align: end;
}
.chat-bubble.is-mine .chat-bubble__time { color: rgba(255, 255, 255, 0.72); }

.chat-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.45rem;
  padding: 0.45rem 0.65rem;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid var(--border);
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  max-width: 100%;
}
.chat-bubble.is-mine .chat-file-chip {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}
.chat-file-chip:hover { border-color: #99f6e4; }
.chat-file-chip.is-locked {
  color: var(--muted);
  font-weight: 500;
}
.chat-bubble.is-mine .chat-file-chip.is-locked { color: rgba(255, 255, 255, 0.8); }
.chat-file-chip em {
  font-style: normal;
  font-size: 0.7rem;
  opacity: 0.85;
}
.chat-file-chip__ico {
  width: 0.85rem;
  height: 0.95rem;
  border-radius: 2px;
  background: currentColor;
  opacity: 0.45;
  flex-shrink: 0;
}

.chat-composer {
  border-top: 1px solid var(--border);
  padding: 0.75rem 1rem 0.85rem;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
}
.chat-attach-bar {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.55rem;
  padding: 0.55rem 0.7rem;
  border-radius: 12px;
  background: var(--accent-soft);
  border: 1px solid #99f6e4;
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 600;
}
.chat-attach-bar.is-hidden,
.chat-attach-bar[hidden] {
  display: none !important;
}
.chat-attach-bar__ico {
  width: 0.85rem;
  height: 0.95rem;
  border-radius: 2px;
  background: currentColor;
  opacity: 0.55;
  flex-shrink: 0;
}
.chat-attach-bar__clear {
  margin-inline-start: auto;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
}
.chat-composer__shell {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.45rem;
  align-items: end;
  padding: 0.45rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.chat-composer__shell:focus-within {
  border-color: #99f6e4;
  box-shadow: 0 0 0 4px var(--accent-ring);
}
.chat-composer__input {
  border: 0;
  outline: none;
  resize: none;
  min-height: 42px;
  max-height: 140px;
  padding: 0.6rem 0.35rem;
  font: inherit;
  line-height: 1.45;
  background: transparent;
  width: 100%;
}
.chat-composer__hint {
  margin: 0.45rem 0.15rem 0;
  color: #94a3b8;
  font-size: 0.72rem;
}
.chat-icon-btn {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 12px;
  background: #f1f5f9;
  color: var(--text-secondary);
  font: inherit;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.chat-icon-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
}
.chat-icon-btn__clip {
  width: 0.95rem;
  height: 1.05rem;
  border: 2px solid currentColor;
  border-radius: 3px;
  opacity: 0.85;
  transform: rotate(-12deg);
}
.chat-send {
  border: 0;
  border-radius: 12px;
  min-height: 42px;
  padding: 0 1.1rem;
  background: linear-gradient(180deg, #0d9488 0%, #0f766e 100%);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 16px rgba(15, 118, 110, 0.22);
}
.chat-send:hover { background: var(--accent-hover); }
.chat-send:disabled { opacity: 0.55; cursor: not-allowed; }

.chat-attach-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
  padding: 0.45rem 0.55rem 0.45rem 0.75rem;
  border-radius: 12px;
  background: var(--accent-soft);
  border: 1px solid #99f6e4;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--accent);
}

.chat-file-dialog {
  border: 0;
  border-radius: 18px;
  padding: 0;
  width: min(520px, calc(100vw - 1.5rem));
  max-width: calc(100vw - 1.5rem);
  background: transparent;
  box-shadow: none;
  overflow: hidden;
}
.chat-file-dialog::backdrop {
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
}
.chat-file-dialog:not([open]) { display: none !important; }
.chat-file-dialog[open] {
  display: block !important;
  margin: auto;
}
.chat-file-dialog__card {
  margin: 0;
  display: flex;
  flex-direction: column;
  max-height: min(72vh, 640px);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.chat-file-dialog__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 1.05rem 1.15rem 0.85rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
  flex-shrink: 0;
}
.chat-file-dialog__intro {
  min-width: 0;
}
.chat-file-dialog__intro strong {
  display: block;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: var(--text);
}
.chat-file-dialog__intro p {
  margin: 0.28rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
}
.chat-file-dialog__close {
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  padding: 0;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.chat-file-dialog__close:hover {
  background: #f8fafc;
  border-color: var(--border-strong);
  color: var(--text);
}
.chat-file-dialog__close span,
.chat-file-dialog__close span::before {
  display: block;
  width: 12px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transform: rotate(45deg);
  position: relative;
}
.chat-file-dialog__close span::before {
  content: "";
  position: absolute;
  inset: 0;
  transform: rotate(90deg);
}
.chat-file-dialog__toolbar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-file-dialog__search {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.7rem;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid var(--border);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.chat-file-dialog__search:focus-within {
  background: #fff;
  border-color: #99f6e4;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}
.chat-file-dialog__search-ico {
  color: var(--muted);
  font-size: 0.95rem;
  flex-shrink: 0;
  line-height: 1;
}
.chat-file-dialog__search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  outline: none;
}
.chat-file-dialog__search input::placeholder { color: #94a3b8; }
.chat-file-dialog__count {
  flex-shrink: 0;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--muted);
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.28rem 0.55rem;
  white-space: nowrap;
}
.chat-file-picker {
  list-style: none;
  margin: 0;
  padding: 0.45rem;
  overflow: auto;
  flex: 1;
  min-height: 12rem;
  max-height: none;
  display: grid;
  align-content: start;
  gap: 0.3rem;
}
.chat-file-picker__item {
  margin: 0;
  min-width: 0;
}
.chat-file-picker__btn {
  width: 100%;
  max-width: 100%;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 12px;
  padding: 0.55rem 0.6rem;
  text-align: start;
  cursor: pointer;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 0.7rem;
  align-items: center;
  font: inherit;
  color: inherit;
  transition: background 0.12s ease, border-color 0.12s ease;
  overflow: hidden;
}
.chat-file-picker__btn:hover,
.chat-file-picker__btn:focus-visible {
  background: #f8fafc;
  border-color: var(--border);
  outline: none;
}
.chat-file-picker__btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}
.chat-file-picker__type {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  flex-shrink: 0;
}
.chat-file-picker__body {
  min-width: 0;
  display: grid;
  gap: 0.18rem;
  overflow: hidden;
}
.chat-file-picker__name {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  direction: ltr;
  unicode-bidi: isolate;
  text-align: left;
}
.chat-file-picker__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.4rem;
  font-size: 0.75rem;
  color: var(--muted);
  min-width: 0;
}
.chat-file-picker__meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.chat-file-picker__action {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  opacity: 0.65;
  transition: opacity 0.12s ease;
  white-space: nowrap;
  padding-inline: 0.15rem;
}
@media (hover: hover) and (pointer: fine) {
  .chat-file-picker__action { opacity: 0; }
  .chat-file-picker__btn:hover .chat-file-picker__action,
  .chat-file-picker__btn:focus-visible .chat-file-picker__action {
    opacity: 1;
  }
}
.chat-file-picker__status {
  padding: 2.5rem 1.25rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.6;
  display: grid;
  gap: 0.35rem;
  justify-items: center;
}
.chat-file-picker__status strong {
  color: var(--text-secondary);
  font-size: 0.95rem;
}
.chat-file-picker__status-mark {
  width: 2.75rem;
  height: 2.75rem;
  margin-bottom: 0.35rem;
  border-radius: 14px;
  background:
    linear-gradient(145deg, rgba(15, 118, 110, 0.12), rgba(15, 118, 110, 0.04));
  border: 1px solid #99f6e4;
  position: relative;
}
.chat-file-picker__status-mark::before {
  content: "";
  position: absolute;
  inset: 30% 34%;
  border-radius: 3px;
  background: var(--accent);
  opacity: 0.45;
  box-shadow: 4px -3px 0 -1px rgba(15, 118, 110, 0.25);
}

.thread-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.45rem;
}
.thread-list a {
  display: block;
  padding: 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.thread-list a:hover,
.thread-list a.is-active {
  border-color: #99f6e4;
  background: var(--accent-soft);
  text-decoration: none;
}

.split {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1rem;
}

.drop {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 2.25rem 1.25rem;
  text-align: center;
  color: var(--muted);
  background: linear-gradient(180deg, #f8fffc 0%, #fff 70%);
  cursor: pointer;
  display: grid;
  justify-items: center;
  gap: 0.55rem;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.drop:hover,
.file-drop.is-dragover {
  border-color: #2dd4bf;
  background: linear-gradient(180deg, #ecfdf8 0%, #fff 75%);
  box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.12);
}
.drop-icon {
  width: 56px;
  height: 56px;
  margin: 0;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.35rem;
}
.file-input-native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.file-drop {
  position: relative;
}
.file-drop-title {
  color: var(--text);
  font-size: 1.05rem;
}
.file-drop-hint {
  margin: 0;
  max-width: 28rem;
}
.file-drop-btn {
  margin-top: 0.35rem;
  pointer-events: none;
}
.file-drop-names {
  display: block;
  margin-top: 0.35rem;
  max-width: 36rem;
  font-size: 0.86rem;
  line-height: 1.5;
  word-break: break-word;
}
.file-drop.has-files {
  border-style: solid;
  border-color: #99f6e4;
}
.file-drop.has-files .file-drop-names {
  color: var(--accent);
  font-weight: 600;
}
.file-drop.is-uploading {
  pointer-events: none;
  opacity: 0.72;
}
.upload-file-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}
.upload-file-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.65rem;
  align-items: center;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}
.upload-file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.9rem;
}
.upload-progress {
  display: none;
  gap: 0.45rem;
}
.upload-progress.is-active {
  display: grid;
}
.upload-progress[hidden] {
  display: none !important;
}
.upload-progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
}
.upload-progress-track {
  height: 10px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}
.upload-progress-bar {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #0d9488, #2dd4bf);
  transition: width 0.12s ease;
}
.upload-progress-eta {
  font-size: 0.84rem;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0.4rem 0;
}
.checkbox-row label { margin: 0; color: var(--text); }

.empty-state {
  text-align: center;
  padding: 2.75rem 1.25rem;
}
.empty-state h3 { margin: 0 0 0.4rem; }
.empty-state p { margin: 0; color: var(--muted); }
.empty-state .actions { justify-content: center; }

.guest-card {
  max-width: 520px;
  margin: 1.5rem auto;
  text-align: center;
  padding: 2.25rem 1.5rem;
}
.guest-card .brand-mark {
  margin: 0 auto 1rem;
  width: 52px;
  height: 52px;
}

.filter-row {
  display: flex;
  gap: 0.75rem;
  align-items: end;
  flex-wrap: wrap;
}
.filter-row .select { min-width: 240px; }

/* ========== Users admin ========== */
.users-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1rem;
}
.users-stat {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 0.35rem;
}
.users-stat__label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}
.users-stat strong {
  font-size: 1.45rem;
  letter-spacing: -0.03em;
  color: var(--text);
}
.users-stat--warn { border-color: #fde68a; background: linear-gradient(180deg, #fffbeb 0%, #fff 70%); }
.users-stat--warn strong { color: var(--warn); }
.users-stat--ok { border-color: #bbf7d0; background: linear-gradient(180deg, #f0fdf4 0%, #fff 70%); }
.users-stat--ok strong { color: var(--ok); }
.users-stat--accent { border-color: #99f6e4; background: linear-gradient(180deg, #ecfdf8 0%, #fff 70%); }
.users-stat--accent strong { color: var(--accent); }

.users-panel { padding: 0; overflow: hidden; }
.users-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}
.users-filters {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  padding: 0.25rem;
  border-radius: 12px;
  background: #e8eef5;
  border: 1px solid var(--border);
}
.users-filter {
  border: 0;
  background: transparent;
  border-radius: 9px;
  padding: 0.45rem 0.8rem;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.users-filter.is-active {
  background: #fff;
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.users-filter__badge {
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
  font-size: 0.72rem;
  display: inline-grid;
  place-items: center;
}
.users-search { flex: 1; min-width: 200px; max-width: 320px; }
.users-search .input { margin: 0; }

.users-list { display: grid; gap: 0; }
.user-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--border);
}
.user-row:last-of-type { border-bottom: 0; }
.user-row:hover { background: #fafbfc; }
.user-row.is-self {
  background: linear-gradient(180deg, #f8fffd 0%, #fff 70%);
}
.user-row.is-self:hover { background: linear-gradient(180deg, #f3fffb 0%, #fafbfc 70%); }
.user-row__main {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 0.85rem;
  align-items: center;
  min-width: 0;
  flex: 1;
}
.user-row__avatar {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 1.05rem;
}
.user-row__info { min-width: 0; display: grid; gap: 0.3rem; }
.user-row__title {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}
.user-row__title strong { font-size: 0.98rem; }
.user-row__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.45rem;
  color: var(--muted);
  font-size: 0.82rem;
}
.user-row__meta .dot { opacity: 0.5; }
.user-row__roles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.15rem;
}
.user-row__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  justify-content: flex-end;
}
.user-row__actions form { margin: 0; }

.role-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  border: 1px solid transparent;
}
.role-pill--admin {
  background: #f5f3ff;
  color: #6d28d9;
  border-color: #ddd6fe;
}
.role-pill--user {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: #99f6e4;
}
.role-pill--guest {
  background: #fff7ed;
  color: #c2410c;
  border-color: #ffedd5;
}
.tag-warn {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

.users-dialog {
  border: 0;
  border-radius: 18px;
  padding: 0;
  width: min(560px, calc(100vw - 1.5rem));
  box-shadow: var(--shadow-lg);
  background: transparent;
}
.users-dialog--roles {
  width: min(440px, calc(100vw - 1.5rem));
}
.users-dialog::backdrop { background: rgba(15, 23, 42, 0.45); }
.users-dialog:not([open]) { display: none !important; }
.users-dialog[open],
.users-dialog.is-open {
  display: block !important;
  margin: auto;
  max-height: calc(100vh - 2rem);
  overflow: auto;
}
.users-dialog__card {
  margin: 0;
  padding: 1.15rem 1.2rem 1.2rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 18px;
}
.users-dialog__head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 0.35rem;
}
.users-dialog__head strong { font-size: 1.05rem; }
.users-dialog__head p { margin: 0.25rem 0 0; font-size: 0.84rem; }
.users-dialog__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}
.users-dialog__grid .field { margin: 0; }
.field-label {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 0.86rem;
  font-weight: 600;
}
.role-checks {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}
.role-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
}
.role-check:has(input:checked) {
  border-color: #99f6e4;
  background: var(--accent-soft);
  color: var(--accent);
}
.role-check input { accent-color: var(--accent); }
.users-dialog__foot {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

/* Roles edit panel */
.roles-panel {
  padding: 0;
  overflow: hidden;
}
.roles-panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1.15rem 1.2rem 1rem;
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(15, 118, 110, 0.1), transparent 55%),
    linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
  border-bottom: 1px solid var(--border);
}
.roles-panel__user {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 0.75rem;
  align-items: center;
  min-width: 0;
}
.roles-panel__avatar {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #0f766e, #134e4a);
  color: #ecfdf8;
  font-weight: 700;
  font-size: 1.15rem;
  box-shadow: 0 8px 18px rgba(15, 118, 110, 0.22);
}
.roles-panel__identity {
  display: grid;
  gap: 0.12rem;
  min-width: 0;
}
.roles-panel__eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--accent);
  text-transform: none;
}
.roles-panel__identity strong {
  font-size: 1.05rem;
  line-height: 1.25;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.roles-panel__identity .muted {
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.roles-panel__close {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}
.roles-panel__close:hover {
  background: #f8fafc;
  color: var(--text);
}
.roles-panel__body {
  padding: 1rem 1.2rem 0.35rem;
  display: grid;
  gap: 0.9rem;
}
.roles-panel__section-head h3 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
}
.roles-panel__section-head p {
  margin: 0.25rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.45;
}
.role-cards {
  display: grid;
  gap: 0.55rem;
}
.role-card {
  position: relative;
  display: grid;
  grid-template-columns: 22px 36px minmax(0, 1fr);
  gap: 0.7rem;
  align-items: center;
  margin: 0;
  padding: 0.85rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.role-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.role-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.role-card__mark {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  border: 1.5px solid var(--border-strong);
  background: #fff;
  position: relative;
  flex-shrink: 0;
}
.role-card__mark::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0.4);
  opacity: 0;
  transition: transform 0.12s ease, opacity 0.12s ease;
}
.role-card__ico {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 0.95rem;
  font-weight: 700;
  background: #f1f5f9;
  color: #475569;
}
.role-card__copy {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}
.role-card__copy strong {
  font-size: 0.92rem;
  color: var(--text);
}
.role-card__copy span {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
}
.role-card--admin .role-card__ico {
  background: #f1f5f9;
  color: #334155;
}
.role-card--user .role-card__ico {
  background: var(--accent-soft);
  color: var(--accent);
}
.role-card--guest .role-card__ico {
  background: #fff7ed;
  color: #c2410c;
}
.role-card:has(input:checked) {
  border-color: #99f6e4;
  background: linear-gradient(180deg, #f0fdfa 0%, #ffffff 100%);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.role-card:has(input:checked) .role-card__mark {
  border-color: var(--accent);
  background: var(--accent);
}
.role-card:has(input:checked) .role-card__mark::after {
  opacity: 1;
  transform: rotate(45deg) scale(1);
}
.role-card--admin:has(input:checked) {
  border-color: #cbd5e1;
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
  box-shadow: 0 0 0 3px rgba(51, 65, 85, 0.1);
}
.role-card--admin:has(input:checked) .role-card__mark {
  border-color: #334155;
  background: #334155;
}
.role-card--guest:has(input:checked) {
  border-color: #fdba74;
  background: linear-gradient(180deg, #fff7ed 0%, #ffffff 100%);
  box-shadow: 0 0 0 3px rgba(194, 65, 12, 0.12);
}
.role-card--guest:has(input:checked) .role-card__mark {
  border-color: #c2410c;
  background: #c2410c;
}
.roles-panel__summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  padding: 0.7rem 0.8rem;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px dashed var(--border);
}
.roles-panel__summary-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
}
.roles-panel__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.roles-panel__chip {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  border: 1px solid transparent;
}
.roles-panel__chip--empty {
  background: transparent;
  color: var(--muted);
  border: 0;
  padding-inline: 0;
  font-weight: 500;
}
.roles-panel__chip--admin {
  background: #f1f5f9;
  color: #334155;
  border-color: #e2e8f0;
}
.roles-panel__chip--user {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: #99f6e4;
}
.roles-panel__chip--guest {
  background: #fff7ed;
  color: #c2410c;
  border-color: #ffedd5;
}
.roles-panel__foot {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.95rem 1.2rem 1.15rem;
  border-top: 1px solid var(--border);
  background: #fafbfc;
}
.users-empty {
  padding: 1.25rem 1.15rem;
  text-align: center;
}

@media (max-width: 900px) {
  .users-stats { grid-template-columns: 1fr 1fr; }
  .users-dialog__grid,
  .role-checks { grid-template-columns: 1fr; }
  .user-row__actions { width: 100%; }
  .user-row__actions .btn { width: 100%; }
  .user-row__actions form { flex: 1; }
}

.share-result-dialog {
  width: min(440px, calc(100vw - 1.5rem));
}
.share-result {
  display: grid;
  gap: 1rem;
  padding: 1.15rem 1.2rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fff;
}
.share-result__head {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}
.share-result__success {
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 12px;
  background: rgba(15, 118, 110, 0.12);
  position: relative;
  flex: 0 0 auto;
}
.share-result__success::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 48%;
  width: 0.42rem;
  height: 0.72rem;
  border-inline-end: 2.2px solid #0f766e;
  border-bottom: 2.2px solid #0f766e;
  transform: translate(-50%, -55%) rotate(40deg);
}
.share-result__titles {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}
.share-result__titles strong {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.3;
}
.share-result__expiry {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  font-size: 0.74rem;
  font-weight: 700;
  color: #57534e;
  background: #fafaf9;
  border: 1px solid #e7e5e4;
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  line-height: 1.3;
}
.share-result__body {
  display: grid;
  gap: 0.4rem;
}
.share-result__label {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
}
.share-result__row {
  display: flex;
  gap: 0.4rem;
  align-items: stretch;
  min-width: 0;
}
.share-result__url {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fafc;
  color: #475569;
  font: inherit;
  font-size: 0.8rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  padding: 0.55rem 0.7rem;
  outline: none;
}
.share-result__url:focus {
  border-color: rgba(15, 118, 110, 0.4);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
  background: #fff;
}
.share-result__copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: 0;
  background: #0f766e;
  color: #fff;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  padding: 0.5rem 0.85rem;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
}
.share-result__copy:hover {
  background: #0d9488;
}
.share-result__copy-ico {
  width: 0.9rem;
  height: 0.9rem;
  position: relative;
  flex: 0 0 auto;
}
.share-result__copy-ico::before {
  content: "";
  position: absolute;
  inset: 0.05rem 0.05rem 0.2rem 0.2rem;
  border: 1.5px solid currentColor;
  border-radius: 2px;
}
.share-result__copy-ico::after {
  content: "";
  position: absolute;
  inset: 0.2rem 0.2rem 0.05rem 0.05rem;
  border: 1.5px solid currentColor;
  border-radius: 2px;
  background: #0f766e;
}
.share-result__copy:hover .share-result__copy-ico::after {
  background: #0d9488;
}
.share-result__foot {
  display: flex;
  justify-content: flex-end;
  padding-top: 0.15rem;
}
.share-result__close {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  padding: 0.5rem 1rem;
  border-radius: 10px;
  cursor: pointer;
}
.share-result__close:hover {
  background: #f8fafc;
  border-color: rgba(15, 118, 110, 0.35);
}
.share-result .hint { margin: 0; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}
.stat {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow-sm);
}
.stat span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 0.35rem;
}
.stat strong {
  font-size: 1.35rem;
  letter-spacing: -0.03em;
}

/* Simple auth top brand when no sidebar */
.auth-only-top {
  display: none;
}

@media (max-width: 980px) {
  .auth-layout { grid-template-columns: 1fr; }
  .auth-panel { display: none; }
  .app-shell { grid-template-columns: minmax(0, 1fr); }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    width: min(86vw, var(--sidebar-w));
    height: 100vh;
    height: 100dvh;
    z-index: 60;
    transition: transform 0.22s ease;
    box-shadow: var(--shadow-lg);
    /* LTR: dock left, hide off-screen to the left */
    left: 0;
    right: auto;
    transform: translateX(-105%);
    pointer-events: none;
  }

  /* RTL: dock right, hide off-screen to the right (NOT toward center) */
  [dir="rtl"] .sidebar {
    left: auto;
    right: 0;
    transform: translateX(105%);
  }

  body.nav-open .sidebar {
    transform: translateX(0);
    pointer-events: auto;
  }

  .nav-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 55;
    border: 0;
    padding: 0;
    cursor: pointer;
  }
  body.nav-open .nav-backdrop {
    display: block;
  }

  .topbar-mobile { display: flex; }
  .content { padding: 1.25rem 1rem 2rem; }
  .split { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr; }

  .chat-app {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
  }
  .chat-sidebar {
    max-height: 38vh;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }
  .chat-main {
    min-height: 52vh;
  }
  .chat-main__head {
    flex-wrap: wrap;
    align-items: flex-start;
  }
  .chat-admin-actions {
    width: 100%;
  }
  .chat-admin-btn {
    flex: 1;
    justify-content: center;
  }
}

/* ========== Settings ========== */
.settings-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1rem;
}
.settings-stat {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 0.25rem;
}
.settings-stat__label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}
.settings-stat strong {
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  text-align: start;
  direction: rtl;
}
.settings-stat__hint {
  color: var(--muted);
  font-size: 0.78rem;
}
.settings-stat--ok { border-color: #bbf7d0; background: linear-gradient(180deg, #f0fdf4 0%, #fff 75%); }
.settings-stat--ok strong { color: var(--ok); }
.settings-stat--warn { border-color: #fde68a; background: linear-gradient(180deg, #fffbeb 0%, #fff 75%); }
.settings-stat--warn strong { color: var(--warn); }

.settings-layout {
  display: grid;
  gap: 1rem;
}
.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 1.15rem;
  padding: 0.3rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  width: fit-content;
  max-width: 100%;
}
.settings-tabs__item {
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 1rem;
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.12s ease, color 0.12s ease;
}
.settings-tabs__item:hover {
  background: #f8fafc;
  color: var(--text);
  text-decoration: none;
}
.settings-tabs__item.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px #99f6e4;
}
.settings-card {
  padding: 0;
  overflow: hidden;
}
.settings-card__head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  padding: 1.15rem 1.25rem 0.85rem;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}
.settings-card__head h2 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
}
.settings-card__head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
}
.settings-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}
.settings-badge.is-on {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}
.settings-badge.is-off {
  background: #f0fdf4;
  color: var(--ok);
  border: 1px solid #bbf7d0;
}

.settings-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem 1.25rem;
  margin: 0;
  cursor: pointer;
}
.settings-toggle--bordered {
  border-bottom: 1px solid var(--border);
}
.settings-toggle__copy {
  min-width: 0;
}
.settings-toggle__copy strong {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.95rem;
}
.settings-toggle__copy p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
}

.settings-form { display: grid; gap: 1rem; }
.settings-blocks {
  display: grid;
  gap: 0;
}
.settings-block {
  padding: 1.2rem 1.25rem 1.3rem;
  border-bottom: 1px solid var(--border);
}
.settings-block:last-child { border-bottom: 0; }
.settings-block__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.95rem;
}
.settings-block__head h3 {
  margin: 0 0 0.2rem;
  font-size: 0.98rem;
}
.settings-block__head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
}
.settings-block__preview {
  display: grid;
  justify-items: start;
  gap: 0.1rem;
  padding: 0.45rem 0.75rem;
  border-radius: 12px;
  background: var(--accent-soft);
  border: 1px solid #99f6e4;
  min-width: 5.5rem;
  direction: rtl;
  text-align: start;
}
.settings-block__preview strong {
  color: var(--accent);
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
  direction: rtl;
}
.settings-block__preview span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
}
.settings-block__hint {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
}
.settings-block__hint code {
  font-size: 0.78rem;
  padding: 0.05rem 0.3rem;
  border-radius: 4px;
  background: #f1f5f9;
  border: 1px solid var(--border);
}

.settings-seg {
  display: flex;
  flex-wrap: nowrap;
  gap: 0;
  padding: 0.2rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fafc;
  overflow: hidden;
}
.settings-seg--wrap {
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.4rem;
}
.settings-seg__btn {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  border-radius: 9px;
  padding: 0.55rem 0.7rem;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.settings-seg--wrap .settings-seg__btn {
  flex: 0 1 auto;
  padding: 0.45rem 0.8rem;
}
.settings-seg__btn:hover {
  color: var(--accent);
  background: rgba(255, 255, 255, 0.7);
}
.settings-seg__btn.is-active {
  background: #fff;
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.settings-custom {
  display: grid;
  gap: 0.4rem;
  margin-top: 0.95rem;
}
.settings-custom label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.15rem;
  padding: 1.15rem 1.25rem 1.25rem;
}
.settings-grid--cleanup { padding-top: 1rem; }
.settings-grid.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}
.settings-field { margin: 0; }
.settings-input-suffix {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.5rem;
}
.settings-input-suffix span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
  min-width: 2rem;
}
.settings-ext-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.85rem;
  min-height: 2rem;
  padding: 0.65rem 0.75rem;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: #fafbfc;
}
.ext-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.28rem 0.55rem;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}
.ext-chip--all {
  background: var(--accent-soft);
  border-color: #99f6e4;
  color: var(--accent);
  box-shadow: none;
}
.ext-chip__remove {
  display: inline-grid;
  place-items: center;
  width: 1.1rem;
  height: 1.1rem;
  margin-inline-start: 0.1rem;
  border: 0;
  border-radius: 999px;
  background: #f1f5f9;
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.ext-chip__remove:hover {
  background: var(--danger-soft);
  color: var(--danger);
}
.settings-meta {
  padding: 0 1.25rem 1.15rem;
  color: var(--muted);
  font-size: 0.84rem;
}
.settings-meta strong { color: var(--text-secondary); }
.settings-savebar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 0.95rem 1.15rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  position: sticky;
  bottom: 0.75rem;
  z-index: 5;
}
.settings-savebar p { margin: 0; font-size: 0.86rem; }

@media (max-width: 900px) {
  .settings-stats { grid-template-columns: 1fr 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-savebar { position: static; }
  .settings-seg {
    flex-wrap: wrap;
    gap: 0.35rem;
  }
  .settings-seg__btn { flex: 1 1 calc(50% - 0.35rem); }
  .settings-block__preview {
    justify-items: start;
  }
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 30px;
  flex-shrink: 0;
  direction: ltr;
  unicode-bidi: isolate;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.switch-slider {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background: #cbd5e1;
  border-radius: 999px;
  transition: background 0.15s ease;
}
.switch-slider::before {
  content: "";
  position: absolute;
  width: 24px;
  height: 24px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.2);
  transition: transform 0.15s ease;
}
.switch input[type="checkbox"]:checked + .switch-slider,
.switch:has(input[type="checkbox"]:checked) .switch-slider {
  background: var(--accent);
}
.switch input[type="checkbox"]:checked + .switch-slider::before,
.switch:has(input[type="checkbox"]:checked) .switch-slider::before {
  transform: translateX(22px);
}

#devtools-guard-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: none;
  place-items: center;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(6px);
  padding: 1.25rem;
}
#devtools-guard-overlay.is-visible {
  display: grid;
}
html.devtools-locked body > *:not(#devtools-guard-overlay) {
  filter: blur(2px);
  pointer-events: none;
  user-select: none;
}
.devtools-guard-card {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 16px;
  padding: 1.5rem;
  text-align: center;
  box-shadow: var(--shadow-lg);
  color: var(--text);
}
.devtools-guard-card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.2rem;
}
.devtools-guard-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}
.devtools-guard-hint {
  margin-top: 0.75rem !important;
  font-size: 0.86rem;
}

.toast-stack {
  position: fixed;
  top: 1rem;
  inset-inline-end: 1rem;
  z-index: 10000;
  display: grid;
  gap: 0.7rem;
  width: min(380px, calc(100vw - 2rem));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  position: relative;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: start;
  padding: 0.95rem 0.95rem 1.05rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: toast-in 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.toast::before {
  content: "";
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  width: 3px;
  background: var(--border-strong);
}
.toast.is-hiding {
  animation: toast-out 0.22s ease both;
}
.toast-success {
  border-color: #bbf7d0;
  background: linear-gradient(180deg, #f0fdf4 0%, #fff 58%);
}
.toast-success::before { background: var(--ok); }
.toast-error {
  border-color: #fecaca;
  background: linear-gradient(180deg, #fef2f2 0%, #fff 58%);
}
.toast-error::before { background: var(--danger); }
.toast-info {
  border-color: #bae6fd;
  background: linear-gradient(180deg, #f0f9ff 0%, #fff 58%);
}
.toast-info::before { background: #0284c7; }
.toast-warn {
  border-color: #fde68a;
  background: linear-gradient(180deg, #fffbeb 0%, #fff 58%);
}
.toast-warn::before { background: var(--warn); }

.toast-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  position: relative;
}
.toast-success .toast-icon {
  background: #dcfce7;
  color: var(--ok);
}
.toast-error .toast-icon {
  background: #fee2e2;
  color: var(--danger);
}
.toast-info .toast-icon {
  background: #e0f2fe;
  color: #0284c7;
}
.toast-warn .toast-icon {
  background: #fef3c7;
  color: var(--warn);
}
.toast-icon::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-radius: 50%;
  box-sizing: border-box;
}
.toast-success .toast-icon::before {
  width: 8px;
  height: 14px;
  border: 0;
  border-right: 2.5px solid currentColor;
  border-bottom: 2.5px solid currentColor;
  border-radius: 0;
  transform: rotate(45deg) translateY(-1px);
}
.toast-error .toast-icon::before {
  width: 12px;
  height: 12px;
  border: 0;
  background:
    linear-gradient(currentColor, currentColor) center / 2px 100% no-repeat,
    linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat;
  border-radius: 0;
  transform: rotate(45deg);
}
.toast-info .toast-icon::before {
  border-radius: 50%;
  box-shadow: inset 0 -5px 0 -3px currentColor;
  position: relative;
}
.toast-info .toast-icon::after {
  content: "";
  position: absolute;
  width: 2.5px;
  height: 2.5px;
  border-radius: 50%;
  background: currentColor;
  top: 11px;
}
.toast-warn .toast-icon::before {
  width: 0;
  height: 0;
  border: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 14px solid currentColor;
  border-radius: 0;
  background: transparent;
}

.toast-body {
  min-width: 0;
  padding-top: 0.1rem;
}
.toast-title {
  display: block;
  margin: 0 0 0.2rem;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}
.toast-success .toast-title { color: #166534; }
.toast-error .toast-title { color: #b91c1c; }
.toast-info .toast-title { color: #075985; }
.toast-warn .toast-title { color: #92400e; }
.toast-message {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.86rem;
  line-height: 1.55;
}

.toast-close {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  transition: background 0.15s ease, color 0.15s ease;
}
.toast-close span {
  width: 12px;
  height: 12px;
  display: block;
  background:
    linear-gradient(currentColor, currentColor) center / 1.5px 100% no-repeat,
    linear-gradient(currentColor, currentColor) center / 100% 1.5px no-repeat;
  transform: rotate(45deg);
}
.toast-close:hover {
  background: #f1f5f9;
  color: var(--text);
}

.toast-progress {
  position: absolute;
  inset-inline: 0 auto;
  bottom: 0;
  width: 100%;
  height: 3px;
  animation: toast-progress linear forwards;
  opacity: 0.9;
}
.toast-success .toast-progress { background: #86efac; }
.toast-error .toast-progress { background: #fca5a5; }
.toast-info .toast-progress { background: #7dd3fc; }
.toast-warn .toast-progress { background: #fcd34d; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateY(-8px) scale(0.98); }
}
@keyframes toast-progress {
  from { width: 100%; }
  to { width: 0%; }
}

.app-confirm {
  border: 0;
  border-radius: 18px;
  padding: 0;
  width: min(400px, calc(100vw - 1.5rem));
  background: transparent;
  box-shadow: var(--shadow-lg);
}
.app-confirm::backdrop {
  background: rgba(15, 23, 42, 0.45);
}
.app-confirm:not([open]) { display: none !important; }
.app-confirm[open],
.app-confirm.is-open {
  display: block !important;
  margin: auto;
}
.app-confirm__card {
  margin: 0;
  padding: 1.2rem 1.2rem 1.15rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 18px;
}
.app-confirm__head {
  display: grid;
  gap: 0.4rem;
  margin-bottom: 1.1rem;
}
.app-confirm__title {
  font-size: 1.05rem;
  color: var(--text);
}
.app-confirm__message {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}
.app-confirm__foot {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* Media preview lightbox */
.media-preview {
  border: 0;
  padding: 0;
  width: min(920px, calc(100vw - 1.25rem));
  max-height: calc(100vh - 1.5rem);
  background: transparent;
  box-shadow: none;
}
.media-preview::backdrop {
  background: rgba(15, 23, 42, 0.62);
  backdrop-filter: blur(8px);
}
.media-preview:not([open]) { display: none !important; }
.media-preview[open],
.media-preview.is-open {
  display: block !important;
  margin: auto;
}
.media-preview__card {
  background: #0b1220;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  overflow: hidden;
  color: #e2e8f0;
  box-shadow: var(--shadow-lg);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  max-height: calc(100vh - 1.5rem);
}
.media-preview__head {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}
.media-preview__identity {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 0.15rem;
}
.media-preview__title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.95rem;
  color: #fff;
}
.media-preview__kind {
  font-size: 0.72rem;
  color: #94a3b8;
  font-weight: 700;
}
.media-preview__actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}
.media-preview__download {
  background: var(--accent) !important;
  border-color: transparent !important;
  color: #fff !important;
}
.media-preview__download:hover {
  background: var(--accent-hover) !important;
  color: #fff !important;
}
.media-preview__close {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
  cursor: pointer;
  position: relative;
}
.media-preview__close span,
.media-preview__close span::before {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 14px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transform: translate(-50%, -50%) rotate(45deg);
}
.media-preview__close span::before {
  content: "";
  inset: 0;
  transform: rotate(-90deg);
}
.media-preview__stage {
  min-height: min(58vh, 520px);
  max-height: min(70vh, 640px);
  display: grid;
  place-items: center;
  padding: 1rem;
  background:
    radial-gradient(circle at 1px 1px, rgba(148, 163, 184, 0.14) 1px, transparent 0);
  background-size: 18px 18px;
}
.media-preview__image {
  max-width: 100%;
  max-height: min(62vh, 580px);
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}
.media-preview__model {
  width: 100%;
  height: min(58vh, 520px);
  background: #111827;
  border-radius: 12px;
  overflow: hidden;
}
.media-preview__loading,
.media-preview__fallback {
  color: #94a3b8;
  text-align: center;
  display: grid;
  gap: 0.75rem;
  justify-items: center;
}

/* Themed custom A/V player (always LTR — no Persian UI text) */
.media-player {
  width: min(100%, 820px);
  display: grid;
  gap: 0.85rem;
  direction: ltr;
  unicode-bidi: isolate;
}
.media-player--audio {
  width: min(100%, 440px);
  justify-items: center;
  padding: 1.25rem 1.1rem 1rem;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(15, 118, 110, 0.18), rgba(15, 23, 42, 0.35));
  border: 1px solid rgba(94, 234, 212, 0.18);
}
.media-player__viewport {
  position: relative;
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35);
}
.media-player__media {
  display: block;
  width: 100%;
  max-height: min(52vh, 480px);
  background: #000;
}
.media-player--audio .media-player__media {
  display: none;
}
.media-player__audio-art {
  width: 6.5rem;
  height: 6.5rem;
  border-radius: 1.4rem;
  display: grid;
  place-items: center;
  color: #ecfdf5;
  background:
    radial-gradient(circle at 30% 30%, rgba(94, 234, 212, 0.35), transparent 55%),
    linear-gradient(145deg, #0f766e, #134e4a);
  border: 1px solid rgba(94, 234, 212, 0.28);
  box-shadow: 0 14px 28px rgba(15, 118, 110, 0.28);
}
.media-player__audio-art .media-player__ico {
  width: 2rem;
  height: 2rem;
}
.media-player__ico {
  width: 1.15rem;
  height: 1.15rem;
  display: block;
  flex-shrink: 0;
}
.media-player__bigplay .media-player__ico {
  width: 1.65rem;
  height: 1.65rem;
  margin-left: 2px;
}
.media-player__bigplay .media-player__ico--pause {
  margin-left: 0;
}
.media-player__ico--pause,
.media-player__btn--mute .media-player__ico--mute {
  display: none;
}
.media-player.is-playing .media-player__ico--play {
  display: none;
}
.media-player.is-playing .media-player__ico--pause {
  display: block;
}
.media-player.is-muted .media-player__btn--mute .media-player__ico--volume {
  display: none;
}
.media-player.is-muted .media-player__btn--mute .media-player__ico--mute {
  display: block;
}
.media-player__bigplay {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 64px;
  height: 64px;
  border: 0;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.92);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 12px 28px rgba(15, 118, 110, 0.35);
  opacity: 1;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.media-player.is-playing .media-player__bigplay {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.9);
}
.media-player__bar {
  direction: ltr;
  unicode-bidi: isolate;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 0.55rem 0.65rem;
  align-items: center;
  padding: 0.55rem 0.65rem;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.16);
  backdrop-filter: blur(8px);
}
.media-player__btn {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: rgba(15, 118, 110, 0.18);
  color: #5eead4;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.media-player__btn:hover {
  background: rgba(15, 118, 110, 0.32);
}
.media-player__timeline {
  position: relative;
  height: 28px;
  display: grid;
  align-items: center;
  direction: ltr;
}
.media-player__track {
  height: 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.28);
  overflow: hidden;
  direction: ltr;
}
.media-player__fill {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #0d9488, #5eead4);
  border-radius: inherit;
}
.media-player__seek {
  position: absolute;
  inset: 0;
  width: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  direction: ltr;
}
.media-player__time {
  display: flex;
  flex-direction: row;
  gap: 0.2rem;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #94a3b8;
  min-width: 5.5rem;
  justify-content: flex-end;
  direction: ltr;
  unicode-bidi: isolate;
}

/* Chat file mention chips (no inline media) */
.chat-file-mention {
  margin-top: 0.45rem;
  max-width: min(100%, 280px);
  width: 100%;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 0.6rem;
  align-items: center;
  padding: 0.55rem 0.65rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.03);
  color: inherit;
  font: inherit;
  text-align: start;
  cursor: pointer;
  text-decoration: none;
}
.chat-bubble.is-mine .chat-file-mention {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}
.chat-file-mention:hover {
  border-color: #99f6e4;
  background: var(--accent-soft);
  text-decoration: none;
}
.chat-bubble.is-mine .chat-file-mention:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
}
.chat-file-mention.is-locked {
  cursor: default;
  opacity: 0.85;
}
.chat-file-mention__ico {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent-soft);
  border: 1px solid #99f6e4;
  position: relative;
}
.chat-bubble.is-mine .chat-file-mention__ico {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.22);
}
.chat-file-mention__ico::before {
  content: "";
  position: absolute;
  inset: 10px 11px;
  border: 2px solid var(--accent);
  border-radius: 2px;
}
.chat-bubble.is-mine .chat-file-mention__ico::before {
  border-color: rgba(255, 255, 255, 0.85);
}
.chat-file-mention__ico--video::before {
  inset: 11px 12px 11px 14px;
  border: 0;
  border-block: 7px solid transparent;
  border-inline-start: 11px solid var(--accent);
  border-radius: 0;
  background: transparent;
}
.chat-bubble.is-mine .chat-file-mention__ico--video::before {
  border-inline-start-color: rgba(255, 255, 255, 0.9);
}
.chat-file-mention__ico--audio::before {
  inset: 11px;
  border-radius: 999px;
  border-width: 2px;
}
.chat-file-mention__ico--model::before {
  inset: 9px;
  border-radius: 4px;
  transform: rotate(45deg);
  border-width: 2px;
}
.chat-file-mention__body {
  min-width: 0;
  display: grid;
  gap: 0.1rem;
}
.chat-file-mention__body strong {
  font-size: 0.86rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-file-mention__body em {
  font-style: normal;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
}
.chat-bubble.is-mine .chat-file-mention__body em {
  color: rgba(255, 255, 255, 0.75);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}

/* ========== Install / PWA ========== */
.install-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.install-grid:has(> :only-child) {
  grid-template-columns: minmax(0, 32rem);
}
.install-card {
  padding: 1.25rem 1.3rem 1.35rem;
  display: grid;
  gap: 1rem;
  align-content: start;
}
.install-card__head {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 0.85rem;
  align-items: center;
}
.install-card__head h2 {
  margin: 0;
  font-size: 1.08rem;
  letter-spacing: -0.02em;
}
.install-card__head p {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
}
.install-card__mark {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(145deg, #0f766e, #134e4a);
  box-shadow: 0 10px 24px rgba(15, 118, 110, 0.22);
  position: relative;
}
.install-card__mark::before {
  content: "";
  position: absolute;
  width: 14px;
  height: 2px;
  background: #ecfdf8;
  left: 50%;
  top: 54%;
  transform: translate(-50%, -50%);
  box-shadow: 0 -6px 0 #ecfdf8, 0 -12px 0 #ecfdf8;
}
.install-card__mark::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border-right: 2px solid #ecfdf8;
  border-bottom: 2px solid #ecfdf8;
  left: 50%;
  top: 38%;
  transform: translate(-50%, -50%) rotate(45deg);
}
.install-card__mark--bell::before {
  width: 14px;
  height: 14px;
  border: 2px solid #ecfdf8;
  border-radius: 8px 8px 4px 4px;
  background: transparent;
  box-shadow: none;
  top: 46%;
}
.install-card__mark--bell::after {
  width: 6px;
  height: 3px;
  border: 0;
  border-radius: 0 0 6px 6px;
  background: #ecfdf8;
  top: 68%;
  transform: translate(-50%, -50%);
}
.install-points {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.55rem;
}
.install-points li {
  position: relative;
  padding-inline-start: 1.15rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
}
.install-points li::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 0.45rem;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--accent);
}
.install-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}
.install-card__note {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.65;
}
.install-ios {
  padding: 0.85rem 0.95rem;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid var(--border);
}
.install-ios strong {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 0.9rem;
}
.install-ios ol {
  margin: 0;
  padding-inline-start: 1.2rem;
  color: var(--text-secondary);
  font-size: 0.86rem;
  line-height: 1.7;
}
.install-ios em {
  font-style: normal;
  font-weight: 700;
  color: var(--text);
}
#pwa-install.is-installed #pwa-install-btn {
  display: none;
}
@media (max-width: 860px) {
  .install-grid { grid-template-columns: 1fr; }
}

.files-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.files-toolbar__search {
  display: flex;
  gap: 0.5rem;
  flex: 1 1 16rem;
  min-width: 0;
}
.files-toolbar__search .input { flex: 1; }
.files-toolbar__actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.files-quota {
  font-size: 0.82rem;
  color: var(--muted);
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.05);
}
.files-path {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin: 0 0 0.85rem;
  font-size: 0.86rem;
  color: var(--muted);
}
.files-path a {
  color: var(--accent, #0f766e);
  text-decoration: none;
  font-weight: 600;
}
.files-path a:hover { text-decoration: underline; }
.files-path__sep {
  width: 0.35rem;
  height: 0.35rem;
  border-inline-end: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  opacity: 0.45;
  margin-inline: 0.15rem;
}
[dir="rtl"] .files-path__sep {
  transform: rotate(135deg);
}
.files-path__current {
  color: var(--text);
  font-weight: 600;
}

/* Folder browser (Drive-style) */
.folder-browser {
  margin-bottom: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fff;
  overflow: hidden;
}
.folder-browser__bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  background: #fbfcfd;
}
.folder-browser__nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  flex: 1 1 auto;
}
.folder-browser__back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  text-decoration: none;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  padding: 0.4rem 0.7rem;
  border-radius: 10px;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.folder-browser__back:hover {
  background: #f8fafc;
  border-color: rgba(15, 118, 110, 0.35);
  color: #0f766e;
}
.folder-browser__back-ico {
  width: 0.55rem;
  height: 0.55rem;
  border-inline-start: 1.8px solid currentColor;
  border-bottom: 1.8px solid currentColor;
  transform: rotate(45deg);
  margin-inline-end: 0.1rem;
}
[dir="rtl"] .folder-browser__back-ico {
  transform: rotate(-135deg);
}
.folder-browser__crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  font-size: 0.9rem;
}
.folder-browser__crumb {
  color: var(--accent, #0f766e);
  text-decoration: none;
  font-weight: 600;
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.folder-browser__crumb.is-current {
  color: var(--text);
  pointer-events: none;
}
.folder-browser__chev {
  width: 0.38rem;
  height: 0.38rem;
  border-inline-end: 1.6px solid rgba(15, 23, 42, 0.35);
  border-bottom: 1.6px solid rgba(15, 23, 42, 0.35);
  transform: rotate(-45deg);
  opacity: 0.5;
}
[dir="rtl"] .folder-browser__chev {
  transform: rotate(135deg);
}
.folder-browser__new {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid rgba(15, 118, 110, 0.28);
  background: #fff;
  color: #0f766e;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  padding: 0.45rem 0.8rem;
  border-radius: 10px;
  cursor: pointer;
}
.folder-browser__new:hover {
  background: rgba(15, 118, 110, 0.06);
}
.folder-browser__new-ico {
  width: 0.85rem;
  height: 0.85rem;
  position: relative;
}
.folder-browser__new-ico::before,
.folder-browser__new-ico::after {
  content: "";
  position: absolute;
  background: currentColor;
  border-radius: 1px;
}
.folder-browser__new-ico::before {
  width: 100%;
  height: 2px;
  top: 50%;
  inset-inline-start: 0;
  transform: translateY(-50%);
}
.folder-browser__new-ico::after {
  width: 2px;
  height: 100%;
  inset-inline-start: 50%;
  top: 0;
  transform: translateX(-50%);
}
.folder-browser__create {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 118, 110, 0.04);
}
.folder-browser__create.is-hidden,
.folder-browser__create[hidden] {
  display: none !important;
}
.folder-browser__create-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.folder-browser__create-row .input {
  flex: 1 1 12rem;
  min-width: 0;
}
.folder-browser__empty {
  display: grid;
  justify-items: center;
  gap: 0.55rem;
  padding: 1.75rem 1rem;
  text-align: center;
  color: var(--muted);
}
.folder-browser__empty p {
  margin: 0;
  font-size: 0.9rem;
}
.folder-browser__empty-ico {
  width: 2.6rem;
  height: 2rem;
  border-radius: 4px;
  background: linear-gradient(180deg, #99f6e4, #0f766e);
  opacity: 0.45;
  position: relative;
  margin-bottom: 0.25rem;
}
.folder-browser__empty-ico::before {
  content: "";
  position: absolute;
  top: -0.28rem;
  inset-inline-start: 0;
  width: 1rem;
  height: 0.32rem;
  border-radius: 2px 2px 0 0;
  background: #5eead4;
  opacity: 0.9;
}
.folder-browser__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 0.65rem;
  padding: 0.85rem;
}
.folder-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #f8fafc;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.folder-card:hover {
  background: #fff;
  border-color: rgba(15, 118, 110, 0.35);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}
.folder-card__main {
  display: grid;
  gap: 0.45rem;
  justify-items: center;
  text-align: center;
  text-decoration: none;
  color: inherit;
  padding: 1rem 0.75rem 0.9rem;
  min-height: 7.2rem;
}
.folder-card__ico {
  width: 2.75rem;
  height: 2.1rem;
  border-radius: 5px;
  background: linear-gradient(180deg, #2dd4bf 0%, #0f766e 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
  position: relative;
}
.folder-card__ico::before {
  content: "";
  position: absolute;
  top: -0.28rem;
  inset-inline-start: 0;
  width: 1.05rem;
  height: 0.34rem;
  border-radius: 3px 3px 0 0;
  background: #5eead4;
}
.folder-card__name {
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.35;
  max-width: 100%;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.folder-card__count {
  font-size: 0.75rem;
  color: var(--muted);
}
.folder-card__share {
  position: absolute;
  top: 0.4rem;
  inset-inline-start: 0.35rem;
  width: 1.7rem;
  height: 1.7rem;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.06);
  color: #64748b;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  line-height: 0;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.folder-card__share:hover {
  background: rgba(15, 118, 110, 0.14);
  color: #0f766e;
}
.folder-card__share-ico {
  position: relative;
  width: 0.48rem;
  height: 0.48rem;
  border: 1.5px solid currentColor;
  border-radius: 999px;
  transform: translateX(3px);
}
.folder-card__share-ico::before,
.folder-card__share-ico::after {
  content: "";
  position: absolute;
  width: 0.42rem;
  height: 0.42rem;
  border: 1.5px solid currentColor;
  border-radius: 999px;
}
.folder-card__share-ico::before {
  inset-block-start: -0.32rem;
  inset-inline-end: -0.38rem;
}
.folder-card__share-ico::after {
  inset-block-end: -0.32rem;
  inset-inline-end: -0.38rem;
}
.folder-card__menu {
  position: absolute;
  top: 0.4rem;
  inset-inline-end: 0.35rem;
  margin: 0;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.folder-card:hover .folder-card__menu,
.folder-card:focus-within .folder-card__menu,
.folder-card:hover .folder-card__share,
.folder-card:focus-within .folder-card__share {
  opacity: 1;
}
.folder-card__delete {
  width: 1.7rem;
  height: 1.7rem;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.06);
  cursor: pointer;
  position: relative;
  display: inline-grid;
  place-items: center;
  line-height: 0;
}
.folder-card__delete::before,
.folder-card__delete::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0.7rem;
  height: 1.6px;
  margin: 0;
  background: #64748b;
  border-radius: 1px;
}
.folder-card__delete::before { transform: translate(-50%, -50%) rotate(45deg); }
.folder-card__delete::after { transform: translate(-50%, -50%) rotate(-45deg); }
.folder-card__delete:hover {
  background: rgba(185, 28, 28, 0.12);
}
.folder-card__delete:hover::before,
.folder-card__delete:hover::after {
  background: #b91c1c;
}
@media (max-width: 720px) {
  .folder-card__menu,
  .folder-card__share { opacity: 1; }
  .folder-browser__grid {
    grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
  }
}

.bulk-bar {
  position: sticky;
  top: 0.75rem;
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 0.9rem;
  margin-bottom: 1rem;
  border-radius: 16px;
  background: #fff;
  border: 1px solid rgba(15, 118, 110, 0.22);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.8) inset,
    0 10px 28px rgba(15, 23, 42, 0.08);
  animation: bulk-bar-in 0.18s ease;
}
.bulk-bar.is-hidden { display: none; }
@keyframes bulk-bar-in {
  from { opacity: 0; transform: translateY(-0.35rem); }
  to { opacity: 1; transform: translateY(0); }
}
.bulk-bar__info {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}
.bulk-bar__check {
  flex: 0 0 auto;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 8px;
  background: #0f766e;
  position: relative;
}
.bulk-bar__check::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 46%;
  width: 0.38rem;
  height: 0.68rem;
  border-inline-end: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: translate(-50%, -55%) rotate(40deg);
}
.bulk-bar__copy {
  display: grid;
  gap: 0.05rem;
  min-width: 0;
  line-height: 1.2;
}
.bulk-bar__copy strong {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text);
}
.bulk-bar__hint {
  font-size: 0.75rem;
  color: var(--muted);
}
.bulk-bar__clear {
  border: 0;
  background: transparent;
  color: #0f766e;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.25rem 0.4rem;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}
.bulk-bar__clear:hover {
  background: rgba(15, 118, 110, 0.08);
}
.bulk-bar__divider {
  width: 1px;
  align-self: stretch;
  min-height: 1.8rem;
  background: var(--border);
}
.bulk-bar__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  flex: 1 1 auto;
  min-width: 0;
}
.bulk-bar__move {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  padding: 0.2rem;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid var(--border);
}
.bulk-bar__select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  border: 0;
  border-radius: 10px;
  background-color: transparent;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--accent) 50%),
    linear-gradient(135deg, var(--accent) 50%, transparent 50%);
  background-position:
    calc(0.55rem + 2px) calc(50% - 1px),
    0.55rem calc(50% - 1px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text);
  padding: 0.45rem 0.7rem 0.45rem 1.85rem;
  max-width: 12rem;
  min-width: 7rem;
  min-height: 2.2rem;
  cursor: pointer;
  line-height: 1.3;
}
.bulk-bar__select:hover,
.bulk-bar__select:focus {
  outline: none;
  background-color: #fff;
}
.bulk-bar__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  padding: 0.45rem 0.75rem;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.bulk-bar__btn:hover {
  background: #f8fafc;
  border-color: rgba(15, 118, 110, 0.35);
}
.bulk-bar__move .bulk-bar__btn {
  border: 0;
  background: #0f766e;
  color: #fff;
  border-radius: 9px;
  padding-inline: 0.7rem;
}
.bulk-bar__move .bulk-bar__btn:hover {
  background: #0d9488;
  border-color: transparent;
}
.bulk-bar__danger {
  margin-inline-start: auto;
}
.bulk-bar__btn--danger {
  border-color: rgba(185, 28, 28, 0.22);
  color: #b91c1c;
  background: rgba(185, 28, 28, 0.04);
}
.bulk-bar__btn--danger:hover {
  background: rgba(185, 28, 28, 0.1);
  border-color: rgba(185, 28, 28, 0.35);
}
.bulk-bar__ico {
  width: 0.95rem;
  height: 0.95rem;
  position: relative;
  flex: 0 0 auto;
}
.bulk-bar__ico--move::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0.12rem;
  width: 1.7px;
  height: 0.72rem;
  background: currentColor;
  transform: translateX(-50%);
}
.bulk-bar__ico--move::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 0.08rem;
  width: 0.42rem;
  height: 0.42rem;
  border-top: 1.7px solid currentColor;
  border-inline-end: 1.7px solid currentColor;
  transform: translateX(-50%) rotate(-45deg);
}
.bulk-bar__ico--zip::before {
  content: "";
  position: absolute;
  inset: 0.05rem 0.12rem;
  border: 1.7px solid currentColor;
  border-radius: 2px;
}
.bulk-bar__ico--zip::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 0.22rem;
  width: 0.28rem;
  height: 0.55rem;
  border-inline-start: 1.5px dashed currentColor;
  border-inline-end: 1.5px dashed currentColor;
  transform: translateX(-50%);
  opacity: 0.85;
}
.bulk-bar__ico--trash::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0.28rem;
  width: 0.62rem;
  height: 0.55rem;
  border: 1.6px solid currentColor;
  border-top: 0;
  border-radius: 0 0 2px 2px;
  transform: translateX(-50%);
}
.bulk-bar__ico--trash::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 0.08rem;
  width: 0.78rem;
  height: 1.6px;
  background: currentColor;
  transform: translateX(-50%);
  box-shadow: 0 0.18rem 0 -0.2px currentColor;
}
@media (max-width: 720px) {
  .bulk-bar {
    position: sticky;
    top: 0.4rem;
    gap: 0.55rem;
  }
  .bulk-bar__divider { display: none; }
  .bulk-bar__danger {
    margin-inline-start: 0;
    width: 100%;
  }
  .bulk-bar__btn--danger { width: 100%; justify-content: center; }
  .bulk-bar__actions { width: 100%; }
  .bulk-bar__move { flex: 1 1 auto; }
  .bulk-bar__select { flex: 1 1 auto; max-width: none; }
}
.file-check {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 1.2rem;
  height: 1.2rem;
  margin-inline-end: 0.15rem;
  cursor: pointer;
}
.file-check input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 1;
}
.file-check__mark {
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 6px;
  border: 1.5px solid rgba(15, 23, 42, 0.22);
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.12s ease;
  pointer-events: none;
  position: relative;
}
.file-check__mark::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 46%;
  width: 0.28rem;
  height: 0.5rem;
  border-inline-end: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: translate(-50%, -55%) rotate(40deg) scale(0.6);
  opacity: 0;
  transition: opacity 0.12s ease, transform 0.12s ease;
}
.file-check:hover .file-check__mark {
  border-color: rgba(15, 118, 110, 0.55);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.08);
}
.file-check input:focus-visible + .file-check__mark {
  border-color: #0f766e;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.2);
}
.file-check input:checked + .file-check__mark {
  background: #0f766e;
  border-color: #0f766e;
  box-shadow: 0 1px 2px rgba(15, 118, 110, 0.28);
}
.file-check input:checked + .file-check__mark::after {
  opacity: 1;
  transform: translate(-50%, -55%) rotate(40deg) scale(1);
}
.file-check:active .file-check__mark {
  transform: scale(0.94);
}
.file-row:has(.js-bulk-check:checked) {
  background: rgba(15, 118, 110, 0.05);
  box-shadow: inset 3px 0 0 #0f766e;
}
[dir="rtl"] .file-row:has(.js-bulk-check:checked) {
  box-shadow: inset -3px 0 0 #0f766e;
}
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.share-panel {
  margin-top: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fff;
  overflow: hidden;
}
.share-panel__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
  background: #fbfcfd;
}
.share-panel__title {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}
.share-panel__title h3 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 800;
  line-height: 1.25;
}
.share-panel__title p {
  margin: 0.1rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}
.share-panel__ico {
  width: 2rem;
  height: 2rem;
  border-radius: 10px;
  background: rgba(15, 118, 110, 0.1);
  position: relative;
  flex: 0 0 auto;
}
.share-panel__ico::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0.72rem;
  height: 0.72rem;
  border: 1.8px solid #0f766e;
  border-radius: 50%;
  transform: translate(-70%, -30%);
}
.share-panel__ico::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0.72rem;
  height: 0.72rem;
  border: 1.8px solid #0f766e;
  border-radius: 50%;
  transform: translate(-30%, -70%);
}
.share-panel__list {
  display: grid;
  gap: 0;
}
.share-card {
  display: grid;
  gap: 0.65rem;
  padding: 0.95rem 1rem;
  border-top: 1px solid var(--border);
}
.share-card:first-child { border-top: 0; }
.share-card:hover {
  background: #fafbfc;
}
.share-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}
.share-card__identity {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  gap: 0.4rem;
  justify-items: start;
}
.share-card__name {
  display: inline-block;
  max-width: 100%;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}
.share-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-start;
}
.share-card__tag {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: #334155;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  line-height: 1.3;
}
.share-card__tag--lock {
  color: #0f766e;
  background: rgba(15, 118, 110, 0.08);
  border-color: rgba(15, 118, 110, 0.18);
}
.share-card__tag--expiry {
  color: #57534e;
  background: #fafaf9;
  border-color: #e7e5e4;
}
.share-card__url-row {
  display: flex;
  gap: 0.4rem;
  align-items: stretch;
  min-width: 0;
}
.share-card__url {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fafc;
  color: #475569;
  font: inherit;
  font-size: 0.78rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  padding: 0.5rem 0.7rem;
  outline: none;
}
.share-card__url:focus {
  border-color: rgba(15, 118, 110, 0.4);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
  background: #fff;
}
.share-card__revoke {
  margin: 0;
  flex: 0 0 auto;
  align-self: flex-start;
}
.share-card__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.48rem 0.72rem;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.share-card__btn:hover {
  background: #f8fafc;
  border-color: rgba(15, 118, 110, 0.35);
}
.share-card__btn--danger {
  border-color: rgba(185, 28, 28, 0.2);
  color: #b91c1c;
  background: rgba(185, 28, 28, 0.04);
}
.share-card__btn--danger:hover {
  background: rgba(185, 28, 28, 0.1);
  border-color: rgba(185, 28, 28, 0.35);
}
.share-card__btn-ico {
  width: 0.9rem;
  height: 0.9rem;
  position: relative;
  flex: 0 0 auto;
}
.share-card__btn-ico--copy::before {
  content: "";
  position: absolute;
  inset: 0.05rem 0.05rem 0.2rem 0.2rem;
  border: 1.5px solid currentColor;
  border-radius: 2px;
}
.share-card__btn-ico--copy::after {
  content: "";
  position: absolute;
  inset: 0.2rem 0.2rem 0.05rem 0.05rem;
  border: 1.5px solid currentColor;
  border-radius: 2px;
  background: #fff;
}
.share-card__btn-ico--revoke::before,
.share-card__btn-ico--revoke::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0.7rem;
  height: 1.6px;
  background: currentColor;
  border-radius: 1px;
}
.share-card__btn-ico--revoke::before { transform: translate(-50%, -50%) rotate(45deg); }
.share-card__btn-ico--revoke::after { transform: translate(-50%, -50%) rotate(-45deg); }
@media (max-width: 720px) {
  .share-card__revoke,
  .share-card__url-row .share-card__btn {
    width: 100%;
  }
  .share-card__url-row {
    flex-wrap: wrap;
  }
  .share-card__url {
    width: 100%;
  }
}

/* ========== Public share pages (/share, /sharefolder) ========== */
.share-public {
  width: min(920px, 100%);
  margin: 1.25rem auto 2.5rem;
}
.share-public--gate {
  display: grid;
  place-items: center;
  min-height: min(70vh, 560px);
  padding: 1rem;
}
.share-public--browse {
  display: grid;
  gap: 1rem;
}

.share-gate {
  width: min(420px, 100%);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2rem 1.6rem 1.75rem;
  box-shadow: var(--shadow-lg);
  text-align: center;
  display: grid;
  gap: 0.65rem;
  justify-items: center;
}
.share-gate h1 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}
.share-gate__lead {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
  font-size: 0.95rem;
  max-width: 34ch;
}
.share-gate__hint {
  margin: 0;
  font-size: 0.82rem;
  color: #94a3b8;
}
.share-gate__form {
  width: 100%;
  margin-top: 0.65rem;
  text-align: start;
}
.share-gate__submit,
.share-gate__home {
  width: 100%;
  margin-top: 0.35rem;
  justify-content: center;
}
.share-gate__icon {
  width: 4.1rem;
  height: 4.1rem;
  border-radius: 18px;
  display: grid;
  place-items: center;
  position: relative;
  margin-bottom: 0.35rem;
  background: var(--accent-soft);
  border: 1px solid #99f6e4;
  color: var(--accent);
}
.share-gate__icon::before,
.share-gate__icon::after {
  content: "";
  position: absolute;
}
.share-gate__icon--invalid {
  background: var(--danger-soft);
  border-color: #fecaca;
  color: var(--danger);
}
.share-gate__icon--invalid::before,
.share-gate__icon--invalid::after {
  width: 1.35rem;
  height: 2.5px;
  background: currentColor;
  border-radius: 2px;
  top: 50%;
  left: 50%;
}
.share-gate__icon--invalid::before { transform: translate(-50%, -50%) rotate(45deg); }
.share-gate__icon--invalid::after { transform: translate(-50%, -50%) rotate(-45deg); }

.share-gate__icon--expired {
  background: var(--warn-soft);
  border-color: #fde68a;
  color: var(--warn);
}
.share-gate__icon--expired::before {
  width: 1.55rem;
  height: 1.55rem;
  border: 2.5px solid currentColor;
  border-radius: 999px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.share-gate__icon--expired::after {
  width: 2px;
  height: 0.55rem;
  background: currentColor;
  top: calc(50% - 0.35rem);
  left: 50%;
  transform: translateX(-50%);
  border-radius: 1px;
  box-shadow: 0.28rem 0.28rem 0 -0.5px currentColor;
}

.share-gate__icon--limit {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}
.share-gate__icon--limit::before {
  width: 1.6rem;
  height: 1.15rem;
  border: 2.5px solid currentColor;
  border-radius: 4px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -42%);
}
.share-gate__icon--limit::after {
  width: 0.85rem;
  height: 2.5px;
  background: currentColor;
  top: calc(50% + 0.05rem);
  left: 50%;
  transform: translateX(-50%);
  border-radius: 1px;
}

.share-gate__icon--missing {
  background: #f8fafc;
  border-color: var(--border-strong);
  color: #64748b;
}
.share-gate__icon--missing::before {
  width: 1.55rem;
  height: 1.2rem;
  border: 2.5px solid currentColor;
  border-radius: 3px;
  top: 52%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0.85;
}
.share-gate__icon--missing::after {
  width: 0.9rem;
  height: 2.5px;
  background: currentColor;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-28deg);
}

.share-gate__icon--lock {
  background: var(--accent-soft);
  border-color: #99f6e4;
  color: var(--accent);
}
.share-gate__icon--lock::before {
  width: 1.15rem;
  height: 0.95rem;
  border: 2.5px solid currentColor;
  border-radius: 4px;
  top: 56%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.share-gate__icon--lock::after {
  width: 0.72rem;
  height: 0.55rem;
  border: 2.5px solid currentColor;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  top: 34%;
  left: 50%;
  transform: translateX(-50%);
}

.share-public__hero {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.15rem 1.25rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.share-public__hero-ico {
  flex: 0 0 auto;
}
.share-public__folder-ico {
  display: block;
  width: 3.1rem;
  height: 2.35rem;
  border-radius: 6px;
  background: linear-gradient(180deg, #2dd4bf 0%, #0f766e 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
  position: relative;
}
.share-public__folder-ico::before {
  content: "";
  position: absolute;
  top: -0.32rem;
  inset-inline-start: 0;
  width: 1.15rem;
  height: 0.38rem;
  border-radius: 3px 3px 0 0;
  background: #5eead4;
}
.share-public__file-ico {
  width: 3.1rem;
  height: 3.1rem;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}
.share-public__hero-copy {
  min-width: 0;
  display: grid;
  gap: 0.3rem;
}
.share-public__eyebrow {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.02em;
}
.share-public__hero h1 {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.share-public__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.share-public__pill {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid #99f6e4;
}
.share-public__pill--muted {
  background: #f8fafc;
  color: var(--muted);
  border-color: var(--border);
}

.share-public__empty {
  display: grid;
  justify-items: center;
  gap: 0.35rem;
  text-align: center;
  padding: 2.5rem 1.25rem;
  background: var(--bg-elevated);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--muted);
}
.share-public__empty strong {
  color: var(--text);
  font-size: 1rem;
}
.share-public__empty p { margin: 0; font-size: 0.9rem; }
.share-public__empty-ico {
  width: 2.6rem;
  height: 2rem;
  border-radius: 5px;
  background: #cbd5e1;
  margin-bottom: 0.4rem;
  position: relative;
  opacity: 0.7;
}
.share-public__empty-ico::before {
  content: "";
  position: absolute;
  top: -0.28rem;
  inset-inline-start: 0;
  width: 1rem;
  height: 0.32rem;
  border-radius: 3px 3px 0 0;
  background: #94a3b8;
}

.share-public__list {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.share-public__list-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 5.5rem 6.5rem;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}
.share-public__list-head span:nth-child(2),
.share-public__list-head span:nth-child(3) {
  text-align: center;
}

.share-file {
  display: grid;
  grid-template-columns: 2.75rem minmax(0, 1fr) auto;
  gap: 0.85rem;
  align-items: center;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
}
.share-file:last-child { border-bottom: 0; }
.share-file:hover { background: #f8fffd; }
.share-file__type {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.share-file__main { min-width: 0; }
.share-file__name {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.share-file__size {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}
.share-file__dl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 0.95rem;
  border-radius: 10px;
  border: 1px solid rgba(15, 118, 110, 0.28);
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.2;
  width: fit-content;
  max-width: max-content;
  justify-self: end;
  box-sizing: border-box;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.share-file__dl:hover {
  background: var(--accent-hover);
  color: #fff;
}
.btn.share-file__dl {
  width: fit-content;
  max-width: max-content;
  justify-content: center;
}
.share-file__dl--lg {
  padding: 0.7rem 1.2rem;
  font-size: 0.95rem;
}
.share-file__dl-ico {
  width: 0.7rem;
  height: 0.7rem;
  position: relative;
  display: block;
  flex: 0 0 auto;
  /* U-shaped tray */
  border: 1.5px solid currentColor;
  border-top: 0;
  border-radius: 0 0 2.5px 2.5px;
  margin-top: 0.22rem;
  box-sizing: border-box;
}
.share-file__dl-ico::before {
  /* vertical shaft */
  content: "";
  position: absolute;
  left: 50%;
  bottom: 100%;
  width: 1.5px;
  height: 0.38rem;
  margin: 0;
  background: currentColor;
  transform: translateX(-50%);
  border: 0;
  box-shadow: none;
}
.share-file__dl-ico::after {
  /* arrow head */
  content: "";
  position: absolute;
  left: 50%;
  bottom: calc(100% - 1px);
  width: 0;
  height: 0;
  margin: 0;
  border-style: solid;
  border-width: 0.28rem 0.24rem 0;
  border-color: currentColor transparent transparent;
  transform: translateX(-50%);
  background: transparent;
  box-shadow: none;
}

.share-public__cta-card {
  display: grid;
  gap: 0.85rem;
  justify-items: start;
  padding: 1.25rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.share-public__cta-card p {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 720px) {
  .share-public__list-head { display: none; }
  .share-file {
    grid-template-columns: 2.5rem minmax(0, 1fr);
    grid-template-areas:
      "type main"
      "type dl";
  }
  .share-file__type { grid-area: type; }
  .share-file__main { grid-area: main; }
  .share-file__dl {
    grid-area: dl;
    justify-self: start;
    margin-top: 0.15rem;
  }
  .share-public__hero {
    align-items: flex-start;
  }
  .share-public__hero h1 {
    white-space: normal;
  }
}


