/* Atrium components. One class family (.at-*), semantic tokens only.
   Values are taken from design/ledger-atrium-ui-direction-plan-20261019.html;
   the design class each block replaces is named in the comment above it.
   Legacy names `.btn`, `.btn.primary`, `.btn.sm` are accepted as aliases for
   .at-btn so server-rendered shell dialogs and old JS strings look right. */
@layer atrium.components {

  /* ===== Button  (design: .btn, .btn.primary) ============================= */
  .at-btn, .at-body .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    min-height: var(--at-control-h); padding: 8px 15px;
    background: var(--at-surface); color: var(--at-ink);
    border: 1px solid var(--at-line-btn); border-radius: var(--at-r-pill);
    font: 600 13px/1.6 var(--at-font-ui); text-decoration: none; white-space: nowrap;
    cursor: pointer;
    transition: background var(--at-t-fast), transform var(--at-t-fast), border-color var(--at-t-fast);
  }
  .at-btn:hover, .at-body .btn:hover { background: var(--at-surface-hover); }
  .at-btn:active, .at-body .btn:active { transform: scale(.98); }
  .at-btn--primary, .at-body .btn.primary {
    background: var(--at-accent-grad); border-color: var(--at-accent-line); color: var(--at-on-accent);
    box-shadow: var(--at-shadow-button);
  }
  .at-btn--primary:hover, .at-body .btn.primary:hover { background: var(--at-accent-grad-hover); }
  .at-btn--sm, .at-body .btn.sm { min-height: 32px; padding: 5px 12px; font-size: var(--at-fs-meta); }
  .at-btn--quiet { background: transparent; border-color: transparent; }
  .at-btn--quiet:hover { background: var(--at-surface-hover); }
  .at-btn--danger { color: var(--at-neg); border-color: var(--at-neg); background: transparent; }
  .at-btn--danger:hover { background: var(--at-error-bg); }
  .at-btn[disabled], .at-btn[aria-disabled="true"], .at-body .btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }
  .at-btn .at-icon, .at-btn svg { width: 16px; height: 16px; flex: none; }
  .at-btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
  .at-btn-row > .at-btn { max-width: 100%; }
  @media (max-width: 600px) { .at-btn-row > .at-btn { white-space: normal; text-align: center; border-radius: var(--at-r-card, 16px); } }

  /* ===== Close  (design: .apple-close, approved "02 Lingkaran lembut") ==== */
  .at-close, .at-body .arkha-close, .at-body .apple-close {
    display: inline-flex; align-items: center; justify-content: center; flex: 0 0 32px;
    width: 32px; height: 32px; min-width: 32px; min-height: 32px; padding: 0;
    background: var(--at-close-bg); color: var(--at-close-ink);
    border: 0; border-radius: 50%; box-shadow: none; font-size: 0; line-height: 1;
    transition: background var(--at-t-fast), color var(--at-t-fast);
  }
  .at-close:hover, .at-body .arkha-close:hover, .at-body .apple-close:hover { background: var(--at-close-bg-hover); color: var(--at-ink); }
  .at-close svg, .at-body .arkha-close svg { display: block; width: 14px; height: 14px; flex: none; }
  .at-close:focus-visible, .at-body .arkha-close:focus-visible, .at-body .apple-close:focus-visible { outline: 2px solid var(--at-accent, currentColor); outline-offset: 2px; }
  /* Legacy close buttons carry a text glyph; draw the X ourselves. */
  .at-body .arkha-close:not(:has(svg))::before, .at-body .arkha-close:not(:has(svg))::after {
    content: ""; position: absolute; width: 16px; height: 1.7px; border-radius: 2px; background: currentColor;
  }
  .at-body .arkha-close:not(:has(svg)) { position: relative; }
  .at-body .arkha-close:not(:has(svg))::before { transform: rotate(45deg); }
  .at-body .arkha-close:not(:has(svg))::after { transform: rotate(-45deg); }

  /* ===== Switch  (design: .toggle / .track, 200 ms glide) =================== */
  .at-switch {
    position: relative; display: inline-flex; gap: 4px; padding: 4px;
    background: var(--at-surface-track); border: 1px solid var(--at-line); border-radius: var(--at-r-pill);
  }
  .at-toolbar .at-switch { padding: 3px; border: 0; }
  @media (max-width: 600px) { .at-switch { max-width: 100%; overflow-x: auto; scrollbar-width: none; } .at-switch::-webkit-scrollbar { display: none; } }
  .at-switch > :is(button, a) {
    position: relative; z-index: 1; display: inline-flex; align-items: center; min-height: 32px;
    padding: 8px 16px; background: transparent; color: var(--at-ink-2);
    border: 0; border-radius: var(--at-r-pill); font: 400 13px/1.4 var(--at-font-ui); white-space: nowrap; text-decoration: none;
    cursor: pointer; transition: color var(--at-t-fast), background var(--at-t-fast);
  }
  .at-switch > :is([aria-pressed="true"], [aria-selected="true"], [aria-current="page"], .is-active) {
    background: var(--at-surface); color: var(--at-ink); box-shadow: 0 2px 4px #20291f0c;
  }
  .at-switch__track { display: none; }
  .at-switch[data-glide] > :is([aria-pressed="true"], [aria-selected="true"], [aria-current="page"], .is-active) { background: transparent; box-shadow: none; }
  .at-switch[data-glide] .at-switch__track {
    position: absolute; z-index: 0; display: block; top: 3px; bottom: 3px; left: 0;
    width: var(--at-track-w, 0); transform: translateX(var(--at-track-x, 0));
    background: var(--at-switch-active); box-shadow: inset 0 1px 0 #fff, 0 2px 5px #8d712712; border-radius: var(--at-r-pill);
    transition: transform var(--at-t-switch) var(--at-ease), width var(--at-t-switch) var(--at-ease);
  }

  /* ===== Tabs  (design: .g-tabs, underline) ================================ */
  .at-tabs { display: flex; gap: 20px; margin: 0 0 22px; border-bottom: 1px solid var(--at-line-tabs); overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
  .at-tabs::-webkit-scrollbar { display: none; }
  .at-tabs > :is(button, a) {
    flex: none; display: inline-flex; align-items: center; padding: 10px 0; min-height: 44px;
    background: none; color: var(--at-ink-tab); border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
    font: 400 15px/1.6 var(--at-font-ui); text-decoration: none; cursor: pointer;
  }
  .at-tabs > :is(button, a):hover { color: var(--at-ink); }
  .at-tabs > :is([aria-pressed="true"], [aria-selected="true"], [aria-current="page"], .is-active) { border-color: var(--at-tab-line); color: var(--at-ink); font-weight: 600; }
  .at-tabs span { margin-left: 6px; font-size: var(--at-fs-micro); color: var(--at-ink-2); }

  /* ===== Hint row / help entry  (design: .document-hint, .document-help-entry) */
  .at-hint { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin: -2px 0 24px; }
  .at-hint p { max-width: 68ch; font-size: var(--at-fs-meta); line-height: 1.6; color: var(--at-ink-2); }
  .at-help-entry {
    display: flex; align-items: center; gap: 10px; flex: none; padding: 10px 14px; text-align: left;
    background: var(--at-amber-soft); color: var(--at-attn-ink); border: 1px solid var(--at-line-card); border-radius: 12px; cursor: pointer;
  }
  .at-help-entry:hover { background: var(--at-attn-bg); }
  .at-help-entry strong { display: block; font-size: var(--at-fs-meta); font-weight: 600; }
  .at-help-entry small { display: block; margin-top: 2px; color: var(--at-ink-2); font-size: var(--at-fs-micro); }
  .at-instruction { padding: 18px 0 0; font-size: 13px; color: var(--at-ink-2); }
  .at-note { margin: 24px 0; padding: 20px 24px; background: var(--at-surface-note); border-radius: 12px; }
  .at-note p { font-size: var(--at-fs-table); }

  /* ===== Summary panel (action oriented)  (design: .g-banner, .brief) ====== */
  .at-summary {
    display: flex; align-items: center; gap: 18px; margin: 0 0 22px; padding: 18px 20px;
    background: var(--at-banner-bg);
    border-radius: 16px;
  }
  .at-summary strong { display: block; font: 700 17px/1.6 var(--at-font-display); }
  .at-summary p { font-size: var(--at-fs-table); color: var(--at-banner-ink); }
  .at-summary > .at-btn { margin-left: auto; }
  .at-summary__amount { min-width: 160px; padding-right: 24px; border-right: 1px solid var(--at-line); }
  .at-summary__amount small { display: block; }
  .at-summary__amount b { display: block; font: 600 25px/1.3 var(--at-font-display); letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
  .at-summary--brief {
    padding: 22px; border: 1px solid var(--at-edge); border-radius: 20px;
    background: radial-gradient(ellipse at 100% 0%, var(--at-glow-1), transparent 64%), linear-gradient(120deg, var(--at-amber-soft), var(--at-surface));
    box-shadow: var(--at-shadow-card);
  }

  .at-summary--brief { gap: 24px; margin-bottom: 18px; }
  .at-summary--brief strong { margin: 0 0 3px; font-size: 18px; line-height: 1.35; }
  .at-summary--brief p { font-size: 13px; }
  .at-summary--brief > div:not(.at-summary__amount) { min-width: 0; }
  .at-count {
    display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px;
    background: var(--at-ink); color: var(--at-surface); border-radius: var(--at-r-pill); font-size: 11px; line-height: 1; font-weight: 700;
  }

  /* ===== Card + board  (design: .g-card, .due-board, .due-next) ============ */
  .at-card {
    min-width: 0; padding: 22px; background: var(--at-surface-card);
    border: 1px solid var(--at-line-card); border-radius: var(--at-r-card);
  }
  .at-card h3, .at-card__title { margin: 0 0 8px; font: 700 15px/1.35 var(--at-font-display); }
  .at-board { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(310px, 1fr); gap: 16px; margin: 0 0 24px; }
  .at-board > .at-card { padding: 20px; background: linear-gradient(135deg, var(--at-surface), var(--at-surface-due)); border-color: var(--at-line-due); }
  .at-board--brief { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); margin-bottom: 0; }
  .at-board--brief + .at-toolbar { margin-top: 22px; }
  .at-board h3 { margin: 0 0 14px; }
  .at-line { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 12px 0; border-bottom: 1px solid var(--at-line-soft); font-size: 13px; }
  .at-line:last-child { border-bottom: 0; }
  .at-line small { display: block; }
  .at-line strong { font-variant-numeric: tabular-nums; }

  /* Action list row (design: .due-action) */
  .at-task { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--at-line-soft); }
  .at-task:last-child { border-bottom: 0; }
  .at-task__avatar {
    display: grid; place-items: center; flex: 0 0 34px; height: 34px; border-radius: 10px;
    background: var(--at-task-avatar-bg); color: var(--at-task-avatar-ink); font-size: 10px; line-height: 16px;
  }
  .at-task > div { min-width: 0; flex: 1; }
  .at-task strong, .at-task div > span, .at-task small { display: block; }
  .at-task strong { font-size: var(--at-fs-meta); font-weight: 600; line-height: 1.5; }
  .at-task div > span { margin-top: 3px; font-size: var(--at-fs-meta); color: var(--at-ink-2); }
  .at-task small { margin-top: 4px; font-size: var(--at-fs-micro); color: var(--at-ink-3); }
  .at-task .at-btn { flex: none; min-height: 32px; padding: 6px 12px; font-size: var(--at-fs-micro); }

  /* Flat bar chart (design: .bars + .barlabels): proportional columns, labels below */
  .at-bars-flat { display: flex; align-items: flex-end; gap: 10px; height: 76px; margin: 18px 0 8px; }
  .at-bars-flat > div { flex: 1; min-height: 10px; background: var(--at-surface-chip); border-radius: 6px 6px 2px 2px; }
  .at-bars-flat .at-bar--late { background: var(--at-bar-late); }
  .at-bars-flat .at-bar--soon { background: var(--at-accent); }
  .at-bars-flat .at-bar--later { background: var(--at-bar-later); }
  .at-bars-flat > .is-zero { min-height: 0; height: 0; background: transparent; border-bottom: 1px solid var(--at-line); border-radius: 0; }
  .at-bars-flat__labels { display: flex; justify-content: space-between; font-size: var(--at-fs-micro); color: var(--at-ink-2); }
  .at-link.at-link--plain { color: inherit; font-weight: 500; text-decoration: none; }
  .at-link.at-link--plain:hover, .at-link.at-link--plain:focus-visible { text-decoration: underline; text-underline-offset: 3px; }
  .at-table tr.is-clickable { cursor: pointer; }

  /* Compare-bar chart (design: .due-bars) */
  .at-bars-note { margin: 0 0 18px; font-size: var(--at-fs-meta); color: var(--at-ink-2); }
  .at-bars { display: grid; grid-template-columns: repeat(var(--at-bar-count, 3), minmax(0, 1fr)); gap: 10px; }
  .at-bar-col { min-width: 0; }
  .at-bar-col__value { display: block; margin-bottom: 6px; font-size: 10px; font-variant-numeric: tabular-nums; white-space: nowrap; }
  .at-bar-col__track { display: flex; align-items: flex-end; height: 76px; border-bottom: 1px solid var(--at-line); }
  .at-bar { width: 100%; border-radius: 5px 5px 0 0; background: var(--at-surface-chip); }
  .at-bar--late { background: var(--at-bar-late); }
  .at-bar--soon { background: var(--at-accent); }
  .at-bar--later { background: var(--at-bar-later); }
  .at-bar--unknown { background: var(--at-bar-unknown); }
  .at-bar-col > strong { display: block; margin-top: 8px; font-size: var(--at-fs-micro); font-weight: 500; }
  .at-bar-col > small { font-size: 10px; color: var(--at-ink-3); }
  .at-bars-date { display: block; margin-top: 14px; font-size: 10px; line-height: 1.5; color: var(--at-ink-3); }

  /* ===== Toolbar  (design: .g-tools) ======================================= */
  .at-toolbar { display: flex; align-items: center; gap: 12px; margin: 0 0 18px; flex-wrap: wrap; }
  .at-toolbar > .at-field, .at-toolbar > .at-select-slot { margin: 0; flex: 0 0 auto; min-width: 0; width: 168px; }
  .at-toolbar > .at-field > label { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
  .at-toolbar > .at-btn { height: var(--at-control-h); margin-block: 0; }
  .at-toolbar > label { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; min-height: var(--at-control-h); margin: 0; font-size: var(--at-fs-meta); white-space: nowrap; }
  .at-toolbar > .at-spacer { flex: 1 1 auto; }
  .at-toolbar > .at-btn:last-child:not(:first-child) { margin-left: 0; }
  .at-search { flex: 1 1 200px; min-width: 180px; }
  .at-search input, input.at-search, .at-input {
    width: 100%; min-height: var(--at-control-h); height: var(--at-control-h); padding: 8px 14px;
    background: var(--at-surface); color: var(--at-ink); border: 1px solid var(--at-line-search); border-radius: var(--at-r-field);
    font: 400 15px/1.4 var(--at-font-ui);
  }
  .at-search input::placeholder, .at-input::placeholder { color: var(--at-ink-3); opacity: 1; }
  .at-toolbar :is(input[type="month"], input[type="date"]) { width: 176px; flex: none; }
  .at-inline-field { display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto; min-height: var(--at-control-h); font-size: var(--at-fs-meta); white-space: nowrap; }
  .at-inline-field > input:not([type="checkbox"], [type="radio"]) { width: 176px; }
  .at-toolbar > .at-inline-field > :is(input[type="checkbox"], input[type="radio"]) { margin: 0; }
  .at-table--wide { min-width: 680px; }
  .at-toolbar :is(input[type="checkbox"], input[type="radio"]) { flex: 0 0 16px; width: 16px; height: 16px; min-width: 16px; min-height: 16px; padding: 0; margin: 0; accent-color: var(--at-check-accent-toolbar); }

  /* ===== Table  (design: .tablewrap / table / .g-table) ==================== */
  .at-table-wrap { overflow: auto; background: var(--at-surface); border: 1px solid var(--at-line); border-radius: var(--at-r-table); }
  .at-table { width: 100%; border-collapse: collapse; text-align: left; }
  .at-table th {
    padding: 12px 15px; background: var(--at-surface-sunk); color: var(--at-ink-2);
    font-size: var(--at-fs-meta); font-weight: 500; line-height: 1.6; white-space: nowrap;
  }
  .at-table td { padding: 12px 15px; font-size: var(--at-fs-table); line-height: 1.6; border-top: 1px solid var(--at-line-soft); vertical-align: middle; }
  .at-table tbody tr:hover { background: var(--at-surface-hover); }
  .at-table tr.is-selected { background: var(--at-surface-selected); }
  .at-table :is(td, th).is-num { text-align: right; font-variant-numeric: tabular-nums; }
  .at-table input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--at-check-accent-table); }
  .at-table .at-table__group td, .at-table tr.at-table__group > td, .at-table tr.at-table__group > th {
    background: var(--at-surface-group); font-weight: 600; color: var(--at-ink);
  }
  .at-table tr.at-table__group:hover { background: var(--at-surface-group); }
  .at-table tfoot td, .at-table tfoot th { font-weight: 700; border-top: 2px solid var(--at-line); background: var(--at-surface-sunk); color: var(--at-ink); }
  .at-table__sub { display: block; font-size: var(--at-fs-meta); color: var(--at-ink-2); }
  .at-table__empty td { padding: 32px 15px; text-align: center; color: var(--at-ink-2); }
  .at-table .at-link + .at-table__sub { margin-top: 2px; }
  .at-link {
    display: inline; padding: 3px 0; background: transparent; border: 0; color: var(--at-link);
    font: inherit; text-align: left; text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
  }
  .at-link:hover { text-decoration-thickness: 2px; }
  .at-link--static { text-decoration: none; cursor: default; color: var(--at-ink); }
  .at-link--static:hover { text-decoration: none; }
  .at-link--plain { text-decoration: none; }
  .at-table-foot { margin: 0; padding: 18px 0 0; font-size: 13px; line-height: 1.6; color: var(--at-ink-note); }
  .at-card__foot { margin-top: 6px; text-align: right; }

  /* Stacked rows on narrow screens (design: tabel lebar memakai kolom prioritas atau kartu berlabel) */
  @media (max-width: 640px) {
    .at-table--cards { min-width: 0; }
    .at-table--cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    .at-table--cards, .at-table--cards tbody, .at-table--cards tr, .at-table--cards td { display: block; width: 100%; }
    .at-table--cards tbody tr { padding: 12px 15px; border-top: 1px solid var(--at-line-soft); }
    .at-table--cards tbody tr:first-child { border-top: 0; }
    .at-table--cards td { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 4px 0; border: 0; text-align: right; }
    .at-table--cards td::before { content: attr(data-label); flex: none; color: var(--at-ink-2); font-size: var(--at-fs-meta); text-align: left; }
    .at-table--cards td.is-title { display: block; padding-bottom: 6px; text-align: left; }
    .at-table--cards td.is-title::before, .at-table--cards td.is-check::before { content: none; }
    .at-table--cards td.is-check { display: block; width: auto; float: right; padding: 0; }
    .at-table--cards .at-table__empty td { display: block; text-align: center; }
    .at-table--cards .at-table__empty td::before { content: none; }
  }
  .at-toolbar > .at-switch { max-width: 100%; overflow-x: auto; scrollbar-width: none; }

  /* ===== Badge  (design: .g-chip, .status, .tag) =========================== */
  .at-badge {
    display: inline-block; padding: 4px 8px; background: var(--at-surface-chip); color: var(--at-ink);
    border-radius: var(--at-r-pill); font-size: var(--at-fs-micro); line-height: 1.6; white-space: nowrap;
  }
  .at-badge--attn { background: var(--at-attn-bg); color: var(--at-attn-ink); }
  .at-badge--good { background: var(--at-good-bg); color: var(--at-good-ink); }
  .at-badge--bad { background: var(--at-bad-bg); color: var(--at-bad-ink); font-weight: 600; }
  .at-badge--info { background: var(--at-info-bg); color: var(--at-info-ink); }
  .at-badge--sq { border-radius: 5px; padding: 2px 7px; font-weight: 600; }

  /* ===== Fields  (design: .rf-field, .g-form, fieldset) ==================== */
  .at-field { margin: 0 0 16px; min-width: 0; }
  .at-field > label, .at-label { display: block; margin: 0 0 7px; font-size: 13px; font-weight: 600; line-height: 1.4; }
  .at-field :is(input:not([type="checkbox"], [type="radio"], [type="range"], [type="file"], [type="hidden"]), select) {
    display: block; width: 100%; min-height: var(--at-control-h); padding: 9px 14px;
    background: var(--at-surface); color: var(--at-ink); border: 1px solid var(--at-line-control); border-radius: var(--at-r-field);
    font: 400 var(--at-fs-body)/1.4 var(--at-font-ui);
  }
  .at-field textarea {
    display: block; width: 100%; min-height: 90px; padding: 10px 14px; resize: vertical;
    background: var(--at-surface); color: var(--at-ink); border: 1px solid var(--at-line-control); border-radius: var(--at-r-textarea);
    font: 400 var(--at-fs-body)/1.5 var(--at-font-ui);
  }
  .at-field :is(input, select, textarea):focus { border-color: var(--at-accent-line); box-shadow: 0 0 0 3px var(--at-focus-ring); outline: none; }
  .at-field :is(input, select, textarea)[aria-invalid="true"] { border-color: var(--at-neg); }
  .at-field input[type="file"] { width: 100%; padding: 10px; font-size: var(--at-fs-meta); }
  .at-field > small { display: block; margin-top: 6px; line-height: 1.5; }
  .at-field__error { margin-top: 6px; color: var(--at-error-ink); font-size: var(--at-fs-meta); }
  .at-field input.is-money, .at-input.is-money { text-align: right; font-variant-numeric: tabular-nums; }
  .at-check { display: flex; gap: 10px; align-items: center; margin: 16px 0; font-size: 13px; cursor: pointer; }
  .at-check input { flex: none; width: 17px; height: 17px; margin: 0; accent-color: var(--at-check-accent); }
  .at-fieldset { min-width: 0; margin: 0 0 22px; padding: 22px; background: var(--at-surface-fieldset); border: 1px solid var(--at-line-card); border-radius: var(--at-r-fieldset); }
  .at-fieldset > legend { padding: 0 8px; font: 650 15px/1.4 var(--at-font-display); }
  .at-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
  .at-fields--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
  .at-fields > .at-field { margin: 0; }
  .at-fields > .at-field > label { display: flex; align-items: flex-end; min-height: 2.8em; margin: 0 0 7px; }
  .at-fields > .at-field--full { grid-column: 1 / -1; }
  .at-error { color: var(--at-error-ink); font-size: 14px; }

  /* Attachment  (design: .ledger-attachment) */
  .at-attachment {
    display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 12px;
    background: var(--at-surface-card); border: 1px solid var(--at-line); border-radius: 14px; box-shadow: inset 0 1px 0 var(--at-edge);
  }
  .at-attachment__icon { display: grid; place-items: center; flex: 0 0 36px; height: 36px; border-radius: 10px; background: var(--at-surface-chip); color: var(--at-ink-2); }
  .at-attachment__copy { flex: 1; min-width: 0; display: grid; gap: 3px; }
  .at-attachment__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 500; }
  .at-attachment__meta { font-size: var(--at-fs-micro); color: var(--at-ink-3); }
  .at-attachment:focus-within { outline: 2px solid var(--at-focus); outline-offset: 3px; }
  .at-attachment__native { position: absolute !important; width: 1px !important; height: 1px !important; margin: -1px !important; padding: 0 !important; overflow: hidden !important; clip-path: inset(50%); border: 0 !important; }

  /* ===== Select  (design: .arkha-select-*, merged base + revision) ========= */
  .arkha-select { position: relative; display: inline-block; min-width: 0; vertical-align: middle; height: var(--arkha-select-height, auto); }
  .arkha-select > select.arkha-select-native { position: static !important; opacity: 0 !important; pointer-events: none !important; }
  .arkha-select-trigger {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px;
    width: 100%; min-width: 0; min-height: 0; height: 100%; padding: 8px 14px;
    background: var(--at-surface); color: var(--at-ink); border: 1px solid var(--at-line-control); border-radius: var(--at-r-field);
    font: 500 13px/1.35 var(--at-font-ui); text-align: left; cursor: pointer;
    transition: border-color var(--at-t-fast), box-shadow var(--at-t-fast);
  }
  .arkha-select-trigger:hover { border-color: var(--at-line-strong); }
  .arkha-select-trigger[aria-expanded="true"] { border-color: var(--at-accent-line); box-shadow: 0 0 0 3px var(--at-focus-ring-soft); }
  .arkha-select-trigger:disabled { opacity: .55; cursor: not-allowed; }
  .arkha-select-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .arkha-select-chevron { flex: 0 0 auto; width: 8px; height: 8px; margin: -4px 3px 0 0; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); }
  .arkha-select-menu {
    position: fixed; z-index: 2300; width: max-content; min-width: 180px; max-width: min(420px, calc(100vw - 20px)); max-height: min(300px, calc(100vh - 20px));
    overflow: auto; padding: 6px; background: var(--at-surface-menu); color: var(--at-ink);
    border: 1px solid var(--at-edge); border-radius: 16px; box-shadow: var(--at-shadow-menu);
    -webkit-backdrop-filter: blur(var(--at-blur)); backdrop-filter: blur(var(--at-blur));
    overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--at-line-strong) transparent;
    animation: at-select-in 150ms var(--at-ease);
  }
  .arkha-select-menu[hidden] { display: none; }
  .arkha-select-option {
    position: relative; display: block; width: 100%; min-height: 40px; padding: 9px 34px 9px 11px;
    background: transparent; color: var(--at-ink); border: 0; border-radius: 9px;
    font: 500 13px/1.4 var(--at-font-ui); text-align: left; cursor: pointer;
  }
  .arkha-select-option:hover, .arkha-select-option[aria-current="true"] { background: var(--at-surface-hover); }
  .arkha-select-option[aria-selected="true"] { background: var(--at-amber-active); color: var(--at-amber-active-ink); }
  .arkha-select-option[aria-selected="true"]::after { content: ""; position: absolute; right: 14px; top: 14px; width: 5px; height: 9px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
  .arkha-select-option:disabled { color: var(--at-ink-3); cursor: not-allowed; }
  .arkha-select-option:focus-visible { outline: 2px solid var(--at-focus); outline-offset: -3px; }
  .arkha-select-group { padding: 9px 11px 4px; color: var(--at-ink-3); font: 700 10px/1.3 var(--at-font-ui); }
  @keyframes at-select-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
  .at-toolbar .arkha-select, .at-field .arkha-select { display: block; width: 100%; margin: 0; }
  .at-toolbar .arkha-select-trigger { height: var(--at-control-h); }

  /* ===== Dialog and drawer  (design: .dialog, .drawer, .rf-compose-drawer) == */
  .at-dialog {
    width: calc(100% - 32px); max-width: 560px; padding: 0; color: var(--at-ink);
    background: var(--at-surface-dialog); border: 1px solid var(--at-edge); border-radius: var(--at-r-dialog); box-shadow: var(--at-shadow-dialog);
    -webkit-backdrop-filter: blur(var(--at-blur)); backdrop-filter: blur(var(--at-blur));
  }
  .at-dialog::backdrop { background: var(--at-scrim); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
  .at-dialog[open] { animation: at-appear 240ms var(--at-ease); }
  .at-dialog__head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 24px; border-bottom: 1px solid var(--at-line); flex-shrink: 0; }
  .at-dialog__head h2, .at-dialog__head h3 { margin: 0; font: 650 20px/1.35 var(--at-font-display); }
  .at-dialog__head small { display: block; margin-top: 2px; }
  .at-dialog__body { padding: 24px; font-size: var(--at-fs-body); overflow: auto; }
  .at-dialog__foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 18px 24px; background: var(--at-surface-foot); flex-shrink: 0; }
  .at-dialog__foot small { margin-right: auto; }
  .at-drawer {
    position: fixed; inset: 16px 16px 16px auto; width: min(520px, calc(100% - 32px)); max-width: none; max-height: calc(100dvh - 32px); margin: 0;
  }
  .at-drawer[open] { display: flex; flex-direction: column; animation: at-slide var(--at-t-drawer) var(--at-ease); }
  .at-drawer .at-dialog__body { flex: 1; min-height: 0; }
  .at-drawer--md { width: min(800px, 94vw); }
  .at-drawer--wide {
    width: min(1040px, 94vw); height: calc(100dvh - 24px); max-height: calc(100dvh - 24px);
    margin: 12px 12px 12px auto; inset: auto; right: 0; top: 0; border-radius: var(--at-r-drawer); overflow: hidden;
  }
  .at-drawer--wide { position: fixed; inset: 0 0 0 auto; }
  .at-drawer--wide[open] { animation: none; display: flex; flex-direction: column; }
  .at-drawer--wide .at-dialog__head, .at-drawer--wide .at-dialog__foot { padding: 18px 24px; }
  .at-drawer--wide .at-dialog__body { padding: 20px 24px; }
  .at-drawer--wide .at-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
  .at-totals {
    position: sticky; bottom: -20px; z-index: 2; display: flex; flex-wrap: wrap; gap: 12px 24px; margin-top: 16px; padding: 12px 16px;
    background: var(--at-surface-note); border: 1px solid var(--at-line-card); border-radius: 16px;
  }
  .at-totals > div { flex: 1; font-size: var(--at-fs-micro); white-space: nowrap; }
  .at-totals > div > :last-child { display: block; margin-top: 4px; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
  @keyframes at-appear { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
  @keyframes at-slide { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: translateX(0); } }

  /* Hit area of a small control (row checkbox) grown to 44 px without changing how it looks */
  .at-hit { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; margin: -14px; cursor: pointer; vertical-align: middle; }
  .at-hit > input { margin: 0; }

  /* ===== Floating action bar  (design: .g-float) =========================== */
  .at-float {
    position: fixed; z-index: 40; bottom: 24px; left: 50%; display: flex; align-items: center; gap: 10px;
    max-width: calc(100vw - 32px); padding: 9px 14px 9px 8px; transform: translateX(-50%);
    background: var(--at-surface-float); border: 1px solid var(--at-edge); border-radius: var(--at-r-pill); box-shadow: var(--at-shadow-float);
    -webkit-backdrop-filter: blur(22px); backdrop-filter: blur(22px); animation: at-bulk-in 180ms var(--at-ease);
  }
  .at-float[hidden] { display: none; }
  .at-float > strong { padding-right: 12px; font-size: 13px; white-space: nowrap; border-right: 1px solid var(--at-line); }
  .at-float .at-btn { white-space: nowrap; }
  .at-float .at-close { width: 38px; height: 38px; min-width: 38px; min-height: 38px; flex-basis: 38px; }
  @keyframes at-bulk-in { from { opacity: 0; translate: 0 8px; } to { opacity: 1; translate: 0 0; } }

  /* ===== Toast  (design: .toast) =========================================== */
  .at-toast {
    position: fixed; z-index: 3000; bottom: 25px; left: 50%; max-width: 90vw; padding: 14px 22px; transform: translateX(-50%);
    background: var(--at-toast-bg); color: var(--at-toast-ink); border: 1px solid var(--at-toast-line); border-radius: 12px; box-shadow: var(--at-shadow-menu); font-size: 14px;
    animation: at-appear 180ms var(--at-ease);
  }
  .at-toast[hidden] { display: none; }
  .at-toast--error { border-color: var(--at-neg); }

  /* ===== States (empty, loading, error, inline status) ===================== */
  .at-state { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 40px 24px; text-align: center; color: var(--at-ink-2); }
  .at-state strong { color: var(--at-ink); font-size: 15px; font-weight: 600; }
  .at-state p { max-width: 52ch; font-size: var(--at-fs-table); }
  .at-state--error strong { color: var(--at-error-ink); }
  .at-skeleton { display: block; height: 14px; border-radius: 7px; background: linear-gradient(90deg, var(--at-surface-chip), var(--at-surface-hover), var(--at-surface-chip)); background-size: 200% 100%; animation: at-shimmer 1.4s linear infinite; }
  .at-skeleton + .at-skeleton { margin-top: 12px; }
  @keyframes at-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
  .at-inline-state { display: inline-block; padding: 12px 16px; border-radius: 10px; font-size: 13px; background: var(--at-surface-chip); }
  .at-inline-state--ok { background: var(--at-good-bg); color: var(--at-good-ink); }
  .at-inline-state--warn { background: var(--at-attn-bg); color: var(--at-attn-ink); }
  .at-inline-state--error { background: var(--at-error-bg); color: var(--at-error-ink); }
  .at-status-line { min-height: 24px; margin-top: 14px; font-size: 13px; color: var(--at-ink-2); }

  /* ===== Detail blocks for drawers  (design: g-kpi, g-line, dl) ================= */
  .at-kpi { margin: 6px 0 16px; font: 650 30px/1.2 var(--at-font-display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
  .at-kpi-block { margin: 0 0 4px; }
  .at-dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; margin: 20px 0; }
  .at-dl > div { min-width: 0; }
  .at-dl > .is-wide { grid-column: 1 / -1; }
  .at-dl dt { font-size: var(--at-fs-meta); color: var(--at-ink-2); }
  .at-dl dd { margin: 2px 0 0; font-size: var(--at-fs-body); overflow-wrap: anywhere; }
  .at-section-title { margin: 20px 0 6px; font: 600 var(--at-fs-section)/1.4 var(--at-font-display); }
  .at-foot-extra { margin-right: auto; }
  .at-dialog__body > .at-switch { margin: 6px 0 14px; max-width: 100%; overflow-x: auto; }
  .num-neg { color: var(--at-neg); }

  /* ===== Item table for document editors  (design: .compact-items) ================ */
  .at-items-wrap { max-height: 430px; margin-bottom: 8px; overflow: auto; border: 1px solid var(--at-line); border-radius: var(--at-r-table); background: var(--at-surface); }
  .at-items { width: 100%; min-width: 700px; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: var(--at-fs-meta); }
  .at-items th { position: sticky; top: 0; z-index: 1; padding: 10px 8px; background: var(--at-surface-sunk); color: var(--at-ink-2); font-weight: 500; text-align: left; }
  .at-items td { padding: 4px 6px; border-bottom: 1px solid var(--at-line-soft); vertical-align: middle; }
  .at-items :is(input, select) {
    width: 100%; height: 32px; padding: 4px 6px; background: transparent; color: var(--at-ink);
    border: 1px solid transparent; border-radius: 7px; font: inherit; font-size: var(--at-fs-meta);
  }
  .at-items :is(input, select):is(:hover, :focus) { border-color: var(--at-line-control); background: var(--at-surface-hover); }
  .at-items .is-num { text-align: right; font-variant-numeric: tabular-nums; }
  .at-items .at-btn { min-height: 30px; padding: 4px 10px; }

  /* ===== Two-step indicator (Catat gaji, Bayar) ============================ */
  .at-stepper { display: flex; gap: 10px; margin: 0 0 16px; padding: 0; list-style: none; }
  .at-stepper li { display: flex; flex: 1; gap: 10px; align-items: center; min-width: 0; padding: 10px 12px; border: 1px solid var(--at-line-soft); border-radius: 10px; }
  .at-stepper li[aria-current="step"] { border-color: var(--at-ink); background: var(--at-surface-chip); }
  .at-stepper li[aria-disabled="true"] { opacity: .75; border-style: dashed; }
  .at-stepper b { display: block; font-size: 13px; }
  .at-stepper small { display: block; font-size: 12px; color: var(--at-ink-2); }
  .at-stepper__n { display: inline-grid; place-items: center; flex: none; width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid currentColor; font-size: 12px; font-weight: 700; }
  .at-stepper li[aria-current="step"] .at-stepper__n { background: var(--at-ink); color: var(--at-surface); border-color: var(--at-ink); }

  /* ===== Disclosure ======================================================== */
  .at-details { padding: 14px 0; border-top: 1px solid var(--at-line-soft); }
  .at-details > summary { margin-bottom: 12px; font-size: 13px; font-weight: 600; cursor: pointer; }

  /* ===== Row motion (240 ms enter, amber highlight that settles) =========== */
  .at-row-new { animation: at-row-in var(--at-t-row) var(--at-ease), at-row-light 1200ms ease-out; }
  .at-row-edited { animation: at-row-light 1200ms ease-out; }
  @keyframes at-row-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
  @keyframes at-row-light { 0%, 35% { background-color: var(--at-amber-highlight); } 100% { background-color: transparent; } }

  /* ===== Responsive ======================================================== */
  @media (max-width: 1000px) {
    .at-board { grid-template-columns: 1fr; }
  }
  @media (max-width: 850px) {
    .at-board { grid-template-columns: 1fr; }
    .at-bar-col__track { height: 90px; }
  }
  @media (max-width: 700px) {
    .at-summary { flex-wrap: wrap; gap: 14px; }
    .at-summary > .at-btn { margin-left: 0; }
    .at-summary__amount { border-right: 0; }
    .at-btn, .at-body .btn { min-height: 44px; }
    .at-btn--sm, .at-body .btn.sm { min-height: 44px; }
    .at-hint { align-items: flex-start; flex-direction: column; gap: 12px; }
    .at-toolbar { align-items: stretch; }
    .at-toolbar > .at-field, .at-toolbar > .at-select-slot { width: 160px; }
    .at-toolbar > .at-btn, .at-toolbar > label { min-height: 44px; height: 44px; }
    .at-toolbar > .at-btn { height: 44px; }
    .at-search { flex-basis: 220px; }
    .at-search input, input.at-search, .at-input, .at-field :is(input:not([type="checkbox"], [type="radio"], [type="range"], [type="file"]), select, textarea) { font-size: 16px; min-height: 44px; }
    .at-search input, input.at-search, .at-input { height: 44px; }
    .arkha-select-trigger { font-size: 16px; }
    .arkha-select { height: max(44px, var(--arkha-select-height, 44px)); }
    .arkha-select-option { min-height: 44px; }
    .at-toolbar .arkha-select-trigger { height: 44px; }
    .at-fields, .at-fields--3 { grid-template-columns: 1fr; }
    .at-fieldset { padding: 16px; }
    .at-tabs { gap: 18px; }
    .at-dialog { width: calc(100% - 16px); }
    .at-drawer, .at-drawer--md, .at-drawer--wide {
      inset: 0; width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0;
    }
    .at-dialog__body, .at-dialog__head, .at-dialog__foot { padding-left: 16px; padding-right: 16px; }
    .at-dialog__foot small { display: none; }
    .at-drawer--wide .at-fields { grid-template-columns: 1fr 1fr; }
    .at-float { border-radius: 22px; flex-wrap: wrap; justify-content: center; width: max-content; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }  /* no bottom nav in the Atrium shell: sit at the foot of the screen */
    .at-float .at-btn { min-height: 44px; }
    .at-card, .at-board > .at-card { padding: 16px; }
    .at-task .at-btn { min-height: 44px; }
    .at-table .at-link { display: inline-flex; align-items: center; min-height: 44px; }
    .at-group-toggle { min-height: 44px; }
    .at-switch > :is(button, a) { min-height: 44px; }
    .at-table-wrap { -webkit-overflow-scrolling: touch; }
  }
  @media (max-width: 480px) {
    .at-drawer--wide .at-fields { grid-template-columns: 1fr; }
    .at-fields > .at-field > label { min-height: 0; }
    .at-attachment { flex-wrap: wrap; }
  }
  @supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
    .at-dialog, .arkha-select-menu, .at-float { background: var(--at-surface); }
  }
  @media print {
    .at-float, .at-toast, .at-dialog, .at-drawer { display: none !important; }
  }
}
@layer atrium.components {
  /* Collapsible group row (Buku Besar and other grouped reports). */
  .at-group-toggle {
    display: inline-flex; align-items: center; gap: 8px; padding: 0; min-height: 24px; background: transparent; border: 0;
    color: inherit; font: inherit; font-weight: 600; text-align: left; cursor: pointer;
  }
  .at-group-toggle small { font-weight: 400; color: var(--at-ink-2); font-size: var(--at-fs-meta); }
  .at-group-toggle__chev { width: 7px; height: 7px; margin: -3px 2px 0 1px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); transition: transform var(--at-t-fast); }
  .at-group-toggle[aria-expanded="false"] .at-group-toggle__chev { transform: rotate(-45deg); margin-top: 0; }
  .at-table tr.at-row-collapsed { display: none; }
  @media (max-width: 700px) { .at-group-toggle { min-height: 44px; } }
}
@layer atrium.components {
  /* ===== Report table rows (Laba Rugi, Neraca, Arus Kas, Neraca Saldo) ====
     Group rows (.at-table__group + .at-group-toggle) carry the subtotal of their lines; detail rows indent;
     .at-table__total closes a statement. Design: tab "Laba Rugi" and "Neraca" in the module gallery. */
  .at-table tr.at-table__detail > :first-child { padding-left: 41px; color: var(--at-ink); }
  .at-table tr.at-table__detail > td { color: var(--at-ink); }
  .at-table tr.at-table__detail.is-muted > td { color: var(--at-ink-2); }
  .at-table tr.at-table__subtotal > * { font-weight: 600; border-top: 1px solid var(--at-line); background: var(--at-surface); }
  .at-table tr.at-table__total > * { font-weight: 700; border-top: 1px solid var(--at-line-strong); background: var(--at-amber-soft); color: var(--at-ink); }
  .at-table tr.at-table__total:hover { background: var(--at-amber-soft); }
  .at-code { display: inline-block; min-width: 56px; margin-right: 14px; font-family: var(--at-font-mono); font-size: var(--at-fs-meta); color: var(--at-ink-2); }
  .at-table tr.at-table__group > td:first-child .at-group-toggle small { margin-left: 2px; }
  .at-table td.is-num.is-neg, .at-table td.is-neg { color: var(--at-neg); }
  @media (max-width: 640px) {
    .at-table tr.at-table__detail > :first-child { padding-left: 24px; }
    .at-code { display: block; min-width: 0; margin: 0 0 1px; }
  }
}
@layer atrium.components {
  /* Spacing helpers for page templates (no local px values). */
  .at-mt { margin-top: 16px; }
  .at-mb { margin-bottom: 16px; }
  .at-pt0 { padding-top: 0; }
  .at-pt-s { padding-top: 8px; }
}
@layer atrium.components {
  /* ===== Insight page: hero, metric row, charts (Clarity by Arkha) ===}
     Design: galeri modul "Clarity by Arkha". Colours come from tokens only: previous period = chip grey,
     current = accent, investing = accent line. */
  .at-hero { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(250px, 1fr); gap: 32px; align-items: center; margin: 0 0 24px; padding: 24px 0 8px; }
  .at-hero__kicker { margin: 0 0 10px; font-size: var(--at-fs-meta); color: var(--at-ink-2); }
  .at-hero h2 { margin: 0 0 14px; font: 700 clamp(26px, 3vw, 38px)/1.14 var(--at-font-display); letter-spacing: -.03em; }
  .at-hero p { max-width: 62ch; font-size: var(--at-fs-body); line-height: 1.7; color: var(--at-banner-ink); }
  .at-hero__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
  .at-hero__focus { padding: 22px; border-radius: 18px; background: var(--at-banner-bg); }
  .at-hero__focus > strong { display: block; margin-bottom: 14px; font: 600 var(--at-fs-body)/1.4 var(--at-font-display); }
  .at-hero__focus > b { display: block; margin-bottom: 10px; color: var(--at-link); font: 700 22px/1.25 var(--at-font-display); letter-spacing: -.02em; }
  .at-hero__focus > p { font-size: var(--at-fs-table); line-height: 1.7; }
  .at-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0 0 28px; border-top: 1px solid var(--at-line); border-bottom: 1px solid var(--at-line); }
  .at-metrics > div { min-width: 0; padding: 22px 20px; border-left: 1px solid var(--at-line); }
  .at-metrics > div:first-child { padding-left: 0; border-left: 0; }
  .at-metrics small { display: block; font-size: var(--at-fs-meta); color: var(--at-ink-2); }
  /* Angka negatif berkurung ('Rp(100.065.391)') tidak boleh patah baris; ukuran menyesuaikan lebar kolom. */
  .at-metrics b { white-space: nowrap; }
  .at-metrics b { display: block; margin: 8px 0 10px; font: 700 clamp(22px, 2.4vw, 32px)/1.2 var(--at-font-display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
  .at-metrics b { font-size: clamp(17px, 1.8vw, 30px); }
  .at-metrics .is-up { color: var(--at-good-ink); }
  .at-metrics .is-down { color: var(--at-neg); }
  .at-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; margin: 0 0 28px; }
  .at-chart { min-width: 0; }
  .at-chart h3 { margin: 0 0 6px; font: 700 18px/1.35 var(--at-font-display); letter-spacing: -.01em; }
  .at-chart > p { font-size: var(--at-fs-meta); line-height: 1.6; color: var(--at-ink-2); }
  .at-legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 14px 0 18px; font-size: var(--at-fs-meta); color: var(--at-ink-2); }
  .at-legend i { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 3px; background: var(--at-surface-chip); }
  .at-legend i.is-now { background: var(--at-accent); }
  .at-colchart { display: flex; align-items: flex-end; justify-content: space-around; gap: 16px; height: 220px; padding-top: 22px; border-bottom: 1px solid var(--at-line); }
  .at-colchart__group { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; flex: 1; height: 100%; min-width: 0; }
  .at-colchart__bars { display: flex; align-items: flex-end; gap: 6px; width: 100%; flex: 1; justify-content: center; }
  .at-colchart__bar { position: relative; flex: 0 1 38px; min-height: 2px; border-radius: 6px 6px 0 0; background: var(--at-surface-chip); }
  .at-colchart__bar.is-now { background: var(--at-accent); }
  .at-colchart__bar > span { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); padding-bottom: 4px; font-size: var(--at-fs-micro); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
  .at-colchart__label { margin-top: 8px; font-size: var(--at-fs-meta); color: var(--at-ink-2); }
  .at-wf { display: block; width: 100%; height: auto; color: var(--at-ink); }
  .at-wf__axis { stroke: var(--at-line-strong); }
  .at-wf__bar { fill: var(--at-accent); }
  .at-wf__bar.is-base { fill: var(--at-surface-chip); }
  .at-wf__bar.is-alt { fill: var(--at-accent-line); }
  .at-wf text { fill: var(--at-ink); font-family: var(--at-font-ui); }
  .at-wf__cap { font-size: 10px; font-weight: 600; }
  .at-wf__name { font-size: 11px; fill: var(--at-ink-2); }
  @media (max-width: 900px) {
    .at-hero, .at-charts { grid-template-columns: minmax(0, 1fr); gap: 20px; }
    .at-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .at-metrics > div:nth-child(odd) { padding-left: 0; border-left: 0; }
    .at-metrics > div:nth-child(n+3) { border-top: 1px solid var(--at-line); }
  }
}
@layer atrium.components {
  .at-note--scroll { max-height: 280px; overflow: auto; white-space: pre-line; }
}
@layer atrium.components {
  /* ===== Narrow screens: item rows become cards, report tables breathe, links get a 44 px hit area ===== */
  @media (max-width: 640px) {
    .at-items-wrap { max-height: none; overflow: visible; border: 0; background: transparent; }
    .at-items--cards, .at-items--cards thead, .at-items--cards tbody, .at-items--cards tr, .at-items--cards td { display: block; width: 100%; min-width: 0; }
    .at-items--cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    .at-items--cards tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px 12px; margin: 0 0 12px; padding: 14px; background: var(--at-surface); border: 1px solid var(--at-line); border-radius: var(--at-r-table); }
    .at-items--cards td { padding: 0; border: 0; }
    .at-items--cards td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 4px; font-size: var(--at-fs-meta); color: var(--at-ink-2); }
    .at-items--cards td:first-child, .at-items--cards td:last-child { grid-column: 1 / -1; }
    .at-items--cards :is(input, select) { height: auto; min-height: 44px; padding: 8px 12px; font-size: 16px; border-color: var(--at-line-control); background: var(--at-surface); }
    .at-items--cards .at-btn { min-height: 44px; width: 100%; }
    .at-items--cards .arkha-select { width: 100%; min-height: 44px; }
    .at-items--cards .arkha-select-trigger { min-height: 44px; font-size: 16px; }
    .at-totals { position: static; }
  }
  @media (max-width: 480px) {
    .at-table--report { font-size: var(--at-fs-meta); }
    .at-table--report th { white-space: normal; padding: 10px 8px; }
    .at-table--report td { padding: 10px 8px; }
    .at-table--report tr.at-table__detail > :first-child { padding-left: 18px; }
    .at-table--report :is(td, th).is-num { min-width: 92px; }
  }
  @media (max-width: 700px), (pointer: coarse) {
    .at-link { padding-block: 13px; }
  }
}
@layer atrium.components {
  @media (max-width: 480px) {
    .at-toolbar > .at-inline-field { flex: 1 1 100%; }
    .at-toolbar > .at-inline-field > input:not([type="checkbox"], [type="radio"]) { flex: 1 1 auto; width: auto; min-width: 0; }
    .at-toolbar > .at-inline-field:has(> input[type="checkbox"]) { flex: 0 0 auto; }
  }
}

