/* SignNest — StudioNest/ClientNest visual language.
   Tokens first; components below. No framework dependency. */

:root {
  --studio-canvas: #e8e2d9;
  --studio-paper: #f7f5f1;
  --studio-surface: rgba(250, 249, 246, 0.94);
  --studio-soft: #f0ede8;
  --studio-ink: #191918;
  --studio-muted: #63615c;
  --studio-faint: #8c8982;
  --studio-border: rgba(28, 26, 22, 0.09);
  --studio-border-strong: rgba(28, 26, 22, 0.16);
  --studio-shadow: 0 24px 70px rgba(47, 39, 29, 0.14);
  --studio-shadow-soft: 0 10px 30px rgba(47, 39, 29, 0.08);
  --studio-card-shadow: 0 8px 26px rgba(48, 40, 31, 0.045);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 13px;
  --radius-sm: 10px;

  --sign-accent: #7650d0;
  --sign-accent-dark: #5a37a8;
  --sign-soft: #f1ebfb;
  --sign-soft-strong: #e5daf8;
  --focus-ring: rgba(118, 80, 208, 0.35);

  --status-success: #37745d;
  --status-success-soft: #e8f3ed;
  --status-warning: #8a5f27;
  --status-warning-soft: #f7eedf;
  --status-danger: #9a5045;
  --status-danger-soft: #f8eae7;
  --status-info: #4f6f8b;
  --status-info-soft: #eaf1f6;

  --font-body: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: Manrope, "DM Sans", system-ui, sans-serif;
  --motion-fast: 160ms;
  --motion-panel: 240ms;

  color: var(--studio-ink);
  background: var(--studio-canvas);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
}

*, *::before, *::after { box-sizing: border-box; }
html { min-width: 320px; background: var(--studio-canvas); }
body { margin: 0; min-height: 100vh; color: var(--studio-ink); background: transparent; -webkit-font-smoothing: antialiased; }
body::before { content: ""; position: fixed; inset: 0; z-index: -2; background: rgba(241, 237, 230, 0.56); pointer-events: none; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); letter-spacing: -0.02em; }
p { margin: 0; }
img { max-width: 100%; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 16px; top: -60px; z-index: 200; padding: 10px 14px; border-radius: 10px; background: var(--studio-ink); color: #fff; font-weight: 600; }
.skip-link:focus { top: 12px; }

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid var(--focus-ring); outline-offset: 2px;
}

.studio-backdrop {
  position: fixed; inset: -18px; z-index: -3;
  background: url("images/studio-workspace.webp") center / cover no-repeat;
  filter: saturate(0.66) contrast(0.82) blur(2px);
  transform: scale(1.025);
}

/* ---------- System bar ---------- */
.system-bar {
  position: fixed; z-index: 50; inset: 12px 16px auto; height: 58px;
  display: flex; align-items: center; gap: 18px;
  padding: 0 12px 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.52); border-radius: 17px;
  background: rgba(247, 245, 241, 0.88);
  box-shadow: 0 10px 34px rgba(48, 40, 31, 0.12);
  backdrop-filter: blur(20px) saturate(1.05);
}
.system-brand { display: flex; align-items: center; gap: 9px; font: 700 14px var(--font-display); white-space: nowrap; }
.system-brand img { width: 26px; height: 26px; border-radius: 8px; }
.system-brand small { color: var(--studio-muted); font: 500 13px var(--font-body); }
.system-nav { display: flex; align-items: center; gap: 3px; }
.system-nav a { padding: 8px 11px; border-radius: 9px; color: var(--studio-muted); font-size: 14px; font-weight: 600; transition: background var(--motion-fast), color var(--motion-fast); }
.system-nav a:hover, .system-nav a.active { color: var(--studio-ink); background: rgba(25, 25, 24, 0.06); }
.system-spacer { flex: 1; }
.demo-flag { padding: 6px 10px; border-radius: 9px; background: var(--status-warning-soft); color: var(--status-warning); font-size: 12px; font-weight: 700; }

