/* Shared surfaces and accessible color pairs for all screens. */
:root {
  color-scheme: light;
  --bg: #fcfaf7;
  --surface: #fff;
  --surface-soft: #f5f2ed;
  --surface-hover: #f0eae3;
  --text: #302e2b;
  --text-secondary: #655f58;
  --muted: #746d65;
  --line: #e9e2d9;
  --primary: #a2472c;
  --primary-hover: #863820;
  --primary-soft: #faeae1;
  --on-primary: #fff;
  --forest: #214c42;
  --forest-soft: #eaf1e8;
  --on-forest: #f8fcf5;
  --green: #a2472c;
  --positive: #42613b;
  --positive-bg: #eaf2e5;
  --warning: #805615;
  --warning-bg: #fff0ce;
  --danger: #a93c35;
  --danger-bg: #fce9e6;
  --shadow: 0 4px 22px #44351c06;
  --radius: 16px;
  --white: var(--surface);
  color: var(--text);
  background: var(--bg);
}
:root[data-accent='forest'] {
  --primary: #245548;
  --primary-hover: #183d33;
  --primary-soft: #e6f0e9;
  --green: #245548;
}
:root[data-accent='plum'] {
  --primary: #754365;
  --primary-hover: #5c304e;
  --primary-soft: #f3e8ef;
  --green: #754365;
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #111b19;
  --surface: #192622;
  --surface-soft: #1f2e29;
  --surface-hover: #293b34;
  --text: #f1f2e9;
  --text-secondary: #c4cec4;
  --muted: #a4b4a9;
  --line: #34463d;
  --primary: #f0ae8d;
  --primary-hover: #ffc2a4;
  --primary-soft: #3b2c25;
  --on-primary: #2b1a11;
  --green: #f0ae8d;
  --forest: #244e40;
  --forest-soft: #203b2d;
  --on-forest: #f0f6e9;
  --positive: #c1daa5;
  --positive-bg: #2b402c;
  --warning: #f3d18a;
  --warning-bg: #42371e;
  --danger: #ffb3a8;
  --danger-bg: #422b27;
  --shadow: 0 5px 24px #00000014;
}
:root[data-theme='dark'][data-accent='forest'] {
  --primary: #b6d5b3;
  --primary-hover: #c9e4c4;
  --primary-soft: #293e30;
  --green: #b6d5b3;
  --on-primary: #17271b;
}
:root[data-theme='dark'][data-accent='plum'] {
  --primary: #e5b1d0;
  --primary-hover: #f2c4e0;
  --primary-soft: #3b2c37;
  --green: #e5b1d0;
  --on-primary: #2b1925;
}
:root[data-text-size='large'] {
  font-size: 18px;
}
body {
  color: var(--text);
  background: var(--bg);
}
h1,
h2,
h3 {
  color: var(--text);
}
a {
  color: var(--primary);
}
button,
.button {
  color: var(--text-secondary);
  border-color: var(--line);
  background: var(--surface);
  border-radius: 10px;
  min-height: 44px;
}
button:hover,
.button:hover {
  background: var(--surface-hover);
}
button:focus-visible,
a:focus-visible {
  outline-color: var(--primary);
}
.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
  box-shadow: 0 3px 9px #7b3d2112;
}
.primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}
.secondary {
  background: var(--surface);
  border-color: var(--line);
  color: var(--text);
}
.text-button {
  color: var(--primary);
  border: 0;
  background: transparent;
}
.danger {
  color: var(--danger);
}
.sidebar {
  background: var(--surface);
  border-color: var(--line);
  padding-top: 30px;
}
.brand {
  color: var(--text);
  padding-bottom: 34px;
}
.brand-mark {
  background: var(--forest);
  color: #d7e5bd;
  border-radius: 13px;
}
.brand small {
  color: var(--muted);
  font-size: 0.625rem;
  letter-spacing: 0.9px;
}
.brand {
  font-size: 1.25rem;
  letter-spacing: -0.65px;
  gap: 9px;
  padding-left: 5px;
  padding-right: 5px;
}
.brand > span:last-child {
  white-space: nowrap;
}
.brand small {
  text-transform: none;
  letter-spacing: 0.25px;
  font-weight: 450;
  font-size: 0.7rem;
}
.nav-label {
  font-size: 0.65rem;
  color: var(--muted);
  letter-spacing: 1.25px;
}
.nav-item {
  font-size: 0.9rem;
  color: var(--text-secondary);
  padding: 13px 14px;
  border-radius: 11px;
  margin-bottom: 7px;
}
.nav-item.active {
  background: var(--primary-soft);
  color: var(--primary);
}
.nav-item:hover {
  background: var(--surface-soft);
}
.nav-count {
  background: var(--surface);
  color: var(--primary);
}
.offline-card {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--text-secondary);
  font-size: 0.75rem;
  border-radius: 12px;
}
.offline-card small,
.profile small {
  color: var(--muted);
  font-size: 0.7rem;
}
.profile {
  border-color: var(--line);
  color: var(--text);
}
.avatar,
.avatar.small {
  background: var(--primary-soft);
  color: var(--primary);
}
.topbar {
  background: var(--bg);
  border-color: var(--line);
  height: 76px;
}
.breadcrumb {
  color: var(--muted);
  font-size: 0.875rem;
}
.breadcrumb span {
  color: var(--muted);
  opacity: 0.65;
}
.topbar-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}
.theme-toggle {
  width: 40px;
  height: 40px;
  min-height: 40px;
  background: var(--surface);
  color: var(--text-secondary);
  padding: 9px;
  border-radius: 50%;
}
.sync-status {
  color: var(--text-secondary);
  font-size: 0.75rem;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 8px 12px;
  border-radius: 25px;
  min-height: 36px;
}
.sync-status.offline {
  color: var(--warning);
  background: var(--warning-bg);
  border-color: transparent;
}
main {
  padding-top: 38px;
}
.eyebrow {
  color: var(--primary);
  font-size: 0.7rem;
  letter-spacing: 1.8px;
}
h1 {
  font-size: 2.1rem;
  font-weight: 600;
  letter-spacing: -1.1px;
}
.hello {
  color: var(--primary);
  font-size: 1.8rem;
}
.page-heading p {
  color: var(--muted);
  font-size: 0.9375rem;
}
.page-heading {
  margin-bottom: 30px;
}
.cycle-banner {
  background: linear-gradient(115deg, var(--forest), #32694e);
  border: 1px solid #ffffff12;
  border-radius: var(--radius);
  padding: 27px 28px;
  box-shadow: var(--shadow);
  color: var(--on-forest);
}
.cycle-banner:after {
  border-color: #d9e9c82e;
  right: 110px;
  width: 330px;
  height: 330px;
  box-shadow:
    0 0 0 35px #d9e9c808,
    0 0 0 70px #d9e9c805;
}
.cycle-banner h2 {
  color: var(--on-forest);
  font-size: 1.75rem;
}
.cycle-banner h2 span {
  color: #d0e0c5;
}
.cycle-banner p {
  color: #d8e5d1;
  font-size: 0.8rem;
}
.cycle-banner .eyebrow {
  color: #d6e4b9;
  font-size: 0.7rem;
}
.banner-icon {
  background: #ffffff12;
  color: #d6e4b9;
}
.light {
  background: #ffffff14;
  color: #fff;
  border: 1px solid #ffffff50;
}
.light:hover {
  background: #ffffff25;
}
.section-label > span {
  color: var(--muted);
  font-size: 0.8rem;
}
.section-label h2 {
  font-size: 1.08rem;
}
.stat,
.panel {
  background: var(--surface);
  border-color: var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.stat {
  padding: 22px;
  border-top: 3px solid var(--line);
}
.stat:first-child {
  border-top-color: var(--primary);
}
.stat:nth-child(3) {
  border-top-color: #c9a35c;
}
.stat:nth-child(4) {
  border-top-color: #9caca0;
}
.stat-label {
  color: var(--text-secondary);
  font-size: 0.875rem;
}
.stat-label .icon {
  color: var(--muted);
}
.stat strong {
  color: var(--text);
  font-size: 1.8rem;
  margin: 17px 0 10px;
}
.stat small {
  font-size: 0.75rem;
  color: var(--muted);
}
.stat.profit {
  background: var(--positive-bg);
  border-color: var(--line);
  border-top-color: var(--positive);
}
.stat.profit strong {
  color: var(--positive);
}
.mini-stats {
  padding: 26px 0 22px;
}
.mini-stats > div {
  border-color: var(--line);
  gap: 8px;
}
.mini-stats .icon,
.mini-stats strong {
  color: var(--primary);
}
.mini-stats span {
  color: var(--muted);
  font-size: 0.75rem;
}
.panel-heading h2 {
  color: var(--text);
  font-size: 1.05rem;
}
.panel-heading a {
  font-size: 0.875rem;
  color: var(--primary);
}
th {
  background: var(--surface-soft);
  color: var(--text-secondary);
  border-color: var(--line);
  font-size: 0.8rem;
}
td {
  color: var(--text-secondary);
  border-color: var(--line);
  font-size: 0.875rem;
}
td strong {
  color: var(--text);
}
tbody tr:hover {
  background: var(--surface-soft);
}
.block {
  color: var(--muted);
  font-size: 0.75rem;
}
.person {
  color: var(--text);
}
.shortcut {
  background: transparent;
  color: var(--text);
  border: 0;
  padding: 16px 22px;
}
.shortcut:hover {
  background: var(--surface-soft);
}
.shortcut strong {
  font-size: 0.9rem;
}
.shortcut small {
  color: var(--muted);
  font-size: 0.8rem;
}
.shortcut-icon {
  background: var(--primary-soft);
  color: var(--primary);
  width: 40px;
  height: 40px;
  border-radius: 12px;
}
.badge {
  font-size: 0.75rem;
  border-radius: 7px;
  padding: 6px 10px;
}
.badge.neutral,
.badge:not(.green):not(.amber) {
  background: var(--surface-soft);
  color: var(--text-secondary);
}
.badge.green {
  background: var(--positive-bg);
  color: var(--positive);
}
.badge.amber {
  background: var(--warning-bg);
  color: var(--warning);
}
.cycle-banner .badge.green {
  background: #d2e4b929;
  color: #e2efcd;
}
.gift-strip {
  background: var(--primary-soft);
  border-color: var(--line);
  border-radius: var(--radius);
  padding: 23px 26px;
}
.gift-strip > .icon,
.gift-strip h3 {
  color: var(--primary);
}
.gift-strip h3 {
  font-size: 0.95rem;
}
.gift-strip p {
  color: var(--text-secondary);
  font-size: 0.8rem;
}
.gift-strip .button {
  background: var(--surface);
  font-size: 0.875rem;
}
.gift-art {
  background: var(--surface-soft);
  color: var(--primary);
}
.gift-content > small,
.gift-content p {
  color: var(--muted);
}
.gift-content h3 {
  color: var(--text);
}
.gift-content p {
  font-size: 0.875rem;
}
.toolbar > span,
.cycle-picker,
.cycle-card p,
.muted,
.hint,
.detail-intro p,
.history-row small,
.line-subtotal small {
  color: var(--muted);
}
.toolbar > span,
.hint {
  font-size: 0.875rem;
}
.cycle-picker {
  font-size: 0.875rem;
}
.search {
  background: var(--surface);
  border-color: var(--line);
  color: var(--muted);
  border-radius: 11px;
}
input,
select,
textarea {
  color: var(--text);
  background-color: var(--surface);
  border-color: var(--line);
  font-size: 1rem;
  border-radius: 9px;
}
input::placeholder {
  color: var(--muted);
}
input:focus,
select:focus,
textarea:focus {
  outline-color: var(--primary);
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath d='m3 5 4 4 4-4' fill='none' stroke='%23808e82' stroke-width='1.5'/%3E%3C/svg%3E");
}
.empty {
  color: var(--muted);
}
.empty h3 {
  color: var(--text);
}
.empty > .icon {
  color: var(--primary);
  background: var(--primary-soft);
}
.empty p {
  font-size: 0.9rem;
}
.cycle-card h2 span {
  color: var(--muted);
}
.cycle-numbers small {
  color: var(--muted);
}
.cycle-numbers strong {
  color: var(--text);
}
.settings-card p,
.settings-card ol {
  color: var(--text-secondary);
  font-size: 0.9375rem;
}
.setting-icon {
  background: var(--primary-soft);
  color: var(--primary);
}
.notice {
  background: var(--surface-soft);
  color: var(--text-secondary);
  border: 1px solid var(--line);
}
.summary > div,
.history-row,
.payment-row {
  border-color: var(--line);
}
.summary dt {
  color: var(--text-secondary);
}
.summary dd {
  color: var(--text);
}
.summary > div:last-child dd {
  color: var(--primary);
}
dialog,
.modal-heading,
.modal-footer {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line);
}
dialog::backdrop {
  background: #071a15a0;
}
.modal-body label {
  color: var(--text-secondary);
  font-size: 0.875rem;
}
.optional {
  color: var(--muted);
}
.product-line {
  background: var(--surface-soft);
  border-color: var(--line);
}
.order-summary {
  background: var(--positive-bg);
  color: var(--positive);
}
.line-subtotal strong {
  color: var(--text);
}
.remove-line {
  color: var(--muted);
  background: transparent;
}
.inline-help {
  color: var(--muted);
}
#form-error {
  color: var(--danger);
}
#toast {
  background: var(--text);
  color: var(--bg);
}
footer {
  color: var(--muted);
  font-size: 0.75rem;
}
.mobile-nav {
  background: var(--surface);
  border-color: var(--line);
}
.mobile-nav a {
  color: var(--muted);
  font-size: 0.75rem;
}
.mobile-nav a.active {
  color: var(--primary);
}
.mobile-nav a.active .icon {
  background: var(--primary-soft);
  box-shadow: 0 0 0 7px var(--primary-soft);
}
.config-layout {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}
.config-nav {
  display: grid;
  gap: 6px;
  position: sticky;
  top: 24px;
}
.config-nav a {
  display: flex;
  gap: 10px;
  align-items: center;
  text-decoration: none;
  padding: 13px 15px;
  border-radius: 11px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}