/* ===== Embedded page and checklist (jalur dokumen, 2026-10-25) ===========
   .at-frame: a detail or editor page shown inside a drawer (same-origin iframe, `?embed=1` / `?drawer=1`).
   .at-checklist: rows of "check + text + amount" for picking records inside a drawer. */
@layer atrium.components {
  .at-dialog__body--frame { display: flex; padding: 0; overflow: hidden; }
  .at-frame { display: block; flex: 1 1 auto; width: 100%; min-height: 60vh; height: 100%; border: 0; background: transparent; }
  .at-preview { display: block; max-width: 100%; max-height: 240px; margin: 12px 0; border: 1px solid var(--at-line); border-radius: var(--at-r-field); object-fit: contain; }
  .at-toolbar > .at-badge { align-self: center; }
  .at-card + .at-card, .at-table-wrap + .at-card, .at-btn-row + .at-card, .at-totals + .at-card { margin-top: 16px; }
  .at-card .at-btn-row, .at-card .at-table-wrap { margin-top: 12px; margin-bottom: 12px; }
  .at-card > p + .at-line, .at-card > .at-muted + strong { margin-top: 8px; }
  .at-frame--overlay { position: fixed; z-index: 3500; inset: 0; width: 100%; height: 100%; min-height: 0; }
  .at-help-entry-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 20px; }
  .at-help-entry-row > p { flex: 1 1 auto; min-width: 0; font-size: var(--at-fs-meta); }
  .at-help-entry-row .at-help-entry { flex: none; text-align: left; }
  @media (max-width: 700px) { .at-help-entry-row { flex-direction: column; align-items: stretch; } }
  .at-checklist { margin: 0 0 16px; border: 1px solid var(--at-line); border-radius: var(--at-r-field); overflow: hidden; }
  .at-checklist .at-check { margin: 0; padding: 12px 14px; border-top: 1px solid var(--at-line-soft); }
  .at-checklist .at-check:first-child { border-top: 0; }
  .at-checklist .at-check span { flex: 1 1 auto; min-width: 0; }
  .at-checklist .at-check b { flex: none; font-variant-numeric: tabular-nums; font-weight: 600; }
}

