/* =============================================================================
   GESTOR DE INSTRUMENTOS — Forms UI (Google Forms–inspired)
   Clean paper cards · light chrome · institutional teal (IDEICE)
   ============================================================================= */

:root {
  --p: #006d80;
  --p-dk: #004b63;
  --p-lt: #5cc6d8;
  --p-faint: #e6f4f7;
  --p-soft: #f0f7f9;
  --success: #1e8e3e;
  --danger: #d93025;
  --warning: #f9ab00;
  --info: #1a73e8;
  --sb-w: 256px;
  --sb-bg: #ffffff;
  --sb-border: #dadce0;
  --sb-txt: #5f6368;
  --sb-txt-h: #202124;
  --sb-active: #e6f4f7;
  --sb-dot: #006d80;
  --bg: #f0f4f5;
  --surface: #ffffff;
  --surface-2: #f8f9fa;
  --border: #dadce0;
  --border-2: #bdc1c6;
  --tx: #202124;
  --tx-2: #3c4043;
  --tx-m: #5f6368;
  --tx-l: #80868b;
  --nav-h: 56px;
  --r-s: 4px;
  --r-m: 8px;
  --r-l: 8px;
  --r-xl: 12px;
  --r-f: 9999px;
  --sh-xs: 0 1px 2px 0 rgba(60,64,67,.08);
  --sh-s: 0 1px 2px 0 rgba(60,64,67,.12), 0 1px 3px 1px rgba(60,64,67,.06);
  --sh-m: 0 1px 3px 0 rgba(60,64,67,.15), 0 4px 8px 3px rgba(60,64,67,.08);
  --sh-l: 0 2px 6px 2px rgba(60,64,67,.12), 0 8px 16px rgba(60,64,67,.1);
  --sh-xl: 0 4px 12px rgba(60,64,67,.16);
  --sh-soft: 0 1px 2px rgba(60,64,67,.1);
  --ease: cubic-bezier(.4,0,.2,1);
  --fast: 150ms;
  --mid: 220ms;
  --slow: 350ms;
  --primary-color: #006d80;
  --primary-dark: #004b63;
  --primary-light: #5cc6d8;
  --secondary-color: #1e8e3e;
  --accent-color: #f9ab00;
  --danger-color: #d93025;
  --info-color: #1a73e8;
  --dark-bg: #3c4043;
  --darker-bg: #202124;
  --light-bg: #f0f4f5;
  --white: #ffffff;
  --text-main: #202124;
  --text-light: #80868b;
  --primary-blue: #006d80;
  --sec-dark-blue: #202124;
  --success-color: #1e8e3e;
  --sec-cyan: #5cc6d8;
  --sec-gray: #5f6368;
  --transition-fast: 150ms ease;
  --transition-medium: 220ms ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Roboto', 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--tx);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
textarea { resize: vertical; }
svg { display: block; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #dadce0; border-radius: var(--r-f); }
::-webkit-scrollbar-thumb:hover { background: #bdc1c6; }

.wrapper { min-height: 100vh; position: relative; overflow-x: hidden; }

#sidebar.instrumentos_sidebar {
  width: var(--sb-w);
  background: var(--sb-bg);
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 999;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform var(--mid) var(--ease);
  border-right: 1px solid var(--sb-border);
}
@media (min-width: 769px) {
  #sidebar.instrumentos_sidebar.active { transform: translateX(calc(var(--sb-w) * -1)); }
}
#sidebar.instrumentos_sidebar::-webkit-scrollbar { width: 6px; }
#sidebar.instrumentos_sidebar::-webkit-scrollbar-thumb { background: #dadce0; }

.instrumentos_brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  height: var(--nav-h);
  min-height: var(--nav-h);
  max-height: var(--nav-h);
  padding: 0 16px;
  box-sizing: border-box;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  flex-shrink: 0;
}
.instrumentos_brand::before { display: none !important; }
.instrumentos_logo {
  flex-shrink: 0;
  width: auto;
  height: 40px;
  max-width: 160px;
  border-radius: 0;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  box-shadow: none;
  text-decoration: none;
}
.instrumentos_logo img {
  width: auto;
  height: 100%;
  max-width: 100%;
  object-fit: contain;
}
.instrumentos_brand_text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  align-items: center;
  text-align: center;
}
.instrumentos_title {
  font-size: .88rem;
  font-weight: 500;
  color: var(--sb-txt-h);
  letter-spacing: 0;
  line-height: 1.25;
  max-width: 12.5rem;
}

.instrumentos_nav { padding: 12px 8px; flex: 1; }
.instrumentos_label {
  padding: 16px 12px 6px; font-size: .68rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: .06em; color: var(--tx-l); opacity: 1; margin: 0;
}
.instrumentos_nav > .instrumentos_label:first-child { padding-top: 4px; }

