/* HSE ONE / STAGING – UI Foundation 1.0
   Tokens, type scale, components, RTL, states and responsive layouts.
   Adapted from design-system principles (not dependent on Figma or paid plugins).
   Scope: CSS only; unchanged app RPCs, permissions and data structures. */
:root{
  --ink:#17343c; --muted:#52666f; --teal:#087d70; --teal-deep:#075c53;
  --bg:#f3f7f8; --line:#d9e5e7; --white:#fff; --soft:#edf7f4;
  --amber:#946323; --red:#a1333d;
  --shadow:0 3px 12px rgba(17,53,62,.035),0 16px 42px rgba(17,53,62,.045);
  --ds-primary:#087d70; --ds-primary-hover:#075c53;
  --ds-on-primary:#ffffff; --ds-sidebar:#102f37; --ds-sidebar-text:#bfd5d7;
  --ds-surface:#ffffff; --ds-surface-raised:#ffffff; --ds-surface-subtle:#f6faf9;
  --ds-text:#17343c; --ds-text-muted:#52666f; --ds-border:#d9e5e7;
  --ds-danger:#a1333d; --ds-danger-surface:#fff1f0;
  --ds-warning:#946323; --ds-warning-surface:#fff6e7;
  --ds-success:#12665d; --ds-success-surface:#e8f6f3;
  --ds-space-1:4px; --ds-space-2:8px; --ds-space-3:12px;
  --ds-space-4:16px; --ds-space-5:20px; --ds-space-6:24px;
  --ds-space-8:32px; --ds-space-10:40px;
  --ds-radius-sm:9px; --ds-radius-md:13px; --ds-radius-lg:18px; --ds-radius-xl:22px;
  --ds-focus:0 0 0 3px #087d7033; --ds-motion:.16s ease;
}
html{scroll-behavior:smooth;scroll-padding-top:88px}
body{font-size:15px;line-height:1.75;color:var(--ds-text);background:var(--bg);font-feature-settings:"kern";-webkit-font-smoothing:antialiased}
button,input,select,textarea{font:inherit}
button,a,.module-card{transition:background-color var(--ds-motion),border-color var(--ds-motion),box-shadow var(--ds-motion),color var(--ds-motion)}
:where(button,a,input,select,textarea,[tabindex]):focus-visible{
  outline:3px solid #087d70;outline-offset:3px
}
:where(button,.button,input,select,textarea)[disabled]{cursor:not-allowed;opacity:.55}
:where(button,a){touch-action:manipulation}
::selection{background:#caeee5;color:#113d38}

/* App shell: legible navigation, consistent spacing, calmer corporate appearance */
.sidebar{width:258px;padding:24px 14px 18px;background:var(--ds-sidebar);box-shadow:-2px 0 16px rgba(17,47,55,.06)}
.brand{padding:4px 9px 22px;margin-bottom:14px;border-bottom:1px solid #36545b}
.brand-logo{width:45px;height:45px;border-radius:14px;background:#168b7d}
.brand strong{font-size:21px;line-height:1.25}
.brand small{font-size:11px;line-height:1.7;color:#bfd5d7}
.side-caption{font-size:12px;padding:6px 12px 10px;color:#c3d7d9;font-weight:600}
.sidebar nav{gap:4px;scrollbar-width:thin;scrollbar-color:#45656b transparent}
.nav-link{font-size:14px;line-height:1.6;min-height:48px;padding:11px 12px;border-radius:11px;color:var(--ds-sidebar-text)}
.nav-link:hover,.nav-link:focus-visible{background:#254b51;color:#fff}
.nav-link.active{background:#215d59;color:#fff;box-shadow:inset -4px 0 0 #67d5c2}
.nav-icon{width:24px;flex-shrink:0;font-size:18px}
.side-bottom{font-size:12px;line-height:1.6;min-height:58px;margin-top:auto}
.topbar{height:74px;min-height:74px;padding:0 30px;gap:12px;box-shadow:0 1px 0 rgba(17,54,62,.025)}
.heading-path{font-size:13px;gap:10px;min-width:0}
.heading-path strong{font-size:15px;color:var(--ink)}
.pilot-mark{font-size:12px;border-radius:999px;padding:7px 13px;color:#86591c;background:#fff5e8;border-color:#ecd7b9;white-space:nowrap}
.user-chip{font-size:13px;border:1px solid #e0ebe9;color:#34545b;background:#f0f7f5;border-radius:999px}
.icon{width:44px;height:44px;min-width:44px;border-radius:12px;flex-shrink:0}
.icon:hover{background:var(--ds-surface-subtle);border-color:#aedbd1}
.page{max-width:1480px;padding:30px 32px 50px}
.eyebrow{font-size:12px;letter-spacing:1.1px;color:var(--teal-deep)}
.page-title{font-size:clamp(23px,2.25vw,30px);font-weight:800;line-height:1.48;letter-spacing:-.3px;margin:4px 0}
.subhead{font-size:14px;line-height:1.9;max-width:850px;color:var(--muted)}
.headrow{margin-bottom:24px;gap:16px}
.headrow>.button{flex-shrink:0}
.panel{border:1px solid var(--line);border-radius:var(--ds-radius-xl);box-shadow:var(--shadow);padding:24px}
.section-row{margin:30px 0 15px}
.section-row h2,.panel h2{font-size:17px;line-height:1.6}
.section-row a{font-size:13px}

/* Metric and activity components – stronger labels and clearer numbers */
.grid-cards{gap:14px}
.kpi{border-radius:var(--ds-radius-lg);padding:18px 20px;min-height:134px;display:flex;flex-direction:column;align-items:flex-start;gap:5px;box-shadow:0 1px 4px rgba(17,53,62,.02)}
.kpi-icon{width:42px;height:42px;margin-bottom:8px;border-radius:13px;color:var(--teal-deep)}
.kpi-label{font-size:13px;line-height:1.6;font-weight:700;color:var(--muted)}
.kpi strong{font-size:clamp(24px,2.4vw,33px);font-variant-numeric:tabular-nums;line-height:1.35;margin-top:2px;letter-spacing:0;color:#163741}
.kpi small,.kpi .hint{font-size:12px;line-height:1.85;margin-top:auto}
.modules{gap:14px}
.module-card{min-height:112px;padding:20px;border-radius:var(--ds-radius-lg);border-color:var(--ds-border);align-items:flex-start;box-shadow:0 2px 5px rgba(16,46,53,.02)}
.module-card:hover,.module-card:focus-visible{transform:translateY(-1px);border-color:#86cabb;box-shadow:0 9px 24px rgba(17,74,68,.075)}
.module-icon{min-width:48px;width:48px;height:48px;border-radius:13px}
.module-card strong{font-size:15px;line-height:1.6}
.module-card small{font-size:12px;line-height:1.9;color:var(--muted)}

/* Interactions: one height and predictable visual hierarchy */
.button{font-size:13px;min-height:44px;font-weight:700;padding:10px 16px;border-radius:var(--ds-radius-sm);line-height:1.5}
.button.primary{background:var(--ds-primary);border-color:var(--ds-primary);color:var(--ds-on-primary)}
.button.primary:hover{background:var(--ds-primary-hover);border-color:var(--ds-primary-hover)}
.button.small{min-height:38px;font-size:12px;padding:7px 10px}
.button.ghost{color:var(--teal-deep)}
.button.danger{color:var(--ds-danger);border-color:#e8b9b9;background:var(--ds-danger-surface)}
.field{gap:8px}
.field label{font-size:13px;line-height:1.65;color:#36535a;font-weight:700}
.input,.select,.textarea{font-size:15px;line-height:1.7;min-height:46px;border:1px solid #c7d9dc;border-radius:11px;padding:10px 13px;color:#17363d;background:#fff}
.input::placeholder,.textarea::placeholder{color:#657880;opacity:1}
.input:hover,.select:hover,.textarea:hover{border-color:#9abeb9}
.input:focus,.select:focus,.textarea:focus{border-color:var(--ds-primary);box-shadow:var(--ds-focus)}
.textarea{min-height:96px}
.formgrid{gap:18px}
.form-actions{gap:10px}
.filter-panel{gap:14px;margin-bottom:20px}
.filter-panel .field{min-width:190px}
:where(input[type="checkbox"],input[type="radio"]){accent-color:var(--ds-primary)}
.hint,.small-muted,.empty p{font-size:12px;line-height:1.85}
.alert{font-size:13px;line-height:1.95;padding:13px 15px;border-radius:11px}
.notice-band{font-size:13px;line-height:1.95}

/* Tables and evidence: more visible labels, stable scrolling and density */
.table-wrap{border-radius:13px;max-width:100%;overscroll-behavior-x:contain}
table{font-variant-numeric:tabular-nums}
th,td{font-size:13px;line-height:1.7;padding:12px 14px;border-bottom-color:#e6edef}
th{font-size:12px;color:#405f68;background:#eff5f5;font-weight:800}
tbody tr:hover{background:#f4faf8}
.pill,.chip{font-size:12px}
.pill.ok{color:var(--ds-success);background:var(--ds-success-surface)}
.pill.open{color:var(--ds-warning);background:var(--ds-warning-surface)}
.empty strong{font-size:16px}
.record-detail-item{background:#f7faf9;border-color:var(--ds-border)}
.record-detail-label{color:var(--ds-text-muted)}
.fire-scroll-hint{font-size:13px;text-align:right;margin:14px 0 9px;color:var(--teal-deep)}
.fire-table-wrap{border-color:var(--ds-border);scrollbar-width:auto}
.fire-matrix th,.fire-matrix td{font-size:12px;line-height:1.55;padding:10px 8px}
.fire-matrix thead th{background:#ebf3f3;color:#385760}
.fire-matrix tbody th{background:#fff;box-shadow:-2px 0 6px rgba(0,0,0,.025)}
.fire-matrix .fire-month{min-width:78px}
.fire-month>span{font-size:17px}
.fire-pass{background:#e8f6f3;color:var(--ds-success)}
.fire-fail,.fire-overdue{background:#fff1f0;color:var(--ds-danger)}
.fire-needs_action{background:#fff6e7;color:var(--ds-warning)}
.fire-check{border-radius:11px;padding:12px 14px;background:#f7faf9;font-size:14px}
.fire-check span{font-size:14px;font-weight:600}
.fire-check select{font-size:14px;min-height:44px;flex-basis:145px;width:145px}
.fire-action-stats>span{font-size:13px;line-height:1.7}
.fire-action-table th,.fire-action-table td{font-size:12px;line-height:1.7}
.fire-actions-wrap{scrollbar-width:auto}
#fireActions{scroll-margin-top:90px}

/* Modal content and feedback */
.modal-wrap{padding:20px}
.modal{width:min(760px,100%);max-height:min(92dvh,900px);border-radius:var(--ds-radius-xl);box-shadow:0 22px 75px rgba(12,39,47,.24)}
.modal-title{padding:18px 24px;background:#fff;border-bottom-color:#dce8e9;min-height:84px}
.modal-title h2{font-size:19px;line-height:1.6}
.modal-body{padding:23px 24px}
.toast{font-size:14px;line-height:1.8;background:#103e3b;max-width:min(450px,calc(100vw - 32px))}
.metrics-box{border:1px solid #e1eeea;border-radius:12px;margin-bottom:10px}
.metrics-box strong{font-size:14px}

/* Mobile: preserve STAGING warning, touch targets, dashboard scannability */
@media(max-width:1100px){
  .sidebar{width:230px}
  .page{padding:26px}
  .topbar{padding:0 24px}
  .grid-cards{grid-template-columns:repeat(2,minmax(0,1fr))}
  .modules{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:760px){
  html{scroll-padding-top:74px}
  .sidebar{width:min(88vw,325px);height:100dvh;padding:20px 12px}
  .brand{margin-bottom:14px}
  .topbar{padding:8px 14px;min-height:64px;height:auto;flex-wrap:wrap}
  .heading-path{flex:1 1 150px;gap:7px}
  .heading-path strong{font-size:13px}
  .top-actions{gap:7px;flex-wrap:wrap;justify-content:flex-start}
  .pilot-mark{display:inline-flex!important;font-size:0;padding:5px 10px;min-height:25px}
  .pilot-mark::before{content:"تشغيل";font-size:11px;line-height:1.4}
  .user-chip{font-size:12px;max-width:130px}
  .page{padding:18px 14px 40px}
  .page-title{font-size:23px}
  .subhead{font-size:13px}
  .panel{padding:17px;border-radius:16px}
  .grid-cards{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
  .kpi{min-height:116px;padding:14px 13px}
  .kpi strong{font-size:25px}
  .kpi-label{font-size:12px}
  .kpi small,.kpi .hint{font-size:11px}
  .modules{grid-template-columns:1fr;gap:10px}
  .module-card{min-height:94px;padding:15px}
  .formgrid,.double{grid-template-columns:1fr}
  .filter-panel .field{min-width:min(100%,160px)}
  .modal-wrap{padding:0;align-items:flex-end}
  .modal{max-height:94dvh;width:100%;border-radius:20px 20px 0 0}
  .modal-title{min-height:75px;padding:15px 17px}
  .modal-body{padding:17px 16px 24px}
  .fire-matrix tbody th{min-width:150px;max-width:150px}
  .fire-matrix thead th:first-child{min-width:150px}
  .fire-table-wrap{scrollbar-width:auto;-webkit-overflow-scrolling:touch}
  .fire-check{flex-direction:column;align-items:stretch;gap:9px}
  .fire-check select{flex:1 1 auto;width:100%;max-width:100%}
  .form-actions{position:relative;flex-wrap:wrap}
  .form-actions .button{min-height:46px;flex:1}
}
@media(max-width:390px){
  .grid-cards{grid-template-columns:1fr}
  .user-chip{max-width:105px}
}
@media(prefers-reduced-motion:reduce){
  html{scroll-behavior:auto}
  button,a,.module-card{transition:none!important}
}

/* Keyboard access: skip directly to the content without touring the sidebar */
.skip-link{position:fixed;top:10px;inset-inline-start:18px;z-index:100;background:var(--ds-primary);color:#fff;text-decoration:none;padding:9px 16px;border-radius:11px;font-size:14px;font-weight:700;transform:translateY(-160%);box-shadow:0 8px 24px #0002}
.skip-link:focus{transform:translateY(0);outline-color:#fff;outline-offset:-4px}
#app:focus{outline:none}

/* Homepage refinement: compact, task-first cards and uniform local line icons. */
.hse-line-icon{display:block;flex:none;width:22px;height:22px;stroke:currentColor;fill:none;stroke-width:1.8}
.nav-icon,.module-icon,.kpi-icon{display:flex;align-items:center;justify-content:center}
.nav-icon .hse-line-icon{width:20px;height:20px}
.home-hero{margin-bottom:22px}
.home-hero>div{min-width:0}
.home-hero .page-title{overflow-wrap:anywhere}
.home-hero .page-title bdi{unicode-bidi:isolate;white-space:normal}
.home-hero .subhead{margin-bottom:0}
.home-overview{margin-bottom:0}
.home-overview .kpi{min-height:160px;align-items:flex-start;gap:7px;text-align:right}
.home-overview .kpi strong{line-height:1.25}
.home-overview .home-kpi-text{font-size:clamp(16px,1.5vw,19px);line-height:1.6;letter-spacing:0;overflow-wrap:anywhere}
.home-overview .kpi small{margin-top:auto}
.home-overview .home-reports-shortcut{font-family:inherit;color:var(--ink);cursor:pointer;width:100%;border:1px solid var(--ds-border);background:var(--white)}
.home-overview .home-reports-shortcut:hover{border-color:#8bc8be;background:#f5fbf9;box-shadow:0 8px 24px rgba(13,82,75,.07)}
.home-card-link{font-size:12px;color:var(--teal-deep);font-weight:700;line-height:1.6}
.home-section-head{margin-top:27px;margin-bottom:13px}
.home-module-grid{gap:13px}
.home-module-grid .home-module-card{display:grid;grid-template-columns:48px minmax(0,1fr) 20px;align-items:center;gap:13px;min-height:108px;padding:18px;text-align:right}
.home-module-card .module-icon{width:48px;min-width:48px;height:48px;color:var(--teal-deep);background:#eaf5f2;border-radius:13px}
.home-module-card .module-icon .hse-line-icon{width:24px;height:24px}
.home-module-card .module-copy{display:block;min-width:0}
.home-module-card .module-copy strong{font-size:14px;line-height:1.65;margin:0 0 3px}
.home-module-card .module-copy small{display:block;font-size:12px;line-height:1.8;color:var(--muted);overflow-wrap:anywhere}
.home-module-card .module-arrow{display:flex;align-items:center;justify-content:center;color:#5d807f;font-size:18px;opacity:.6;transition:transform .15s ease,opacity .15s ease}
.home-module-card:hover .module-arrow,.home-module-card:focus-visible .module-arrow{opacity:1;transform:translateX(-3px)}
.home-safety-note{margin-top:26px;font-size:13px;color:#345e5c;background:#edf6f4;border:1px solid #cae5df;border-right:3px solid var(--teal);border-radius:12px;padding:12px 16px;line-height:2}
@media(max-width:1100px){
 .home-module-grid .home-module-card{padding:15px;gap:11px}
}
@media(max-width:760px){
 .home-hero{margin-bottom:18px}
 .home-overview .kpi{min-height:132px;gap:5px}
 .home-overview .home-kpi-text{font-size:15px}
 .home-overview .kpi-icon{width:36px;height:36px}
 .home-overview .kpi small{font-size:11px}
 .home-section-head{margin-top:25px;flex-wrap:wrap}
 .home-module-grid .home-module-card{grid-template-columns:44px minmax(0,1fr) 16px;min-height:88px;padding:13px 14px}
 .home-module-card .module-icon{width:44px;min-width:44px;height:44px}
 .home-module-card .module-copy strong{font-size:14px}
 .home-module-card .module-copy small{font-size:12px}
 .home-safety-note{margin-top:22px}
}
@media(max-width:390px){
 .home-overview{grid-template-columns:repeat(2,minmax(0,1fr))}
 .home-overview .kpi{min-height:140px}
 .home-module-grid .home-module-card{grid-template-columns:42px minmax(0,1fr) 16px}
}
@media(prefers-reduced-motion:reduce){.home-module-card .module-arrow{transition:none!important}}

/* Accessible toolbar action: always descriptive; compact on narrow screens. */
.signout-control{width:auto;min-width:82px;min-height:44px;grid-template-columns:20px auto;justify-content:center;align-items:center;column-gap:7px;padding:0 12px;color:var(--ds-text);font-size:12px;font-weight:700;white-space:nowrap}
.signout-control svg{width:20px;height:20px;display:block}
.signout-control:hover{background:var(--ds-danger-surface);color:var(--ds-danger);border-color:#e8b9b9}
@media(max-width:760px){.signout-control{min-width:44px;width:44px;grid-template-columns:1fr;padding:0}.signout-label{display:none}}

/* STAGING dashboard — factual safety metrics, distinct from account / permission metadata. */
.home-hero{margin-bottom:14px}
.home-hero .actions{flex-shrink:0}
.home-access-summary{display:flex;align-items:center;flex-wrap:wrap;gap:8px 18px;padding:11px 16px;margin:0 0 20px;border:1px solid var(--ds-border);border-radius:12px;background:#f9fcfb;color:#45636a;font-size:12px;line-height:1.7}
.home-access-summary>span{display:inline-flex;align-items:center;gap:7px;min-width:0}
.home-access-summary .hse-line-icon{width:17px;height:17px;color:var(--ds-primary)}
.home-metrics-section{margin-bottom:6px}
.home-metrics-heading{margin-top:15px;margin-bottom:12px;gap:10px;flex-wrap:wrap}
.home-metrics-heading h2{font-size:17px}
.hse-dashboard-grid{grid-template-columns:repeat(4,minmax(0,1fr));gap:13px}
.hse-indicator{position:relative;display:flex;align-items:flex-start;text-align:right;min-height:169px;padding:17px 18px;gap:5px;box-shadow:var(--shadow)}
.hse-indicator .kpi-icon{width:40px;height:40px;margin-bottom:7px}
.hse-indicator .kpi-label{font-size:13px;line-height:1.7;max-width:100%}
.hse-indicator .hse-indicator-value{font-size:clamp(25px,2.5vw,36px);line-height:1.2;font-weight:800;color:var(--ds-text);font-variant-numeric:tabular-nums}
.hse-indicator .hse-indicator-period{color:#537178;font-weight:700;font-size:11px}
.hse-indicator .hse-indicator-note{font-size:11px;line-height:1.7;margin-top:auto;color:var(--muted)}
.hse-indicator-danger .kpi-icon{color:var(--ds-danger);background:#fff0ef}
.hse-indicator-warning .kpi-icon{color:var(--ds-warning);background:#fff4df}
.hse-indicator-neutral .kpi-icon{color:var(--ds-primary)}
.hse-indicator-loading .kpi-icon{opacity:.7}
.hse-dashboard-provenance{font-size:12px;line-height:1.9;color:var(--ds-text-muted);margin:12px 2px 0;max-width:1100px}
.hse-dashboard-error{margin:12px 0}
@media(max-width:1100px){.hse-dashboard-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:760px){
 .home-hero{gap:12px}
 .home-hero .actions{width:100%}
 .home-hero .actions .button{width:100%}
 .home-access-summary{gap:7px 11px;padding:10px 12px}
 .home-metrics-heading{margin-top:12px}
 .hse-dashboard-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
 .hse-indicator{min-height:160px;padding:13px;gap:5px}
 .hse-indicator .kpi-icon{width:36px;height:36px;margin-bottom:4px}
 .hse-indicator .kpi-label{font-size:12px}
 .hse-indicator .hse-indicator-value{font-size:26px}
 .hse-indicator .hse-indicator-period,.hse-indicator .hse-indicator-note{font-size:11px}
}
@media(max-width:360px){
 .hse-dashboard-grid{grid-template-columns:1fr}
 .hse-indicator{min-height:132px}
}

/* Import provenance banner: visible to staging administrator only. */
.home-import-section{margin:16px 0 10px}
.home-import-status{padding:16px 19px;background:#fff9ed;border:1px solid #eeddb9;border-radius:14px;color:#775522;font-size:13px;line-height:1.85}
.home-import-title{display:flex;align-items:center;flex-wrap:wrap;justify-content:space-between;gap:8px;margin-bottom:11px}
.home-import-title strong{font-size:15px}
.home-import-numbers{display:flex;flex-wrap:wrap;gap:10px 24px;margin:10px 0}
.home-import-numbers span{font-size:12px;color:#735a36}
.home-import-numbers strong{color:#6c4620;font-size:16px;margin-inline-start:6px;font-variant-numeric:tabular-nums}
.home-import-status p{font-size:12px;color:#685b46;margin:8px 0 0}
@media(max-width:760px){.home-import-status{padding:12px 14px}.home-import-numbers{gap:8px 16px}}

/* Admin-only STAGING historical metadata triage. */
.import-review-area{padding:20px}
.import-review-area>.hint{margin:7px 0 16px}
.import-review-scroll{max-width:100%;overflow-x:auto;border:1px solid var(--ds-border);border-radius:12px;scrollbar-width:auto}
.import-review-scroll table{min-width:870px}
.import-review-scroll td,.import-review-scroll th{font-size:12px;line-height:1.8}
.import-review-scroll tr:hover{background:#f3faf8}
.import-findings{display:flex;flex-wrap:wrap;gap:5px;max-width:300px}
.import-findings .pill{white-space:normal;line-height:1.6}
.import-review-pagination{display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:10px;margin:14px 0}
.import-review-pagination>div{display:flex;align-items:center;gap:8px}
.import-review-pagination span{color:var(--ds-text-muted);font-size:13px;font-variant-numeric:tabular-nums}
@media(max-width:760px){.import-review-area{padding:14px}.import-review-scroll table{min-width:820px}.import-review-pagination .button{min-width:72px}}

.fire-import-provenance{margin:12px 0;background:#fff8e8;color:#76501b;border:1px solid #eddbad;padding:12px 15px;border-radius:12px;font-size:13px;line-height:1.9}
.fire-legacy-source{font-size:11px;color:#90631e;font-weight:700;line-height:1.65;margin-top:4px}

/* Production historical archive: original Google Sheets rows, searchable and read-only. */
.history-panel{padding:22px}
.history-notice{border:1px solid #e5d5b5;border-right:4px solid #ad7c2b;color:#6b5229;background:#fff8e8;padding:13px 16px;border-radius:13px;font-size:13px;line-height:2;margin-bottom:17px}
.history-notice strong{display:inline;font-size:14px}
.history-summary{display:flex;align-items:center;gap:11px;flex-wrap:wrap;margin-bottom:14px;color:var(--ds-text-muted);font-size:13px}
.history-summary strong{font-size:31px;line-height:1.3;letter-spacing:-.3px;color:var(--ds-text);font-variant-numeric:tabular-nums}
.history-summary span:last-child{margin-inline-start:auto}
.history-filters{display:flex;flex-wrap:wrap;align-items:end;gap:13px;margin-bottom:19px}
.history-filters .field{flex:1 1 180px;min-width:160px}
.history-filters .history-search{flex:2 1 260px}
.history-filters .history-apply{min-height:46px;min-width:84px;align-self:end}
.history-table-wrap{overflow-x:auto;border-radius:13px;border:1px solid var(--ds-border);overscroll-behavior-x:contain;scrollbar-width:auto}
.history-table-wrap table{min-width:950px;width:100%}
.history-table-wrap th{font-size:12px;white-space:nowrap}
.history-table-wrap td{font-size:12px;line-height:1.9;vertical-align:middle}
.history-table-wrap td:nth-child(4){min-width:180px;max-width:360px;overflow-wrap:anywhere}
.history-ref{font-variant-numeric:tabular-nums;direction:ltr;unicode-bidi:isolate;font-size:13px;color:#124d47;white-space:nowrap}
.history-pager{display:flex;gap:12px;align-items:center;justify-content:space-between;flex-wrap:wrap;margin-top:17px;font-size:13px;color:var(--muted)}
.history-pager>div{display:flex;gap:9px}
.history-record-source{background:#f0f8f6;border:1px solid #d6eae5;border-radius:13px;padding:14px 15px;margin-bottom:14px}
.history-record-source strong{font-size:16px}
.history-record-source p{margin:6px 0 0;font-size:13px;line-height:1.8}
.history-detail-list{margin:13px 0;display:grid;grid-template-columns:1fr;gap:0;border:1px solid var(--ds-border);border-radius:12px;overflow:hidden}
.history-detail-pair{display:grid;grid-template-columns:minmax(130px,34%) 1fr;gap:13px;padding:10px 13px;border-bottom:1px solid #e6eff0;line-height:1.8;font-size:13px}
.history-detail-pair:last-child{border-bottom:0}
.history-detail-pair:nth-child(even){background:#f8fbfa}
.history-detail-pair dt{font-weight:700;color:#49636a;overflow-wrap:anywhere}
.history-detail-pair dd{margin:0;white-space:pre-wrap;overflow-wrap:anywhere}
@media(max-width:760px){
 .history-panel{padding:13px}
 .history-notice{padding:11px 12px;font-size:12px}
 .history-filters{gap:9px}
 .history-filters .field{min-width:135px}
 .history-filters .history-search{flex-basis:100%}
 .history-filters .history-apply{width:100%}
 .history-summary strong{font-size:26px}
 .history-table-wrap table{min-width:850px}
 .history-detail-pair{grid-template-columns:1fr;gap:4px}
}

/* Unified operational log: original sheet data and new records in one table. */
.record-results-wrap{max-width:100%;overflow-x:auto;scrollbar-width:auto}
.record-results-wrap table{min-width:750px}
.record-results-wrap th,.record-results-wrap td{font-size:12px;line-height:1.85}
.record-results-wrap td:nth-child(3){min-width:220px;max-width:390px;overflow-wrap:anywhere}
.record-origin{display:block;margin-top:4px;font-size:11px;color:#5e786e}
.record-search-button{display:flex;align-items:flex-end}
.record-search-button button{min-height:46px;min-width:92px}
.record-pager{display:flex;gap:12px;align-items:center;justify-content:space-between;flex-wrap:wrap;margin-top:14px;font-size:13px;color:#567078}
.record-pager>div{display:flex;gap:8px}
.record-source-note{margin:16px 0;padding:13px 16px;border:1px solid #cfe3dc;border-radius:12px;background:#f2faf7;font-size:13px;line-height:1.9}
.record-source-note>strong{color:#1f554d}
.record-source-note p{margin:6px 0}
.record-source-note details{margin-top:12px}
.record-source-note summary{cursor:pointer;font-weight:700}
.record-source-note dl{margin:12px 0 0;border-top:1px solid #d8e9e3}
.record-source-pair{display:grid;grid-template-columns:minmax(120px,36%) 1fr;gap:8px;padding:8px 0;border-bottom:1px solid #d8e9e3}
.record-source-pair dd{margin:0;white-space:pre-wrap;overflow-wrap:anywhere}
.record-source-pair dt{font-weight:700}
@media(max-width:720px){.record-search-button{width:100%}.record-search-button button{width:100%}.record-source-pair{grid-template-columns:1fr;gap:0}}


/* Mobile operational logs: fit the viewport; preserve full-width table on desktop. */
.record-mobile-list{display:none}
@media (max-width:760px){
  #recordTable{max-width:100%;min-width:0}
  #recordTable .record-results-wrap{display:none}
  #recordTable .record-mobile-list{display:grid;grid-template-columns:minmax(0,1fr);gap:12px}
  .record-mobile-card{
    width:100%;min-width:0;box-sizing:border-box;border:1px solid #d9e6e5;
    border-radius:16px;background:#fff;padding:15px 15px 13px;
    box-shadow:0 2px 12px rgba(20,56,57,.035);text-align:start
  }
  .record-card-heading{display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:9px}
  .record-card-ref{
    display:inline-block;max-width:100%;padding:5px 11px;border-radius:9px;
    background:#eaf5f2;color:#175e56;font-size:14px;font-weight:800;
    unicode-bidi:isolate;direction:ltr;overflow-wrap:anywhere
  }
  .record-card-title{font-size:16px;line-height:1.7;margin:12px 0 10px;color:#122f37;overflow-wrap:anywhere}
  .record-card-metadata{display:grid;grid-template-columns:1fr;gap:5px;font-size:13px;color:#526872}
  .record-card-metadata b{font-weight:700;color:#294d51}
  .record-card-metadata bdi{unicode-bidi:isolate}
  .record-card-source{display:block;font-size:12px;color:#607878;margin-top:10px}
  .record-card-actions{display:flex;justify-content:flex-end;margin-top:12px;padding-top:11px;border-top:1px solid #e8f0ef}
  .record-card-actions button{min-height:43px;padding:8px 18px}
  .record-pager{align-items:center;font-size:12px;gap:9px}
  .record-pager>div{gap:6px}
  .record-pager .button{min-height:42px}
  .topbar .pilot-mark{display:none}
  .topbar .heading-path{flex-wrap:nowrap;min-width:0}
  .topbar .heading-path .muted,.topbar .heading-path .slash{display:none}
  .topbar #topTitle{max-width:118px;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .topbar .top-actions{flex-shrink:0;gap:5px}
  .topbar .user-chip{max-width:114px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
}
@media (max-width:390px){
  .record-mobile-card{padding:12px}
  .topbar .user-chip{max-width:84px}
  .topbar #topTitle{max-width:96px}
}