.icon-button { position: relative; display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 40px; padding: 0 9px; border: 0; border-radius: 10px; color: var(--studio-ink); background: transparent; }
.icon-button:hover { background: rgba(25, 25, 24, 0.06); }
.icon-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-button-tooltip { position: absolute; z-index: 100; top: calc(100% + 7px); left: 50%; width: max-content; max-width: 200px; padding: 6px 9px; border-radius: 7px; color: #fff; background: rgba(23, 23, 23, 0.9); font-size: 12px; font-weight: 600; pointer-events: none; opacity: 0; transform: translate(-50%, -3px); transition: opacity 0.14s, transform 0.14s; }
.icon-button:hover .icon-button-tooltip, .icon-button:focus-visible .icon-button-tooltip { opacity: 1; transform: translate(-50%, 0); }
.icon-button[aria-expanded="true"] .icon-button-tooltip { display: none; }

/* App switcher */
.app-switcher-control { position: relative; }
.app-switcher-panel { position: absolute; z-index: 95; top: 46px; right: 0; width: min(590px, calc(100vw - 32px)); padding: 18px; border: 1px solid rgba(255, 255, 255, 0.7); border-radius: 19px; background: rgba(249, 248, 245, 0.97); box-shadow: 0 28px 80px rgba(24, 38, 31, 0.22); backdrop-filter: blur(24px); }
.app-switcher-panel[hidden] { display: none; }
.app-switcher-panel > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.app-switcher-panel > header h2 { font-size: 18px; }
.app-switcher-panel > header button { width: 32px; height: 32px; border: 0; border-radius: 9px; color: var(--studio-muted); background: rgba(25, 25, 24, 0.06); font-size: 20px; line-height: 1; }
.app-switcher-panel > p { margin: 3px 0 15px; color: var(--studio-muted); font-size: 13px; }
.app-switcher-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.app-switcher-item { position: relative; min-width: 0; min-height: 142px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 13px; border: 1px solid transparent; border-radius: 14px; color: var(--studio-ink); background: rgba(255, 255, 255, 0.5); font: inherit; text-align: left; transition: background var(--motion-fast), border-color var(--motion-fast), transform var(--motion-fast); }
a.app-switcher-item:hover, a.app-switcher-item:focus-visible { border-color: rgba(118, 80, 208, 0.25); background: #fff; transform: translateY(-2px); }
.app-switcher-item.current { border-color: rgba(118, 80, 208, 0.35); box-shadow: inset 0 0 0 1px rgba(118, 80, 208, 0.12); }
.app-switcher-item[aria-disabled="true"] { cursor: default; }
.app-switcher-icon { width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid rgba(255, 255, 255, 0.72); border-radius: 14px; color: var(--accent); background: linear-gradient(145deg, rgba(255, 255, 255, 0.88), var(--accent-bg)); box-shadow: 0 8px 18px rgba(35, 44, 39, 0.1); }
.app-switcher-icon svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.app-switcher-icon.has-brand-icon { border-color: transparent; background: transparent; }
.app-switcher-icon.has-brand-icon img { width: 44px; height: 44px; display: block; border-radius: 12px; }
.app-switcher-copy strong, .app-switcher-copy small { display: block; }
.app-switcher-copy strong { font-size: 14px; }
.app-switcher-copy small { margin-top: 1px; color: var(--studio-muted); font-size: 12px; line-height: 1.35; }
.app-switcher-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: auto; }
.app-switcher-state, .app-switcher-current { padding: 3px 7px; border-radius: 6px; font-size: 11px; font-weight: 700; }
.app-switcher-state { color: #5f5f5b; background: #e8e8e4; }
.app-switcher-current { color: var(--sign-accent-dark); background: var(--sign-soft); }
.app-switcher-item.state-not-enabled .app-switcher-icon { color: #888; background: #ecece8; box-shadow: none; filter: grayscale(1); opacity: 0.62; }
.app-switcher-item.state-not-enabled .app-switcher-copy { opacity: 0.6; }
.app-switcher-tooltip { position: absolute; z-index: 110; right: 4px; bottom: calc(100% + 6px); left: 4px; padding: 7px 8px; border-radius: 8px; color: #fff; background: rgba(23, 23, 23, 0.92); font-size: 12px; line-height: 1.4; pointer-events: none; opacity: 0; transform: translateY(3px); transition: opacity 0.14s, transform 0.14s; }
.app-switcher-item:hover .app-switcher-tooltip, .app-switcher-item:focus-visible .app-switcher-tooltip { opacity: 1; transform: none; }
.accent-forest { --accent: #316f5d; --accent-bg: #dcece5; }
.accent-clay { --accent: #a85f35; --accent-bg: #f5e3d7; }
.accent-blue { --accent: #527691; --accent-bg: #e1edf5; }
.accent-violet { --accent: #7650d0; --accent-bg: #ece4fa; }
.accent-ink { --accent: #4d5361; --accent-bg: #e7e9ed; }
.accent-sage { --accent: #647d68; --accent-bg: #e4ece3; }
.accent-sand { --accent: #987443; --accent-bg: #f1e8d7; }

/* Account menu */
.account-menu { position: relative; min-width: 0; }
.account-menu summary { display: flex; align-items: center; gap: 9px; padding: 4px 6px; border-radius: 11px; cursor: pointer; list-style: none; }
.account-menu summary:hover { background: rgba(25, 25, 24, 0.05); }
.account-menu summary::-webkit-details-marker { display: none; }
.account-avatar { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 10px; background: var(--sign-soft); color: var(--sign-accent-dark); font-size: 14px; font-weight: 700; }
.account-copy { display: grid; max-width: 190px; line-height: 1.3; }
.account-copy strong, .account-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-copy strong { font-size: 13px; }
.account-copy small { color: var(--studio-muted); font-size: 12px; }
.account-menu > div { position: absolute; z-index: 80; top: 48px; right: 0; width: 220px; padding: 7px; border: 1px solid var(--studio-border); border-radius: 12px; background: rgba(255, 255, 255, 0.98); box-shadow: var(--studio-shadow-soft); }
.account-menu > div a { display: block; padding: 10px; border-radius: 8px; color: var(--studio-muted); font-size: 14px; }
.account-menu > div a:hover { background: var(--studio-soft); color: var(--studio-ink); }

/* ---------- Workspace ---------- */
.workspace { width: min(1600px, 100%); min-height: 100vh; margin: 0 auto; padding: 86px 18px 22px; display: grid; grid-template-columns: 196px minmax(0, 1fr); gap: 18px; }
.app-rail { position: sticky; top: 86px; align-self: start; height: calc(100vh - 108px); display: flex; flex-direction: column; padding: 16px 13px 13px; border: 1px solid rgba(255, 255, 255, 0.48); border-radius: var(--radius-xl); background: rgba(247, 245, 241, 0.82); box-shadow: var(--studio-shadow-soft); backdrop-filter: blur(18px); }
.app-tile { position: relative; display: grid; justify-items: center; gap: 8px; padding: 7px 5px 17px; border-bottom: 1px solid var(--studio-border); text-align: center; transition: transform var(--motion-fast); }
.app-tile:hover, .app-tile:focus-visible { transform: translateY(-2px); }
.app-tile img { width: 72px; height: 72px; border-radius: 20px; filter: drop-shadow(0 9px 12px rgba(90, 55, 168, 0.18)); }
.app-tile > span { display: grid; gap: 1px; }
.app-tile strong { font: 700 15px var(--font-display); }
.app-tile small { color: var(--studio-muted); font-size: 12px; }
.app-navigation { display: grid; gap: 4px; margin-top: 14px; }
.app-navigation a { display: grid; grid-template-columns: 24px 1fr; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 10px; color: var(--studio-muted); font-size: 14px; font-weight: 600; transition: background var(--motion-fast), color var(--motion-fast), transform var(--motion-fast); }
.app-navigation a small { display: block; color: var(--studio-faint); font-size: 12px; font-weight: 500; }
.app-navigation svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; color: var(--studio-faint); }
.app-navigation a:hover { color: var(--studio-ink); background: rgba(255, 255, 255, 0.58); transform: translateX(2px); }
.app-navigation a.active { color: var(--studio-ink); background: var(--sign-soft); box-shadow: inset 3px 0 var(--sign-accent); }
.app-navigation a.active svg { color: var(--sign-accent-dark); }
.app-rail-bottom { display: grid; gap: 4px; margin-top: auto; }
.utility-link { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 9px; color: var(--studio-muted); font-size: 13px; }
.utility-link:hover { background: rgba(255, 255, 255, 0.58); color: var(--studio-ink); }
.utility-link svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.main { min-width: 0; min-height: calc(100vh - 108px); padding: clamp(24px, 3vw, 46px); border: 1px solid rgba(255, 255, 255, 0.58); border-radius: var(--radius-xl); background: var(--studio-surface); box-shadow: var(--studio-shadow); backdrop-filter: blur(24px) saturate(0.9); animation: workspace-in var(--motion-panel) ease-out both; }
@keyframes workspace-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.title-md { font-size: clamp(24px, 3vw, 32px); }
.section-gap { margin-top: 18px; }
.page-footer { margin-top: 40px; color: var(--studio-faint); font-size: 12px; }
.page-footer a { text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Page structure ---------- */
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 30px; flex-wrap: wrap; }
.page-header h1 { font-size: clamp(26px, 3vw, 34px); font-weight: 700; letter-spacing: -0.035em; line-height: 1.15; }
.eyebrow { margin-bottom: 6px; color: var(--sign-accent-dark); font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.subhead { margin-top: 6px; color: var(--studio-muted); font-size: 16px; max-width: 62ch; }
.muted { color: var(--studio-muted); }
.small { font-size: 13px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 14px; color: var(--studio-muted); font-size: 14px; font-weight: 600; }
.back-link:hover { color: var(--studio-ink); }
.text-link { color: var(--sign-accent-dark); font-weight: 600; }
.text-link:hover { text-decoration: underline; text-underline-offset: 3px; }

.panel { padding: 25px; border: 1px solid var(--studio-border); border-radius: var(--radius-lg); background: rgba(255, 255, 255, 0.78); box-shadow: var(--studio-card-shadow); }
.panel + .panel { margin-top: 18px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.panel-heading h2 { font-size: 19px; font-weight: 700; }
.panel-heading p { margin-top: 3px; color: var(--studio-muted); font-size: 14px; }
.panel-count { padding: 3px 9px; border-radius: 999px; background: var(--studio-soft); color: var(--studio-muted); font-size: 12px; font-weight: 700; }
.panel.narrow { max-width: 760px; }
.split-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, 1fr); gap: 18px; align-items: start; }
.prose p + p, .prose p + ul, .prose ul + p { margin-top: 12px; }
.prose ul { margin: 10px 0 0; padding-left: 20px; }
.prose li + li { margin-top: 4px; }
.prose code { padding: 1px 6px; border-radius: 6px; background: var(--sign-soft); color: var(--sign-accent-dark); font-size: 14px; }

/* Metrics */
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.metric-card { position: relative; display: flex; flex-direction: column; gap: 4px; min-height: 132px; padding: 20px; overflow: hidden; border: 1px solid var(--studio-border); border-radius: 16px; background: rgba(255, 255, 255, 0.78); box-shadow: var(--studio-card-shadow); }
.metric-card span { color: var(--studio-muted); font-size: 14px; font-weight: 600; }
.metric-card strong { font: 700 34px/1.1 var(--font-display); }
.metric-card a { margin-top: auto; color: var(--sign-accent-dark); font-size: 14px; font-weight: 600; }
.metric-card small { margin-top: auto; color: var(--studio-muted); font-size: 13px; }
.metric-card.accent { border-color: rgba(118, 80, 208, 0.14); background: linear-gradient(145deg, rgba(245, 239, 255, 0.95), rgba(255, 255, 255, 0.84)); }
.metric-card.warning { background: linear-gradient(145deg, rgba(250, 243, 230, 0.95), rgba(255, 255, 255, 0.84)); }

/* ---------- Buttons ---------- */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 9px 16px; border: 1px solid transparent; border-radius: 10px; font-size: 14px; font-weight: 600; line-height: 1.2; white-space: nowrap; transition: transform var(--motion-fast), background var(--motion-fast), box-shadow var(--motion-fast); }
.button:hover { transform: translateY(-1px); }
.button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.button.primary { background: var(--studio-ink); color: #fff; box-shadow: 0 7px 18px rgba(25, 25, 24, 0.16); }
.button.primary:hover { background: #363531; }
.button.accent { background: var(--sign-accent); color: #fff; box-shadow: 0 7px 18px rgba(90, 55, 168, 0.22); }
.button.accent:hover { background: var(--sign-accent-dark); }
.button.secondary { border-color: var(--studio-border-strong); background: rgba(255, 255, 255, 0.8); color: var(--studio-ink); }
.button.secondary:hover { background: #fff; }
.button.ghost { border-color: var(--studio-border); background: transparent; color: var(--studio-muted); }
.button.small { min-height: 36px; padding: 7px 12px; font-size: 13px; }
.button.block { width: 100%; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---------- Notices ---------- */
.notice { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; padding: 13px 15px; border: 1px solid transparent; border-radius: 12px; font-size: 14px; animation: workspace-in var(--motion-panel) ease-out both; }
.notice[hidden] { display: none; }
.notice > div { flex: 1; }
.notice ul { margin: 6px 0 0; padding-left: 18px; }
.notice strong { display: block; }
.notice.success { border-color: rgba(55, 116, 93, 0.2); background: var(--status-success-soft); color: var(--status-success); }
.notice.info { border-color: rgba(79, 111, 139, 0.2); background: var(--status-info-soft); color: var(--status-info); }
.notice.warning { border-color: rgba(138, 95, 39, 0.2); background: var(--status-warning-soft); color: var(--status-warning); }
.notice.danger { border-color: rgba(154, 80, 69, 0.2); background: var(--status-danger-soft); color: var(--status-danger); }
.notice-icon { flex: none; display: inline-flex; width: 20px; height: 20px; margin-top: 1px; }
.notice-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.notice-close { flex: none; width: 28px; height: 28px; border: 0; border-radius: 8px; background: transparent; color: inherit; font-size: 19px; line-height: 1; opacity: 0.75; }
.notice-close:hover { background: rgba(255, 255, 255, 0.6); opacity: 1; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.neutral { background: var(--studio-soft); color: var(--studio-muted); }
.badge.pending { background: var(--status-warning-soft); color: var(--status-warning); }
.badge.info { background: var(--status-info-soft); color: var(--status-info); }
.badge.accent { background: var(--sign-soft); color: var(--sign-accent-dark); }
.badge.success { background: var(--status-success-soft); color: var(--status-success); }

/* ---------- Forms ---------- */
.stack-form { display: grid; gap: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .field-label { font-size: 14px; font-weight: 600; }
.field input[type="text"], .field input[type="email"], .field input[type="number"], .field input[type="file"], .field input:not([type]), .field select, .field textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--studio-border-strong); border-radius: 10px;
  background: rgba(255, 255, 255, 0.86); color: var(--studio-ink); font-size: 15px;
  transition: border-color var(--motion-fast), box-shadow var(--motion-fast);
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: rgba(118, 80, 208, 0.6); box-shadow: 0 0 0 3px rgba(118, 80, 208, 0.13); outline: 0; }
.field input::placeholder { color: var(--studio-faint); }
.field-help { color: var(--studio-muted); font-size: 13px; }
.field-error { color: var(--status-danger); font-size: 13px; }
.form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding-top: 6px; }
.form-section + .form-section { padding-top: 20px; border-top: 1px solid var(--studio-border); }
.form-section > h3 { margin-bottom: 12px; font-size: 16px; }
.form-section > h3 small { margin-left: 6px; color: var(--studio-muted); font: 500 13px var(--font-body); }

.drop-zone { position: relative; display: grid; justify-items: center; gap: 6px; padding: 26px 18px; border: 1.5px dashed rgba(118, 80, 208, 0.32); border-radius: 14px; background: rgba(241, 235, 251, 0.4); text-align: center; transition: background var(--motion-fast), border-color var(--motion-fast); }
.drop-zone:hover, .drop-zone.is-dragover, .drop-zone:focus-within { border-color: rgba(118, 80, 208, 0.6); background: rgba(241, 235, 251, 0.75); }
.drop-zone svg { width: 30px; height: 30px; fill: none; stroke: var(--sign-accent); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.drop-zone strong { font-size: 15px; }
.drop-zone span { color: var(--studio-muted); font-size: 13px; }
.drop-zone input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.drop-zone .file-name { color: var(--sign-accent-dark); font-weight: 600; }

/* ---------- Lists (documents & templates) ---------- */
.item-list { display: grid; gap: 0; border: 1px solid var(--studio-border); border-radius: var(--radius-lg); background: rgba(255, 255, 255, 0.78); box-shadow: var(--studio-card-shadow); }
.item-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 18px; padding: 16px 20px; border-top: 1px solid var(--studio-border); transition: background var(--motion-fast); }
.item-row:first-child { border-top: 0; }
.item-row:first-child { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.item-row:last-child { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.item-row:only-child { border-radius: var(--radius-lg); }
.item-row.compact { grid-template-columns: minmax(0, 1fr) auto; }
.item-row:hover { background: rgba(255, 255, 255, 0.6); }
.item-main { display: flex; align-items: center; gap: 14px; min-width: 0; }
.item-icon { display: grid; place-items: center; flex: none; width: 42px; height: 42px; border-radius: 12px; background: var(--sign-soft); color: var(--sign-accent-dark); }
.item-icon svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.item-copy { min-width: 0; }
.item-copy strong { display: block; overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.item-copy small { display: block; color: var(--studio-muted); font-size: 13px; }
.item-meta { display: grid; justify-items: end; gap: 6px; }
.item-actions { display: flex; align-items: center; gap: 8px; }

.progress { display: flex; gap: 4px; align-items: center; }
.progress span { width: 22px; height: 5px; border-radius: 999px; background: var(--studio-border-strong); }
.progress span.done { background: var(--status-success); }
.progress span.current { background: var(--sign-accent); }
/* Plan usage (StudioNest packages) */
.usage-meter { display: grid; gap: 8px; }
.usage-meter + .usage-meter { margin-top: 16px; }
.usage-meter-head { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.usage-meter-head strong { font-variant-numeric: tabular-nums; }
.usage-meter-track { height: 8px; border-radius: 999px; background: var(--studio-border-strong); overflow: hidden; }
.usage-meter-track span { display: block; height: 100%; border-radius: inherit; background: var(--sign-accent); }
.usage-meter.exhausted .usage-meter-track span { background: var(--status-danger); }
.check-field { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.check-field input { margin-top: 3px; }

/* Action menu (details/summary, no JS framework) */
.action-menu { position: relative; }
.action-menu summary { list-style: none; }
.action-menu summary::-webkit-details-marker { display: none; }
.action-menu-panel { position: absolute; z-index: 30; top: calc(100% + 6px); right: 0; width: 260px; padding: 6px; border: 1px solid var(--studio-border); border-radius: 12px; background: rgba(255, 255, 255, 0.99); box-shadow: var(--studio-shadow-soft); animation: workspace-in 160ms ease-out both; }
.action-menu-panel a, .action-menu-panel button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--studio-ink); font-size: 14px; text-align: left; }
.action-menu-panel a:hover, .action-menu-panel button:hover { background: var(--studio-soft); }
.action-menu-panel svg { flex: none; width: 17px; height: 17px; fill: none; stroke: var(--studio-muted); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.action-menu-panel form { margin: 0; }
.action-menu-panel hr { margin: 5px 4px; border: 0; border-top: 1px solid var(--studio-border); }
.action-menu-panel .danger, .action-menu-panel .danger svg { color: var(--status-danger); stroke: var(--status-danger); }
.action-menu-label { padding: 8px 10px 4px; color: var(--studio-faint); font-size: 12px; font-weight: 700; }

.filter-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.filter-tabs button { padding: 7px 12px; border: 1px solid var(--studio-border); border-radius: 999px; background: rgba(255, 255, 255, 0.6); color: var(--studio-muted); font-size: 13px; font-weight: 600; }
.filter-tabs button[aria-pressed="true"] { border-color: transparent; background: var(--studio-ink); color: #fff; }

/* Empty state */
.empty { display: grid; justify-items: center; gap: 8px; padding: 42px 20px; text-align: center; }
.empty svg { width: 34px; height: 34px; fill: none; stroke: var(--studio-faint); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.empty strong { font-size: 16px; }
.empty p { max-width: 46ch; color: var(--studio-muted); font-size: 14px; }

/* Steps (how it works) */
.steps { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.steps li { display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: start; counter-increment: step; }
.steps li::before { content: counter(step); display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; background: var(--sign-soft); color: var(--sign-accent-dark); font-weight: 700; font-size: 14px; }
.steps strong { display: block; font-size: 15px; }
.steps span { color: var(--studio-muted); font-size: 14px; }
.check-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.check-list li { display: flex; gap: 9px; font-size: 14px; }
.check-list li::before { content: "✓"; color: var(--status-success); font-weight: 700; }

/* ---------- Signature pad ---------- */
.signature-pad { display: grid; gap: 14px; }
.signature-pad--body { position: relative; height: 240px; border: 1.5px dashed var(--studio-border-strong); border-radius: 14px; background: #fff; touch-action: none; }
.signature-pad--body canvas { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 14px; cursor: crosshair; }
.signature-pad--body::after { content: ""; position: absolute; left: 22px; right: 22px; bottom: 54px; border-bottom: 1px solid var(--studio-border-strong); pointer-events: none; }
.signature-hint { position: absolute; left: 24px; bottom: 26px; color: var(--studio-faint); font-size: 13px; pointer-events: none; }
.signature-pad--actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; }
.signature-pad--actions .column { display: flex; flex-wrap: wrap; gap: 8px; }

.pdf-frame { width: 100%; height: min(72vh, 760px); border: 1px solid var(--studio-border); border-radius: 14px; background: #fff; }

/* ---------- Public (customer) & auth pages ---------- */
.public-body { min-height: 100vh; }
.public-header { width: min(1080px, 100%); margin: 0 auto; padding: 18px 16px 0; }
.public-header .system-brand { display: inline-flex; padding: 10px 14px; border: 1px solid rgba(255, 255, 255, 0.55); border-radius: 14px; background: rgba(247, 245, 241, 0.88); box-shadow: var(--studio-shadow-soft); backdrop-filter: blur(18px); }
.public-main { width: min(1080px, 100%); margin: 0 auto; padding: 18px 16px 40px; }
.public-card { padding: clamp(20px, 3vw, 38px); border: 1px solid rgba(255, 255, 255, 0.58); border-radius: var(--radius-xl); background: var(--studio-surface); box-shadow: var(--studio-shadow); backdrop-filter: blur(24px); animation: workspace-in var(--motion-panel) ease-out both; }
.public-card + .public-card { margin-top: 18px; }
.public-footer { margin-top: 22px; color: var(--studio-muted); font-size: 13px; text-align: center; }
.success-mark { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 14px; border-radius: 16px; background: var(--status-success-soft); color: var(--status-success); }
.success-mark svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.auth-body { position: relative; min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(440px, 100%); padding: 38px; border: 1px solid rgba(255, 255, 255, 0.62); border-radius: 22px; background: rgba(250, 249, 246, 0.93); box-shadow: var(--studio-shadow); backdrop-filter: blur(24px); animation: workspace-in var(--motion-panel) ease-out both; }
.auth-product { display: flex; align-items: center; gap: 14px; margin-bottom: 30px; }
.auth-product img { width: 64px; height: 64px; border-radius: 18px; filter: drop-shadow(0 9px 12px rgba(90, 55, 168, 0.18)); }
.auth-product > span { display: grid; gap: 2px; }
.auth-product strong { font: 700 21px var(--font-display); }
.auth-product small { color: var(--studio-muted); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
.auth-card h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.03em; }
.auth-card .subhead { margin-bottom: 24px; font-size: 15px; }
.auth-divider { margin: 24px 0 16px; border: 0; border-top: 1px solid var(--studio-border); }
.auth-links { display: grid; gap: 10px; color: var(--studio-muted); font-size: 14px; }

/* Cookie banner */
.cookie-banner { position: fixed; z-index: 120; right: 16px; bottom: 16px; width: min(420px, calc(100vw - 32px)); padding: 18px; border: 1px solid rgba(255, 255, 255, 0.7); border-radius: 16px; background: rgba(250, 249, 246, 0.98); box-shadow: 0 24px 70px rgba(24, 24, 22, 0.22); }
.cookie-banner[hidden] { display: none; }
.cookie-banner h2 { margin-bottom: 6px; font-size: 16px; }
.cookie-banner p { margin-bottom: 14px; color: var(--studio-muted); font-size: 14px; }
.cookie-banner a { text-decoration: underline; }

/* Feedback ("Comentario") */
.feedback-trigger { position: fixed; z-index: 58; top: 55%; right: 0; min-width: 42px; min-height: 124px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 11px 8px; border: 1px solid rgba(255, 255, 255, 0.72); border-right: 0; border-radius: 14px 0 0 14px; color: var(--sign-accent-dark); background: rgba(249, 248, 245, 0.92); box-shadow: 0 16px 38px rgba(47, 39, 29, 0.15); backdrop-filter: blur(18px); cursor: pointer; transition: background var(--motion-fast), box-shadow var(--motion-fast); }
.feedback-trigger:hover { background: rgba(255, 255, 255, 0.98); box-shadow: 0 18px 42px rgba(47, 39, 29, 0.2); }
.feedback-trigger:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.feedback-trigger svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.feedback-trigger span { font-size: 12px; font-weight: 700; letter-spacing: 0.02em; writing-mode: vertical-rl; transform: rotate(180deg); }
.feedback-dialog { width: min(560px, calc(100% - 28px)); max-height: calc(100vh - 28px); padding: 0; border: 1px solid rgba(255, 255, 255, 0.7); border-radius: var(--radius-lg); color: var(--studio-ink); background: var(--studio-paper); box-shadow: var(--studio-shadow); }
.feedback-dialog::backdrop { background: rgba(25, 25, 24, 0.32); backdrop-filter: blur(3px); }
.feedback-form > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 22px 24px 18px; border-bottom: 1px solid var(--studio-border); }
.feedback-form > header h2 { margin: 1px 0 5px; font-size: 22px; }
.feedback-form > header p:last-child { max-width: 430px; margin: 0; color: var(--studio-muted); font-size: 14px; }
.feedback-form > header > button { flex: none; width: 32px; height: 32px; border: 0; border-radius: 9px; color: var(--studio-muted); background: rgba(25, 25, 24, 0.06); font-size: 21px; cursor: pointer; }
.feedback-fields { display: grid; gap: 15px; padding: 21px 24px; }
.feedback-fields textarea { min-height: 150px; line-height: 1.5; resize: vertical; }
.feedback-hint { margin: -3px 0 0; color: var(--studio-muted); font-size: 13px; }
.feedback-status { min-height: 20px; color: var(--studio-muted); font-size: 14px; font-weight: 600; }
.feedback-status.success { color: var(--status-success); }
.feedback-status.error { color: var(--status-danger); }
.feedback-form > footer { display: flex; justify-content: flex-end; gap: 9px; padding: 14px 24px 18px; border-top: 1px solid var(--studio-border); }
.feedback-form > footer .button:disabled { cursor: wait; opacity: 0.62; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .workspace { grid-template-columns: 168px minmax(0, 1fr); }
  .app-navigation a small { display: none; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split-layout { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .system-nav, .system-brand small { display: none; }
  .item-row { grid-template-columns: minmax(0, 1fr) auto; }
  .item-meta { grid-column: 1 / 2; justify-items: start; grid-auto-flow: column; align-items: center; justify-content: start; padding-left: 56px; }
  .item-actions { grid-row: 1 / 3; grid-column: 2; }
}

@media (max-width: 760px) {
  body::before { background: rgba(241, 237, 230, 0.72); }
  .studio-backdrop { filter: saturate(0.55) contrast(0.78) blur(4px); }
  .system-bar { inset: 8px 8px auto; height: 56px; gap: 8px; border-radius: 15px; }
  .account-copy, .demo-flag-long { display: none; }
  .app-switcher-panel { position: fixed; top: 70px; right: 9px; left: 9px; width: auto; max-height: calc(100vh - 160px); overflow-y: auto; padding: 15px; border-radius: 17px; }
  .app-switcher-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app-switcher-item { min-height: 128px; }
  .app-switcher-tooltip { display: none; }
  .workspace { display: block; padding: 72px 8px 92px; }
  .main { min-height: calc(100vh - 170px); padding: 22px 16px 30px; border-radius: 19px; }
  .app-rail { position: fixed; z-index: 45; inset: auto 8px 8px; width: auto; height: 70px; display: block; padding: 7px; border-radius: 17px; }
  .app-tile, .app-rail-bottom { display: none; }
  .app-navigation { grid-template-columns: repeat(3, 1fr); gap: 4px; margin: 0; }
  .app-navigation a { grid-template-columns: 1fr; justify-items: center; gap: 3px; min-height: 54px; padding: 6px 2px; font-size: 12px; }
  .app-navigation a:hover { transform: none; }
  .app-navigation a.active { box-shadow: inset 0 3px var(--sign-accent); }
  .page-header { margin-bottom: 22px; }
  .page-header > .button, .page-header > .button-row { width: 100%; }
  .page-header > .button-row .button { flex: 1; }
  .metric-grid { gap: 10px; }
  .metric-card { min-height: 116px; padding: 16px; }
  .metric-card strong { font-size: 29px; }
  .panel { padding: 19px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-actions .button { width: 100%; }
  .item-row { padding: 14px; gap: 10px 12px; }
  .item-meta { padding-left: 0; grid-column: 1 / -1; }
  .item-actions { grid-row: 1; }
  .item-actions .button-label { display: none; }
  .action-menu-panel { position: fixed; top: auto; right: 8px; bottom: 86px; left: 8px; width: auto; }
  .signature-pad--body { height: 210px; }
  .signature-pad--actions .column { width: 100%; }
  .signature-pad--actions .column .button { flex: 1; }
  .pdf-frame { height: 62vh; }
  .auth-card { padding: 30px 22px; }
  .cookie-banner { right: 8px; left: 8px; bottom: 86px; width: auto; }
  .feedback-trigger { top: auto; right: 13px; bottom: 90px; min-width: 44px; min-height: 44px; flex-direction: row; padding: 10px 12px; border-right: 1px solid rgba(255, 255, 255, 0.72); border-radius: 13px; }
  .feedback-trigger span { writing-mode: initial; transform: none; }
  .feedback-dialog { width: 100%; max-width: 100%; max-height: 100%; height: 100%; border-radius: 0; }
  .feedback-form > header { padding: 19px 17px 15px; }
  .feedback-fields { padding: 18px 17px; }
  .feedback-form > footer { padding: 13px 17px 18px; }
  .feedback-form > footer .button { flex: 1; }
}

@media (max-width: 380px) {
  .metric-grid { grid-template-columns: 1fr; }
  .system-brand span { display: none; }
}

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

/* Keep page actions reachable while the cookie banner is visible */
body.has-cookie-banner .workspace { padding-bottom: 220px; }
@media (max-width: 760px) { body.has-cookie-banner .workspace { padding-bottom: 330px; } }