.instrumentos_item {
  position: relative; display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 10px 12px; border-radius: 0 24px 24px 0; margin-right: 8px;
  font-size: .875rem; font-weight: 500; color: var(--sb-txt); background: transparent;
  border: none; text-align: left; text-decoration: none; cursor: pointer;
  transition: background var(--fast), color var(--fast); font-family: inherit;
}
.instrumentos_item::before { display: none !important; }
.instrumentos_item:hover { background: #f1f3f4; color: var(--sb-txt-h); }
.instrumentos_item.is-active { background: var(--sb-active); color: var(--p-dk); }
.instrumentos_item.is-active .instrumentos_icon { color: var(--p); }
.instrumentos_icon {
  width: 20px; height: 20px; text-align: center; font-size: 1rem; color: var(--sb-txt);
  flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
}
.instrumentos_icon svg { width: 20px; height: 20px; fill: currentColor; }
.instrumentos_item:hover .instrumentos_icon { color: var(--sb-txt-h); }
.instrumentos_text { flex: 1; min-width: 0; }
.instrumentos_group { display: block; }
.instrumentos_caret {
  width: 18px;
  height: 18px;
  margin-left: auto;
  opacity: .55;
  display: inline-flex;
  transition: transform var(--mid) var(--ease);
}
.instrumentos_group.is-open .instrumentos_caret, .instrumentos_toggle.is-expanded .instrumentos_caret { transform: rotate(180deg); }
.instrumentos_panel {
  max-height: 0; overflow: hidden; transition: max-height var(--slow) var(--ease);
  margin-left: 22px; padding-left: 10px; border-left: 1px solid var(--border);
}
.instrumentos_group.is-open > .instrumentos_panel { max-height: 400px; }
.instrumentos_subitem {
  display: block; padding: 8px 12px; margin: 2px 0; font-size: .82rem; color: var(--sb-txt);
  text-decoration: none; border-radius: var(--r-m);
  transition: background var(--fast), color var(--fast), padding-left var(--fast);
}
.instrumentos_subitem:hover { background: #f1f3f4; color: var(--sb-txt-h); padding-left: 16px; }
.instrumentos_subitem.is-active { color: var(--p-dk); background: var(--sb-active); font-weight: 500; }
.instrumentos_footer { padding: 12px; border-top: 1px solid var(--sb-border); display: flex; flex-direction: column; gap: 10px; flex-shrink: 0; }
.instrumentos_card {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--p-faint); border: 1px solid #d0e8ee; border-radius: var(--r-m);
}
.instrumentos_card_icon {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: #fff; color: var(--p); font-size: .9rem; flex-shrink: 0; border: 1px solid var(--border);
}
.instrumentos_card_body { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.instrumentos_card_title { font-size: .78rem; font-weight: 500; color: var(--sb-txt-h); }
.instrumentos_card_sub { font-size: .68rem; color: var(--sb-txt); margin-top: 2px; }
.instrumentos_version { text-align: center; font-size: .65rem; color: var(--sb-txt); opacity: .7; letter-spacing: .04em; }

/* ─── Content ────────────────────────────────────────────────────────────────── */
#content {
  margin-left: var(--sb-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin var(--mid) var(--ease);
  min-width: 0;
}
#sidebar.active ~ #content { margin-left: 0; }

/* ─── Topbar ─────────────────────────────────────────────────────────────────── */
.btn-icon {
  background: none;
  border: 1px solid transparent;
  color: var(--tx-m);
  font-size: 1rem;
  padding: 7px 9px;
  border-radius: var(--r-m);
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease),
              color var(--fast) var(--ease);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.btn-icon:hover {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--tx);
}

.topbar {
  height: var(--nav-h);
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar__left,
.topbar__right {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.topbar__left { justify-self: start; }
.topbar__right { justify-self: end; }
.topbar__logo {
  justify-self: center;
  height: 42px;
  max-width: min(180px, 42vw);
}

.topbar__toggle {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  background: transparent;
  border: 1px solid transparent;
  color: var(--tx-2);
  border-radius: var(--r-m);
  font-size: 1rem;
  cursor: pointer;
  transition: background var(--fast), border-color var(--fast), color var(--fast);
  flex-shrink: 0;
}
.topbar__toggle:hover { background: var(--surface-2); border-color: var(--border); color: var(--tx); }

/* Search */
.topbar__search {
  position: relative;
  flex: 1;
  max-width: 420px;
  display: flex;
  align-items: center;
}
.topbar__search input {
  width: 100%;
  height: 38px;
  padding: 0 72px 0 38px;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--r-m);
  font-size: .875rem;
  color: var(--tx);
  font-family: inherit;
  transition: background var(--fast), border-color var(--fast), box-shadow var(--fast);
}
.topbar__search input::placeholder { color: var(--tx-l); }
.topbar__search input:hover { background: #f0f0f3; }
.topbar__search input:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--p-lt);
  box-shadow: 0 0 0 3px rgba(0,109,128,.13);
}
.topbar__search-icon {
  position: absolute;
  left: 13px;
  color: var(--tx-l);
  font-size: .85rem;
  pointer-events: none;
}
.topbar__kbd {
  position: absolute;
  right: 8px;
  font-family: inherit;
  font-size: .68rem;
  font-weight: 600;
  padding: 2px 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-s);
  color: var(--tx-m);
  pointer-events: none;
}

