/**
 * Crimson Command Deck — shared visual system for Accounting, Freight, Warehouse.
 * Brand: navy #161C34 + crimson #AE2129. No purple / cream defaults.
 */
:root {
  --ams-mod-navy: #161C34;
  --ams-mod-navy-2: #1e2640;
  --ams-mod-navy-3: #2a334f;
  --ams-mod-crimson: #AE2129;
  --ams-mod-crimson-soft: rgba(174, 33, 41, 0.16);
  --ams-mod-muted: #5a6174;
  --ams-mod-border: rgba(22, 28, 52, 0.12);
  --ams-mod-soft: #eef1f7;
  --ams-mod-glass: rgba(255, 255, 255, 0.1);
  --ams-mod-font: "Manrope", "IBM Plex Sans", Tahoma, system-ui, sans-serif;
  --ams-mod-display: "Sora", "Manrope", system-ui, sans-serif;
}

/* Page atmosphere behind module roots */
.ams-acc-root,
.ams-frt-root,
.ams-wh-root {
  --navy: var(--ams-mod-navy);
  --crimson: var(--ams-mod-crimson);
  --muted: var(--ams-mod-muted);
  --border: #d5dae6;
  --soft: var(--ams-mod-soft);
  font-family: var(--ams-mod-font) !important;
  position: relative;
  isolation: isolate;
}

.ams-acc-root::before,
.ams-frt-root::before,
.ams-wh-root::before {
  content: "";
  position: absolute;
  inset: -12px -8px auto -8px;
  height: 220px;
  z-index: -1;
  pointer-events: none;
  border-radius: 0 0 28px 28px;
  background:
    radial-gradient(900px 220px at 12% -10%, var(--ams-mod-crimson-soft), transparent 60%),
    linear-gradient(180deg, rgba(22, 28, 52, 0.06) 0%, transparent 100%);
}

