/* AMOS-X static HTML replica — design tokens and components.
   Token values copied from amos-web/libs/amos-design-system/src/foundations/_tokens.scss */
:root {
  --ds-purple-1: hsl(274,100%,45%); --ds-purple-2: hsl(286,85%,44%);
  --ds-magenta-1: hsl(318,72%,49%); --ds-magenta-2: hsl(332,100%,62%);
  --ds-navy: hsl(242,53%,23%);
  --ds-primary: hsl(274,100%,45%); --ds-primary-hover: hsl(274,100%,35%); --ds-primary-active: hsl(274,100%,30%);
  --ds-primary-foreground: hsl(0,0%,100%); --ds-primary-tint: hsla(274,100%,45%,.1);
  --ds-accent: hsl(318,72%,49%); --ds-accent-foreground: hsl(0,0%,100%);
  --ds-info: hsl(210,80%,50%); --ds-info-tint: hsla(210,80%,50%,.1);
  --ds-success: hsl(142,45%,40%); --ds-success-foreground: #fff; --ds-success-tint: hsla(142,45%,40%,.1);
  --ds-warning: hsl(38,92%,50%); --ds-warning-foreground: hsl(0,0%,10%); --ds-warning-tint: hsla(38,92%,50%,.1);
  --ds-destructive: hsl(0,84%,60%); --ds-destructive-foreground: #fff; --ds-destructive-tint: hsla(0,84%,60%,.1);
  --ds-outline-text: hsl(217,91%,40%); --ds-outline-background: hsl(217,91%,95%); --ds-outline-border: hsl(217,91%,85%);
  --ds-success-bg: hsl(142,45%,95%); --ds-success-text: hsl(142,45%,30%);
  --ds-destructive-bg: hsl(0,84%,95%); --ds-destructive-text: hsl(0,84%,40%);
  --ds-warning-bg: hsl(38,92%,95%); --ds-warning-text: hsl(38,92%,30%);
  --ds-info-bg: hsl(274,100%,95%);
  --ds-background: hsl(0,0%,100%); --ds-foreground: hsl(222,24%,12%);
  --ds-muted: hsl(220,14%,96%); --ds-muted-foreground: hsl(215,16%,35%);
  --ds-border: hsl(214,32%,91%); --ds-input: hsl(214,32%,91%);
  --ds-card: hsl(0,0%,100%); --ds-ring: hsl(274,100%,45%); --ds-ring-focus: hsla(274,100%,45%,.2);
  --ds-hover: hsl(223,11%,75%); --ds-surface-bg: hsl(240,5%,93%);
  --ds-gradient-primary: linear-gradient(135deg, hsl(274,100%,45%), hsl(332,100%,62%));
  --ds-gradient-accent: linear-gradient(90deg, hsl(286,85%,44%), hsl(318,72%,49%));
  --ds-gradient-secondary: linear-gradient(90deg, hsl(242,53%,23%), hsl(274,100%,45%), hsl(332,100%,62%));
  --ds-font-family: 'DM Sans', ui-sans-serif, system-ui, sans-serif;
  --ds-font-size-2xs: .6rem; --ds-font-size-xs: .75rem; --ds-font-size-sm: .875rem; --ds-font-size-base: 1rem;
  --ds-font-size-lg: 1.125rem; --ds-font-size-xl: 1.25rem; --ds-font-size-2xl: 1.5rem; --ds-font-size-3xl: 1.875rem;
  --ds-space-1: .25rem; --ds-space-2: .5rem; --ds-space-3: .75rem; --ds-space-4: 1rem; --ds-space-6: 1.5rem; --ds-space-8: 2rem;
  --ds-radius-sm: .25rem; --ds-radius-md: .375rem; --ds-radius-lg: .5rem; --ds-radius-xl: .75rem; --ds-radius-full: 9999px;
  --ds-transition-fast: 150ms ease; --ds-transition-base: 200ms ease; --ds-transition-slow: 300ms ease;
  --ds-grid-header-color: var(--ds-navy); --ds-grid-row-hover-bg: hsla(220,14%,96%,.5);
  --ds-grid-row-selected-bg: hsla(274,100%,45%,.1);
  --ds-label-color: hsl(210,4%,54%); --ds-required-color: hsl(0,100%,50%);
  --ds-disabled-bg: hsl(240,5%,93%); --ds-disabled-text: hsl(0,0%,40%);
  --ds-shadow-sm: 0 1px 2px 0 rgba(0,0,0,.05);
  --ds-shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -2px rgba(0,0,0,.1);
  --ds-shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
  --ds-shadow-xl: 0 20px 25px -5px rgba(0,0,0,.1), 0 8px 10px -6px rgba(0,0,0,.1);
  --ds-header-bg: hsl(216,20%,97%); --ds-header-height: 56px;
  --ds-sidebar-bg: hsl(242,53%,23%); --ds-sidebar-fg: hsl(0,0%,98%);
  --ds-sidebar-width: 240px; --ds-sidebar-collapsed: 60px;
  --ds-favorite: hsl(60,84%,48%);
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--ds-font-family); font-size: var(--ds-font-size-base); color: var(--ds-foreground);
  background: var(--ds-background); line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--ds-primary); text-decoration: none; }
h1, h2, h3, h4, h5 { margin: 0; }
.muted { color: var(--ds-muted-foreground); }
.small { font-size: var(--ds-font-size-xs); }
.nowrap { white-space: nowrap; }
.text-destructive { color: var(--ds-destructive); font-weight: 600; }
.text-warning { color: var(--ds-warning-text); font-weight: 600; }
.text-success { color: var(--ds-success-text); font-weight: 600; }
.hidden { display: none !important; }

/* ---------- Header ---------- */
.hdr { position: fixed; top: 0; left: 0; right: 0; height: var(--ds-header-height); z-index: 1030;
  background: var(--ds-header-bg); border-bottom: 1px solid var(--ds-border);
  display: flex; align-items: center; gap: var(--ds-space-2); padding: 0 var(--ds-space-2); }