/* Icon buttons */
.topbar__svg,
.topbar__toggle .topbar__svg {
  display: inline-flex;
  width: 22px;
  height: 22px;
  color: currentColor;
}
.topbar__svg svg,
.instrumentos_caret svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}
.topbar__user-caret {
  width: 18px;
  height: 18px;
  color: var(--tx-l);
  transition: transform var(--fast);
}
.instrumentos_card_icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}
.topbar__icon-btn {
  position: relative;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  background: transparent;
  border: 1px solid transparent;
  color: var(--tx-2);
  border-radius: var(--r-m);
  font-size: .95rem;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--fast), border-color var(--fast), color var(--fast);
}
.topbar__icon-btn:hover { background: var(--surface-2); border-color: var(--border); color: var(--p); }
.topbar__dot {
  position: absolute;
  top: 8px; right: 9px;
  width: 8px; height: 8px;
  background: var(--danger);
  border: 2px solid var(--surface);
  border-radius: 50%;
}

.topbar__divider {
  width: 1px;
  height: 26px;
  background: var(--border);
  margin: 0 4px;
}

/* User */
.topbar__user { position: relative; }
.topbar__user-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 10px 5px 5px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-f);
  cursor: pointer;
  transition: background var(--fast), border-color var(--fast);
}
.topbar__user-trigger:hover { background: var(--surface-2); border-color: var(--border); }
.topbar__user.is-open .topbar__user-trigger { background: var(--surface-2); border-color: var(--border); }
.topbar__user.is-open .topbar__user-caret { transform: rotate(180deg); }

.topbar__avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--p-dk) 0%, var(--p) 100%);
  color: #fff;
  font-weight: 700;
  font-size: .75rem;
  letter-spacing: .02em;
  flex-shrink: 0;
}
.topbar__avatar--lg { width: 44px; height: 44px; font-size: .95rem; }

.topbar__user-meta { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.topbar__user-name { font-size: .82rem; font-weight: 600; color: var(--tx); }
.topbar__user-role { font-size: .68rem; color: var(--tx-m); text-transform: capitalize; }
.topbar__user-caret { font-size: .65rem; color: var(--tx-l); transition: transform var(--fast); }

/* Dropdown menu */
.topbar__menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 240px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-l);
  box-shadow: var(--sh-xl);
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity var(--fast), transform var(--fast), visibility var(--fast);
  z-index: 200;
}
.topbar__user.is-open .topbar__menu { opacity: 1; visibility: visible; transform: translateY(0); }

.topbar__menu-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}
.topbar__menu-name { font-size: .875rem; font-weight: 600; color: var(--tx); }
.topbar__menu-role { font-size: .72rem; color: var(--tx-m); text-transform: capitalize; margin-top: 2px; }

