/* ============================================================
   INTEGRA 3D Cloud — Design tokens & base styles
   ============================================================ */

:root {
  /* Surfaces (light premium portal) */
  --bg: #F7F8FA;
  --bg-sunken: #EEF1F6;
  --surface: #FFFFFF;
  --surface-2: #FBFCFE;
  --surface-3: #F4F6FA;
  --surface-grad: linear-gradient(180deg, rgba(255,255,255,.92) 0%, rgba(248,250,253,.96) 100%);

  /* Deep ink (dark brand surfaces) */
  --ink: #111824;
  --ink-2: #1f2837;
  --ink-3: #2a3545;

  /* Brand */
  --brand: #c6395d;
  --brand-bright: #db3862;
  --brand-support: #d05277;
  --danger: #b52238;
  --brand-grad: linear-gradient(135deg, #c6395d 0%, #db3862 100%);
  --brand-grad-soft: linear-gradient(135deg, rgba(198,57,93,.10) 0%, rgba(219,56,98,.10) 100%);

  /* Text */
  --text: #111824;
  --text-2: #5b6a82;       /* gris azulado claro */
  --text-3: #8a96aa;
  --text-on-dark: #eef2f8;
  --text-on-dark-2: #93a1b8;

  /* Lines & strokes */
  --border: #e6eaf1;
  --border-strong: #d6dce6;
  --border-dark: #2b3647;

  /* Status */
  --ok: #0f9b8a;
  --ok-bg: #e2f5f1;
  --warn: #c5871f;
  --warn-bg: #fbf0db;
  --info: #3576c4;
  --info-bg: #e4eefb;
  --new-bg: rgba(219,56,98,.12);
  --danger-bg: #fbe4e7;

  /* Radii */
  --r-sm: 10px;
  --r: 14px;
  --r-lg: 18px;
  --r-xl: 22px;
  --r-pill: 999px;

  /* Shadows (soft) */
  --sh-xs: 0 1px 2px rgba(17,24,36,.04), 0 1px 1px rgba(17,24,36,.03);
  --sh-sm: 0 2px 8px rgba(17,24,36,.05), 0 1px 2px rgba(17,24,36,.04);
  --sh: 0 6px 20px rgba(17,24,36,.07), 0 2px 6px rgba(17,24,36,.04);
  --sh-lg: 0 18px 48px rgba(17,24,36,.12), 0 6px 16px rgba(17,24,36,.06);
  --sh-brand: 0 8px 22px rgba(198,57,93,.30);
  --shadow-soft: 0 16px 42px rgba(17,24,36,.09), 0 1px 0 rgba(255,255,255,.8) inset;

  --header-h: 72px;
  --z-header: 40;
  --z-menu: 900;
  --z-overlay: 3000;
  --z-toast: 1300;

  --font: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body { overflow: hidden; }

#root { height: 100vh; }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; }
::selection { background: rgba(219,56,98,.20); }

.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.mono { font-family: var(--mono); }

/* Scrollbars */
.scroll { scrollbar-width: thin; scrollbar-color: #cdd5e1 transparent; }
.scroll::-webkit-scrollbar { width: 10px; height: 10px; }
.scroll::-webkit-scrollbar-thumb { background: #cdd5e1; border-radius: 99px; border: 3px solid transparent; background-clip: padding-box; }
.scroll::-webkit-scrollbar-thumb:hover { background: #b3bdcc; background-clip: padding-box; }
.scroll-dark { scrollbar-color: #3a475c transparent; }
.scroll-dark::-webkit-scrollbar-thumb { background: #3a475c; }

/* ===== App shell layout ===== */
.app {
  display: block;
  height: 100vh;
  background: var(--bg);
}

.header-brand-button {
  width: 148px;
  height: 44px;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}
.header-brand-button img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* ===== Main column ===== */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  position: relative;
  overflow: visible;
  isolation: isolate;
}

/* Header */
.header {
  height: var(--header-h); flex: none;
  background:
    linear-gradient(90deg, rgba(9,14,22,.96) 0%, rgba(18,25,37,.94) 44%, rgba(32,22,35,.92) 100%);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(148,163,184,.16);
  display: flex; align-items: center; gap: 18px;
  padding: 0 26px; z-index: var(--z-header);
  position: relative;
  overflow: visible;
}
.header::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(7,9,13,.36) 0%, rgba(7,9,13,.18) 34%, rgba(7,9,13,.08) 58%, rgba(7,9,13,.18) 100%),
    url("navbar-bg3.png") center 42% / cover no-repeat;
  opacity: .50;
  pointer-events: none;
}
.header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(219,56,98,.24), rgba(255,255,255,.08), rgba(219,56,98,.18));
  pointer-events: none;
}
.header > * {
  position: relative;
  z-index: 1;
}
.header-brand-strip {
  flex: none;
  min-width: 0;
  width: min(100%, 258px);
  height: 56px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px;
  align-items: center;
  gap: 10px;
  padding: 0 10px 0 0;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255,255,255,.14), rgba(255,255,255,.05));
  box-shadow: 0 18px 44px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.07);
  overflow: hidden;
}
.header-brand-cover {
  position: relative;
  height: 100%;
  overflow: hidden;
}
.header-brand-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: scale(1.04);
}
.header-brand-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(7,10,16,.18), rgba(7,10,16,.04) 56%, rgba(7,10,16,0) 100%);
}
.header-brand-cover-glow {
  position: absolute;
  right: -14px;
  bottom: -20px;
  width: 96px;
  height: 96px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(219,56,98,.28) 0%, rgba(219,56,98,0) 72%);
  pointer-events: none;
}
.header-brand-badge {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255,255,255,.16), rgba(255,255,255,.08));
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}
.header-brand-badge img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.search-global {
  flex: 1 1 320px; max-width: 520px; min-width: 220px; height: 44px;
  position: relative; display: flex; align-items: center;
}
.search-global input {
  display: block; width: 100%; height: 44px; border-radius: 16px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.96);
  padding: 0 54px 0 42px; font-size: 13.5px; font-weight: 600; color: var(--ink);
  transition: border .16s, box-shadow .16s; outline: none;
  box-shadow: 0 12px 30px rgba(8,12,18,.10), inset 0 1px 0 rgba(255,255,255,.78);
}
.search-global input::placeholder { color: #738198; }
.search-global input:focus { border-color: rgba(219,56,98,.50); box-shadow: 0 0 0 4px rgba(219,56,98,.12), 0 16px 38px rgba(8,12,18,.12); }
.search-global .si-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: #6b7890; width: 18px; height: 18px; }
.search-global .si-action {
  position: absolute; right: 7px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; border-radius: 11px; display: grid; place-items: center;
  background: var(--brand-grad); color: #fff; box-shadow: var(--sh-brand);
}
.search-popover {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 10px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-lg);
  padding: 8px;
  z-index: 80;
}
.ops-status {
  height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  border: 1px solid rgba(148,163,184,.24);
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.ops-status span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.ops-status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 4px rgba(16,185,129,.12);
}
.ops-status b {
  color: #0f766e;
  background: rgba(20,184,166,.10);
  border: 1px solid rgba(20,184,166,.18);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
}
.theme-toggle.active {
  color: var(--brand);
  background: var(--new-bg);
}
.search-source {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
  font-size: 11.5px;
  color: var(--text-3);
}
.search-source b {
  color: var(--brand);
  font-weight: 800;
  text-align: right;
}
.search-result {
  width: 100%;
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 10px;
  align-items: center;
  text-align: left;
  padding: 9px 10px;
  border-radius: var(--r-sm);
}
.search-result:hover {
  background: var(--surface-2);
}
.sr-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--brand);
  background: var(--new-bg);
}
.search-result.kind-referidor .sr-icon { color: #0e8f7e; background: rgba(20,184,166,.12); }
.search-result.kind-paciente .sr-icon { color: #2a6fdb; background: rgba(42,111,219,.12); }
.search-result.kind-carpeta .sr-icon { color: #c5871f; background: rgba(197,135,31,.14); }
.search-result.kind-archivo .sr-icon,
.search-result.kind-estudio .sr-icon { color: var(--brand); background: var(--new-bg); }
.search-result.kind-doctor .sr-icon { color: #64748b; background: rgba(100,116,139,.14); }
.sr-copy {
  min-width: 0;
}
.sr-copy strong,
.sr-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sr-copy strong {
  font-size: 13.5px;
  color: var(--text);
}
.sr-copy small {
  font-size: 11.5px;
  color: var(--text-2);
  margin-top: 2px;
}
.search-empty {
  padding: 18px 12px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-2);
}
.header-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.header-actions {
  position: relative;
  z-index: 140;
}
.sync-chip {
  display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 13px;
  border-radius: var(--r-pill); background: var(--ok-bg); color: #0b7a6c;
  font-size: 12.5px; font-weight: 700;
}
.sync-chip .dot { width: 7px; height: 7px; border-radius: 99px; background: var(--ok); box-shadow: 0 0 0 3px rgba(15,155,138,.18); }
.source-chip {
  background: var(--warn-bg);
  color: #8a5d12;
}
.source-chip .dot {
  background: var(--warn);
  box-shadow: 0 0 0 3px rgba(197,135,31,.18);
}
.icon-btn {
  width: 42px; height: 42px; border-radius: var(--r-sm);
  display: grid; place-items: center; color: var(--text-2);
  transition: background .16s, color .16s; position: relative;
}
.icon-btn { color: rgba(255,255,255,.74); }
.icon-btn:hover { background: rgba(255,255,255,.10); color: #fff; }
.icon-btn svg { width: 21px; height: 21px; }
.icon-btn .dot-badge {
  position: absolute;
  top: 6px;
  right: 5px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 99px;
  display: grid;
  place-items: center;
  background: var(--brand-bright);
  color: #fff;
  border: 2px solid rgba(10,13,19,.96);
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
}
.notifications-wrap {
  position: relative;
  z-index: var(--z-menu);
}
.notifications-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  z-index: var(--z-menu);
  width: min(360px, calc(100vw - 24px));
  max-height: min(520px, calc(100vh - 96px));
  overflow: hidden;
  border: 1px solid rgba(148,163,184,.22);
  border-radius: 16px;
  background: rgba(255,255,255,.98);
  color: var(--text);
  box-shadow: 0 28px 64px rgba(15,23,42,.20), 0 1px 0 rgba(255,255,255,.9) inset;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.notifications-head {
  min-height: 58px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(148,163,184,.16);
}
.notifications-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.notifications-head strong {
  display: block;
  font-size: 13.5px;
  font-weight: 900;
}
.notifications-head small {
  display: block;
  margin-top: 2px;
  color: var(--text-3);
  font-size: 11.5px;
}
.notifications-list {
  max-height: 430px;
  overflow: auto;
  padding: 6px;
}
.notifications-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 8px 10px 2px;
}
.notifications-tabs button {
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid rgba(148,163,184,.16);
  font-size: 11.5px;
  font-weight: 900;
}
.notifications-tabs button.active {
  background: var(--brand-grad);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 8px 20px rgba(198,57,93,.22);
}
.notifications-tabs span {
  min-width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(148,163,184,.16);
  font-size: 10px;
}
.notifications-tabs button.active span {
  background: rgba(255,255,255,.20);
}
.notification-permission {
  width: calc(100% - 12px);
  margin: 6px;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 11px;
  border: 1px solid rgba(198,57,93,.22);
  background: var(--new-bg);
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
}
.notification-permission:hover {
  background: rgba(219,56,98,.16);
}
.notification-row {
  width: 100%;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 30px;
  gap: 9px;
  padding: 9px;
  border-radius: 11px;
  text-align: left;
  color: var(--text);
}
.notification-row:hover {
  background: var(--surface-2);
}
.notification-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--new-bg);
  color: var(--brand);
}
.notification-copy {
  min-width: 0;
}
.notification-copy strong,
.notification-copy small,
.notification-copy em {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notification-row-action {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  align-self: center;
  color: var(--text-3);
  border: 1px solid transparent;
}
.notification-row-action:hover,
.notification-row-action:focus-visible {
  color: var(--brand);
  background: var(--new-bg);
  border-color: rgba(198,57,93,.20);
  outline: none;
}
.notification-copy strong {
  font-size: 12.5px;
  font-weight: 900;
}
.notification-copy small {
  margin-top: 2px;
  color: var(--text-2);
  font-size: 12px;
}
.notification-copy em {
  margin-top: 3px;
  color: var(--text-3);
  font-size: 10.5px;
  font-style: normal;
}
.notifications-empty {
  padding: 18px 10px;
  color: var(--text-3);
  font-size: 12.5px;
  line-height: 1.45;
}
.avatar-btn { display: flex; align-items: center; gap: 9px; padding: 4px 6px 4px 4px; border-radius: var(--r-pill); transition: background .16s; color: #fff; }
.avatar-btn:hover { background: rgba(255,255,255,.10); }
.user-menu-wrap {
  position: relative;
  z-index: var(--z-menu);
}
.user-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  z-index: var(--z-menu);
  width: 248px;
  padding: 8px;
  border: 1px solid rgba(148,163,184,.22);
  border-radius: 16px;
  background: rgba(255,255,255,.98);
  box-shadow: 0 28px 64px rgba(15,23,42,.20), 0 1px 0 rgba(255,255,255,.9) inset;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.user-profile-sheet {
  width: min(340px, calc(100vw - 22px));
  padding: 12px;
}
.profile-sheet-head {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 4px 4px 10px;
}
.profile-sheet-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}
.profile-sheet-copy strong {
  color: var(--text);
  font-size: 15px;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-sheet-copy small {
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-sheet-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 38px;
  padding: 0 10px;
  margin-bottom: 8px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(219,56,98,.10), rgba(42,111,219,.08));
  border: 1px solid rgba(148,163,184,.18);
}
.profile-sheet-status span,
.profile-sheet-status b {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 850;
}
.profile-sheet-status span {
  gap: 7px;
}
.profile-sheet-status span i {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(15,155,138,.14);
}
.profile-sheet-status b {
  color: var(--brand);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-sheet-nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 8px;
}
.profile-sheet-nav button {
  min-height: 64px;
  justify-content: center;
  display: grid;
  place-items: center;
  gap: 5px;
  padding: 8px 6px;
  text-align: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.profile-sheet-nav button span {
  font-size: 11px;
  line-height: 1.15;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-sheet-nav button.active {
  background: var(--brand-grad);
  color: #fff;
  border-color: transparent;
  box-shadow: var(--sh-brand);
}
.user-menu button {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 9px;
  border-radius: 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  text-align: left;
}
.user-menu button:hover {
  background: var(--surface-2);
  color: var(--brand);
}
.user-menu .profile-sheet-nav button {
  display: grid;
  place-items: center;
  grid-template-columns: 1fr;
  gap: 5px;
  padding: 8px 6px;
  text-align: center;
}
.user-menu .profile-sheet-nav button span {
  width: 100%;
}
.profile-pwa-panel {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(148,163,184,.18);
  border-radius: 13px;
  background:
    radial-gradient(circle at 10% 0%, rgba(219,56,98,.14), transparent 44%),
    var(--surface-2);
}
.profile-pwa-title {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
}
.profile-pwa-title svg {
  color: var(--brand);
}
.profile-pwa-title b {
  margin-left: auto;
  border-radius: 999px;
  padding: 2px 7px;
  background: var(--new-bg);
  color: var(--brand);
  font-size: 10px;
  font-weight: 900;
}
.profile-pwa-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}
.user-menu .profile-pwa-actions button {
  min-height: 36px;
  justify-content: center;
  gap: 6px;
  padding: 0 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 11.5px;
  white-space: nowrap;
}
.profile-pwa-message {
  color: var(--text-3);
  font-size: 11px;
  line-height: 1.35;
}
.user-menu .divider {
  margin: 5px 3px;
}

.profile-page {
  max-width: 980px;
}
.profile-app-grid {
  display: grid;
  grid-template-columns: minmax(260px, 330px) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
  margin-bottom: 16px;
}
.profile-app-tabs {
  width: min(430px, 100%);
  min-height: 46px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  margin: -2px 0 16px;
  border-radius: 16px;
  border: 1px solid rgba(148,163,184,.20);
  background:
    linear-gradient(180deg, rgba(255,255,255,.90), rgba(244,246,250,.92));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.86), 0 10px 28px rgba(15,23,42,.055);
}
.profile-app-tabs button {
  min-width: 0;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 12px;
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 950;
}
.profile-app-tabs button.active {
  background: var(--brand-grad);
  color: #fff;
  box-shadow: 0 10px 24px rgba(198,57,93,.28);
}
.profile-hero-card,
.profile-contact-card {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(148,163,184,.20);
  box-shadow: var(--shadow-soft);
}
.profile-hero-card {
  min-height: 240px;
  padding: 18px;
  display: grid;
  align-content: space-between;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(12,18,29,.96), rgba(37,23,39,.94) 52%, rgba(198,57,93,.88)),
    url("navbar-bg3.png") center / cover no-repeat;
}
.profile-hero-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 86% 12%, rgba(255,255,255,.18), transparent 28%);
  pointer-events: none;
}
.profile-hero-glow {
  position: absolute;
  inset: auto -22% -42% 16%;
  height: 170px;
  background: radial-gradient(circle, rgba(219,56,98,.48), transparent 62%);
  filter: blur(14px);
}
.profile-hero-main {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 14px;
  justify-items: start;
}
.profile-hero-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
}
.profile-hero-copy strong {
  font-size: 23px;
  line-height: 1.08;
  font-weight: 950;
  overflow-wrap: anywhere;
}
.profile-hero-copy span {
  color: rgba(255,255,255,.68);
  font-size: 11.5px;
}
.profile-contact-rail {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.profile-contact-rail span {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.14);
  color: rgba(255,255,255,.82);
  font-size: 11.5px;
  font-weight: 850;
}
.profile-contact-card {
  padding: 18px;
  display: grid;
  gap: 16px;
  background:
    radial-gradient(circle at 0% 0%, rgba(219,56,98,.10), transparent 36%),
    linear-gradient(180deg, rgba(255,255,255,.96), rgba(248,250,253,.94));
}
.profile-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.profile-card-title > svg {
  width: 38px;
  height: 38px;
  padding: 10px;
  border-radius: 13px;
  color: var(--brand);
  background: var(--new-bg);
}
.profile-card-title div {
  display: grid;
  gap: 2px;
}
.profile-card-title strong {
  color: var(--text);
  font-size: 15px;
  font-weight: 950;
}
.profile-card-title span {
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.35;
}
.profile-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.profile-field {
  display: grid;
  gap: 7px;
}
.profile-field > span {
  color: var(--text-2);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}
