.ams-acc-root {
  --navy: #161C34;
  --crimson: #AE2129;
  --muted: #4b5163;
  --border: #d9dde6;
  --soft: #f4f6fb;
  color: var(--navy);
  font-family: Inter, Manrope, "IBM Plex Sans", Tahoma, system-ui, sans-serif;
  padding: 8px 4px 32px;
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  position: relative;
  z-index: 1;
}
.ams-acc-root *,
.ams-acc-root *::before,
.ams-acc-root *::after { box-sizing: border-box; }

.ams-acc-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 16px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--crimson);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(22, 28, 52, 0.05);
}
.ams-acc-kicker {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--crimson);
}
.ams-acc-hero h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--navy);
}
.ams-acc-sub {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  max-width: 42rem;
}

.ams-acc-mode {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  max-width: 36rem;
}
.ams-acc-mode-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.ams-acc-mode-chip.vat { background: #ecfdf3; color: #166534; border: 1px solid #bbf7d0; }
.ams-acc-mode-chip.commercial { background: #111827; color: #fbbf24; border: 1px solid #1f2937; }
.ams-acc-mode-copy { color: var(--muted); font-size: 13px; line-height: 1.4; }
.ams-acc-mode.commercial {
  width: 100%;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 12px;
  background: #111827;
  color: #fbbf24;
}
.ams-acc-mode.commercial .ams-acc-mode-copy { color: #fde68a; }
.ams-acc-mode.commercial .ams-acc-btn { background: #fff; color: var(--navy); border-color: #fff; }

.ams-acc-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(22, 28, 52, 0.05);
}
.ams-acc-nav-group {
  display: grid;
  grid-template-columns: 136px minmax(0, 1fr);
  gap: 8px 12px;
  align-items: center;
}
.ams-acc-nav-group > span {
  padding-top: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.ams-acc-nav-group > div { display: flex; flex-wrap: wrap; gap: 6px; }

.ams-acc-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 36px; padding: 6px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: #fff; color: var(--navy);
  text-decoration: none; font-weight: 600; cursor: pointer; white-space: nowrap; font-size: 13px;
}
.ams-acc-btn.primary { background: var(--crimson); border-color: var(--crimson); color: #fff; }
.ams-acc-btn.active { background: var(--navy); border-color: var(--navy); color: #fff; }
.ams-acc-btn:focus { outline: 3px solid #f4c7ca; outline-offset: 1px; }

.ams-acc-body { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.ams-acc-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(22, 28, 52, 0.05);
}
.ams-acc-shell-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  padding: 12px 20px;
  background: var(--navy);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.3;
}
.ams-acc-shell-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.ams-acc-shell-actions .ams-acc-btn {
  min-height: 32px;
  background: #fff;
  color: var(--navy);
  border-color: #fff;
}
.ams-acc-shell-body { padding: 16px 20px 20px; }
.ams-acc-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.ams-acc-kpi-block h2,
.ams-acc-panel > h3 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--navy);
}
.ams-acc-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.ams-acc-card {
  background: var(--soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  min-width: 0;
}
.ams-acc-card p { margin: 0; color: var(--muted); font-size: 12px; font-weight: 600; }
.ams-acc-card strong { display: block; margin-top: 8px; font-size: 1.2rem; letter-spacing: -0.02em; color: var(--navy); }
.ams-acc-card.loss strong { color: var(--crimson); }

.ams-acc-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 18px;
  overflow: auto;
  box-shadow: 0 1px 2px rgba(22, 28, 52, 0.05);
}
.ams-acc-panel + .ams-acc-panel { margin-top: 0; }
.ams-acc-lead { margin: 0 0 14px; color: var(--muted); font-size: 14px; line-height: 1.5; max-width: 46rem; }
.ams-acc-empty { margin: 0; color: var(--muted); padding: 12px 0; }
.ams-acc-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.ams-acc-table-wrap { overflow: auto; }
.ams-acc-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 640px; }
.ams-acc-table th, .ams-acc-table td { border-bottom: 1px solid var(--border); padding: 10px 12px; text-align: left; vertical-align: top; }
.ams-acc-table th {
  background: var(--soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.ams-acc-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

.ams-acc-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; margin-bottom: 12px; }
.ams-acc-filters input, .ams-acc-filters select,
.ams-acc-form input, .ams-acc-form select, .ams-acc-form textarea {
  width: 100%; min-height: 42px; border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 12px; font: inherit; color: var(--navy); background: #fff;
}
.ams-acc-form input:focus, .ams-acc-form select:focus, .ams-acc-form textarea:focus {
  outline: 3px solid #f4c7ca;
  border-color: var(--crimson);
}
.ams-acc-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px 14px; align-items: end; }
.ams-acc-form .span-2 { grid-column: span 2; }
.ams-acc-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; font-size: 12px; font-weight: 700; color: var(--navy); }
.ams-acc-field > span { line-height: 1.2; }
.ams-acc-form-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.ams-acc-period-bar .ams-acc-help { margin-top: 10px; }
.ams-acc-statement { width: 100%; border-collapse: collapse; font-size: 14px; }
.ams-acc-statement td { padding: 8px 10px; border-bottom: 1px solid var(--border); }
.ams-acc-statement .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ams-acc-statement .section td { background: var(--soft); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; font-size: 12px; }
.ams-acc-statement .indent td:first-child { padding-left: 22px; color: var(--muted); }
.ams-acc-statement .total td { font-weight: 700; background: #fafbfc; }
.ams-acc-statement .total.net td { background: var(--navy); color: #fff; border-bottom: 0; }
.ams-acc-table button.ams-acc-btn { min-height: 32px; padding: 4px 10px; font-size: 12px; }

.ams-acc-error { color: var(--crimson); font-weight: 600; }
.ams-acc-help { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.ams-acc-badge { display: inline-block; border-radius: 999px; padding: 2px 8px; font-size: 11px; font-weight: 700; border: 1px solid var(--border); }
.ams-acc-badge.vat { background: #ecfdf3; color: #166534; }
.ams-acc-badge.commercial { background: #111827; color: #fbbf24; }
.ams-acc-badge.ok { background: #ecfdf3; color: #166534; border-color: #bbf7d0; }
.ams-acc-badge.warn { background: #fff7ed; color: #9a3412; border-color: #fed7aa; }
.ams-acc-badge.bad { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.ams-acc-badge.neutral { background: var(--soft); color: var(--muted); }
.ams-acc-job {
  color: var(--crimson);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.ams-acc-job:hover { text-decoration: underline; }
.ams-acc-row-actions { white-space: nowrap; }

.ams-acc-banner {
  display: none; position: sticky; top: 0; z-index: 40; margin-bottom: 12px;
  background: #111827; color: #fbbf24; border-radius: 12px; padding: 10px 14px;
  align-items: center; justify-content: space-between; gap: 10px;
}
.ams-acc-banner.show { display: flex; }
.ams-acc-vat-banner { display: none; }

.ams-acc-modal {
  position: fixed; inset: 0; z-index: 80; background: rgba(22, 28, 52, .45);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.ams-acc-modal[hidden] { display: none !important; }
.ams-acc-modal-card {
  width: min(440px, 100%); background: #fff; border-radius: 16px; padding: 22px;
  box-shadow: 0 20px 50px rgba(22, 28, 52, .25);
}
.ams-acc-modal-card h2 { margin: 0 0 6px; font-size: 1.15rem; color: var(--navy); }
.ams-acc-modal-card p { margin: 0 0 12px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.ams-acc-modal-card hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
.ams-acc-modal-card label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 700; color: var(--navy); }
.ams-acc-modal-card input {
  width: 100%; min-height: 42px; border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; font: inherit;
}
.ams-acc-modal-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.ams-acc-modal-actions .ams-acc-btn { width: 100%; min-height: 42px; }

.ams-acc-toast {
  position: fixed; right: 16px; bottom: 16px; z-index: 90; background: #161C34; color: #fff;
  padding: 10px 14px; border-radius: 10px; font-weight: 600;
}
.ams-acc-toast.err { background: var(--crimson); }

#ams-acc-slot { display: none; width: 100%; }
body.ams-acc-page #ams-acc-slot {
  display: flex !important;
  flex-direction: column;
  flex: 1 1 0% !important;
  min-height: 0 !important;
  min-width: 0 !important;
  width: 100% !important;
  overflow: auto;
  position: relative;
  z-index: 1;
  align-self: stretch;
  box-sizing: border-box;
  background: #F5F5F3;
}
body.ams-acc-page #app .flex.min-w-0.flex-1.flex-col > .flex-1.p-4:not(#ams-acc-slot):not(#ams-frt-slot):not(#ams-wa-slot),
body.ams-acc-page #app .flex.min-w-0.flex-1.flex-col > .flex-1.p-6:not(#ams-acc-slot):not(#ams-frt-slot):not(#ams-wa-slot),
body.ams-acc-page #app .flex.min-w-0.flex-1.flex-col > .flex-1.p-8:not(#ams-acc-slot):not(#ams-frt-slot):not(#ams-wa-slot),
body.ams-acc-page [data-ams-acc-hidden-page="1"] {
  display: none !important;
}
body.ams-acc-page #ams-acc-slot .ams-acc-root,
body.ams-acc-page #ams-acc-slot .ams-workspace.ams-acc-root {
  position: relative !important;
  inset: auto !important;
  flex: 1 1 auto;
  width: 100% !important;
  max-width: none !important;
  min-height: 0;
  overflow: auto;
  z-index: 1 !important;
  padding: 16px 24px 24px;
  margin: 0;
  background: #F5F5F3;
  box-sizing: border-box;
}
body.ams-acc-page [data-ams-acc-hidden-page] { display: none !important; }

.ams-acc-slot-fallback,
body.ams-acc-fixed-fallback #ams-acc-slot,
#ams-acc-slot.ams-acc-slot-fallback {
  position: fixed !important;
  top: 4rem !important;
  left: 18rem !important;
  right: 0 !important;
  bottom: 0 !important;
  inset: 4rem 0 0 18rem !important;
  z-index: 20 !important;
  width: auto !important;
  flex: none !important;
  display: flex !important;
  overflow: auto;
}
body.ams-acc-fixed-fallback { overflow: auto; }

@media (max-width: 1023px) {
  body.ams-acc-fixed-fallback #ams-acc-slot,
  #ams-acc-slot.ams-acc-slot-fallback {
    left: 0 !important;
    inset: 4rem 0 0 0 !important;
  }
  .ams-acc-nav-group { grid-template-columns: 1fr; }
  .ams-acc-nav-group > span { padding-top: 0; }
  .ams-acc-split { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  .ams-acc-form .span-2 { grid-column: span 1; }
  .ams-acc-nav { overflow-x: auto; }
}
@media (max-width: 640px) {
  .ams-acc-hero { padding: 14px; }
}