.topbar__menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r-m);
  color: var(--tx-2);
  font-size: .85rem;
  font-weight: 500;
  text-decoration: none;
  transition: background var(--fast), color var(--fast);
}
.topbar__menu-item i { width: 16px; text-align: center; font-size: .85rem; color: var(--tx-l); }
.topbar__menu-item:hover { background: var(--p-faint); color: var(--p-dk); }
.topbar__menu-item:hover i { color: var(--p); }
.topbar__menu-item--danger:hover { background: #fef2f2; color: var(--danger); }
.topbar__menu-item--danger:hover i { color: var(--danger); }
.topbar__menu-sep { height: 1px; background: var(--border); margin: 6px 0; }

/* Tooltip */
.topbar__icon-btn[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  font-size: .7rem;
  font-weight: 500;
  padding: 4px 8px;
  background: var(--tx);
  color: #fff;
  border-radius: var(--r-s);
  white-space: nowrap;
  pointer-events: none;
  z-index: 300;
}

/* Responsive */
@media (max-width: 768px) {
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar__search { display: none; }
  .topbar__user-meta { display: none; }
  .topbar__user-caret { display: none; }
  .topbar__divider { display: none; }
  .topbar__user-trigger { padding: 4px; }
}
@media (max-width: 480px) {
  .topbar__icon-btn:nth-of-type(2) { display: none; }
}

/* ─── Page body ──────────────────────────────────────────────────────────────── */
.main-content { padding: 28px; flex: 1; }

/* ─── Typography ─────────────────────────────────────────────────────────────── */
h2 {
  font-size: clamp(1.25rem, 2.5vw, 1.5rem);
  font-weight: 400;
  color: var(--tx);
  letter-spacing: 0;
  line-height: 1.3;
  margin-bottom: 4px;
}
h2 i { color: var(--p); margin-right: 6px; }
p    { color: var(--tx-m); font-size: .9rem; }

/* ─── Flash messages ─────────────────────────────────────────────────────────── */
.flash {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--r-m);
  margin-bottom: 20px;
  font-size: .875rem;
  font-weight: 500;
  border: 1px solid transparent;
}
.flash-success { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.flash-error   { background: #fef2f2; color: #991b1b; border-color: #fecaca; }

/* ─── Grid (legacy Bootstrap) ────────────────────────────────────────────────── */
.container-fluid { width: 100%; }

.row {
  display: flex;
  flex-wrap: wrap;
  margin: -10px;
}
.col      { flex: 1; padding: 10px; }
.col-auto { flex: 0 0 auto; padding: 10px; }
.col-12   { width: 100%; padding: 10px; }
.col-md-3 { width: 25%; padding: 10px; }
.col-md-4 { width: 33.333%; padding: 10px; }
.col-md-6 { width: 50%; padding: 10px; }
.col-md-8 { width: 66.666%; padding: 10px; }

.align-items-center { align-items: center; }
.mb-4  { margin-bottom: 24px !important; }
.mt-4  { margin-top: 24px !important; }
.mb-3  { margin-bottom: 16px; }
.text-end { text-align: right; }

@media (max-width: 992px) { .col-md-3 { width: 50%; } }

/* ─── Stat cards ─────────────────────────────────────────────────────────────── */
.card-counter {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-l);
  padding: 22px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 100%;
  position: relative;
  overflow: hidden;
  transition: transform var(--mid) var(--ease), box-shadow var(--mid) var(--ease);
  box-shadow: var(--sh-xs);
}
.card-counter::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
}
.card-counter.primary::after { background: var(--p); }
.card-counter.danger::after  { background: var(--danger); }
.card-counter.success::after { background: var(--success); }
.card-counter.info::after    { background: var(--info); }

.card-counter:hover { transform: translateY(-3px); box-shadow: var(--sh-l); }

.card-counter i {
  font-size: 2rem;
  opacity: .1;
  transition: opacity var(--mid) var(--ease), transform var(--mid) var(--ease);
}
.card-counter:hover i { opacity: .2; transform: scale(1.1) rotate(-5deg); }

.card-details  { text-align: right; }
.count-numbers {
  display: block;
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.04em;
}
.count-name {
  display: block;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--tx-m);
  margin-top: 7px;
}

.card-counter.primary .count-numbers, .card-counter.primary i { color: var(--p); }
.card-counter.danger .count-numbers,  .card-counter.danger  i { color: var(--danger); }
.card-counter.success .count-numbers, .card-counter.success i { color: var(--success); }
.card-counter.info .count-numbers,    .card-counter.info    i { color: var(--info); }

/* ─── Card ───────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-l);
  box-shadow: var(--sh-soft);
}
.card-form {
  background: var(--surface);
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: var(--r-l);
  box-shadow: var(--sh-soft);
}
.p-4 { padding: 24px; }

/* ─── Instrument cards (Forms paper) ─────────────────────────────────────────── */
.instrument-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--sh-s);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  position: relative;
  transition: box-shadow var(--mid) var(--ease), border-color var(--mid) var(--ease);
}
.instrument-card:hover {
  box-shadow: var(--sh-m);
  border-color: #c2c7cc;
}
.instrument-card-body {
  padding: 20px 18px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  text-align: left;
  gap: 12px;
  min-height: 120px;
}
.instrument-card-title {
  font-size: 1.05rem;
  font-weight: 400;
  color: var(--tx);
  line-height: 1.35;
  margin: 0;
  text-align: left;
  word-break: break-word;
}
.instrument-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--p-faint);
  color: var(--p);
  order: -1;
}
.instrument-card-icon svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}
.instrument-card-meta {
  font-size: .75rem;
  color: var(--tx-m);
  margin-top: auto;
}

.instrument-card-footer {
  border-top: 1px solid var(--border);
  padding: 10px 12px;
  background: var(--surface-2);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  align-items: stretch;
}