.profile-field-control {
  min-height: 48px;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 0 13px;
  border-radius: 14px;
  border: 1px solid rgba(148,163,184,.20);
  background:
    linear-gradient(180deg, rgba(255,255,255,.82), rgba(244,246,250,.92));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 8px 22px rgba(15,23,42,.045);
}
.profile-field-control svg {
  color: var(--brand);
}
.profile-field-control input {
  width: 100%;
  min-width: 0;
  height: 44px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 750;
}
.profile-field-control:focus-within {
  border-color: rgba(219,56,98,.45);
  box-shadow: 0 0 0 4px rgba(219,56,98,.10), inset 0 1px 0 rgba(255,255,255,.9);
}
.profile-save-row {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}
.profile-save-row span {
  margin-right: auto;
  font-size: 12.5px;
  font-weight: 850;
}
.profile-save-row span.ok {
  color: var(--ok);
}
.profile-save-row span.warn {
  color: var(--danger);
}
.profile-security-grid {
  display: grid;
  grid-template-columns: minmax(260px, 330px) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}
.profile-security-card {
  position: relative;
  min-height: 230px;
  overflow: hidden;
  border-radius: 18px;
  padding: 20px;
  display: grid;
  align-content: end;
  gap: 18px;
  color: #fff;
  background:
    radial-gradient(circle at 16% 8%, rgba(255,255,255,.16), transparent 30%),
    linear-gradient(135deg, #07101f, #131a2a 50%, #2b1530);
  border: 1px solid rgba(148,163,184,.20);
  box-shadow: var(--shadow-soft);
}
.profile-security-card::after {
  content: "";
  position: absolute;
  inset: auto -18% -45% 8%;
  height: 180px;
  background: radial-gradient(circle, rgba(219,56,98,.50), transparent 62%);
  filter: blur(14px);
}
.profile-security-card > * {
  position: relative;
  z-index: 1;
}
.profile-security-mark {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.14);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}
.profile-security-card strong {
  display: block;
  font-size: 23px;
  line-height: 1.1;
  font-weight: 950;
}
.profile-security-card span {
  display: block;
  max-width: 260px;
  margin-top: 8px;
  color: rgba(255,255,255,.68);
  font-size: 12.5px;
  line-height: 1.45;
}
.profile-security-form {
  align-content: start;
}
.profile-field-grid.security {
  grid-template-columns: 1fr;
}

.spin {
  animation: integra-spin .85s linear infinite;
}
@keyframes integra-spin {
  to { transform: rotate(360deg); }
}