/* Command hero */
.ams-mod-hero,
.ams-acc-hero,
.ams-frt-hero,
.ams-wh-hero {
  display: grid;
  gap: 16px;
  margin: 0 0 16px;
  padding: 22px 22px 20px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(1000px 280px at 85% -30%, rgba(174, 33, 41, 0.28), transparent 55%),
    linear-gradient(135deg, var(--ams-mod-navy) 0%, var(--ams-mod-navy-3) 48%, #1a2138 100%);
  color: #fff;
  box-shadow: 0 18px 40px rgba(22, 28, 52, 0.22);
  animation: ams-mod-hero-in 520ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes ams-mod-hero-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.ams-mod-hero-top,
.ams-acc-hero > div:first-child,
.ams-frt-hero-copy,
.ams-wh-hero .ams-wh-total {
  min-width: 0;
}

.ams-mod-kicker,
.ams-acc-kicker {
  margin: 0 0 6px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  letter-spacing: 0.14em !important;
  text-transform: uppercase !important;
  color: rgba(255, 255, 255, 0.62) !important;
}

.ams-mod-hero h1,
.ams-acc-hero h1,
.ams-frt-hero h1,
.ams-wh-head h1,
.ams-frt-head h1 {
  margin: 0 !important;
  font-family: var(--ams-mod-display) !important;
  font-size: clamp(1.55rem, 2.2vw, 2rem) !important;
  font-weight: 700 !important;
  letter-spacing: -0.03em !important;
  line-height: 1.15 !important;
  color: #fff !important;
}

.ams-acc-hero h1,
.ams-frt-hero h1 { color: #fff !important; }

.ams-mod-sub,
.ams-acc-sub,
.ams-frt-hero p,
.ams-wh-head p,
.ams-frt-head p {
  margin: 8px 0 0 !important;
  color: rgba(255, 255, 255, 0.72) !important;
  font-size: 14px !important;
  line-height: 1.5 !important;
  max-width: 40rem;
}

/* When freight/warehouse still use pale heads outside hero, tone them */
.ams-frt-head:not(.ams-frt-hero),
.ams-wh-head {
  margin-bottom: 14px;
}
.ams-frt-head:not(.ams-frt-hero) h1,
.ams-wh-head h1 {
  color: var(--ams-mod-navy) !important;
  font-family: var(--ams-mod-display) !important;
}
.ams-frt-head:not(.ams-frt-hero) p,
.ams-wh-head p {
  color: var(--ams-mod-muted) !important;
}

/* Glass metric tiles */
.ams-mod-metrics,
.ams-frt-cards,
.ams-wh-cards,
.ams-acc-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.ams-frt-hero .ams-frt-cards,
.ams-wh-hero .ams-wh-cards {
  margin-top: 4px;
}

.ams-mod-metric,
.ams-frt-card,
.ams-wh-card,
.ams-acc-card {
  position: relative;
  overflow: hidden;
  border-radius: 14px !important;
  padding: 12px 14px !important;
  animation: ams-mod-tile-in 480ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.ams-frt-hero .ams-frt-card,
.ams-wh-hero .ams-wh-card {
  background: var(--ams-mod-glass) !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  backdrop-filter: blur(8px);
  color: #fff;
}
.ams-frt-hero .ams-frt-card p,
.ams-wh-hero .ams-wh-card p {
  color: rgba(255, 255, 255, 0.7) !important;
  font-size: 11px !important;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}
.ams-frt-hero .ams-frt-card strong,
.ams-wh-hero .ams-wh-card strong,
.ams-wh-total strong {
  color: #fff !important;
  font-family: var(--ams-mod-display);
  font-size: 1.35rem !important;
  letter-spacing: -0.03em;
}

.ams-acc-card {
  background: linear-gradient(180deg, #fff 0%, #f7f8fc 100%) !important;
  border: 1px solid var(--ams-mod-border) !important;
  box-shadow: 0 8px 20px rgba(22, 28, 52, 0.05);
}
.ams-acc-card strong {
  font-family: var(--ams-mod-display);
  font-size: 1.28rem !important;
}

.ams-frt-card:nth-child(1), .ams-wh-card:nth-child(1), .ams-acc-card:nth-child(1) { animation-delay: 40ms; }
.ams-frt-card:nth-child(2), .ams-wh-card:nth-child(2), .ams-acc-card:nth-child(2) { animation-delay: 80ms; }
.ams-frt-card:nth-child(3), .ams-wh-card:nth-child(3), .ams-acc-card:nth-child(3) { animation-delay: 120ms; }
.ams-frt-card:nth-child(4), .ams-wh-card:nth-child(4), .ams-acc-card:nth-child(4) { animation-delay: 160ms; }
.ams-frt-card:nth-child(5), .ams-wh-card:nth-child(5), .ams-acc-card:nth-child(5) { animation-delay: 200ms; }
.ams-frt-card:nth-child(6), .ams-wh-card:nth-child(6), .ams-acc-card:nth-child(6) { animation-delay: 240ms; }

@keyframes ams-mod-tile-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Segmented toolbars */
.ams-mod-toolbar,
.ams-acc-nav,
.ams-frt-toolbar,
.ams-wh-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
  padding: 10px 12px !important;
  border-radius: 16px !important;
  border: 1px solid var(--ams-mod-border) !important;
  background: rgba(255, 255, 255, 0.92) !important;
  box-shadow: 0 10px 28px rgba(22, 28, 52, 0.06);
  backdrop-filter: blur(10px);
}

.ams-acc-btn,
.ams-frt-btn,
.ams-wh-btn {
  border-radius: 11px !important;
  transition: transform 140ms ease, background-color 160ms ease, box-shadow 160ms ease, color 160ms ease;
}
.ams-acc-btn:active,
.ams-frt-btn:active,
.ams-wh-btn:active {
  transform: scale(0.97);
}
.ams-acc-btn.primary,
.ams-frt-btn.primary,
.ams-wh-btn.primary {
  background: var(--ams-mod-crimson) !important;
  border-color: var(--ams-mod-crimson) !important;
  color: #fff !important;
  box-shadow: 0 8px 18px rgba(174, 33, 41, 0.28);
}
.ams-acc-btn.active,
.ams-frt-btn.active,
.ams-wh-btn.active {
  background: var(--ams-mod-navy) !important;
  border-color: var(--ams-mod-navy) !important;
  color: #fff !important;
}

/* Panels / shells */
.ams-acc-shell,
.ams-frt-panel,
.ams-wh-panel {
  border-radius: 18px !important;
  border: 1px solid var(--ams-mod-border) !important;
  box-shadow: 0 12px 32px rgba(22, 28, 52, 0.07) !important;
  overflow: hidden;
  background: #fff;
}
.ams-acc-shell-title,
.ams-frt-panel-title,
.ams-wh-panel-title {
  background: linear-gradient(90deg, var(--ams-mod-navy) 0%, var(--ams-mod-navy-2) 100%) !important;
  letter-spacing: 0.06em !important;
}

/* Tables */
.ams-acc-table th,
.ams-frt-table th,
.ams-wh-table th {
  background: var(--ams-mod-soft) !important;
  font-size: 11px !important;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ams-mod-muted) !important;
}
.ams-acc-table tr:hover td,
.ams-frt-table tr:hover td,
.ams-wh-table tr:hover td {
  background: rgba(174, 33, 41, 0.03);
}

/* Accounting hero: white→navy conversion */
.ams-acc-hero {
  align-items: start;
  justify-content: space-between;
  grid-template-columns: minmax(0, 1fr) auto;
  border-left: none !important;
}
.ams-acc-hero .ams-acc-mode-copy { color: rgba(255, 255, 255, 0.7) !important; }
.ams-acc-hero .ams-acc-mode-chip.vat {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}
.ams-acc-hero .ams-acc-mode:not(.commercial) {
  background: transparent;
}
.ams-acc-hero .ams-acc-mode.commercial {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(251, 191, 36, 0.35);
}

/* Warehouse total on hero */
.ams-wh-total p {
  opacity: 0.75;
  font-size: 12px;
  letter-spacing: 0.1em;
  font-weight: 700;
}
.ams-wh-total strong {
  display: block;
  font-size: clamp(2rem, 3vw, 2.6rem) !important;
  margin: 6px 0 4px;
}
.ams-wh-total span { opacity: 0.7; font-size: 13px; }

@media (max-width: 840px) {
  .ams-acc-hero {
    grid-template-columns: 1fr;
  }
  .ams-frt-hero .ams-frt-cards,
  .ams-wh-hero .ams-wh-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