.card-action-link {
  font-size: .72rem;
  font-weight: 600;
  color: var(--tx-m);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 6px;
  border-radius: var(--r-s);
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
  text-align: center;
  line-height: 1.2;
  min-width: 0;
  cursor: pointer;
  text-decoration: none;
}
.card-action-link span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-action-link i {
  flex-shrink: 0;
  font-size: .75rem;
}
.card-action-link:hover          { color: var(--p);       background: var(--p-faint); }
.card-action-link.ca-view:hover  { color: var(--info);    background: #f0f9ff; }
.card-action-link.ca-form:hover  { color: var(--success); background: #f0fdf4; }
.card-action-link.ca-share:hover { color: #0f766e;        background: #ecfdf5; }
.card-action-link.ca-edit:hover  { color: #7c3aed;        background: #f5f3ff; }
.card-action-link.ca-del:hover   { color: var(--danger);  background: #fef2f2; }

/* Mobile: cards full width; actions stay 3×2, icon above label */
@media (max-width: 768px) {
  .card-action-link {
    flex-direction: column;
    gap: 4px;
    padding: 10px 6px;
    font-size: .68rem;
  }
  .card-action-link i { font-size: .85rem; }
  .card-action-link span { white-space: normal; }
}

/* ─── Table ──────────────────────────────────────────────────────────────────── */
.table       { width: 100%; border-collapse: collapse; min-width: 580px; }
.table thead { background: var(--surface-2); border-bottom: 2px solid var(--border); }
.table th {
  padding: 11px 16px;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--tx-m);
  text-align: left;
  white-space: nowrap;
}
.table td {
  padding: 13px 16px;
  font-size: .875rem;
  color: var(--tx);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr { transition: background var(--fast) var(--ease); }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: none; }

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: var(--r-f);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .02em;
}
.badge-primary { background: var(--p-faint);  color: var(--p-dk); }
.badge-info    { background: #f0f9ff; color: #0369a1; }
.badge-default { background: var(--surface-2); color: var(--tx-m); border: 1px solid var(--border); }

/* ─── Buttons ────────────────────────────────────────────────────────────────── */
.btn-gradient {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: var(--p);
  color: #fff;
  border: none;
  padding: 9px 18px;
  border-radius: var(--r-m);
  font-family: inherit;
  font-size: .875rem;
  font-weight: 600;
  letter-spacing: .01em;
  transition: background var(--fast) var(--ease), transform var(--fast) var(--ease),
              box-shadow var(--fast) var(--ease);
  box-shadow: 0 1px 3px rgba(0,109,128,.28), 0 0 0 0 rgba(0,109,128,.22);
}
.btn-gradient:hover {
  background: var(--p-dk);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,109,128,.35);
}
.btn-gradient:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(0,109,128,.22);
}

/* ─── Form grid ──────────────────────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 18px;
}
.col-span-12 { grid-column: span 12; }
.col-span-8  { grid-column: span 8; }
.col-span-6  { grid-column: span 6; }
.col-span-4  { grid-column: span 4; }
.col-span-3  { grid-column: span 3; }

/* ─── Form controls ──────────────────────────────────────────────────────────── */
.form-section-title {
  grid-column: span 12;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--tx-m);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.form-section-title i { color: var(--p); }

.form-label, .form-group label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--tx-2);
  margin-bottom: 5px;
}
.text-danger, .text-danger * { color: var(--danger) !important; }

.form-group     { margin-bottom: 16px; }

.form-input,
.form-control {
  width: 100%;
  padding: 9px 13px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-m);
  font-family: inherit;
  font-size: .875rem;
  color: var(--tx);
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
  line-height: 1.5;
  appearance: none;
  -webkit-appearance: none;
}
.form-input:hover, .form-control:hover { border-color: var(--border-2); }
.form-input:focus, .form-control:focus {
  outline: none;
  border-color: var(--p);
  box-shadow: 0 0 0 3px rgb(0 109 128/.13);
}
textarea.form-input, textarea.form-control { min-height: 80px; }
select.form-input, select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2371717a'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

/* Glass variant */
.glass {
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,.6);
}
.border-0 { border: none !important; }
.shadow-sm { box-shadow: var(--sh-s) !important; }

/* ─── Login ───────────────────────────────────────────────────────────────────── */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse 80% 60% at 50% -20%, rgb(99 102 241/.35) 0%, transparent 70%),
    #09090b;
}

.login-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 44px 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 32px 64px rgb(0 0 0/.3);
}

.login-header { text-align: center; margin-bottom: 32px; }
.login-header h2 { color: var(--p-dk); font-size: 1.5rem; margin-bottom: 4px; }
.login-header p  { color: var(--tx-m); }
.btn-block { width: 100%; }

/* ─── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Misma especificidad que escritorio (#sidebar.instrumentos_sidebar) para que .active abra/cierre bien */
  #sidebar.instrumentos_sidebar { transform: translateX(calc(var(--sb-w) * -1)); }
  #sidebar.instrumentos_sidebar.active { transform: translateX(0); box-shadow: 0 0 24px rgba(60,64,67,.18); }
  #sidebar.instrumentos_sidebar.active ~ #content::before {
    content: '';
    position: fixed; inset: 0;
    background: rgb(0 0 0/.5);
    z-index: 900;
  }

  #content { margin-left: 0; }

  .col-span-6, .col-span-4, .col-span-3, .col-span-8 { grid-column: span 12 !important; }
  .col-md-3, .col-md-4, .col-md-6, .col-md-8 { width: 100%; flex: 0 0 100%; }

  .main-content { padding: 14px; }
  .card-form    { padding: 20px; }
  .user-name    { display: none; }
  .login-card   { padding: 30px 22px; }
}