.config-nav a[aria-current='page'] {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}
.config-nav .icon {
  width: 18px;
  height: 18px;
}
.config-content {
  display: grid;
  gap: 22px;
  min-width: 0;
}
.config-content > .panel {
  padding: 28px;
}
.config-section-heading {
  display: flex;
  gap: 13px;
  align-items: start;
  margin-bottom: 26px;
}
.config-section-heading > .setting-icon {
  margin: 0;
  flex-shrink: 0;
}
.config-section-heading h2 {
  font-size: 1.15rem;
  margin: 0 0 6px;
}
.config-section-heading p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.6;
}
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 21px 0;
  border-top: 1px solid var(--line);
}
.setting-row > div {
  flex: 1;
}
.setting-row strong {
  font-size: 0.9375rem;
  font-weight: 600;
  display: block;
}
.setting-row p {
  font-size: 0.875rem;
  color: var(--muted);
  margin: 6px 0 0;
  max-width: 440px;
  line-height: 1.6;
}
.setting-row select {
  width: auto;
  min-width: 175px;
  max-width: 220px;
}
.setting-row .toggle {
  flex-shrink: 0;
}
.theme-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 13px;
  margin: 20px 0 25px;
}
.theme-option {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: left;
  border: 2px solid var(--line);
  padding: 9px;
  border-radius: 13px;
  gap: 13px;
  color: var(--text);
}
.theme-option[aria-pressed='true'] {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.theme-option > span:last-child {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 0.875rem;
  padding: 0 3px 5px;
}
.theme-option > span:last-child > .icon {
  width: 16px;
  height: 16px;
  margin-left: auto;
  color: var(--primary);
}
.theme-preview {
  height: 95px;
  display: grid;
  grid-template-columns: 25% 1fr;
  gap: 9px;
  padding: 10px;
  border-radius: 7px;
  overflow: hidden;
  border: 1px solid #0000000c;
}
.theme-preview i {
  display: block;
  border-radius: 3px;
  background: #e7ded2;
}
.theme-preview > i {
  height: 100%;
  background: #e9e0d5;
}
.theme-preview b {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  align-content: start;
}
.theme-preview b i:first-child {
  grid-column: 1/-1;
  background: #3e6952;
  height: 25px;
}
.theme-preview b i {
  height: 29px;
  background: #fff;
}
.preview-light {
  background: #f4f1eb;
}
.preview-dark {
  background: #111b19;
}
.preview-dark > i {
  background: #2b3b33;
}
.preview-dark b i:not(:first-child) {
  background: #30453a;
}
.preview-system {
  background: linear-gradient(90deg, #f4f1eb 50%, #111b19 50%);
}
.preview-system > i {
  background: #e9e0d5;
}
.preview-system b i:last-child {
  background: #30453a;
}
.accent-options {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.accent-option {
  border: 2px solid var(--line);
  font-size: 0.875rem;
  padding: 9px 12px;
}
.accent-option[aria-pressed='true'] {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}
.swatch {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  display: inline-block;
  border: 1px solid #00000015;
  background: #a2472c;
}
.swatch.forest {
  background: #245548;
}
.swatch.plum {
  background: #754365;
}
.toggle {
  width: 48px;
  height: 28px;
  min-height: 28px;
  border: 0;
  padding: 3px;
  border-radius: 20px;
  background: var(--muted);
  display: flex;
  justify-content: flex-start;
}
.toggle::before {
  content: '';
  height: 22px;
  width: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px #0002;
}
.toggle[aria-checked='true'] {
  background: var(--primary);
  justify-content: flex-end;
}
.config-form label {
  display: block;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
}
.config-form input,
.config-form select {
  margin-top: 9px;
}
.config-form .form-grid {
  max-width: 650px;
}
.save-note {
  color: var(--muted);
  font-size: 0.8rem;
  margin: 17px 0 0;
  display: flex;
  gap: 7px;
  align-items: center;
}
.save-note .icon {
  height: 16px;
  width: 16px;
}
.database-status {
  padding: 20px;
  border-radius: 12px;
  background: var(--positive-bg);
  color: var(--positive);
  display: flex;
  gap: 12px;
  align-items: start;
}
.database-status h3 {
  color: var(--positive);
  margin: 0 0 6px;
}
.database-status p {
  font-size: 0.875rem;
  line-height: 1.7;
  margin: 0;
}
.database-status > .icon {
  margin-top: 2px;
}
.data-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 22px 0;
}
.data-facts > div {
  padding: 17px;
  border-radius: 11px;
  background: var(--surface-soft);
}
.data-facts small {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}
.data-facts strong {
  display: block;
  color: var(--text);
  font-size: 0.9375rem;
  margin-top: 9px;
}
.info-list {
  padding: 0;
  list-style: none;
  margin: 20px 0;
}
.info-list li {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text-secondary);
}
.info-list strong {
  color: var(--text);
}
.config-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
}
.config-actions button {
  font-size: 0.875rem;
}
.about-logo {
  display: flex;
  gap: 15px;
  align-items: center;
  margin-bottom: 22px;
}
.about-logo .brand-mark {
  width: 52px;
  height: 56px;
}
.about-logo h2 {
  font-size: 1.3rem;
}
.about-logo p {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 7px 0 0;
}
.config-help {
  padding: 18px 20px;
  background: var(--primary-soft);
  border-radius: 12px;
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.7;
  margin-top: 20px;
}
:root[data-density='compact'] td {
  padding-top: 10px;
  padding-bottom: 10px;
}
:root[data-density='compact'] th {
  padding-top: 10px;
  padding-bottom: 10px;
}
@media (max-width: 1200px) {
  .stat {
    padding: 18px 15px;
  }
  .stat strong {
    font-size: 1.5rem;
  }
  .stat-label {
    font-size: 0.8rem;
  }
  .config-layout {
    grid-template-columns: 160px minmax(0, 1fr);
    gap: 20px;
  }
  .config-content > .panel {
    padding: 23px;
  }
  .brand small {
    font-size: 0.55rem;
  }
}
@media (max-width: 900px) {
  .config-layout {
    grid-template-columns: 1fr;
  }
  .config-nav {
    display: flex;
    overflow: auto;
    position: static;
    gap: 7px;
    padding-bottom: 3px;
  }
  .config-nav a {
    white-space: nowrap;
    font-size: 0.875rem;
    padding: 11px 13px;
  }
  .stat-label {
    font-size: 0.875rem;
  }
  .brand small {
    font-size: 0.48rem;
  }
  .theme-preview {
    height: 85px;
  }
  .setting-row {
    align-items: start;
    flex-wrap: wrap;
  }
  .setting-row select {
    min-width: 150px;
  }
  .data-facts {
    grid-template-columns: 1fr;
  }
  .data-facts > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }
  .data-facts strong {
    margin: 0;
  }
  .topbar-actions {
    gap: 7px;
  }
}
@media (max-width: 650px) {
  .topbar {
    height: 64px;
    padding: 0 16px;
  }
  .breadcrumb {
    font-size: 0.75rem;
  }
  .breadcrumb > span {
    margin: 0 5px;
  }
  .topbar-actions {
    gap: 7px;
  }
  .sync-status {
    font-size: 0.65rem;
    padding: 7px 9px;
    max-width: 175px;
  }
  .theme-toggle {
    width: 34px;
    height: 34px;
    min-height: 34px;
    padding: 7px;
  }
  .theme-toggle .icon {
    width: 17px;
    height: 17px;
  }
  main {
    padding: 27px 18px 18px;
  }
  h1 {
    font-size: 1.95rem;
  }
  .page-heading {
    margin-bottom: 25px;
    gap: 20px;
  }
  .eyebrow {
    font-size: 0.64rem;
  }
  .page-heading p {
    font-size: 0.9rem;
  }
  .cycle-banner {
    padding: 22px 19px;
    border-radius: 15px;
  }
  .cycle-banner h2 {
    font-size: 1.55rem;
  }
  .cycle-banner .eyebrow {
    font-size: 0.65rem;
  }
  .cycle-banner p {
    font-size: 0.75rem;
  }
  .stat {
    padding: 17px 13px;
  }
  .stat strong {
    font-size: 1.4rem;
  }
  .stat-label {
    font-size: 0.8rem;
  }
  .stat small {
    font-size: 0.75rem;
  }
  .mini-stats span {
    font-size: 0.7rem;
  }
  .panel-heading a {
    font-size: 0.8rem;
  }
  .gift-strip {
    padding: 20px 17px;
  }
  .gift-strip h3 {
    font-size: 0.9rem;
  }
  .gift-strip p {
    font-size: 0.8rem;
  }
  .gift-strip .button {
    font-size: 0.8rem;
  }
  .config-layout {
    gap: 21px;
  }
  .config-nav {
    margin: 0 -18px;
    padding: 0 18px 5px;
    scrollbar-width: thin;
  }
  .config-nav a {
    padding: 11px 13px;
    font-size: 0.85rem;
  }
  .config-content > .panel {
    padding: 21px 18px;
  }
  .config-section-heading {
    gap: 11px;
    margin-bottom: 20px;
  }
  .config-section-heading h2 {
    font-size: 1.05rem;
  }
  .config-section-heading p {
    font-size: 0.85rem;
  }
  .theme-options {
    gap: 8px;
  }
  .theme-option {
    padding: 6px;
    gap: 10px;
  }
  .theme-option > span:last-child {
    font-size: 0.8rem;
    padding: 0 1px 4px;
    gap: 5px;
  }
  .theme-preview {
    height: 75px;
    gap: 5px;
    padding: 7px;
  }
  .theme-preview b {
    gap: 4px;
  }
  .theme-preview b i:first-child {
    height: 20px;
  }
  .theme-preview b i {
    height: 20px;
  }
  .theme-option > span:last-child > .icon {
    width: 13px;
  }
  .setting-row {
    gap: 14px;
    padding: 19px 0;
  }
  .setting-row > div {
    min-width: 180px;
  }
  .setting-row strong {
    font-size: 0.9rem;
  }
  .setting-row p {
    font-size: 0.85rem;
  }
  .setting-row select {
    width: 100%;
    max-width: none;
  }
  .accent-options {
    gap: 7px;
  }
  .accent-option {
    font-size: 0.8rem;
    padding: 9px 10px;
  }
  .data-facts {
    gap: 9px;
  }
  .data-facts > div {
    padding: 15px;
  }
  .database-status {
    padding: 16px;
    gap: 9px;
  }
  .database-status h3 {
    font-size: 0.95rem;
  }
  .database-status p {
    font-size: 0.85rem;
  }
  .config-form .form-grid {
    grid-template-columns: 1fr;
  }
  .config-actions button {
    font-size: 0.85rem;
  }
  .mobile-nav a {
    font-size: 0.7rem;
  }
  .config-help {
    padding: 16px;
    font-size: 0.85rem;
  }
  .panel-heading h2 {
    font-size: 1rem;
  }
  footer {
    font-size: 0.7rem;
    padding-bottom: 105px;
  }
}
@media (min-width: 651px) and (max-width: 900px) {
  .brand {
    font-size: 1.03rem;
    gap: 6px;
    padding-inline: 0;
  }
  .brand small {
    font-size: 0.57rem;
  }
}
/* Filas clicables, avisos de error y contacto */
tr.row-link {
  cursor: pointer;
}
tr.row-link:hover td {
  background: var(--surface-soft);
}
tr.row-link:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}
#toast.error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger);
}
.sync-error {
  color: var(--danger);
}
.contact-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.contact-actions .button {
  text-decoration: none;
}
.mobile-brand {
  display: none;
}
.toolbar > span:last-child {
  margin-left: auto;
}
@media (max-width: 650px) {
  .breadcrumb {
    display: none;
  }
  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 9px;
    text-decoration: none;
    color: var(--text);
    font-weight: 650;
    font-size: 1rem;
    letter-spacing: -0.4px;
    white-space: nowrap;
  }
  .mobile-brand .brand-mark {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    flex-shrink: 0;
  }
  .mobile-brand .brand-mark .icon {
    width: 24px;
    height: 24px;
  }
  .toolbar > span:last-child {
    margin-left: 0;
    width: 100%;
  }
}
/* Las tablas se leen como tarjetas en celulares y tablets */
@media (max-width: 1024px) {
  .table-wrap {
    overflow: visible;
  }
  .table-wrap table,
  .table-wrap tbody,
  .table-wrap tr,
  .table-wrap td {
    display: block;
    width: 100%;
  }
  .table-wrap thead {
    display: none;
  }
  .table-wrap table {
    white-space: normal;
  }
  .table-wrap tbody tr {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
  }
  .table-wrap tbody tr:last-child {
    border-bottom: 0;
  }
  .table-wrap tbody td,
  .table-wrap tbody tr:last-child td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    padding: 4px 0;
    border: 0;
    background: transparent;
    text-align: right;
  }
  .table-wrap tbody td > small.block {
    display: inline;
    margin-left: 6px;
  }
  .table-wrap tbody td[data-label]::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.78rem;
    text-align: left;
    flex-shrink: 0;
  }
  .table-wrap tbody td:first-child {
    padding-bottom: 8px;
    text-align: left;
    font-weight: 600;
    color: var(--text);
  }
  .table-wrap tbody td:first-child::before {
    display: none;
  }
  .table-wrap tbody td:last-child:not([data-label]),
  .table-wrap tbody td[data-label=''] {
    justify-content: flex-end;
  }
  .hide-mobile,
  .table-wrap tbody td.row-actions:not(:has(> :not(.hide-mobile))) {
    display: none !important;
  }
  .table-wrap tbody td.row-actions {
    justify-content: flex-end;
    padding-top: 10px;
  }
  .table-wrap tbody tr.row-link {
    position: relative;
    padding-right: 34px;
  }
  .table-wrap tbody tr.row-link::after {
    content: '›';
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.4rem;
    color: var(--muted);
  }
  tr.row-link:hover td {
    background: transparent;
  }
}
@media (max-width: 1024px) {
  .table-wrap tbody td > span:not(.person):not(.badge) {
    display: block;
    text-align: right;
  }
  .table-wrap tbody td > span > small.block {
    display: block;
    margin: 3px 0 0;
  }
}
@media (max-width: 650px) {
  .sync-status {
    max-width: 150px;
  }
  .sync-status span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }
  .gift-strip {
    flex-wrap: wrap;
    gap: 12px 14px;
  }
  .gift-strip > div {
    flex: 1 1 200px;
  }
  .gift-strip .button {
    width: 100%;
    text-align: center;
    justify-content: center;
  }
}
/* Acciones rápidas en filas */
.row-actions {
  text-align: right;
}
td.row-actions {
  white-space: nowrap;
}
td.row-actions > * + * {
  margin-left: 6px;
}
.button.whatsapp {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}
.button.whatsapp .icon {
  width: 16px;
  height: 16px;
}
.panel-links {
  display: flex;
  gap: 16px;
}
/* Recordatorio de copia de seguridad */
.backup-reminder {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  margin-bottom: 24px;
  border-radius: 14px;
  background: var(--warning-bg);
  color: var(--text);
  border: 1px solid var(--line);
}
.backup-reminder > .icon {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  color: var(--warning);
}
.backup-reminder > div:not(.backup-actions) {
  flex: 1;
}
.backup-reminder h3 {
  margin: 0 0 4px;
  font-size: 0.95rem;
}
.backup-reminder p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.55;
}
.backup-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}
/* Confirmaciones propias */
.confirm-dialog {
  width: min(420px, calc(100% - 32px));
  padding: 24px;
  border-radius: 16px;
}
.confirm-dialog p {
  margin: 0 0 22px;
  line-height: 1.6;
  font-size: 0.95rem;
}
.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.danger-button {
  background: var(--danger);
  color: var(--bg);
  border-color: transparent;
}
/* Conflictos, regalos y formularios */
.conflict-list {
  margin: 0 0 16px;
  padding-left: 20px;
  line-height: 1.7;
  font-size: 0.9rem;
}
.gift-detail-image {
  display: block;
  width: 100%;
  max-height: 240px;
  object-fit: contain;
  border-radius: 12px;
  background: var(--surface-soft);
  margin-bottom: 14px;
}
.field-hint {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.78rem;
}
@media (max-width: 650px) {
  .backup-reminder {
    flex-wrap: wrap;
    padding: 16px;
  }
  .backup-reminder > div:not(.backup-actions) {
    flex: 1 1 200px;
  }
  .backup-actions {
    width: 100%;
  }
  .backup-actions .primary {
    flex: 1;
  }
  .confirm-actions button {
    flex: 1;
  }
}
/* Tablets: tarjetas en dos columnas; pantallas medianas: las acciones bajan de renglón */
@media (min-width: 651px) and (max-width: 1024px) {
  .table-wrap tbody {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .table-wrap tbody tr,
  .table-wrap tbody tr:last-child {
    border-bottom: 1px solid var(--line);
  }
  .table-wrap tbody tr:nth-child(odd) {
    border-right: 1px solid var(--line);
  }
}
@media (min-width: 1025px) and (max-width: 1180px) {
  td.row-actions {
    white-space: normal;
  }
  td.row-actions > * {
    margin: 3px 0 3px 6px;
  }
}
/* Productos sin stock en Natura */
tr.out-of-stock td:not(.row-actions) {
  color: var(--muted);
}
tr.out-of-stock td:not(.row-actions) strong,
tr.out-of-stock td:nth-child(3),
tr.out-of-stock td:nth-child(4) {
  text-decoration: line-through;
}
.danger-badge,
.badge.danger-badge {
  background: var(--danger-bg);
  color: var(--danger);
}
.stock-toggle[aria-pressed='true'] {
  border-color: var(--danger);
}
.product-line.out-of-stock {
  opacity: 0.7;
}
.stock-note {
  margin: 0 0 10px;
  font-size: 0.8rem;
  color: var(--muted);
}
/* Cierre del pedido: importe a pagar y ganancia del ciclo */
.order-close {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  margin-bottom: 18px;
  border-radius: 14px;
  background: var(--primary-soft);
  border: 1px solid var(--line);
}
.order-close.done {
  background: var(--positive-bg);
}
.order-close > .icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  color: var(--primary);
}
.order-close.done > .icon {
  color: var(--positive);
}
.order-close > div {
  flex: 1;
}
.order-close h3 {
  margin: 0 0 4px;
  font-size: 0.95rem;
}
.order-close p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
@media (max-width: 650px) {
  .order-close {
    flex-wrap: wrap;
  }
  .order-close > div {
    flex: 1 1 200px;
  }
  .order-close > button {
    width: 100%;
  }
}
.brand-mark .logo {
  width: 30px;
  height: 30px;
}
/* Estadísticas */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: 20px;
}
.chart {
  padding: 22px;
}
.chart h2 {
  font-size: 1rem;
  margin: 0 0 18px;
}
.chart-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
.chart-figure {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.chart-figure small {
  color: var(--muted);
  font-weight: 400;
}
.col-chart {
  display: flex;
  align-items: stretch;
  gap: 6px;
  height: 190px;
  border-bottom: 1px solid var(--line);
  position: relative;
}
.col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  outline: none;
}
.col-plot {
  flex: 1;
  position: relative;
}
.col-plot::before {
  content: '';
  position: absolute;
  left: -3px;
  right: -3px;
  top: calc(100% - var(--zero, 100%));
  border-top: 1px solid var(--line);
}
.col-bar {
  position: absolute;
  left: 50%;
  width: min(64%, 56px);
  transform: translateX(-50%);
  bottom: calc(100% - var(--zero, 100%));
  height: var(--h, 0%);
  min-height: 2px;
  background: var(--primary);
  border-radius: 4px 4px 0 0;
}
.col-bar.neg {
  bottom: auto;
  top: var(--zero, 100%);
  border-radius: 0 0 4px 4px;
  opacity: 0.55;
}
.col-tip {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translate(-50%, -110%);
  background: var(--text);
  color: var(--bg);
  font-size: 0.72rem;
  padding: 4px 7px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  z-index: 2;
}
.col:hover .col-tip,
.col:focus .col-tip {
  opacity: 1;
}
.col:hover .col-bar,
.col:focus .col-bar {
  filter: brightness(1.12);
}
.col-label {
  font-size: 0.7rem;
  color: var(--muted);
  text-align: center;
  padding-top: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  position: absolute;
  bottom: -22px;
  width: inherit;
}
.col {
  position: relative;
}
.col-label {
  left: 0;
  right: 0;
}
.col-chart {
  margin-bottom: 30px;
}
.bar-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}
.bar-text {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.85rem;
  margin-bottom: 5px;
}
.bar-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bar-value {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.bar-track {
  height: 8px;
  border-radius: 4px;
  background: var(--surface-soft);
}
.bar-fill {
  display: block;
  height: 100%;
  width: var(--w, 0%);
  min-width: 2px;
  border-radius: 4px;
  background: var(--primary);
}
.bar-list small {
  color: var(--muted);
  font-size: 0.75rem;
}
.chart-table {
  margin-top: 14px;
  font-size: 0.8rem;
}
.chart-table summary {
  cursor: pointer;
  color: var(--muted);
}
.more-links {
  display: none;
}
@media (max-width: 900px) {
  .chart-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 650px) {
  .more-links {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 22px;
  }
  .more-links a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 14px 8px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--text);
    text-decoration: none;
    font-size: 0.8rem;
    text-align: center;
  }
  .more-links .icon {
    color: var(--primary);
  }
}