/* Aksi di dalam toast ("Lihat data") */
@layer atrium.components {
  .at-toast__action { margin-left: 8px; padding: 0; background: none; border: 0; color: inherit; font: 600 14px var(--at-font-ui); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
}

/* ===== Row actions: round kebab / view button + floating menu ============
   Same markup as templates/_row_actions.html (RowActions.menu / row_actions_menu). The legacy
   stylesheet that carries these rules is not loaded in Atrium mode, so this is the one Atrium copy. */
@layer atrium.components {
  .at-table td.is-actions { width: 56px; text-align: right; }
  .row-act, .row-view {
    box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; min-width: 32px; min-height: 32px; padding: 0; margin: 0;
    border: 1px solid var(--at-line); border-radius: 50%; background: transparent; color: var(--at-ink-2);
    font-family: inherit; cursor: pointer; vertical-align: middle; text-decoration: none;
    transition: background-color 140ms var(--at-ease), color 140ms, border-color 140ms;
  }
  .row-act svg { width: 18px; height: 18px; display: block; }
  .row-view svg { width: 15px; height: 15px; display: block; }
  .row-act:hover, .row-act[aria-expanded="true"], .row-view:hover { background: var(--at-amber-soft); border-color: var(--at-accent-line); color: var(--at-ink); }
  .row-act:focus-visible, .row-view:focus-visible { outline: 3px solid var(--at-focus); outline-offset: 2px; }
  .row-act-wrap { display: inline-flex; }
  .row-act-menu {
    position: fixed; z-index: 1300; min-width: 184px; max-width: min(280px, calc(100vw - 32px)); padding: 6px; box-sizing: border-box;
    display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--at-line); border-radius: 12px;
    background: var(--at-surface, #fff); box-shadow: 0 12px 32px #0002, 0 2px 6px #0001; text-align: left;
    animation: at-appear 160ms var(--at-ease);
  }
  .row-act-menu[hidden] { display: none; }
  .row-act-item {
    box-sizing: border-box; display: flex; align-items: center; width: 100%; min-height: 36px; padding: 0 12px; border: 0; border-radius: 8px;
    background: transparent; color: var(--at-ink); font: inherit; font-size: 12px; line-height: 1.3; text-align: left; text-decoration: none; white-space: nowrap; cursor: pointer;
  }
  .row-act-item:hover, .row-act-item:focus { background: var(--at-amber-soft); outline: none; }
  .row-act-item.danger { color: var(--at-error-ink); }
  @media (max-width: 620px), (pointer: coarse) { .row-act, .row-view { width: 40px; height: 40px; min-width: 40px; min-height: 40px; } .row-act-item { min-height: 44px; } }
  @media (prefers-reduced-motion: reduce) { .row-act, .row-view { transition: none; } .row-act-menu { animation: none; } }
}

/* Menu aksi baris dan toast sebagai popover manual (top layer) membutuhkan reset bawaan popover (inset:0, margin:auto). */
@layer atrium.components {
  .row-act-menu[popover] { inset: auto; margin: 0; }
  .at-toast[popover] { top: auto; right: auto; margin: 0; }
}