/* ─── Modals ─────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(9, 9, 11, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--mid) var(--ease);
}
.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--surface);
  width: 100%;
  max-width: 500px;
  border-radius: var(--r-l);
  box-shadow: var(--sh-xl);
  transform: translateY(20px);
  transition: transform var(--mid) var(--ease);
  overflow: hidden;
  border: 1px solid var(--border);
}
.modal-overlay.active .modal-content {
  transform: translateY(0);
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-2);
}
.modal-header h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--tx);
  margin: 0;
}
.modal-close {
  background: none;
  border: none;
  color: var(--tx-l);
  font-size: 1.25rem;
  padding: 4px;
  display: flex;
  transition: color var(--fast);
}
.modal-close:hover { color: var(--danger); }

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: var(--surface-2);
}

/* Custom button for notes */
.btn-note {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--p-faint);
  color: var(--p-dk);
  border: 1px dashed var(--p);
  border-radius: var(--r-m);
  font-weight: 600;
  font-size: .875rem;
  transition: all var(--fast) var(--ease);
  width: 100%;
}
.btn-note:hover {
  background: var(--p-lt);
  color: #fff;
  border-style: solid;
}
.btn-note.has-content {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}
.note-preview {
  margin-top: 8px;
  font-size: .8rem;
  color: var(--tx-m);
  font-style: italic;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* ─── Share modal (QR + enlace) ─────────────────────────────────────────────── */
#shareModal .modal-content {
  max-width: 440px;
}

#shareModal .modal-header {
  background: linear-gradient(135deg, var(--p-faint) 0%, #fff 100%);
  border-bottom: 1px solid var(--border);
}

#shareModal .modal-header h4 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.05rem;
}

#shareModal .modal-header h4 .share-header-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--r-m);
  background: linear-gradient(135deg, var(--p), var(--p-dk));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  box-shadow: 0 4px 12px rgba(0,109,128,.28);
}

#shareModal .modal-body {
  padding: 22px 24px 24px;
}

#shareModal .share-intro {
  margin: 0 0 14px;
  font-size: 0.9rem;
  color: var(--tx-2);
  line-height: 1.55;
}

#shareModal .share-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 20px;
  padding: 12px 14px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--r-m);
  font-size: 0.8rem;
  color: #92400e;
  line-height: 1.5;
}

#shareModal .share-notice i {
  margin-top: 2px;
  color: var(--warning);
  flex-shrink: 0;
}

#shareModal .share-loading {
  text-align: center;
  padding: 40px 16px;
}

#shareModal .share-loading__spinner {
  width: 48px;
  height: 48px;
  margin: 0 auto 14px;
  border-radius: 50%;
  border: 3px solid var(--p-faint);
  border-top-color: var(--p);
  animation: share-spin 0.75s linear infinite;
}

@keyframes share-spin {
  to { transform: rotate(360deg); }
}

#shareModal .share-loading p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--tx-m);
  font-weight: 500;
}

#shareModal .share-error {
  text-align: center;
  padding: 28px 16px;
}

#shareModal .share-error__icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: #fef2f2;
  color: var(--danger);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

#shareModal .share-error p {
  margin: 0 0 16px;
  font-size: 0.9rem;
  color: var(--tx-2);
}

#shareModal .btn-retry-share {
  padding: 10px 22px;
  border: none;
  border-radius: var(--r-m);
  background: var(--warning);
  color: #fff;
  font-weight: 700;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background var(--fast), transform var(--fast);
}

#shareModal .btn-retry-share:hover {
  background: #d97706;
  transform: translateY(-1px);
}

#shareModal .share-qr-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 20px 18px;
  margin-bottom: 18px;
  background: linear-gradient(160deg, var(--p-faint) 0%, #fff 45%, #fafafa 100%);
  border: 1px solid var(--border);
  border-radius: var(--r-l);
  box-shadow: var(--sh-s);
}

#shareModal .share-qr-card__badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  padding: 5px 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-f);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--p-dk);
}

#shareModal .qr-canvas-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  background: #fff;
  border-radius: var(--r-m);
  border: 2px solid var(--border);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

#shareModal .qr-canvas-wrapper img,
#shareModal .qr-canvas-wrapper canvas {
  display: block;
  border-radius: 4px;
}

#shareModal .qr-label {
  margin-top: 14px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--tx-2);
  text-align: center;
}

#shareModal .qr-label i {
  color: var(--p);
  margin-right: 4px;
}

#shareModal .share-url-container {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