.drive-open-tabs {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  padding: 5px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  scrollbar-width: thin;
}
.drive-shell {
  background: var(--surface-grad) !important;
  border-color: var(--border) !important;
  box-shadow: var(--shadow-soft) !important;
}
.drive-toolbar {
  background: linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,0));
}
.drive-crumbs {
  min-height: 38px;
}
.drive-open-tab {
  height: 26px;
  min-width: 116px;
  max-width: 178px;
  display: grid;
  grid-template-columns: 15px minmax(0, 1fr) 16px;
  column-gap: 6px;
  align-items: center;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-2);
  text-align: left;
}
.drive-open-tab svg { color: var(--brand); }
.drive-open-tab span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11.5px;
  font-weight: 900;
  color: var(--text);
}
.drive-open-tab i {
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  color: var(--text-3);
  font-style: normal;
}
.drive-open-tab i:hover { background: var(--bg-sunken); color: var(--text); }
.drive-open-tab.active {
  border-color: rgba(198,57,93,.35);
  background: var(--surface);
  box-shadow: inset 0 -2px 0 var(--brand), 0 1px 5px rgba(15,23,42,.06);
}
.drive-open-tab.active span {
  color: var(--text);
}
.soft-folder-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-grid;
  place-items: center;
  flex: none;
  color: var(--brand);
  background: var(--new-bg);
  border: 1px solid rgba(198,57,93,.18);
}
.soft-folder-icon.large {
  width: 42px;
  height: 42px;
  border-radius: 13px;
}
.drive-share-end {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #8a8f98;
  background: transparent;
  border: 1px solid transparent;
  transition: background .16s, border-color .16s, color .16s;
}
.drive-share-end:hover {
  color: var(--brand);
  background: var(--new-bg);
  border-color: rgba(198,57,93,.18);
}
.drive-new-wrap {
  position: relative;
  display: inline-flex;
}
.folder-action-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 120;
  width: 292px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 16px 44px rgba(15,23,42,.16);
  padding: 12px;
  animation: sheetUp .14s ease;
}

.cloud-details-drawer {
  background: var(--surface-grad) !important;
  border-color: rgba(148,163,184,.22) !important;
  box-shadow: 0 26px 80px rgba(0,0,0,.24), 0 1px 0 rgba(255,255,255,.05) inset !important;
}
.cloud-details-head {
  background:
    radial-gradient(circle at 18% 0%, rgba(219,56,98,.10), transparent 34%),
    var(--surface-grad) !important;
}
.cloud-details-preview {
  background: linear-gradient(180deg, var(--surface-3), var(--bg-sunken)) !important;
}
.cloud-details-tabs {
  border: 1px solid var(--border);
}
.cloud-details-tabs button.active {
  background: var(--surface) !important;
  box-shadow: 0 8px 18px rgba(15,23,42,.08) !important;
}
.drive-file-card {
  background: var(--surface-grad);
}
.drive-context-menu {
  width: 226px;
  display: grid;
  gap: 4px;
  padding: 8px;
  border: 1px solid rgba(148,163,184,.28);
  border-radius: 14px;
  background: rgba(255,255,255,.98);
  box-shadow: 0 24px 60px rgba(15,23,42,.22), 0 1px 0 rgba(255,255,255,.9) inset;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.drive-context-menu button {
  width: 100%;
  min-height: 40px;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 0 11px;
  border-radius: 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
  text-align: left;
  background: var(--surface);
  border: 1px solid transparent;
}
.drive-context-menu button svg {
  color: var(--text-2);
}
.drive-context-menu button:hover {
  background: linear-gradient(135deg, rgba(219,56,98,.10), rgba(42,111,219,.08));
  border-color: rgba(198,57,93,.18);
  color: var(--brand);
}
.drive-context-menu button:hover svg {
  color: var(--brand);
}
[data-theme="dark"] .drive-context-menu {
  border-color: rgba(148,163,184,.22);
  background: rgba(10,14,20,.98);
  box-shadow: 0 28px 70px rgba(0,0,0,.48), 0 1px 0 rgba(255,255,255,.03) inset;
}
[data-theme="dark"] .drive-context-menu button {
  background: rgba(255,255,255,.035);
  color: var(--text);
  border-color: rgba(148,163,184,.08);
}
[data-theme="dark"] .drive-context-menu button svg {
  color: var(--text-2);
}
[data-theme="dark"] .drive-context-menu button:hover {
  background: linear-gradient(135deg, rgba(219,56,98,.16), rgba(42,111,219,.14));
  color: #fff;
  border-color: rgba(219,56,98,.24);
}
[data-theme="dark"] .drive-context-menu button:hover svg {
  color: #fff;
}

@media (max-width: 980px) {
  :root {
    --header-h: 64px;
  }
  body { overflow: auto; }
  #root { min-height: 100vh; height: auto; }
  .app {
    min-height: 100vh;
    height: auto;
  }
  .main { height: auto; min-height: 100vh; }
  .header {
    position: sticky;
    top: 0;
    height: auto;
    min-height: var(--header-h);
    padding: 10px 12px;
    flex-wrap: wrap;
    background:
      linear-gradient(90deg, rgba(9,14,22,.96) 0%, rgba(18,25,37,.94) 44%, rgba(32,22,35,.92) 100%);
  }
  .header-brand-button {
    order: 1;
    width: 120px;
    height: 40px;
  }
  .header-brand-strip {
    order: 1;
    width: 100%;
    max-width: none;
    height: 60px;
  }
  .search-global {
    order: 2;
    flex-basis: 100%;
    max-width: none;
    min-width: 0;
  }
  .header-actions {
    order: 1;
    width: auto;
    margin-left: auto;
    justify-content: flex-end;
  }
  .content {
    min-height: calc(100vh - var(--header-h));
    overflow: visible;
  }
  .page {
    padding: 18px 14px 36px;
  }
  .dashboard-appbar {
    grid-template-columns: 1fr;
  }
  .cloud-details-drawer {
    right: 10px !important;
    left: 10px !important;
    top: 92px !important;
    bottom: 10px !important;
    width: auto !important;
    border-radius: 14px !important;
  }
}
.sheet-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 0 0 10px;
}
.sheet-title {
  font-size: 14px;
  font-weight: 900;
  color: var(--text);
}
.sheet-copy {
  margin-top: 3px;
  font-size: 12px;
  color: var(--text-3);
}
.sheet-actions {
  display: grid;
  gap: 8px;
}
.sheet-action {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: center;
  min-height: 58px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface-2);
  text-align: left;
}
.sheet-action:hover {
  border-color: rgba(198,57,93,.28);
  background: var(--surface);
}
.sheet-action span {
  grid-row: 1 / span 2;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--new-bg);
  color: var(--brand);
}
.sheet-action strong {
  font-size: 14px;
  font-weight: 900;
  color: var(--text);
}
.sheet-action small {
  font-size: 12px;
  color: var(--text-3);
}
@keyframes sheetUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 900px) {
  .drive-page-pad { padding: 0 !important; }
  .drive-shell {
    border-radius: 0 !important;
    min-height: calc(100vh - var(--header-h)) !important;
  }
  .drive-toolbar {
    padding: 12px 14px !important;
    align-items: flex-start !important;
  }
  .drive-actions {
    width: 100%;
    justify-content: flex-start !important;
  }
  .drive-actions > button {
    height: 36px !important;
  }
  .dental-lab-hero {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .dental-lab-hero > .btn {
    justify-self: start;
  }
  .dental-lab-grid {
    grid-template-columns: 1fr;
  }
  .dental-planner-preview {
    grid-template-columns: 1fr;
  }
  .dental-cut-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .drive-selection-bar {
    min-height: 0 !important;
    display: grid !important;
    grid-template-columns: 1fr !important;
    align-items: stretch !important;
    padding: 10px !important;
  }
  .drive-selection-bar > div {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px !important;
  }
  .drive-selection-bar > div .btn,
  .drive-selection-bar > div button {
    width: 100%;
    justify-content: center;
    min-width: 0;
  }
  .drive-selection-bar > div .btn:only-child,
  .drive-selection-bar > div button:only-child {
    grid-column: 1 / -1;
  }
  .drive-context-menu {
    left: 10px !important;
    right: 10px !important;
    top: auto !important;
    bottom: 10px !important;
    width: auto !important;
    border-radius: 18px !important;
    padding: 10px !important;
    display: grid !important;
    grid-template-columns: 1fr !important;
  }
  .drive-context-menu button {
    min-height: 46px;
    font-size: 13.5px;
  }
  .drive-open-tab {
    min-width: 104px;
    max-width: 150px;
  }
  .drive-action-primary,
  .drive-actions > button {
    padding-inline: 10px !important;
    font-size: 11px !important;
  }
  .search-global input {
    height: 40px;
    padding-inline: 40px 52px;
    font-size: 13px;
  }
  .search-global .si-action { right: 6px; width: 30px; height: 30px; border-radius: 11px; }
  .search-popover {
    top: calc(100% + 8px);
    padding: 6px;
    border-radius: 14px;
  }
  .header-actions {
    gap: 6px;
  }
  .row-actions {
    opacity: 1;
  }
  .icon-btn,
  .avatar-btn {
    height: 38px;
  }
  .page-title {
    font-size: 20px;
  }
  .page-sub {
    font-size: 12.5px;
  }
  .drive-toolbar {
    gap: 10px !important;
  }
  .drive-crumbs {
    width: 100%;
    gap: 8px !important;
    font-size: 15px !important;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }
  .drive-crumbs::-webkit-scrollbar {
    display: none;
  }
  .drive-open-tabs {
    padding-inline: 8px;
  }
  .drive-files-group-grid {
    grid-template-columns: 1fr !important;
  }
  .drive-files-table-wrap {
    overflow-x: visible !important;
  }
  .drive-files-table-wrap table,
  .drive-mobile-table {
    min-width: 0 !important;
    width: 100% !important;
    table-layout: auto !important;
  }
  .drive-mobile-table thead {
    display: none;
  }
  .drive-mobile-table tbody,
  .drive-mobile-table tr,
  .drive-mobile-table td {
    display: block;
    width: 100% !important;
  }
  .drive-mobile-table .drive-patient-row,
  .drive-mobile-table .drive-file-row {
    position: relative;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 0 10px;
    padding: 12px 12px 12px 50px;
    border: 1px solid var(--border) !important;
    border-radius: 14px;
    background: var(--surface) !important;
    box-shadow: 0 10px 24px rgba(15,23,42,.08);
  }
  .drive-mobile-table .drive-mobile-check {
    position: absolute;
    left: 12px;
    top: 15px;
    width: 26px !important;
    padding: 0 !important;
    border: 0 !important;
  }
  .drive-mobile-table .drive-mobile-name {
    padding: 0 0 8px !important;
    border: 0 !important;
  }
  .drive-mobile-table .drive-mobile-name button {
    align-items: flex-start !important;
    gap: 10px !important;
    font-size: 15px !important;
    line-height: 1.22 !important;
  }
  .drive-mobile-table .drive-mobile-name button span {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
  }
  .drive-mobile-table .drive-mobile-meta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: auto !important;
    padding: 3px 10px 3px 0 !important;
    border: 0 !important;
    text-align: left !important;
    color: var(--text-2) !important;
    font-size: 12.5px !important;
  }
  .drive-mobile-table .drive-mobile-meta::before {
    content: attr(data-label);
    color: var(--text-3);
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
  }
  .drive-mobile-table .drive-mobile-actions {
    padding: 8px 0 0 !important;
    border: 0 !important;
  }
  .drive-mobile-table .drive-mobile-actions .row-actions,
  .drive-mobile-table .drive-mobile-actions {
    display: flex;
    justify-content: flex-start !important;
    gap: 8px;
    flex-wrap: wrap;
  }
  .drive-mobile-table .drive-mobile-actions button {
    min-width: 36px;
  }
  .drive-mobile-table .drive-group-row {
    display: block;
    height: auto !important;
    margin: 16px 0 8px;
    border: 0 !important;
  }
  .drive-mobile-table .drive-group-row td {
    display: block;
    padding: 10px 0 8px !important;
    border: 0 !important;
    background: transparent !important;
  }
  .file-list-thumb {
    width: 86px !important;
    height: 68px !important;
    border-radius: 12px !important;
  }
  .file-list-thumb img {
    height: 68px !important;
  }
  .drive-file-card-preview {
    height: 220px !important;
  }
  .dashboard-ref-table th,
  .dashboard-ref-table td {
    padding-inline: 12px !important;
  }
  .cloud-details-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  .update-snack {
    left: 10px;
    right: 10px;
    top: auto;
    bottom: 10px;
    max-width: none;
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) auto 30px;
    align-items: center;
    gap: 8px;
    padding: 9px;
    border-radius: 14px;
  }
  .update-snack span {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.25;
    font-size: 11.5px;
  }
  .update-snack button:not(.mini-btn) {
    height: 32px;
    padding-inline: 9px;
    font-size: 0;
  }
  .update-snack button:not(.mini-btn) svg {
    margin: 0;
  }
  .update-snack .mini-btn {
    width: 30px;
    height: 30px;
  }
  .upload-jobs-toast {
    left: 10px !important;
    right: 10px !important;
    top: auto !important;
    bottom: 66px !important;
    width: auto !important;
  }
  .upload-job-card {
    box-shadow: var(--sh-lg) !important;
  }
  .image-preview-shell,
  .pdf-preview-shell,
  .office-preview-shell,
  .sandbox-upload-shell,
  .create-folder-shell {
    padding: 10px !important;
  }
  .image-preview-modal,
  .pdf-preview-modal,
  .office-preview-modal,
  .sandbox-upload-modal,
  .create-folder-modal {
    width: min(100vw - 20px, 100%) !important;
    border-radius: 14px !important;
  }
  .image-preview-head {
    height: auto !important;
    min-height: 58px !important;
    align-items: flex-start !important;
    flex-wrap: wrap !important;
    padding: 10px !important;
  }
  .image-preview-actions {
    width: 100%;
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px !important;
  }
  .image-preview-actions .btn,
  .image-preview-actions .mini-btn,
  .image-preview-actions label {
    width: 100%;
    min-width: 0;
    justify-content: center;
    padding-inline: 7px !important;
  }
  .image-preview-actions .btn span,
  .image-preview-actions label {
    white-space: nowrap;
  }
  .image-preview-tools {
    max-height: 34vh;
    overflow: auto;
    align-items: flex-start !important;
    gap: 8px !important;
  }
  .image-preview-tools label {
    width: 100%;
    justify-content: space-between;
  }
  .image-preview-tools label input {
    width: min(210px, 54vw);
  }
  .image-preview-body {
    height: calc(100vh - 188px) !important;
    min-height: 320px;
    grid-template-columns: 40px minmax(0, 1fr) 40px !important;
    gap: 6px !important;
    padding: 10px !important;
  }
  .pdf-preview-modal {
    height: min(100vh - 20px, 100%) !important;
    grid-template-rows: 54px 1fr !important;
  }
}