.hdr__left { display: flex; align-items: center; gap: var(--ds-space-2); flex: 1; min-width: 0; }
.hdr__brand { font-weight: 500; color: var(--ds-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: var(--ds-font-size-lg); }
.hdr__right { display: flex; align-items: center; gap: var(--ds-space-2); }
.hdr__notif { position: relative; }
.hdr__notif .count { position: absolute; top: 2px; right: 2px; background: var(--ds-warning); color: var(--ds-warning-foreground);
  font-size: var(--ds-font-size-2xs); border-radius: var(--ds-radius-full); padding: 1px 5px; font-weight: 600; }

/* ---------- Sidebar ---------- */
.sb { position: fixed; top: var(--ds-header-height); bottom: 0; left: 0; width: var(--ds-sidebar-width);
  background: var(--ds-sidebar-bg); color: var(--ds-sidebar-fg); overflow-y: auto; overflow-x: hidden;
  transition: width var(--ds-transition-base); z-index: 1020; }
.sb__group { padding: var(--ds-space-2); display: flex; flex-direction: column; gap: 4px; }
.sb__label { height: 32px; display: flex; align-items: center; padding: 0 12px; font-size: var(--ds-font-size-xs);
  font-weight: 500; text-transform: uppercase; letter-spacing: .05em; opacity: .7; white-space: nowrap; }
.sb__item { display: flex; align-items: center; gap: var(--ds-space-2); padding: 8px 12px; border-radius: var(--ds-radius-md);
  border-left: 2px solid transparent; color: var(--ds-sidebar-fg); font-size: var(--ds-font-size-sm); cursor: pointer;
  white-space: nowrap; background: none; border-top: 0; border-right: 0; border-bottom: 0; width: 100%; text-align: left; }
.sb__item i { width: 20px; text-align: center; font-size: 16px; color: hsl(274,100%,72%); flex: none; }
.sb__item:hover { background: hsla(274,100%,45%,.2); }
.sb__item.active { background: var(--ds-magenta-1); color: #fff; border-left-color: var(--ds-purple-1); font-weight: 500; }
.sb__item.active i { color: #fff; }
.sb__item .tag { margin-left: auto; font-size: var(--ds-font-size-2xs); background: hsla(0,0%,100%,.15); padding: 1px 6px; border-radius: var(--ds-radius-full); }
body.sb-collapsed .sb { width: var(--ds-sidebar-collapsed); }
body.sb-collapsed .sb__label, body.sb-collapsed .sb__item span, body.sb-collapsed .sb__item .tag { display: none; }
body.sb-collapsed .sb__item { justify-content: center; padding: 8px 0; }
.main { margin-left: var(--ds-sidebar-width); padding-top: var(--ds-header-height); min-height: 100vh;
  transition: margin-left var(--ds-transition-slow); }
body.sb-collapsed .main { margin-left: var(--ds-sidebar-collapsed); }
.sb-backdrop { display: none; }
@media (max-width: 991.98px) {
  .sb { width: 0; }
  body.sb-open .sb { width: var(--ds-sidebar-width); }
  body.sb-open .sb-backdrop { display: block; position: fixed; inset: var(--ds-header-height) 0 0 0; background: rgba(0,0,0,.4); z-index: 1010; }
  .main, body.sb-collapsed .main { margin-left: 0; }
  .hdr__right .desktop-only { display: none; }
  body.sb-collapsed .sb__label, body.sb-collapsed .sb__item span { display: initial; }
}
@media (min-width: 992px) { .mobile-only { display: none !important; } }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--ds-space-2); height: 40px; padding: 0 24px;
  border-radius: var(--ds-radius-md); font-weight: 500; font-size: var(--ds-font-size-base); border: 1px solid transparent;
  cursor: pointer; white-space: nowrap; transition: all var(--ds-transition-fast); background: none; }
.btn--sm { height: 36px; padding: 0 12px; font-size: var(--ds-font-size-sm); }
.btn--lg { height: 44px; padding: 0 32px; }
.btn--icon { padding: 0; width: 40px; } .btn--sm.btn--icon { width: 36px; }
.btn--primary { background: var(--ds-gradient-primary); color: #fff; }
.btn--primary:hover { opacity: .9; transform: scale(1.02); }
.btn--secondary { background: var(--ds-muted); color: var(--ds-foreground); }
.btn--secondary:hover { opacity: .8; }
.btn--outline { border-color: var(--ds-border); background: #fff; color: var(--ds-foreground); }
.btn--outline:hover, .btn--ghost:hover { background: var(--ds-magenta-1); color: #fff; border-color: var(--ds-magenta-1); }
.btn--ghost { color: var(--ds-foreground); }
.btn--destructive { background: var(--ds-destructive); color: #fff; }
.btn--destructive:hover { opacity: .8; }
.btn:disabled, .btn.disabled { opacity: .5; pointer-events: none; }
.btn .caret { font-size: 10px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: var(--ds-radius-full);
  font-size: var(--ds-font-size-xs); font-weight: 500; line-height: 1; white-space: nowrap; border: 1px solid transparent; }
.badge--default { background: var(--ds-primary); color: #fff; }
.badge--secondary { background: var(--ds-magenta-1); color: #fff; }
.badge--outline { background: var(--ds-outline-background); color: var(--ds-outline-text); border-color: var(--ds-outline-border); }
.badge--success { background: var(--ds-success-bg); color: var(--ds-success-text); }
.badge--warning { background: var(--ds-warning-bg); color: var(--ds-warning-text); }
.badge--destructive { background: var(--ds-destructive-bg); color: var(--ds-destructive-text); }
.badge--error { background: var(--ds-muted); color: var(--ds-destructive); }
.badge--muted { background: var(--ds-muted); color: var(--ds-muted-foreground); }

/* ---------- Avatar ---------- */
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--ds-magenta-1); color: #fff; display: inline-flex;
  align-items: center; justify-content: center; font-weight: 600; font-size: var(--ds-font-size-sm); cursor: pointer; border: 0; flex: none; }
.avatar--sm { width: 32px; height: 32px; font-size: var(--ds-font-size-xs); }
.avatar--navy { background: var(--ds-navy); } .avatar--purple { background: var(--ds-primary); }

/* ---------- Dropdown ---------- */
.dd { position: relative; display: inline-flex; }
.dd__menu { position: absolute; right: 0; top: 100%; margin-top: 4px; min-width: 180px; max-height: 320px; overflow-y: auto;
  background: #fff; border: 1px solid var(--ds-border); border-radius: var(--ds-radius-md); padding: 4px; z-index: 400;
  box-shadow: var(--ds-shadow-lg); font-size: var(--ds-font-size-sm); display: none; }
.dd__menu.left { left: 0; right: auto; }
.dd.open .dd__menu { display: block; }
.dd__item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 12px; border: 0; background: none;
  border-radius: var(--ds-radius-sm); cursor: pointer; text-align: left; white-space: nowrap; color: var(--ds-foreground); }
.dd__item:hover { background: var(--ds-magenta-1); color: #fff; }
.dd__item.disabled { opacity: .5; pointer-events: none; }
.dd__sep { height: 1px; background: var(--ds-border); margin: 4px 0; }
.dd__head { padding: 6px 12px; font-size: var(--ds-font-size-xs); color: var(--ds-muted-foreground); text-transform: uppercase; letter-spacing: .05em; }

/* ---------- Welcome header / page ---------- */
.welcome { margin: 16px 24px; padding: 24px; border-radius: var(--ds-radius-lg); display: flex; align-items: center; gap: 16px; }
.welcome--basic { background: var(--ds-gradient-secondary); color: #fff; }
.welcome--classic { background: #fff; border: 1px solid var(--ds-border); }
.welcome__text { flex: 1; min-width: 0; }
.welcome__title { font-size: var(--ds-font-size-2xl); font-weight: 700; }
.welcome__subtitle { font-size: var(--ds-font-size-sm); margin-top: 4px; opacity: .9; }
.welcome__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.welcome--basic .btn { background: hsla(0,0%,100%,.15); border-color: hsla(0,0%,100%,.3); color: #fff; }
.welcome--basic .btn:hover { background: hsla(0,0%,100%,.25); transform: none; }
.page-content { padding-bottom: 32px; }

/* ---------- Action toolbar ---------- */
.atb { padding: 8px 16px; border-bottom: 1px solid var(--ds-border); background: #fff; position: sticky; top: var(--ds-header-height); z-index: 100; }
.atb__row { display: flex; align-items: center; gap: 12px; min-height: 44px; flex-wrap: wrap; }
.atb__back { width: 44px; height: 44px; border-radius: var(--ds-radius-md); border: 0; background: none; cursor: pointer; font-size: 14px; flex: none; }
.atb__back:hover { background: var(--ds-magenta-1); color: #fff; }
.atb__title { font-size: var(--ds-font-size-xl); font-weight: 700; color: var(--ds-muted-foreground); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entity-title__code { font-weight: 700; font-size: var(--ds-font-size-2xl); color: var(--ds-foreground); }
.entity-title__desc { font-size: var(--ds-font-size-2xl); color: var(--ds-muted-foreground); margin-left: 8px; }
.atb__badges { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.atb__buttons { display: flex; gap: 8px; }
.atb__meta { display: flex; flex-wrap: wrap; gap: 4px 20px; padding: 0 0 4px 56px; font-size: var(--ds-font-size-sm); color: var(--ds-muted-foreground); }
.atb__meta b { font-weight: 500; }
.atb__meta .highlight { color: var(--ds-destructive); font-weight: 600; }

/* ---------- Collapsible card / filter ---------- */
.ccard { border: 1px solid var(--ds-border); border-radius: var(--ds-radius-lg); padding: 16px 24px; background: #fff; }
.ccard + .ccard { margin-top: 12px; }
.ccard__head { display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.ccard__icon { color: var(--ds-muted-foreground); width: 20px; text-align: center; }
.ccard__title { font-size: var(--ds-font-size-base); font-weight: 400; text-transform: uppercase; flex: 1; min-width: 0; }
.ccard__sub { font-size: var(--ds-font-size-xs); color: var(--ds-muted-foreground); text-transform: none; }
.ccard__chev { font-size: 12px; transition: transform var(--ds-transition-slow); }
.ccard.collapsed .ccard__chev { transform: rotate(180deg); }
.ccard__body { padding-top: 16px; }
.ccard.collapsed .ccard__body { display: none; }
.filter { margin: 16px 24px; }
.filter__actions { display: flex; justify-content: flex-end; gap: 12px; padding-top: 16px; }
.filter .ccard .ccard { margin-top: 8px; padding: 12px 16px; }

/* ---------- Form fields ---------- */
.row { display: flex; flex-wrap: wrap; margin: 0 -8px; }
.row > [class*="col-"] { padding: 0 8px; }
.col-12 { width: 100%; } .col-9 { width: 75%; } .col-8 { width: 66.666%; } .col-6 { width: 50%; }
.col-4 { width: 33.333%; } .col-3 { width: 25%; } .col-2 { width: 16.666%; }
@media (max-width: 991.98px) { .row > .col-3, .row > .col-4, .row > .col-2 { width: 50%; } }
@media (max-width: 640px) { .row > [class*="col-"] { width: 100%; } }
.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px; min-width: 0; }
.field--sm { margin-bottom: 8px; }
.field label { font-size: var(--ds-font-size-sm); font-weight: 500; color: var(--ds-muted-foreground); }
.field label.req::after { content: ' *'; color: var(--ds-required-color); }
.ctl { height: 40px; border: 1px solid var(--ds-input); border-radius: var(--ds-radius-md); padding: 0 12px; background: #fff;
  width: 100%; display: flex; align-items: center; gap: 6px; min-width: 0; font-size: var(--ds-font-size-sm); }
.ctl:focus-within { border-color: var(--ds-primary); box-shadow: 0 0 0 2px var(--ds-ring-focus); }
.ctl input, .ctl select { border: 0; outline: 0; background: none; flex: 1; min-width: 0; height: 100%; font-size: var(--ds-font-size-sm); }
.ctl select { cursor: pointer; }
.ctl .suffix { color: var(--ds-muted-foreground); cursor: pointer; }
.ctl.readonly, .ctl.disabled { background: var(--ds-disabled-bg); color: var(--ds-disabled-text); }
.ctl--area { height: auto; min-height: 88px; padding: 8px 12px; align-items: flex-start; }
.ctl--area textarea { border: 0; outline: 0; width: 100%; min-height: 72px; resize: vertical; font-size: var(--ds-font-size-sm); }
.ctl.invalid { border-color: var(--ds-destructive); }
.field .err { font-size: var(--ds-font-size-xs); color: var(--ds-destructive); margin-top: -4px; }
.chk { display: flex; align-items: center; gap: 8px; min-height: 42px; border: 1px solid var(--ds-border); border-radius: var(--ds-radius-lg);
  padding: 8px 12px; font-size: var(--ds-font-size-sm); cursor: pointer; }
.chk input { width: 18px; height: 18px; accent-color: var(--ds-primary); margin: 0; }
.chk--bare { border: 0; padding: 0; min-height: 0; }
.sw { display: flex; align-items: center; gap: 10px; min-height: 40px; border: 1px solid var(--ds-border); border-radius: var(--ds-radius-md); padding: 0 12px; font-size: var(--ds-font-size-sm); cursor: pointer; }
.sw input { display: none; }
.sw .track { width: 44px; height: 24px; border-radius: 12px; background: var(--ds-hover); position: relative; transition: background var(--ds-transition-fast); flex: none; }
.sw .track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: left var(--ds-transition-fast); }
.sw input:checked + .track { background: var(--ds-primary); }
.sw input:checked + .track::after { left: 22px; }
.radios { display: flex; gap: 8px; flex-wrap: wrap; }
.radios--v { flex-direction: column; }
.radio { display: flex; align-items: center; gap: 8px; border: 1px solid var(--ds-border); border-radius: var(--ds-radius-md);
  padding: 8px 12px; min-height: 40px; cursor: pointer; font-size: var(--ds-font-size-sm); }
.radio input { accent-color: var(--ds-primary); margin: 0; }
.radio.checked { border-color: var(--ds-primary); background: var(--ds-primary-tint); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tagchip { height: 28px; display: inline-flex; align-items: center; gap: 6px; padding: 0 10px; border-radius: var(--ds-radius-sm);
  background: var(--ds-accent); color: #fff; font-size: var(--ds-font-size-xs); }
.ro-value { font-size: var(--ds-font-size-sm); min-height: 40px; display: flex; align-items: center; }

/* ---------- Grid card ---------- */
.gcard { margin: 16px 24px; border: 1px solid var(--ds-border); border-radius: var(--ds-radius-lg); background: #fff; overflow: hidden; display: flex; flex-direction: column; }
.tab-pane .gcard, .gcard.flush { margin: 0; }
.tab-pane .gcard + .gcard, .stack > .gcard + .gcard { margin-top: 16px; }
.gcard__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 24px; border-bottom: 1px solid var(--ds-border); flex-wrap: wrap; }
.gcard__title { font-size: var(--ds-font-size-lg); font-weight: 700; }
.gcard__count { font-weight: 400; color: var(--ds-muted-foreground); }
.gcard__actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grid-wrap { overflow: auto; position: relative; }
table.grid { border-collapse: separate; border-spacing: 0; width: 100%; font-size: var(--ds-font-size-sm); }
table.grid th { position: sticky; top: 0; z-index: 2; background: #fff; color: var(--ds-grid-header-color); font-weight: 700; text-align: left;
  padding: 12px 16px; border-bottom: 1px solid var(--ds-border); white-space: nowrap; cursor: pointer; user-select: none; }
table.grid th.num, table.grid td.num { text-align: right; }
table.grid th.center, table.grid td.center { text-align: center; }
table.grid th .sort { margin-left: 6px; font-size: 10px; color: var(--ds-primary); }
table.grid tr.filter-row td { position: sticky; top: 45px; z-index: 2; background: hsl(220,14%,98%); padding: 4px 8px; border-bottom: 1px solid var(--ds-border); }
table.grid tr.filter-row input { width: 100%; height: 32px; border: 1px solid var(--ds-border); border-radius: var(--ds-radius-md); padding: 0 8px 0 26px; font-size: var(--ds-font-size-xs); outline: 0;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 512 512'%3E%3Cpath fill='%23999' d='M505 442.7 405.3 343c28.4-34.9 45.7-79 45.7-127C451 103.5 349.5 2 225.5 2S0 103.5 0 216s101.5 214 225.5 214c48 0 92.1-17.3 127-45.7l99.7 99.7c4.7 4.7 10.9 7 17 7s12.3-2.3 17-7c9.3-9.4 9.3-24.6-.2-34.3zM225.5 382C137 382 64 309 64 216S137 50 225.5 50 387 123 387 216s-73 166-161.5 166z'/%3E%3C/svg%3E") no-repeat 8px center; }
table.grid tr.filter-row input:focus { border-color: var(--ds-primary); box-shadow: 0 0 0 2px var(--ds-ring-focus); }
table.grid td { padding: 10px 16px; border-bottom: 1px solid var(--ds-border); height: 48px; vertical-align: middle; }
table.grid tbody tr.data:hover td { background: var(--ds-grid-row-hover-bg); }
table.grid tbody tr.clickable { cursor: pointer; }
table.grid tbody tr.selected td { background: var(--ds-grid-row-selected-bg); }
table.grid td.sel, table.grid th.sel { width: 40px; padding: 0 8px; text-align: center; }
table.grid td.sel input, table.grid th.sel input { accent-color: var(--ds-primary); width: 16px; height: 16px; }
table.grid td .link { color: var(--ds-primary); font-weight: 500; cursor: pointer; }
table.grid tr.group td { background: var(--ds-muted); font-weight: 600; cursor: pointer; }
table.grid td.tint-destructive { background: var(--ds-destructive-tint) !important; }
table.grid td.tint-warning { background: var(--ds-warning-tint) !important; }
table.grid tr.row-destructive td { background: var(--ds-destructive-tint); }
table.grid tr.row-warning td { background: var(--ds-warning-tint); }
table.grid tr.row-success td { background: var(--ds-success-tint); }
table.grid tr.no-data td { text-align: center; color: var(--ds-muted-foreground); padding: 40px; height: auto; }
.cell-actions { display: inline-flex; gap: 4px; justify-content: center; }
.act-btn { border: 0; background: none; color: var(--ds-muted-foreground); font-size: 16px; width: 30px; height: 30px; border-radius: var(--ds-radius-sm); cursor: pointer; }
.act-btn:hover { background: var(--ds-muted); color: var(--ds-foreground); }
.act-btn--destructive:hover { color: var(--ds-destructive); }
.pager { display: flex; align-items: center; justify-content: space-between; padding: 8px 16px; border-top: 1px solid var(--ds-border); font-size: var(--ds-font-size-sm); color: var(--ds-muted-foreground); gap: 8px; flex-wrap: wrap; }
.pager__pages { display: flex; gap: 4px; }
.pager button { min-width: 32px; height: 32px; border-radius: var(--ds-radius-md); border: 0; background: none; cursor: pointer; color: var(--ds-muted-foreground); }
.pager button:hover { background: hsla(274,100%,45%,.08); }
.pager button.on { background: var(--ds-primary); color: #fff; }
.grid-editable td.editable { cursor: text; }
.grid-editable td.editable:hover { box-shadow: inset 0 0 0 1px var(--ds-border); }
.grid-editable td.modified { box-shadow: inset 0 0 0 2px hsla(142,45%,40%,.5); }
.grid-editable td input.cell-edit { width: 100%; height: 30px; border: 1px solid var(--ds-primary); border-radius: 4px; padding: 0 6px; outline: 0; font-size: var(--ds-font-size-sm); }

/* ---------- Tabs ---------- */
.tabs__header { border-bottom: 1px solid var(--ds-border); overflow-x: auto; background: #fff; }
.tabs__list { display: flex; gap: 4px; position: relative; }
.tabs__trigger { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; min-height: 44px; font-size: var(--ds-font-size-sm);
  font-weight: 500; color: var(--ds-muted-foreground); border: 0; background: none; cursor: pointer; white-space: nowrap; border-bottom: 3px solid transparent; }
.tabs__trigger:hover { color: var(--ds-foreground); }
.tabs__trigger.active { color: var(--ds-foreground); font-weight: 600; border-bottom-color: var(--ds-primary); }
.tabs__trigger .badge { padding: 2px 6px; }
.tab-pane { display: none; padding: 16px 0 0; }
.tab-pane.active { display: block; }
.tabs--bordered > .tab-panes > .tab-pane { border: 1px solid var(--ds-border); border-top: 0; border-radius: 0 0 8px 8px; padding: 16px; }
@media (max-width: 991.98px) { .tabs__trigger .tabs__label { display: none; } .tabs__trigger i { font-size: 18px; } }

/* ---------- Detail layout ---------- */
.dl { display: flex; flex-direction: column; min-height: calc(100vh - var(--ds-header-height)); }
.dl__body { display: flex; flex: 1; min-height: 0; }
.dl__info { width: 200px; flex: none; border-right: 1px solid var(--ds-border); padding: 16px; overflow-y: auto; }
.dl__main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dl__nav { position: sticky; top: calc(var(--ds-header-height) + 61px); z-index: 50; background: #fff; padding: 0 24px; }
.dl__content { padding: 16px 24px; flex: 1; }
.dl__content > .tabs > .tab-panes > .tab-pane { padding: 8px 0 0; }
@media (max-width: 991.98px) { .dl__body { flex-direction: column; } .dl__info { width: auto; border-right: 0; border-bottom: 1px solid var(--ds-border); display: flex; flex-wrap: wrap; gap: 0 16px; } .dl__info .il { min-width: 140px; } }
.il { padding: 12px 0; border-bottom: 1px solid var(--ds-border); display: flex; flex-direction: column; gap: 2px; }
.il:last-child { border-bottom: 0; }
.il__k { font-size: var(--ds-font-size-xs); color: var(--ds-muted-foreground); text-transform: uppercase; letter-spacing: .02em; }
.il__v { font-weight: 500; font-size: var(--ds-font-size-sm); word-break: break-word; }

/* ---------- Dashboard ---------- */
.dash { display: flex; flex-direction: column; gap: 32px; padding: 24px 32px; }
.dash__section { display: flex; flex-direction: column; gap: 16px; }
.section-title { font-size: var(--ds-font-size-sm); font-weight: 600; color: var(--ds-muted-foreground); text-transform: uppercase; letter-spacing: .05em; }
.kpis { display: flex; flex-wrap: wrap; gap: 12px; }
.kpi { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border: 1px solid var(--ds-border); border-radius: var(--ds-radius-md);
  box-shadow: var(--ds-shadow-sm); min-width: 160px; background: #fff; text-align: left; font: inherit; color: inherit; }
button.kpi { cursor: pointer; } button.kpi:hover { border-color: var(--ds-primary); box-shadow: var(--ds-shadow-md); }
.kpi__icon { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 18px; flex: none; }
.kpi__value { font-size: var(--ds-font-size-3xl); font-weight: 700; line-height: 1; }
.kpi__label { font-size: var(--ds-font-size-sm); font-weight: 500; }
.kpi__sub { font-size: var(--ds-font-size-xs); color: var(--ds-muted-foreground); }
.kpi--red .kpi__icon { background: var(--ds-destructive-tint); color: var(--ds-destructive); } .kpi--red .kpi__value { color: var(--ds-destructive); }
.kpi--amber .kpi__icon { background: var(--ds-warning-tint); color: var(--ds-warning); } .kpi--amber .kpi__value { color: var(--ds-warning-text); }
.kpi--green .kpi__icon { background: var(--ds-success-tint); color: var(--ds-success); } .kpi--green .kpi__value { color: var(--ds-success); }
.kpi--blue .kpi__icon { background: var(--ds-info-tint); color: var(--ds-info); } .kpi--blue .kpi__value { color: var(--ds-info); }
.kpi--purple .kpi__icon { background: var(--ds-primary-tint); color: var(--ds-primary); } .kpi--purple .kpi__value { color: var(--ds-primary); }
.modules { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.mcard { border: 1px solid var(--ds-border); border-radius: var(--ds-radius-md); box-shadow: var(--ds-shadow-sm); background: #fff; display: flex; flex-direction: column; transition: all var(--ds-transition-fast); }
.mcard:hover { border-color: var(--ds-primary); box-shadow: var(--ds-shadow-md); transform: translateY(-1px); }
.mcard__head { display: flex; align-items: center; gap: 12px; padding: 16px; border-bottom: 1px solid var(--ds-border); }
.mcard__icon { width: 36px; height: 36px; border-radius: var(--ds-radius-md); background: var(--ds-primary-tint); color: var(--ds-primary); display: flex; align-items: center; justify-content: center; font-size: 18px; flex: none; }
.mcard__title { font-weight: 600; flex: 1; }
.mcard__badge { min-width: 24px; height: 24px; border-radius: 12px; font-size: var(--ds-font-size-xs); font-weight: 700; display: inline-flex; align-items: center; justify-content: center; padding: 0 6px; }
.mcard__badge--red { background: var(--ds-destructive-bg); color: var(--ds-destructive-text); }
.mcard__body { padding: 12px 16px; flex: 1; }
.mcard__stats { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: var(--ds-font-size-sm); }
.mcard__stats li { display: flex; align-items: center; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot--red { background: var(--ds-destructive); } .dot--amber { background: var(--ds-warning); } .dot--green { background: var(--ds-success); } .dot--muted { background: var(--ds-hover); } .dot--blue { background: var(--ds-info); }
.mcard__desc { font-size: var(--ds-font-size-sm); color: var(--ds-muted-foreground); margin: 0; }
.mcard__foot { border-top: 1px solid var(--ds-border); padding: 12px 16px; }
.mcard__open { border: 0; background: none; color: var(--ds-primary); font-weight: 500; font-size: var(--ds-font-size-sm); cursor: pointer; padding: 0; }
.watch { border: 1px solid var(--ds-border); border-radius: var(--ds-radius-md); box-shadow: var(--ds-shadow-sm); background: #fff; overflow: hidden; }
.watch__row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; width: 100%; border: 0; background: none; text-align: left; cursor: pointer; font: inherit; color: inherit; }
.watch__row + .watch__row { border-top: 1px solid var(--ds-border); }
.watch__row:hover { background: var(--ds-muted); }
.watch__ind { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.watch__row--critical .watch__ind { background: var(--ds-destructive); } .watch__row--warning .watch__ind { background: var(--ds-warning); } .watch__row--info .watch__ind { background: var(--ds-hover); }
.watch__content { flex: 1; min-width: 0; }
.watch__title { font-size: var(--ds-font-size-sm); font-weight: 500; }
.watch__sub { font-size: var(--ds-font-size-xs); color: var(--ds-muted-foreground); }
.watch__urg { font-size: var(--ds-font-size-xs); font-weight: 500; }
.watch__row--critical .watch__urg { color: var(--ds-destructive); } .watch__row--warning .watch__urg { color: var(--ds-warning-text); }
.alerts { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 768px) { .alerts { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1400px) { .alerts { grid-template-columns: 1fr 1fr 1fr; } }
.alert-card { border: 1px solid var(--ds-border); border-radius: var(--ds-radius-lg); box-shadow: var(--ds-shadow-sm); min-height: 200px; padding: 16px 16px 16px 19px; position: relative; background: #fff; }
.alert-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--ds-gradient-primary); border-radius: 8px 0 0 8px; }
.alert-card:hover { border-color: var(--ds-primary); box-shadow: var(--ds-shadow-md); }
.alert-card__name { font-weight: 700; font-size: var(--ds-font-size-sm); }
.alert-card__desc { font-size: var(--ds-font-size-xs); color: var(--ds-muted-foreground); margin-bottom: 12px; }
.alert-row { display: flex; align-items: center; gap: 16px; padding: 4px 8px; border-radius: var(--ds-radius-sm); margin-bottom: 6px; cursor: pointer; border: 1px solid transparent; }
.alert-row__val { font-size: var(--ds-font-size-xl); font-weight: 500; min-width: 2.5rem; text-align: center; }
.alert-row__name { font-size: var(--ds-font-size-sm); }
.alert-row--destructive { background: var(--ds-destructive-bg); border-color: var(--ds-destructive); color: var(--ds-destructive-text); }
.alert-row--warning { background: var(--ds-warning-bg); border-color: var(--ds-warning); color: var(--ds-warning-text); }
.alert-row--success { background: var(--ds-success-bg); border-color: var(--ds-success); color: var(--ds-success-text); }
.alert-row--info { background: var(--ds-info-bg); border-color: var(--ds-primary); color: var(--ds-primary); }
.alert-row--neutral { background: var(--ds-muted); border-color: var(--ds-border); color: var(--ds-muted-foreground); }
.stat-card { padding: 16px; border-radius: var(--ds-radius-xl); border: 1px solid var(--ds-border); box-shadow: var(--ds-shadow-sm); border-top: 3px solid var(--ds-primary); background: #fff; }
.stat-card__label { font-size: var(--ds-font-size-xs); text-transform: uppercase; font-weight: 600; color: var(--ds-muted-foreground); }
.stat-card__value { font-size: var(--ds-font-size-3xl); font-weight: 700; color: var(--ds-navy); }
.stat-card--red { border-top-color: var(--ds-destructive); } .stat-card--amber { border-top-color: var(--ds-warning); } .stat-card--green { border-top-color: var(--ds-success); } .stat-card--blue { border-top-color: var(--ds-info); }
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.panel { border: 1px solid var(--ds-border); border-radius: var(--ds-radius-lg); background: #fff; padding: 16px; }
.panel__title { font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }

/* ---------- Charts (simple SVG/CSS) ---------- */
.hbar { display: flex; flex-direction: column; gap: 8px; font-size: var(--ds-font-size-sm); }
.hbar__row { display: grid; grid-template-columns: 160px 1fr 48px; align-items: center; gap: 8px; }
.hbar__track { height: 12px; background: var(--ds-muted); border-radius: 6px; overflow: hidden; display: flex; }
.hbar__fill { height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: var(--ds-font-size-xs); color: var(--ds-muted-foreground); margin-top: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Modal / offcanvas ---------- */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1200; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: #fff; border-radius: var(--ds-radius-lg); box-shadow: var(--ds-shadow-xl); padding: 24px; width: 512px; max-width: 100%;
  max-height: 80dvh; display: flex; flex-direction: column; }
.modal--sm { width: 425px; } .modal--lg { width: 640px; height: 80dvh; } .modal--xl { width: 800px; height: 80dvh; } .modal--2xl { width: 1100px; height: 80dvh; }
.modal--auto { height: auto; }
.modal__head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.modal__iconbadge { width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 20px; flex: none; }
.modal__iconbadge--destructive { background: var(--ds-destructive-tint); color: var(--ds-destructive); }
.modal__iconbadge--warning { background: var(--ds-warning-tint); color: var(--ds-warning); }
.modal__titles { flex: 1; min-width: 0; }
.modal__title { font-size: var(--ds-font-size-2xl); font-weight: 600; }
.modal__desc { font-size: var(--ds-font-size-sm); color: var(--ds-muted-foreground); margin-top: 4px; }
.modal__close { width: 32px; height: 32px; border: 0; background: none; border-radius: var(--ds-radius-md); cursor: pointer; font-size: 18px; flex: none; }
.modal__close:hover { background: var(--ds-muted); }
.modal__body { flex: 1; overflow: auto; min-height: 0; display: flex; flex-direction: column; }
.modal__foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; flex-wrap: wrap; }
.modal__foot .spacer { flex: 1; }
.oc { position: fixed; top: 0; right: 0; bottom: 0; width: 540px; max-width: 100%; background: #fff; z-index: 1210; box-shadow: var(--ds-shadow-xl); display: flex; flex-direction: column; animation: ocin .2s ease; }
.oc--50 { width: 50%; } .oc--780 { width: 780px; }
@media (max-width: 991.98px) { .oc--50, .oc--780 { width: 100%; } }
.oc--bottom { top: auto; left: 0; width: 100%; max-height: 80vh; border-radius: 16px 16px 0 0; animation: ocup .2s ease; }
@keyframes ocin { from { transform: translateX(40px); opacity: 0; } }
@keyframes ocup { from { transform: translateY(40px); opacity: 0; } }
.oc__head { display: flex; align-items: center; gap: 8px; padding: 24px 24px 16px; }
.oc__title { font-size: var(--ds-font-size-2xl); font-weight: 600; flex: 1; }
.oc__body { padding: 0 24px 24px; overflow-y: auto; flex: 1; }
.oc__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 24px; border-top: 1px solid var(--ds-border); }
.oc-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1205; }

/* ---------- Stepper ---------- */
.stepper { display: flex; list-style: none; margin: 0; padding: 0; }
.stepper__item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative; min-width: 0; }
.stepper__item + .stepper__item::before { content: ''; position: absolute; top: 16px; right: 50%; width: 100%; height: 2px; background: var(--ds-border); z-index: 0; }
.stepper__item.complete + .stepper__item::before, .stepper__item.complete + .stepper__item.complete::before { background: var(--ds-success); }
.stepper__circle { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--ds-border); background: #fff; display: flex; align-items: center; justify-content: center;
  font-size: var(--ds-font-size-xs); font-weight: 600; position: relative; z-index: 1; color: var(--ds-muted-foreground); }
.stepper__item.complete .stepper__circle { background: var(--ds-success); border-color: var(--ds-success); color: #fff; }
.stepper__item.current .stepper__circle { border-color: var(--ds-primary); color: var(--ds-primary); box-shadow: 0 0 0 4px var(--ds-ring-focus); }
.stepper__label { font-size: var(--ds-font-size-xs); font-weight: 500; color: var(--ds-muted-foreground); text-align: center; }
.stepper__item.current .stepper__label { color: var(--ds-primary); }

/* ---------- Empty state / banner / toast ---------- */
.empty { max-width: 579px; min-height: 260px; margin: 24px auto; padding: 32px 16px; border: 1px dashed var(--ds-border); border-radius: var(--ds-radius-lg);
  background: var(--ds-muted); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; }
.empty__icon { width: 64px; height: 64px; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center; font-size: 24px; color: var(--ds-muted-foreground); margin-bottom: 8px; }
.empty__title { font-size: var(--ds-font-size-lg); font-weight: 600; }
.empty__desc { font-size: var(--ds-font-size-sm); color: var(--ds-muted-foreground); }
.banner { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: var(--ds-radius-md); font-size: var(--ds-font-size-sm); margin: 0 0 16px; }
.banner--info { background: var(--ds-info-tint); color: hsl(210,80%,35%); }
.banner--warning { background: var(--ds-warning-bg); color: var(--ds-warning-text); }
.banner--destructive { background: var(--ds-destructive-bg); color: var(--ds-destructive-text); }
.banner--primary { background: var(--ds-primary-tint); color: var(--ds-primary); }
.toasts { position: fixed; top: 72px; right: 16px; z-index: 1500; display: flex; flex-direction: column; gap: 8px; width: 420px; max-width: calc(100% - 32px); }
.toast { background: #fff; border: 1px solid var(--ds-border); border-left: 4px solid var(--ds-success); border-radius: var(--ds-radius-md); box-shadow: var(--ds-shadow-lg);
  padding: 12px 16px; font-size: var(--ds-font-size-sm); display: flex; gap: 10px; align-items: center; animation: ocin .2s ease; }
.toast--warning { border-left-color: var(--ds-warning); } .toast--destructive { border-left-color: var(--ds-destructive); } .toast--info { border-left-color: var(--ds-primary); }
.toast i { font-size: 18px; } .toast--success i { color: var(--ds-success); } .toast--warning i { color: var(--ds-warning); } .toast--destructive i { color: var(--ds-destructive); } .toast--info i { color: var(--ds-primary); }

/* ---------- Misc layout helpers ---------- */
.pad { padding: 16px 24px; }
.split { display: flex; gap: 16px; padding: 16px 24px; align-items: stretch; }
.split > * { min-width: 0; }
@media (max-width: 991.98px) { .split { flex-direction: column; } }
.stack { display: flex; flex-direction: column; gap: 16px; }
.inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.tree { list-style: none; padding-left: 0; margin: 0; font-size: var(--ds-font-size-sm); }
.tree ul { list-style: none; padding-left: 20px; margin: 0; }
.tree__node { display: flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: var(--ds-radius-sm); cursor: pointer; }
.tree__node:hover { background: var(--ds-muted); }
.tree__node.selected { background: var(--ds-primary-tint); color: var(--ds-primary); font-weight: 500; }
.tree__node.inaccessible { opacity: .5; }
.tree__toggle { width: 14px; font-size: 10px; color: var(--ds-muted-foreground); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: var(--ds-font-size-sm); }
.kv dt { color: var(--ds-muted-foreground); } .kv dd { margin: 0; font-weight: 500; }
.legacy-card { box-shadow: 3px 3px 3px #000033; border-radius: 4px; padding: 20px; min-height: 155px; position: relative; cursor: pointer; background: #fff; }
.status-cell { padding: 2px 8px; border-radius: 3px; display: inline-block; }
.cell-green { background: #107c41; color: #fff; } .cell-red { background: #e68e8c; color: #333; } .cell-yellow { background: #ffc67d; color: #333; }
.progress { height: 8px; background: var(--ds-muted); border-radius: 4px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--ds-primary); }
.coming-soon { display: inline-flex; align-items: center; gap: 6px; }
.raw-key { font-family: ui-monospace, monospace; font-size: .85em; }

/* ---------- Replica control (not part of AMOS) ---------- */
.replica { position: fixed; right: 16px; bottom: 16px; z-index: 1600; font-size: var(--ds-font-size-xs); }
.replica__btn { background: var(--ds-navy); color: #fff; border: 0; border-radius: var(--ds-radius-full); padding: 8px 14px; cursor: pointer; box-shadow: var(--ds-shadow-lg); display: flex; gap: 6px; align-items: center; }
.replica__panel { position: absolute; right: 0; bottom: 44px; width: 300px; background: #fff; border: 1px solid var(--ds-border); border-radius: var(--ds-radius-lg); box-shadow: var(--ds-shadow-xl); padding: 16px; display: none; }
.replica.open .replica__panel { display: block; }
.replica__panel h4 { font-size: var(--ds-font-size-sm); margin-bottom: 8px; }
.replica__panel p { margin: 6px 0; color: var(--ds-muted-foreground); }
.replica__seg { display: inline-flex; border: 1px solid var(--ds-border); border-radius: var(--ds-radius-md); overflow: hidden; }
.replica__seg button { border: 0; background: #fff; padding: 6px 14px; cursor: pointer; font-size: var(--ds-font-size-xs); }
.replica__seg button.on { background: var(--ds-primary); color: #fff; }
.note-chip { display: inline-flex; align-items: center; gap: 4px; font-size: var(--ds-font-size-2xs); text-transform: uppercase; letter-spacing: .04em; background: var(--ds-warning-bg); color: var(--ds-warning-text); border-radius: var(--ds-radius-full); padding: 2px 8px; font-weight: 600; }

/* ---------- Error pages inside the shell (amos-feature error-page, #10351/#10352) + detail state (#10158) ---------- */
.error-page { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.5rem; min-height: 60vh; height: 100%; padding: 2rem; text-align: center; }
.error-page .empty { margin: 0 auto; width: 100%; }
.empty__icon .fa-regular, .empty__icon .fa-solid { line-height: 1; }
.empty--error .empty__icon { background: var(--ds-destructive-bg); color: var(--ds-destructive); }
.detail-state__empty { display: flex; justify-content: center; padding: 24px 16px; }
.detail-state__empty .empty { margin: 0; width: 100%; }
/* DevExtreme-style broken validation rule on a batch-edited cell */
.grid td.cell-invalid { box-shadow: inset 0 0 0 1px var(--ds-destructive); background: var(--ds-destructive-tint); }
.grid td.cell-invalid .cell-err { display: block; font-size: var(--ds-font-size-xs); color: var(--ds-destructive); line-height: 1.3; }

/* ---------- attachments viewer (assets/js/attachments.js) ---------- */
.att-host { display: flex; flex-direction: column; flex: 1; min-height: 0; gap: var(--ds-space-3); }
.att-bar { display: flex; align-items: center; gap: var(--ds-space-2); font-size: var(--ds-font-size-sm); }
.att-bar .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-viewer { flex: 1; min-height: 0; overflow: auto; background: var(--ds-surface-bg); border-radius: var(--ds-radius-lg); padding: var(--ds-space-6); display: flex; flex-direction: column; align-items: center; }
.att-page { position: relative; width: 794px; max-width: 100%; min-height: 1060px; flex: none; background: var(--ds-background); color: var(--ds-foreground); box-shadow: var(--ds-shadow-md); padding: 56px 64px 72px; font-size: 13px; line-height: 1.55; overflow: hidden; }
.att-page > *:not(.att-page__wm) { position: relative; }
.att-page__wm { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 120px; font-weight: 700; letter-spacing: .1em; color: var(--ds-muted); transform: rotate(-35deg); pointer-events: none; user-select: none; }
.att-page__head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 1px solid var(--ds-border); padding-bottom: var(--ds-space-3); margin-bottom: var(--ds-space-6); font-size: var(--ds-font-size-xs); color: var(--ds-muted-foreground); }
.att-page__head b { display: block; color: var(--ds-navy); font-size: var(--ds-font-size-sm); }
.att-page h1 { font-size: var(--ds-font-size-2xl); font-weight: 700; color: var(--ds-navy); margin: 0; }
.att-page h2 { font-size: var(--ds-font-size-base); font-weight: 600; color: var(--ds-navy); margin: var(--ds-space-6) 0 var(--ds-space-2); }
.att-page p { margin: 0 0 var(--ds-space-3); }
.att-page ul, .att-page ol { margin: 0 0 var(--ds-space-3); padding-left: 20px; }
.att-page__sub { color: var(--ds-muted-foreground); }
.att-page__meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--ds-space-3) var(--ds-space-6); margin: var(--ds-space-4) 0 var(--ds-space-2); padding: var(--ds-space-4); border: 1px solid var(--ds-border); border-radius: var(--ds-radius-md); }
.att-page__meta dt { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--ds-muted-foreground); }
.att-page__meta dd { margin: 0; }
.att-page__table { width: 100%; border-collapse: collapse; margin: 0 0 var(--ds-space-3); }
.att-page__table th { background: var(--ds-muted); text-align: left; font-weight: 600; }
.att-page__table th, .att-page__table td { padding: 6px 8px; border-bottom: 1px solid var(--ds-border); }
.att-page__table .num { text-align: right; }
.att-page__totals { width: 280px; margin: 0 0 var(--ds-space-3) auto; }
.att-page__totals div { display: flex; justify-content: space-between; padding: 2px 0; }
.att-page__totals .grand { border-top: 1px solid var(--ds-foreground); font-weight: 700; margin-top: 4px; padding-top: 6px; }
.att-page__totals dd { margin: 0; }
.att-page__sign { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--ds-space-8); margin-top: 56px; font-size: var(--ds-font-size-xs); color: var(--ds-muted-foreground); }
.att-page__sign span { display: block; border-bottom: 1px solid var(--ds-foreground); margin-bottom: 4px; height: 32px; }
.att-page__foot { position: absolute !important; left: 64px; right: 64px; bottom: 28px; font-size: 10px; color: var(--ds-muted-foreground); border-top: 1px solid var(--ds-border); padding-top: 6px; }
.att-photo { margin: 0; max-width: 100%; }
.att-photo img { display: block; max-width: 100%; max-height: calc(80dvh - 220px); border-radius: var(--ds-radius-md); box-shadow: var(--ds-shadow-md); }
.att-frame { width: 100%; flex: 1; min-height: 60dvh; border: 0; background: var(--ds-background); }
.att-text { width: 100%; margin: 0; padding: var(--ds-space-4); background: var(--ds-background); white-space: pre-wrap; font-size: 12px; }
.att-drop { text-align: center; border: 1px dashed var(--ds-border); border-radius: var(--ds-radius-lg); padding: var(--ds-space-4); margin-bottom: var(--ds-space-4); }
.att-drop.over { border-color: var(--ds-primary); background: var(--ds-primary-tint); }
.att-drop p { margin: var(--ds-space-2) 0 0; }
.att-name { display: inline-flex; align-items: center; gap: 6px; }
.att-name .link { cursor: pointer; }