#shareModal .share-url-input {
  flex: 1;
  min-width: 0;
  padding: 11px 14px;
  font-size: 0.8rem;
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  color: var(--tx);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-m);
  transition: border-color var(--fast), box-shadow var(--fast);
}

#shareModal .share-url-input:focus {
  outline: none;
  border-color: var(--p-lt);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

#shareModal .btn-copy {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--r-m);
  background: var(--p);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  transition: background var(--fast), transform var(--fast), box-shadow var(--fast);
  box-shadow: 0 2px 8px rgba(0,109,128,.28);
}

#shareModal .btn-copy:hover {
  background: var(--p-dk);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

#shareModal .btn-copy.copied {
  background: var(--success);
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.35);
}

#shareModal .share-tablet-actions {
  margin-bottom: 14px;
}

#shareModal .btn-prepare-tablet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 13px 18px;
  border: 1px solid var(--border);
  border-radius: var(--r-m);
  background: var(--surface);
  color: var(--tx);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--fast), border-color var(--fast), color var(--fast), transform var(--fast);
}

#shareModal .btn-prepare-tablet:hover {
  background: var(--p-faint);
  border-color: var(--p-lt);
  color: var(--p-dk);
  transform: translateY(-1px);
}

#shareModal .btn-prepare-tablet i {
  font-size: 1.1rem;
  color: var(--p);
}

#shareModal .share-tablet-guide {
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-m);
  background: var(--surface-2);
  overflow: hidden;
}

#shareModal .share-tablet-guide summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--tx-2);
  list-style: none;
  user-select: none;
  transition: background var(--fast);
}

#shareModal .share-tablet-guide summary::-webkit-details-marker {
  display: none;
}

#shareModal .share-tablet-guide summary::after {
  content: '\f107';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  margin-left: auto;
  color: var(--tx-l);
  transition: transform var(--fast);
}

#shareModal .share-tablet-guide[open] summary::after {
  transform: rotate(180deg);
}

#shareModal .share-tablet-guide summary:hover {
  background: var(--p-faint);
}

#shareModal .share-tablet-guide__body {
  padding: 0 14px 14px;
  border-top: 1px solid var(--border);
}

#shareModal .share-tablet-guide ol {
  margin: 12px 0 10px;
  padding-left: 20px;
  font-size: 0.8rem;
  color: var(--tx-2);
  line-height: 1.6;
}

#shareModal .share-tablet-guide__note {
  margin: 0;
  padding: 10px 12px;
  background: #fff;
  border-radius: var(--r-s);
  font-size: 0.76rem;
  color: var(--tx-m);
  line-height: 1.5;
}

#shareModal .share-tablet-guide__note i {
  color: var(--info);
  margin-right: 4px;
}

#shareModal .share-tablet-guide code {
  padding: 1px 5px;
  background: var(--bg);
  border-radius: 4px;
  font-size: 0.85em;
  color: var(--tx);
}

/* ─── Page toolbar (Forms-like list headers) ─────────────────────────────────── */
.page-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.page-toolbar__title {
  margin: 0;
  font-size: 1.375rem;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--tx);
  display: flex;
  align-items: center;
  gap: 10px;
}
.page-toolbar__title svg {
  width: 28px;
  height: 28px;
  fill: var(--p);
  flex-shrink: 0;
}
.page-toolbar__sub {
  margin: 4px 0 0;
  font-size: .875rem;
  color: var(--tx-m);
  font-weight: 400;
}
.page-toolbar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--r-m);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--tx-2);
  font-size: .875rem;
  font-weight: 500;
  text-decoration: none;
  transition: background var(--fast), border-color var(--fast), color var(--fast);
}
.btn-ghost:hover {
  background: var(--surface-2);
  border-color: var(--border-2);
  color: var(--p);
}

/* ─── Mis instrumentos hub (Accessible & Ethical) ───────────────────────────── */
.inst-hub {
  max-width: 100%;
  width: 100%;
  margin: 0;
  padding-bottom: 40px;
}

.inst-hub__hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 28px;
  padding: 28px 28px 26px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--sh-s);
  position: relative;
}
.inst-hub__eyebrow {
  margin: 0 0 6px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--p);
}
.inst-hub__title {
  margin: 0;
  font-family: 'Plus Jakarta Sans', 'Roboto', system-ui, sans-serif;
  font-size: clamp(1.5rem, 2.2vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--tx);
  line-height: 1.2;
}
.inst-hub__sub {
  margin: 8px 0 0;
  max-width: 42rem;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--tx-m);
}
.inst-hub__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.inst-hub__stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--tx-2);
  font-size: 0.8125rem;
}
.inst-hub__stat strong {
  color: var(--p-dk);
  font-weight: 700;
}
.inst-hub__hero-actions {
  position: relative;
}
.inst-hub__cta {
  min-height: 44px;
  padding-inline: 20px;
}