@media (max-width: 520px) {
  .header {
    top: 0;
    padding: 8px 10px;
  }
  .header-brand-button {
    width: 108px;
    height: 38px;
  }
  .header-brand-strip {
    grid-template-columns: 48px minmax(0, 1fr) 34px;
    height: 42px;
    gap: 8px;
  }
  .header-brand-copy span {
    font-size: 12px;
  }
  .header-brand-copy small {
    font-size: 10px;
  }
  .search-global {
    flex-basis: 100%;
  }
  .user-profile-sheet {
    right: -2px;
    width: min(340px, calc(100vw - 16px));
  }
  .search-result {
    grid-template-columns: 32px 1fr;
    gap: 8px;
    padding: 8px 9px;
  }
  .sr-icon {
    width: 30px;
    height: 30px;
  }
  .sr-copy strong {
    font-size: 12.5px;
  }
  .sr-copy small {
    font-size: 11px;
  }
  .drive-action-primary,
  .drive-actions > button,
  .btn.btn-sm {
    height: 34px !important;
    padding-inline: 9px !important;
    font-size: 10.5px !important;
  }
  .drive-files-table-wrap table {
    min-width: 0 !important;
  }
  .cloud-details-drawer {
    top: 84px !important;
    bottom: 8px !important;
    left: 8px !important;
    right: 8px !important;
    width: auto !important;
    max-width: none !important;
  }
  .cloud-details-drawer .cloud-details-head {
    padding: 11px !important;
  }
  .cloud-details-drawer .cloud-details-preview {
    height: 112px !important;
    margin-bottom: 9px !important;
  }
  .cloud-details-drawer .scroll {
    padding: 11px !important;
  }
  .cloud-details-drawer input,
  .cloud-details-drawer textarea,
  .cloud-details-drawer select {
    max-width: 100%;
  }
  .cloud-details-drawer .btn {
    min-width: 0;
  }
  .page {
    padding: 14px 10px 28px;
  }
  .dental-lab-page {
    padding-inline: 10px;
  }
  .dental-lab-hero {
    padding: 14px;
    border-radius: 15px;
  }
  .dental-lab-hero h1 {
    font-size: 25px;
  }
  .dental-lab-study {
    grid-template-columns: 36px minmax(0, 1fr);
  }
  .dental-lab-study span {
    width: 36px;
    height: 36px;
  }
  .dental-lab-panel {
    padding: 13px;
    border-radius: 14px;
  }
  .dental-lab-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
  .dental-lab-actions .btn {
    width: 100%;
    justify-content: center;
  }
  .dental-engine-actions {
    grid-template-columns: 1fr;
  }
  .dental-engine-actions button {
    width: 100%;
  }
  .dental-arch {
    min-height: 150px;
  }
  .dental-cut-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .profile-page {
    max-width: none;
  }
  .profile-app-grid {
    grid-template-columns: 1fr;
  }
  .profile-app-tabs {
    width: 100%;
  }
  .profile-hero-card {
    min-height: 190px;
  }
  .profile-security-grid {
    grid-template-columns: 1fr;
  }
  .profile-security-card {
    min-height: 180px;
  }
  .profile-field-grid {
    grid-template-columns: 1fr;
  }
  .profile-save-row {
    justify-content: stretch;
  }
  .profile-save-row .btn {
    width: 100%;
    justify-content: center;
  }
}

