/* Account screens reuse the site's typography and blue/white palette. */
.accounts-page { width: min(1080px, calc(100% - 2rem)); margin: 2rem auto 4rem; gap: 1rem; }
.accounts-page h1, .accounts-page h2 { color: #1e3a8a; }
.accounts-page h2 { font-size: 1.3rem; }
.accounts-page a { color: #1e3a8a; text-decoration: underline; }
.accounts-page .account-links { display: flex; flex-wrap: wrap; gap: 1rem; background: transparent; padding: 0; }
.account-panel { background: #fff; border: 1px solid #ddd; border-radius: 10px; padding: 1.25rem; display: flex; flex-direction: column; gap: .75rem; max-width: 36rem; }
.account-panel input:not([type="hidden"]):not([type="checkbox"]), .account-panel select { width: 100%; min-height: 44px; padding: .65rem; border: 1px solid #777; border-radius: 4px; font: inherit; }
.account-panel button { min-height: 44px; padding: .65rem 1rem; font: inherit; font-weight: 600; background: #1e3a8a; color: #fff; border: 1px solid #1e3a8a; border-radius: 4px; cursor: pointer; align-self: flex-start; }
.account-panel .secondary { color: #1e3a8a; background: #fff; }
.account-panel dt { font-weight: 600; }
.account-panel dd { margin-bottom: .75rem; overflow-wrap: anywhere; }
.account-message { border-left: 4px solid #1e3a8a; padding: .75rem 1rem; background: #eef3ff; }
.account-error { border-color: #a42020; color: #801919; background: #fff0f0; }
.account-table { position: relative; overflow-x: auto; background: #fff; border: 1px solid #ddd; border-radius: 6px; }
.account-table table { border-collapse: collapse; width: 100%; text-align: left; }
.mapping-table table { min-width: 720px; }
.api-account-table table { min-width: 560px; }
.account-table caption { text-align: left; font-weight: 600; padding: .75rem; }
.account-table th, .account-table td { padding: .75rem; border-top: 1px solid #ddd; overflow-wrap: anywhere; }
.account-table a { display: inline-block; min-height: 44px; padding: .5rem; }
.account-form-grid { display: grid; gap: 1rem; }
.account-sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.accounts-page :focus-visible { outline: 3px solid #2563eb; outline-offset: 3px; }
@media (min-width: 800px) { .account-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.account-roles { border: 1px solid #aaa; padding: .75rem; border-radius: 4px; }
.account-roles label { display: flex; align-items: center; gap: .75rem; min-height: 44px; }
.account-roles input { width: 20px; height: 20px; }
.account-panel textarea { width: 100%; min-height: 8rem; padding: .65rem; font: inherit; border: 1px solid #777; }

/* Admin records mirror the operations lists without importing its global shell. */
.admin-shell { --line:#d7e2ed; --ink:#183451; --muted:#526784; display:grid; grid-template-columns:15rem minmax(0,1fr); max-width:90rem; margin:0 auto; min-height:75vh; }
.admin-sidebar { background:#15181f; padding:.75rem 0; }
.admin-sidebar nav { display:flex; flex-direction:column; gap:0; background:transparent; padding:0; }
.admin-nav-group[open] { background:#20232b; }
.admin-nav-heading { display:flex; align-items:center; gap:.875rem; min-height:46px; margin:0; padding:.65rem 1rem; color:#d5d7df; cursor:pointer; list-style:none; font-size:.9rem; font-weight:500; line-height:1.4; }
.admin-nav-heading::-webkit-details-marker { display:none; }
.admin-nav-heading svg { width:1rem; height:1rem; flex:none; }
.admin-nav-heading span { flex:1; }
.admin-nav-heading .admin-nav-chevron { width:.8rem; height:.8rem; transform:rotate(90deg); }
.admin-nav-group[open] .admin-nav-chevron { transform:rotate(0); }
.admin-nav-heading:hover { background:#2b2f39; color:white; }
.admin-nav-submenu { margin:0; padding:0 0 .25rem; list-style:none; }
.admin-nav-link { display:flex; align-items:center; min-height:44px; padding:.5rem 1rem .5rem 2.875rem; color:#d5d7df; text-decoration:none; font-size:.85rem; line-height:1.4; }
.admin-nav-link:hover { background:#30343e; color:white; }
.admin-nav-link.is-active { background:#44474f; color:white; }
.admin-nav-heading:focus-visible,.admin-nav-link:focus-visible { outline:2px solid #92c5ff; outline-offset:-2px; }
.accounts-page.admin-content { width:auto; min-width:0; margin:0; padding:2rem clamp(1rem,3vw,2.5rem) 3rem; color:var(--ink); }
#main-content.admin-content { min-height:75vh; }
.records-heading { display:flex; justify-content:space-between; align-items:center; gap:1rem; margin-bottom:1rem; }
.records-heading h1 { margin:0; font-size:clamp(1.6rem,3vw,2rem); }
.records-heading p { color:var(--muted); }
.accounts-page .button-link { display:inline-flex; align-items:center; justify-content:center; flex:none; min-height:44px; background:#1269e7; color:white; padding:.6rem 1rem; border-radius:.4rem; text-decoration:none; font-weight:600; }
.records-filter { background:white; border:1px solid var(--line); border-radius:.6rem; margin:0 0 1rem; }
.records-filter summary { cursor:pointer; padding:.85rem 1.2rem; font-weight:700; }
.records-filter[open] summary { border-bottom:1px solid var(--line); }
.records-filter-form { padding:1rem 1.2rem; display:flex; flex-wrap:wrap; align-items:center; gap:.65rem; }
.records-filter-form input,.records-filter-form select { min-height:44px; min-width:0; padding:.5rem; font:inherit; border:1px solid #77899f; border-radius:.3rem; }
.records-filter-form button { min-height:44px; padding:.5rem .8rem; font:inherit; border:1px solid #77899f; background:white; border-radius:.3rem; cursor:pointer; }
.account-table.records-list { border-color:var(--line); border-radius:.6rem; }
.records-list caption { padding:1rem 1.2rem; font-size:.85rem; color:var(--muted); }
.records-list th,.records-list td { padding:.85rem 1rem; border-color:var(--line); font-size:.86rem; }
.records-list thead th { background:#f5f8fc; color:#526784; font-size:.75rem; }
.records-list tbody tr[data-record-href] { cursor:pointer; }
.records-list tbody tr[data-record-href]:hover { background:#f5f8fc; }
.accounts-page .record-icon-action { display:inline-flex; align-items:center; justify-content:center; width:44px; height:44px; min-height:44px; padding:.5rem; border:1px solid #c9d7e7; border-radius:.4rem; color:#164d87; text-decoration:none; background:white; }
.record-icon-action svg { width:24px; height:24px; fill:none; stroke:currentColor; stroke-width:1.5; }
.record-dialog { width:min(59rem,calc(100% - 1.5rem)); max-height:92dvh; padding:0; margin:auto; overflow:auto; border:1px solid #d7e2ed; border-radius:.75rem; color:#183451; background:white; box-shadow:0 22px 80px #0c203b40; }
.record-dialog::backdrop { background:#0c1c309e; }
.record-dialog-head { display:flex; justify-content:space-between; align-items:start; gap:1rem; padding:1.1rem 1.4rem; border-bottom:1px solid #d7e2ed; background:white; }
.record-dialog-head h2 { margin:0; font-size:1.2rem; }
.record-dialog-head p { font-size:.85rem; color:#526784; }
.accounts-page .record-dialog-close { display:flex; align-items:center; justify-content:center; min-width:44px; min-height:44px; border:1px solid #c9d7e7; border-radius:.4rem; font-size:1.4rem; text-decoration:none; }
.record-dialog-body { padding:1.2rem 1.4rem; }
.record-dialog .account-panel { max-width:none; margin-bottom:1rem; }
.record-dialog-actions { display:flex; align-items:center; justify-content:flex-end; gap:1rem; margin-top:1rem; }
.record-dialog-actions a { min-height:44px; display:inline-flex; align-items:center; }
.exchange-rate-panel { margin-top:1.5rem; }
/* Only the mapping body scrolls; its header and submit controls stay in view. */
.mapping-dialog[open] { display:flex; flex-direction:column; position:fixed; inset:0; width:min(56rem,calc(100% - 2rem)); height:min(46rem,calc(100dvh - 2rem)); max-height:calc(100dvh - 2rem); margin:auto; overflow:hidden; }
.mapping-dialog .record-dialog-head { position:static; flex:none; padding:.65rem 1rem; }
.mapping-dialog .record-dialog-body { flex:1; min-height:0; padding:.75rem 1rem; overflow:auto; overscroll-behavior:contain; }
.mapping-dialog .mapping-editor { margin:0; gap:.5rem; font-size:.9rem; }
.mapping-dialog-footer { display:flex; justify-content:flex-end; align-items:center; flex:none; gap:.75rem; padding:.65rem 1rem; background:white; border-top:1px solid #d7e2ed; }
.mapping-dialog-footer a { display:inline-flex; align-items:center; min-height:44px; padding:.4rem .75rem; }
.mapping-dialog-footer button { min-height:44px; padding:.5rem 1rem; border:1px solid #1e3a8a; border-radius:4px; background:#1e3a8a; color:white; font:inherit; font-weight:600; cursor:pointer; }
.mapping-guide { font-size:.85rem; color:#526784; }
.mapping-guide summary { min-height:36px; display:list-item; margin-left:1rem; padding:.35rem 0; cursor:pointer; color:#164d87; }
.mapping-guide p { margin:.4rem 0; }
.mapping-scope-note { color:#526784; font-size:.8rem; margin:0; }
.mapping-dialog .mapping-basics { grid-template-columns:repeat(3,minmax(0,1fr)); gap:.5rem .75rem; }
.mapping-dialog .mapping-basics > div:first-child { grid-column:1/-1; }
.mapping-dialog .mapping-basics > div { gap:.2rem; }
.mapping-dialog .mapping-column-head,.mapping-dialog .mapping-field { grid-template-columns:7.5rem minmax(0,1fr) minmax(0,1fr); gap:.6rem; padding:.55rem 0; }
.mapping-dialog .mapping-column-head { padding:.5rem; font-size:.82rem; }
.mapping-dialog .mapping-field h3 { font-size:.9rem; }
.mapping-dialog .mapping-editor input:not([type=hidden]):not([type=checkbox]),.mapping-dialog .mapping-editor select,.mapping-dialog .mapping-editor textarea { min-height:40px; padding:.4rem .5rem; font:inherit; line-height:1.4; border-radius:4px; }
.mapping-dialog .mapping-editor textarea { min-height:40px; max-height:8rem; }
.mapping-dialog .mapping-priority { margin-top:.25rem; }
.mapping-dialog .mapping-priority summary { min-height:36px; font-size:.8rem; }
@media(max-width:44rem) {
  .mapping-dialog[open] { width:calc(100% - 1rem); height:calc(100dvh - 1rem); max-height:calc(100dvh - 1rem); border-radius:.6rem; margin:auto; }
  .mapping-dialog .record-dialog-head,.mapping-dialog .record-dialog-body,.mapping-dialog-footer { padding:.65rem .75rem; }
  .mapping-dialog .mapping-basics { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .mapping-dialog .mapping-field { grid-template-columns:minmax(0,1fr); gap:.35rem; }
  .mapping-dialog .mapping-editor input:not([type=hidden]):not([type=checkbox]),.mapping-dialog .mapping-editor select,.mapping-dialog .mapping-editor textarea,.mapping-dialog .mapping-priority summary { min-height:44px; }
}
.mapping-editor { border:0; padding:0; }
.mapping-basics { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:1rem; }
.mapping-basics label { display:grid; gap:.35rem; }
.mapping-column-head,.mapping-field { display:grid; grid-template-columns:8rem minmax(0,1fr) minmax(0,1fr); gap:1rem; padding:1rem 0; border-bottom:1px solid #d7e2ed; }
.mapping-column-head { font-weight:700; background:#f5f8fc; padding:1rem .5rem; }
.mapping-field h3 { font-size:1rem; margin:0; }
.mapping-field label:not(.account-sr-only) { display:block; margin-top:.5rem; font-size:.85rem; }
.mapping-field [data-condition-value],.mapping-field [data-action-value] { margin-top:.5rem; }
.mapping-field textarea { min-height:4.5rem; resize:vertical; }
.mapping-field input:disabled,.mapping-field textarea:disabled { background:#f3f5f8; color:#526784; }
.mapping-priority { margin-top:.6rem; font-size:.85rem; }
.mapping-priority summary { cursor:pointer; min-height:44px; display:flex; align-items:center; color:#164d87; }
.mapping-priority [data-priority-options] { max-height:13rem; overflow:auto; }
.mapping-priority label { display:flex!important; align-items:center; gap:.5rem; min-height:44px; }
.mapping-priority input[type=checkbox] { flex:none; width:20px; height:20px; }
.admin-shell [hidden] { display:none!important; }
.admin-content :focus-visible { outline:3px solid #1269e7; outline-offset:3px; }
@media(max-width:44rem) {
  .admin-shell { grid-template-columns:minmax(0,1fr); }
  .accounts-page.admin-content { padding:1.2rem .75rem 2rem; }
  .records-heading { flex-direction:column; align-items:start; }
  .records-heading h1 { font-size:1.5rem; }
  .records-filter-form { display:grid; grid-template-columns:1fr; padding:.75rem; }
  .record-dialog { width:100%; max-width:none; height:100dvh; max-height:100dvh; border-radius:0; margin:0; }
  .record-dialog-body,.record-dialog-head { padding:1rem; }
  .mapping-basics { grid-template-columns:1fr; }
  .mapping-column-head { display:none; }
  .mapping-field { grid-template-columns:minmax(0,1fr); gap:.65rem; }
  .mapping-field h3 { color:#164d87; }
  .record-dialog-actions { flex-direction:column-reverse; align-items:stretch; }
  .record-dialog-actions button { width:100%; align-self:stretch; }
}

.mapping-field { min-width:0; border:0; border-bottom:1px solid #d7e2ed; }
.records-list table { min-width:35rem; }

.mapping-basics > div { display:grid; gap:.35rem; }

.record-dialog-head { position:sticky; top:0; z-index:2; }

.record-actions { display:inline-flex; align-items:center; gap:.35rem; }
.record-action { white-space:nowrap; }
.records-pagination { display:flex; flex-wrap:wrap; justify-content:space-between; align-items:center; gap:.75rem; margin-top:1rem; color:var(--muted); font-size:.85rem; }
.records-pagination p { margin:0; }
.records-pagination > div { display:flex; gap:.5rem; }
.accounts-page .records-pagination a { display:inline-flex; align-items:center; justify-content:center; min-height:44px; padding:.5rem .8rem; border:1px solid #c9d7e7; border-radius:.4rem; background:white; text-decoration:none; }
.records-pagination a[aria-disabled="true"] { color:#526784; background:#f3f5f8; cursor:default; }
.accounts-page .record-icon-action.is-danger { color:#9a2e29; }
.accounts-page .record-icon-action.is-danger:hover { background:#fcefed; }
.accounts-page .record-icon-action:disabled { opacity:.45; cursor:not-allowed; }
.record-delete-dialog { width:min(30rem,calc(100% - 1.5rem)); max-height:90dvh; margin:auto; padding:1.4rem; overflow:auto; border:1px solid #d7e2ed; border-radius:.65rem; color:#183451; background:white; box-shadow:0 22px 80px #0c203b40; }
.record-delete-dialog::backdrop { background:#0c1c309e; }
.record-delete-dialog h2 { margin:0 0 .5rem; font-size:1.3rem; }
.record-delete-dialog p { margin:.5rem 0; overflow-wrap:anywhere; }
.record-delete-dialog .account-panel { border:0; padding:0; margin:0; }
.record-delete-dialog .account-panel .is-danger { background:#9a2e29; border-color:#9a2e29; }
.mapping-table tbody th { min-width:20rem; max-width:40rem; font-weight:600; }
/* Keep the fixed metadata readable; the table container handles narrow screens. */
.mapping-table td { white-space:nowrap; }