.inst-hub__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.inst-search {
  position: relative;
  flex: 1 1 280px;
  max-width: 420px;
  display: block;
}
.inst-search__icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--tx-m);
  pointer-events: none;
  display: inline-flex;
}
.inst-search__input {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px 10px 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--tx);
  font: inherit;
  font-size: 0.9375rem;
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.inst-search__input::placeholder { color: var(--tx-l); }
.inst-search__input:hover { border-color: var(--border-2); }
.inst-search__input:focus {
  outline: none;
  border-color: var(--p);
  box-shadow: 0 0 0 3px rgba(0, 109, 128, 0.18);
}
.inst-hub__filter-meta {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--tx-m);
}
.inst-hub__filter-meta strong { color: var(--tx); }

.inst-hub__more {
  display: flex;
  justify-content: center;
  margin-top: 22px;
}
.inst-hub__more-btn {
  min-height: 44px;
  padding-inline: 20px;
  cursor: pointer;
}
.inst-hub__more-rest {
  color: var(--tx-m);
  font-weight: 500;
}

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

.inst-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--sh-s);
  overflow: hidden;
  transition: box-shadow var(--mid) var(--ease), border-color var(--mid) var(--ease), transform var(--mid) var(--ease);
}
.inst-card[hidden],
.inst-hub__more[hidden],
.inst-empty[hidden],
.inst-grid[hidden] {
  display: none !important;
}
.inst-card:hover {
  border-color: #c5d0d4;
  box-shadow: var(--sh-m);
  transform: translateY(-2px);
}
.inst-card__accent {
  display: none;
}
.inst-card__body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 18px 14px;
  flex: 1;
  min-height: 0;
}
.inst-card__top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.inst-card__icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--p-faint);
  color: var(--p);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.inst-card__icon svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}
.inst-card__title {
  margin: 0;
  font-family: 'Plus Jakarta Sans', 'Roboto', system-ui, sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: var(--tx);
  word-break: break-word;
}
.inst-card__title a {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: color var(--fast) var(--ease);
}
.inst-card__title a:hover { color: var(--p); }
.inst-card__title a:focus-visible {
  outline: 3px solid rgba(0, 109, 128, 0.35);
  outline-offset: 2px;
  border-radius: 4px;
}
.inst-card__desc {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--tx-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.inst-card__desc--muted { color: var(--tx-l); font-style: italic; }

.inst-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: auto 0 0;
  padding: 0;
  list-style: none;
}
.inst-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--p-faint);
  color: var(--p-dk);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1;
}
.inst-chip--soft {
  background: var(--surface-2);
  color: var(--tx-m);
  border: 1px solid var(--border);
}

.inst-card__footer {
  border-top: 1px solid var(--border);
  background: #fafbfc;
  padding: 10px;
}
.inst-card__actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.inst-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 6px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--tx-m);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.15;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.inst-action span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inst-action svg { flex-shrink: 0; }
.inst-action:hover {
  background: var(--p-faint);
  color: var(--p);
}
.inst-action:focus-visible {
  outline: 3px solid rgba(0, 109, 128, 0.35);
  outline-offset: 1px;
}
.inst-action--primary {
  background: var(--p-faint);
  color: var(--p-dk);
  border-color: rgba(0, 109, 128, 0.12);
}
.inst-action--primary:hover {
  background: var(--p);
  color: #fff;
  border-color: var(--p);
}
.inst-action--danger:hover {
  background: #fef2f2;
  color: var(--danger);
}

.inst-empty {
  text-align: center;
  padding: 56px 28px;
  border: 1px dashed #c5d0d4;
  border-radius: 12px;
  background: linear-gradient(180deg, #fff 0%, #f7fbfc 100%);
}
.inst-empty--filtered {
  margin-top: 8px;
  padding: 40px 24px;
}
.inst-empty__visual {
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: var(--p-faint);
  color: var(--p);
}
.inst-empty__title {
  margin: 0 0 8px;
  font-family: 'Plus Jakarta Sans', 'Roboto', system-ui, sans-serif;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--tx);
}
.inst-empty__text {
  margin: 0 auto 20px;
  max-width: 28rem;
  color: var(--tx-m);
  font-size: 0.9375rem;
  line-height: 1.55;
}

@media (max-width: 768px) {
  .inst-hub__hero {
    padding: 22px 18px;
  }
  .inst-hub__cta {
    width: 100%;
  }
  .inst-card__actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .inst-action {
    flex-direction: column;
    gap: 4px;
    min-height: 48px;
    font-size: 0.68rem;
  }
  .inst-action span { white-space: normal; }
}

@media (prefers-reduced-motion: reduce) {
  .inst-card,
  .inst-action,
  .inst-search__input,
  .btn-gradient {
    transition: none !important;
  }
  .inst-card:hover {
    transform: none;
  }
}