[data-theme="dark"] .header {
  background:
    linear-gradient(90deg, rgba(6,8,12,.96) 0%, rgba(11,15,23,.94) 44%, rgba(28,18,31,.92) 100%);
  border-bottom-color: rgba(148,163,184,.18);
}
[data-theme="dark"] .header::before {
  opacity: .42;
}
[data-theme="dark"] .header-brand-strip {
  background: rgba(15,19,27,.76);
  border-color: rgba(148,163,184,.18);
  box-shadow: 0 18px 40px rgba(0,0,0,.32), inset 0 1px 0 rgba(255,255,255,.04);
}
[data-theme="dark"] .header-brand-badge {
  background: rgba(255,255,255,.08);
  border-color: rgba(148,163,184,.18);
}
[data-theme="dark"] table,
[data-theme="dark"] tbody,
[data-theme="dark"] tr {
  color: var(--text);
}
[data-theme="dark"] th,
[data-theme="dark"] td {
  color: var(--text);
}
[data-theme="dark"] .card {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
[data-theme="dark"] .content {
  background:
    linear-gradient(180deg, rgba(255,255,255,.018), transparent 260px),
    var(--bg);
}
[data-theme="dark"] .drive-context-menu {
  background: rgba(17,24,36,.96);
  border-color: rgba(148,163,184,.22);
}
[data-theme="dark"] .user-menu,
[data-theme="dark"] .notifications-menu {
  background: rgba(12,16,23,.98);
  border-color: rgba(148,163,184,.18);
  box-shadow: 0 28px 64px rgba(0,0,0,.42), 0 1px 0 rgba(255,255,255,.04) inset;
}
[data-theme="dark"] .dashboard-welcome-card {
  background: linear-gradient(135deg, rgba(20,26,36,.96), rgba(13,18,27,.96));
  border-color: rgba(148,163,184,.18);
  box-shadow: 0 22px 52px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.045);
}
[data-theme="dark"] .profile-sheet-nav button {
  background: rgba(255,255,255,.045);
  border-color: rgba(148,163,184,.18);
}
[data-theme="dark"] .profile-sheet-status {
  background: linear-gradient(135deg, rgba(219,56,98,.16), rgba(42,111,219,.12));
  border-color: rgba(148,163,184,.18);
}
[data-theme="dark"] .profile-pwa-panel {
  background:
    radial-gradient(circle at 10% 0%, rgba(219,56,98,.18), transparent 44%),
    rgba(255,255,255,.04);
  border-color: rgba(148,163,184,.18);
}
[data-theme="dark"] .profile-contact-card {
  background:
    radial-gradient(circle at 0% 0%, rgba(219,56,98,.14), transparent 36%),
    linear-gradient(180deg, rgba(19,25,36,.96), rgba(12,17,26,.96));
  border-color: rgba(148,163,184,.18);
}
[data-theme="dark"] .profile-app-tabs {
  background:
    linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,.028));
  border-color: rgba(148,163,184,.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 10px 26px rgba(0,0,0,.18);
}
[data-theme="dark"] .profile-field-control {
  background:
    linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,.028));
  border-color: rgba(148,163,184,.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 10px 26px rgba(0,0,0,.18);
}
[data-theme="dark"] .profile-field-control:focus-within {
  border-color: rgba(219,56,98,.50);
  box-shadow: 0 0 0 4px rgba(219,56,98,.13), inset 0 1px 0 rgba(255,255,255,.04);
}
[data-theme="dark"] .user-menu .profile-pwa-actions button {
  background: rgba(255,255,255,.045);
  border-color: rgba(148,163,184,.18);
}
[data-theme="dark"] .search-global .si-action,
[data-theme="dark"] .dashboard-inline-search-btn,
[data-theme="dark"] .ops-status,
[data-theme="dark"] .avatar-btn,
[data-theme="dark"] .icon-btn {
  background: var(--surface);
}
[data-theme="dark"] .search-popover,
[data-theme="dark"] .user-menu,
[data-theme="dark"] .notifications-menu,
[data-theme="dark"] .folder-action-popover,
[data-theme="dark"] .update-snack {
  background: rgba(15,19,27,.96);
  border-color: rgba(148,163,184,.22);
}
[data-theme="dark"] .cloud-details-drawer {
  background: #0f141d !important;
  color: var(--text) !important;
  border-color: rgba(148,163,184,.26) !important;
  box-shadow: 0 30px 90px rgba(0,0,0,.58), 0 1px 0 rgba(255,255,255,.045) inset !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
[data-theme="dark"] .cloud-details-head {
  background:
    radial-gradient(circle at 15% 0%, rgba(219,56,98,.18), transparent 36%),
    linear-gradient(180deg, #151c29, #101722) !important;
  border-color: rgba(148,163,184,.20) !important;
}
[data-theme="dark"] .cloud-details-preview,
[data-theme="dark"] .cloud-details-tabs,
[data-theme="dark"] .cloud-details-drawer .card,
[data-theme="dark"] .cloud-details-drawer input,
[data-theme="dark"] .cloud-details-drawer textarea,
[data-theme="dark"] .cloud-details-drawer select {
  background: #121a26 !important;
  color: var(--text) !important;
  border-color: rgba(148,163,184,.24) !important;
}
[data-theme="dark"] .cloud-details-tabs button.active {
  background: #182231 !important;
  color: var(--text) !important;
}
[data-theme="dark"] .skeleton {
  background: linear-gradient(90deg, #101722 25%, #172033 50%, #101722 75%);
  background-size: 200% 100%;
}

/* Content scroll area */
.content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  z-index: auto;
}
.page { padding: 28px 32px 56px; max-width: 1480px; margin: 0 auto; }

/* Page head */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.page-title { font-size: 25px; font-weight: 800; letter-spacing: -.02em; }
.page-sub { font-size: 14px; color: var(--text-2); margin-top: 4px; }

/* ===== Avatar ===== */
.avatar {
  border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; color: #fff; flex: none; letter-spacing: -.01em;
  background: var(--ink-2);
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  height: 42px; padding: 0 18px; border-radius: var(--r-sm);
  font-size: 14px; font-weight: 700; transition: all .16s; white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--brand-grad); color: #fff; box-shadow: var(--sh-brand); }
.btn-primary:hover { filter: brightness(1.04); transform: translateY(-1px); box-shadow: 0 12px 26px rgba(198,57,93,.36); }
.btn-ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); }
.btn-ghost:hover { background: var(--bg-sunken); border-color: var(--border-strong); }
.btn-soft { background: var(--new-bg); color: var(--brand); }
.btn-soft:hover { background: rgba(219,56,98,.18); }
.btn-sm { height: 34px; padding: 0 13px; font-size: 13px; border-radius: 9px; }
.btn-icon-only { padding: 0; width: 42px; }

/* ===== Cards ===== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-sm); }
.card-pad { padding: 20px; }

/* ===== Badges ===== */
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px;
  border-radius: var(--r-pill); font-size: 12px; font-weight: 700; white-space: nowrap;
}
.badge .bd { width: 6px; height: 6px; border-radius: 99px; }
.badge-new { background: var(--new-bg); color: var(--brand); }
.badge-new .bd { background: var(--brand-bright); }
.badge-ok { background: var(--ok-bg); color: #0b7a6c; }
.badge-ok .bd { background: var(--ok); }
.badge-pend { background: var(--warn-bg); color: #9a6712; }
.badge-pend .bd { background: var(--warn); }
.badge-up { background: var(--info-bg); color: #2a5fa0; }
.badge-up .bd { background: var(--info); }
.badge-err { background: var(--danger-bg); color: var(--danger); }
.badge-err .bd { background: var(--danger); }
.badge-neutral { background: var(--bg-sunken); color: var(--text-2); }
.badge-neutral .bd { background: var(--text-3); }

/* ===== Chips / tabs ===== */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px;
  border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--border-strong);
  font-size: 13px; font-weight: 600; color: var(--text-2); transition: all .16s;
}
.chip:hover { border-color: var(--brand-support); color: var(--text); }
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip.active .chip-count { color: rgba(255,255,255,.6); }
.chip .chip-count { font-size: 12px; color: var(--text-3); font-weight: 700; }

/* ===== Tables ===== */
.tbl-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--sh-sm); }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl thead th {
  text-align: left; font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-3); font-weight: 700; padding: 14px 16px; background: var(--surface-2);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.tbl tbody td { padding: 13px 16px; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr:last-child td { border-bottom: none; }
.cell-strong { font-weight: 700; color: var(--text); }
.cell-muted { color: var(--text-2); }

.row-actions { display: flex; gap: 4px; opacity: 0; transition: opacity .14s; }
.tbl tbody tr:hover .row-actions { opacity: 1; }
.tbl tbody tr:focus-within .row-actions { opacity: 1; }
.mini-btn {
  width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center;
  color: var(--text-2); transition: all .14s;
}
.mini-btn:hover { background: var(--new-bg); color: var(--brand); }
.mini-btn svg { width: 17px; height: 17px; }

/* ===== Stat cards ===== */
.stat-grid { display: grid; gap: 16px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 18px 18px 16px; box-shadow: var(--sh-sm); position: relative; overflow: hidden; transition: transform .16s, box-shadow .16s; }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--sh); }
.stat-ico { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; margin-bottom: 14px; }
.stat-ico svg { width: 20px; height: 20px; }
.stat-val { font-size: 30px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.stat-label { font-size: 13px; color: var(--text-2); font-weight: 600; margin-top: 7px; }
.stat-delta { font-size: 12px; font-weight: 700; margin-top: 9px; display: inline-flex; align-items: center; gap: 4px; }
.stat-delta.up { color: var(--ok); }
.stat-delta.flat { color: var(--text-3); }

/* ===== Dashboard ===== */
.dashboard-head { align-items: center; }
.dashboard-welcome-card {
  margin-bottom: 18px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(255,255,255,.96), rgba(247,248,252,.92));
  box-shadow: 0 20px 48px rgba(15,23,42,.08), inset 0 1px 0 rgba(255,255,255,.78);
}
.dashboard-appbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 460px);
  gap: 18px;
  align-items: end;
  margin-bottom: 18px;
}
.dashboard-appbar-copy { min-width: 0; }
.dashboard-inline-search {
  position: relative;
  display: flex;
  align-items: center;
}
.dashboard-inline-search input {
  width: 100%;
  height: 52px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 0 58px 0 46px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  outline: none;
  box-shadow: var(--sh-sm);
}
.dashboard-inline-search input:focus {
  border-color: rgba(219,56,98,.34);
  box-shadow: 0 0 0 4px rgba(219,56,98,.08), var(--sh);
}

/* ===== Office document modal ===== */
.image-preview-shell,
.pdf-preview-shell,
.office-preview-shell,
.sandbox-upload-shell,
.create-folder-shell,
.modal-scrim {
  z-index: var(--z-overlay) !important;
}
.drive-context-menu,
.folder-action-popover,
.cloud-details-drawer {
  z-index: calc(var(--z-menu) + 20) !important;
}

.pdf-preview-shell {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  display: grid;
  place-items: center;
  padding: clamp(8px, 2vw, 18px);
  background: rgba(7,9,12,.82);
}
.pdf-preview-modal {
  width: min(1180px, 98vw);
  height: min(860px, calc(100dvh - 36px));
  min-height: 420px;
  background: var(--surface);
  color: var(--text);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 30px 90px rgba(0,0,0,.45);
  border: 1px solid rgba(148,163,184,.24);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}
.pdf-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.pdf-preview-head .btn {
  white-space: nowrap;
}
.pdf-preview-modal iframe {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  background: #202124;
}
@media (max-width: 720px) {
  .pdf-preview-shell {
    padding: 8px !important;
    align-items: stretch;
  }
  .pdf-preview-modal {
    width: 100% !important;
    height: calc(100dvh - 16px) !important;
    min-height: 0;
    border-radius: 14px;
  }
  .pdf-preview-head {
    min-height: 0;
    align-items: flex-start;
    padding: 10px;
  }
  .pdf-preview-head > div:first-child {
    min-width: 0;
  }
  .pdf-preview-head > div:last-child {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px !important;
  }
  .pdf-preview-head .btn {
    height: 36px;
    padding: 0 10px;
    font-size: 12px;
  }
}

