body { font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif; }
    .field-row { display: grid; grid-template-columns: 180px 1fr; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid #f1f5f9; }
    .field-row:last-child { border-bottom: none; }
    .field-row label { font-size: 12px; color: #64748b; font-weight: 500; display: flex; align-items: center; gap: 5px; }
    .field-row input[type=text], .field-row input[type=email], .field-row input[type=number], .field-row select {
      width: 100%; padding: 5px 8px; border: 1px solid #e2e8f0; border-radius: 6px; font-size: 13px; background: #fff; outline: none;
    }
    .field-row input:focus, .field-row select:focus { border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59,130,246,0.12); }
    .field-row input[type=checkbox] { width: 15px; height: 15px; accent-color: #3b82f6; cursor: pointer; }
    .tab-btn { padding: 8px 14px; font-size: 12px; font-weight: 600; border-bottom: 2px solid transparent; color: #94a3b8; cursor: pointer; white-space: nowrap; transition: color 0.15s; }
    .tab-btn:hover { color: #475569; }
    .tab-btn.active { border-bottom-color: #3b82f6; color: #2563eb; }
    .tab-dropdown { display: inline-block; }
    .tab-dropdown-menu { display: none; position: fixed; background: #fff; border: 1px solid #e2e8f0; border-radius: 6px; box-shadow: 0 4px 16px rgba(0,0,0,0.12); z-index: 9999; min-width: 160px; padding: 4px 0; }
    .tab-dropdown-menu.open { display: block; }
    .tab-dropdown-item { display: block; width: 100%; text-align: left; padding: 7px 14px; font-size: 12px; font-weight: 600; border: none; background: none; cursor: pointer; color: #475569; white-space: nowrap; }
    .tab-dropdown-item:hover { background: #f1f5f9; color: #1d4ed8; }
    .status-badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 9999px; font-size: 11px; font-weight: 600; }
    .dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; margin-right: 5px; }
    .filter-btn-item { padding: 3px 9px; border-radius: 6px; font-weight: 500; cursor: pointer; color: #64748b; background: transparent; border: none; transition: background 0.1s, color 0.1s; font-size: 12px; }
    .filter-btn-item:hover { background: #f1f5f9; color: #334155; }
    .filter-btn-item.active { background: #dbeafe; color: #1d4ed8; }
    .year-btn { padding: 2px 9px; border-radius: 9999px; font-size: 11px; font-weight: 700; cursor: pointer; border: 1.5px solid #e2e8f0; color: #94a3b8; background: transparent; transition: all 0.12s; }
    .year-btn:hover { border-color: #93c5fd; color: #3b82f6; }
    .year-btn.active { background: #3b82f6; color: white; border-color: #3b82f6; }
    #file-modal { display:none; position:fixed; inset:0; z-index:1000; background:rgba(0,0,0,0.75); align-items:center; justify-content:center; }
    #file-modal.open { display:flex; }
    #file-modal-inner { background:white; border-radius:12px; overflow:hidden; box-shadow:0 25px 60px rgba(0,0,0,0.4); display:flex; flex-direction:column; max-width:92vw; max-height:92vh; width:900px; }
    #file-modal-header { background:#0f172a; color:white; padding:12px 16px; display:flex; align-items:center; gap:10px; flex-shrink:0; }
    #file-modal-body { flex:1; overflow:auto; background:#1e293b; display:flex; align-items:center; justify-content:center; min-height:200px; }
    #file-modal-body img { max-width:100%; max-height:80vh; object-fit:contain; border-radius:4px; }
    #file-modal-body iframe { width:100%; height:78vh; border:0; background:#fff; }
    .file-card { display:flex; align-items:center; gap:10px; padding:10px 12px; border:1px solid #e2e8f0; border-radius:8px; transition:all 0.15s; background:#fff; }
    .file-card:hover { border-color:#93c5fd; background:#eff6ff; }
    .file-icon { width:36px; height:36px; border-radius:6px; display:flex; align-items:center; justify-content:center; font-size:18px; flex-shrink:0; }
    .upload-zone { border: 2px dashed #e2e8f0; border-radius: 10px; padding: 20px; text-align: center; transition: all 0.15s; }
    .upload-zone.drag-over { border-color: #3b82f6; background: #eff6ff; }
    #create-modal { display:none; position:fixed; inset:0; z-index:2000; background:rgba(0,0,0,0.5); align-items:center; justify-content:center; }
    #create-modal.open { display:flex; }
    #extract-modal { display:none; position:fixed; inset:0; z-index:3000; background:rgba(0,0,0,0.5); align-items:center; justify-content:center; }
    #extract-modal.open { display:flex; }
    .extract-field-item { transition: background 0.1s, border-color 0.1s; }
    @keyframes spin { to { transform: rotate(360deg); } }
    .spin { animation: spin 0.8s linear infinite; }


#view-fleet { flex-direction:column; padding:0; min-height:0; overflow:hidden; background:#f4f6fa; color:#18283c; }
.rf-layout{display:flex;position:relative;width:100%;height:100%;min-height:0;overflow:hidden}
.rf-content{flex:1;min-width:0;min-height:0;overflow:auto;padding:14px 20px 24px;box-sizing:border-box}
.rf-nav{position:relative;flex:0 0 72px;width:72px;z-index:4}
.rf-nav.pinned{flex-basis:210px;width:210px}
.rf-nav-panel{position:absolute;inset:0 auto 0 0;width:72px;box-sizing:border-box;overflow-y:auto;overflow-x:hidden;background:#fff;border-right:1px solid #dce4ef;box-shadow:1px 0 4px #0f172a0a}
.rf-nav.pinned .rf-nav-panel,.rf-nav.is-open .rf-nav-panel{width:210px}
.rf-nav.is-open .rf-nav-panel{box-shadow:8px 0 24px #0f172a26}
.rf-nav-controls{display:flex;align-items:center;justify-content:center;gap:6px;height:52px;border-bottom:1px solid #e5eaf2}
.rf-nav-controls button{height:34px;min-width:34px;padding:0 7px;border:1px solid #d3ddec;border-radius:7px;background:#fff;color:#475569;cursor:pointer}
.rf-nav-controls button:hover,.rf-nav-item:hover{background:#eff5ff;color:#1d4ed8}
.rf-nav-pin{display:none}.rf-nav.pinned .rf-nav-pin,.rf-nav.is-open .rf-nav-pin{display:inline-block}.rf-nav.pinned:not(.is-open) .rf-nav-expand{display:none}
.rf-nav nav{padding:8px 6px}
.rf-nav-item{display:flex;align-items:center;justify-content:center;width:100%;min-height:43px;padding:7px 5px;border:0;border-radius:7px;background:transparent;color:#56677d;font-size:12px;font-weight:600;cursor:pointer;text-align:left}
.rf-nav-item.selected{background:#e7efff;color:#1d4ed8}
.rf-nav-label{display:none}.rf-nav.pinned .rf-nav-label,.rf-nav.is-open .rf-nav-label{display:block}.rf-nav.pinned .rf-nav-short,.rf-nav.is-open .rf-nav-short{display:none}
.rf-nav.pinned .rf-nav-item,.rf-nav.is-open .rf-nav-item{justify-content:flex-start;padding:9px 12px;font-size:13px}
.rf-nav-scrim{display:none;position:absolute;inset:0;z-index:3;border:0;background:#0f172a14;cursor:default}
.rf-nav.is-open~.rf-nav-scrim{display:block}
.rf-heading,.rf-banner,.rf-tools { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.rf-heading { justify-content:space-between; margin-bottom:8px; }.rf-heading h1 {font-size:20px;font-weight:700}.rf-heading p,.rf-muted {font-size:12px;color:#62748b;margin-top:2px}
.rf-tabs {display:flex;gap:22px;border-bottom:1px solid #dce3ed}.rf-tab {padding:12px 4px;color:#63758b}.rf-tab.selected{border-bottom:3px solid #2563eb;color:#1d4ed8;font-weight:600}
.rf-btn {border:1px solid #2563eb;background:#2563eb;color:white;border-radius:7px;padding:7px 12px;font-size:12px;cursor:pointer}.rf-btn:hover{filter:brightness(.94)}.rf-secondary{background:white;color:#405572;border-color:#cfd9e7}.rf-notice{white-space:pre-wrap;font-size:13px;margin:5px 0;color:#1d4ed8}.rf-notice:empty{display:none}.rf-error{color:#b91c1c;white-space:pre-wrap}
.rf-banner{justify-content:space-between;padding:8px 12px;background:#e7efff;border:1px solid #cfddf5;border-radius:9px;margin-bottom:8px;font-size:13px}.rf-warn{background:#fff4d9;color:#8d570b}
.rf-tools{margin:12px 0}.rf-list-tools{margin:2px 0 8px;gap:8px}.rf-list-tools .rf-btn:last-child{margin-left:auto}.rf-table-wrap{overflow:auto;background:white;border:1px solid #e1e6ef;border-radius:10px}.rf-table{width:100%;text-align:left;font-size:13px;border-collapse:collapse}.rf-table th{background:#edf2f8;color:#607086;padding:12px}.rf-table td{padding:15px 12px;border-top:1px solid #edf1f6;vertical-align:top}.rf-table td:nth-child(5){max-width:320px}.rf-row-actions{min-width:220px}.rf-row-actions button{margin:2px}.rf-badge{display:inline-block;font-size:12px;background:#edf1f6;color:#52647c;border-radius:5px;padding:3px 8px}.rf-badge.running{background:#dbeaff;color:#1d4ed8}.rf-badge.done{background:#dcf6e7;color:#176e43}.rf-badge.review,.rf-badge.needs_human,.rf-badge.stop_requested{background:#fff0cf;color:#95630f}.rf-badge.failed{background:#ffe5e5;color:#b91c1c}
.rf-cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(310px,1fr));gap:18px}.rf-card{background:white;border:1px solid #dfe6ee;border-radius:12px;padding:22px}.rf-card h3{font-size:18px;font-weight:600}.rf-sub{font-size:12px;margin:10px 0;overflow-wrap:anywhere}.rf-sub span{color:#64748b}.rf-sub strong{font-weight:500}.rf-empty{padding:60px 24px;text-align:center;color:#718096;background:white;border:1px dashed #c9d5e5;border-radius:12px;width:100%}
.rf-dialog{width:min(760px,94vw);max-height:88vh;overflow:auto;padding:26px;border:1px solid #d1dceb;border-radius:14px;box-shadow:0 20px 80px #172b4d40}.rf-dialog[open]{display:flex;flex-direction:column;overflow:hidden;padding:0}.rf-dialog-header{display:flex;align-items:center;justify-content:space-between;gap:16px;flex-shrink:0;padding:16px 22px;background:white;border-bottom:1px solid #dce4ef}.rf-dialog .rf-dialog-header h2{margin:0}.rf-dialog-close{flex-shrink:0;width:44px;height:44px;border:1px solid #d1dceb;border-radius:8px;background:white;color:#334155;font-size:28px;cursor:pointer}.rf-dialog-close:hover{background:#f0f4f9}.rf-dialog-close:focus-visible{outline:2px solid #2563eb;outline-offset:2px}.rf-dialog-body{overflow:auto;min-height:0;padding:12px 26px 26px;overscroll-behavior:contain}.rf-dialog::backdrop{background:#0a192f70}.rf-dialog h2{font-size:21px;font-weight:700;margin-bottom:16px}.rf-dialog h3{font-weight:600;margin-top:20px}.rf-dialog p{margin:10px 0;font-size:13px;line-height:1.6}.rf-dialog pre{white-space:pre-wrap;overflow-wrap:anywhere;background:#f0f4f9;padding:14px;border-radius:7px;font-size:12px}.rf-dialog input:not([type=checkbox]),.rf-dialog select,#view-fleet select{border:1px solid #cbd5e1;border-radius:6px;padding:8px;margin:5px;font-size:13px;max-width:100%}.rf-picker{max-height:300px;overflow:auto;border:1px solid #e2e8f0;border-radius:8px;padding:8px}.rf-check{display:flex;gap:10px;align-items:center;padding:10px;font-size:13px}.rf-source{border:1px solid #dce4ef;background:#fff;padding:14px;margin:10px 0;border-radius:12px;box-shadow:0 1px 2px #0f172a0a}.rf-source-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:10px}.rf-issue{border:1px solid #dce4ef;border-radius:8px;padding:9px 11px;margin-top:7px;font-size:12px;line-height:1.55}.rf-issue strong{display:block;font-size:11px;margin-bottom:2px}.rf-issue-warn{background:#fffbeb;border-color:#fde68a;color:#78350f}.rf-issue-error{background:#fef2f2;border-color:#fecaca;color:#991b1b}.rf-issue-gray{background:#f8fafc;border-color:#e2e8f0;color:#475569}.rf-issue-ok{background:#f0fdf4;border-color:#bbf7d0;color:#166534}.rf-dialog li{font-size:13px;margin:8px 0}
@media(max-width:760px){.rf-nav,.rf-nav.pinned{flex-basis:56px;width:56px}.rf-nav-panel,.rf-nav.pinned .rf-nav-panel{width:56px}.rf-nav.is-open .rf-nav-panel{width:min(250px,calc(100vw - 40px))}.rf-nav.pinned:not(.is-open) .rf-nav-label{display:none}.rf-nav.pinned:not(.is-open) .rf-nav-short{display:block}.rf-nav.pinned:not(.is-open) .rf-nav-item{justify-content:center;padding:7px 5px;font-size:12px}.rf-nav.pinned:not(.is-open) .rf-nav-expand{display:inline-block}.rf-nav-pin{display:none!important}.rf-content{padding:12px}.rf-heading h1{font-size:18px}.rf-heading p{display:none}.rf-table{min-width:850px}}
#token-rotation-modal{display:none;position:fixed;inset:0;z-index:9000;background:rgba(15,23,42,.72);align-items:center;justify-content:center;padding:24px}
#token-rotation-modal.open{display:flex}
.token-rotation-card{width:min(560px,100%);background:#fff;border-radius:16px;padding:24px;box-shadow:0 24px 70px rgba(15,23,42,.32)}
.token-candidate-value{margin-top:10px;padding:10px 12px;border:1px solid #fcd34d;border-radius:8px;background:#fff;color:#111827;white-space:pre-wrap;overflow-wrap:anywhere;font:13px ui-monospace,SFMono-Regular,Menlo,monospace}

/* REQ-251: preserve desktop layout; phones use list -> detail navigation. */
.admin-header-tools { display: contents; }
.client-mobile-toolbar { display: none; }
/* REQ-275: the desktop toolbar also needs a second row on small laptops.
   Keep the client list/detail breakpoint independent of the header. */
@media (min-width: 768px) and (max-width: 1023px) {
  #admin-header { height: auto !important; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 4px 8px; padding: 6px 12px; }
  .admin-brand { min-width: 0; }
  .admin-brand svg { flex-shrink: 0; }
  .admin-brand > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #header-stats { display: none; }
  .admin-navigation { display: contents; }
  .admin-header-tools { display: flex; gap: 4px; }
  .admin-header-tools button { white-space: nowrap; padding: 6px 8px; }
  .admin-nav { grid-row: 2; grid-column: 1 / -1; overflow-x: auto; min-width: 0; }
  .admin-nav button { flex: 1 0 auto; white-space: nowrap; min-height: 40px; }
}
@media (max-width: 767px), (max-width: 1023px) and (max-height: 500px) and (pointer: coarse) {
  body { height: 100dvh; }
  #admin-header { height: auto !important; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 4px 8px; padding: 6px 12px; }
  .admin-brand { min-width: 0; }
  .admin-brand svg { flex-shrink: 0; }
  .admin-brand > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #header-stats { display: none; }
  .admin-navigation { display: contents; }
  .admin-header-tools { display: flex; gap: 4px; }
  .admin-header-tools button { white-space: nowrap; padding: 6px 8px; }
  .admin-nav { grid-row: 2; grid-column: 1 / -1; overflow-x: auto; min-width: 0; }
  .admin-nav button { flex: 1 0 auto; white-space: nowrap; }
  button, a[role="button"] { min-height: 44px; min-width: 44px; }
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]),
  select, textarea { font-size: 16px !important; min-height: 44px; max-width: 100%; }
  #view-clients { min-height: 0; }
  #view-clients > aside { width: 100%; min-width: 0; border-right: 0; }
  #view-clients > main { display: none; min-width: 0; }
  #view-clients[data-mobile-pane="detail"] > aside { display: none; }
  #view-clients[data-mobile-pane="detail"] > main { display: block; width: 100%; }
  .client-mobile-toolbar { display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 30; padding: 6px 12px; border-bottom: 1px solid #e2e8f0; background: #fff; }
  .client-mobile-toolbar button { flex-shrink: 0; color: #1d4ed8; font-weight: 600; font-size: 14px; }
  #mobile-client-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: #64748b; }
  #client-detail { padding: 12px 12px calc(32px + env(safe-area-inset-bottom)); min-width: 0; overflow-wrap: anywhere; }
  #client-detail > .p-5 { padding: 16px; }
  #client-detail h2 { overflow-wrap: anywhere; }
  #client-detail a { display: inline-flex; align-items: center; min-height: 44px; }
  .client-progress { overflow-x: auto; padding-bottom: 6px; }
  .client-progress > div { flex-shrink: 0; }
  #client-detail .field-row { grid-template-columns: minmax(0,1fr); gap: 6px; padding: 10px 0; }
  #client-detail .field-row > * { min-width: 0; }
  #client-detail .field-row label { font-size: 14px; }
  #client-detail .field-row input[type="checkbox"] { width: 22px; height: 22px; }
  #client-detail .grid { grid-template-columns: minmax(0,1fr); }
  #client-detail .dv-tab-btn { flex-shrink: 0; white-space: nowrap; padding: 10px; }
  #client-detail .detail-view-tabs { overflow-x: auto; padding-left: 8px; padding-right: 8px; }
  #dv-federal > .p-5 { overflow-x: auto; }
  #client-detail .tab-btn { flex-shrink: 0; }
  #client-detail .file-card { flex-wrap: wrap; }
  .admin-record-row { flex-direction: column; overflow-wrap: anywhere; }
  .admin-record-row > div { width: 100%; min-width: 0; }
  .admin-record-actions { flex-wrap: wrap; }
  .admin-record-actions button { white-space: nowrap; }
  .invite-create-fields { flex-direction: column; }
  .invite-create-fields > * { width: 100%; min-width: 0; }
  #view-invites, #view-accounts { padding: 12px; min-width: 0; }
  #view-invites > div, #view-accounts > div { width: 100%; min-width: 0; }
  #create-modal, #extract-modal, #file-modal, #token-rotation-modal { padding: 12px; }
  .create-card { display: flex; flex-direction: column; max-height: calc(100dvh - 24px); padding: 16px; }
  .create-card > :first-child { flex-shrink: 0; margin-bottom: 12px; }
  .create-card > .space-y-4 { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  .create-actions { position: sticky; bottom: 0; background: white; padding-top: 12px; padding-bottom: 4px; }
  #extract-modal-inner, .token-rotation-card, #admin-token-gate > div { max-height: calc(100dvh - 24px); overflow-y: auto; overscroll-behavior: contain; padding: 16px !important; }
  #extract-actions { flex-wrap: wrap; }
  #extract-actions button { white-space: nowrap; }
  #file-modal-inner { max-height: calc(100dvh - 24px); max-width: 100%; }
  #file-modal-header { padding: 8px; }
  #file-modal-header > div { min-width: 0; }
  #file-modal-header a, #file-modal-header button { flex-shrink: 0; }
  #file-modal-body { min-height: 0; }
  #file-modal-body iframe { height: calc(100dvh - 100px); }
  .rf-cards { grid-template-columns: minmax(0,1fr); }
  .rf-source-head { flex-wrap: wrap; }
  .rf-dialog { max-height: calc(100dvh - 24px); }
}

/* REQ-298: utility display classes must not override denied controls. */
.staff-permission-denied{display:none!important}
