:root {
  --green-950: #05251f;
  --green-900: #073d32;
  --green-800: #0b6652;
  --green-700: var(--user-accent, #0f766e);
  --green-600: #0d9488;
  --green-500: #14b8a6;
  --green-100: #ccfbf1;
  --green-50: #f0fdfa;
  --ink-950: #10211d;
  --ink-700: #354b44;
  --ink-500: #62746e;
  --line: #dfe8e4;
  --line-strong: #c9d7d1;
  --surface: #ffffff;
  --canvas: #f3f7f5;
  --danger: #bf3636;
  --warning: #a96800;
  --shadow: 0 20px 50px rgba(6, 50, 40, .11);
  --shadow-soft: 0 8px 24px rgba(6, 50, 40, .07);
  --radius: 18px;
  --sidebar: 284px;
  color-scheme: light;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--canvas); }
body { margin: 0; min-height: 100vh; overflow-x: hidden; color: var(--ink-950); background: var(--canvas); font-size: 14px; line-height: 1.45; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.muted { color: var(--ink-500); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); padding: 18px 14px;
  background: var(--green-950); color: #d9f3e8; overflow-y: auto; z-index: 40;
  border-right: 1px solid rgba(255,255,255,.08);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 4px 18px; }
.brand .brand-lockup { width: 182px; height: 58px; padding: 4px 6px; object-fit: contain; object-position: left center; border-radius: 10px; background: #fff; }
.brand .brand-mark { display: none; }
.brand-version { margin-left: auto; color: #9edcc2; font-size: 11px; }
.nav-section { margin: 8px 0; }
.nav-section summary {
  display: flex; align-items: center; justify-content: space-between; list-style: none;
  padding: 9px 10px; color: #9ed0bc; text-transform: uppercase; letter-spacing: .07em;
  font-size: 10px; font-weight: 800; cursor: pointer;
}
.nav-section summary::-webkit-details-marker { display: none; }
.nav-section summary::after { content: "›"; transform: rotate(90deg); transition: transform .16s; }
.nav-section:not([open]) summary::after { transform: rotate(0); }
.nav-link { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 8px 10px; margin: 2px 0; border-radius: 9px; color: #d8eee5; }
.nav-link:hover, .nav-link.active { background: rgba(124, 225, 181, .12); color: #fff; }
.nav-link .nav-dot { width: 7px; height: 7px; border-radius: 50%; background: #64d3a4; opacity: .8; flex: 0 0 auto; }
.nav-dashboard { margin-bottom: 12px; background: rgba(124, 225, 181, .08); }
.nav-all { border: 1px solid rgba(255,255,255,.11); margin-top: 12px; }
.sidebar-footer { margin-top: 22px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.1); }

.main-shell { margin-left: var(--sidebar); min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: 68px; display: flex; align-items: center; gap: 14px;
  padding: 0 28px; background: rgba(255,255,255,.93); border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}
.menu-toggle { display: none; }
.search-trigger {
  flex: 1; max-width: 560px; display: flex; align-items: center; justify-content: space-between;
  height: 40px; padding: 0 13px; color: var(--ink-500); background: var(--canvas);
  border: 1px solid var(--line); border-radius: 10px;
}
.search-trigger:hover { border-color: var(--green-500); background: #fff; }
.kbd { padding: 2px 7px; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; font-size: 11px; }
.topbar-spacer { flex: 1; }
.user-chip { display: flex; align-items: center; gap: 9px; min-width: 0; }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--green-100); color: var(--green-800); font-weight: 800; }
.user-name { max-width: 180px; font-weight: 700; }
.icon-button { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink-700); }
.icon-button:hover { border-color: var(--green-500); color: var(--green-700); }

.content { padding: 26px 28px 50px; max-width: 1680px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.eyebrow { margin-bottom: 5px; color: var(--green-700); font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
h1, h2, h3 { margin: 0; letter-spacing: -.02em; }
h1 { font-size: clamp(24px, 3vw, 34px); line-height: 1.14; }
h2 { font-size: 19px; }
h3 { font-size: 15px; }
.page-subtitle { margin: 7px 0 0; color: var(--ink-500); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px;
  padding: 8px 13px; border: 1px solid var(--line-strong); border-radius: 9px; background: #fff;
  color: var(--ink-700); font-weight: 700; line-height: 1;
}
.btn:hover { border-color: var(--green-600); color: var(--green-800); }
.btn-primary { background: var(--green-700); border-color: var(--green-700); color: #fff; box-shadow: 0 5px 12px rgba(8,122,88,.18); }
.btn-primary:hover { background: var(--green-800); color: #fff; }
.btn-danger { color: var(--danger); border-color: #edc7c7; }
.btn-danger:hover { background: #fff5f5; border-color: var(--danger); color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { min-height: 32px; padding: 6px 9px; font-size: 12px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 1px rgba(15,40,31,.02); }
.card:hover.elevate { box-shadow: var(--shadow); border-color: var(--line-strong); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 17px 18px; border-bottom: 1px solid var(--line); }
.card-body { padding: 18px; }
.grid { display: grid; gap: 16px; }
.metrics-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metric { padding: 18px; position: relative; overflow: hidden; }
.metric::after { content: ""; position: absolute; width: 74px; height: 74px; right: -22px; top: -22px; border-radius: 50%; background: var(--green-100); opacity: .65; }
.metric-label { color: var(--ink-500); font-weight: 700; }
.metric-value { margin: 10px 0 5px; font-size: 29px; font-weight: 850; letter-spacing: -.04em; }
.metric-detail { color: var(--green-700); font-size: 12px; font-weight: 700; }
.period-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 16px; }
.period { padding: 15px 16px; }
.period strong { display: block; margin-top: 7px; font-size: 20px; }
.dashboard-grid { grid-template-columns: minmax(0, 1.5fr) minmax(300px, .75fr); margin-top: 16px; align-items: start; }
.stack { display: grid; gap: 16px; }

.toolbar { display: flex; align-items: center; gap: 9px; padding: 14px; border-bottom: 1px solid var(--line); }
.toolbar form { display: flex; align-items: center; gap: 8px; flex: 1; }
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--line-strong); border-radius: 9px; background: #fff; color: var(--ink-950);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.input, .select { min-height: 39px; padding: 8px 11px; }
.textarea { min-height: 110px; padding: 10px 11px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--green-600); box-shadow: 0 0 0 3px rgba(19,173,122,.12); }
.search-input { max-width: 520px; }
.field { display: grid; gap: 6px; }
.field label { font-size: 12px; font-weight: 750; color: var(--ink-700); }
.field-hint { color: var(--ink-500); font-size: 11px; }
.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field-wide { grid-column: 1 / -1; }
.required { color: var(--danger); }
.role-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.check-card { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; }
.check-card:hover { border-color: var(--green-500); background: var(--green-50); }
.check-card input { margin-top: 3px; accent-color: var(--green-700); }
.check-card span { display: grid; gap: 3px; }
.check-card small { color: var(--ink-500); line-height: 1.35; }
.form-actions { justify-content: flex-end; border-top: 1px solid var(--line); border-bottom: 0; }

.table-wrap { overflow: auto; border-radius: 0 0 var(--radius) var(--radius); }
.data-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.data-table th { position: sticky; top: 0; z-index: 2; padding: 11px 13px; background: #f7faf8; border-bottom: 1px solid var(--line); color: var(--ink-500); text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .045em; white-space: nowrap; }
.data-table td { padding: 12px 13px; border-bottom: 1px solid #e9efec; vertical-align: middle; max-width: 330px; }
.data-table tbody tr:hover { background: var(--green-50); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.table-link { color: var(--green-800); font-weight: 750; }
.sort-link { display: inline-flex; gap: 5px; align-items: center; }
.empty { padding: 48px 20px; text-align: center; color: var(--ink-500); }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 15px; border-top: 1px solid var(--line); }
.page-links { display: flex; align-items: center; gap: 5px; }

.badge { display: inline-flex; align-items: center; gap: 5px; min-height: 24px; padding: 3px 8px; border-radius: 999px; background: #edf2ef; color: var(--ink-700); font-size: 11px; font-weight: 750; }
.badge-success { background: var(--green-100); color: var(--green-800); }
.badge-danger { background: #ffeded; color: #a52d2d; }
.badge-warning { background: #fff1d6; color: #8a5600; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-word { font-size: 20px; text-transform: capitalize; }
.status-good { color: var(--green-800); }
.status-attention { color: var(--warning); }
.space-top { margin-top: 18px; }
.hash-value { overflow-wrap: anywhere; font-size: 11px; line-height: 1.55; }
.migration-ok { display: flex; align-items: center; gap: 12px; }
.migration-ok > span { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--green-100); color: var(--green-800); font-weight: 900; }
.audit-feed { max-height: 700px; overflow: auto; padding: 8px 18px; }
.audit-event { position: relative; display: grid; grid-template-columns: 14px 1fr; gap: 9px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.audit-event:last-child { border-bottom: 0; }
.audit-mark { width: 9px; height: 9px; margin-top: 4px; border: 2px solid var(--green-600); border-radius: 50%; background: #fff; }
.report-filter { margin-bottom: 16px; padding: 14px; }
.report-filter form { display: flex; align-items: end; gap: 10px; }
.report-filter .field { min-width: 180px; }
.report-metrics { margin-bottom: 16px; }
.metric-money { font-size: clamp(20px, 2.3vw, 29px); }
.detail-list { display: grid; gap: 0; }
.detail-list > div { display: flex; justify-content: space-between; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.detail-list > div:last-child { border-bottom: 0; }
.report-big-number { color: var(--green-800); font-size: 44px; font-weight: 850; letter-spacing: -.04em; }
.report-link { margin-top: 16px; }

.flash-stack { display: grid; gap: 8px; margin-bottom: 16px; }
.flash { display: flex; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 10px; border: 1px solid; }
.flash-success { background: var(--green-50); border-color: #aee8ce; color: var(--green-800); }
.flash-error { background: #fff1f1; border-color: #edc3c3; color: #9c2f2f; }
.flash-info { background: #f1f6ff; border-color: #c8d9f3; color: #315c96; }

.detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; }
.detail-item { min-height: 78px; padding: 13px 15px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.detail-item:nth-child(3n) { border-right: 0; }
.detail-label { margin-bottom: 7px; color: var(--ink-500); font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .04em; }
.detail-value { overflow-wrap: anywhere; white-space: pre-wrap; }
.relation-list { display: grid; gap: 8px; }
.relation-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 12px; background: var(--canvas); border-radius: 9px; }

.directory-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.resource-card { display: block; padding: 15px; min-height: 92px; }
.resource-card:hover { border-color: var(--green-500); box-shadow: var(--shadow); transform: translateY(-1px); }
.resource-card h3 { margin-bottom: 7px; }
.resource-code { color: var(--ink-500); font-family: ui-monospace, monospace; font-size: 11px; }
.group-title { margin: 28px 0 12px; }
.group-title:first-child { margin-top: 0; }

.document-form { overflow: visible; }
.document-meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.document-party { grid-column: span 2; }
.line-editor { overflow-x: auto; border: 1px solid var(--line); border-radius: 11px; }
.line-editor table { width: 100%; min-width: 1060px; border-collapse: collapse; }
.line-editor th { padding: 9px 8px; background: #f5f9f7; color: var(--ink-500); text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .04em; }
.line-editor td { padding: 7px 5px; border-top: 1px solid var(--line); vertical-align: top; }
.line-editor .input, .line-editor .select { min-height: 34px; padding: 6px 7px; border-radius: 7px; font-size: 12px; }
.line-reference { width: 118px; }
.line-description { min-width: 280px; }
.line-quantity { width: 86px; }
.line-price { width: 105px; }
.line-discount { width: 78px; }
.line-tax { width: 116px; }
.line-total { width: 105px; text-align: right; font-weight: 800; white-space: nowrap; }
.document-summary { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; margin-top: 18px; }
.totals-box { padding: 15px; border: 1px solid var(--line); border-radius: 11px; background: var(--green-50); }
.total-row { display: flex; justify-content: space-between; gap: 18px; padding: 6px 0; }
.total-row-grand { margin-top: 6px; padding-top: 12px; border-top: 1px solid #b9dfcd; color: var(--green-900); font-size: 18px; font-weight: 850; }
.document-title-block { display: grid; gap: 3px; }
.document-code { color: var(--green-800); font-family: ui-monospace, monospace; font-weight: 800; }
.document-info-grid { display: grid; grid-template-columns: 1.1fr .9fr .7fr; gap: 14px; }
.document-info { padding: 16px; }
.document-info p { margin: 5px 0; }
.document-total { font-size: 30px; font-weight: 850; color: var(--green-900); }

.modal { width: min(720px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 16px; box-shadow: 0 28px 80px rgba(5,46,38,.26); }
.modal::backdrop { background: rgba(4, 28, 22, .48); backdrop-filter: blur(3px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 15px 17px; border-bottom: 1px solid var(--line); }
.command-results { max-height: 420px; overflow-y: auto; padding: 8px; }
.command-result { display: flex; justify-content: space-between; gap: 12px; padding: 11px 12px; border-radius: 9px; }
.command-result:hover { background: var(--green-50); color: var(--green-800); }

.auth-page, .install-page { min-height: 100vh; display: grid; place-items: center; padding: 28px; background: radial-gradient(circle at 15% 10%, #dcf6ea 0, transparent 35%), linear-gradient(145deg, #f6faf8, #eaf4ef); }
.auth-shell { width: min(1040px, 100%); display: grid; grid-template-columns: 1.1fr .9fr; overflow: hidden; border-radius: 24px; background: #fff; box-shadow: 0 30px 80px rgba(5,46,38,.16); }
.auth-aside { position: relative; padding: 54px; display: flex; flex-direction: column; justify-content: space-between; background: var(--green-950); color: #fff; min-height: 620px; overflow: hidden; }
.auth-aside::before, .auth-aside::after { content: ""; position: absolute; border-radius: 50%; border: 1px solid rgba(124,225,181,.23); }
.auth-aside::before { width: 380px; height: 380px; right: -180px; top: -120px; }
.auth-aside::after { width: 260px; height: 260px; left: -130px; bottom: -100px; }
.auth-logo { width: min(300px, 100%); height: auto; padding: 7px; position: relative; z-index: 1; border-radius: 14px; background: #fff; box-shadow: 0 12px 32px rgba(0,0,0,.14); }
.auth-copy { position: relative; z-index: 1; max-width: 420px; }
.auth-copy h1 { font-size: 42px; margin-bottom: 16px; }
.auth-copy p { color: #b9d8cb; font-size: 16px; line-height: 1.6; }
.auth-checks { display: grid; gap: 9px; margin-top: 24px; color: #d8eee5; }
.auth-check { display: flex; gap: 9px; align-items: center; }
.auth-check::before { content: "✓"; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: rgba(124,225,181,.16); color: #8be6bf; font-weight: 800; }
.auth-form { padding: 54px; display: flex; flex-direction: column; justify-content: center; }
.auth-form h2 { font-size: 28px; margin-bottom: 7px; }
.auth-form form { display: grid; gap: 15px; margin-top: 28px; }
.auth-form .btn { min-height: 45px; }
.auth-footer { margin-top: 24px; color: var(--ink-500); font-size: 12px; }

.install-shell { width: min(1180px, 100%); }
.install-card { overflow: hidden; }
.install-head { display: flex; justify-content: space-between; gap: 20px; padding: 24px 28px; color: #fff; background: var(--green-950); }
.install-head img { width: min(290px, 100%); height: auto; padding: 6px; border-radius: 12px; background: #fff; }
.install-body { display: grid; grid-template-columns: 330px 1fr; }
.requirements { padding: 24px; background: #f6faf8; border-right: 1px solid var(--line); }
.requirement { display: flex; align-items: center; gap: 9px; padding: 8px 0; }
.requirement-mark { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; font-size: 11px; font-weight: 900; }
.requirement-ok { background: var(--green-100); color: var(--green-800); }
.requirement-fail { background: #ffe5e5; color: var(--danger); }
.requirement-warning { background: #fff4d6; color: #8a5a00; }
.install-form { padding: 28px; }
.section-title { padding-bottom: 9px; margin: 22px 0 14px; border-bottom: 1px solid var(--line); }
.section-title:first-child { margin-top: 0; }

.mobile-backdrop { display: none; }

@media (max-width: 1180px) {
  .metrics-grid, .period-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .directory-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-item:nth-child(3n) { border-right: 1px solid var(--line); }
  .detail-item:nth-child(2n) { border-right: 0; }
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .main-shell { margin-left: 0; }
  .menu-toggle { display: grid; }
  .mobile-backdrop { position: fixed; inset: 0; z-index: 35; background: rgba(4,28,22,.42); }
  body.sidebar-open .mobile-backdrop { display: block; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .auth-shell { grid-template-columns: 1fr; max-width: 560px; }
  .auth-aside { min-height: 260px; padding: 34px; }
  .auth-copy h1 { font-size: 30px; }
  .auth-checks { display: none; }
  .auth-form { padding: 34px; }
  .install-body { grid-template-columns: 1fr; }
  .document-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .document-summary, .document-info-grid { grid-template-columns: 1fr; }
  .requirements { border-right: 0; border-bottom: 1px solid var(--line); }
}

@media (max-width: 640px) {
  .topbar { padding: 0 14px; }
  .content { padding: 20px 14px 38px; }
  .page-head { flex-direction: column; }
  .actions { justify-content: flex-start; width: 100%; }
  .metrics-grid, .period-grid, .directory-grid, .form-grid, .detail-grid { grid-template-columns: 1fr; }
  .role-grid { grid-template-columns: 1fr; }
  .detail-item { border-right: 0 !important; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .toolbar form { align-items: stretch; flex-direction: column; }
  .search-input { max-width: none; }
  .pagination { align-items: flex-start; flex-direction: column; }
  .user-name, .search-trigger .search-label { display: none; }
  .auth-page, .install-page { padding: 0; align-items: stretch; }
  .auth-shell, .install-card { border-radius: 0; min-height: 100vh; }
  .auth-form, .install-form { padding: 26px 20px; }
  .auth-aside { display: none; }
  .document-meta { grid-template-columns: 1fr; }
  .report-filter form { align-items: stretch; flex-direction: column; }
  .report-filter .field { min-width: 0; width: 100%; }
  .document-party { grid-column: auto; }
  .install-head { padding: 20px; }
}

@media print {
  .sidebar, .topbar, .actions, .toolbar, .flash-stack, .pagination { display: none !important; }
  .main-shell { margin: 0; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; break-inside: avoid; }
}

/* TECSA Suite 7.1 · visual system */
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg { width: 20px; height: 20px; fill: currentColor; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--green-500) 35%, transparent); outline-offset: 2px; }
.sidebar {
  display: flex; flex-direction: column; padding: 16px 12px 14px;
  background:
    radial-gradient(circle at 25% 0, rgba(20,184,166,.18), transparent 32%),
    linear-gradient(180deg, #0f172a 0%, #0b1f27 55%, #071f1d 100%);
  box-shadow: 8px 0 30px rgba(15,23,42,.12);
  transition: width .22s ease, transform .22s ease;
}
.brand { min-height: 64px; padding: 4px 8px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand .brand-lockup { width: 176px; max-height: 58px; object-fit: contain; object-position: left center; }
.brand-version { display: inline-flex; align-items: center; min-height: 22px; padding: 2px 7px; margin-left: auto; border-radius: 999px; background: rgba(45,212,191,.11); color: #99f6e4; }
.sidebar-nav { flex: 1; margin-top: 10px; }
.nav-section { margin: 6px 0; }
.nav-section summary { padding: 10px 12px 6px; color: #7895a5; }
.nav-link { position: relative; min-height: 41px; padding: 9px 11px; margin: 3px 0; border: 1px solid transparent; color: #cbd5e1; transition: color .15s, background .15s, border .15s, transform .15s; }
.nav-link:hover { transform: translateX(2px); background: rgba(148,163,184,.09); border-color: rgba(255,255,255,.05); }
.nav-link.active { background: linear-gradient(90deg, rgba(20,184,166,.22), rgba(20,184,166,.08)); border-color: rgba(94,234,212,.15); color: #fff; }
.nav-link.active::before { content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 5px 5px 0; background: #2dd4bf; box-shadow: 0 0 14px rgba(45,212,191,.55); }
.nav-icon { width: 18px; height: 18px; flex: 0 0 18px; color: #7dd3c7; opacity: .9; }
.nav-link.active .nav-icon { color: #5eead4; }
.nav-link .nav-dot { display: none; }
.nav-label { min-width: 0; }
.nav-all { margin-top: 13px; border-color: rgba(148,163,184,.16); }
.sidebar-footer { padding: 14px 8px 0; }
.suite-status { display: flex; align-items: center; gap: 8px; color: #d5f5ed; }
.suite-status > span { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 4px rgba(34,197,94,.11); }
.main-shell { transition: margin-left .22s ease; }
.topbar { height: 72px; padding: 0 26px; background: color-mix(in srgb, var(--surface) 91%, transparent); box-shadow: 0 1px 0 rgba(15,23,42,.02); }
.desktop-collapse { display: grid; }
.search-trigger { max-width: 610px; gap: 10px; justify-content: flex-start; background: color-mix(in srgb, var(--canvas) 80%, var(--surface)); }
.search-trigger svg { width: 17px; height: 17px; }
.search-trigger .kbd { margin-left: auto; }
.icon-button { flex: 0 0 auto; }
.icon-button svg { width: 18px; height: 18px; }
.user-chip { padding: 4px 9px 4px 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.avatar { background: linear-gradient(135deg, var(--green-100), #a7f3d0); box-shadow: inset 0 0 0 1px rgba(15,118,110,.08); }
.content { padding-top: 30px; }
.page-head { margin-bottom: 24px; }
.page-subtitle { max-width: 780px; line-height: 1.55; }
.eyebrow { color: var(--green-700); }
.card { box-shadow: 0 2px 5px rgba(15,23,42,.025); transition: border-color .15s, box-shadow .15s, transform .15s; }
.card-head { min-height: 66px; }
.card-head p { margin: 5px 0 0; }
.metric { min-height: 142px; border-top: 3px solid transparent; }
.metric:hover { border-top-color: var(--green-500); transform: translateY(-2px); box-shadow: var(--shadow); }
.metric::after { width: 105px; height: 105px; right: -34px; top: -37px; background: linear-gradient(135deg, var(--green-100), transparent); }
.btn, .input, .select, .textarea, .icon-button, .search-trigger { transition: border-color .15s, box-shadow .15s, background .15s, color .15s, transform .15s; }
.btn:active, .icon-button:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(135deg, var(--green-700), #0d9488); border-color: transparent; box-shadow: 0 7px 18px color-mix(in srgb, var(--green-700) 25%, transparent); }
.btn-primary:hover { background: linear-gradient(135deg, #115e59, var(--green-700)); }
.data-table th { background: color-mix(in srgb, var(--canvas) 82%, var(--surface)); }
.data-table td { border-color: var(--line); }
.data-table tbody tr { transition: background .12s; }
.badge { border: 1px solid color-mix(in srgb, currentColor 9%, transparent); }
.settings-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, .8fr); gap: 16px; align-items: start; }
.check-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.color-field { grid-template-columns: 52px 1fr; align-items: center; }
.color-field label { grid-column: 1 / -1; }
.color-field input[type="color"] { width: 52px; height: 40px; padding: 3px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); }
.color-field code { color: var(--ink-500); }
.feature-list { display: grid; padding: 8px 18px; }
.feature-row { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 12px; min-height: 72px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.feature-row:last-child { border-bottom: 0; }
a.feature-row:hover strong { color: var(--green-700); }
.feature-row > span:nth-child(2) { display: grid; gap: 4px; }
.feature-row small { color: var(--ink-500); line-height: 1.35; }
.feature-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; background: var(--green-50); color: var(--green-800); font-size: 10px; font-weight: 850; }
.feature-list.static .feature-row { cursor: default; }
.modal { background: var(--surface); color: var(--ink-950); }
.modal-footer { display: flex; justify-content: space-between; gap: 12px; padding: 10px 17px; border-top: 1px solid var(--line); }
.command-modal .modal-head { gap: 10px; }
.command-modal .modal-head .input { border: 0; box-shadow: none; font-size: 16px; }
.modal-search-icon { flex: 0 0 auto; color: var(--green-700); }
.command-result { display: grid; grid-template-columns: 38px 1fr auto; align-items: center; min-height: 58px; }
.command-result > span:nth-child(2) { display: grid; gap: 4px; }
.command-result.selected, .command-result:hover { background: var(--green-50); color: var(--green-800); }
.command-symbol { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: color-mix(in srgb, var(--green-100) 65%, var(--surface)); font-weight: 850; }
.command-arrow { color: var(--ink-500); }
.appearance-modal { width: min(440px, calc(100vw - 32px)); }
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 11px; background: var(--canvas); }
.segmented button { min-height: 36px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-500); font-weight: 750; }
.segmented button.active { background: var(--surface); color: var(--green-700); box-shadow: 0 2px 8px rgba(15,23,42,.08); }
.accent-row { display: flex; align-items: center; gap: 12px; }
.accent-row input { width: 58px; height: 42px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.session-modal { width: min(500px, calc(100vw - 32px)); text-align: center; }
.session-visual { display: grid; place-items: center; padding-top: 28px; }
.session-visual span { width: 64px; height: 64px; display: grid; place-items: center; border-radius: 50%; background: #fff7ed; color: #c2410c; border: 8px solid #ffedd5; font-size: 28px; font-weight: 900; }
.session-modal h2 { margin: 8px 0; font-size: 25px; }
.session-modal p { line-height: 1.6; }
.session-actions { margin-top: 22px; justify-content: center; }
.printer-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.printer-card { display: grid; grid-template-columns: auto 48px 1fr; align-items: center; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 13px; cursor: pointer; }
.printer-card:has(input:checked) { border-color: var(--green-500); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green-500) 12%, transparent); background: var(--green-50); }
.printer-card input { accent-color: var(--green-700); }
.printer-card > span:last-child { display: grid; gap: 4px; }
.printer-card small { color: var(--ink-500); }
.printer-symbol { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 12px; background: var(--ink-950); color: #fff; font-size: 9px; font-weight: 850; }
.pdf-frame-card { height: calc(100vh - 170px); min-height: 560px; overflow: hidden; }
.pdf-frame-card iframe { width: 100%; height: 100%; border: 0; }
.pdf-brand-preview { grid-template-columns: minmax(180px, 240px) minmax(0, 1fr); align-items: center; gap: 18px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: color-mix(in srgb, var(--canvas) 58%, var(--surface)); }
.pdf-brand-preview-media { min-height: 102px; display: grid; place-items: center; padding: 9px; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.pdf-brand-preview-media img { display: block; width: 100%; height: 86px; object-fit: contain; }
.pdf-brand-preview-copy { display: grid; gap: 5px; }
.pdf-brand-preview-copy strong { font-size: 16px; }
.product-thumb { width: 52px; height: 52px; display: grid; place-items: center; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: var(--canvas); }
.product-thumb-empty { color: var(--ink-500); font-size: 9px; font-weight: 850; }
.product-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.product-image-card { display: grid; gap: 10px; padding: 11px; border: 1px solid var(--line); border-radius: 13px; background: var(--canvas); }
.product-image-card > img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; border-radius: 9px; background: #fff; }
.product-image-card > div:nth-child(2) { display: grid; gap: 3px; min-width: 0; }
.product-image-card .actions { justify-content: flex-start; }
.upload-inline { display: flex; align-items: end; gap: 12px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.upload-inline .field { flex: 1; }
.config-accordion > summary { cursor: pointer; list-style: none; }
.config-accordion > summary::-webkit-details-marker { display: none; }
.config-accordion > summary::after { content: "+"; font-size: 22px; color: var(--green-700); }
.config-accordion[open] > summary::after { content: "−"; }
.scan-drop { display: grid; place-items: center; gap: 9px; min-height: 260px; padding: 28px; border: 2px dashed var(--line-strong); border-radius: 15px; background: linear-gradient(145deg, var(--canvas), var(--green-50)); text-align: center; cursor: pointer; }
.scan-drop:hover { border-color: var(--green-500); }
.scan-drop input { max-width: 100%; margin-top: 10px; }
.scan-icon { width: 66px; height: 66px; display: grid; place-items: center; border-radius: 20px; background: linear-gradient(135deg, var(--ink-950), var(--green-800)); color: #fff; box-shadow: 0 12px 28px rgba(15,23,42,.2); font-weight: 900; }
.is-processing .scan-drop { opacity: .65; pointer-events: none; }
.scan-review-grid { display: grid; grid-template-columns: minmax(330px, .72fr) minmax(680px, 1.5fr); gap: 16px; align-items: start; }
.scan-original { position: sticky; top: 88px; overflow: hidden; }
.scan-original iframe { width: 100%; height: calc(100vh - 190px); min-height: 610px; border: 0; background: var(--canvas); }
.ai-lines .data-table { min-width: 1220px; }
.ai-lines td { vertical-align: top; padding: 8px; }
.ai-lines .select { min-width: 210px; }
.ai-lines td:nth-child(2) { min-width: 280px; }
.ai-lines .textarea { min-height: 65px; margin-top: 5px; }
.ai-lines td:nth-child(n+3):nth-child(-n+6) .input,
.ai-lines td:nth-child(6) .select { min-width: 94px; }
.scan-total-preview { min-height: 39px; display: flex; align-items: center; padding: 8px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--canvas); line-height: 1.4; }
.import-confirm-card .card-body { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.import-confirm-card p { margin-bottom: 0; }
.density-compact .content { padding-top: 20px; }
.density-compact .card-head { min-height: 56px; padding: 12px 15px; }
.density-compact .card-body { padding: 14px; }
.density-compact .data-table th { padding: 8px 10px; }
.density-compact .data-table td { padding: 8px 10px; }
.density-compact .nav-link { min-height: 35px; padding-block: 6px; }
.sidebar-is-collapsed .sidebar { width: 84px; }
.sidebar-is-collapsed .main-shell { margin-left: 84px; }
.sidebar-is-collapsed .brand { justify-content: center; padding-inline: 0; }
.sidebar-is-collapsed .brand .brand-lockup { display: none; }
.sidebar-is-collapsed .brand .brand-mark { display: block; width: 46px; height: 46px; padding: 3px; object-fit: contain; border-radius: 13px; background: #fff; box-shadow: 0 8px 22px rgba(20,184,166,.18); }
.sidebar-is-collapsed .brand-version,
.sidebar-is-collapsed .nav-label,
.sidebar-is-collapsed .nav-section-label,
.sidebar-is-collapsed .nav-section summary::after { display: none; }
.sidebar-is-collapsed .nav-section summary { min-height: 7px; padding: 3px; }
.sidebar-is-collapsed .nav-link { justify-content: center; padding-inline: 0; }
.sidebar-is-collapsed .nav-icon { width: 20px; height: 20px; flex-basis: 20px; }
.sidebar-is-collapsed .nav-link.active::before { left: -12px; }
.sidebar-is-collapsed .sidebar-footer { display: none; }

html[data-theme="dark"] {
  --ink-950: #e5edf6;
  --ink-700: #c3d0de;
  --ink-500: #8fa2b5;
  --line: #263645;
  --line-strong: #3a4c5d;
  --surface: #111d28;
  --canvas: #0b141d;
  --green-50: #0d2828;
  --green-100: #103b38;
  --shadow: 0 18px 45px rgba(0,0,0,.32);
  color-scheme: dark;
}
html[data-theme="dark"] .topbar { background: rgba(17,29,40,.92); }
html[data-theme="dark"] .input,
html[data-theme="dark"] .select,
html[data-theme="dark"] .textarea,
html[data-theme="dark"] .icon-button,
html[data-theme="dark"] .btn,
html[data-theme="dark"] .user-chip,
html[data-theme="dark"] .kbd { background: #152330; color: var(--ink-950); }
html[data-theme="dark"] .btn-primary { background: linear-gradient(135deg, #0f766e, #0d9488); color: #fff; }
html[data-theme="dark"] .data-table th,
html[data-theme="dark"] .line-editor th { background: #14222e; }
html[data-theme="dark"] .data-table tbody tr:hover { background: #102a2b; }
html[data-theme="dark"] .product-image-card > img { background: #f8fafc; }
html[data-theme="dark"] .flash-error { background: #351b21; border-color: #6b2935; color: #fecdd3; }
html[data-theme="dark"] .flash-success { background: #0b302b; border-color: #155e55; color: #99f6e4; }

@media (prefers-color-scheme: dark) {
  html[data-theme="system"] {
    --ink-950: #e5edf6; --ink-700: #c3d0de; --ink-500: #8fa2b5;
    --line: #263645; --line-strong: #3a4c5d; --surface: #111d28; --canvas: #0b141d;
    --green-50: #0d2828; --green-100: #103b38; --shadow: 0 18px 45px rgba(0,0,0,.32);
    color-scheme: dark;
  }
  html[data-theme="system"] .topbar { background: rgba(17,29,40,.92); }
  html[data-theme="system"] .input, html[data-theme="system"] .select, html[data-theme="system"] .textarea,
  html[data-theme="system"] .icon-button, html[data-theme="system"] .btn, html[data-theme="system"] .user-chip,
  html[data-theme="system"] .kbd { background: #152330; color: var(--ink-950); }
  html[data-theme="system"] .btn-primary { background: linear-gradient(135deg, #0f766e, #0d9488); color: #fff; }
  html[data-theme="system"] .data-table th, html[data-theme="system"] .line-editor th { background: #14222e; }
  html[data-theme="system"] .data-table tbody tr:hover { background: #102a2b; }
  html[data-theme="system"] .product-image-card > img { background: #f8fafc; }
}

@media (max-width: 1180px) {
  .settings-grid { grid-template-columns: 1fr; }
  .scan-review-grid { grid-template-columns: 1fr; }
  .scan-original { position: static; }
  .scan-original iframe { height: 620px; min-height: 0; }
  .check-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .desktop-collapse { display: none; }
  body.sidebar-is-collapsed .sidebar { width: var(--sidebar); }
  body.sidebar-is-collapsed .main-shell { margin-left: 0; }
  body.sidebar-is-collapsed .brand { justify-content: flex-start; padding: 4px 8px 16px; }
  body.sidebar-is-collapsed .brand .brand-lockup { display: block; }
  body.sidebar-is-collapsed .brand .brand-mark { display: none; }
  body.sidebar-is-collapsed .brand-version,
  body.sidebar-is-collapsed .nav-label,
  body.sidebar-is-collapsed .nav-section-label { display: initial; }
  body.sidebar-is-collapsed .nav-section summary { min-height: auto; padding: 10px 12px 6px; }
  body.sidebar-is-collapsed .nav-link { justify-content: flex-start; padding: 9px 11px; }
  body.sidebar-is-collapsed .sidebar-footer { display: block; }
}

@media (max-width: 640px) {
  .topbar { gap: 8px; }
  .search-trigger { flex: 0 0 44px; width: 44px; padding: 0; justify-content: center; }
  .search-trigger .kbd { display: none; }
  .topbar .user-chip { padding: 3px; }
  .topbar .user-chip > div { display: none; }
  .check-grid, .printer-grid { grid-template-columns: 1fr; }
  .upload-inline, .import-confirm-card .card-body { align-items: stretch; flex-direction: column; }
  .scan-original iframe { height: 480px; }
  .pdf-frame-card { height: calc(100vh - 210px); min-height: 440px; }
  .pdf-brand-preview { grid-template-columns: 1fr; }
  .modal-footer { display: none; }
}

/* TECSA Core 7.3 - identidad oficial, PDF reforzado y experiencia adaptable */
.icon-sprite {
  position: absolute !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
  pointer-events: none !important;
}
.app-shell svg,
.mobile-tabbar svg,
.modal svg,
.dashboard-hero svg,
.metric svg,
.quick-action svg {
  width: 20px;
  height: 20px;
  display: block;
  flex: 0 0 auto;
  fill: currentColor;
}
.skip-link {
  position: fixed;
  z-index: 1000;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--ink-950);
  color: #fff;
  font-weight: 800;
  transform: translateY(-160%);
  transition: transform .16s ease;
}
.skip-link:focus { transform: translateY(0); }
.mobile-brand,
.mobile-tabbar { display: none; }

.sidebar { scrollbar-width: thin; scrollbar-color: rgba(153,246,228,.24) transparent; }
.sidebar::-webkit-scrollbar { width: 7px; }
.sidebar::-webkit-scrollbar-thumb { border-radius: 99px; background: rgba(153,246,228,.2); }
.sidebar-nav { padding-bottom: 8px; }
.nav-link { font-weight: 620; }
.nav-section summary { min-height: 36px; border-radius: 9px; }
.nav-section summary:hover { background: rgba(148,163,184,.07); color: #a7c5bf; }
.admin-section { margin-top: 12px; padding-top: 6px; border-top: 1px solid rgba(255,255,255,.07); }
.mobile-backdrop { padding: 0; border: 0; }

.topbar { isolation: isolate; }
.topbar-action-logout { margin: 0; flex: 0 0 auto; }
.content { width: 100%; }
.btn,
.icon-button,
.search-trigger,
.input,
.select { min-height: 42px; }
.btn { padding-inline: 15px; border-radius: 11px; }
.btn-sm { min-height: 34px; padding-inline: 11px; border-radius: 9px; }
.icon-button { width: 42px; height: 42px; border-radius: 12px; }
.card { overflow: clip; box-shadow: 0 3px 12px rgba(6,50,40,.035); }
.card-head { padding: 18px 20px; }
.card-body { padding: 20px; }
.empty { min-height: 130px; display: grid; place-content: center; gap: 5px; }
.empty h3,
.empty p { margin: 0; }
.text-link { display: inline-flex; align-items: center; gap: 7px; color: var(--green-800); font-weight: 800; }
.text-link:hover { color: var(--green-600); }

.dashboard-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 32px;
  min-height: 236px;
  padding: 36px 38px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 24px;
  color: #fff;
  background:
    radial-gradient(circle at 88% 10%, rgba(94,234,212,.25), transparent 28%),
    radial-gradient(circle at 58% 130%, rgba(34,197,94,.16), transparent 42%),
    linear-gradient(135deg, #071f1d 0%, #073d32 48%, #0f766e 100%);
  box-shadow: 0 22px 60px rgba(5,46,38,.2);
}
.dashboard-hero::after {
  content: "";
  position: absolute;
  width: 250px;
  height: 250px;
  top: -150px;
  right: 15%;
  border: 1px solid rgba(153,246,228,.18);
  border-radius: 50%;
  pointer-events: none;
}
.dashboard-hero-copy,
.dashboard-hero-status { position: relative; z-index: 1; }
.dashboard-hero .eyebrow { color: #83ead1; }
.dashboard-hero h1 { max-width: 760px; font-size: clamp(30px, 4vw, 46px); }
.dashboard-hero-copy > p { max-width: 690px; margin: 12px 0 0; color: #c6e6dc; font-size: 15px; line-height: 1.65; }
.dashboard-hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.dashboard-hero-actions .btn { min-height: 44px; }
.dashboard-hero .btn-primary { background: linear-gradient(135deg, #2dd4bf, #22c55e); color: #05251f; box-shadow: 0 9px 26px rgba(45,212,191,.2); }
.dashboard-hero .btn-primary:hover { background: linear-gradient(135deg, #5eead4, #4ade80); color: #05251f; }
.btn-on-dark { border-color: rgba(255,255,255,.22); background: rgba(255,255,255,.08); color: #fff; backdrop-filter: blur(8px); }
.btn-on-dark:hover { border-color: rgba(255,255,255,.42); background: rgba(255,255,255,.14); color: #fff; }
.dashboard-hero-status {
  display: grid;
  min-width: 215px;
  gap: 5px;
  padding: 18px;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 17px;
  background: rgba(4,28,22,.24);
  backdrop-filter: blur(12px);
}
.dashboard-hero-status strong { margin-top: 8px; font-size: 24px; }
.dashboard-hero-status small { color: #aed7ca; }
.live-pill { display: inline-flex; align-items: center; gap: 8px; color: #d5fff2; font-size: 12px; font-weight: 800; }
.live-pill > span { width: 9px; height: 9px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 5px rgba(74,222,128,.14); }

.dashboard-block { margin-top: 28px; }
.revenue-block { padding-top: 2px; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.section-heading h2 { font-size: 21px; }
.section-heading .eyebrow { margin-bottom: 3px; }
.metrics-grid { gap: 14px; }
.metric {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "label icon" "value icon" "detail detail";
  align-content: start;
  min-height: 154px;
  padding: 20px;
  border-top: 0;
}
.metric:hover { border-top-color: transparent; border-color: color-mix(in srgb, var(--green-500) 50%, var(--line)); }
.metric::after { width: 120px; height: 120px; right: -58px; top: -58px; opacity: .5; }
.metric-label { grid-area: label; align-self: center; }
.metric-value { grid-area: value; margin: 11px 0 7px; font-size: clamp(27px, 2.5vw, 34px); }
.metric-detail { grid-area: detail; position: relative; z-index: 1; }
.metric-icon {
  grid-area: icon;
  position: relative;
  z-index: 1;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--green-500) 17%, var(--line));
  border-radius: 13px;
  background: var(--green-50);
  color: var(--green-800);
}
.metric-icon svg { width: 21px; height: 21px; }
.period-grid { gap: 12px; margin-top: 0; }
.period { position: relative; min-height: 112px; padding: 18px; overflow: hidden; }
.period::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: linear-gradient(180deg, var(--green-500), var(--green-700)); }
.period-label { color: var(--ink-500); font-size: 12px; font-weight: 750; }
.period strong { margin-top: 8px; font-size: clamp(20px, 2vw, 25px); letter-spacing: -.03em; }
.period-detail { display: block; margin-top: 4px; color: var(--ink-500); font-size: 12px; }

.migration-banner {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-top: 20px;
  padding: 14px 16px;
  border: 1px solid;
  border-radius: 14px;
}
.migration-banner-success { border-color: #a7e8ce; background: #ecfdf5; color: #0b6652; }
.migration-banner-info { border-color: #bfd5ef; background: #eff6ff; color: #315c96; }
.migration-banner-icon { width: 30px; height: 30px; display: grid; flex: 0 0 auto; place-items: center; border-radius: 10px; color: #fff; font-weight: 900; }
.migration-banner-success .migration-banner-icon { background: #0f766e; }
.migration-banner-info .migration-banner-icon { background: #315c96; }
.dashboard-grid { gap: 18px; margin-top: 20px; }
.relation-item { min-height: 52px; border: 1px solid transparent; transition: border-color .15s, background .15s, transform .15s; }
a.relation-item:hover { border-color: var(--line-strong); background: var(--green-50); transform: translateX(2px); }
.quick-actions { display: grid; gap: 8px; }
.quick-action { display: grid; grid-template-columns: 42px minmax(0,1fr) auto; align-items: center; gap: 12px; min-height: 62px; padding: 9px 10px; border: 1px solid transparent; border-radius: 13px; }
.quick-action:hover { border-color: var(--line); background: var(--green-50); }
.quick-action > span:nth-child(2) { display: grid; gap: 2px; }
.quick-action small { color: var(--ink-500); }
.quick-action b { color: var(--green-700); font-size: 17px; }
.quick-action-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: var(--green-50); color: var(--green-800); }

.flash-warning { background: #fff8e8; border-color: #efcf8e; color: #7c4c00; }
.ai-scan-grid { align-items: start; }
.scan-drop-card,
.print-select-card { overflow: hidden; }
.table-wrap { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.data-table th { height: 43px; }
.data-table td { line-height: 1.45; }
.data-table tbody tr:focus-within { background: var(--green-50); }
.toolbar { gap: 10px; }
.per-page-select { max-width: 160px; }
.form-footer { justify-content: flex-end; border-top: 1px solid var(--line); border-bottom: 0; }
.add-line-button,
.flow-action-form { margin-top: 10px; }
.input::placeholder,
.textarea::placeholder { color: color-mix(in srgb, var(--ink-500) 72%, transparent); }
.field label { font-size: 12.5px; }
.form-actions { background: color-mix(in srgb, var(--canvas) 50%, var(--surface)); }

.auth-mobile-brand { display: none; }
.auth-form .auth-status { display: inline-flex; align-self: flex-start; align-items: center; gap: 7px; margin-bottom: 18px; padding: 6px 10px; border-radius: 999px; background: var(--green-50); color: var(--green-800); font-size: 11px; font-weight: 850; }
.auth-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #22c55e; }
.auth-platform-note { position: relative; z-index: 1; color: #9ed0bc; }
.auth-flashes { margin-top: 18px; }
.install-lead { margin: 12px 0 0; color: #b9d8cb; }
.requirements-list { margin-top: 18px; }
.requirements-note { margin-top: 22px; }
.install-error { margin-top: 18px; }
.install-fields { margin-top: 20px; }
.install-actions { margin-top: 12px; }

@media (max-width: 900px) {
  body.sidebar-open { overflow: hidden; }
  .sidebar { width: min(88vw, 326px); z-index: 70; padding-bottom: calc(18px + env(safe-area-inset-bottom)); box-shadow: 22px 0 70px rgba(4,28,22,.34); }
  .sidebar .nav-link { min-height: 46px; }
  .sidebar .nav-section summary { min-height: 42px; }
  .mobile-backdrop { z-index: 65; background: rgba(3,18,15,.6); backdrop-filter: blur(3px); }
  .topbar { z-index: 55; height: 66px; padding: 0 18px; }
  .content { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .mobile-tabbar {
    position: fixed;
    z-index: 60;
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
    left: 10px;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: end;
    min-height: 66px;
    padding: 6px 7px;
    border: 1px solid color-mix(in srgb, var(--line) 88%, transparent);
    border-radius: 20px;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    box-shadow: 0 18px 48px rgba(4,28,22,.2);
    backdrop-filter: blur(18px);
  }
  .mobile-tab { position: relative; min-width: 0; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 4px 2px; border: 0; border-radius: 13px; background: transparent; color: var(--ink-500); font-size: 10px; font-weight: 750; }
  .mobile-tab svg { width: 20px; height: 20px; }
  .mobile-tab.active { background: var(--green-50); color: var(--green-800); }
  .mobile-tab-primary { width: 58px; min-height: 58px; justify-self: center; margin-top: -15px; border-radius: 18px; background: linear-gradient(135deg, var(--green-700), #0d9488); color: #fff; box-shadow: 0 9px 24px color-mix(in srgb, var(--green-700) 30%, transparent); }
  .mobile-tab-primary:hover { color: #fff; }
  .dashboard-hero { min-height: 218px; padding: 30px; }
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .responsive-table { overflow: visible; padding: 10px; background: color-mix(in srgb, var(--canvas) 55%, var(--surface)); }
  .data-table.responsive-ready { display: block; min-width: 0; }
  .data-table.responsive-ready thead { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
  .data-table.responsive-ready tbody { display: grid; gap: 10px; }
  .data-table.responsive-ready tbody tr { display: block; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); box-shadow: 0 2px 8px rgba(6,50,40,.035); }
  .data-table.responsive-ready td { display: grid; grid-template-columns: minmax(92px, 34%) minmax(0, 1fr); gap: 10px; align-items: center; width: 100%; max-width: none; min-height: 43px; padding: 9px 11px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
  .data-table.responsive-ready td:last-child { border-bottom: 0; }
  .data-table.responsive-ready td::before { content: attr(data-label); color: var(--ink-500); font-size: 10px; font-weight: 850; letter-spacing: .045em; text-transform: uppercase; }
  .data-table.responsive-ready td:not([data-label]) { display: block; }
  .data-table.responsive-ready td:not([data-label])::before,
  .data-table.responsive-ready td[data-label=""]::before { display: none; }
  .data-table.responsive-ready td .btn { justify-self: start; }
  .data-table.responsive-ready .product-thumb { width: 58px; height: 58px; }
}

@media (max-width: 640px) {
  .topbar { gap: 7px; height: 64px; padding: 0 12px; }
  .topbar .desktop-collapse,
  .topbar-action-appearance { display: none; }
  .mobile-brand { display: flex; align-items: center; min-width: 46px; }
  .mobile-brand img { width: 42px; height: 42px; padding: 2px; object-fit: contain; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
  .search-trigger { flex: 0 0 42px; width: 42px; height: 42px; }
  .topbar-spacer { min-width: 0; }
  .topbar .user-chip { width: 42px; height: 42px; padding: 3px; border-radius: 13px; }
  .topbar .avatar { width: 34px; height: 34px; }
  .content { padding: 18px 12px calc(100px + env(safe-area-inset-bottom)); }
  .page-head { gap: 15px; margin-bottom: 18px; }
  .page-head h1 { font-size: 26px; }
  .page-head .actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-head .actions:has(> :only-child) { grid-template-columns: 1fr; }
  .page-head .actions > .btn,
  .page-head .actions > form,
  .page-head .actions > form .btn { width: 100%; }
  .dashboard-hero { grid-template-columns: 1fr; gap: 22px; min-height: 0; padding: 25px 21px; border-radius: 20px; }
  .dashboard-hero h1 { font-size: 30px; }
  .dashboard-hero-copy > p { font-size: 14px; }
  .dashboard-hero-status { grid-template-columns: 1fr auto; min-width: 0; padding: 13px 14px; }
  .dashboard-hero-status strong { grid-column: 2; grid-row: 1; margin: 0; font-size: 17px; }
  .dashboard-hero-status small { grid-column: 1 / -1; }
  .dashboard-block { margin-top: 23px; }
  .section-heading { align-items: center; }
  .section-heading h2 { font-size: 19px; }
  .section-heading .badge { display: none; }
  .metrics-grid,
  .period-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .metric { min-height: 132px; padding: 14px; }
  .metric-icon { width: 36px; height: 36px; border-radius: 11px; }
  .metric-icon svg { width: 18px; height: 18px; }
  .metric-label { font-size: 12px; }
  .metric-value { margin: 8px 0 5px; font-size: 25px; }
  .metric-detail { font-size: 10.5px; line-height: 1.35; }
  .period { min-height: 102px; padding: 14px 12px 13px 16px; }
  .period strong { font-size: 19px; overflow-wrap: anywhere; }
  .period-detail { font-size: 10.5px; }
  .migration-banner { align-items: flex-start; padding: 12px; font-size: 12px; }
  .dashboard-grid { margin-top: 14px; }
  .card-head { min-height: 0; padding: 15px; }
  .card-head h2 { font-size: 17px; }
  .card-body { padding: 15px; }
  .relation-item { align-items: flex-start; }
  .quick-action { padding-inline: 4px; }
  .per-page-select { max-width: none; }
  .pagination { padding-inline: 12px; }
  .page-links { width: 100%; overflow-x: auto; padding-bottom: 3px; }
  .form-actions { position: sticky; bottom: 80px; z-index: 8; padding: 10px; box-shadow: 0 -8px 22px rgba(6,50,40,.07); }
  .form-actions .btn-primary { width: 100%; }
  .auth-page { background: var(--canvas); }
  .auth-shell { min-height: 100dvh; background: var(--surface); }
  .auth-form { justify-content: flex-start; padding: 28px 22px 34px; }
  .auth-mobile-brand { display: block; width: min(230px, 86%); height: auto; margin-bottom: 38px; padding: 5px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
  .auth-form h2 { font-size: 29px; }
  .auth-form form { margin-top: 24px; }
  .auth-form .input { min-height: 47px; }
  .auth-form .btn { min-height: 48px; }
  .install-head { align-items: flex-start; }
  .install-head .badge { white-space: nowrap; }
}

@media (max-width: 390px) {
  .mobile-brand { min-width: 42px; }
  .mobile-brand img { width: 40px; height: 40px; }
  .topbar .user-chip { display: none; }
  .dashboard-hero-actions { display: grid; }
  .dashboard-hero-actions .btn { width: 100%; }
  .metric-value { font-size: 23px; }
  .period strong { font-size: 17px; }
  .mobile-tabbar { right: 6px; left: 6px; }
}

html[data-theme="dark"] .dashboard-hero,
html[data-theme="system"] .dashboard-hero { color: #fff; }
html[data-theme="dark"] .migration-banner-success { border-color: #155e55; background: #0b302b; color: #99f6e4; }
html[data-theme="dark"] .migration-banner-info { border-color: #294f79; background: #152942; color: #bfdbfe; }
html[data-theme="dark"] .flash-warning { border-color: #72531d; background: #332713; color: #fde68a; }
html[data-theme="dark"] .mobile-tabbar { background: rgba(17,29,40,.94); }

@media (prefers-color-scheme: dark) {
  html[data-theme="system"] .migration-banner-success { border-color: #155e55; background: #0b302b; color: #99f6e4; }
  html[data-theme="system"] .migration-banner-info { border-color: #294f79; background: #152942; color: #bfdbfe; }
  html[data-theme="system"] .flash-warning { border-color: #72531d; background: #332713; color: #fde68a; }
  html[data-theme="system"] .mobile-tabbar { background: rgba(17,29,40,.94); }
}

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