.office-preview-shell {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(7,9,12,.58);
}
.office-preview-modal {
  width: min(760px, 96vw);
  background: var(--surface);
  color: var(--text);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 30px 90px rgba(0,0,0,.35);
  border: 1px solid rgba(148,163,184,.24);
}
.office-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.office-preview-body {
  padding: 24px;
  display: grid;
  gap: 16px;
}
.office-preview-state {
  min-height: 220px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 22px;
}
.office-preview-icon {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  background: var(--new-bg);
  color: var(--brand);
}
.office-preview-ext {
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 6px;
}
.office-preview-title {
  color: var(--text);
  font-size: 18px;
  font-weight: 900;
}
.office-preview-copy {
  margin-top: 6px;
  color: var(--text-2);
  font-size: 13px;
}
[data-theme="dark"] .office-preview-state,
[data-theme="dark"] .office-preview-head {
  background: rgba(255,255,255,.035);
}
.dashboard-inline-search-icon {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  display: grid;
  place-items: center;
}
.dashboard-inline-search-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: var(--brand-grad);
  color: #fff;
  box-shadow: var(--sh-brand);
}
.dashboard-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.dash-readonly {
  height: 42px;
  background: var(--surface-2);
}
.dashboard-stat-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.dashboard-page {
  max-width: 1320px;
}
.dashboard-ref-card {
  overflow: hidden;
}
.dashboard-ref-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
}
.dashboard-ref-table td,
.dashboard-ref-table th {
  white-space: nowrap;
}
.dashboard-sort-head {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: inherit;
  gap: 6px;
  color: var(--text-3);
  font-size: 11.5px;
  letter-spacing: .04em;
  text-transform: uppercase;
  font-weight: 800;
}
.dashboard-sort-head:hover,
.dashboard-sort-head.active {
  color: var(--brand);
}
.dashboard-sort-head span:last-child {
  font-size: 11px;
  letter-spacing: 0;
}
.dashboard-branch-row td {
  padding: 9px 16px !important;
  background: var(--bg-sunken);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.dashboard-branch-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  text-align: left;
}
.dashboard-branch-toggle svg {
  color: var(--text-3);
  transition: transform .16s;
}
.dashboard-branch-toggle span {
  display: inline-flex;
  align-items: center;
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
}
.dashboard-branch-toggle small {
  margin-left: 9px;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 800;
}
.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.58fr) minmax(300px, .92fr);
  align-items: start;
}
.dashboard-primary {
  min-width: 0;
  overflow: hidden;
}
.dashboard-side {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.dashboard-section-note {
  margin-top: 4px;
  color: var(--text-2);
  font-size: 12.5px;
}
.quick-grid {
  display: grid;
  gap: 8px;
}
.quick-action {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 11px;
  text-align: left;
  padding: 10px 11px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  transition: border-color .16s, background .16s, box-shadow .16s, transform .16s;
}
.quick-action:hover {
  border-color: rgba(198,57,93,.32);
  background: var(--surface);
  box-shadow: var(--sh-sm);
  transform: translateY(-1px);
}
.quick-ico {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--brand);
  background: var(--new-bg);
}
.quick-copy {
  min-width: 0;
}
.quick-copy strong,
.quick-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.quick-copy strong {
  color: var(--text);
  font-size: 13.5px;
  font-weight: 800;
}
.quick-copy small {
  color: var(--text-3);
  font-size: 11.5px;
  margin-top: 2px;
}
.quick-action > svg {
  color: var(--text-3);
}
.dashboard-empty-row {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: var(--text-2);
  font-size: 13px;
  text-align: center;
}
.dashboard-empty-row svg {
  color: var(--text-3);
  flex: none;
}
.dashboard-mini-empty {
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12.5px;
  line-height: 1.45;
  padding: 13px;
}
.patient-gate {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.patient-gate-icon {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: var(--brand);
  background: var(--new-bg);
}
.patient-gate-actions {
  grid-column: 2;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}

@media (max-width: 1340px) {
  .dashboard-layout {
    grid-template-columns: 1fr;
  }
  .dashboard-side {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
  }
}

@media (max-width: 1080px) {
  .dashboard-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dashboard-side {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .dashboard-ref-head {
    display: grid;
  }
  .dashboard-head-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .dashboard-head-actions .btn,
  .dashboard-head-actions .ops-status {
    flex: 1 1 180px;
  }
  .dashboard-stat-grid {
    grid-template-columns: 1fr;
  }
  .patient-gate {
    grid-template-columns: 1fr;
  }
  .patient-gate-actions {
    grid-column: 1;
  }
}

/* ===== Clinical Study Timeline (signature) ===== */
.timeline { position: relative; }
.tl-track { display: flex; align-items: flex-start; gap: 0; position: relative; }
.tl-node { flex: 1; display: flex; flex-direction: column; align-items: center; position: relative; min-width: 0; }
.tl-line { position: absolute; top: 19px; height: 2px; background: var(--border-strong); z-index: 0; }
.tl-dot {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: var(--surface); border: 2px solid var(--border-strong); color: var(--text-3);
  z-index: 1; position: relative; transition: all .16s;
}
.tl-dot svg { width: 19px; height: 19px; }
.tl-node.done .tl-dot { background: var(--ink); border-color: var(--ink); color: #fff; }
.tl-node.current .tl-dot { background: var(--brand-grad); border-color: transparent; color: #fff; box-shadow: var(--sh-brand); }
.tl-node.current .tl-dot::after { content:""; position:absolute; inset:-5px; border-radius:16px; border:2px solid var(--brand-bright); opacity:.4; }
.tl-cap { margin-top: 10px; text-align: center; padding: 0 4px; }
.tl-cap .t1 { font-size: 12.5px; font-weight: 700; color: var(--text); }
.tl-cap .t2 { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.tl-node.future .tl-cap .t1 { color: var(--text-3); }

/* vertical timeline */
.tl-v { display: flex; flex-direction: column; gap: 0; }
.tl-v-item { display: flex; gap: 14px; position: relative; padding-bottom: 18px; }
.tl-v-item:last-child { padding-bottom: 0; }
.tl-v-rail { position: relative; display: flex; flex-direction: column; align-items: center; flex: none; }
.tl-v-rail .line { width: 2px; flex: 1; background: var(--border-strong); margin-top: 2px; }
.tl-v-item:last-child .line { display: none; }
.tl-v-body { padding-bottom: 4px; min-width: 0; flex: 1; }

/* ===== Empty / loading ===== */
.empty { text-align: center; padding: 60px 20px; color: var(--text-2); }
.empty .e-ico { width: 64px; height: 64px; border-radius: 18px; background: var(--bg-sunken); display: grid; place-items: center; margin: 0 auto 16px; color: var(--text-3); }
.empty .e-ico svg { width: 30px; height: 30px; }
.empty h3 { font-size: 17px; color: var(--text); font-weight: 700; }
.empty p { font-size: 13.5px; margin-top: 6px; max-width: 360px; margin-inline: auto; }
.skeleton { background: linear-gradient(90deg, #eef1f6 25%, #f6f8fb 50%, #eef1f6 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.image-loading-card {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  gap: 8px;
  color: rgba(255,255,255,.72);
  background: #0a0e14;
}
.image-loading-card .skeleton {
  width: 54%;
  height: 42%;
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(255,255,255,.06) 25%, rgba(255,255,255,.12) 50%, rgba(255,255,255,.06) 75%);
  background-size: 200% 100%;
}
.image-loading-card strong {
  font-size: 11.5px;
  font-weight: 850;
}

/* ===== Modal ===== */
.modal-scrim { position: fixed; inset: 0; background: rgba(17,24,36,.46); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 200; padding: 24px; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal { background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--sh-lg); width: 100%; max-width: 520px; overflow: hidden; animation: pop .2s cubic-bezier(.2,.8,.3,1); }
@keyframes pop { from { transform: scale(.96) translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { padding: 22px 24px 0; display: flex; justify-content: space-between; align-items: flex-start; }
.modal-title { font-size: 18px; font-weight: 800; letter-spacing: -.02em; }
.modal-body { padding: 18px 24px 24px; }
.modal-foot { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; background: var(--surface-2); }

/* ===== Form ===== */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12.5px; font-weight: 700; color: var(--text-2); margin-bottom: 7px; }
.field .inp, .field select, .field textarea {
  width: 100%; height: 42px; border-radius: var(--r-sm); border: 1px solid var(--border-strong);
  background: var(--surface); padding: 0 13px; font-size: 14px; color: var(--text); outline: none; transition: border .16s, box-shadow .16s;
}
.field textarea { height: auto; padding: 11px 13px; resize: vertical; min-height: 78px; }
.field .inp:focus, .field select:focus, .field textarea:focus { border-color: var(--brand-bright); box-shadow: 0 0 0 4px rgba(219,56,98,.10); }

/* ===== Utility ===== */
.flex { display: flex; }
.between { display: flex; align-items: center; justify-content: space-between; }
.center { display: flex; align-items: center; }
.gap6 { gap: 6px; } .gap8 { gap: 8px; } .gap10 { gap: 10px; } .gap12 { gap: 12px; } .gap16 { gap: 16px; }
.wrap { flex-wrap: wrap; }
.muted { color: var(--text-2); }
.section-title { font-size: 16px; font-weight: 800; letter-spacing: -.01em; display: flex; align-items: center; gap: 9px; }
.link-act { color: var(--brand); font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; gap: 4px; transition: gap .14s; }
.link-act:hover { gap: 7px; }
.divider { height: 1px; background: var(--border); }

.update-snack {
  position: fixed;
  right: 18px;
  top: 18px;
  z-index: 260;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(420px, calc(100vw - 28px));
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,.96);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--sh-sm);
  font-size: 12px;
  font-weight: 700;
}
.update-snack > svg { color: var(--brand); }
.update-snack span { min-width: 0; }
.update-snack button:not(.mini-btn) {
  height: 28px;
  border-radius: 9px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--brand-grad);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  flex: none;
}
.update-snack .mini-btn {
  width: 28px;
  height: 28px;
  color: var(--text-3);
  flex: none;
}

.dental-lab-page {
  background:
    radial-gradient(circle at 12% 4%, rgba(219,56,98,.13), transparent 28%),
    radial-gradient(circle at 82% 10%, rgba(42,111,219,.11), transparent 28%),
    var(--bg);
}
.dental-lab-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(260px, 380px);
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid rgba(148,163,184,.2);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(13,20,32,.96), rgba(45,23,39,.92));
  color: #fff;
  box-shadow: 0 24px 70px rgba(15,23,42,.14);
}
.dental-lab-hero .btn {
  background: rgba(255,255,255,.08);
  color: #fff;
  border-color: rgba(255,255,255,.16);
}
.dental-lab-kicker {
  display: inline-flex;
  margin-bottom: 7px;
  color: rgba(255,255,255,.62);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.dental-lab-hero h1 {
  margin: 0;
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1;
  letter-spacing: 0;
}
.dental-lab-hero p {
  margin: 8px 0 0;
  max-width: 660px;
  color: rgba(255,255,255,.68);
  font-size: 13.5px;
  line-height: 1.5;
}
.dental-lab-study {
  min-width: 0;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 8px 11px;
  align-items: center;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.07);
}
.dental-lab-study span {
  grid-row: 1 / span 2;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: rgba(219,56,98,.18);
  color: #fff;
}
.dental-lab-study strong,
.dental-lab-study small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dental-lab-study small {
  color: rgba(255,255,255,.62);
  font-size: 11.5px;
}
.dental-lab-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, .9fr);
  gap: 16px;
}
.dental-lab-panel {
  min-width: 0;
  padding: 16px;
  border: 1px solid rgba(148,163,184,.22);
  border-radius: 16px;
  background: var(--surface-grad);
  box-shadow: 0 18px 46px rgba(15,23,42,.08);
}
.dental-lab-wide {
  grid-column: 1 / -1;
}
.dental-flow {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}
.dental-flow-step {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 11px;
  border-radius: 13px;
  background: var(--surface-2);
  border: 1px solid rgba(148,163,184,.18);
}
.dental-flow-step b {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--new-bg);
  color: var(--brand);
}
.dental-flow-step span {
  display: grid;
  gap: 3px;
}
.dental-flow-step small,
.dental-engine-card small,
.dental-lab-note {
  color: var(--text-3);
  line-height: 1.45;
}
.dental-lab-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.dental-engine-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}
.dental-engine-card {
  display: grid;
  gap: 5px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--engine) 26%, var(--border));
  background: linear-gradient(135deg, color-mix(in srgb, var(--engine) 10%, transparent), transparent);
}
.dental-engine-card span {
  justify-self: start;
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--engine) 18%, transparent);
  color: var(--engine);
  font-size: 10.5px;
  font-weight: 900;
}
.dental-engine-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 7px;
  margin-top: 8px;
}
.dental-engine-actions button {
  min-height: 34px;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 9px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--engine) 22%, var(--border));
  background: var(--surface);
  color: var(--text);
  font-size: 11px;
  font-weight: 850;
}
.dental-engine-actions button:hover {
  background: color-mix(in srgb, var(--engine) 13%, var(--surface));
  color: var(--engine);
}
.dental-engine-actions button:disabled {
  opacity: .46;
  cursor: default;
}
.dental-lab-toast {
  margin-top: 12px;
  padding: 9px 10px;
  border-radius: 12px;
  background: var(--ok-bg);
  border: 1px solid rgba(15,155,138,.28);
  color: var(--ok);
  font-size: 12px;
  font-weight: 850;
}
.dental-planner-preview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  margin-top: 14px;
}
.dental-arch {
  position: relative;
  min-height: 190px;
  border-radius: 16px;
  background: radial-gradient(ellipse at 50% 84%, rgba(219,56,98,.18), transparent 42%), #08101d;
  overflow: hidden;
  border: 1px solid rgba(148,163,184,.18);
}
.dental-arch::before {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: 28px;
  height: 132px;
  border: 3px solid rgba(255,255,255,.55);
  border-top: 0;
  border-radius: 0 0 999px 999px;
}
.dental-arch i {
  position: absolute;
  bottom: 42px;
  width: 1px;
  height: 120px;
  background: linear-gradient(180deg, transparent, rgba(91,209,168,.86), transparent);
  transform-origin: bottom;
}
.dental-arch i:nth-child(1) { left: 26%; transform: rotate(-27deg); }
.dental-arch i:nth-child(2) { left: 38%; transform: rotate(-12deg); }
.dental-arch i:nth-child(3) { left: 50%; }
.dental-arch i:nth-child(4) { left: 62%; transform: rotate(12deg); }
.dental-arch i:nth-child(5) { left: 74%; transform: rotate(27deg); }
.dental-cut-list {
  display: grid;
  gap: 8px;
}
.dental-cut-list button {
  height: 36px;
  min-width: 72px;
  border-radius: 11px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 850;
}
.dental-lab-note {
  margin: 12px 0 0;
  font-size: 12.5px;
}

/* fade-in for route changes */
.route-fade { animation: routeIn .26s ease; }
@keyframes routeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ============================================================
   Login — portada clinica INTEGRA sobre placa oscura
   Siempre en paleta visor oscuro: es la firma, no depende del tema.
   ============================================================ */
.login-screen {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center; padding: 34px;
  background:
    radial-gradient(90% 80% at 82% 18%, rgba(219,56,98,.32) 0%, transparent 58%),
    linear-gradient(135deg, #101622 0%, #171d2a 46%, #080b11 100%);
  overflow: hidden;
  --film: #141a24;
  --film-inset: #0c1017;
  --film-line: rgba(148,163,184,.16);
  --film-line-2: rgba(148,163,184,.26);
  --film-text: #eef2f8;
  --film-text-2: #9aa6b8;
  --film-text-3: #6b7689;
  color-scheme: dark;
}

/* Backdrop: pieza clinica real + marca geometrica tenue */
.login-viewer { position: absolute; inset: 0; pointer-events: none; }
.login-cover {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(8,11,17,.14) 0%, rgba(8,11,17,.06) 34%, rgba(8,11,17,.72) 66%, rgba(8,11,17,.92) 100%),
    linear-gradient(180deg, rgba(8,11,17,.10) 0%, rgba(8,11,17,.52) 100%),
    url("login-clinical-cover.jpg") center / cover no-repeat;
  transform: scale(1.012);
}
.login-brand-watermark {
  position: absolute;
  right: -72px;
  bottom: -120px;
  width: min(48vw, 620px);
  aspect-ratio: 1;
  background: url("integra-production-logo.png") center / contain no-repeat;
  opacity: .055;
  filter: grayscale(1) brightness(2.4);
}
.login-cbct {
  position: absolute; top: 52%; right: min(42vw, 520px);
  width: min(64vh, 620px); height: min(64vh, 620px);
  transform: translateY(-50%);
  color: #dbe8ff; opacity: .10;
  -webkit-mask-image: radial-gradient(circle at center, #000 38%, transparent 72%);
          mask-image: radial-gradient(circle at center, #000 38%, transparent 72%);
}
.login-glow {
  position: absolute; top: 46%; right: min(9vw, 130px);
  width: 520px; height: 520px; transform: translateY(-50%);
  background: radial-gradient(circle, rgba(219,56,98,.34) 0%, rgba(219,56,98,.10) 38%, transparent 68%);
  filter: blur(10px);
}

.login-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 18px;
  width: min(100%, 462px);
}

.login-panel {
  position: relative; width: 100%;
  display: flex; flex-direction: column;
  padding: 36px 38px 30px;
  background:
    linear-gradient(180deg, rgba(22,29,41,.94) 0%, rgba(12,16,23,.96) 100%);
  border: 1px solid rgba(226,232,240,.15);
  border-radius: 20px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow:
    0 40px 90px rgba(0,0,0,.55),
    0 8px 26px rgba(0,0,0,.40),
    0 1px 0 rgba(255,255,255,.05) inset;
  animation: loginRise .5s cubic-bezier(.2,.7,.2,1);
}
.login-panel::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(115deg, rgba(219,56,98,.10), rgba(219,56,98,.52), rgba(130,155,176,.18), rgba(219,56,98,.10));
  background-size: 260% 260%;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  opacity: .74;
  pointer-events: none;
  animation: loginPanelLoop 7s ease-in-out infinite;
}
@keyframes loginRise { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes loginPanelLoop {
  0%, 100% { background-position: 0% 50%; opacity: .42; }
  45% { background-position: 100% 50%; opacity: .86; }
}
@media (prefers-reduced-motion: reduce) {
  .login-panel,
  .login-panel::before,
  .spin {
    animation: none !important;
  }
}

/* Canto iluminado de la placa (luz del negatoscopio) */
.login-filmedge {
  position: absolute; top: 0; left: 26px; right: 26px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--brand-bright), transparent);
  opacity: .85;
}
.login-filmedge::after {
  content: ""; position: absolute; top: -1px; left: 20%; right: 20%; height: 22px;
  background: radial-gradient(60% 100% at 50% 0, rgba(219,56,98,.34), transparent 75%);
  filter: blur(5px);
}

.login-brand { display: flex; align-items: center; justify-content: center; margin-bottom: 28px; }
.login-logo-img {
  display: block;
  width: min(100%, 306px);
  height: auto;
  filter: drop-shadow(0 14px 30px rgba(219,56,98,.18));
}

.login-title { font-size: 28px; font-weight: 800; letter-spacing: 0; color: var(--film-text); line-height: 1.12; text-align: center; }
.login-sub { margin-top: 9px; font-size: 13.5px; line-height: 1.55; color: var(--film-text-2); text-align: center; }

.login-field { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.login-label { font-size: 12.5px; font-weight: 600; color: var(--film-text-2); }
.login-input {
  display: flex; align-items: center; gap: 10px;
  padding: 0 12px; height: 50px;
  background: var(--film-inset);
  border: 1px solid var(--film-line);
  border-radius: 14px;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
.login-input:focus-within {
  border-color: var(--brand-support);
  box-shadow: 0 0 0 3px rgba(219,56,98,.18);
  background: #0e131c;
}
.login-input.is-error { border-color: rgba(229,90,110,.55); box-shadow: 0 0 0 3px rgba(229,90,110,.14); }
.login-ico { color: var(--film-text-3); flex: none; }
.login-input-el {
  flex: 1; min-width: 0; height: 100%; border: none; outline: none; background: transparent;
  color: var(--film-text); font-family: var(--font); font-size: 15px; letter-spacing: .005em;
  caret-color: var(--brand-bright);
  appearance: none;
  -webkit-appearance: none;
}
.login-input-el::placeholder { color: var(--film-text-3); }
.login-input-el:-webkit-autofill,
.login-input-el:-webkit-autofill:hover,
.login-input-el:-webkit-autofill:focus,
.login-input-el:-webkit-autofill:active {
  -webkit-text-fill-color: var(--film-text) !important;
  caret-color: var(--brand-bright);
  box-shadow: 0 0 0 1000px var(--film-inset) inset !important;
  border: 0 !important;
  transition: background-color 9999s ease-in-out 0s;
}
.login-input:has(.login-input-el:-webkit-autofill) {
  background: var(--film-inset);
}
.login-eye {
  display: grid; place-items: center; width: 30px; height: 30px; flex: none;
  border: none; background: transparent; color: var(--film-text-3); cursor: pointer; border-radius: 8px;
  transition: color .14s ease, background .14s ease;
}
.login-eye:hover { color: var(--film-text); background: rgba(255,255,255,.05); }

.login-error {
  display: flex; align-items: center; gap: 8px; margin-top: 14px;
  font-size: 13px; color: #f0a3ad;
}

.login-submit {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  margin-top: 22px; height: 52px; width: 100%;
  border: none; border-radius: 14px; cursor: pointer;
  background: var(--brand-grad); color: #fff;
  font-family: var(--font); font-size: 15px; font-weight: 700; letter-spacing: .01em;
  box-shadow: 0 12px 28px rgba(219,56,98,.34), 0 1px 0 rgba(255,255,255,.16) inset;
  transition: transform .14s ease, box-shadow .14s ease, opacity .14s ease, filter .14s ease;
}
.login-submit:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 16px 36px rgba(219,56,98,.42); filter: brightness(1.04); }
.login-submit:active:not(:disabled) { transform: translateY(0); }
.login-submit:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }

.login-sig {
  align-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0;
  color: rgba(255,255,255,.86);
  text-shadow: 0 1px 12px rgba(0,0,0,.55);
  text-align: center;
}
.login-sig span {
  color: rgba(255,255,255,.78);
}
.login-sig a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  color: #fff;
  background: rgba(219,56,98,.20);
  border: 1px solid rgba(219,56,98,.42);
  text-decoration: none;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  box-shadow: 0 8px 20px rgba(0,0,0,.18);
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}
.login-sig a:hover {
  color: #fff;
  background: rgba(219,56,98,.30);
  border-color: rgba(219,56,98,.68);
  transform: translateY(-1px);
}

.spin { animation: loginSpin .8s linear infinite; }
@keyframes loginSpin { to { transform: rotate(360deg); } }

@media (max-width: 480px) {
  .login-screen {
    place-items: end center;
    padding: 16px;
  }
  .login-cover {
    background:
      linear-gradient(180deg, rgba(8,11,17,.18) 0%, rgba(8,11,17,.58) 48%, rgba(8,11,17,.96) 100%),
      url("login-clinical-cover.jpg") 30% center / cover no-repeat;
  }
  .login-cbct,
  .login-brand-watermark { display: none; }
  .login-stage { width: 100%; }
  .login-panel { padding: 32px 24px 24px; border-radius: 18px; }
  .login-title { font-size: 23px; }
  .login-brand { margin-bottom: 24px; }
  .login-logo-img { width: min(100%, 250px); }
  .login-sig {
    font-size: 10px;
    text-align: center;
    line-height: 1.45;
  }
}

/* Enlaces públicos (Administración) */
.search-mini {
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px; height: 38px; min-width: 260px;
  background: var(--surface-3); border: 1px solid var(--border); border-radius: var(--r-sm);
  color: var(--text-3);
}
.search-mini input {
  flex: 1; min-width: 0; border: none; outline: none; background: transparent;
  font-family: var(--font); font-size: 13.5px; color: var(--text);
}
.search-mini input::placeholder { color: var(--text-3); }
.pl-ico {
  display: grid; place-items: center; width: 30px; height: 30px; flex: none;
  border-radius: 9px; background: var(--new-bg); color: var(--brand);
}
.mini-btn.is-copied { color: var(--ok); border-color: var(--ok); }
.empty-row { padding: 28px 16px; text-align: center; color: var(--text-3); font-size: 13px; }

/* Administración */
.admin-page {
  max-width: 1360px;
}
.admin-console-head {
  align-items: center;
  padding: 18px;
  border: 1px solid rgba(148,163,184,.14);
  border-radius: 22px;
  background:
    radial-gradient(circle at 12% 8%, rgba(219,56,98,.20), transparent 34%),
    linear-gradient(135deg, rgba(17,24,36,.98), rgba(26,35,50,.94) 54%, rgba(68,28,48,.88)),
    var(--surface);
  color: #fff;
  box-shadow: 0 22px 70px rgba(15,23,42,.22);
  overflow: hidden;
  position: relative;
}
.admin-console-head::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(219,56,98,.7), rgba(255,255,255,.16), rgba(20,184,166,.42));
}
.admin-console-title {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  position: relative;
  z-index: 1;
}
.admin-console-title .page-title {
  color: #fff;
  font-size: 25px;
}
.admin-console-title .page-sub {
  color: rgba(238,242,248,.70);
}
.admin-console-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 16px;
  background: rgba(255,255,255,.09);
  border: 1px solid rgba(255,255,255,.14);
  color: #fff;
}
.admin-console-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}
.admin-console-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.09);
  color: rgba(255,255,255,.88);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}
.admin-directory {
  display: grid;
  gap: 14px;
}
.admin-directory-toolbar {
  border: 1px solid rgba(148,163,184,.16);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.92), rgba(248,250,253,.96)),
    var(--surface);
  box-shadow: 0 16px 42px rgba(17,24,36,.08);
  overflow: hidden;
}
.admin-directory-copy {
  padding: 18px 18px 12px;
  gap: 14px;
}
.admin-directory-copy .section-title {
  margin-bottom: 4px;
}
.admin-directory-copy div div:last-child {
  color: var(--text-2);
  font-size: 12.5px;
}
.admin-directory-count {
  display: inline-grid;
  justify-items: end;
  min-width: 88px;
}
.admin-directory-count strong {
  font-size: 23px;
  line-height: 1;
  color: var(--text);
  font-weight: 900;
}
.admin-directory-count span {
  margin-top: 4px;
  color: var(--text-3);
  font-size: 11.5px;
  font-weight: 800;
}
.admin-directory-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 0 18px 14px;
  min-width: 0;
}
.admin-search {
  height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 13px;
  border-radius: 14px;
  border: 1px solid rgba(148,163,184,.18);
  background: var(--surface-3);
  color: var(--text-3);
}
.admin-search input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
}
.admin-filter-reset {
  height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 13px;
  border-radius: 14px;
  border: 1px solid rgba(148,163,184,.18);
  background: var(--surface);
  color: var(--text-2);
  font-weight: 850;
  font-size: 12px;
}
.admin-group-chips {
  padding: 0 18px 16px;
}
.admin-users-table {
  border: 0;
  border-top: 1px solid rgba(148,163,184,.14);
  border-radius: 0;
  box-shadow: none;
}
.admin-user-sheet {
  position: fixed;
  right: 22px;
  top: 88px;
  bottom: 22px;
  z-index: calc(var(--z-menu) + 80);
  width: min(440px, calc(100vw - 34px));
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--text);
  border: 1px solid rgba(148,163,184,.22);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(219,56,98,.08), rgba(15,23,42,0) 190px),
    color-mix(in srgb, var(--surface) 96%, transparent);
  box-shadow: 0 28px 90px rgba(15,23,42,.28);
  backdrop-filter: blur(18px);
}
.admin-user-sheet-head {
  display: grid;
  gap: 14px;
  padding: 16px;
  border-bottom: 1px solid rgba(148,163,184,.16);
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,0));
}
.admin-sheet-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  padding: 4px;
  border-radius: 14px;
  border: 1px solid rgba(148,163,184,.14);
  background: color-mix(in srgb, var(--surface-2) 78%, transparent);
}
.admin-sheet-tabs button {
  min-width: 0;
  height: 42px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--text-2);
  display: grid;
  place-items: center;
  gap: 1px;
  cursor: pointer;
  font: inherit;
}
.admin-sheet-tabs button span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10.5px;
  font-weight: 850;
}
.admin-sheet-tabs button:hover {
  background: rgba(148,163,184,.09);
  color: var(--text);
}
.admin-sheet-tabs button.active {
  background: linear-gradient(135deg, var(--brand), #9f2447);
  color: #fff;
  box-shadow: 0 10px 24px rgba(219,56,98,.24);
}
[data-theme="dark"] .admin-directory-toolbar {
  background:
    linear-gradient(180deg, rgba(21,28,41,.96), rgba(16,23,34,.98)),
    var(--surface);
  border-color: rgba(148,163,184,.18);
  box-shadow: 0 18px 54px rgba(0,0,0,.26);
}
[data-theme="dark"] .admin-search,
[data-theme="dark"] .admin-filter-reset {
  background: #121a26;
  border-color: rgba(148,163,184,.20);
}
[data-theme="dark"] .admin-users-table {
  border-color: rgba(148,163,184,.16);
}
[data-theme="dark"] .admin-user-sheet {
  background:
    linear-gradient(180deg, rgba(219,56,98,.10), rgba(15,23,42,0) 190px),
    rgba(16,23,34,.96);
  border-color: rgba(148,163,184,.22);
}
@media (max-width: 720px) {
  .admin-console-head { align-items: flex-start; }
  .admin-console-badge { margin-top: 10px; }
  .admin-console-actions,
  .admin-directory-controls {
    width: 100%;
    grid-template-columns: 1fr;
  }
  .admin-user-sheet {
    left: 10px;
    right: 10px;
    top: 76px;
    bottom: 12px;
    width: auto;
    border-radius: 18px;
  }
}

/* Admin sheet open — desplazar contenido para no quedar bajo el panel */
.admin-has-sheet {
  padding-right: calc(min(440px, calc(100vw - 34px)) + 30px);
  transition: padding-right .22s ease;
}
@media (max-width: 720px) {
  .admin-has-sheet { padding-right: 0; }
}

/* User menu — header con identidad real */
.user-menu-head { display: flex; align-items: center; gap: 10px; padding: 6px 8px 4px; }
.user-menu-head .umh-copy { display: flex; flex-direction: column; min-width: 0; }
.user-menu-head .umh-copy strong { font-size: 13.5px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-menu-head .umh-copy small { font-family: var(--mono); font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Public share uses the same Drive/viewer components, only with a lighter shell. */
.public-shell-app .main { width: 100%; }
.public-header { grid-template-columns: auto minmax(0, 1fr) auto; }
.public-header-spacer { min-width: 0; }
.public-content { padding: 0; }
.public-share-page {
  min-height: 100%;
  padding: 24px clamp(14px, 3vw, 42px) 46px;
  background:
    radial-gradient(900px 420px at 88% -8%, color-mix(in srgb, var(--brand) 18%, transparent), transparent 64%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-sunken) 100%);
}
.public-share-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  max-width: 1180px;
  margin: 0 auto 18px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--surface) 94%, var(--brand) 6%), var(--surface-2));
  box-shadow: var(--shadow-soft);
}
.public-share-brand {
  width: 174px;
  max-width: 34vw;
  height: 54px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #121824, #1d2430);
  border: 1px solid rgba(148,163,184,.22);
  overflow: hidden;
}
.public-share-brand img {
  width: 142px;
  max-width: 82%;
  height: auto;
  display: block;
}
.public-share-title { min-width: 0; }
.public-share-title span {
  display: block;
  margin-bottom: 5px;
  color: var(--brand);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.public-share-title h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(22px, 3vw, 34px);
  line-height: 1.06;
  overflow-wrap: anywhere;
}
.public-share-title p {
  margin: 7px 0 0;
  color: var(--text-2);
  font-size: 14px;
}
.public-share-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  flex-wrap: wrap;
}
.public-share-surface {
  max-width: 1180px;
  margin: 0 auto;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-grad);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}
.public-share-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.public-share-summary span {
  height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--bg-sunken);
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 850;
}
.public-share-list { display: grid; }
.public-share-row {
  min-height: 72px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 74%, transparent);
  color: var(--text);
  background: transparent;
}
.public-share-row:hover { background: color-mix(in srgb, var(--brand) 7%, transparent); }
.public-share-fileicon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--brand);
  background: color-mix(in srgb, var(--brand) 12%, var(--surface));
}
.public-share-filecopy { min-width: 0; }
.public-share-filecopy strong,
.public-share-filecopy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.public-share-filecopy strong { font-size: 14.5px; font-weight: 900; }
.public-share-filecopy small {
  margin-top: 4px;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 700;
}
.public-share-row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 850;
}
.public-share-row-actions i {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--brand);
  background: var(--surface);
  border: 1px solid var(--border);
}
@media (max-width: 720px) {
  .public-share-page { padding: 14px 10px 32px; }
  .public-share-hero {
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    padding: 14px;
  }
  .public-share-brand {
    width: 100%;
    max-width: none;
  }
  .public-share-actions { justify-content: stretch; }
  .public-share-actions .btn {
    flex: 1;
    min-width: 0;
  }
  .public-share-row {
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 10px;
    padding: 12px;
  }
  .public-share-row-actions {
    grid-column: 2;
    justify-content: flex-start;
  }
}
