:root {
    --primary: #1D5CC8; --primary-light: #4B82DB; --primary-dark: #1748A8;
    --bg: #f5f7fb; --surface: #ffffff; --text: #1a1d2e; --text-secondary: #8993a4;
    --border: #eaecf0; --accent: #059669; --sidebar-bg: #ffffff; --sidebar-text: #5f6b7a;
    --radius: 12px; --shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02); --sidebar-width: 250px; --sidebar-collapsed-width: 72px;
}
[data-theme="dark"] {
    --primary: #1D5CC8; --primary-light: #4B82DB; --primary-dark: #1748A8;
    --bg: #0f172a; --surface: #1e293b; --text: #e2e8f0; --text-secondary: #94a3b8;
    --border: #334155; --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --sidebar-bg: #0c1225; --sidebar-text: #94a3b8;
}
[data-theme="dark"] .sidebar { border-right-color: rgba(255,255,255,0.06); background: #0c1225; }
[data-theme="dark"] .logo h1 { color: #fff; }
[data-theme="dark"] .nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
[data-theme="dark"] .nav-item.active { box-shadow: 0 2px 8px rgba(29,92,200,0.5); }
[data-theme="dark"] .sidebar-stats { border-top-color: rgba(255,255,255,0.08); background: rgba(255,255,255,0.03); }
[data-theme="dark"] .chat-history { border-top-color: rgba(255,255,255,0.08); }
[data-theme="dark"] .ch-header button:hover { color: #fff; }
[data-theme="dark"] .ch-item:hover { background: rgba(255,255,255,0.06); }
[data-theme="dark"] .ch-item.active { background: rgba(29,92,200,0.28); color: #fff; }
[data-theme="dark"] .lang-switcher { background: rgba(255,255,255,0.06); }
[data-theme="dark"] .lang-option:hover { background: rgba(255,255,255,0.1); color: #fff; }
[data-theme="dark"] .modal-overlay { background: rgba(0,0,0,0.7); }
[data-theme="dark"] .modal-content { background: var(--surface); color: var(--text); }
[data-theme="dark"] input, [data-theme="dark"] select, [data-theme="dark"] textarea {
    background: var(--bg); color: var(--text); border-color: var(--border);
}
[data-theme="dark"] .cat-card { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .cat-card:hover { border-color: var(--primary-light); }
[data-theme="dark"] .doc-card { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .doc-card:hover { border-color: var(--primary-light); }
[data-theme="dark"] .source-badge { background: #334155; color: #94a3b8; }
[data-theme="dark"] .chat-msg.bot .msg-content { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .chat-msg.user .msg-content { background: var(--primary-dark); }
[data-theme="dark"] .chat-input-wrap { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .hint-btn { background: var(--surface); border-color: var(--border); color: var(--text); }
[data-theme="dark"] .hint-btn:hover { background: var(--bg); border-color: var(--primary-light); }
[data-theme="dark"] .mode-btn { background: var(--surface); border-color: var(--border); color: var(--text-secondary); }
[data-theme="dark"] .mode-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
[data-theme="dark"] .hs-search-card { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .hs-search-input-wrap { background: var(--bg); }
[data-theme="dark"] .hs-chip { background: var(--bg); }
[data-theme="dark"] .acct-tab { color: var(--text-secondary); }
[data-theme="dark"] .acct-tab.active { color: var(--primary-light); border-color: var(--primary-light); }
[data-theme="dark"] .lib-layer-btn { background: var(--surface); border-color: var(--border); color: var(--text); }
[data-theme="dark"] .lib-layer-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
[data-theme="dark"] .lib-upload-target { background: #1e3a5f; border-color: #2563eb40; color: #93c5fd; }
[data-theme="dark"] .upload-status { background: #1e3a5f; border-color: #2563eb40; }
[data-theme="dark"] .user-doc-card { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .page-btn { background: var(--surface); border-color: var(--border); color: var(--text); }
[data-theme="dark"] .page-btn.active { background: var(--primary); color: #fff; }
* { margin:0; padding:0; box-sizing:border-box; }
html, body { height:100%; overflow:hidden; }
body { font-family:'ZIA Inter','ZIA Noto Sans Thai',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif; background:var(--bg); color:var(--text); }
:lang(th) body { font-family:'ZIA Noto Sans Thai','ZIA Inter',Tahoma,sans-serif; }
:lang(ja) body { font-family:'Hiragino Kaku Gothic ProN','Yu Gothic',Meiryo,'ZIA Inter',sans-serif; }
:lang(zh) body { font-family:'PingFang SC','Microsoft YaHei','ZIA Inter',sans-serif; }

.sidebar { position:fixed; left:0; top:0; bottom:0; width:var(--sidebar-width); background:var(--sidebar-bg); color:var(--sidebar-text); display:flex; flex-direction:column; z-index:10; border-right:1px solid var(--border); transition:width .2s ease, transform .3s ease; }
.sidebar-header { padding:24px 20px 20px; position:relative; }
.sidebar-collapse-btn {
    display:none; position:absolute; top:16px; right:-14px; width:28px; height:28px;
    align-items:center; justify-content:center; border:1px solid var(--border); border-radius:999px;
    background:var(--surface); color:var(--sidebar-text); box-shadow:var(--shadow); cursor:pointer;
    font-size:12px; z-index:12; transition:background .15s, color .15s, border-color .15s, transform .15s;
}
.sidebar-collapse-btn:hover { background:var(--bg); color:var(--primary); border-color:#bfdbfe; }
.logo { display:flex; align-items:center; gap:12px; }
.z-logo {
    width:38px; height:38px; border-radius:50%; display:flex; align-items:center; justify-content:center;
    background:#1D5CC8; color:#fff;
    font-size:19px; font-weight:800; font-family:'ZIA Inter',sans-serif; letter-spacing:-0.5px;
    box-shadow:0 2px 8px rgba(29,92,200,0.28); flex-shrink:0;
}
.logo h1 { font-size:17px; font-weight:700; color:var(--text); letter-spacing:0.3px; }
.logo p { font-size:10px; color:var(--text-secondary); letter-spacing:0.3px; margin-top:2px; }
.sidebar-nav { padding:12px 12px; flex:1; display:flex; flex-direction:column; gap:2px; }
.nav-item { display:flex; align-items:center; gap:12px; padding:10px 14px; color:var(--sidebar-text); text-decoration:none; border-radius:10px; transition:background .18s, color .18s, box-shadow .18s, padding .18s; font-size:13.5px; font-weight:500; }
.nav-item:hover { background:#f0f2f8; color:var(--text); }
.nav-item.active { background:linear-gradient(135deg, #1D5CC8 0%, #2568D8 100%); color:#fff; font-weight:600; box-shadow:0 2px 8px rgba(29,92,200,0.28); }
.nav-item i { width:18px; text-align:center; font-size:14px; opacity:0.85; }
.nav-item.active i { opacity:1; }
.sidebar-stats { padding:14px 16px; border-top:1px solid var(--border); display:grid; grid-template-columns:repeat(3,1fr); gap:6px; background:var(--bg); }
.stat-item { text-align:center; }
.stat-number { display:block; font-size:17px; font-weight:700; color:var(--primary); }
.stat-label { font-size:9px; color:var(--text-secondary); text-transform:uppercase; letter-spacing:.5px; }

.main-content { margin-left:var(--sidebar-width); height:100vh; position:relative; overflow:hidden; transition:margin-left .2s ease; }
.tab-content { display:none; position:absolute; top:54px; left:0; right:0; bottom:0; }
.tab-content.active { display:flex; flex-direction:column; }
.page-container { padding:28px 32px; overflow-y:auto; flex:1; min-height:0; }
.page-header { margin-bottom:22px; }
.page-header h2 { font-size:20px; font-weight:700; letter-spacing:-0.2px; color:var(--text); }
.page-header h2 i { color:var(--primary); margin-right:8px; font-size:17px; }
.page-header p { color:var(--text-secondary); font-size:13px; margin-top:4px; }

@media(min-width:769px) {
    .sidebar-collapse-btn { display:flex; }
    body.sidebar-collapsed .sidebar { width:var(--sidebar-collapsed-width); }
    body.sidebar-collapsed .main-content { margin-left:var(--sidebar-collapsed-width); }
    body.sidebar-collapsed .sidebar-header { padding:18px 10px 12px; display:flex; align-items:center; justify-content:center; }
    body.sidebar-collapsed .logo { justify-content:center; gap:0; }
    body.sidebar-collapsed .logo h1,
    body.sidebar-collapsed .logo p,
    body.sidebar-collapsed .beta-badge,
    body.sidebar-collapsed .nav-item span,
    body.sidebar-collapsed .chat-history,
    body.sidebar-collapsed .usage-meter,
    body.sidebar-collapsed .sidebar-stats { display:none !important; }
    body.sidebar-collapsed .sidebar-nav { padding:12px 8px; gap:6px; }
    body.sidebar-collapsed .nav-item {
        justify-content:center; gap:0; min-height:42px; padding:10px 0; border-radius:12px;
    }
    body.sidebar-collapsed .nav-item i { width:auto; min-width:20px; font-size:15px; }
    body.sidebar-collapsed .sidebar-collapse-btn i { transform:rotate(180deg); }
}

.chat-container { display:flex; flex-direction:column; max-width:1100px; width:100%; margin:0 auto; padding:0 20px; min-height:0; height:100%; }
.chat-header { padding:12px 0 6px; text-align:center; flex-shrink:0; }
.chat-header h2 { font-size:18px; font-weight:600; }
.chat-header h2 i { color:var(--primary); margin-right:6px; }
.chat-header p { color:var(--text-secondary); font-size:12px; }
.chat-messages { flex:1; overflow-y:auto; padding:10px 0; display:flex; flex-direction:column; gap:14px; min-height:0; }
.chat-input-area { flex-shrink:0; padding:8px 0 12px; }
.chat-input-wrapper { display:flex; gap:8px; align-items:flex-end; background:var(--surface); border:1.5px solid var(--border); border-radius:14px; padding:6px 6px 6px 16px; transition:border-color .2s, box-shadow .2s; box-shadow:var(--shadow); }
.chat-input-wrapper:focus-within { border-color:var(--primary); box-shadow:0 0 0 3px rgba(29,92,200,0.10); }
#chat-input { flex:1; border:none; outline:none; resize:none; font-family:inherit; font-size:14px; padding:8px 0; min-height:20px; max-height:100px; background:transparent; color:var(--text); }
#chat-send { width:38px; height:38px; border-radius:10px; border:none; background:var(--primary); color:#fff; cursor:pointer; display:flex; align-items:center; justify-content:center; flex-shrink:0; box-shadow:0 2px 6px rgba(29,92,200,0.28); transition:all .15s; }
#chat-send:hover { transform:scale(1.05); box-shadow:0 3px 8px rgba(29,92,200,0.38); }
/* .chat-hints now sits above the mode bar — add space below, not above. */
.chat-hints { display:flex; gap:6px; margin-bottom:8px; flex-wrap:wrap; }
/* Model selector moved out of the textarea into the mode bar. */
.chat-model-select {
  margin-left:auto; border:1px solid var(--border); background:var(--surface);
  color:var(--text-secondary,#6b7280); border-radius:8px; padding:4px 10px;
  font-size:12px; cursor:pointer; outline:none; max-width:180px; flex-shrink:0;
}
.chat-model-select:hover { border-color:var(--primary); }
.hint-btn { background:var(--surface); border:1px solid var(--border); padding:6px 14px; border-radius:20px; font-size:11.5px; cursor:pointer; color:var(--text-secondary); font-family:inherit; transition:all .18s; box-shadow:none; }
.hint-btn:hover { border-color:var(--primary); color:var(--primary); background:#f5f7ff; }

.message { display:flex; gap:10px; animation:fadeIn .25s ease; }
@keyframes fadeIn { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:translateY(0)} }
.message.user { flex-direction:row-reverse; }
.message-avatar { width:34px; height:34px; border-radius:50%; display:flex; align-items:center; justify-content:center; flex-shrink:0; font-size:13px; }
.message.bot .message-avatar { background:linear-gradient(135deg, #1D5CC8, #2568D8); color:#fff; box-shadow:0 2px 4px rgba(29,92,200,0.22); }
.message.user .message-avatar { background:linear-gradient(135deg, #059669, #10b981); color:#fff; }
.message-content { max-width:78%; padding:14px 18px; border-radius:var(--radius); font-size:13.5px; line-height:1.7; }
.message.bot .message-content { background:var(--surface); border:1px solid var(--border); border-radius:4px var(--radius) var(--radius) var(--radius); box-shadow:var(--shadow); }
.message.user .message-content { background:var(--primary); color:#fff; border-radius:var(--radius) 4px var(--radius) var(--radius); box-shadow:0 2px 4px rgba(29,92,200,0.20); }
.message-content ul { margin:6px 0; padding-left:18px; } .message-content li { margin:3px 0; } .message-content strong { font-weight:600; }
.sources-list { margin-top:10px; padding-top:10px; border-top:1px solid var(--border); font-size:11px; color:var(--text-secondary); }
.sources-list summary { cursor:pointer; font-weight:500; color:var(--primary); }
.source-item { padding:4px 0; display:flex; align-items:center; gap:6px; cursor:pointer; }
.source-badge { background:var(--primary-light); color:#fff; padding:2px 7px; border-radius:4px; font-size:9px; font-weight:600; white-space:nowrap; }
.source-filename { margin-top:2px; font-size:10.5px; color:var(--text-secondary); overflow-wrap:anywhere; }
.typing-indicator { display:flex; gap:4px; padding:6px 0; }
.typing-indicator span { width:7px; height:7px; background:var(--text-secondary); border-radius:50%; animation:typing 1.4s infinite; }
.typing-indicator span:nth-child(2){animation-delay:.2s} .typing-indicator span:nth-child(3){animation-delay:.4s}
@keyframes typing { 0%,60%,100%{transform:translateY(0);opacity:.4} 30%{transform:translateY(-5px);opacity:1} }

.search-bar { display:flex; align-items:center; gap:8px; background:var(--surface); border:1px solid var(--border); border-radius:8px; padding:8px 14px; margin-top:12px; max-width:400px; }
.search-bar i { color:var(--text-secondary); font-size:13px; }
.search-bar input { border:none; outline:none; font-size:14px; font-family:inherit; flex:1; background:transparent; }

.category-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(280px,1fr)); gap:12px; margin-top:16px; }
.cat-card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:18px 20px; display:flex; align-items:center; gap:14px; cursor:pointer; transition:all .18s; box-shadow:var(--shadow); }
.cat-card:hover { border-color:var(--primary-light); box-shadow:0 4px 12px rgba(29,92,200,0.09); transform:translateY(-1px); }
.cat-card > i { font-size:22px; width:28px; text-align:center; }
.cat-card h3 { font-size:14px; font-weight:600; }
.cat-count { display:inline-block; background:var(--bg); border-radius:10px; padding:1px 8px; font-size:11px; font-weight:600; color:var(--primary); margin-left:6px; }

.doc-list-bar { display:flex; align-items:center; gap:12px; margin-bottom:14px; flex-wrap:wrap; }
.back-btn { background:var(--surface); border:1px solid var(--border); border-radius:8px; padding:7px 14px; cursor:pointer; font-size:13px; font-family:inherit; }
.back-btn:hover { border-color:var(--primary); color:var(--primary); }
.doc-list-bar h3 { font-size:16px; font-weight:600; flex:1; }
.doc-list-bar input { padding:7px 12px; border:1px solid var(--border); border-radius:8px; font-size:13px; font-family:inherit; width:240px; outline:none; }
.doc-list-bar input:focus { border-color:var(--primary); }
.documents-grid { display:flex; flex-direction:column; gap:6px; }
.doc-card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:14px 18px; cursor:pointer; transition:all .18s; display:flex; gap:14px; align-items:flex-start; box-shadow:var(--shadow); }
.doc-card:hover { border-color:var(--primary-light); box-shadow:0 3px 10px rgba(29,92,200,0.09); transform:translateY(-1px); }
.doc-original-name { margin-top:2px; font-size:12px; color:var(--text-secondary); overflow-wrap:anywhere; }
.doc-original-name i { font-size:11px; margin-right:4px; }
.doc-empty-state { width:100%; text-align:center; padding:44px 18px; color:#94a3b8; display:flex; flex-direction:column; align-items:center; gap:6px; }
.doc-empty-state i { font-size:36px; margin-bottom:4px; }
.doc-empty-state strong { color:var(--text-secondary); font-size:14px; font-weight:700; overflow-wrap:anywhere; }
.doc-empty-state span { font-size:12px; max-width:520px; }
.doc-card-actions { margin-left:auto; display:flex; flex-direction:column; gap:6px; align-items:flex-end; flex-shrink:0; max-width:220px; }
.doc-icon { width:38px; height:38px; border-radius:8px; background:#eff6ff; display:flex; align-items:center; justify-content:center; color:var(--primary); flex-shrink:0; font-size:16px; }
.doc-info { flex:1; min-width:0; }
.doc-title { font-weight:500; font-size:13px; margin-bottom:3px; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.doc-meta { display:flex; gap:10px; font-size:11px; color:var(--text-secondary); flex-wrap:wrap; }
.doc-meta span { display:flex; align-items:center; gap:3px; }
.doc-summary { font-size:12px; color:var(--text-secondary); margin-top:4px; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.pagination { padding:14px 0; display:flex; gap:6px; justify-content:center; }
.page-btn { padding:6px 12px; border:1px solid var(--border); border-radius:6px; background:var(--surface); cursor:pointer; font-size:12px; }
.page-btn:hover { border-color:var(--primary); color:var(--primary); }
.page-btn.active { background:var(--primary); color:#fff; border-color:var(--primary); }

.modal-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,0.5); z-index:1000; justify-content:center; align-items:center; padding:40px; }
.modal-overlay.active { display:flex; }
.modal-content { background:var(--surface); border-radius:var(--radius); max-width:760px; width:100%; max-height:80vh; overflow-y:auto; padding:28px; position:relative; box-shadow:0 8px 32px rgba(0,0,0,0.12); }
.modal-close { position:absolute; top:14px; right:14px; background:none; border:none; font-size:18px; cursor:pointer; color:var(--text-secondary); width:32px; height:32px; border-radius:50%; display:flex; align-items:center; justify-content:center; }
.modal-close:hover { background:var(--bg); }
.modal-content h2 { font-size:18px; margin-bottom:14px; padding-right:36px; }
.detail-grid { display:grid; grid-template-columns:130px 1fr; gap:6px 14px; font-size:13px; margin-bottom:14px; }
.detail-label { color:var(--text-secondary); font-weight:500; }
.detail-section { margin-top:16px; padding-top:14px; border-top:1px solid var(--border); }
.detail-section h3 { font-size:14px; margin-bottom:6px; }
.detail-section p,.detail-section ul { font-size:13px; line-height:1.7; color:var(--text-secondary); }

.sh-force-match-toolbar {
    display:flex; align-items:center; justify-content:space-between; gap:14px;
    border:1px solid #bfdbfe; background:#eff6ff; border-radius:8px;
    padding:10px 12px; margin:8px 0 10px;
}
.sh-force-match-toolbar b { display:block; color:#1e3a8a; font-size:13px; margin-bottom:2px; }
.sh-force-match-toolbar span { color:#334155; font-size:12px; line-height:1.35; }
.sh-force-match-actions { display:flex; gap:8px; align-items:center; flex:none; }
.sh-force-secondary,
.sh-force-primary {
    border-radius:7px; padding:8px 12px; font-size:12px; font-weight:800;
    cursor:pointer; display:inline-flex; align-items:center; gap:6px; white-space:nowrap;
}
.sh-force-secondary { border:1px solid #cbd5e1; background:#fff; color:#334155; }
.sh-force-primary { border:1px solid #2563eb; background:#2563eb; color:#fff; }
.sh-force-primary span {
    background:rgba(255,255,255,.22); color:#fff; border-radius:999px;
    min-width:18px; height:18px; display:inline-flex; align-items:center; justify-content:center;
    font-size:11px; line-height:1;
}
.sh-force-secondary:disabled,
.sh-force-primary:disabled { opacity:.65; cursor:not-allowed; }
.sh-force-match-cell,
.sh-force-line-edit { background:#eff6ff; }
.sh-force-match-cell.changed,
.sh-force-line-edit.changed { background:#dbeafe; }
.sh-force-match-input {
    width:100%; min-height:46px; resize:vertical; border:1px solid #bfdbfe;
    border-radius:6px; background:#fff; color:#0f172a; padding:7px 8px;
    font-family:inherit; font-size:12px; font-weight:600; line-height:1.35;
    outline:none; box-sizing:border-box;
}
.sh-force-match-input:focus { border-color:#2563eb; box-shadow:0 0 0 2px rgba(37,99,235,.14); }

.agr-section { margin-bottom:24px; }
.agr-section h3 { font-size:15px; font-weight:600; margin-bottom:10px; padding-bottom:6px; border-bottom:2px solid var(--border); }
.agr-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); gap:10px; }
.agr-card { background:var(--surface); border:1px solid var(--border); border-radius:10px; padding:14px; cursor:pointer; transition:all .15s; display:flex; align-items:center; gap:10px; }
.agr-card:hover { border-color:var(--primary-light); box-shadow:0 2px 8px rgba(0,0,0,0.05); }
.agr-flag { width:36px; height:36px; border-radius:50%; display:flex; align-items:center; justify-content:center; color:#fff; font-weight:700; font-size:12px; flex-shrink:0; }
.agr-card-info h4 { font-size:13px; font-weight:600; }
.agr-card-info p { font-size:11px; color:var(--text-secondary); }
.agr-doc-count { margin-left:auto; background:var(--bg); border-radius:6px; padding:3px 8px; font-size:12px; font-weight:600; color:var(--text-secondary); }

.dashboard-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:16px; }
#home-footer-links { display:none !important; }
.dash-card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:20px; box-shadow:var(--shadow); }
.dash-card.wide { grid-column:span 2; }
.dash-card h3 { font-size:14px; font-weight:600; margin-bottom:14px; }
.chart-container { display:flex; flex-direction:column; gap:6px; }
.bar-item { display:flex; align-items:center; gap:10px; font-size:12px; }
.bar-label { width:170px; text-align:right; color:var(--text-secondary); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.bar-track { flex:1; height:22px; background:var(--bg); border-radius:5px; overflow:hidden; }
.bar-fill { height:100%; border-radius:5px; display:flex; align-items:center; padding-left:7px; font-size:10px; font-weight:600; color:#fff; min-width:24px; transition:width .6s ease; }
.stats-row { display:grid; grid-template-columns:repeat(5,1fr); gap:12px; padding:10px 0; }
.big-stat { text-align:center; }
.big-stat span { display:block; font-size:22px; font-weight:700; color:var(--primary); }
.big-stat label { font-size:11px; color:var(--text-secondary); }
.dash-action-summary {
    display:flex; align-items:center; justify-content:space-between; gap:20px;
    border:1px solid var(--border); border-radius:8px; background:var(--surface);
    padding:18px 20px; margin-bottom:14px; box-shadow:var(--shadow);
}
.dash-action-summary h3 { margin:3px 0 5px; font-size:22px; line-height:1.25; color:var(--text); letter-spacing:0; }
.dash-action-summary p { margin:0; color:var(--text-secondary); font-size:13px; line-height:1.45; }
.dash-period-control {
    display:flex; align-items:center; gap:6px; flex-wrap:wrap;
    border:1px solid var(--border); border-radius:8px; padding:4px; background:var(--surface);
}
.dash-period-control button {
    border:none; background:transparent; color:var(--text-secondary);
    border-radius:6px; padding:8px 11px; min-height:34px;
    font-size:12px; font-weight:700; cursor:pointer; white-space:nowrap;
}
.dash-period-control button.active { background:var(--primary); color:#fff; }
.dash-exec-hero {
    display:flex; align-items:flex-end; justify-content:space-between; gap:20px;
    border:1px solid #bfdbfe; border-radius:8px; background:linear-gradient(135deg,#f8fbff,#fff);
    padding:18px 20px; margin-bottom:12px; box-shadow:var(--shadow);
}
.dash-exec-hero h3 { margin:3px 0 5px; font-size:16px; color:var(--text); letter-spacing:0; }
.dash-exec-hero strong { display:block; font-size:34px; line-height:1.05; color:var(--text); letter-spacing:0; font-variant-numeric:tabular-nums; }
.dash-exec-hero p { margin:7px 0 0; color:var(--text-secondary); font-size:12.5px; }
.dash-hero-side { display:flex; flex-direction:column; align-items:flex-end; gap:8px; min-width:220px; }
.dash-exec-grid { margin-bottom:10px; }
.dash-exec-card { cursor:default; }
.dash-exec-card:hover { transform:none; border-color:var(--border); box-shadow:var(--shadow); }
.dash-delta {
    display:inline-flex; align-items:center; gap:4px; margin-top:8px;
    font-size:11.5px; font-weight:700; line-height:1.3;
}
.dash-delta.up { color:#166534; }
.dash-delta.down { color:#b91c1c; }
.dash-delta.flat { color:var(--text-secondary); }
.dash-assumptions {
    color:var(--text-secondary); font-size:11.5px;
    border:none; border-radius:0; background:transparent;
}
.dash-assumptions details { padding:0; }
.dash-assumptions summary { cursor:pointer; font-weight:700; color:var(--text-secondary); }
.dash-assumptions div { margin-top:6px; line-height:1.5; max-width:420px; text-align:right; }
.dash-summary-kicker {
    font-size:11px; font-weight:700; color:var(--text-secondary);
    text-transform:uppercase; letter-spacing:0.06em;
}
.dash-primary-action {
    border:none; background:var(--primary); color:#fff; border-radius:7px;
    padding:10px 16px; font-size:13px; font-weight:700; cursor:pointer;
    white-space:nowrap; min-height:38px;
}
.dash-primary-action:hover { background:var(--primary-dark); }
.dash-simple-grid { display:grid; grid-template-columns:repeat(4, minmax(0, 1fr)); gap:10px; margin-bottom:10px; }
.dash-status-card {
    text-align:left; border:1px solid var(--border); border-radius:8px; background:var(--surface);
    padding:12px; min-height:104px; cursor:default; box-shadow:var(--shadow);
    display:flex; flex-direction:column; justify-content:space-between; transition:transform .12s, border-color .12s, box-shadow .12s;
}
.dash-status-card:hover { transform:none; border-color:var(--border); box-shadow:var(--shadow); }
.dash-status-top { display:flex; align-items:center; gap:8px; color:var(--text-secondary); font-size:12px; font-weight:700; }
.dash-status-icon { width:26px; height:26px; border-radius:6px; display:inline-flex; align-items:center; justify-content:center; background:#eef2ff; color:var(--primary); flex-shrink:0; }
.dash-status-card strong { display:block; margin-top:8px; font-size:24px; line-height:1; color:var(--text); font-variant-numeric:tabular-nums; }
.dash-status-card small { display:block; margin-top:6px; color:var(--text-secondary); font-size:11px; line-height:1.3; }
.dash-status-card.danger .dash-status-icon { background:#fee2e2; color:#b91c1c; }
.dash-status-card.warning .dash-status-icon { background:#fef3c7; color:#a16207; }
.dash-status-card.success .dash-status-icon { background:#dcfce7; color:#166534; }
.dash-status-card.info .dash-status-icon { background:#e0f2fe; color:#0369a1; }
.dash-status-card.quiet .dash-status-icon { background:#f1f5f9; color:#64748b; }
.dash-next-actions { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:16px; }
.dash-next-actions button,
.dash-next-summary {
    border:1px solid var(--border); background:var(--surface); color:var(--text);
    border-radius:7px; padding:8px 11px; font-size:12px; font-weight:650;
    display:inline-flex; align-items:center; gap:7px;
}
.dash-next-actions button { cursor:pointer; }
.dash-next-summary { cursor:default; }
.dash-next-actions button:hover { border-color:var(--primary-light); color:var(--primary); }
.dash-next-actions b {
    min-width:20px; height:20px; padding:0 6px; border-radius:10px;
    display:inline-flex; align-items:center; justify-content:center;
    background:var(--bg); color:var(--text-secondary); font-size:11px;
}
.dash-next-summary.danger i { color:#b91c1c; }
.dash-next-summary.warning i { color:#a16207; }
.dash-next-summary.neutral i { color:var(--text-secondary); }
.dash-attention-strip {
    border:1px solid var(--border);
    border-radius:8px;
    background:var(--surface);
    box-shadow:var(--shadow);
    padding:12px 14px;
    margin:0 0 14px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:14px;
}
.dash-attention-main {
    display:flex;
    align-items:flex-start;
    gap:10px;
    min-width:0;
}
.dash-attention-main > span {
    width:28px;
    height:28px;
    border-radius:7px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    flex-shrink:0;
    background:#f1f5f9;
    color:var(--text-secondary);
}
.dash-attention-main.danger > span { background:#fee2e2; color:#b91c1c; }
.dash-attention-main.warning > span { background:#fef3c7; color:#a16207; }
.dash-attention-main.success > span { background:#dcfce7; color:#166534; }
.dash-attention-main b {
    display:block;
    color:var(--text-secondary);
    font-size:10.5px;
    font-weight:800;
    letter-spacing:.04em;
    text-transform:uppercase;
}
.dash-attention-main strong {
    display:block;
    color:var(--text);
    font-size:14px;
    line-height:1.25;
    margin-top:1px;
}
.dash-attention-main small {
    display:block;
    color:var(--text-secondary);
    font-size:12px;
    margin-top:3px;
}
.dash-secondary-action {
    border:1px solid #bfdbfe;
    border-radius:7px;
    background:#eff6ff;
    color:#1d4ed8;
    padding:8px 11px;
    font-size:12px;
    font-weight:800;
    cursor:pointer;
    display:inline-flex;
    gap:7px;
    align-items:center;
    justify-content:center;
    white-space:nowrap;
}
.dash-secondary-action:hover { background:#dbeafe; }
.dash-document-usage-card { margin-bottom:16px; padding:14px 16px; }
.dash-metrics-card { margin-bottom:16px; padding:14px 16px; }
.dash-muted-mini {
    margin-top:2px;
    color:#94a3b8;
    font-size:11px;
    font-weight:500;
}
.dash-doc-usage-table .dash-num {
    text-align:right;
    font-variant-numeric:tabular-nums;
    white-space:nowrap;
}
.dash-card-head.compact { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom:10px; }
.dash-card-head.compact h3 { margin:0 0 3px; font-size:14px; }
.dash-card-head.compact p { margin:0; color:var(--text-secondary); font-size:12px; line-height:1.35; }
.dash-doc-usage-table-wrap { overflow-x:auto; border:1px solid var(--border); border-radius:8px; }
.dash-doc-usage-table { width:100%; min-width:760px; border-collapse:collapse; font-size:12px; background:var(--surface); }
.dash-doc-usage-table th {
    text-align:left; padding:9px 10px; background:var(--bg-secondary);
    color:var(--text-secondary); font-size:11px; text-transform:uppercase; letter-spacing:.02em;
    border-bottom:1px solid var(--border);
}
.dash-table-head-label {
    display:block;
    line-height:1.15;
    white-space:nowrap;
}
.dash-table-head-unit {
    display:block;
    margin-top:2px;
    color:#94a3b8;
    font-size:10px;
    font-weight:600;
    line-height:1.1;
    text-transform:none;
    letter-spacing:0;
    white-space:nowrap;
}
.dash-doc-usage-table td { padding:9px 10px; border-bottom:1px solid var(--border); vertical-align:top; }
.dash-doc-usage-table td:nth-child(n+3) { text-align:right; font-variant-numeric:tabular-nums; font-weight:700; }
.dash-doc-usage-table td b { display:block; color:var(--text); }
.dash-doc-usage-table td span { display:block; margin-top:2px; color:var(--text-secondary); max-width:420px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.broker-queue { margin:0 0 14px; }
.broker-queue-card {
    border:1px solid var(--border);
    border-left:4px solid #64748b;
    border-radius:8px;
    background:var(--surface);
    box-shadow:var(--shadow);
    padding:12px;
    display:grid;
    grid-template-columns:minmax(260px, 1fr) auto auto;
    gap:12px;
    align-items:center;
}
.broker-queue-card.danger { border-left-color:#dc2626; }
.broker-queue-card.warning { border-left-color:#f59e0b; }
.broker-queue-card.success { border-left-color:#16a34a; }
.broker-queue-card.info { border-left-color:#2563eb; }
.broker-queue-main { display:flex; gap:10px; align-items:flex-start; min-width:0; }
.broker-queue-icon {
    width:34px; height:34px; border-radius:8px; display:inline-flex;
    align-items:center; justify-content:center; background:#f1f5f9; color:#475569;
    flex-shrink:0;
}
.broker-queue-card.danger .broker-queue-icon { background:#fee2e2; color:#b91c1c; }
.broker-queue-card.warning .broker-queue-icon { background:#fef3c7; color:#a16207; }
.broker-queue-card.success .broker-queue-icon { background:#dcfce7; color:#166534; }
.broker-queue-card.info .broker-queue-icon { background:#dbeafe; color:#1d4ed8; }
.broker-queue-kicker {
    color:var(--text-secondary); font-size:10.5px; font-weight:800;
    letter-spacing:.05em; text-transform:uppercase; margin-bottom:2px;
}
.broker-queue-main h3 { margin:0; font-size:15px; color:var(--text); letter-spacing:0; }
.broker-queue-main p { margin:4px 0 0; color:var(--text-secondary); font-size:12px; line-height:1.4; }
.broker-queue-metrics { display:grid; grid-template-columns:repeat(4, minmax(88px, 1fr)); gap:6px; }
.broker-queue-metric {
    border:1px solid var(--border); border-radius:7px; background:#fff;
    padding:7px 9px; min-width:88px; text-align:left; cursor:pointer;
    color:var(--text); font:inherit;
}
.broker-queue-metric span {
    display:block; color:var(--text-secondary); font-size:10.5px; font-weight:750;
    white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.broker-queue-metric b { display:block; margin-top:2px; font-size:18px; line-height:1; font-variant-numeric:tabular-nums; }
.broker-queue-metric.danger b { color:#b91c1c; }
.broker-queue-metric.warning b { color:#92400e; }
.broker-queue-metric.success b { color:#166534; }
.broker-queue-metric:hover { border-color:#93c5fd; background:#f8fbff; }
.broker-queue-action {
    border:1px solid #bfdbfe; border-radius:7px; background:#eff6ff; color:#1d4ed8;
    padding:8px 11px; font-size:12px; font-weight:800; cursor:pointer;
    display:inline-flex; gap:7px; align-items:center; justify-content:center; white-space:nowrap;
}
.sh-background-jobs { margin:0 0 14px; }
.sh-bg-jobs-card {
    border:1px solid #bfdbfe;
    border-radius:8px;
    background:linear-gradient(180deg, #f8fbff 0%, #fff 100%);
    box-shadow:var(--shadow);
    padding:12px;
}
.sh-bg-jobs-head {
    display:flex;
    justify-content:space-between;
    gap:12px;
    align-items:flex-start;
}
.sh-bg-jobs-kicker {
    color:#2563eb;
    font-size:10.5px;
    font-weight:850;
    letter-spacing:.04em;
    text-transform:uppercase;
    margin-bottom:3px;
}
.sh-bg-jobs-head h3 {
    margin:0;
    color:var(--text);
    font-size:15px;
    letter-spacing:0;
}
.sh-bg-jobs-head p {
    margin:4px 0 0;
    color:var(--text-secondary);
    font-size:12px;
    line-height:1.4;
}
.sh-bg-jobs-refresh {
    border:1px solid #bfdbfe;
    background:#fff;
    color:#1d4ed8;
    border-radius:7px;
    padding:7px 10px;
    font-size:12px;
    font-weight:800;
    cursor:pointer;
    display:inline-flex;
    gap:6px;
    align-items:center;
    white-space:nowrap;
}
.sh-bg-jobs-refresh:hover { background:#eff6ff; }
.sh-bg-jobs-list { display:grid; gap:8px; margin-top:10px; }
.sh-bg-job-row {
    display:grid;
    grid-template-columns:34px minmax(0, 1fr);
    gap:9px;
    border:1px solid var(--border);
    border-radius:8px;
    background:#fff;
    padding:9px;
}
.sh-bg-job-row.warning { border-color:#fde68a; background:#fffbeb; }
.sh-bg-job-row.danger { border-color:#fecaca; background:#fff7f7; }
.sh-bg-job-icon {
    width:34px;
    height:34px;
    border-radius:8px;
    background:#dbeafe;
    color:#1d4ed8;
    display:inline-flex;
    align-items:center;
    justify-content:center;
}
.sh-bg-job-row.warning .sh-bg-job-icon { background:#fef3c7; color:#a16207; }
.sh-bg-job-row.danger .sh-bg-job-icon { background:#fee2e2; color:#b91c1c; }
.sh-bg-job-main { min-width:0; }
.sh-bg-job-topline { display:flex; align-items:center; gap:8px; min-width:0; flex-wrap:wrap; }
.sh-bg-job-topline strong {
    color:var(--text);
    font-size:13px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    max-width:min(560px, 100%);
}
.sh-bg-job-chip {
    border-radius:999px;
    padding:2px 7px;
    font-size:10.5px;
    font-weight:850;
    background:#e2e8f0;
    color:#475569;
    white-space:nowrap;
}
.sh-bg-job-chip.info { background:#dbeafe; color:#1d4ed8; }
.sh-bg-job-chip.warning { background:#fef3c7; color:#92400e; }
.sh-bg-job-chip.danger { background:#fee2e2; color:#991b1b; }
.sh-bg-job-chip.success { background:#dcfce7; color:#166534; }
.sh-bg-job-meta {
    display:flex;
    gap:8px;
    flex-wrap:wrap;
    color:var(--text-secondary);
    font-size:11px;
    margin-top:3px;
}
.sh-bg-job-bar {
    height:5px;
    border-radius:999px;
    background:#e2e8f0;
    overflow:hidden;
    margin-top:7px;
}
.sh-bg-job-bar span {
    display:block;
    height:100%;
    border-radius:inherit;
    background:#2563eb;
}
.sh-bg-job-bar span.pct-0 { width: 0%; }
.sh-bg-job-bar span.pct-5 { width: 5%; }
.sh-bg-job-bar span.pct-10 { width: 10%; }
.sh-bg-job-bar span.pct-15 { width: 15%; }
.sh-bg-job-bar span.pct-20 { width: 20%; }
.sh-bg-job-bar span.pct-25 { width: 25%; }
.sh-bg-job-bar span.pct-30 { width: 30%; }
.sh-bg-job-bar span.pct-35 { width: 35%; }
.sh-bg-job-bar span.pct-40 { width: 40%; }
.sh-bg-job-bar span.pct-45 { width: 45%; }
.sh-bg-job-bar span.pct-50 { width: 50%; }
.sh-bg-job-bar span.pct-55 { width: 55%; }
.sh-bg-job-bar span.pct-60 { width: 60%; }
.sh-bg-job-bar span.pct-65 { width: 65%; }
.sh-bg-job-bar span.pct-70 { width: 70%; }
.sh-bg-job-bar span.pct-75 { width: 75%; }
.sh-bg-job-bar span.pct-80 { width: 80%; }
.sh-bg-job-bar span.pct-85 { width: 85%; }
.sh-bg-job-bar span.pct-90 { width: 90%; }
.sh-bg-job-bar span.pct-95 { width: 95%; }
.sh-bg-job-bar span.pct-100 { width: 100%; }
.sh-bg-job-row.warning .sh-bg-job-bar span { background:#f59e0b; }
.sh-bg-job-row.danger .sh-bg-job-bar span { background:#dc2626; }
.sh-bg-job-estimates {
    margin-top:8px;
    padding:7px 9px;
    border:1px solid #dbeafe;
    border-radius:7px;
    background:#f8fbff;
    color:#475569;
    font-size:11px;
    line-height:1.4;
}
.sh-bg-job-eta-total { display:inline-flex; align-items:center; gap:5px; color:#1d4ed8; font-weight:800; }
.sh-bg-job-estimate-list { display:flex; flex-wrap:wrap; gap:4px 10px; margin-top:4px; }
.sh-bg-job-estimate-list span { white-space:nowrap; }
.sh-bg-job-warning,
.sh-bg-job-error,
.sh-bg-jobs-load-error {
    margin-top:7px;
    border-radius:7px;
    padding:7px 9px;
    font-size:11.5px;
    line-height:1.35;
}
.sh-bg-job-warning { background:#fef3c7; color:#92400e; }
.sh-bg-job-error,
.sh-bg-jobs-load-error { background:#fee2e2; color:#991b1b; }
.sh-bg-job-actions {
    display:flex;
    flex-wrap:wrap;
    gap:7px;
    margin-top:8px;
}
.sh-bg-job-action {
    border:1px solid #93c5fd;
    border-radius:7px;
    background:#fff;
    color:#1d4ed8;
    padding:6px 9px;
    font-size:11.5px;
    font-weight:800;
    cursor:pointer;
    display:inline-flex;
    align-items:center;
    gap:6px;
}
.sh-bg-job-action:hover:not(:disabled) { background:#eff6ff; }
.sh-bg-job-action.danger { border-color:#fca5a5; color:#b91c1c; }
.sh-bg-job-action.danger:hover:not(:disabled) { background:#fef2f2; }
.sh-bg-job-action:disabled { opacity:.6; cursor:wait; }
/* Shipment processing now lives in the Shipment Docs table, not in a
   separate dashboard card. These rows retain OCR-style progress and ETA. */
.sh-bg-table-row > td {
    padding:8px 10px !important;
    background:#f8fbff;
    border-bottom:1px solid #bfdbfe;
}
.sh-bg-table-row.warning > td { background:#fffbeb; border-bottom-color:#fde68a; }
.sh-bg-table-row.danger > td { background:#fff7f7; border-bottom-color:#fecaca; }
.sh-bg-table-row .sh-bg-job-row { max-width:none; }
.sh-bg-table-row .sh-bg-job-estimates { background:#fff; }
.sh-bg-virtual-row td { background:#f8fbff; vertical-align:middle; }
.sh-bg-virtual-row.warning td { background:#fffbeb; }
.sh-bg-virtual-row.danger td { background:#fff7f7; }
.sh-bg-virtual-id,
.sh-bg-virtual-model,
.sh-bg-virtual-template,
.sh-bg-virtual-muted { color:#64748b; font-size:11px; font-weight:750; }
.sh-bg-virtual-id { display:inline-flex; align-items:center; gap:5px; color:#2563eb; white-space:nowrap; }
.sh-bg-virtual-open { border:0; background:transparent; padding:0; cursor:pointer; font:inherit; }
.sh-bg-virtual-open:hover { color:#1d4ed8; text-decoration:underline; }
.sh-bg-virtual-open:focus-visible { outline:2px solid #2563eb; outline-offset:3px; border-radius:3px; }
.sh-bg-virtual-id.danger { color:#b91c1c; }
.sh-bg-virtual-name { min-width:0; display:grid; gap:2px; }
.sh-bg-virtual-name b { color:var(--text); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.sh-bg-virtual-name small,
.sh-bg-virtual-system small { color:var(--text-secondary); font-size:10.5px; line-height:1.3; }
.sh-bg-virtual-template { display:block; max-width:150px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.sh-bg-virtual-model { display:inline-block; border-radius:999px; padding:3px 7px; background:#dbeafe; color:#1d4ed8; white-space:nowrap; }
.sh-bg-virtual-docs { min-width:82px; text-align:center; color:#334155; font-size:11px; }
.sh-bg-virtual-system { display:grid; gap:3px; min-width:0; }
.sh-bg-virtual-system > span { display:inline-flex; align-items:center; gap:5px; width:max-content; max-width:100%; overflow:hidden; text-overflow:ellipsis; border-radius:999px; padding:3px 8px; background:#dbeafe; color:#1d4ed8; font-size:11px; font-weight:850; white-space:nowrap; }
.sh-bg-virtual-system > span[data-sh-status-tooltip] { cursor:help; }
.sh-bg-virtual-eta { display:flex; align-items:center; gap:4px; color:#475569; font-size:10.5px; font-weight:750; line-height:1.3; white-space:normal; }
.sh-bg-virtual-system.warning > span { background:#fef3c7; color:#92400e; }.sh-bg-virtual-system.danger > span { background:#fee2e2; color:#991b1b; }
.sh-bg-virtual-review { display:flex; flex-wrap:wrap; align-items:center; gap:5px; color:#64748b; font-size:11px; font-weight:750; }
.sh-bg-virtual-review small.danger { color:#b91c1c; }
.sh-bg-virtual-action { border:1px solid #93c5fd; border-radius:6px; background:#fff; color:#1d4ed8; padding:4px 6px; cursor:pointer; font:inherit; font-size:10.5px; font-weight:800; white-space:nowrap; }
.sh-bg-virtual-action.danger { border-color:#fca5a5; color:#b91c1c; }
.sh-bg-virtual-action:disabled { opacity:.6; cursor:wait; }
.dash-card-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom:10px; }
.dash-card-head h3 { margin:0 0 3px; display:flex; align-items:center; gap:7px; }
.dash-card-head p { margin:0; color:var(--text-secondary); font-size:12px; }
.dash-risk-list { display:grid; gap:8px; }
.dash-risk-row {
    display:flex; align-items:center; justify-content:space-between; gap:10px;
    width:100%; border:1px solid var(--border); border-radius:7px; background:var(--surface);
    padding:10px 12px; cursor:default; color:var(--text); font-size:12px; font-weight:700;
}
.dash-risk-row strong { font-size:18px; font-variant-numeric:tabular-nums; }
.dash-risk-row.danger strong { color:#b91c1c; }
.dash-risk-row.warning strong { color:#a16207; }
.dash-risk-row.success strong { color:#166534; }
.dash-risk-row.neutral strong { color:var(--text-secondary); }
.dash-discrepancy-list { display:grid; gap:8px; }
.dash-discrepancy-row {
    display:grid; grid-template-columns:minmax(0,1fr) auto auto; align-items:center; gap:10px;
    border-bottom:1px solid var(--border); padding:8px 0;
}
.dash-discrepancy-row:last-child { border-bottom:none; }
.dash-discrepancy-row > div { min-width:0; }
.dash-discrepancy-row strong { display:block; color:var(--text); font-size:12px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.dash-discrepancy-row span { display:-webkit-box; margin-top:2px; color:var(--text-secondary); font-size:11px; line-height:1.35; overflow:hidden; -webkit-line-clamp:2; -webkit-box-orient:vertical; }
.dash-discrepancy-row em {
    font-style:normal; border-radius:999px; padding:3px 8px; font-size:10px; font-weight:800; text-transform:uppercase;
    background:#f1f5f9; color:#475569;
}
.dash-discrepancy-row em.critical { background:#fee2e2; color:#b91c1c; }
.dash-discrepancy-row em.warning { background:#fef3c7; color:#92400e; }
.dash-discrepancy-row b { color:var(--text); font-size:13px; }
.dash-trend-strip { min-height:118px; display:flex; align-items:flex-end; gap:3px; padding:12px 0 4px; }
.dash-trend-bar { flex:1; min-width:5px; border-radius:3px 3px 0 0; }
.dash-trend-bar--muted { background:#94a3b8; }
.dash-trend-bar--good { background:#16815f; }
.dash-trend-bar--warn { background:#c98211; }
.dash-trend-bar--bad { background:#b23535; }
.dash-trend-bar--h1 { height:8px; }
.dash-trend-bar--h2 { height:16px; }
.dash-trend-bar--h3 { height:25px; }
.dash-trend-bar--h4 { height:34px; }
.dash-trend-bar--h5 { height:43px; }
.dash-trend-bar--h6 { height:52px; }
.dash-trend-bar--h7 { height:61px; }
.dash-trend-bar--h8 { height:72px; }
.dash-trend-bar--h9 { height:82px; }
.dash-trend-bar--h10 { height:92px; }
.dash-empty-line { width:100%; align-self:center; text-align:center; color:var(--text-secondary); font-size:12px; }
.dash-admin-grid { margin-top:2px; }
.dash-volume-scroll {
    width:100%;
    overflow-x:auto;
    overflow-y:hidden;
    -webkit-overflow-scrolling:touch;
    padding:4px 0 2px;
}
.dash-volume-chart {
    display:grid;
    grid-template-columns:52px minmax(0,1fr);
    grid-template-rows:18px 132px 38px;
    gap:8px 12px;
    min-height:196px;
    padding:0 8px 2px 0;
}
.dash-volume-y-unit {
    grid-column:1;
    grid-row:1;
    align-self:end;
    justify-self:end;
    color:var(--text-secondary);
    font-size:10px;
    font-weight:800;
    text-transform:uppercase;
    letter-spacing:0;
}
.dash-volume-y-axis {
    grid-column:1;
    grid-row:2;
    position:relative;
    min-height:132px;
    border-right:1px solid var(--border);
}
.dash-volume-y-tick {
    position:absolute;
    right:8px;
    transform:translateY(50%);
    color:var(--text-secondary);
    font-size:11px;
    font-weight:650;
    white-space:nowrap;
}
.dash-volume-plot {
    grid-column:2;
    grid-row:2;
    position:relative;
    min-height:132px;
    border-bottom:1px solid var(--border);
    overflow:hidden;
}
.dash-volume-gridlines {
    position:absolute;
    inset:0 0 0 0;
    pointer-events:none;
    z-index:1;
}
.dash-volume-gridline {
    position:absolute;
    left:0;
    right:0;
    height:1px;
    background:#e8edf5;
}
.dash-volume-gridline:first-child { background:#dbe3ef; }
.dash-volume-gridline:last-child { background:var(--border); }
.dash-volume-axis {
    grid-column:2;
    grid-row:3;
    position:relative;
    min-height:34px;
    color:var(--text-secondary);
    font-size:11px;
}
.dash-volume-bars {
    position:relative;
    z-index:2;
    height:100%;
    display:flex;
    align-items:flex-end;
    gap:4px;
    padding:0 2px;
}
.dash-volume-day {
    flex:1 0 8px;
    min-width:8px;
    height:100%;
    display:flex;
    align-items:flex-end;
    justify-content:center;
    gap:2px;
}
.dash-volume-bar {
    width:4px;
    min-height:0;
    border-radius:4px 4px 0 0;
    display:block;
}
.dash-volume-bar.docs { background:#2563eb; }
.dash-volume-bar.shipments { background:#16a34a; }
.dash-volume-bar.active-users { background:#2563eb; width:8px; }
.dash-volume-bar.pdf-ocr { background:#16a34a; width:8px; }
.dash-volume-x-tick {
    position:absolute;
    top:5px;
    transform:translateX(-50%);
    display:flex;
    flex-direction:column;
    gap:1px;
    min-width:58px;
    text-align:center;
    white-space:nowrap;
}
.dash-volume-x-tick.start {
    transform:translateX(0);
    text-align:left;
}
.dash-volume-x-tick.end {
    transform:translateX(-100%);
    text-align:right;
}
.dash-volume-x-tick b {
    color:#64748b;
    font-size:11px;
    font-weight:750;
}
.dash-volume-x-tick small {
    color:#94a3b8;
    font-size:10px;
}
.dash-volume-legend {
    display:flex;
    align-items:center;
    gap:14px;
    flex-wrap:wrap;
    margin-top:10px;
    color:var(--text-secondary);
    font-size:12px;
}
.dash-volume-legend span {
    display:inline-flex;
    align-items:center;
    gap:6px;
    min-width:0;
}
.dash-volume-legend i {
    width:10px;
    height:10px;
    border-radius:3px;
    display:inline-block;
}
.dash-volume-legend i.docs { background:#2563eb; }
.dash-volume-legend i.shipments { background:#16a34a; }
.dash-volume-legend i.active-users { background:#2563eb; }
.dash-volume-legend i.pdf-ocr { background:#16a34a; }
.dash-volume-legend b {
    font-weight:700;
    color:var(--text);
}
.dash-usage-charts-summary {
    display:flex;
    align-items:center;
    gap:12px;
    flex-wrap:wrap;
    color:var(--text-secondary);
    font-size:12px;
    margin-bottom:10px;
}
.dash-usage-charts-summary span {
    display:inline-flex;
    align-items:center;
    gap:4px;
}
.dash-usage-charts-body {
    min-height:220px;
}
.dash-usage-chart-grid {
    display:grid;
    grid-template-columns:repeat(2, minmax(0, 1fr));
    gap:12px;
}
.dash-usage-chart-panel {
    min-width:0;
    border:1px solid var(--border);
    border-radius:8px;
    padding:12px;
    background:#fff;
}
.dash-usage-chart-title {
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:10px;
    margin-bottom:8px;
}
.dash-usage-chart-title h4 {
    margin:0 0 3px;
    color:var(--text);
    font-size:13px;
    font-weight:800;
}
.dash-usage-chart-title p {
    margin:0;
    color:var(--text-secondary);
    font-size:11px;
    line-height:1.35;
}
.dash-usage-chart-title strong {
    flex:0 0 auto;
    border-radius:999px;
    background:#f1f5f9;
    color:#334155;
    padding:4px 8px;
    font-size:11px;
    font-weight:800;
    white-space:nowrap;
}

/* ══════════════════════════════════════════════
   MOBILE RESPONSIVE (≤768px)
   ══════════════════════════════════════════════ */
@media(max-width:768px) {
    /* ── Sidebar: off-canvas drawer ── */
    .sidebar {
        width: var(--sidebar-width); transform: translateX(-100%);
        transition: transform 0.3s ease; z-index: 100;
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-backdrop {
        display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4);
        z-index: 99;
    }
    .sidebar-backdrop.active { display: block; }
    .main-content { margin-left: 0 !important; }

    /* ── Hamburger button ── */
    .hamburger-btn { display: flex !important; }

    /* ── Top bar compact ── */
    .top-bar { padding: 0 8px; }
    .top-bar-actions { gap: 4px; }
    .account-name { display: none; }
    .lang-dropdown-btn { padding: 6px 8px; font-size: 12px; }
    .account-dropdown-btn { padding: 4px 8px 4px 4px; }
    .role-switcher-btn { padding: 4px 8px; font-size: 11px; }

    /* ── Page container padding ── */
    .page-container { padding: 16px 12px; }

    /* ── Chat ── */
    .chat-container { padding: 0 8px; }
    .chat-header h2 { font-size: 16px; }
    .chat-input-wrapper { border-radius: 10px; }
    /* iOS Safari auto-zooms into any input whose computed font-size is
       below 16 px, and the zoom frequently eats the first few keystrokes.
       Bump to 16 px on mobile so the keyboard opens without the zoom. */
    #chat-input, .chat-input-wrapper textarea, .chat-input-wrapper input,
    #hs-unified-input, #lib-search, #doc-search { font-size: 16px; }
    .chat-mode-tabs { overflow-x: auto; justify-content: flex-start; gap: 4px; }
    .chat-mode-tab { white-space: nowrap; padding: 8px 14px; font-size: 12px; }
    .quick-actions { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
    .quick-action-chip { white-space: nowrap; font-size: 11px; }

    /* ── Dashboard ── */
    .dashboard-grid { grid-template-columns: 1fr; }
    .dash-card.wide { grid-column: span 1; }
    .stats-row { grid-template-columns: repeat(3, 1fr); gap: 6px; }
    .big-stat span { font-size: 16px; }
    .dash-action-summary { flex-direction:column; align-items:flex-start; gap:12px; padding:16px; }
    .dash-action-summary h3 { font-size:18px; }
    .dash-period-control { width:100%; display:grid; grid-template-columns:1fr 1fr; }
    .dash-period-control button { white-space:normal; }
    .dash-exec-hero { flex-direction:column; align-items:flex-start; padding:16px; gap:12px; }
    .dash-exec-hero strong { font-size:31px; }
    .dash-hero-side { align-items:flex-start; width:100%; min-width:0; }
    .dash-assumptions div { text-align:left; max-width:none; }
    .dash-primary-action { width:100%; justify-content:center; }
    .dash-simple-grid { grid-template-columns:1fr; }
    .dash-usage-chart-grid { grid-template-columns:1fr; }
    .dash-status-card { min-height:112px; }
    .dash-attention-strip { flex-direction:column; align-items:stretch; }
    .dash-secondary-action { width:100%; }
    .dash-next-actions { display:grid; grid-template-columns:1fr 1fr; }
    .dash-next-actions button { justify-content:space-between; min-width:0; }
    .broker-queue-card { grid-template-columns:1fr; }
    .broker-queue-metrics { grid-template-columns:1fr 1fr; }
    .broker-queue-action { width:100%; }
    .sh-review-audit { grid-template-columns:1fr; }

    /* ── Document Library ── */
    .doc-card { padding: 10px 12px; gap: 10px; }
    .lib-toolbar { flex-wrap: wrap; gap: 8px; }
    .lib-search { width: 100%; }

    /* ── HS Code ── */
    .hs-search-card { padding: 14px; }
    .hs-unified-field { font-size: 14px; }
    .hs-search-btn-inline span { display:none; }

    /* ── Settings layout: stack ── */
    .settings-layout { flex-direction: column; }
    .settings-sidebar {
        width: 100%; min-width: 100%; flex-direction: row; overflow-x: auto;
        border-right: none; border-bottom: 1px solid var(--border);
        white-space: nowrap; -webkit-overflow-scrolling: touch;
    }
    .settings-sidebar-title { display: none; }
    .settings-group { padding: 0; border-bottom: none; display: flex; flex-shrink: 0; }
    .settings-group-label { display: none; }
    .settings-nav-item {
        padding: 10px 14px; border-left: none; border-bottom: 2px solid transparent;
        flex-shrink: 0; font-size: 12px;
    }
    .settings-nav-item.active { border-left-color: transparent; border-bottom-color: var(--primary); }

    /* ── Role Settings split ── */
    .rs-split { flex-direction: column; min-height: auto; }
    .rs-sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); max-height: 200px; overflow-y: auto; }

    /* ── Account tables ── */
    .acct-toolbar { flex-wrap: wrap; gap: 8px; }
    .acct-search { width: 100%; }

    /* ── Modals ── */
    .modal-overlay { padding: 10px; }
    .modal-content { max-height: 90vh; }
    .auth-card { margin: 10px; max-width: 100%; padding: 20px 16px; }

    /* ── Profile card ── */
    .profile-card { flex-direction: column; text-align: center; }
    .profile-edit-btn { align-self: center; }

    /* ── Role preview banner ── */
    .role-preview-banner { font-size: 12px; padding: 6px 10px; }
}

/* Dashboard sub-tabs */
.dash-tabs { display:flex; gap:4px; margin-bottom:20px; border-bottom:2px solid var(--border); padding-bottom:0; }
.dash-tab { background:none; border:none; padding:10px 18px; font-size:13px; font-family:inherit; cursor:pointer; color:var(--text-secondary); border-bottom:2px solid transparent; margin-bottom:-2px; transition:all .15s; font-weight:500; }
.dash-tab:hover { color:var(--text); }
.dash-tab.active { color:var(--primary); border-bottom-color:var(--primary); }
.dash-panel { display:none; }
.dash-panel.active { display:block; }

/* Data table */
.data-table { width:100%; border-collapse:collapse; font-size:13px; }
.data-table th { text-align:left; padding:8px 12px; background:var(--bg); color:var(--text-secondary); font-weight:600; font-size:12px; border-bottom:1px solid var(--border); }
.data-table td { padding:8px 12px; border-bottom:1px solid var(--border); }
.data-table tbody tr:hover { background:var(--bg); }
.data-table tfoot td { font-weight:600; background:var(--bg); }

/* Library section titles */
.lib-section-title {
    font-size: 15px; font-weight: 600; margin-bottom: 10px; padding-bottom: 6px;
    border-bottom: 2px solid var(--border); display: flex; align-items: center; gap: 8px;
}
.lib-section-title i { font-size: 16px; }
.lib-section-count {
    margin-left: auto; font-size: 11px; font-weight: 400; color: var(--text-secondary);
    background: var(--bg); padding: 2px 10px; border-radius: 10px;
}

/* Download button in modal */
.dl-btn {
    display:inline-flex; align-items:center; gap:6px; padding:8px 16px;
    background:var(--primary); color:#fff; border-radius:8px; text-decoration:none;
    font-size:13px; font-weight:500; white-space:nowrap; flex-shrink:0;
    transition: background .15s;
}
.dl-btn:hover { background:var(--primary-dark); }
.dl-btn i { font-size:14px; }
.doc-detail-header {
    display:grid;
    grid-template-columns:minmax(0, 1fr) auto;
    align-items:start;
    gap:18px;
    padding-right:44px;
    margin-bottom:14px;
}
.modal-content .doc-detail-header h2 {
    margin:0;
    padding-right:0;
    min-width:0;
    overflow-wrap:anywhere;
    line-height:1.25;
}
.doc-detail-pdf-btn { margin-top:2px; }
#doc-modal .modal-close {
    position:absolute;
    top:18px;
    right:18px;
    width:34px;
    height:34px;
    padding:0;
    border-radius:999px;
    display:flex;
    align-items:center;
    justify-content:center;
    z-index:2;
}
#doc-modal .modal-close:hover {
    background:var(--bg);
    color:var(--text);
}
.doc-modal-close-hint {
    position:absolute;
    top:56px;
    right:18px;
    z-index:3;
    opacity:0;
    transform:translateY(-4px);
    pointer-events:none;
    background:#111827;
    color:#fff;
    border-radius:999px;
    padding:6px 10px;
    font-size:12px;
    font-weight:650;
    box-shadow:0 10px 24px rgba(15,23,42,0.22);
    transition:opacity .16s ease, transform .16s ease;
}
#doc-modal.show-close-hint .doc-modal-close-hint,
#ocr-classify-modal.show-close-hint .doc-modal-close-hint {
    opacity:1;
    transform:translateY(0);
}
#doc-modal.show-close-hint .modal-close {
    background:#eff6ff;
    color:var(--primary);
    box-shadow:0 0 0 3px rgba(37,99,235,0.18);
    animation:doc-close-nudge .42s ease;
}
#ocr-classify-modal.show-close-hint .ob-classify-close {
    background:#eff6ff;
    color:var(--primary);
    box-shadow:0 0 0 3px rgba(37,99,235,0.18);
    animation:doc-close-nudge .42s ease;
}
@keyframes doc-close-nudge {
    0%, 100% { transform:translateX(0); }
    30% { transform:translateX(-3px); }
    60% { transform:translateX(3px); }
}

/* NSW status items */
.nsw-item { padding:8px 12px; border-radius:8px; font-size:12px; display:flex; align-items:center; gap:6px; }
.nsw-item b { margin-left:auto; }
.nsw-item.done { background:#d1fae5; color:#059669; }
.nsw-item.done i { color:#059669; }
.nsw-item.pending { background:var(--bg); color:var(--text-secondary); }
.nsw-item.pending i { color:#cbd5e1; font-size:10px; }

/* Search mode bar */
.search-mode-bar { display:flex; gap:4px; margin-bottom:8px; }
.mode-btn {
    flex:1; padding:8px 10px; border:1px solid var(--border); border-radius:10px;
    background:var(--surface); font-size:11.5px; font-family:inherit; cursor:pointer;
    color:var(--text-secondary); transition:all .2s; display:flex; align-items:center;
    justify-content:center; gap:5px; font-weight:500;
}
.mode-btn:hover { border-color:var(--primary); color:var(--primary); background:#f5f7ff; }
.mode-btn.active { background:var(--primary); color:#fff; border-color:transparent; box-shadow:0 2px 6px rgba(29,92,200,0.28); }
.mode-btn i { font-size:10px; }

/* Answer sections in chat */
.answer-section {
    margin-top:10px; padding:10px 14px; border-radius:8px; border-left:3px solid;
}
.answer-section.rag { border-color:var(--primary); background:#eef2ff; }
.answer-section.web { border-color:#059669; background:#f0fdf4; }
.answer-section-label {
    font-size:11px; font-weight:600; text-transform:uppercase; letter-spacing:.5px;
    margin-bottom:8px; display:flex; align-items:center; gap:5px; padding-bottom:6px; border-bottom:1px solid rgba(0,0,0,0.06);
}
.answer-section.rag .answer-section-label { color:var(--primary); }
.answer-section.web .answer-section-label { color:#059669; }

/* Both mode: side-by-side 50:50 */
.hybrid-compare { margin-top: 4px; }
.hybrid-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
.hybrid-columns .answer-section { margin-top: 0; width: 100%; min-width: 0; overflow-wrap: break-word; }
@media(max-width:768px) { .hybrid-columns { grid-template-columns: 1fr; } }

/* Settings */
.settings-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:16px; }
.setting-card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:22px; box-shadow:var(--shadow); }
.setting-card.wide { grid-column:span 2; }
.setting-card h3 { font-size:14px; font-weight:600; margin-bottom:4px; display:flex; align-items:center; gap:8px; }
.setting-card h3 i { font-size:16px; }
.setting-card > p { font-size:12px; color:var(--text-secondary); margin-bottom:14px; }
.setting-card select { width:100%; padding:8px 12px; border:1px solid var(--border); border-radius:8px; font-size:13px; font-family:inherit; background:var(--surface); outline:none; cursor:pointer; }
.setting-card select:focus { border-color:var(--primary); }
.setting-row { display:flex; align-items:center; justify-content:space-between; padding:6px 0; border-bottom:1px solid var(--bg); font-size:13px; }
.setting-row label { color:var(--text-secondary); font-weight:500; }
.setting-row input[type=range] { flex:1; margin:0 10px; }

/* Chat History sidebar */
.chat-history { padding:0 8px; border-top:1px solid var(--border); flex:1; overflow-y:auto; min-height:0; }
.ch-header { display:flex; justify-content:space-between; align-items:center; padding:8px 8px 4px; font-size:11px; color:var(--text-secondary); text-transform:uppercase; letter-spacing:.5px; }
.ch-header button { background:none; border:none; color:var(--sidebar-text); cursor:pointer; font-size:13px; padding:4px; }
.ch-header button:hover { color:var(--primary); }
.ch-list { display:flex; flex-direction:column; gap:2px; }
.ch-item { padding:8px 10px; border-radius:6px; cursor:pointer; display:flex; align-items:center; gap:6px; font-size:12px; color:var(--sidebar-text); transition:all .1s; position:relative; }
.ch-item:hover { background:rgba(0,0,0,0.04); }
.ch-item.active { background:rgba(29,92,200,0.12); color:var(--primary); font-weight:500; }
.ch-title { flex:1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ch-date { font-size:10px; color:var(--text-secondary); white-space:nowrap; }
.ch-delete { display:none; background:none; border:none; color:#f87171; cursor:pointer; font-size:11px; padding:2px; }
.ch-item:hover .ch-delete { display:block; }

/* Upload */
.upload-btn { background:var(--primary); color:#fff; border:none; border-radius:8px; padding:8px 16px; font-size:13px; font-family:inherit; cursor:pointer; display:flex; align-items:center; gap:6px; }
.upload-btn:hover { background:var(--primary-dark); }
.lib-title-row { display:flex; align-items:center; }

/* Library Layer Tabs */
.lib-layer-bar { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.lib-layer-btn {
    display: flex; align-items: center; gap: 6px; padding: 8px 16px;
    border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
    font-size: 13px; font-family: inherit; cursor: pointer; color: var(--text-secondary);
    transition: all 0.15s; font-weight: 500;
}
.lib-layer-btn:hover { border-color: var(--primary-light); color: var(--text); }
.lib-layer-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.lib-layer-btn.active .layer-count { background: rgba(255,255,255,0.25); color: #fff; }
.layer-count {
    font-size: 11px; padding: 1px 8px; border-radius: 10px;
    background: var(--bg); color: var(--text-secondary); font-weight: 600;
}
.lib-upload-target {
    margin: 8px 0; padding: 8px 14px; border-radius: 6px; font-size: 12px;
    background: #dbeafe; color: #2563eb; display: flex; align-items: center; gap: 6px;
}
.lib-upload-target.enterprise { background: #fef3c7; color: #d97706; }

/* Personal/Enterprise doc grid */
.user-doc-card {
    display: flex; align-items: center; gap: 12px; padding: 14px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
    transition: all 0.15s;
}
.user-doc-card:hover { border-color: var(--primary-light); box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.user-doc-icon { font-size: 28px; color: #c00; width: 44px; text-align: center; flex-shrink: 0; }
.user-doc-icon:hover { transform: scale(1.1); }
.user-doc-info { flex: 1; min-width: 0; }
.user-doc-filename { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-doc-filename i { color: var(--text-secondary); font-size: 11px; margin-right: 4px; }
.user-doc-title { font-size: 12px; font-weight: 400; color: var(--text-secondary); margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-doc-meta { display: flex; gap: 12px; font-size: 11px; color: var(--text-secondary); margin-top: 4px; }
.user-doc-actions { display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; }
.user-doc-preview-btn { background: none; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; color: var(--primary); padding: 5px 8px; font-size: 13px; transition: all 0.15s; }
.user-doc-preview-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.user-doc-delete { background: none; border: none; cursor: pointer; color: #94a3b8; padding: 4px; font-size: 14px; }
.user-doc-delete:hover { color: #dc2626; }
.user-docs-grid { display: grid; gap: 8px; }
.typhoon-status {
    display:inline-flex; align-items:center; gap:6px; margin-top:7px;
    width:max-content; max-width:100%; padding:4px 9px; border-radius:999px;
    font-size:11px; font-weight:650; line-height:1.2; border:1px solid var(--border);
    background:#f8fafc; color:#475569;
}
.typhoon-status i { font-size:11px; }
.typhoon-queued, .typhoon-running { background:#eff6ff; border-color:#bfdbfe; color:#1d4ed8; }
.typhoon-completed { background:#ecfdf5; border-color:#bbf7d0; color:#047857; }
.typhoon-failed { background:#fef2f2; border-color:#fecaca; color:#b91c1c; }
.typhoon-action-btn {
    display:inline-flex; align-items:center; justify-content:center; gap:6px;
    border:1px solid #bfdbfe; background:#eff6ff; color:#1d4ed8;
    border-radius:8px; padding:6px 10px; font-size:12px; font-weight:650;
    font-family:inherit; cursor:pointer; white-space:nowrap; transition:all .15s;
}
.typhoon-action-btn:hover { background:#dbeafe; border-color:#93c5fd; }
.typhoon-action-btn.is-running { cursor:default; opacity:.86; }
.typhoon-action-btn.is-complete { background:#f8fafc; border-color:var(--border); color:#475569; }
.doc-detail-enhance { display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin:8px 0 14px; }
/* Storage bar */
.lib-storage-bar { margin-top: 12px; padding: 10px 14px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; }
.lib-storage-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom:7px; }
.lib-storage-copy { flex:1; min-width:0; }
.lib-storage-info { display: flex; justify-content: space-between; gap:12px; font-size: 12px; color: var(--text-secondary); margin-bottom: 5px; }
.lib-storage-info i { margin-right: 4px; }
.lib-storage-target { display:flex; align-items:center; gap:6px; color:#2563eb; font-size:12px; font-weight:650; min-width:0; }
.lib-storage-target span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.lib-storage-upload-btn { flex-shrink:0; margin-top:0; white-space:nowrap; }
.lib-storage-upload-btn.enterprise { background:#1e4f8b; }
.lib-storage-upload-btn.enterprise:hover { background:#173f70; }
.lib-storage-track { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.lib-storage-fill { height: 100%; background: var(--primary); border-radius: 3px; transition: width 0.3s; }
.lib-storage-fill.yellow { background: #f59e0b; }
.lib-storage-fill.red { background: #dc2626; }
.user-docs-empty { text-align: center; padding: 60px 20px; color: #94a3b8; }
.user-docs-empty i { font-size: 48px; margin-bottom: 12px; display: block; }
.upload-status { margin-top:10px; padding:10px 14px; border-radius:8px; background:#eff6ff; border:1px solid #bfdbfe; font-size:13px; display:flex; align-items:center; gap:8px; }

/* HS Code — redesigned */
.hs-search-card { background:var(--surface); border:1px solid var(--border); border-radius:16px; padding:20px 24px; margin-bottom:20px; box-shadow:var(--shadow); }
.hs-search-input-wrap { display:flex; align-items:center; border:2px solid var(--border); border-radius:12px; overflow:hidden; background:var(--bg); transition:border-color .2s; }
.hs-search-input-wrap:focus-within { border-color:var(--primary); }
.hs-search-icon-inline { padding:0 14px; color:var(--text-secondary); font-size:16px; flex-shrink:0; }
.hs-unified-field { flex:1; border:none; background:none; padding:14px 0; font-size:15px; color:var(--text); outline:none; font-family:inherit; }
.hs-unified-field::placeholder { color:var(--text-secondary); }
.hs-search-btn-inline { background:var(--primary); color:#fff; border:none; padding:0 22px; font-size:14px; font-weight:600; cursor:pointer; height:52px; flex-shrink:0; display:flex; align-items:center; gap:8px; font-family:inherit; transition:background .15s; }
.hs-search-btn-inline:hover { background:var(--primary-dark); }
/* Country chips */
.hs-origin-row { margin-top:14px; display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
.hs-origin-hint { font-size:12px; color:var(--text-secondary); white-space:nowrap; flex-shrink:0; }
.hs-country-chips { display:flex; flex-wrap:wrap; gap:6px; }
.hs-chip { border:1px solid var(--border); background:var(--bg); border-radius:20px; padding:5px 13px; font-size:12px; cursor:pointer; transition:all .15s; color:var(--text); white-space:nowrap; font-family:inherit; }
.hs-chip:hover { border-color:var(--primary); color:var(--primary); }
.hs-chip.active { background:var(--primary); color:#fff; border-color:var(--primary); }
/* FTA static always-visible section */
.hs-fta-static-section { margin-bottom:20px; }
.hs-tariff-note { display:flex; gap:10px; align-items:flex-start; background:#fffbeb; border:1px solid #f59e0b; border-radius:8px; padding:12px 14px; margin-top:16px; font-size:13px; color:#78350f; line-height:1.5; }
.hs-tariff-note .fa-exclamation-triangle { color:#f59e0b; margin-top:2px; flex-shrink:0; }
.hs-tariff-note a { color:#b45309; text-decoration:underline; }
.hs-fta-static-title { font-size:15px; font-weight:600; color:var(--text); margin-bottom:12px; }
/* Main 2-col layout */
.hs-main-layout { display:flex; gap:20px; align-items:flex-start; }
.hs-results-area { flex:1; min-width:0; }
.hs-empty-state { text-align:center; padding:60px 24px; color:var(--text-secondary); }
.hs-empty-state i { font-size:48px; margin-bottom:14px; display:block; color:var(--border); }
.hs-empty-state p { font-size:14px; }
/* History sidebar */
.hs-history-panel { width:260px; flex-shrink:0; background:var(--surface); border-radius:12px; border:1px solid var(--border); overflow:hidden; position:sticky; top:16px; }
.hs-history-header { padding:12px 14px; border-bottom:1px solid var(--border); font-size:13px; font-weight:600; display:flex; justify-content:space-between; align-items:center; color:var(--text); }
.hs-history-clear-btn { background:none; border:none; font-size:11px; color:var(--text-secondary); cursor:pointer; font-family:inherit; }
.hs-history-clear-btn:hover { color:#dc2626; }
.hs-history-list { max-height:calc(100vh - 280px); overflow-y:auto; }
.hs-history-item { padding:10px 14px; border-bottom:1px solid var(--border); cursor:pointer; transition:background .15s; border-left:3px solid transparent; }
.hs-history-item:last-child { border-bottom:none; }
.hs-history-item:hover { background:var(--bg); }
.hs-history-item.active { background:rgba(29,92,200,0.07); border-left-color:var(--primary); }
.hs-history-query { font-size:13px; font-weight:500; color:var(--text); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.hs-history-meta { font-size:11px; color:var(--text-secondary); margin-top:3px; display:flex; gap:8px; }
.hs-history-empty { text-align:center; padding:28px 14px; color:var(--text-secondary); font-size:13px; }
@media(max-width:768px) { .hs-main-layout { flex-direction:column; } .hs-history-panel { width:100%; position:static; } }

/* Widget code */
.widget-code { background:var(--bg); padding:12px; border-radius:8px; font-size:11px; overflow-x:auto; white-space:pre; font-family:monospace; border:1px solid var(--border); }

/* FTA Checker cards */
.fta-card { background:var(--surface); border:2px solid #d1fae5; border-radius:var(--radius); padding:16px; cursor:pointer; transition:all .15s; }
.fta-card:hover { border-color:#059669; box-shadow:0 2px 8px rgba(5,150,105,0.15); }
.fta-card-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:10px; }
.fta-card-header strong { font-size:14px; }
.fta-badge { background:#d1fae5; color:#059669; padding:3px 10px; border-radius:12px; font-size:11px; font-weight:600; }
.fta-card-body { font-size:12px; color:var(--text-secondary); display:flex; flex-direction:column; gap:4px; }
.fta-card-body i { width:16px; color:var(--primary); }
.hs-select-btn { background:var(--primary); color:#fff; border:none; border-radius:6px; padding:4px 10px; cursor:pointer; font-size:11px; }
.hs-select-btn:hover { background:var(--primary-dark); }

/* ═══════════════════════════════════ */
/* LANGUAGE SWITCHER                   */
/* ═══════════════════════════════════ */
.lang-switcher {
    display: flex; gap: 2px; margin-top: 10px;
    background: var(--bg); border-radius: 8px; padding: 2px;
}
.lang-option {
    flex: 1; padding: 4px 0; border: none; border-radius: 6px;
    background: transparent; color: var(--sidebar-text); cursor: pointer;
    font-size: 11px; font-weight: 600; letter-spacing: 0.5px;
    transition: all 0.15s;
}
.lang-option:hover { background: #eaecf0; color: var(--text); }
.lang-option.active { background: var(--primary); color: #fff; }

/* Language choice in Settings */
.lang-setting-row {
    display: flex; gap: 8px; margin-top: 10px;
}
.lang-choice {
    flex: 1; display: flex; align-items: center; gap: 8px;
    padding: 12px 14px; border: 2px solid var(--border); border-radius: 10px;
    background: var(--surface); cursor: pointer; font-family: inherit;
    font-size: 13px; font-weight: 500; color: var(--text);
    transition: all 0.15s;
}
.lang-choice:hover { border-color: var(--primary-light); }
.lang-choice.active { border-color: var(--primary); background: #eef2ff; }
.lang-flag { font-size: 20px; }

/* Chinese font support */
html[lang="zh-CN"] body { font-family: 'Noto Sans SC', 'Inter', sans-serif; }
/* Japanese font support */
html[lang="ja"] body { font-family: 'Noto Sans JP', 'Inter', sans-serif; }

/* ═══════════════════════════════════ */
/* TOP HEADER BAR                      */
/* ═══════════════════════════════════ */
.top-bar {
    position: absolute; top: 0; left: 0; right: 0; height: 54px;
    background: var(--surface); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: flex-end;
    padding: 0 24px; z-index: 5;
}
.top-bar-spacer { flex: 1; }
.top-bar-actions { display: flex; align-items: center; gap: 10px; }
.theme-toggle { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; cursor: pointer; padding: 6px 10px; font-size: 14px; color: var(--text-secondary); display: flex; align-items: center; gap: 6px; transition: all 0.15s; }
.theme-toggle:hover { border-color: var(--primary); color: var(--primary); }

/* ─── Language Dropdown ─── */
.lang-dropdown { position: relative; }
.lang-dropdown-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 12px; background: var(--bg); border: 1px solid var(--border);
    border-radius: 8px; cursor: pointer; font-family: inherit;
    font-size: 13px; font-weight: 500; color: var(--text); transition: all 0.15s;
}
.lang-dropdown-btn:hover { border-color: var(--primary-light); }
.lang-dropdown-btn .fa-chevron-down { font-size: 9px; color: var(--text-secondary); transition: transform 0.2s; margin-left: 2px; }
.lang-dropdown.open .lang-dropdown-btn .fa-chevron-down { transform: rotate(180deg); }
.lang-dropdown.open .lang-dropdown-btn { border-color: var(--primary); }
.lang-current-flag { font-size: 18px; line-height: 1; }
.lang-current-code { font-weight: 600; letter-spacing: 0.5px; }

.lang-dropdown-menu {
    display: none; position: absolute; top: calc(100% + 6px); right: 0;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: 0 4px 16px rgba(0,0,0,0.08); overflow: hidden; min-width: 190px; z-index: 100;
    animation: dropdownIn 0.15s ease;
}
@keyframes dropdownIn { from { opacity:0; transform:translateY(-4px); } to { opacity:1; transform:translateY(0); } }
.lang-dropdown.open .lang-dropdown-menu { display: block; }

.lang-dropdown-item {
    display: flex; align-items: center; gap: 10px; padding: 10px 14px;
    cursor: pointer; font-size: 13px; font-weight: 500; transition: background 0.1s;
}
.lang-dropdown-item:hover { background: var(--bg); }
.lang-dropdown-item.active { background: #eef2ff; color: var(--primary); }
.ldi-flag { font-size: 18px; line-height: 1; }
.ldi-code { font-weight: 600; min-width: 22px; }
.ldi-name { margin-left: auto; font-size: 12px; color: var(--text-secondary); font-weight: 400; }
.lang-dropdown-item.active .ldi-name { color: var(--primary-light); }

/* ─── Account Dropdown ─── */
.account-dropdown { position: relative; }
.account-dropdown-btn {
    display: flex; align-items: center; gap: 8px;
    padding: 4px 12px 4px 4px; background: var(--bg); border: 1px solid var(--border);
    border-radius: 8px; cursor: pointer; font-family: inherit;
    font-size: 13px; color: var(--text); transition: all 0.15s;
}
.account-dropdown-btn:hover { border-color: var(--primary-light); }
.account-dropdown.open .account-dropdown-btn { border-color: var(--primary); }
.account-dropdown-btn .fa-chevron-down { font-size: 9px; color: var(--text-secondary); margin-left: 2px; }
.account-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--primary);
    color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px;
}
.account-name { font-weight: 500; }

.account-dropdown-menu {
    display: none; position: absolute; top: calc(100% + 6px); right: 0;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: 0 4px 16px rgba(0,0,0,0.08); overflow: hidden; min-width: 220px; z-index: 100;
    animation: dropdownIn 0.15s ease;
}
.account-dropdown.open .account-dropdown-menu { display: block; }

.account-menu-header {
    display: flex; align-items: center; gap: 10px; padding: 14px 16px;
}
.account-menu-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--primary);
    color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0;
}
.account-menu-name { font-weight: 600; font-size: 13px; }
.account-menu-email { font-size: 11px; color: var(--text-secondary); }

.account-menu-item {
    display: flex; align-items: center; gap: 10px; padding: 10px 16px;
    cursor: pointer; font-size: 13px; transition: background 0.1s;
}
.account-menu-item:hover { background: var(--bg); }
.account-menu-item i { width: 16px; text-align: center; color: var(--text-secondary); font-size: 13px; }
.account-menu-item.logout { color: #dc2626; }
.account-menu-item.logout i { color: #dc2626; }
.account-menu-item.logout:hover { background: #fef2f2; }
.account-menu-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ═══════════════════════════════════ */
/* ACCOUNT SETTING (RBAC)              */
/* ═══════════════════════════════════ */

/* ── Settings Sidebar Layout ── */
.settings-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}
.settings-sidebar {
    width: 210px;
    min-width: 210px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}
.settings-sidebar-title {
    padding: 18px 16px 14px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
}
.settings-sidebar-title i { color: var(--primary); }
.settings-group {
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
}
.settings-group:last-child { border-bottom: none; }
.settings-group-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.08em;
    padding: 6px 16px 2px;
    text-transform: uppercase;
}
.settings-nav-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 9px 16px;
    background: none;
    border: none;
    border-left: 3px solid transparent;
    text-align: left;
    font-size: 13px;
    font-family: inherit;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.settings-nav-item i { width: 14px; text-align: center; }
.settings-nav-item:hover { background: var(--bg); color: var(--text); }
.settings-nav-item.active {
    background: #eff6ff;
    color: var(--primary, #1a56db);
    font-weight: 600;
    border-left-color: var(--primary, #1a56db);
}
[data-theme="dark"] .settings-nav-item.active {
    background: rgba(99,102,241,0.12);
    color: #818cf8;
    border-left-color: #818cf8;
}
.settings-content {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

/* Keep old .acct-tabs hidden (legacy) */
.acct-tabs { display: none; }
.acct-tabs::-webkit-scrollbar { display: none; }
.acct-tab {
    background: none; border: none; padding: 10px 16px; font-size: 13px; font-family: inherit;
    cursor: pointer; color: var(--text-secondary); border-bottom: 2px solid transparent;
    margin-bottom: -2px; transition: all 0.15s; font-weight: 500; display: flex; align-items: center;
    gap: 6px; flex-shrink: 0; white-space: nowrap;
}
.acct-tab i { font-size: 12px; }
.acct-tab:hover { color: var(--text); }
.acct-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.acct-panel { display: none; }
.acct-panel.active { display: block; }

/* Toolbar */
.acct-toolbar {
    display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap;
}
.acct-search {
    position: relative; flex: 1; min-width: 200px; max-width: 320px;
}
.acct-search input {
    width: 100%; padding: 9px 14px 9px 36px; border: 1px solid var(--border);
    border-radius: 8px; font-size: 13px; font-family: inherit; outline: none;
    background: var(--surface); transition: border-color 0.15s;
}
.acct-search input:focus { border-color: var(--primary); }
.acct-search i {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    color: var(--text-secondary); font-size: 13px; pointer-events: none;
}
.acct-toolbar select {
    padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
    font-size: 13px; font-family: inherit; background: var(--surface); cursor: pointer; outline: none;
    color: var(--text-secondary); min-width: 100px;
}
.acct-toolbar select:focus { border-color: var(--primary); }
.acct-add-btn {
    margin-left: auto; padding: 9px 18px; background: var(--primary); color: #fff;
    border: none; border-radius: 8px; font-size: 13px; font-family: inherit;
    cursor: pointer; display: flex; align-items: center; gap: 6px; font-weight: 500;
    transition: background 0.15s; white-space: nowrap;
}
.acct-add-btn:hover { background: var(--primary-dark); box-shadow: 0 2px 8px rgba(29,92,200,0.32); }

/* Account Table */
.acct-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.acct-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.acct-table thead th {
    text-align: left; padding: 12px 14px; background: var(--bg); color: var(--primary);
    font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border); white-space: nowrap;
}
.acct-table tbody td {
    padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle;
}
.acct-table tbody tr:last-child td { border-bottom: none; }
.acct-table tbody tr:hover { background: var(--bg); }

.zia-table-pager {
    display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap;
    margin:10px 0 18px; padding:9px 10px; border:1px solid var(--border);
    border-radius:8px; background:var(--surface); color:var(--text-secondary); font-size:12px;
}
.zia-table-pager-summary strong,
.zia-table-pager-buttons strong { color:var(--text); font-variant-numeric:tabular-nums; }
.zia-table-pager-size { display:inline-flex; align-items:center; gap:7px; white-space:nowrap; }
.zia-table-pager-size select {
    height:30px; border:1px solid var(--border); border-radius:6px; background:var(--surface);
    color:var(--text); padding:3px 24px 3px 8px; font-size:12px;
}
.zia-table-pager-buttons { display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
.zia-table-pager-buttons button {
    min-height:30px; border:1px solid var(--border); border-radius:6px; background:var(--surface);
    color:var(--text); padding:4px 9px; font-size:12px; font-weight:600; cursor:pointer;
}
.zia-table-pager-buttons button:hover:not(:disabled) { border-color:var(--primary); color:var(--primary); }
.zia-table-pager-buttons button:disabled { opacity:.45; cursor:not-allowed; }

/* Role badge */
.role-badge {
    display: inline-block; padding: 3px 10px; border-radius: 12px;
    font-size: 11px; font-weight: 600; white-space: nowrap;
}
/* Plan badge */
.plan-badge {
    display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 12px;
    font-size: 11px; font-weight: 600; white-space: nowrap;
}
.plan-free { background: #f1f5f9; color: #64748b; }
.plan-pro { background: #dbeafe; color: #2563eb; }
.plan-max { background: #dcfce7; color: #16a34a; }
.plan-enterprise { background: #ede9fe; color: #7c3aed; }
.notif-chip { display:inline-block; padding:3px 9px; margin:1px; border-radius:10px; font-size:10px; font-weight:600; cursor:pointer; user-select:none; transition:all .15s; text-transform:lowercase; }
.notif-chip.on { background:#dbeafe; color:#1d4ed8; border:1px solid #93c5fd; }
.notif-chip.off { background:#f1f5f9; color:#94a3b8; border:1px solid #e2e8f0; }
.notif-chip:hover { transform:scale(1.05); }
.ntb { padding:5px 10px; background:var(--surface); border:1px solid var(--border); border-radius:6px; font-size:12px; cursor:pointer; color:var(--text); transition:all .15s; }
.ntb:hover { background:var(--primary); color:#fff; border-color:var(--primary); }
.plan-unlimited { background: #fef2f2; color: #dc2626; }

/* Enterprise Accounts */
.ent-detail-header {
    display: flex; align-items: center; gap: 12px; padding: 12px 0; margin-bottom: 12px;
    border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.ent-detail-title { flex: 1; display: flex; align-items: center; gap: 10px; }
.ent-detail-title h3 { margin: 0; font-size: 16px; font-weight: 600; }
.ent-detail-status { font-size: 11px; padding: 2px 10px; border-radius: 10px; font-weight: 500; }
.status-active { background: #dcfce7; color: #16a34a; }
.status-disabled { background: #fee2e2; color: #dc2626; }

/* Status */
.status-active { color: #059669; font-weight: 500; }
.status-disabled { color: #94a3b8; font-weight: 500; }

/* Toggle switch */
.toggle-switch {
    position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute; cursor: pointer; inset: 0; background: #cbd5e1;
    border-radius: 24px; transition: 0.2s;
}
.toggle-slider:before {
    content: ""; position: absolute; height: 18px; width: 18px; left: 3px; bottom: 3px;
    background: #fff; border-radius: 50%; transition: 0.2s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(18px); }

/* Action buttons */
.acct-action-btn {
    background: none; border: none; cursor: pointer; padding: 4px 6px;
    color: var(--text-secondary); font-size: 14px; transition: color 0.15s;
}
.acct-action-btn:hover { color: var(--primary); }
.acct-action-btn.delete:hover { color: #dc2626; }

/* ── Role Setting Split Panel ── */
.rs-split { display: flex; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); min-height: 500px; overflow: hidden; }
.rs-sidebar { width: 220px; border-right: 1px solid var(--border); flex-shrink: 0; background: var(--bg); }
.rs-sidebar-header { padding: 14px 16px; font-weight: 600; font-size: 13px; color: var(--text); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }
.rs-role-list { overflow-y: auto; }
.rs-role-item { padding: 12px 16px; cursor: pointer; border-left: 3px solid transparent; transition: all 0.15s; }
.rs-role-item:hover { background: var(--surface); }
.rs-role-item.active { border-left-color: var(--primary); background: var(--surface); }
.rs-role-item .rs-role-name { font-size: 13px; font-weight: 500; color: var(--primary); }
.rs-role-item .rs-role-team { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.rs-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.rs-main-header { padding: 14px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; font-weight: 600; font-size: 14px; }
.rs-selected-badge { font-size: 12px; padding: 4px 16px; }
.rs-main .acct-table-wrap { border: none; border-radius: 0; flex: 1; }

/* Permissions table inside Role Setting */
.perms-table th { text-align: center; }
.perms-table td { text-align: center; }
.perms-table td:first-child, .perms-table th:first-child { text-align: left; }
.perms-table .perm-category-row td { background: #eef2ff; color: var(--primary); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.3px; padding: 8px 14px; border-bottom: 1px solid #d6e0f7; }
.perm-cb { width: 18px; height: 18px; accent-color: #22c55e; cursor: pointer; }
.perm-cb:disabled { opacity: 0.3; cursor: default; }

/* Role modal */
.rm-color-row { display: flex; align-items: center; gap: 12px; }
.rm-color-input { width: 48px; height: 36px; border: 1px solid var(--border); border-radius: 6px; padding: 2px; cursor: pointer; background: var(--surface); }
.rm-color-preview { font-size: 13px; padding: 4px 14px; }
.rm-perms-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.rm-perm-item { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 6px; font-size: 13px; cursor: pointer; transition: background 0.15s; }
.rm-perm-item:hover { background: var(--bg); }
.rm-perm-item input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }

/* User modal */
.um-field { margin-bottom: 14px; }
.um-field label { display: block; font-size: 12px; font-weight: 500; color: var(--text-secondary); margin-bottom: 4px; }
.um-field input, .um-field select {
    width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px;
    font-size: 13px; font-family: inherit; outline: none; background: var(--surface);
}
.um-field input:focus, .um-field select:focus { border-color: var(--primary); }
.um-contract-section.is-hidden,
.um-override-section.is-hidden { display: none !important; }
.um-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.um-cancel {
    padding: 9px 18px; border: 1px solid var(--border); border-radius: 8px;
    background: var(--surface); font-size: 13px; font-family: inherit; cursor: pointer;
}
.um-cancel:hover { border-color: var(--text-secondary); }
.um-save {
    padding: 9px 24px; background: var(--primary); color: #fff; border: none;
    border-radius: 8px; font-size: 13px; font-family: inherit; cursor: pointer; font-weight: 500;
}
.um-save:hover { background: var(--primary-dark); }

/* Notification list in settings */
.notif-row {
    display: flex; align-items: center; gap: 12px; padding: 10px 0;
    border-bottom: 1px solid var(--bg); font-size: 13px;
}
.notif-row:last-child { border-bottom: none; }
.notif-row .notif-name { flex: 1; font-weight: 500; }
.notif-row .notif-email { flex: 1; color: var(--text-secondary); font-size: 12px; }

/* ═══════════════════════════════════ */
/* SUBSCRIPTION / PRICING              */
/* ═══════════════════════════════════ */
.sub-current {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    background: #f5f7ff; border: 1px solid #e0e7ff;
    border-radius: var(--radius); padding: 16px 24px; margin-bottom: 24px;
}
[data-theme="dark"] .sub-current { background: linear-gradient(135deg, #1e2a4a 0%, #1e2450 100%); border-color: #334155; }
.sub-current-label { font-size: 12px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.sub-current-plan { display: block; font-size: 22px; font-weight: 700; color: var(--primary); margin-top: 2px; }
.sub-current-usage { font-size: 12px; color: var(--text-secondary); text-align: right; line-height: 1.8; }
.sub-downgrade-notice {
    display: flex; align-items: flex-start; gap: 12px;
    border: 1px solid #fbbf24; background: #fffbeb; color: #78350f;
    border-radius: var(--radius); padding: 12px 16px; margin: -12px 0 24px;
}
.sub-downgrade-notice.scheduled { border-color: #93c5fd; background: #eff6ff; color: #1e3a8a; }
.sub-downgrade-icon {
    width: 32px; height: 32px; border-radius: 10px; flex: 0 0 auto;
    display: flex; align-items: center; justify-content: center;
    background: rgba(245, 158, 11, 0.16); color: #b45309;
}
.sub-downgrade-notice.scheduled .sub-downgrade-icon { background: rgba(59, 130, 246, 0.14); color: #2563eb; }
.sub-downgrade-title { font-size: 13px; font-weight: 800; margin-bottom: 2px; }
.sub-downgrade-body { font-size: 12px; line-height: 1.55; color: inherit; opacity: .9; }
[data-theme="dark"] .sub-downgrade-notice { background: rgba(120, 53, 15, .28); color: #fde68a; border-color: #92400e; }
[data-theme="dark"] .sub-downgrade-notice.scheduled { background: rgba(30, 58, 138, .28); color: #bfdbfe; border-color: #1d4ed8; }

.sub-billing-toggle {
    display: flex; gap: 0; background: var(--bg); border-radius: 10px; padding: 3px;
    width: fit-content; margin: 0 auto 28px;
}
.sub-billing-btn {
    padding: 8px 24px; border: none; border-radius: 8px; font-size: 13px; font-family: inherit;
    cursor: pointer; font-weight: 500; background: transparent; color: var(--text-secondary);
    transition: all 0.15s; display: flex; align-items: center; gap: 6px;
}
.sub-billing-btn.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.sub-save-tag {
    background: #dcfce7; color: #16a34a; font-size: 10px; padding: 2px 8px; border-radius: 10px; font-weight: 600;
}

.sub-cards {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 32px;
}
.sub-card {
    background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius);
    padding: 28px 24px; position: relative; transition: all 0.18s; display: flex; flex-direction: column; box-shadow: var(--shadow);
}
.sub-card:hover { border-color: var(--primary-light); box-shadow: 0 6px 20px rgba(29,92,200,0.09); transform: translateY(-1px); }
.sub-card.popular { border-color: var(--primary); }
.sub-card.enterprise { border-color: #7c3aed; }
.sub-popular-tag {
    position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
    background: var(--primary); color: #fff; font-size: 11px; font-weight: 600;
    padding: 3px 14px; border-radius: 10px; white-space: nowrap;
}
.sub-card-header { text-align: center; margin-bottom: 16px; }
.sub-plan-icon {
    width: 48px; height: 48px; border-radius: 14px; display: flex; align-items: center;
    justify-content: center; font-size: 20px; margin: 0 auto 12px;
}
.sub-plan-icon.free { background: #f1f5f9; color: #64748b; }
.sub-plan-icon.pro { background: #dbeafe; color: #2563eb; }
.sub-plan-icon.max { background: #dcfce7; color: #16a34a; }
.sub-plan-icon.enterprise { background: #ede9fe; color: #7c3aed; }
.sub-card-header h3 { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.sub-plan-desc { font-size: 12px; color: var(--text-secondary); }
.sub-price { text-align: center; margin-bottom: 4px; }
.sub-amount { font-size: 36px; font-weight: 800; color: var(--text); }
.sub-period { font-size: 13px; color: var(--text-secondary); font-weight: 400; }
.sub-user-note { text-align: center; font-size: 12px; color: var(--text-secondary); margin-bottom: 16px; }

.sub-action-btn {
    width: 100%; padding: 10px; border: 1.5px solid var(--border); border-radius: 10px;
    font-size: 13px; font-family: inherit; font-weight: 600; cursor: pointer;
    transition: all 0.15s; margin-bottom: 20px; background: var(--surface); color: var(--text);
}
.sub-action-btn.upgrade { background: var(--primary); color: #fff; border-color: var(--primary); }
.sub-action-btn.upgrade:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.sub-action-btn.downgrade { background: #fef3c7; color: #92400e; border-color: #fbbf24; }
.sub-action-btn.downgrade:hover { background: #fde68a; border-color: #f59e0b; }
.sub-action-btn.current { background: var(--bg); color: var(--text-secondary); border-color: var(--border); cursor: default; }
.sub-action-btn.contact { background: #7c3aed; color: #fff; border-color: #7c3aed; }
.sub-action-btn.contact:hover { background: #6d28d9; border-color: #6d28d9; }
.sub-action-btn.waitlisted { background: #f59e0b; color: #fff; border-color: #f59e0b; cursor: default; }

/* Waitlist admin table */
.waitlist-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.waitlist-table th { text-align: left; padding: 10px 12px; background: var(--bg-secondary); color: var(--text-secondary); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 2px solid var(--border); }
.waitlist-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.waitlist-table tr:hover td { background: var(--bg-secondary); }
.waitlist-status-badge { display: inline-block; padding: 3px 10px; border-radius: 12px; color: #fff; font-size: 11px; font-weight: 600; }
.waitlist-plan-badge { display: inline-block; padding: 3px 10px; border-radius: 8px; font-size: 11px; font-weight: 600; }
.waitlist-plan-badge.free { background: #f1f5f9; color: #475569; }
.waitlist-plan-badge.pro { background: #dbeafe; color: #2563eb; }
.waitlist-plan-badge.max { background: #dcfce7; color: #16a34a; }
.waitlist-plan-badge.enterprise { background: #ede9fe; color: #7c3aed; }
.waitlist-plan-badge.unlimited { background: #fee2e2; color: #dc2626; }
.waitlist-action-badge { display:inline-block; padding:3px 10px; border-radius:999px; font-size:11px; font-weight:700; white-space:nowrap; }
.waitlist-action-badge.upgrade { background:#dbeafe; color:#1d4ed8; }
.waitlist-action-badge.downgrade { background:#fef3c7; color:#92400e; }
.waitlist-action-badge.contact_sales { background:#ede9fe; color:#6d28d9; }
.waitlist-next-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.waitlist-next-btn,
.waitlist-next-processed {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 32px;
    padding: 6px 10px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}
.waitlist-next-btn {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.waitlist-next-btn:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
}
.waitlist-next-btn.primary {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}
.waitlist-next-btn.primary:hover {
    border-color: var(--primary-dark);
    background: var(--primary-dark);
}
.waitlist-next-btn.muted {
    border-color: #dbeafe;
    background: #eff6ff;
    color: #1d4ed8;
}
.waitlist-next-btn.danger {
    border-color: #fecaca;
    background: #fff5f5;
    color: #dc2626;
}
.waitlist-next-btn.danger:hover {
    border-color: #fca5a5;
    background: #fee2e2;
}
.waitlist-next-processed {
    background: #f1f5f9;
    color: #64748b;
}
.settings-history-action-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    background: #dbeafe;
    color: #1e3a8a;
    border: 1px solid #bfdbfe;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.25;
    white-space: nowrap;
}
[data-theme="dark"] .settings-history-action-badge {
    background: #1e3a8a;
    color: #dbeafe;
    border-color: #2563eb;
}
.settings-history-value {
    display: inline-flex;
    max-width: 260px;
    min-height: 26px;
    align-items: center;
    padding: 4px 8px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
    overflow-wrap: anywhere;
}
.settings-history-value.old {
    color: #991b1b;
    background: #fef2f2;
    border-color: #fecaca;
}
.settings-history-value.new {
    color: #065f46;
    background: #ecfdf5;
    border-color: #a7f3d0;
}
[data-theme="dark"] .settings-history-value.old {
    color: #fecaca;
    background: rgba(127, 29, 29, 0.28);
    border-color: rgba(248, 113, 113, 0.35);
}
[data-theme="dark"] .settings-history-value.new {
    color: #bbf7d0;
    background: rgba(6, 95, 70, 0.28);
    border-color: rgba(52, 211, 153, 0.35);
}

/* OCR status badges */
.ocr-status { display:inline-flex; align-items:center; gap:5px; padding:3px 10px; border-radius:12px; font-size:11px; font-weight:600; }
.ocr-status--queued     { background:#f3f4f6; color:#6b7280; }
.ocr-status--processing { background:#fef3c7; color:#92400e; }
.ocr-status--processing i { animation: spin 1s linear infinite; }
.ocr-status--ready      { background:#d1fae5; color:#065f46; }
.ocr-status--review     { background:#fef3c7; color:#92400e; }
.ocr-status--error      { background:#fee2e2; color:#991b1b; }
.business-id { font-family:'SF Mono',Consolas,monospace; font-size:11px; font-weight:700; color:#1e4f8b; background:#eff6ff; border:1px solid #dbeafe; border-radius:6px; padding:2px 6px; white-space:nowrap; display:inline-block; }

/* OCR review split view */
.ocr-review-header { display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin-bottom:16px; }
.ocr-back-btn { display:inline-flex; align-items:center; gap:6px; background:var(--surface); border:1px solid var(--border); border-radius:8px; padding:7px 14px; cursor:pointer; font-size:13px; font-family:inherit; color:var(--text); }
.ocr-back-btn:hover { border-color:var(--primary); color:var(--primary); }
.ocr-review-split { display:flex; gap:0; border:1px solid var(--border); border-radius:12px; overflow:hidden; height:calc(100vh - 230px); background:var(--surface); }
.ocr-review-left  { flex:1; min-width:0; border-right:1px solid var(--border); background:#f8f9fa; }
.ocr-review-right { flex:1; min-width:0; overflow-y:auto; padding:16px; }
@media (max-width:768px) {
    .ocr-review-split { flex-direction:column; height:auto; }
    .ocr-review-left { height:40vh; border-right:none; border-bottom:1px solid var(--border); }
}

/* OCR upload modal — split layout */
.ocr-modal-card { position:relative; background:var(--surface); border-radius:16px; max-width:1120px; width:96vw; height:82vh; max-height:88vh; overflow:hidden; box-shadow:0 20px 60px rgba(0,0,0,0.18); display:flex; flex-direction:column; }
.ocr-upload-simple-card {
    max-width:760px;
    width:min(760px,calc(100vw - 32px));
    height:min(820px,calc(100dvh - 32px));
}
.ocr-modal-close-btn { position:absolute; top:14px; right:18px; background:none; border:none; font-size:22px; cursor:pointer; color:var(--text-secondary); z-index:10; line-height:1; }
.ocr-modal-close-btn:hover { color:var(--text); }
.ocr-modal-split { display:flex; height:100%; min-height:0; }
.ocr-modal-split.ocr-upload-simple {
    flex:1;
}
/* Left upload pane */
.ocr-modal-upload-pane { width:52%; min-width:0; border-right:1px solid var(--border); padding:24px; display:flex; flex-direction:column; overflow-y:auto; background:var(--surface); }
.ocr-upload-simple .ocr-modal-upload-pane {
    width:100%;
    border-right:0;
    padding:24px 24px 14px;
}
.ocr-modal-preview-pane { margin-top:12px; min-height:220px; flex:1; border:1px solid var(--border); border-radius:10px; overflow:hidden; display:flex; flex-direction:column; background:#f3f4f8; }
[data-theme="dark"] .ocr-modal-preview-pane { background:#0f172a; }
.ocr-modal-preview-header { padding:10px 14px; border-bottom:1px solid var(--border); font-size:12px; font-weight:500; display:flex; align-items:center; gap:8px; color:var(--text-secondary); min-height:40px; background:var(--surface); }
.ocr-modal-preview-pane iframe { flex:1; border:none; width:100%; min-height:0; }
.ocr-excel-preview { flex:1; min-height:0; overflow:auto; background:#fff; padding:10px; color:#0f172a; }
.ocr-excel-preview-meta { display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-bottom:8px; font-size:12px; color:#64748b; }
.ocr-excel-preview-meta b { color:#166534; }
.ocr-excel-preview-table { border-collapse:collapse; width:max-content; min-width:100%; font-size:12px; background:#fff; }
.ocr-excel-preview-table th,
.ocr-excel-preview-table td { border:1px solid #e2e8f0; padding:5px 8px; min-width:88px; max-width:260px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; vertical-align:top; }
.ocr-excel-preview-table th { position:sticky; top:0; z-index:1; background:#ecfdf5; color:#14532d; font-weight:700; }
.ocr-excel-preview-table td:first-child,
.ocr-excel-preview-table th:first-child { position:sticky; left:0; z-index:2; min-width:42px; max-width:42px; text-align:right; background:#f8fafc; color:#64748b; font-weight:600; }
.ocr-excel-preview-empty { height:100%; min-height:180px; display:flex; align-items:center; justify-content:center; flex-direction:column; gap:8px; color:#64748b; text-align:center; padding:24px; }
[data-theme="dark"] .ocr-excel-preview { background:#0f172a; color:#e5e7eb; }
[data-theme="dark"] .ocr-excel-preview-table { background:#0f172a; }
[data-theme="dark"] .ocr-excel-preview-table th { background:#052e1a; color:#bbf7d0; }
[data-theme="dark"] .ocr-excel-preview-table td:first-child,
[data-theme="dark"] .ocr-excel-preview-table th:first-child { background:#111827; color:#94a3b8; }
/* Right controls pane */
.ocr-modal-controls { flex:1; min-width:0; padding:24px; overflow-y:auto; display:flex; flex-direction:column; gap:0; max-height:88vh; }
/* File list */
.ocr-modal-file-list { display:flex; flex-direction:column; gap:6px; max-height:180px; overflow-y:auto; margin:12px 0 0; }
.ocr-modal-file-item { display:flex; align-items:center; gap:10px; padding:8px 12px; border:1px solid var(--border); border-radius:8px; background:var(--bg); font-size:13px; cursor:grab; transition:border-color .15s, background .15s; }
.ocr-modal-file-item:hover { border-color:var(--primary); }
.ocr-modal-file-item.active-preview { border-color:var(--primary); background:rgba(29,92,200,0.06); }
.ocr-modal-file-item.drag-over { border-color:var(--primary); background:#eff6ff; }
[data-theme="dark"] .ocr-modal-file-item.drag-over { background:rgba(29,92,200,0.18); }
.ocr-modal-file-item i.fa-grip-vertical { color:var(--text-secondary); font-size:11px; flex-shrink:0; }
.ocr-modal-file-item .file-name { flex:1; font-weight:500; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.ocr-modal-file-type-label { display:flex; align-items:center; gap:6px; flex-shrink:0; font-size:10px; color:var(--text-secondary); }
.ocr-modal-file-type { max-width:190px; min-width:125px; border:1px solid var(--border); border-radius:6px; background:var(--surface); color:var(--text); padding:4px 6px; font:inherit; font-size:11px; }
.ocr-modal-file-item .file-size { font-size:11px; color:var(--text-secondary); flex-shrink:0; }
.ocr-modal-file-item .file-remove { background:none; border:none; color:var(--text-secondary); cursor:pointer; padding:2px 6px; flex-shrink:0; }
.ocr-modal-file-item .file-remove:hover { color:#dc2626; }
.ocr-modal-actions { display:flex; align-items:center; justify-content:flex-end; gap:10px; margin-top:auto; padding-top:14px; border-top:1px solid var(--border); }
.ocr-upload-simple-actions {
    margin-top:0;
    padding:14px 24px 18px;
    flex:0 0 auto;
}
.ocr-modal-actions .ocr-action-btn,
.ocr-modal-actions .ocr-submit-btn {
    min-height:42px;
    margin-top:0;
    box-sizing:border-box;
    justify-content:center;
    white-space:nowrap;
}
.ocr-modal-actions .ocr-action-btn { padding:0 18px; font-size:13px; border-radius:9px; }
.ocr-modal-actions .ocr-submit-btn { padding:0 28px; }
@media(max-width:700px) { .ocr-modal-split { flex-direction:column; } .ocr-modal-upload-pane { width:100%; border-right:none; border-bottom:1px solid var(--border); max-height:55vh; } .ocr-modal-preview-pane { min-height:180px; } }
.ocr-classify-card {
    position:relative; background:var(--surface); border-radius:12px; width:min(1120px,96vw);
    max-height:92vh; overflow:auto; box-shadow:0 20px 60px rgba(0,0,0,.22); padding:22px;
}
.ocr-classify-card.ob-classify-card {
    width:min(1680px,calc(100vw - 32px));
    height:calc(100dvh - 32px);
    max-height:none;
    overflow:hidden;
    padding:0;
}
.ocr-classify-card .ob-classify-header h3 {
    display:flex;
    align-items:center;
    gap:8px;
}
.ocr-classify-card .ob-classify-header > div:first-child {
    flex:1 1 auto;
    min-width:0;
}
.ocr-classify-layout {
    grid-template-columns:minmax(420px,48%) minmax(560px,1fr);
}
#ocr-classify-review {
    flex:1;
    min-height:0;
    flex-direction:column;
    overflow:hidden;
}
#ocr-classify-preview-frame {
    flex:1;
    min-height:0;
    width:100%;
    border:0;
    background:#f8fafc;
}
#ocr-classify-tbody.ob-map-list {
    padding-bottom:18px;
}
.ocr-map-header {
    position:sticky;
    top:0;
    z-index:1;
    background:#f8fafc;
    color:#64748b;
    font-size:11px;
    font-weight:900;
    text-transform:uppercase;
    border-color:#dbe3ef;
    box-shadow:0 1px 0 rgba(15,23,42,.04);
}
.ocr-map-header span {
    min-width:0;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}
.ocr-classify-card h3 { margin:0 32px 6px 0; font-size:18px; display:flex; align-items:center; gap:8px; color:var(--text); }
.ocr-classify-meta { color:var(--text-secondary); font-size:12px; margin-bottom:14px; }
.ocr-classify-doc-queue {
    margin-top:10px;
    width:100%;
    max-width:none;
}
.ocr-classify-doc-queue-head {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    color:#64748b;
    font-size:11px;
    font-weight:800;
    text-transform:uppercase;
    margin-bottom:6px;
}
.ocr-classify-doc-queue-head span {
    min-width:0;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}
.ocr-classify-doc-strip {
    display:flex;
    gap:8px;
    overflow-x:auto;
    padding:2px 2px 8px;
    scrollbar-width:thin;
}
.ocr-classify-doc-chip {
    flex:0 0 240px;
    display:grid;
    grid-template-columns:28px minmax(0,1fr);
    grid-template-rows:auto auto;
    column-gap:8px;
    row-gap:2px;
    text-align:left;
    border:1px solid #dbe3ef;
    border-radius:8px;
    background:#fff;
    color:#334155;
    padding:8px 10px;
    cursor:pointer;
    box-shadow:0 1px 2px rgba(15,23,42,.04);
}
.ocr-classify-doc-chip:hover:not(:disabled) {
    border-color:#93c5fd;
    background:#f8fbff;
}
.ocr-classify-doc-chip:disabled {
    cursor:not-allowed;
    opacity:.78;
}
.ocr-classify-doc-chip.active {
    border-color:#2563eb;
    background:#eff6ff;
    box-shadow:0 0 0 1px rgba(37,99,235,.14);
}
.ocr-classify-doc-chip.sent {
    border-color:#bbf7d0;
    background:#f0fdf4;
}
.ocr-classify-doc-chip.failed {
    border-color:#fecaca;
    background:#fef2f2;
}
.ocr-classify-doc-chip.classifying,
.ocr-classify-doc-chip.sending {
    border-color:#bfdbfe;
    background:#eff6ff;
}
.ocr-classify-doc-no {
    grid-row:1 / span 2;
    width:26px;
    height:26px;
    border-radius:7px;
    display:flex;
    align-items:center;
    justify-content:center;
    background:#e2e8f0;
    color:#334155;
    font-size:12px;
    font-weight:900;
}
.ocr-classify-doc-chip.active .ocr-classify-doc-no {
    background:#2563eb;
    color:#fff;
}
.ocr-classify-doc-main {
    min-width:0;
    display:flex;
    flex-direction:column;
    gap:1px;
}
.ocr-classify-doc-name,
.ocr-classify-doc-sub {
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}
.ocr-classify-doc-name {
    color:#0f172a;
    font-size:12px;
    font-weight:900;
}
.ocr-classify-doc-sub {
    color:#64748b;
    font-size:11px;
    font-weight:700;
}
.ocr-classify-doc-status {
    grid-column:2;
    color:#64748b;
    font-size:11px;
    font-weight:800;
}
.ocr-classify-doc-chip.sent .ocr-classify-doc-status { color:#15803d; }
.ocr-classify-doc-chip.failed .ocr-classify-doc-status { color:#b91c1c; }
.ocr-classify-footer-actions,
.ocr-classify-footer-nav {
    display:flex;
    align-items:center;
    gap:8px;
    flex-wrap:wrap;
    justify-content:flex-end;
}
.ocr-classify-footer-nav {
    padding-right:4px;
}
.ocr-classify-loading { text-align:center; padding:46px 0; color:var(--text-secondary); font-size:13px; }
.ocr-classify-loading i { display:block; font-size:26px; color:var(--primary); margin-bottom:10px; }
.ocr-classify-help {
    display:flex; align-items:flex-start; gap:8px; background:#eff6ff; color:#1e40af;
    border:1px solid #bfdbfe; border-radius:8px; padding:9px 10px; font-size:12px; margin-bottom:12px;
}
.ocr-classify-table-wrap { overflow-x:auto; border:1px solid var(--border); border-radius:8px; margin-bottom:14px; }
.ocr-classify-table { min-width:940px; margin:0 !important; }
.ocr-classify-table select {
    width:100%; border:1px solid var(--border); border-radius:7px; background:var(--surface);
    color:var(--text); padding:7px 8px; font-size:12px;
}
.ocr-classify-table tr.ocr-classify-skipped {
    background:#f8fafc;
    opacity:.78;
}
.ocr-classify-actions { display:flex; justify-content:flex-end; gap:10px; }
.ocr-classify-error { margin-top:12px; padding:12px; background:#fee2e2; color:#991b1b; border-radius:8px; font-size:13px; }
.ocr-classify-warning {
    margin:10px 0;
    padding:10px 12px;
    background:#fffbeb;
    color:#92400e;
    border:1px solid #fde68a;
    border-radius:8px;
    font-size:12px;
    line-height:1.45;
}

/* Shipment merged-PDF classification modal */
.ob-classify-card {
    position:relative;
    background:var(--surface);
    border-radius:12px;
    width:min(1680px,calc(100vw - 32px));
    height:calc(100dvh - 32px);
    min-height:min(760px,calc(100dvh - 32px));
    overflow:hidden;
    box-shadow:0 20px 60px rgba(0,0,0,.22);
    display:flex;
    flex-direction:column;
}
.ob-classify-header {
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:14px;
    padding:18px 22px 12px;
    border-bottom:1px solid var(--border);
    background:var(--surface);
}
.ob-classify-header h3 {
    margin:0;
    font-size:20px;
    color:var(--text);
}
.ob-classify-header p {
    margin:4px 0 0;
    color:var(--text-secondary);
    font-size:13px;
}
.ob-classify-close {
    border:0;
    background:#f8fafc;
    color:#64748b;
    border-radius:8px;
    padding:8px 10px;
    cursor:pointer;
}
.ob-classify-close:hover {
    color:#0f172a;
    background:#eef2f7;
}
#ob-classify-meta {
    margin-top:4px;
    color:var(--text-secondary);
    font-size:12px;
}
.ob-classify-steps {
    display:flex;
    gap:8px;
    padding:12px 22px;
    border-bottom:1px solid var(--border);
    background:#f8fafc;
    flex:0 0 auto;
}
.ob-classify-steps span {
    border:1px solid #dbe3ef;
    border-radius:999px;
    padding:4px 10px;
    font-size:12px;
    font-weight:800;
    color:#64748b;
    background:#fff;
}
.ob-classify-steps span.active {
    border-color:#bfdbfe;
    background:#eff6ff;
    color:#1d4ed8;
}
.ob-classify-layout {
    flex:1;
    min-height:0;
    display:grid;
    grid-template-columns:minmax(420px,48%) minmax(560px,1fr);
}
.ob-preview-pane {
    min-width:0;
    border-right:1px solid var(--border);
    background:#eef2f7;
    display:flex;
    flex-direction:column;
}
.ob-preview-title {
    display:flex;
    align-items:center;
    gap:8px;
    padding:10px 14px;
    background:var(--surface);
    border-bottom:1px solid var(--border);
    color:var(--text);
    font-size:12px;
    font-weight:700;
}
.ob-preview-title > span {
    min-width:0;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}
.ob-preview-title i { color:#b91c1c; }
.ob-preview-zoom-tools {
    margin-left:auto;
    display:inline-flex;
    align-items:center;
    gap:4px;
    flex-shrink:0;
}
.ob-preview-zoom-tools button {
    width:28px;
    height:28px;
    border:1px solid #cbd5e1;
    border-radius:7px;
    background:#fff;
    color:#334155;
    cursor:pointer;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    font-size:11px;
}
.ob-preview-zoom-tools button:hover:not(:disabled) {
    border-color:#2563eb;
    color:#1d4ed8;
    background:#eff6ff;
}
.ob-preview-zoom-tools button:disabled {
    opacity:.45;
    cursor:not-allowed;
}
.ob-preview-zoom-tools span {
    min-width:46px;
    text-align:center;
    font-variant-numeric:tabular-nums;
    color:#475569;
}
.ob-preview-pane iframe {
    flex:1;
    min-height:0;
    width:100%;
    border:0;
    background:#f8fafc;
}
.ob-existing-preview-stage {
    flex:1;
    min-height:0;
    background:#e5e7eb;
    color:#475569;
    overflow:auto;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:22px;
}
.ob-existing-preview-placeholder {
    max-width:420px;
    text-align:center;
    border:1px dashed #cbd5e1;
    border-radius:10px;
    background:#f8fafc;
    padding:28px 26px;
    color:#64748b;
}
.ob-existing-preview-placeholder i {
    display:inline-flex;
    align-items:center;
    justify-content:center;
    width:42px;
    height:42px;
    border-radius:10px;
    background:#e0ebff;
    color:#1d4ed8;
    font-size:20px;
    margin-bottom:10px;
}
.ob-existing-preview-placeholder b {
    display:block;
    color:#0f172a;
    font-size:15px;
    margin-bottom:5px;
}
.ob-existing-preview-placeholder span {
    display:block;
    color:#64748b;
    font-size:12px;
    line-height:1.5;
}
.ob-existing-pdf-page {
    display:flex;
    flex-direction:column;
    align-items:center;
    gap:8px;
    min-width:0;
}
.ob-existing-pdf-page canvas {
    max-width:none;
    height:auto;
    background:#fff;
    box-shadow:0 10px 28px rgba(15,23,42,.18);
}
.ob-existing-pdf-caption {
    max-width:100%;
    display:flex;
    align-items:center;
    gap:8px;
    color:#475569;
    font-size:12px;
}
.ob-source-method {
    display:inline-flex;
    align-items:center;
    gap:5px;
    border:1px solid #bfdbfe;
    border-radius:999px;
    background:#eff6ff;
    color:#1d4ed8;
    padding:2px 8px;
    font-size:11px;
    font-weight:900;
}
.ob-page-rail {
    display:flex;
    gap:8px;
    overflow-x:auto;
    padding:10px;
    background:var(--surface);
    border-top:1px solid var(--border);
}
.ob-page-chip {
    border:1px solid var(--border);
    background:var(--surface);
    color:var(--text-secondary);
    border-radius:8px;
    padding:5px;
    width:78px;
    font-size:11px;
    font-weight:700;
    flex:0 0 auto;
    cursor:pointer;
    display:flex;
    flex-direction:column;
    align-items:center;
    gap:4px;
}
.ob-page-chip.active {
    border-color:var(--primary);
    color:var(--primary);
    background:#eff6ff;
}
.ob-thumb-frame {
    width:66px;
    height:86px;
    border:1px solid #dbe3ef;
    border-radius:5px;
    background:#f8fafc;
    display:flex;
    align-items:center;
    justify-content:center;
    overflow:hidden;
}
.ob-thumb-frame canvas {
    max-width:100%;
    max-height:100%;
    display:block;
}
.ob-thumb-placeholder {
    width:22px;
    height:28px;
    border-radius:4px;
    border:1px solid #cbd5e1;
    background:linear-gradient(180deg,#fff,#edf2f7);
}
.ob-page-chip-label {
    line-height:1.1;
    white-space:nowrap;
}
.ob-slot-rail {
    gap:8px;
    padding:9px 10px;
    background:#f8fafc;
}
.ob-slot-rail .ob-page-chip {
    width:190px;
    min-height:58px;
    padding:8px 9px;
    flex-direction:row;
    justify-content:flex-start;
    text-align:left;
    align-items:center;
    gap:8px;
}
.ob-slot-rail .ob-page-chip:disabled {
    cursor:default;
}
.ob-slot-rail .ob-page-chip.ready {
    color:#334155;
    background:#fff;
}
.ob-slot-rail .ob-page-chip.missing {
    background:#fff;
    border-style:dashed;
    color:#64748b;
}
.ob-slot-rail .ob-page-chip.missing.required {
    border-color:#fdba74;
    background:#fff7ed;
}
.ob-slot-rail .ob-page-chip.active {
    border-color:var(--primary);
    color:#1d4ed8;
    background:#eff6ff;
    box-shadow:0 0 0 2px rgba(37,99,235,.10);
}
.ob-slot-rail .ob-thumb-frame {
    width:34px;
    height:34px;
    border-radius:8px;
    flex:0 0 34px;
}
.ob-slot-rail .ob-doc-chip .ob-thumb-frame {
    height:34px;
}
.ob-slot-rail .ob-doc-chip .ob-thumb-frame i {
    font-size:16px;
}
.ob-slot-rail .ob-page-chip.missing .ob-thumb-frame i {
    color:#94a3b8;
}
.ob-slot-rail .ob-page-chip.missing.required .ob-thumb-frame i {
    color:#ea580c;
}
.ob-slot-rail .ob-page-chip-label {
    min-width:0;
    display:flex;
    flex-direction:column;
    gap:2px;
    line-height:1.15;
    white-space:normal;
}
.ob-slot-rail .ob-page-chip-label b,
.ob-slot-rail .ob-page-chip-label span,
.ob-slot-rail .ob-page-chip-label small {
    display:block;
    min-width:0;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}
.ob-slot-rail .ob-page-chip-label b {
    color:#0f172a;
    font-size:11px;
    font-weight:900;
}
.ob-slot-rail .ob-page-chip-label span {
    color:#334155;
    font-size:10px;
    font-weight:800;
}
.ob-slot-rail .ob-page-chip-label small {
    color:#64748b;
    font-size:10px;
    font-weight:700;
}
.ob-map-pane {
    min-width:0;
    min-height:0;
    display:flex;
    flex-direction:column;
    overflow:hidden;
    background:var(--surface);
}
#ob-review {
    flex:1;
    min-height:0;
    flex-direction:column;
    overflow:hidden;
}
.ob-loading {
    text-align:center;
    padding:56px 20px;
    color:var(--text-secondary);
    font-size:13px;
}
.ob-loading i {
    display:block;
    font-size:26px;
    margin-bottom:10px;
    color:var(--primary);
}
.ob-map-help {
    display:flex;
    align-items:center;
    gap:8px;
    margin:14px 16px 10px;
    padding:9px 10px;
    border:1px solid #bfdbfe;
    background:#eff6ff;
    color:#1e40af;
    border-radius:8px;
    font-size:12px;
    font-weight:600;
}
.ob-quota-summary {
    margin:0 16px 10px;
    border:1px solid var(--border);
    border-radius:8px;
    padding:10px 12px;
    background:#f8fafc;
    color:#475569;
    font-size:12px;
    line-height:1.35;
}
.ob-quota-summary.ready {
    border-color:#bfdbfe;
    background:#eff6ff;
}
.ob-quota-summary.warning {
    border-color:#fed7aa;
    background:#fff7ed;
    color:#9a3412;
}
.ob-quota-summary.over {
    border-color:#fecaca;
    background:#fff1f2;
}
.ob-quota-main {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    color:#0f172a;
    font-weight:700;
}
.ob-quota-main i { color:var(--primary); margin-right:5px; }
.ob-quota-sub {
    margin-top:4px;
    color:#64748b;
}
.ob-quota-warning {
    margin-top:7px;
    color:#b91c1c;
    font-weight:700;
}
.ob-map-list {
    flex:1;
    min-height:0;
    padding:0 16px 18px;
    overflow-y:auto;
    display:flex;
    flex-direction:column;
    gap:8px;
    overscroll-behavior:contain;
}
.ob-map-row {
    border:1px solid var(--border);
    border-radius:8px;
    background:var(--surface);
    padding:10px;
    display:grid;
    grid-template-columns:70px minmax(120px,1fr) 112px minmax(140px,170px) minmax(82px,96px) minmax(120px,150px) 46px;
    gap:10px;
    align-items:center;
}
.ob-map-row.needs-review { border-color:#fed7aa; background:#fff7ed; }
.ob-map-row.skipped {
    border-color:#cbd5e1;
    background:#f8fafc;
    opacity:.78;
}
.ob-map-pages {
    border:0;
    background:transparent;
    text-align:left;
    cursor:pointer;
    font-weight:800;
    color:var(--text);
    font-size:13px;
}
.ob-map-pages:hover { color:var(--primary); }
.ob-map-guess b {
    display:block;
    color:var(--text);
    font-size:13px;
    line-height:1.2;
}
.ob-map-guess span {
    display:block;
    color:var(--text-secondary);
    font-size:11px;
    margin-top:3px;
    line-height:1.25;
}
.ob-confidence-pill {
    display:inline-flex;
    align-items:center;
    justify-content:center;
    border-radius:999px;
    padding:4px 9px;
    font-size:11px;
    font-weight:800;
    white-space:nowrap;
}
.ob-confidence-pill.good { background:#dcfce7; color:#166534; }
.ob-confidence-pill.review { background:#ffedd5; color:#9a3412; }
.ob-confidence-pill.low { background:#fee2e2; color:#991b1b; }
.ob-map-row select {
    width:100%;
    border:1px solid var(--border);
    border-radius:7px;
    background:var(--surface);
    color:var(--text);
    padding:7px 8px;
    font-size:12px;
    font-weight:600;
}
.ob-map-row select:disabled {
    color:#475569;
    background:#f8fafc;
    opacity:1;
}
.ob-doc-chip .ob-thumb-frame {
    height:74px;
    display:flex;
    align-items:center;
    justify-content:center;
    background:#f8fafc;
}
.ob-doc-chip .ob-thumb-frame i {
    font-size:24px;
    color:#64748b;
}
.ob-existing-list {
    display:flex;
    flex-direction:column;
    gap:8px;
}
.ob-existing-row {
    display:grid;
    grid-template-columns:minmax(128px,.45fr) minmax(280px,1fr) auto;
    gap:8px;
    align-items:center;
    border:1px solid #e2e8f0;
    border-radius:8px;
    background:#fff;
    padding:10px;
}
.ob-existing-row.ready {
    border-color:#bbf7d0;
    background:#f7fef9;
}
.ob-existing-row.missing {
    border-color:#fed7aa;
    background:#fff7ed;
}
.ob-existing-slot {
    min-width:0;
}
.ob-existing-slot b {
    display:block;
    color:#0f172a;
    font-size:13px;
}
.ob-existing-slot span {
    display:inline-flex;
    margin-top:4px;
    border-radius:999px;
    background:#f8fafc;
    color:#475569;
    border:1px solid #e2e8f0;
    padding:2px 7px;
    font-size:10px;
    font-weight:900;
}
.ob-existing-row.missing .ob-existing-slot span {
    background:#fff1f2;
    border-color:#fecaca;
    color:#991b1b;
}
.ob-existing-row.ready .ob-existing-slot span {
    background:#dcfce7;
    border-color:#bbf7d0;
    color:#166534;
}
.ob-existing-picker {
    min-width:0;
    display:grid;
    grid-template-columns:minmax(150px,.62fr) minmax(180px,1fr);
    gap:8px;
    align-items:center;
    position:relative;
}
.ob-existing-picker label {
    min-width:0;
    display:flex;
    align-items:center;
    gap:7px;
    border:1px solid #dbe3ef;
    border-radius:7px;
    padding:0 9px;
    background:#fff;
    color:#94a3b8;
}
.ob-existing-picker label:focus-within {
    border-color:#93c5fd;
    box-shadow:0 0 0 2px rgba(37,99,235,.10);
}
.ob-existing-picker label i {
    flex:0 0 auto;
    font-size:11px;
}
.ob-existing-picker input {
    width:100%;
    min-width:0;
    border:0;
    outline:0;
    background:transparent;
    padding:8px 0;
    color:#0f172a;
    font-size:12px;
}
.ob-existing-picker input::placeholder {
    color:#94a3b8;
}
.ob-existing-results {
    display:none;
    position:absolute;
    z-index:12;
    top:calc(100% + 4px);
    left:0;
    right:0;
    max-height:260px;
    overflow:auto;
    border:1px solid #bfdbfe;
    border-radius:8px;
    background:#fff;
    box-shadow:0 16px 34px rgba(15,23,42,.18);
    padding:5px;
}
.ob-existing-results.active {
    display:block;
}
.ob-existing-result {
    width:100%;
    display:grid;
    grid-template-columns:22px minmax(0,1fr) auto;
    gap:8px;
    align-items:center;
    border:0;
    border-radius:6px;
    background:#fff;
    color:#334155;
    padding:7px 8px;
    text-align:left;
    cursor:pointer;
}
.ob-existing-result:hover,
.ob-existing-result.active {
    background:#eff6ff;
    color:#1d4ed8;
}
.ob-existing-result i {
    color:#64748b;
    text-align:center;
}
.ob-existing-result span {
    min-width:0;
    display:flex;
    flex-direction:column;
    gap:2px;
}
.ob-existing-result b,
.ob-existing-result small {
    display:block;
    min-width:0;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}
.ob-existing-result b {
    color:#0f172a;
    font-size:12px;
    font-weight:800;
}
.ob-existing-result small {
    color:#64748b;
    font-size:11px;
    font-weight:600;
}
.ob-existing-result em {
    border:1px solid #bfdbfe;
    border-radius:999px;
    background:#eff6ff;
    color:#1d4ed8;
    padding:2px 6px;
    font-size:10px;
    font-style:normal;
    font-weight:900;
}
.ob-existing-result-empty {
    padding:10px;
    color:#64748b;
    font-size:12px;
    text-align:center;
}
.ob-existing-row select {
    width:100%;
    min-width:0;
    border:1px solid #dbe3ef;
    border-radius:7px;
    padding:8px 10px;
    background:#fff;
    color:#0f172a;
    font-size:12px;
}
.ob-existing-row button {
    white-space:nowrap;
}
.ob-existing-row button:disabled {
    opacity:.5;
    cursor:not-allowed;
}
.ob-existing-row small {
    grid-column:2 / -1;
    color:#64748b;
    font-size:11px;
    line-height:1.35;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}
.ob-classify-actions {
    border-top:1px solid var(--border);
    padding:12px 22px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    background:var(--surface);
    flex:0 0 auto;
    z-index:2;
}
.ob-classify-actions > div:first-child {
    color:#64748b;
    font-size:12px;
}
.ob-classify-actions > div:last-child {
    display:flex;
    align-items:center;
    gap:10px;
}
@media(max-width:900px) {
    .ob-classify-card { width:calc(100vw - 16px); height:calc(100dvh - 16px); min-height:0; }
    .ob-classify-header,
    .ob-classify-actions { padding-left:14px; padding-right:14px; }
    .ob-classify-steps { padding-left:14px; padding-right:14px; overflow-x:auto; }
    .ob-classify-layout { grid-template-columns:1fr; overflow:auto; }
    .ob-preview-pane { min-height:420px; border-right:0; border-bottom:1px solid var(--border); }
    .ob-map-pane { min-height:520px; }
    .ob-map-row { grid-template-columns:72px minmax(160px,1fr); }
    .ob-map-row > * { min-width:0; }
    .ob-existing-row { grid-template-columns:1fr; }
    .ob-existing-picker { grid-template-columns:1fr; }
    .ob-existing-row small { grid-column:auto; white-space:normal; }
    .ob-classify-actions { align-items:stretch; flex-direction:column; }
    .ob-classify-actions > div:last-child { justify-content:flex-end; }
}

/* OCR empty state */
.ocr-empty-state { text-align:center; padding:48px 24px; color:var(--text-secondary); }
.ocr-empty-state i { font-size:40px; margin-bottom:12px; display:block; color:var(--border); }

/* OCR table row actions */
.ocr-row-btn { background:none; border:none; cursor:pointer; color:var(--text-secondary); padding:4px 8px; font-size:13px; }
.ocr-row-btn:hover { color:var(--primary); }
.zia-tag-strip { display:flex; align-items:center; gap:5px; flex-wrap:wrap; min-width:0; }
.zia-tag-chip { display:inline-flex; align-items:center; gap:5px; max-width:150px; padding:2px 8px; border-radius:999px; background:#eef2ff; color:#3730a3; border:1px solid #c7d2fe; font-size:11px; font-weight:700; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.zia-tag-chip.editable { max-width:220px; padding-right:5px; }
.zia-tag-chip button { border:none; background:transparent; color:inherit; cursor:pointer; padding:0 2px; font-size:13px; line-height:1; opacity:.75; }
.zia-tag-chip button:hover { opacity:1; }
.zia-tag-empty { color:#94a3b8; font-size:11px; font-weight:600; }
.sh-table-tags .zia-tag-strip { max-width:180px; }
#shipments-table-wrap .sh-shipments-table {
    table-layout:fixed;
    min-width:1777px;
}
.sh-shipments-table .sh-col-id { width:170px; }
.sh-shipments-table .sh-col-name { width:220px; }
.sh-shipments-table .sh-col-template { width:300px; }
.sh-shipments-table .sh-col-tags { width:132px; }
.sh-shipments-table .sh-col-ocr { width:92px; }
.sh-shipments-table .sh-col-docs { width:70px; }
.sh-shipments-table .sh-col-match { width:88px; }
.sh-shipments-table .sh-col-status { width:185px; }
.sh-shipments-table .sh-col-result { width:145px; }
.sh-shipments-table .sh-col-created { width:190px; }
.sh-shipments-table .sh-col-updated { width:190px; }
.sh-ocr-model-badge {
    display:inline-block;
    padding:2px 8px;
    border-radius:10px;
    font-size:11px;
    font-weight:600;
    white-space:nowrap;
}
.sh-ocr-model-badge--ztrus { background:#f3e8ff; color:#6b21a8; }
.sh-ocr-model-badge--standard { background:#dbeafe; color:#1d4ed8; }
.sh-ocr-model-badge--typhoon { background:#e0f2fe; color:#075985; }
.sh-ocr-model-badge--excel { background:#dcfce7; color:#166534; }
.sh-ocr-model-empty {
    color:#94a3b8;
    font-size:11px;
}
.sh-preview-active-head {
    flex:1;
    min-width:0;
    display:flex;
    flex-direction:column;
    gap:2px;
}
.sh-preview-active-meta {
    min-height:18px;
    display:flex;
    align-items:center;
    gap:8px;
    min-width:0;
    color:#64748b;
    font-size:11px;
    font-weight:700;
}
#sh-preview-active-filename {
    display:block;
    min-width:0;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    color:#334155;
}
#sh-preview-active-model .sh-ocr-model-badge {
    font-size:10px;
    padding:2px 7px;
}
.sh-slot-attach-btn {
    display:inline-flex;
    align-items:center;
    gap:6px;
    border:1px dashed #94a3b8;
    background:#fff;
    border-radius:14px;
    padding:4px 10px;
    font-size:12px;
    font-weight:700;
    cursor:pointer;
    color:#475569;
    white-space:nowrap;
}
.sh-slot-empty-message {
    color:#64748b;
    font-size:12px;
    padding:4px 2px;
}
.sh-slot-tab {
    display:inline-flex;
    align-items:center;
    gap:7px;
    padding:5px 10px;
    border:1px solid #e2e8f0;
    border-radius:12px;
    font-size:12px;
    cursor:pointer;
    max-width:310px;
    min-width:120px;
    background:#fff;
    color:#0f172a;
}
.sh-slot-tab-active {
    background:#1e4f8b;
    color:#fff;
    border-color:#1e4f8b;
}
.sh-slot-tab-empty {
    gap:6px;
    padding:4px 10px;
    border-style:dashed;
    border-color:#94a3b8;
    border-radius:14px;
    background:#fafafa;
    color:#475569;
}
.sh-slot-tab-empty-required {
    border-color:#fed7aa;
    background:#fff7ed;
    color:#9a3412;
}
.sh-slot-chip-icon {
    font-size:11px;
}
.sh-slot-chip-icon-active {
    color:#fff;
}
.sh-slot-chip-icon-ready {
    color:#166534;
}
.sh-slot-tab .sh-slot-chip-text {
    min-width:0;
    overflow:hidden;
}
.sh-slot-tab .sh-slot-chip-doc {
    display:block;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    max-width:190px;
}
.sh-slot-tab .sh-slot-chip-file {
    display:block;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    max-width:190px;
    margin-top:1px;
    opacity:.72;
    font-size:10px;
    line-height:1.15;
}
.sh-slot-chip-action {
    border:none;
    background:none;
    color:#64748b;
    cursor:pointer;
    font-size:11px;
    padding:0 2px;
}
.sh-slot-chip-action .fas {
    font-size:10px;
}
.sh-slot-tab-active .sh-slot-chip-action {
    color:#dbeafe;
}
.sh-slot-chip-remove {
    color:#94a3b8;
}
.sh-slot-tab-active .sh-slot-chip-remove {
    color:#cbd5e1;
}
#shipments-table-wrap .acct-table th,
#shipments-table-wrap .acct-table td {
    min-width:0;
}
.sh-shipment-name-cell,
.sh-rule-template-col,
.sh-tags-col {
    min-width:0;
}
.sh-shipment-name-text,
.sh-shipment-batch-text,
.sh-rule-template-name {
    display:block;
    max-width:100%;
    min-width:0;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}
.sh-shipment-name-text {
    color:var(--text);
    font-size:13px;
    font-weight:700;
    line-height:1.25;
}
.sh-shipment-batch-text {
    margin-top:2px;
    color:#64748b;
    font-size:11px;
    line-height:1.25;
}
.sh-date-col {
    color:#64748b;
    font-size:12px;
    font-variant-numeric:tabular-nums;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}
.sh-rule-template-name {
    color:#334155;
    font-size:12px;
    font-weight:700;
    line-height:1.25;
}
.sh-rule-template-name.muted { color:#94a3b8; }
.sh-table-tags .zia-tag-strip {
    max-width:100%;
    flex-wrap:nowrap;
    overflow:hidden;
}
.sh-table-tags .zia-tag-chip {
    max-width:112px;
}
.sh-table-open-btn {
    border:none;
    background:transparent;
    padding:0;
    margin:0;
    color:inherit;
    font:inherit;
    cursor:pointer;
    text-align:left;
}
.sh-table-open-btn:hover .business-id,
.sh-table-open-btn:focus-visible .business-id {
    box-shadow:0 0 0 2px rgba(37,99,235,.18);
}
.sh-status-open-btn {
    display:inline-flex;
    align-items:center;
    border-radius:999px;
}
.sh-status-open-btn:hover,
.sh-status-open-btn:focus-visible {
    outline:2px solid rgba(37,99,235,.22);
    outline-offset:2px;
}
.zia-tag-edit-btn { display:inline-flex; align-items:center; justify-content:center; width:24px; height:24px; border:1px solid #dbe3ef; border-radius:999px; background:#fff; color:#64748b; cursor:pointer; font-size:11px; }
.zia-tag-edit-btn:hover { border-color:var(--primary); color:var(--primary); }
.zia-tag-modal-card {
    max-width:760px;
    padding:26px 30px 24px;
}
.zia-tag-modal-card h2 {
    margin:0 34px 24px;
    padding:0;
    text-align:center;
    font-size:21px;
    line-height:1.25;
}
.zia-tag-field {
    display:flex;
    flex-direction:column;
    gap:8px;
}
.zia-tag-field > label {
    color:#475569;
    font-size:14px;
    font-weight:800;
}
.zia-tag-entry-row {
    display:grid;
    grid-template-columns:minmax(0, 1fr) 92px;
    gap:10px;
    align-items:center;
}
.zia-tag-combo {
    display:flex;
    align-items:center;
    min-width:0;
    border:1px solid #dbe3ef;
    border-radius:6px;
    background:#fff;
    overflow:hidden;
}
.zia-tag-combo:focus-within {
    border-color:#2563eb;
    box-shadow:0 1px 0 #2563eb;
}
.zia-tag-combo input {
    flex:1;
    min-width:0;
    border:none;
    outline:none;
    padding:10px 12px;
    font-size:14px;
    color:#0f172a;
    background:#fff;
}
.zia-tag-combo-btn {
    width:32px;
    height:38px;
    border:none;
    background:#fff;
    color:#2563eb;
    cursor:pointer;
    display:inline-flex;
    align-items:center;
    justify-content:center;
}
.zia-tag-combo-btn:hover { background:#eff6ff; }
.zia-tag-add-btn,
.zia-tag-primary,
.zia-tag-secondary {
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:6px;
    border-radius:8px;
    padding:10px 16px;
    min-height:40px;
    font-size:14px;
    font-weight:800;
    cursor:pointer;
    white-space:nowrap;
}
.zia-tag-add-btn,
.zia-tag-primary {
    border:1px solid #0b66d8;
    background:#0b66d8;
    color:#fff;
}
.zia-tag-add-btn:hover,
.zia-tag-primary:hover { background:#0754b2; }
.zia-tag-secondary {
    border:1px solid #e2e8f0;
    background:#e5e7eb;
    color:#475569;
}
.zia-tag-secondary:hover {
    border-color:#cbd5e1;
    background:#dbe1e8;
}
.zia-tag-list-box {
    margin-top:16px;
    min-height:230px;
    max-height:300px;
    overflow:auto;
    border:1px solid #e2e8f0;
    border-radius:7px;
    background:#fff;
    box-shadow:0 6px 16px rgba(15,23,42,.08);
}
.zia-tag-list-row {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    min-height:42px;
    padding:8px 12px;
    border-bottom:1px solid #f1f5f9;
    color:#475569;
    font-size:14px;
    font-weight:700;
}
.zia-tag-list-row:last-child { border-bottom:none; }
.zia-tag-list-row button {
    width:30px;
    height:30px;
    border:none;
    background:transparent;
    color:#ef4444;
    cursor:pointer;
    border-radius:6px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
}
.zia-tag-list-row button:hover {
    background:#fee2e2;
    color:#dc2626;
}
.zia-tag-list-empty {
    padding:18px 12px;
    color:#94a3b8;
    font-size:13px;
    font-weight:700;
}
.zia-tag-modal-count {
    margin-top:12px;
    text-align:right;
    color:#64748b;
    font-size:13px;
    font-weight:700;
}
.zia-tag-modal-count b { color:#2563eb; }
.zia-tag-modal-actions {
    display:flex;
    justify-content:center;
    gap:18px;
    margin-top:18px;
    padding-top:0;
    border-top:none;
}
.zia-tag-modal-actions .zia-tag-secondary,
.zia-tag-modal-actions .zia-tag-primary {
    min-width:96px;
}
#ocr-files-table {
    min-width:1760px;
    table-layout:fixed;
}
#ocr-files-table .ocr-col-document-id { width:140px; }
#ocr-files-table .ocr-col-type { width:140px; }
#ocr-files-table .ocr-col-filename { width:310px; }
#ocr-files-table .ocr-col-tags { width:145px; }
#ocr-files-table .ocr-col-shipment { width:165px; }
#ocr-files-table .ocr-col-status { width:140px; }
#ocr-files-table .ocr-col-model { width:150px; }
#ocr-files-table .ocr-col-fields { width:125px; }
#ocr-files-table .ocr-col-accuracy { width:125px; }
#ocr-files-table .ocr-col-created,
#ocr-files-table .ocr-col-updated { width:112px; }
#ocr-files-table .ocr-col-actions { width:150px; }
#ocr-files-table th,
#ocr-files-table td {
    padding-left:10px;
    padding-right:10px;
}
#ocr-files-table .ocr-actions-cell { min-width:150px; }
#ocr-files-table .ocr-sort-btn {
    display:inline-flex;
    align-items:center;
    gap:5px;
    width:100%;
    padding:0;
    border:0;
    background:transparent;
    color:inherit;
    font:inherit;
    font-size:11px;
    font-weight:800;
    text-align:left;
    text-transform:inherit;
    letter-spacing:inherit;
    cursor:pointer;
}
#ocr-files-table .ocr-sort-btn i {
    color:#94a3b8;
    font-size:10px;
}
#ocr-files-table .ocr-sort-btn:hover,
#ocr-files-table .ocr-sort-btn.is-active {
    color:#1d4ed8;
}
#ocr-files-table .ocr-sort-btn.is-active i {
    color:#2563eb;
}
#ocr-files-table .ocr-row-actions {
    display:flex;
    align-items:center;
    gap:6px;
    flex-wrap:nowrap;
}
#ocr-files-table .ocr-row-btn {
    display:inline-flex;
    align-items:center;
    gap:5px;
    min-height:28px;
    padding:5px 8px;
    border:1px solid #dbe3ef;
    border-radius:7px;
    background:#fff;
    color:#475569;
    font-size:11px;
    font-weight:700;
    line-height:1;
    white-space:nowrap;
}
#ocr-files-table .ocr-row-btn:hover {
    border-color:#4f6ef7;
    background:#eff6ff;
    color:#1d4ed8;
}
#ocr-files-table .ocr-row-btn.danger,
#ocr-files-table .ocr-row-btn.danger i {
    color:#b91c1c;
}
#ocr-files-table .ocr-row-btn.danger:hover {
    border-color:#fecaca;
    background:#fef2f2;
    color:#991b1b;
}
.ocr-document-id-link {
    border:0;
    background:transparent;
    padding:0;
    color:#4f6ef7;
    text-decoration:underline;
    cursor:pointer;
    font-family:'SF Mono',Consolas,monospace;
    font-size:11px;
    font-weight:700;
}
.ocr-document-id-link:hover { color:#1d4ed8; }
.ocr-shipment-links { display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
.ocr-shipment-id-link {
    cursor:pointer;
    font-family:'SF Mono',Consolas,monospace;
}
.ocr-shipment-id-link:hover {
    border-color:#93c5fd;
    color:#1d4ed8;
    background:#dbeafe;
}
.ocr-help-icon {
    display:inline-flex;
    align-items:center;
    margin-left:4px;
    color:#64748b;
    font-size:11px;
    vertical-align:middle;
    cursor:help;
}
.ocr-confidence {
    display:inline-flex;
    flex-direction:column;
    gap:2px;
    cursor:help;
}
.ocr-confidence span {
    font-size:11px;
    color:#64748b;
}
.ocr-file-name-cell {
    color:#475569;
    font-size:12px;
    line-height:1.3;
    word-break:break-word;
}
.ocr-file-name-cell i {
    margin-right:5px;
}
.ocr-file-name-cell span {
    overflow-wrap:anywhere;
}
.ocr-timestamp-cell {
    color:var(--text-secondary);
    font-size:12px;
    line-height:1.25;
    white-space:normal;
}
.ocr-timestamp {
    display:flex;
    flex-direction:column;
    gap:2px;
}
.ocr-timestamp-date,
.ocr-timestamp-time {
    display:block;
    white-space:nowrap;
}
.ocr-timestamp-time {
    color:#64748b;
    font-size:11px;
}
.ocr-field-completeness {
    display:inline-flex;
    flex-direction:column;
    gap:4px;
    min-width:82px;
}
.ocr-field-completeness strong {
    color:#334155;
    font-size:12px;
    font-weight:800;
    white-space:nowrap;
}
.ocr-field-meter {
    width:72px;
    height:4px;
    overflow:hidden;
    border-radius:999px;
    background:#e2e8f0;
}
.ocr-field-meter span {
    display:block;
    height:100%;
    border-radius:inherit;
    background:#2563eb;
}

/* AI disclaimer */
.ai-disclaimer { text-align: center; font-size: 11px; color: var(--text-secondary); opacity: 0.7; padding: 4px 0 0; }

/* Quota badge (inline in page headers) */
.quota-badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 20px; vertical-align: middle; margin-left: 8px; }
.quota-badge.green { background: #d1fae5; color: #059669; }
.quota-badge.yellow { background: #fef3c7; color: #d97706; }
.quota-badge.red { background: #fee2e2; color: #ef4444; }
.quota-badge.unlimited { background: #dbeafe; color: #2563eb; }

/* Usage cards */
.usage-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.usage-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
.usage-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.usage-card-title { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.usage-card-value { font-size: 28px; font-weight: 700; line-height: 1.2; }
.usage-card-unit { font-size: 13px; font-weight: 500; opacity: 0.7; }
.usage-bar { height: 6px; background: var(--bg-secondary); border-radius: 3px; margin: 10px 0 6px; overflow: hidden; }
.usage-bar-fill { height: 100%; border-radius: 3px; transition: width 0.5s ease; }
.usage-card-sub { font-size: 11px; color: var(--text-secondary); }
.usage-breakdown { margin-top: 10px; display: grid; gap: 6px; }
.usage-breakdown-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--text); }
.usage-breakdown-row span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usage-breakdown-row em { color: var(--text-secondary); font-style: normal; font-weight: 500; }
.usage-breakdown-row strong { font-weight: 700; color: var(--text); white-space: nowrap; }
.usage-breakdown-scope { color: var(--primary); font-weight: 650; }
.usage-history-panel { margin-top: 20px; display: grid; gap: 16px; }
.usage-history-loading { color: var(--text-secondary); font-size: 13px; padding: 16px 0; }
.usage-history-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px; box-shadow: var(--shadow-sm); }
.usage-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.usage-section-head h4 { margin: 0; font-size: 16px; font-weight: 800; color: var(--text); }
.usage-section-head p { margin: 4px 0 0; font-size: 12px; color: var(--text-secondary); }
.usage-current-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.usage-current-metric { min-width: 0; border: 1px solid var(--border); border-radius: 10px; padding: 12px; background: var(--bg); display: grid; gap: 4px; }
.usage-current-metric i { color: var(--primary); font-size: 15px; }
.usage-current-metric span { color: var(--text-secondary); font-size: 12px; font-weight: 700; }
.usage-current-metric strong { color: var(--text); font-size: 20px; line-height: 1.15; overflow-wrap: anywhere; }
.usage-current-metric em { color: var(--text-secondary); font-size: 11px; font-style: normal; }
.usage-history-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
.usage-history-table { width: 100%; border-collapse: collapse; min-width: 980px; background: var(--surface); }
.usage-history-table th { text-align: left; background: var(--bg-secondary); color: var(--text-secondary); font-size: 11px; text-transform: uppercase; letter-spacing: 0; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.usage-history-table td { padding: 12px; border-bottom: 1px solid var(--border); color: var(--text); font-size: 13px; vertical-align: middle; }
.usage-history-table tbody tr:last-child td { border-bottom: 0; }
.usage-history-table td span,
.usage-history-table td small { color: var(--text-secondary); font-size: 11px; }
.usage-storage-cell { display: grid; gap: 6px; min-width: 140px; }
.usage-storage-cell strong { font-size: 13px; color: var(--text); }
.usage-mini-bar { height: 6px; background: var(--bg-secondary); border-radius: 999px; overflow: hidden; }
.usage-mini-bar div { height: 100%; border-radius: inherit; background: #06b6d4; }

/* Shared notification system */
.zia-notify-root {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    pointer-events: none;
}
.zia-notify-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 58px 16px 24px;
    background: rgba(15, 23, 42, 0.48);
    backdrop-filter: blur(1.5px);
    opacity: 0;
    pointer-events: auto;
    transition: opacity 0.14s ease;
}
.zia-notify-overlay.active { opacity: 1; }
.zia-notify-dialog {
    width: min(430px, calc(100vw - 32px));
    background: var(--surface, #fff);
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 12px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
    padding: 22px;
    transform: translateY(-10px) scale(0.98);
    transition: transform 0.16s ease;
    outline: none;
}
.zia-notify-overlay.active .zia-notify-dialog { transform: translateY(0) scale(1); }
.zia-notify-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    color: #2563eb;
    background: #eff6ff;
    border: 1px solid #dbeafe;
    font-size: 18px;
}
.zia-notify-warning .zia-notify-icon { color: #b45309; background: #fffbeb; border-color: #fde68a; }
.zia-notify-danger .zia-notify-icon { color: #dc2626; background: #fef2f2; border-color: #fecaca; }
.zia-notify-success .zia-notify-icon { color: #059669; background: #ecfdf5; border-color: #bbf7d0; }
.zia-notify-copy h2 {
    margin: 0;
    color: var(--text, #0f172a);
    font-size: 18px;
    line-height: 1.25;
    font-weight: 800;
    letter-spacing: 0;
}
.zia-notify-copy p {
    margin: 8px 0 0;
    color: var(--text-secondary, #64748b);
    font-size: 13px;
    line-height: 1.6;
}
.zia-notify-field {
    display: grid;
    gap: 7px;
    margin-top: 16px;
}
.zia-notify-field span {
    color: var(--text-secondary, #64748b);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}
.zia-notify-input {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 8px;
    background: var(--surface, #fff);
    color: var(--text, #0f172a);
    padding: 10px 12px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.35;
    outline: none;
    transition: border-color 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}
.zia-notify-textarea {
    min-height: 86px;
    resize: vertical;
}
.zia-notify-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}
.zia-notify-input.is-invalid {
    border-color: #dc2626;
    background: #fff7f7;
}
.zia-notify-field small {
    color: #dc2626;
    font-size: 11px;
    font-weight: 700;
}
.zia-notify-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 22px;
}
.zia-notify-btn {
    min-height: 38px;
    border-radius: 8px;
    border: 1px solid var(--border, #e2e8f0);
    padding: 8px 16px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}
.zia-notify-secondary {
    color: var(--text, #0f172a);
    background: var(--surface, #fff);
}
.zia-notify-secondary:hover { background: var(--bg-secondary, #f8fafc); }
.zia-notify-primary {
    color: #fff;
    border-color: #2563eb;
    background: #2563eb;
    box-shadow: 0 6px 14px rgba(37, 99, 235, 0.22);
}
.zia-notify-primary:hover { background: #1d4ed8; }
.zia-notify-danger .zia-notify-primary {
    border-color: #dc2626;
    background: #dc2626;
    box-shadow: 0 6px 14px rgba(220, 38, 38, 0.18);
}
.zia-notify-danger .zia-notify-primary:hover { background: #b91c1c; }
.zia-toast-stack {
    position: fixed;
    top: 76px;
    right: 22px;
    display: grid;
    gap: 10px;
    width: min(390px, calc(100vw - 28px));
    z-index: 2147483001;
    pointer-events: none;
}
.zia-toast {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    background: var(--surface, #fff);
    color: var(--text, #0f172a);
    border: 1px solid var(--border, #e2e8f0);
    border-left: 4px solid #10b981;
    border-radius: 10px;
    padding: 12px 12px 12px 13px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.16);
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.18s ease, transform 0.18s ease;
    pointer-events: auto;
}
.zia-toast.show { opacity: 1; transform: translateY(0); }
.zia-toast-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ecfdf5;
    color: #059669;
    flex-shrink: 0;
}
.zia-toast-info { border-left-color: #2563eb; }
.zia-toast-info .zia-toast-icon { color: #2563eb; background: #eff6ff; }
.zia-toast-warning { border-left-color: #d97706; }
.zia-toast-warning .zia-toast-icon { color: #b45309; background: #fffbeb; }
.zia-toast-danger { border-left-color: #dc2626; }
.zia-toast-danger .zia-toast-icon { color: #dc2626; background: #fef2f2; }
.zia-toast-message { min-width: 0; overflow-wrap: anywhere; }
.zia-toast-close {
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary, #64748b);
    cursor: pointer;
}
.zia-toast-close:hover { background: var(--bg-secondary, #f8fafc); color: var(--text, #0f172a); }
@media (max-width: 640px) {
    .zia-notify-overlay { align-items: center; padding-top: 24px; }
    .zia-notify-actions { flex-direction: column-reverse; }
    .zia-notify-btn { width: 100%; }
    .zia-toast-stack { top: 14px; right: 14px; left: 14px; width: auto; }
}

.sub-features { list-style: none; flex: 1; }
.sub-features li {
    display: flex; align-items: center; gap: 8px; font-size: 13px;
    padding: 7px 0; border-bottom: 1px solid rgba(0,0,0,0.045);
    color: var(--text);
}
.sub-features li:last-child { border-bottom: none; }
.sub-features li i.fa-check { color: #16a34a; font-size: 11px; width: 14px; flex-shrink: 0; text-align: center; }
.sub-features li.sub-feat-no { color: var(--text-secondary); }
.sub-features li.sub-feat-no i { color: #cbd5e1; width: 14px; flex-shrink: 0; }
.sf-label { flex: 1; font-weight: 500; line-height: 1.4; }
.sf-val { font-size: 12px; color: var(--text-secondary); white-space: nowrap; text-align: right; flex-shrink: 0; }
.sf-tier {
    display: inline-block; padding: 2px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 700; white-space: nowrap;
    background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0;
}
.sub-card[data-plan="pro"]        .sf-tier { background: #dbeafe; color: #1d4ed8; border-color: #bfdbfe; }
.sub-card[data-plan="max"]        .sf-tier { background: #dcfce7; color: #15803d; border-color: #bbf7d0; }
.sub-card[data-plan="enterprise"] .sf-tier { background: #ede9fe; color: #6d28d9; border-color: #ddd6fe; }

/* Enterprise Calculator */
.sub-ent-calc {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 24px; margin-bottom: 28px; box-shadow: var(--shadow);
}
.sub-ent-calc h3 { font-size: 16px; font-weight: 600; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.sub-ent-calc h3 i { color: #7c3aed; }
.sub-ent-calc-desc { font-size: 12px; color: var(--text-secondary); margin-bottom: 18px; }
.sub-calc-row { display: flex; align-items: flex-start; gap: 32px; flex-wrap: wrap; }
.sub-calc-field label { display: block; font-size: 12px; color: var(--text-secondary); font-weight: 500; margin-bottom: 6px; }
.sub-calc-stepper {
    display: flex; align-items: center; gap: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
}
.sub-calc-stepper button {
    width: 38px; height: 38px; border: none; background: var(--bg); cursor: pointer;
    font-size: 12px; color: var(--text-secondary); transition: all 0.15s; display: flex; align-items: center; justify-content: center;
}
.sub-calc-stepper button:hover { background: var(--primary); color: #fff; }
.sub-calc-stepper input {
    width: 70px; height: 38px; border: none; border-left: 1px solid var(--border); border-right: 1px solid var(--border);
    text-align: center; font-size: 16px; font-weight: 600; font-family: inherit; outline: none;
    background: var(--surface); color: var(--text);
}
.sub-calc-result { flex: 1; display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.sub-calc-per-user, .sub-calc-total, .sub-calc-annual {
    font-size: 13px; color: var(--text-secondary);
}
.sub-calc-per-user strong, .sub-calc-total strong, .sub-calc-annual strong {
    font-size: 20px; color: var(--text); margin: 0 2px;
}
.sub-calc-total strong { color: #7c3aed; }
.sub-volume-tiers {
    display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap;
}
.sub-tier-tag {
    font-size: 11px; padding: 4px 12px; border-radius: 8px; background: var(--bg);
    color: var(--text-secondary); font-weight: 500; border: 1px solid var(--border);
}

/* Feature Comparison */
.sub-compare {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 24px; margin-bottom: 24px; box-shadow: var(--shadow);
}
.sub-compare h3 { font-size: 16px; font-weight: 600; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.sub-compare h3 i { color: var(--primary); }
.sub-compare-wrap { overflow-x: auto; }
.sub-compare-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sub-compare-table thead th {
    padding: 10px 14px; text-align: center; font-weight: 700; font-size: 14px;
    border-bottom: 2px solid var(--border); color: var(--text);
}
.sub-compare-table thead th:first-child { text-align: left; }
.sub-compare-table thead th.highlight { color: var(--primary); }
.sub-compare-table td {
    padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: center; color: var(--text-secondary);
}
.sub-compare-table td:first-child { text-align: left; font-weight: 500; color: var(--text); }
.sub-cat-row td {
    background: #eef2ff; color: var(--primary) !important; font-weight: 600 !important;
    font-size: 11px !important; text-transform: uppercase; letter-spacing: 0.5px;
}
[data-theme="dark"] .sub-cat-row td { background: #1e2a4a; }
.sub-yes { color: #16a34a !important; }
.sub-no { color: #cbd5e1 !important; }
[data-theme="dark"] .sub-no { color: #475569 !important; }

@media(max-width:1024px) {
    .sub-cards { grid-template-columns: repeat(2, 1fr); }
}
@media(max-width:640px) {
    .sub-cards { grid-template-columns: 1fr; }
    .sub-calc-row { flex-direction: column; gap: 16px; }
    .sub-calc-result { gap: 12px; }
}

/* ══════════════════════════════════════════════
   BETA BADGE
══════════════════════════════════════════════ */
.beta-badge {
    display: inline-block;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 2px 7px;
    border-radius: 20px;
    margin-left: 6px;
    vertical-align: middle;
    text-transform: uppercase;
}

/* ══════════════════════════════════════════════
   USAGE METER
══════════════════════════════════════════════ */
.usage-meter {
    padding: 10px 16px 6px;
    border-top: 1px solid var(--border);
}
.usage-meter-label {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 5px;
}
.usage-meter-label span { font-weight: 700; color: var(--text); }
.usage-meter-bar {
    height: 4px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}
.usage-meter-fill {
    height: 100%;
    border-radius: 4px;
    background: #22c55e;
    transition: width 0.4s ease, background 0.3s;
}
.usage-meter-sub {
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 4px;
    text-align: right;
}

/* ══════════════════════════════════════════════
   LIMIT-REACHED BANNER
══════════════════════════════════════════════ */
.limit-banner {
    margin: 16px 0;
    padding: 16px 20px;
    background: linear-gradient(135deg, #fff7ed, #fef3c7);
    border: 1px solid #fcd34d;
    border-radius: 12px;
    color: #92400e;
    font-size: 13px;
    text-align: center;
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
}
[data-theme="dark"] .limit-banner {
    background: linear-gradient(135deg, #1c1307, #1f1b07);
    border-color: #92400e;
    color: #fcd34d;
}

/* ══════════════════════════════════════════════
   AUTH OVERLAY & CARD
══════════════════════════════════════════════ */
.auth-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.7);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}
.auth-overlay.active { display: flex; }

/* AI OCR Terms gate */
.terms-gate-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 30000;
    padding: 24px;
    background: rgba(15, 23, 42, 0.62);
}
.terms-gate-modal.active { display: flex; }
.terms-gate-card {
    width: min(920px, 96vw);
    max-height: 92vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 16px;
    border: 1px solid #dbe3ef;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 22px 80px rgba(15, 23, 42, 0.28);
    padding: 24px;
}
.terms-gate-card--small {
    width: min(480px, 94vw);
    align-items: center;
    text-align: center;
}
.terms-gate-top {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
}
.terms-gate-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    padding: 4px 9px;
    border-radius: 999px;
    background: #eef2ff;
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 800;
}
.terms-gate-card h2 {
    margin: 0;
    color: #0f172a;
    font-size: 22px;
    line-height: 1.2;
}
.terms-gate-card p {
    margin: 6px 0 0;
    color: #475569;
    font-size: 13px;
    line-height: 1.55;
}
.terms-gate-lang {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    border: 1px solid #dbe3ef;
    border-radius: 999px;
    background: #f8fafc;
    flex: 0 0 auto;
}
.terms-gate-lang button {
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
    padding: 5px 10px;
}
.terms-gate-lang button.active {
    background: #1d4ed8;
    color: #fff;
}
.terms-gate-body {
    overflow: auto;
    padding: 14px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    color: #1f2937;
}
.terms-gate-body p {
    margin: 0 0 12px;
    color: #1f2937;
}
.terms-gate-body p:last-child { margin-bottom: 0; }
.terms-gate-check {
    display: grid;
    grid-template-columns: 18px 1fr;
    gap: 10px;
    align-items: flex-start;
    padding: 12px;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    background: #eff6ff;
    color: #1e3a8a;
    font-size: 13px;
    line-height: 1.45;
    font-weight: 700;
}
.terms-gate-check input {
    width: 16px;
    height: 16px;
    margin-top: 2px;
}
.terms-gate-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}
.terms-gate-actions button,
.terms-limited-banner button {
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 800;
    padding: 10px 14px;
}
.terms-primary {
    border: 1px solid #1d4ed8;
    background: #1d4ed8;
    color: #fff;
}
.terms-primary:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}
.terms-secondary {
    border: 1px solid #dbe3ef;
    background: #fff;
    color: #334155;
}
.terms-danger {
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #991b1b;
}
.terms-gate-icon {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 20px;
}
.terms-gate-error {
    padding: 9px 12px;
    border: 1px solid #fecaca;
    border-radius: 8px;
    background: #fef2f2;
    color: #991b1b;
    font-size: 12px;
    font-weight: 700;
}
.terms-limited-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px 20px 0;
    padding: 10px 12px;
    border: 1px solid #fed7aa;
    border-radius: 8px;
    background: #fff7ed;
    color: #9a3412;
    font-size: 13px;
    font-weight: 700;
}
.terms-limited-banner span { flex: 1; }
.terms-limited-banner button {
    border: 1px solid #fdba74;
    background: #fff;
    color: #9a3412;
    padding: 7px 10px;
}

.terms-admin-card { max-width: 100%; }
.terms-admin-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 14px;
}
.terms-admin-head h3 { margin: 0; }
.terms-admin-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.terms-admin-grid,
.terms-admin-split {
    display: grid;
    gap: 12px;
    margin-top: 12px;
}
.terms-admin-grid { grid-template-columns: 160px 1fr 1fr; }
.terms-admin-split { grid-template-columns: 1fr 1fr; }
.terms-admin-grid label,
.terms-admin-split label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    color: #475569;
    font-size: 12px;
    font-weight: 800;
}
.terms-admin-grid input,
.terms-admin-split textarea {
    width: 100%;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    background: #fff;
    color: #0f172a;
    font: 13px/1.5 inherit;
    padding: 9px 10px;
}
.terms-admin-split textarea {
    min-height: 92px;
    resize: vertical;
}
.terms-admin-status {
    min-height: 18px;
    margin: 4px 0 8px;
    font-size: 12px;
    font-weight: 800;
}
.terms-admin-status.ok { color: #166534; }
.terms-admin-status.error { color: #991b1b; }
.terms-status-chip {
    display: inline-flex;
    padding: 3px 9px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #334155;
    font-size: 11px;
    font-weight: 800;
}
.terms-status-chip.published {
    background: #dcfce7;
    color: #166534;
}
.terms-status-chip.draft {
    background: #fef3c7;
    color: #92400e;
}
.terms-status-chip.accepted {
    background: #dbeafe;
    color: #1d4ed8;
}
.terms-status-chip.declined {
    background: #fee2e2;
    color: #991b1b;
}
.terms-link-btn {
    border: 0;
    background: transparent;
    color: #1d4ed8;
    cursor: pointer;
    font-weight: 800;
    padding: 0;
}
.terms-history-toggle {
    white-space: nowrap;
}
.terms-history-detail-row td {
    background: #f8fafc;
    padding: 14px 16px;
}
.terms-history-snapshot {
    border: 1px solid #dbeafe;
    border-radius: 8px;
    background: #fff;
    padding: 14px;
}
.terms-history-snapshot-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: #64748b;
    font-size: 12px;
    margin-bottom: 12px;
}
.terms-history-snapshot-head strong {
    display: block;
    color: #0f172a;
    font-size: 13px;
}
.terms-history-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.terms-history-grid h4 {
    margin: 0 0 6px;
    color: #1d4ed8;
    font-size: 12px;
    text-transform: uppercase;
}
.terms-history-title,
.terms-history-checkbox {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    color: #334155;
    font-size: 12px;
    margin: 0 0 8px;
    padding: 8px 10px;
}
.terms-history-grid pre {
    max-height: 320px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #0f172a;
    color: #e2e8f0;
    font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    margin: 0 0 8px;
    padding: 10px;
}
@media (max-width: 900px) {
    .terms-history-grid {
        grid-template-columns: 1fr;
    }
    .terms-history-snapshot-head {
        flex-direction: column;
    }
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 36px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.25);
}

.auth-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
}

.auth-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 24px;
}
.auth-tab {
    background: none;
    border: none;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s;
    font-family: inherit;
}
.auth-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.auth-tab:hover:not(.active) { color: var(--text); }

.auth-form { display: flex; flex-direction: column; gap: 16px; }

.auth-field { display: flex; flex-direction: column; gap: 5px; }
.auth-field label { font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }
.auth-field input {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    background: var(--bg);
    color: var(--text);
    transition: border-color 0.15s;
}
.auth-field input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(29,92,200,0.12); }

.auth-error {
    font-size: 12px;
    color: #dc2626;
    min-height: 16px;
    padding: 0 2px;
}

.auth-success {
    font-size: 12px;
    color: #15803d;
    min-height: 16px;
    padding: 0 2px;
    line-height: 1.4;
}

.auth-success a {
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
}

.auth-submit {
    padding: 12px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
    margin-top: 4px;
}
.auth-submit:hover { opacity: 0.9; }
.auth-submit:active { transform: scale(0.98); }
.auth-submit:disabled { opacity: 0.6; cursor: not-allowed; }

.auth-footer {
    font-size: 11px;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 20px;
    margin-bottom: 0;
}
.auth-footer a { color: var(--primary); text-decoration: none; }

/* Change-password modal */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.48);
}
.modal.active {
    display: flex;
}
.modal-box {
    background: var(--surface);
    border-radius: 16px;
    width: 100%;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { margin: 0; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.modal-close {
    background: none; border: none; font-size: 16px;
    color: var(--text-secondary); cursor: pointer; padding: 4px;
}
.modal-close:hover { color: var(--text); }

/* ══════════════════════════════════════════════
   ADMIN USER USAGE TABLE
══════════════════════════════════════════════ */
.dash-user-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.dash-user-table th {
    text-align: left;
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
}
.dash-user-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.dash-user-table tr:hover td { background: var(--hover); }
.dash-user-table tr:last-child td { border-bottom: none; }

/* ══════════════════════════════════════════════
   ROLE SWITCHER (owner only)
══════════════════════════════════════════════ */
.role-switcher {
    position: relative;
}
.role-switcher-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #fef3c7, #fff7ed);
    border: 1px solid #fcd34d;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: #92400e;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
    white-space: nowrap;
}
.role-switcher-btn:hover { background: linear-gradient(135deg, #fde68a, #fed7aa); }
[data-theme="dark"] .role-switcher-btn {
    background: linear-gradient(135deg, #1c1307, #1f1b07);
    border-color: #78350f;
    color: #fbbf24;
}

.role-switcher-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    min-width: 180px;
    z-index: 500;
    overflow: hidden;
    display: none;
}
.role-switcher-menu.active { display: block; }

.rsm-title {
    padding: 10px 14px 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}
.rsm-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.1s;
    color: var(--text);
}
.rsm-item:hover { background: var(--hover); }
.rsm-item.active { font-weight: 600; background: var(--hover); }
.rsm-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.rsm-you { font-size: 11px; color: var(--text-secondary); margin-left: auto; }

/* Role preview banner */
.role-preview-banner {
    position: absolute;
    top: 54px;
    left: 0; right: 0;
    z-index: 4;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 20px;
    background: linear-gradient(90deg, #7c2d12, #b45309);
    border-bottom: 1px solid #92400e;
    font-size: 13px;
    color: #fff7ed;
    font-weight: 650;
}
/* Push tab content down when banner is visible */
.main-content.has-role-banner .tab-content {
    top: 92px; /* 54px top-bar + 38px banner */
}
[data-theme="dark"] .role-preview-banner {
    background: linear-gradient(90deg, #1c1307, #1f1b07);
    border-color: #78350f;
    color: #fbbf24;
}
.role-preview-banner i { font-size: 14px; }
.role-preview-banner button {
    margin-left: auto;
    background: none;
    border: 1px solid rgba(255,255,255,.55);
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 600;
    color: #fff7ed;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background 0.15s;
}
.role-preview-banner button:hover { background: rgba(255,255,255,0.14); }
[data-theme="dark"] .role-preview-banner button { color: #fbbf24; border-color: #78350f; }

/* ══════════════════════════════════════════════
   HAMBURGER BUTTON (hidden on desktop)
   ══════════════════════════════════════════════ */
.hamburger-btn {
    display: none;
    align-items: center; justify-content: center;
    background: none; border: none; cursor: pointer;
    font-size: 18px; color: var(--text); padding: 8px;
    border-radius: 8px;
    transition: background 0.15s;
}
.hamburger-btn:hover { background: var(--bg); }
.sidebar-backdrop { display: none; }

/* ══════════════════════════════════════════════
   MY ACCOUNT PAGE
   ══════════════════════════════════════════════ */
.profile-card {
    display: flex; align-items: center; gap: 20px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 24px;
    margin-bottom: 24px;
}
.profile-avatar-lg {
    width: 64px; height: 64px; border-radius: 50%;
    background: var(--primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; flex-shrink: 0;
}
.profile-info { flex: 1; }
.profile-info h3 { font-size: 18px; font-weight: 700; color: var(--text); margin: 0 0 4px; }
.profile-info p { font-size: 13px; color: var(--text-secondary); margin: 0 0 8px; }
.profile-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.profile-role-badge, .profile-plan-badge {
    font-size: 11px; font-weight: 600; padding: 2px 10px;
    border-radius: 20px; text-transform: capitalize;
}
.profile-role-badge { background: #eff6ff; color: #1a56db; }
.profile-role-badge.role-owner { background: #fef2f2; color: #dc2626; }
.profile-role-badge.role-admin { background: #eff6ff; color: #3b82f6; }
.profile-role-badge.role-enterprise_user { background: #f5f3ff; color: #7c3aed; }
.profile-plan-badge { background: #f0fdf4; color: #16a34a; }
.profile-plan-badge.plan-pro { background: #eff6ff; color: #3b82f6; }
.profile-plan-badge.plan-max { background: #dcfce7; color: #16a34a; }
.profile-plan-badge.plan-unlimited { background: #fef2f2; color: #dc2626; }
.profile-edit-btn {
    padding: 8px 16px; background: var(--primary); color: #fff;
    border: none; border-radius: 8px; font-size: 13px;
    font-weight: 600; cursor: pointer; font-family: inherit;
    display: flex; align-items: center; gap: 6px;
    transition: background 0.15s; flex-shrink: 0;
}
.profile-edit-btn:hover { background: var(--primary-dark); }
.profile-password-managed-note {
    max-width: 260px;
    padding: 8px 12px;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    background: #eff6ff;
    color: #1e3a8a;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.35;
}

/* My Team */
.my-team-section { margin-top: 8px; }
.my-team-header {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 14px; flex-wrap: wrap;
}
.my-team-header h3 { font-size: 16px; font-weight: 700; color: var(--text); margin: 0; }
.my-team-header h3 i { color: var(--primary); }
.my-team-quota {
    font-size: 12px; color: var(--text-secondary);
    background: var(--bg); padding: 4px 10px; border-radius: 6px;
}
.icon-btn-sm {
    background: none; border: none; cursor: pointer;
    padding: 4px 6px; border-radius: 4px; transition: background 0.15s;
}
.icon-btn-sm:hover { background: var(--bg); }

/* ═══ AI Memory ═══ */
.my-memory-section { background: var(--card-bg); border-radius: 12px; padding: 20px; border: 1px solid var(--border); }
.memory-category { margin-bottom: 12px; }
.memory-cat-label {
    font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--text-secondary);
    letter-spacing: 0.5px; margin-bottom: 6px; padding-left: 4px;
}
.memory-cat-label i { margin-right: 4px; }
.memory-item {
    display: flex; align-items: center; gap: 8px; padding: 8px 12px;
    background: var(--bg); border-radius: 8px; margin-bottom: 4px; border: 1px solid var(--border);
}
.memory-key { font-weight: 600; min-width: 100px; font-size: 13px; color: var(--text-primary); }
.memory-value { flex: 1; font-size: 13px; color: var(--text-secondary); }

/* ═══ Prompt Template Manager ═══ */
.prompt-manager { display: flex; flex-direction: column; gap: 12px; }
.prompt-topbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.prompt-mode-tabs { display: flex; gap: 4px; }
.prompt-mode-tab {
    padding: 6px 14px; border-radius: 6px; border: 1px solid var(--border);
    background: var(--bg); cursor: pointer; font-size: 13px; transition: all 0.15s;
}
.prompt-mode-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.prompt-mode-tab:hover:not(.active) { background: var(--hover); }
.prompt-topbar-actions { display: flex; gap: 6px; }

.prompt-split { display: flex; gap: 16px; min-height: 500px; }
.prompt-list {
    width: 280px; min-width: 240px; overflow-y: auto; max-height: 600px;
    border: 1px solid var(--border); border-radius: 10px; background: var(--bg); padding: 8px;
}
.prompt-editor {
    flex: 1; border: 1px solid var(--border); border-radius: 10px;
    background: var(--card-bg); padding: 16px; overflow-y: auto; max-height: 600px;
}
.prompt-editor-form {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
}
.prompt-editor-form > .pe-field {
    width: 100%;
    min-width: 0;
}
.prompt-editor-form .pe-field-prompt {
    flex: 1 1 auto;
}
.prompt-editor-form .pe-field-prompt textarea {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    min-height: 360px;
}
.prompt-editor-empty {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    height: 100%; color: var(--text-secondary); gap: 12px;
}

#acct-panel-ocr-prompts.active {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 92px);
    min-height: 720px;
}
#acct-panel-ocr-prompts .prompt-manager,
#acct-panel-ocr-prompts .prompt-split {
    flex: 1;
    min-height: 0;
}
#acct-panel-ocr-prompts .prompt-list,
#acct-panel-ocr-prompts .prompt-editor {
    max-height: none;
    min-height: 0;
}
#acct-panel-ocr-prompts .prompt-list {
    height: 100%;
}
#acct-panel-ocr-prompts .prompt-editor {
    display: flex;
    flex-direction: column;
}
#acct-panel-ocr-prompts #ocr-prompt-editor-form {
    flex: 1;
    min-height: 0;
    flex-direction: column;
}
#acct-panel-ocr-prompts .pe-field-prompt {
    flex: 1 1 0;
    min-height: 220px;
}
#acct-panel-ocr-prompts .pe-field-prompt textarea {
    flex: 1;
    min-height: 220px;
}

.prompt-group-label {
    font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--text-secondary);
    padding: 8px 8px 4px; letter-spacing: 0.5px;
}
.prompt-group-label i { margin-right: 4px; }

.prompt-card {
    padding: 10px 12px; border-radius: 8px; cursor: pointer; margin-bottom: 4px;
    border: 1px solid transparent; transition: all 0.15s;
}
.prompt-card:hover { background: var(--hover); }
.prompt-card-active { background: var(--primary-light, #eff6ff); border-color: var(--primary) !important; }
.prompt-card-inactive { opacity: 0.5; }
.prompt-card-header { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.prompt-card-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prompt-mode-badge {
    font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 4px; white-space: nowrap;
}
.prompt-card-desc { font-size: 11px; color: var(--text-secondary); margin-top: 4px; line-height: 1.3; }
.prompt-card-footer { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.prompt-status { font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 4px; }
.prompt-active { background: #dcfce7; color: #16a34a; }
.prompt-inactive { background: #fee2e2; color: #dc2626; }
.prompt-default-badge { font-size: 10px; background: #dbeafe; color: #1d4ed8; padding: 1px 6px; border-radius: 4px; }

/* Prompt Editor Form */
.pe-row { display: flex; gap: 12px; flex-wrap: wrap; }
.pe-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; flex: 1; min-width: 160px; }
.pe-field label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.pe-field input, .pe-field select {
    padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px;
    font-size: 13px; background: var(--bg);
}
.pe-field textarea {
    padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
    font-size: 12.5px; font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    background: var(--bg); resize: vertical; line-height: 1.5; min-height: 200px;
}
.pe-field textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 2px rgba(59,130,246,.15); }
.pe-placeholder-hints { font-size: 11px; color: var(--text-secondary); margin-bottom: 4px; }
.pe-chip {
    display: inline-block; background: #dbeafe; color: #1d4ed8; padding: 1px 6px;
    border-radius: 4px; font-family: monospace; font-size: 11px;
}
.pe-actions { display: flex; gap: 8px; margin-top: 8px; }

.ocr-feedback-coach {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    padding: 12px;
    margin: 4px 0 12px;
}
.ocr-feedback-head { display:flex; justify-content:space-between; gap:12px; align-items:flex-start; }
.ocr-feedback-head h4 { margin:0; font-size:14px; color:var(--text); }
.ocr-feedback-head p { margin:3px 0 0; font-size:12px; color:var(--text-secondary); }
.ocr-feedback-filters { display:flex; flex-wrap:wrap; gap:8px; align-items:end; margin-top:10px; }
.ocr-feedback-filters label { display:flex; flex-direction:column; gap:3px; font-size:11px; font-weight:600; color:var(--text-secondary); }
.ocr-feedback-filters input, .ocr-feedback-filters select {
    min-width:120px; padding:6px 8px; border:1px solid var(--border); border-radius:6px;
    background:var(--surface); color:var(--text); font-size:12px;
}
.ocr-feedback-filters input[type="number"] { min-width:76px; }
.ocr-feedback-result { margin-top:10px; font-size:12px; color:var(--text-secondary); }
.ocr-feedback-summary { display:grid; grid-template-columns:repeat(4,minmax(110px,1fr)); gap:8px; }
.ocr-feedback-metric { border:1px solid var(--border); border-radius:8px; background:var(--surface); padding:8px; }
.ocr-feedback-metric span { display:block; font-size:11px; color:var(--text-secondary); }
.ocr-feedback-metric b { display:block; margin-top:2px; font-size:18px; color:var(--text); }
.ocr-feedback-metric small { display:block; margin-top:2px; font-size:10px; color:var(--text-secondary); }
.ocr-feedback-note { margin-top:8px; border:1px solid #fed7aa; border-radius:8px; background:#fff7ed; color:#9a3412; padding:8px; }
.ocr-feedback-models { display:flex; flex-wrap:wrap; gap:6px; margin-top:8px; }
.ocr-feedback-models span { padding:3px 7px; border-radius:999px; background:#eef2ff; color:#3730a3; font-size:11px; }
.ocr-feedback-empty { padding:14px; text-align:center; border:1px dashed var(--border); border-radius:8px; margin-top:8px; }
.ocr-feedback-table-wrap { overflow:auto; margin-top:8px; border:1px solid var(--border); border-radius:8px; background:var(--surface); }
.ocr-feedback-table { width:100%; border-collapse:collapse; min-width:720px; }
.ocr-feedback-table th, .ocr-feedback-table td { padding:8px; border-bottom:1px solid var(--border); vertical-align:top; text-align:left; }
.ocr-feedback-table th { font-size:11px; color:var(--text-secondary); text-transform:uppercase; background:var(--bg); }
.ocr-feedback-table td { font-size:12px; color:var(--text); }
.ocr-feedback-table code { font-size:10px; color:var(--text-secondary); }
.ocr-feedback-example { display:flex; flex-direction:column; gap:2px; margin-bottom:4px; }
.ocr-feedback-draft { margin-top:10px; border:1px solid #bfdbfe; border-radius:8px; background:#eff6ff; padding:10px; color:#1e3a8a; }
.ocr-feedback-draft-head { display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:8px; }
.ocr-feedback-draft-head > div { display:flex; flex-wrap:wrap; gap:6px; }
.ocr-feedback-draft ul { margin:8px 0; padding-left:18px; }
.ocr-feedback-draft-grid { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.ocr-feedback-draft pre {
    margin:0; white-space:pre-wrap; max-height:220px; overflow:auto; padding:8px;
    border:1px solid #bfdbfe; border-radius:6px; background:#fff; color:#172554; font-size:11px;
}

/* ═══════════════════════════════════════════════════
   OCR DOCUMENT ANALYSIS
   ═══════════════════════════════════════════════════ */

/* Upload card */
.ocr-upload-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    margin-bottom: 20px;
}

/* Drop zone */
.ocr-drop-zone {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 40px 24px;
    text-align: center;
    cursor: pointer;
    transition: all .2s;
    background: var(--bg);
}
.ocr-drop-zone:hover, .ocr-drop-zone.drag-over {
    border-color: var(--primary);
    background: rgba(29,92,200,.05);
}
/* Compact drop zone when files are already added */
.ocr-drop-zone.compact { padding: 10px 16px; display:flex; align-items:center; gap:10px; text-align:left; }
.ocr-drop-zone.compact .ocr-drop-icon { font-size:18px; margin:0; display:inline; }
.ocr-drop-zone.compact .ocr-drop-title { font-size:13px; font-weight:500; margin:0; }
.ocr-drop-zone.compact .ocr-drop-sub,
.ocr-drop-zone.compact .ocr-drop-hint { display:none; }
.ocr-drop-zone.compact .ocr-browse-btn { margin:0; padding:5px 12px; font-size:12px; }
.ocr-drop-icon { font-size: 40px; color: var(--primary); margin-bottom: 12px; display: block; }
.ocr-drop-title { font-size: 16px; font-weight: 600; color: var(--text); margin: 0 0 6px; }
.ocr-drop-sub { font-size: 13px; color: var(--text-secondary); margin: 0 0 12px; }
.ocr-drop-hint { font-size: 12px; color: var(--text-secondary); margin: 12px 0 0; }

.ocr-browse-btn {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--primary); color: #fff;
    padding: 9px 20px; border-radius: 8px;
    font-size: 13px; font-weight: 600; cursor: pointer;
    transition: background .15s;
}
.ocr-browse-btn:hover { background: var(--primary-dark); }

/* Doc type buttons */
.ocr-type-row { margin-top: 20px; }
.ocr-type-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 10px; }
.ocr-engine-fixed-mode #ocr-modal-engine-select { display: none; }
.ocr-engine-fixed-badge {
    align-items: center;
    gap: 7px;
    width: 100%;
    border: 1px solid #dbe5f2;
    border-radius: 8px;
    background: #f8fafc;
    color: #334155;
    font-size: 13px;
    font-weight: 700;
    padding: 9px 11px;
}
.ocr-type-grid { display: flex; gap: 10px; flex-wrap: wrap; }
.ocr-type-btn {
    display: flex; align-items: center; gap: 7px;
    padding: 9px 16px; border-radius: 8px;
    border: 2px solid var(--border);
    background: var(--bg); color: var(--text);
    font-size: 13px; font-weight: 500; cursor: pointer;
    transition: all .15s;
}
.ocr-type-btn:hover { border-color: var(--primary); color: var(--primary); }
.ocr-type-btn.active {
    border-color: var(--primary); background: rgba(29,92,200,.09);
    color: var(--primary); font-weight: 700;
}

/* Selected file row */
.ocr-selected-file {
    display: flex; align-items: center; gap: 10px;
    background: #fff8f0; border: 1px solid #fcd9a0;
    border-radius: 8px; padding: 10px 14px; margin-top: 16px;
    font-size: 13px; font-weight: 500;
}
.ocr-clear-btn {
    margin-left: auto; background: none; border: none;
    color: var(--text-secondary); cursor: pointer; font-size: 14px;
}
.ocr-clear-btn:hover { color: #c00; }

/* Submit button */
.ocr-toolbar {
    display:flex;
    align-items:center;
    gap:12px;
    margin-bottom:16px;
    flex-wrap:wrap;
}
.ocr-search-box {
    position:relative;
    flex:1 1 360px;
    min-width:260px;
    max-width:560px;
}
.ocr-type-filter {
    display:flex;
    align-items:center;
    gap:8px;
    min-height:36px;
    padding:0 10px;
    border:1px solid #dbe3ef;
    border-radius:8px;
    background:#fff;
    color:#475569;
    font-size:12px;
    font-weight:700;
}
.ocr-type-filter > span {
    display:inline-flex;
    align-items:center;
    gap:6px;
    white-space:nowrap;
}
.ocr-type-filter i { color:var(--primary); font-size:12px; }
.ocr-type-filter select {
    min-width:210px;
    max-width:280px;
    border:0;
    outline:0;
    background:transparent;
    color:#0f172a;
    font:inherit;
    font-weight:600;
    cursor:pointer;
    padding:8px 4px;
}
[data-theme="dark"] .ocr-type-filter {
    background:var(--bg);
    border-color:var(--border);
    color:var(--text-secondary);
}
[data-theme="dark"] .ocr-type-filter select { color:var(--text); }
.ocr-submit-btn {
    display: flex; align-items: center; gap: 8px;
    margin-top: 18px; padding: 11px 28px;
    background: var(--primary); color: #fff;
    border: none; border-radius: 9px;
    font-size: 14px; font-weight: 700; cursor: pointer;
    transition: background .15s;
}
.ocr-submit-btn:disabled { background: #c5cde8; cursor: not-allowed; }
.ocr-submit-btn:not(:disabled):hover { background: var(--primary-dark); }

/* Processing spinner */
.ocr-processing {
    text-align: center; padding: 48px 24px;
    background: var(--surface); border-radius: var(--radius);
    border: 1px solid var(--border); margin-bottom: 20px;
}
.ocr-spinner {
    width: 44px; height: 44px; margin: 0 auto 16px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#ocr-processing-msg { font-size: 14px; color: var(--text-secondary); }

/* Result bar */
.ocr-result-bar {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 12px 16px;
    margin-bottom: 16px;
}
.ocr-result-badge {
    background: #dbeafe; color: #1d4ed8;
    padding: 3px 10px; border-radius: 20px;
    font-size: 12px; font-weight: 700;
}
.ocr-result-filename { font-size: 13px; font-weight: 500; color: var(--text); flex: 1; }
.ocr-result-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.ocr-action-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 14px; border-radius: 7px;
    border: 1px solid var(--border); background: var(--bg);
    font-size: 12px; font-weight: 600; cursor: pointer; color: var(--text);
    transition: all .15s;
}
.ocr-action-btn:hover { border-color: var(--primary); color: var(--primary); }
.ocr-action-btn--ai { background: #1D5CC8; color: #fff; border-color: #1D5CC8; }
.ocr-action-btn--ai:hover { background: #1748A8; color: #fff; border-color: #1748A8; }
.ocr-action-btn--chat { background: #059669; color: #fff; border-color: #059669; }
.ocr-action-btn--chat:hover { background: #047857; color: #fff; border-color: #047857; }

/* AI Analysis box */
.ocr-analysis-box {
    background: #f0f7ff; border: 1px solid #bdd7ee;
    border-radius: var(--radius); margin-bottom: 20px; overflow: hidden;
}
.ocr-analysis-header {
    background: #1f3864; color: #fff;
    padding: 10px 16px; font-size: 13px; font-weight: 700;
    display: flex; align-items: center; gap: 8px;
}
.ocr-analysis-body {
    padding: 16px 20px; font-size: 13.5px; line-height: 1.7;
    white-space: pre-wrap;
}

/* Extracted fields grid */
.ocr-fields-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}
.ocr-field-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
}
.ocr-field-card-header {
    background: var(--bg); padding: 9px 14px;
    font-size: 11px; font-weight: 700; color: var(--text-secondary);
    letter-spacing: .5px; text-transform: uppercase;
    border-bottom: 1px solid var(--border);
}
.ocr-field-table { width: 100%; border-collapse: collapse; }
.ocr-field-table tr:not(:last-child) td { border-bottom: 1px solid var(--border); }
.ocr-field-table td { padding: 8px 12px; font-size: 12.5px; vertical-align: top; }
.ocr-field-table td:first-child {
    color: var(--text-secondary); font-weight: 600;
    width: 42%; background: rgba(0,0,0,.01);
}
.ocr-field-table td:last-child { color: var(--text); word-break: break-word; }

/* ══════════════════════════════════════════════
   MASTER DATA WORKBENCH
══════════════════════════════════════════════ */
.md-page-header,
.md-detail-header,
.md-section-head,
.md-action-row {
    display:flex; align-items:center; gap:12px; flex-wrap:wrap;
}
.md-page-header { justify-content:space-between; }
.md-header-actions { display:flex; align-items:center; gap:8px; flex-wrap:wrap; justify-content:flex-end; }
.md-primary-action,
.md-compact-primary { margin:0; border-radius:8px; min-height:38px; }
.md-compact-primary { padding:8px 16px; font-size:13px; }
.md-summary-grid {
    display:grid; grid-template-columns:repeat(5,minmax(150px,1fr)); gap:10px; margin:0 0 14px;
}
.md-summary-card {
    background:var(--surface); border:1px solid var(--border); border-radius:8px;
    padding:13px 14px; box-shadow:var(--shadow); min-height:92px;
}
.md-summary-card span {
    display:block; color:var(--text-secondary); font-size:11px; font-weight:800;
    text-transform:uppercase; letter-spacing:.04em;
}
.md-summary-card strong {
    display:block; margin-top:8px; font-size:24px; line-height:1.1; color:var(--text);
    font-variant-numeric:tabular-nums;
}
.md-summary-card small { display:block; color:var(--text-secondary); margin-top:6px; font-size:11px; line-height:1.35; }
.md-toolbar {
    display:flex; align-items:center; gap:8px; flex-wrap:wrap;
    background:var(--surface); border:1px solid var(--border); border-radius:8px;
    padding:10px; margin-bottom:12px; box-shadow:var(--shadow);
}
.policy-guidance { margin:0 0 12px; }
.policy-guidance-card {
    display:flex;
    align-items:flex-start;
    gap:10px;
    border:1px solid var(--border);
    border-left:4px solid #64748b;
    background:var(--surface);
    border-radius:8px;
    padding:10px 12px;
    box-shadow:var(--shadow);
    color:var(--text);
}
.policy-guidance-card > span {
    width:30px;
    height:30px;
    border-radius:8px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    background:#f1f5f9;
    color:#475569;
    flex-shrink:0;
}
.policy-guidance-card b { display:block; font-size:13px; margin:0 0 2px; }
.policy-guidance-card p { margin:0; color:var(--text-secondary); font-size:12px; line-height:1.4; }
.policy-guidance-card.success { border-left-color:#16a34a; }
.policy-guidance-card.success > span { background:#dcfce7; color:#166534; }
.policy-guidance-card.warning { border-left-color:#f59e0b; }
.policy-guidance-card.warning > span { background:#fef3c7; color:#92400e; }
.policy-guidance-card.info { border-left-color:#2563eb; }
.policy-guidance-card.info > span { background:#dbeafe; color:#1d4ed8; }
.md-toolbar select,
.md-small-search {
    border:1px solid var(--border); background:var(--surface); color:var(--text);
    border-radius:8px; padding:8px 10px; min-height:36px; font:inherit; font-size:13px;
}
.md-search {
    flex:1 1 280px; display:flex; align-items:center; gap:8px;
    border:1px solid var(--border); border-radius:8px; padding:0 10px; min-height:38px;
    background:var(--surface);
}
.md-search i { color:var(--text-secondary); font-size:12px; }
.md-search input {
    border:none; outline:none; background:transparent; color:var(--text);
    width:100%; font:inherit; font-size:13px; min-width:0;
}
.md-list-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(320px,1fr)); gap:12px; }
.md-list-grid.md-table-host {
    display:block;
    width:100%;
    min-width:0;
}
.md-list-table-wrap {
    width:100%;
    overflow:auto;
    border:1px solid var(--border);
    border-radius:8px;
    background:var(--surface);
    box-shadow:var(--shadow);
}
.md-list-table {
    width:100%;
    min-width:1540px;
    border-collapse:separate;
    border-spacing:0;
    font-size:12px;
}
.md-list-table th {
    position:sticky;
    top:0;
    z-index:2;
    background:#f8fafc;
    border-bottom:1px solid var(--border);
    color:#475569;
    font-size:11px;
    font-weight:800;
    letter-spacing:.02em;
    line-height:1.25;
    padding:10px;
    text-align:left;
    text-transform:uppercase;
    white-space:nowrap;
}
.md-list-table td {
    border-bottom:1px solid #eef2f7;
    color:var(--text);
    padding:10px;
    vertical-align:top;
}
.md-list-table tr:hover td { background:#fbfdff; }
.md-list-table .md-sticky-col {
    position:sticky;
    left:0;
    z-index:3;
    min-width:240px;
    max-width:280px;
    background:var(--surface);
    box-shadow:1px 0 0 var(--border);
}
.md-list-table th.md-sticky-col {
    z-index:4;
    background:#f8fafc;
}
.md-name-btn {
    display:block;
    width:100%;
    border:0;
    background:transparent;
    color:var(--text);
    font:inherit;
    font-size:13px;
    font-weight:800;
    line-height:1.35;
    padding:0;
    text-align:left;
    cursor:pointer;
    overflow-wrap:anywhere;
}
.md-name-btn:hover { color:var(--primary); }
.md-id-line {
    margin-top:3px;
    color:var(--text-secondary);
    font-size:10.5px;
    font-family:ui-monospace, SFMono-Regular, Menlo, monospace;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}
.md-purpose-cell {
    min-width:250px;
    max-width:340px;
    color:#334155;
    line-height:1.45;
}
.md-category-pill {
    display:inline-flex;
    align-items:center;
    border-radius:999px;
    padding:3px 8px;
    margin:0 4px 5px 0;
    background:#e0f2fe;
    color:#075985;
    font-size:11px;
    font-weight:800;
    white-space:nowrap;
}
.md-category-pill.parties { background:#fae8ff; color:#86198f; }
.md-category-pill.ports { background:#dbeafe; color:#1e40af; }
.md-category-pill.commercial_terms { background:#dcfce7; color:#166534; }
.md-category-pill.customs { background:#e0f2fe; color:#075985; }
.md-category-pill.banking { background:#eef2ff; color:#3730a3; }
.md-category-pill.fta { background:#fef3c7; color:#92400e; }
.md-category-pill.products { background:#ede9fe; color:#5b21b6; }
.md-category-pill.trade_terms { background:#dcfce7; color:#166534; }
.md-category-pill.trade_finance,
.md-category-pill.finance { background:#ecfeff; color:#155e75; }
.md-category-pill.logistics,
.md-category-pill.carrier_modes,
.md-category-pill.equipment { background:#dbeafe; color:#1e40af; }
.md-category-pill.origin { background:#fef9c3; color:#854d0e; }
.md-category-pill.documents { background:#f1f5f9; color:#475569; }
.md-category-pill.compliance,
.md-category-pill.permits,
.md-category-pill.tariff { background:#fff7ed; color:#9a3412; }
.md-category-pill.field_library { background:#e0e7ff; color:#3730a3; }
.md-category-pill.logistics_costs,
.md-category-pill.freight_costs { background:#ecfeff; color:#155e75; }
.md-category-pill.units,
.md-category-pill.payment_terms { background:#f0fdf4; color:#166534; }
.md-category-pill.company_identifiers,
.md-category-pill.policy,
.md-category-pill.external_data { background:#fff7ed; color:#9a3412; }
.md-level-chip {
    display:inline-flex;
    align-items:center;
    border-radius:999px;
    padding:3px 8px;
    border:1px solid #e2e8f0;
    background:#f8fafc;
    color:#475569;
    font-size:11px;
    font-weight:800;
    white-space:nowrap;
}
.md-level-chip.system { background:#eff6ff; border-color:#bfdbfe; color:#1d4ed8; }
.md-level-chip.organization { background:#ecfdf5; border-color:#bbf7d0; color:#166534; }
.md-level-chip.private { background:#f5f3ff; border-color:#ddd6fe; color:#5b21b6; }
.md-level-chip.external { background:#fff7ed; border-color:#fed7aa; color:#9a3412; }
.md-number-cell {
    min-width:92px;
    text-align:right;
}
.md-number-cell span {
    display:block;
    color:var(--text-secondary);
    font-size:10.5px;
    font-weight:700;
}
.md-count-link {
    border:0;
    background:transparent;
    color:var(--primary);
    cursor:pointer;
    font:inherit;
    font-size:15px;
    font-weight:800;
    padding:0;
}
.md-source-cell {
    min-width:190px;
    max-width:250px;
}
.md-source-cell b,
.md-source-cell span {
    display:block;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}
.md-source-cell span {
    margin-top:3px;
    color:var(--text-secondary);
    font-size:11px;
}
.md-version-cell,
.md-date-cell,
.md-edited-cell {
    min-width:110px;
    color:#334155;
    font-size:12px;
}
.md-version-cell b {
    color:var(--primary);
}
.md-edited-cell {
    max-width:150px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}
.md-date-due {
    color:#b45309;
    font-weight:800;
}
.md-usage-cell {
    min-width:220px;
    max-width:290px;
}
.md-usage-cell b,
.md-usage-cell span {
    display:block;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}
.md-usage-cell b {
    color:#334155;
    font-size:11px;
}
.md-usage-cell span {
    margin-top:3px;
    color:var(--text-secondary);
    font-size:11px;
}
.md-pending-pill {
    display:inline-flex;
    align-items:center;
    border-radius:999px;
    padding:3px 8px;
    background:#fff7ed;
    border:1px solid #fed7aa;
    color:#9a3412;
    font-size:11px;
    font-weight:800;
    white-space:nowrap;
}
.md-actions-cell {
    min-width:210px;
}
.md-actions-cell .md-action-row {
    gap:6px;
}
.md-field-key-chip {
    display:inline-flex;
    align-items:center;
    max-width:180px;
    padding:2px 7px;
    border:1px solid #c7d2fe;
    border-radius:999px;
    background:#eef2ff;
    color:#3730a3;
    font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size:11px;
    font-weight:800;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}
.md-list-card {
    background:var(--surface); border:1px solid var(--border); border-radius:8px;
    padding:15px; box-shadow:var(--shadow); display:flex; flex-direction:column; gap:12px;
    min-height:220px;
}
.md-list-card:hover { border-color:#b6c8e8; box-shadow:0 4px 14px rgba(15,23,42,0.06); }
.md-card-top { display:flex; justify-content:space-between; gap:10px; align-items:flex-start; }
.md-card-title { min-width:0; }
.md-card-title h3 { font-size:15px; line-height:1.3; margin:0; overflow-wrap:anywhere; }
.md-card-title p { color:var(--text-secondary); font-size:12px; line-height:1.45; margin-top:5px; }
.md-card-meta { display:flex; flex-wrap:wrap; gap:6px; }
.md-chip,
.md-status-pill {
    display:inline-flex; align-items:center; gap:5px; border-radius:999px; padding:3px 8px;
    font-size:11px; font-weight:800; line-height:1.2; white-space:nowrap;
}
.md-chip { background:#f1f5f9; color:#475569; border:1px solid #e2e8f0; }
.md-status-pill.approved { background:#dcfce7; color:#166534; border:1px solid #bbf7d0; }
.md-status-pill.pending { background:#fef3c7; color:#92400e; border:1px solid #fde68a; }
.md-status-pill.draft { background:#e0f2fe; color:#075985; border:1px solid #bae6fd; }
.md-status-pill.rejected { background:#fee2e2; color:#991b1b; border:1px solid #fecaca; }
.md-status-pill.retired { background:#f1f5f9; color:#475569; border:1px solid #cbd5e1; }
.md-status-pill.system { background:#ede9fe; color:#5b21b6; border:1px solid #ddd6fe; }
.md-card-facts {
    display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; margin-top:auto;
}
.md-fact {
    border:1px solid var(--border); border-radius:8px; padding:8px 10px; min-width:0;
    background:#fbfdff;
}
.md-fact span { display:block; color:var(--text-secondary); font-size:10px; font-weight:800; text-transform:uppercase; letter-spacing:.04em; }
.md-fact b { display:block; margin-top:3px; color:var(--text); font-size:12px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.md-card-footer { display:flex; align-items:center; justify-content:space-between; gap:8px; flex-wrap:wrap; border-top:1px solid var(--border); padding-top:10px; }
.md-link-note { color:var(--text-secondary); font-size:11px; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; flex:1; }
.md-secondary-btn,
.md-danger-btn,
.md-quiet-btn {
    display:inline-flex; align-items:center; justify-content:center; gap:6px;
    border:1px solid var(--border); border-radius:8px; background:var(--surface); color:var(--text);
    min-height:34px; padding:7px 12px; font:inherit; font-size:12px; font-weight:700; cursor:pointer;
}
.md-secondary-btn:hover,
.md-quiet-btn:hover { border-color:var(--primary); color:var(--primary); }
.md-danger-btn { color:#b91c1c; border-color:#fecaca; background:#fff7f7; }
.md-danger-btn:hover { background:#fee2e2; }
.md-empty-state {
    border:1px dashed #cbd5e1; border-radius:8px; background:var(--surface);
    padding:28px; text-align:center; color:var(--text-secondary); box-shadow:var(--shadow);
}
.md-empty-state i { display:block; font-size:24px; color:#94a3b8; margin-bottom:8px; }
.md-empty-state b { display:block; color:var(--text); margin-bottom:4px; }
.md-empty-state span { display:block; font-size:13px; line-height:1.4; }
.md-detail-header {
    justify-content:space-between; border-bottom:1px solid var(--border); padding-bottom:14px; margin-bottom:14px;
}
.md-detail-title { flex:1 1 320px; min-width:0; }
.md-kicker { color:var(--text-secondary); font-size:10px; font-weight:800; text-transform:uppercase; letter-spacing:.08em; }
.md-detail-title h3 { margin:2px 0 4px; font-size:20px; line-height:1.25; overflow-wrap:anywhere; }
#md-entries-meta { color:var(--text-secondary); font-size:12px; line-height:1.45; }
.md-detail-layout { display:grid; grid-template-columns:minmax(0,1fr) 330px; gap:14px; align-items:start; }
.md-detail-main,
.md-side-panel {
    background:var(--surface); border:1px solid var(--border); border-radius:8px; box-shadow:var(--shadow);
}
.md-detail-main { padding:14px; min-width:0; }
.md-section-head { justify-content:space-between; margin-bottom:12px; }
.md-section-head h4,
.md-side-panel h4 { margin:0; font-size:14px; color:var(--text); }
.md-section-head p { margin:4px 0 0; color:var(--text-secondary); font-size:12px; }
.md-small-search { width:180px; }
.md-system-impact-banner {
    align-items:center;
    gap:8px;
    margin:0 0 12px;
    padding:10px 12px;
    border:1px solid #bfdbfe;
    border-radius:8px;
    background:#eff6ff;
    color:#1e40af;
    font-size:12px;
    font-weight:800;
}
.md-detail-side { display:flex; flex-direction:column; gap:12px; min-width:0; }
.md-side-panel { padding:14px; }
.md-field-list { display:grid; gap:8px; margin-top:10px; }
.md-field-row { display:grid; grid-template-columns:110px minmax(0,1fr); gap:10px; font-size:12px; align-items:start; }
.md-field-row span { color:var(--text-secondary); font-weight:700; }
.md-field-row b,
.md-field-row a { color:var(--text); overflow-wrap:anywhere; min-width:0; }
.md-usage-item,
.md-history-item {
    border-top:1px solid var(--border); padding-top:9px; margin-top:9px; font-size:12px; line-height:1.45;
}
.md-usage-item:first-child,
.md-history-item:first-child { border-top:none; padding-top:0; margin-top:0; }
.md-history-item b { display:block; color:var(--text); text-transform:capitalize; }
.md-history-item small { display:block; color:var(--text-secondary); overflow-wrap:anywhere; }
.md-table-wrap { border:1px solid var(--border); border-radius:8px; overflow:auto; }
.md-entry-table { min-width:720px; }
.md-entry-table td { vertical-align:top; }
.md-alias-chip {
    display:inline-block; background:#f1f5f9; border:1px solid #e2e8f0; color:#475569;
    padding:2px 7px; border-radius:999px; margin:0 4px 4px 0; font-size:11px;
}
.md-alias-list {
    display:flex;
    flex-wrap:wrap;
    gap:4px;
}
.md-muted { color:var(--text-secondary); }
.md-modal-shell {
    position:fixed; inset:0; background:rgba(15,23,42,0.48); z-index:1000;
    align-items:center; justify-content:center; padding:24px;
}
.md-modal {
    width:min(760px,94vw); max-height:90vh; overflow-y:auto; background:var(--surface);
    color:var(--text); border-radius:8px; padding:22px; box-shadow:0 18px 50px rgba(15,23,42,0.22);
}
.md-small-modal { width:min(520px,94vw); }
.md-modal h3 { margin:0 0 14px; font-size:18px; }
.md-modal-help { color:var(--text-secondary); font-size:12px; line-height:1.5; margin:0 0 14px; }
.md-template-modal { width:min(980px,94vw); }
.md-template-grid {
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(250px,1fr));
    gap:10px;
}
.md-template-card {
    display:flex;
    flex-direction:column;
    gap:8px;
    min-height:184px;
    border:1px solid var(--border);
    border-radius:8px;
    background:var(--surface);
    color:var(--text);
    padding:13px;
    text-align:left;
    cursor:pointer;
}
.md-template-card:hover {
    border-color:#bfdbfe;
    box-shadow:0 8px 24px rgba(15,23,42,.08);
}
.md-template-top {
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:8px;
}
.md-template-top b { font-size:14px; line-height:1.3; }
.md-template-desc {
    color:var(--text-secondary);
    font-size:12px;
    line-height:1.45;
}
.md-template-meta {
    display:flex;
    align-items:center;
    gap:6px;
    flex-wrap:wrap;
    margin-top:auto;
}
.md-template-meta small { color:var(--text-secondary); font-size:11px; }
.md-template-fields {
    display:flex;
    flex-wrap:wrap;
    gap:4px;
}
.md-template-fields em {
    border-radius:999px;
    background:#f8fafc;
    border:1px solid #e2e8f0;
    color:#475569;
    padding:2px 7px;
    font-size:11px;
    font-style:normal;
}
.md-form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.md-form-wide { grid-column:1 / -1; }
.md-form-grid label,
.md-form-block { display:flex; flex-direction:column; gap:5px; color:var(--text-secondary); font-size:12px; font-weight:700; }
.md-form-grid input,
.md-form-grid select,
.md-form-grid textarea,
.md-form-block textarea,
.md-bulk-text {
    width:100%; border:1px solid var(--border); border-radius:8px; background:var(--surface); color:var(--text);
    padding:9px 10px; font:inherit; font-size:13px; outline:none;
}
.md-form-grid textarea,
.md-form-block textarea,
.md-bulk-text { resize:vertical; line-height:1.45; }
.md-form-grid input:focus,
.md-form-grid select:focus,
.md-form-grid textarea:focus,
.md-form-block textarea:focus,
.md-bulk-text:focus,
.md-search:focus-within,
.md-toolbar select:focus,
.md-small-search:focus {
    border-color:var(--primary); box-shadow:0 0 0 3px rgba(29,92,200,0.10);
}
.md-modal-actions { display:flex; justify-content:flex-end; gap:10px; margin-top:18px; }
.md-bulk-note { margin-top:12px; }

[data-theme="dark"] .md-fact { background:#0f172a; }
[data-theme="dark"] .md-list-table th,
[data-theme="dark"] .md-list-table th.md-sticky-col {
    background:#111827;
}
[data-theme="dark"] .md-list-table .md-sticky-col {
    background:var(--surface);
}
[data-theme="dark"] .md-list-table tr:hover td {
    background:#0f172a;
}
[data-theme="dark"] .md-chip,
[data-theme="dark"] .md-alias-chip { background:#1e293b; border-color:#334155; color:#cbd5e1; }

/* ═══════════════════════════════════════════════════
   GOOGLE OAUTH BUTTON
   ═══════════════════════════════════════════════════ */
.auth-google-btn {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    width: 100%; padding: 12px 16px; margin-bottom: 16px;
    background: #fff; color: #3c4043;
    border: 1px solid #dadce0; border-radius: 8px;
    font-size: 14px; font-weight: 500; cursor: pointer;
    transition: all .15s;
    font-family: 'Inter', -apple-system, sans-serif;
}
.auth-google-btn:hover { background: #f7f8f8; border-color: #c6c9cd; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.auth-google-btn svg { flex-shrink: 0; }

.auth-divider {
    display: flex; align-items: center; gap: 12px;
    margin: 16px 0 14px; color: #94a3b8; font-size: 12px;
}
.auth-divider::before, .auth-divider::after {
    content: ''; flex: 1; height: 1px; background: #e2e8f0;
}

/* ══════════════════════════════════════════════
   MOBILE APP HARDENING
   Keeps every module usable on iPhone-size screens.
══════════════════════════════════════════════ */
@media(max-width:768px) {
    html, body { width:100%; max-width:100%; }
    body { overscroll-behavior-y:none; }
    .main-content { min-width:0; }
    .tab-content { overflow:hidden; }
    .page-container { width:100%; max-width:100vw; }
    .page-header h2 { font-size:18px; line-height:1.3; overflow-wrap:anywhere; }
    .page-header p { line-height:1.45; }

    button, input, select, textarea { max-width:100%; }
    .ocr-toolbar { align-items:stretch; }
    .ocr-search-box,
    .ocr-type-filter,
    .ocr-type-filter select {
        width:100%;
        max-width:none;
        min-width:0;
    }
    .ocr-type-filter { justify-content:space-between; }
    .ocr-submit-btn { justify-content:center; text-align:center; line-height:1.25; }

    .top-bar-actions { min-width:0; gap:4px; }
    .top-bar-actions > * { flex-shrink:0; }
    .role-switcher-btn #role-switcher-label,
    .account-dropdown-btn .fa-chevron-down { display:none; }
    .lang-dropdown-menu,
    .account-dropdown-menu,
    .role-switcher-menu {
        max-width:calc(100vw - 24px);
    }

    .search-bar { width:100%; max-width:none; }
    .doc-list-bar { align-items:stretch; }
    .doc-list-bar h3 { min-width:0; overflow-wrap:anywhere; }
    .doc-list-bar input { width:100%; flex:1 1 220px; }
    .category-grid,
    .agr-grid,
    .ocr-fields-grid,
    .usage-grid,
    .usage-current-grid,
    .settings-grid {
        grid-template-columns:1fr !important;
    }
    .setting-card.wide { grid-column:auto; }
    .md-summary-grid,
    .md-list-grid,
    .md-detail-layout,
    .md-card-facts,
    .md-form-grid {
        grid-template-columns:1fr !important;
    }
    .md-list-table {
        min-width:1120px;
    }
    .md-list-table .md-sticky-col {
        min-width:190px;
        max-width:220px;
    }
    .md-page-header,
    .md-detail-header,
    .md-section-head,
    .md-toolbar,
    .md-action-row {
        align-items:stretch;
    }
    .md-action-row,
    .md-primary-action,
    .md-compact-primary,
    .md-secondary-btn,
    .md-danger-btn,
    .md-quiet-btn,
    .md-small-search {
        width:100%;
    }
    .md-detail-side { order:2; }
    .md-card-footer { align-items:stretch; }
    .md-link-note { white-space:normal; }
    .md-form-wide { grid-column:auto; }

    .workflow-rail {
        overflow-x:visible !important;
        flex-wrap:wrap !important;
    }
    .workflow-rail b,
    .workflow-rail span,
    .workflow-rail i {
        flex:0 1 auto;
        white-space:normal;
    }

    .acct-table-wrap,
    .sub-compare-wrap,
    .widget-code {
        max-width:100%;
        overflow-x:auto;
        -webkit-overflow-scrolling:touch;
    }
    .acct-table { min-width:680px; }
    #ocr-files-table { min-width:1760px; }
    #shipments-table-wrap .acct-table { min-width:1320px; }

    #lib-header > div:first-child,
    #syslib-header > div:first-child {
        flex-wrap:wrap;
        gap:8px;
    }
    .lib-storage-head {
        flex-direction:column;
        align-items:stretch;
    }
    .lib-storage-info {
        flex-wrap:wrap;
    }
    .lib-storage-target span {
        white-space:normal;
        overflow-wrap:anywhere;
    }
    .lib-storage-upload-btn {
        width:100%;
        justify-content:center;
    }
    .user-doc-card {
        width:100%;
        min-width:0;
        align-items:flex-start;
        padding:12px;
    }
    .user-doc-info { flex:1 1 0; min-width:0; }
    .user-doc-filename,
    .user-doc-title {
        white-space:normal;
        overflow-wrap:anywhere;
    }
    .user-doc-meta {
        flex-wrap:wrap;
        gap:4px 8px;
        min-width:0;
    }
    .user-doc-meta span {
        max-width:100%;
        overflow-wrap:anywhere;
    }
    .user-doc-actions {
        margin-left:auto;
        align-self:flex-start;
    }
    .doc-card {
        flex-wrap:wrap;
    }
    .doc-card-actions {
        width:100%;
        max-width:none;
        align-items:flex-start;
        margin-left:56px;
    }
    .typhoon-action-btn span {
        white-space:normal;
    }

    .dashboard-grid { width:100%; min-width:0; }
    .dash-card {
        min-width:0;
        width:100%;
        padding:14px;
        overflow:hidden;
    }
    .dash-card div[style*="overflow-x:auto"],
    .dash-card .mobile-scroll-x {
        max-width:100%;
        overflow-x:auto;
        -webkit-overflow-scrolling:touch;
    }
    .dash-user-table { min-width:680px; }
    .chart-container { min-width:0; gap:8px; }
    .bar-item {
        display:grid;
        grid-template-columns:minmax(0,110px) minmax(0,1fr);
        align-items:center;
        gap:8px;
        width:100%;
        min-width:0;
    }
    .bar-label {
        width:auto;
        text-align:left;
        white-space:normal;
        overflow-wrap:anywhere;
        line-height:1.25;
        font-size:11.5px;
    }
    .bar-track { width:100%; min-width:0; }
    .bar-fill {
        max-width:100%;
        min-width:24px;
        overflow:hidden;
        padding-left:5px;
    }

    .settings-sidebar {
        max-width:100vw;
        width:100%;
        min-width:0;
        scrollbar-width:thin;
    }
    .settings-group {
        flex:0 0 auto;
        min-width:0;
    }
    .settings-nav-item {
        width:auto;
        min-width:max-content;
        flex:0 0 auto;
    }
    .settings-content { width:100%; min-width:0; }
    .rs-main-header { flex-wrap:wrap; gap:8px; }
    .rm-perms-grid { grid-template-columns:1fr; }
    .um-actions { flex-wrap:wrap; }
    .um-actions > * { flex:1 1 120px; }
    .prompt-split { flex-direction:column; min-height:auto; }
    .prompt-list { width:100%; min-width:0; max-height:240px; }
    .prompt-editor { max-height:none; }
    #acct-panel-ocr-prompts .prompt-list {
        height: auto;
        max-height: 260px;
    }
    #acct-panel-ocr-prompts .pe-field-prompt,
    #acct-panel-ocr-prompts .pe-field-prompt textarea {
        min-height: 180px;
    }
    .ocr-feedback-summary,
    .ocr-feedback-draft-grid {
        grid-template-columns: 1fr;
    }
    .pe-row { flex-direction:column; gap:0; }

    .sub-current {
        flex-direction:column;
        align-items:flex-start;
        padding:14px;
    }
    .sub-current-usage { text-align:left; }
    .sub-billing-toggle { width:100%; }
    .sub-billing-btn { flex:1; justify-content:center; padding:8px 10px; }
    .sub-compare { padding:14px; }

    #ocr-review-view > div[style*="border-bottom"] {
        flex-wrap:wrap !important;
        align-items:flex-start !important;
    }
    .ocr-review-split {
        grid-template-columns:1fr !important;
        height:auto !important;
    }
    .ocr-source-preview-resizer {
        display:none !important;
    }
    .ocr-source-preview-pane,
    .ocr-review-data-pane {
        min-height:320px;
    }
    #ocr-review-filename {
        min-width:0;
        max-width:100%;
        overflow:hidden;
        text-overflow:ellipsis;
        white-space:nowrap;
    }

    .auth-overlay { padding:10px; }
    .ocr-modal-card {
        width:calc(100vw - 20px);
        height:calc(100dvh - 20px);
        max-height:calc(100dvh - 20px);
        border-radius:12px;
    }
    .ocr-modal-controls {
        padding:18px 14px;
        max-height:none;
    }
    .ocr-modal-actions {
        position:sticky;
        bottom:0;
        background:var(--surface);
        flex-wrap:wrap;
    }
    .ocr-modal-actions .ocr-action-btn,
    .ocr-modal-actions .ocr-submit-btn {
        flex:1 1 140px;
    }
    div[id$="-modal"][style*="position:fixed"] {
        padding:12px;
        box-sizing:border-box;
    }
    div[id$="-modal"][style*="position:fixed"] > div {
        max-width:calc(100vw - 24px) !important;
        max-height:calc(100dvh - 24px) !important;
        overflow-y:auto !important;
    }
    #rule-editor-modal > div > div[style*="grid-template-columns:140px 1fr"] {
        grid-template-columns:1fr !important;
    }

    #sh-detail-breadcrumbs {
        display:flex;
        flex-wrap:wrap;
        gap:4px 8px;
    }
    #shipments-detail-view > div[style*="border-bottom"] {
        flex-wrap:wrap !important;
        align-items:flex-start !important;
    }
    #sh-split {
        grid-template-columns:1fr !important;
    }
    #sh-results-pane { order:1; grid-column:auto !important; }
    #sh-preview-resizer { display:none !important; }
    #sh-preview-pane { order:2; grid-column:auto !important; }
    #sh-preview-pane {
        min-height:300px !important;
        max-height:45vh;
    }
    #sh-preview-body { min-height:220px !important; }
    #sh-preview-collapse-btn { display:none !important; }
    .sh-slot-tab { max-width:100% !important; }
}

@media(max-width:430px) {
    .page-container { padding:14px 10px; }
    .user-doc-card {
        display:grid;
        grid-template-columns:44px minmax(0,1fr) auto;
        gap:10px;
    }
    .user-doc-icon { width:44px; }
    .user-doc-actions { margin-left:0; }
    .bar-item { grid-template-columns:1fr; }
    .bar-label { width:100%; }
    .bar-track { width:100%; }
    .stats-row { grid-template-columns:repeat(2, 1fr); }
    .modal-content { padding:22px 16px; }
}

.sh-priority-dot {
    position:relative;
    display:inline-block;
    width:12px;
    height:12px;
    border-radius:999px;
    background:var(--priority-dot, #64748b);
    border:2px solid #fff;
    box-shadow:0 0 0 1px var(--priority-border, #cbd5e1);
    vertical-align:middle;
    cursor:help;
}

.sh-priority-dot:focus {
    outline:2px solid #2563eb;
    outline-offset:3px;
}

.sh-quiet-action,
.sh-secondary-action {
    display:inline-flex;
    align-items:center;
    gap:6px;
    padding:6px 12px;
    border:1px solid #dbe3ef;
    border-radius:8px;
    background:#fff;
    color:#334155;
    font-size:13px;
    font-weight:600;
    cursor:pointer;
}

.sh-quiet-action:hover,
.sh-secondary-action:hover {
    border-color:#94a3b8;
    background:#f8fafc;
}

.attach-doc-card {
    background:#fff;
    border-radius:10px;
    width:min(1380px,96vw);
    height:min(900px,94vh);
    overflow:hidden;
    box-shadow:0 12px 40px rgba(0,0,0,0.2);
    display:flex;
    flex-direction:column;
}
.attach-doc-head {
    display:flex;
    align-items:flex-start;
    gap:12px;
    padding:18px 22px 12px;
    border-bottom:1px solid #e2e8f0;
}
.attach-close-btn {
    border:none;
    background:#f8fafc;
    border-radius:8px;
    padding:8px 10px;
    cursor:pointer;
    color:#64748b;
}
.attach-close-btn:hover {
    background:#eef2f7;
    color:#0f172a;
}
.attach-doc-body {
    min-height:0;
    overflow:hidden;
    padding:12px 18px 14px;
    flex:1 1 auto;
    display:flex;
    flex-direction:column;
}
.attach-rule-summary {
    margin-bottom:10px;
}
.attach-rule-strip {
    border:1px solid #e2e8f0;
    border-radius:8px;
    background:#f8fafc;
    color:#475569;
    padding:8px 10px;
    font-size:12px;
    display:flex;
    align-items:center;
    gap:8px;
    min-height:38px;
}
.attach-rule-strip b {
    color:#0f172a;
}
.attach-rule-chip {
    display:inline-flex;
    align-items:center;
    gap:5px;
    border:1px solid #dbe3ef;
    border-radius:999px;
    padding:3px 8px;
    background:#fff;
    color:#475569;
    font-size:11px;
    font-weight:800;
    white-space:nowrap;
}
.attach-rule-chip.missing {
    background:#fff7ed;
    color:#9a3412;
    border-color:#fed7aa;
}
.attach-review-grid {
    flex:1 1 auto;
    min-height:0;
    display:grid;
    grid-template-columns:minmax(520px,1.05fr) minmax(420px,.95fr);
    gap:14px;
}
.attach-preview-panel,
.attach-picker-panel {
    min-width:0;
    min-height:0;
    border:1px solid #e2e8f0;
    border-radius:8px;
    background:#fff;
    overflow:hidden;
}
.attach-preview-panel {
    display:flex;
    flex-direction:column;
}
.attach-preview-head {
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:12px;
    padding:10px 12px;
    border-bottom:1px solid #e2e8f0;
    background:#f8fafc;
}
.attach-preview-kicker {
    display:flex;
    align-items:center;
    gap:6px;
    color:#475569;
    font-size:11px;
    font-weight:900;
    text-transform:uppercase;
}
.attach-preview-kicker i {
    color:#b91c1c;
}
.attach-preview-head h4 {
    margin:4px 0 2px;
    color:#0f172a;
    font-size:14px;
}
.attach-preview-head p {
    margin:0;
    color:#64748b;
    font-size:12px;
}
.attach-preview-open {
    display:inline-flex;
    align-items:center;
    gap:6px;
    border:1px solid #dbe3ef;
    border-radius:7px;
    background:#fff;
    color:#1d4ed8;
    text-decoration:none;
    padding:7px 9px;
    font-size:12px;
    font-weight:800;
    white-space:nowrap;
}
.attach-preview-stage {
    flex:1 1 auto;
    min-height:0;
    background:#1f2933;
    position:relative;
    display:flex;
}
.attach-preview-stage iframe {
    width:100%;
    height:100%;
    border:0;
    background:#334155;
}
.attach-preview-empty {
    position:absolute;
    inset:0;
    display:flex;
    align-items:center;
    justify-content:center;
    flex-direction:column;
    gap:7px;
    padding:22px;
    text-align:center;
    color:#cbd5e1;
}
.attach-preview-empty i {
    font-size:28px;
    color:#94a3b8;
}
.attach-preview-empty b {
    color:#f8fafc;
    font-size:14px;
}
.attach-preview-empty span {
    color:#cbd5e1;
    font-size:12px;
    max-width:360px;
    line-height:1.45;
}
.attach-picker-panel {
    display:flex;
    flex-direction:column;
    padding:12px;
    gap:10px;
}
.attach-slot-card {
    display:grid;
    grid-template-columns:minmax(180px,260px) 1fr;
    gap:10px;
    align-items:stretch;
    border:1px solid #dbeafe;
    border-radius:8px;
    background:#eff6ff;
    padding:10px;
}
.attach-slot-card label {
    display:block;
    font-size:12px;
    color:#1e3a8a;
    font-weight:800;
}
.attach-slot-card label span {
    display:block;
    margin-bottom:4px;
}
.attach-slot-card select {
    width:100%;
    padding:8px 10px;
    border:1px solid #bfdbfe;
    border-radius:7px;
    font-size:14px;
    background:#fff;
    color:#0f172a;
}
.attach-source-head {
    display:flex;
    align-items:flex-start;
    gap:10px;
    justify-content:space-between;
}
.attach-source-head h4 {
    margin:0;
    display:flex;
    align-items:center;
    gap:7px;
    color:#0f172a;
    font-size:14px;
}
.attach-source-head h4 i {
    color:#1d4ed8;
}
.attach-source-head p {
    margin:3px 0 0;
    color:#64748b;
    font-size:12px;
    line-height:1.35;
}
.attach-doc-tools {
    display:flex;
    gap:8px;
}
.attach-doc-tools input,
.attach-doc-tools select {
    border:1px solid #dbe3ef;
    border-radius:7px;
    padding:8px 10px;
    font-size:12px;
    color:#0f172a;
    background:#fff;
}
.attach-doc-tools input {
    flex:1;
    min-width:0;
}
.attach-doc-tools select {
    width:180px;
}
.attach-doc-list {
    border:1px solid #e2e8f0;
    border-radius:7px;
    min-height:160px;
    flex:1 1 auto;
    overflow:auto;
}
.attach-doc-group-title {
    position:sticky;
    top:0;
    z-index:1;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:8px;
    padding:7px 10px;
    border-bottom:1px solid #e2e8f0;
    background:#f8fafc;
    color:#475569;
    font-size:11px;
    font-weight:900;
    text-transform:uppercase;
}
.attach-doc-row {
    display:grid;
    grid-template-columns:24px 1fr auto;
    gap:8px;
    align-items:center;
    padding:9px 10px;
    border-bottom:1px dotted #e2e8f0;
    cursor:pointer;
    background:#fff;
}
.attach-doc-row:last-child {
    border-bottom:0;
}
.attach-doc-row:hover {
    background:#f8fbff;
}
.attach-doc-row.selected {
    background:#eff6ff;
    outline:2px solid #2563eb;
    outline-offset:-2px;
}
.attach-doc-row.recommended {
    background:#f8fafc;
}
.attach-doc-row.recommended.selected {
    background:#eff6ff;
}
.attach-doc-row.current {
    border-left:3px solid #2563eb;
}
.attach-doc-row input {
    margin:0;
    accent-color:#2563eb;
}
.attach-doc-main {
    min-width:0;
}
.attach-doc-title {
    display:flex;
    align-items:center;
    gap:6px;
    font-size:13px;
    min-width:0;
}
.attach-doc-title b {
    color:#0f172a;
    white-space:nowrap;
}
.attach-doc-title span.attach-filename {
    color:#64748b;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}
.attach-doc-meta {
    font-size:11px;
    color:#64748b;
    margin-top:2px;
    line-height:1.35;
}
.attach-doc-badges {
    display:flex;
    align-items:center;
    gap:4px;
    flex-wrap:wrap;
    margin-top:5px;
}
.attach-doc-badge {
    display:inline-flex;
    align-items:center;
    gap:4px;
    border-radius:999px;
    padding:1px 6px;
    font-size:10px;
    font-weight:900;
    white-space:nowrap;
}
.attach-doc-badge.match {
    background:#dcfce7;
    color:#166534;
}
.attach-doc-badge.current {
    background:#dbeafe;
    color:#1d4ed8;
}
.attach-doc-badge.move {
    background:#fef3c7;
    color:#92400e;
}
.attach-doc-badge.classified {
    background:#eef2ff;
    color:#3730a3;
}
.attach-doc-date {
    color:#64748b;
    font-size:11px;
    white-space:nowrap;
}
.attach-upload-box {
    border:1px dashed #cbd5e1;
    border-radius:8px;
    background:#f8fafc;
    padding:10px;
    flex:0 0 auto;
}

.attach-upload-title {
    display:flex;
    align-items:center;
    gap:7px;
    color:#0f172a;
    font-size:13px;
    font-weight:700;
    margin-bottom:4px;
}

.attach-upload-help {
    color:#64748b;
    font-size:12px;
    line-height:1.45;
    margin-bottom:8px;
}

.attach-upload-box input[type="file"] {
    width:100%;
    font-size:12px;
    color:#334155;
}
.attach-doc-foot {
    border-top:1px solid #e2e8f0;
    padding:12px 22px;
    display:flex;
    gap:10px;
    justify-content:flex-end;
    background:#fff;
    flex:0 0 auto;
}
@media(max-width:900px) {
    .attach-doc-card {
        width:calc(100vw - 16px);
        height:calc(100dvh - 16px);
    }
    .attach-doc-body,
    .attach-doc-head,
    .attach-doc-foot {
        padding-left:14px;
        padding-right:14px;
    }
    .attach-doc-body {
        overflow:auto;
    }
    .attach-review-grid,
    .attach-slot-card {
        grid-template-columns:1fr;
    }
    .attach-preview-panel {
        min-height:420px;
    }
    .attach-doc-tools {
        flex-direction:column;
    }
    .attach-doc-tools select {
        width:100%;
    }
    .attach-doc-foot {
        flex-wrap:wrap;
    }
}

.sh-decision-card {
    background:#fff;
    border:1px solid #dbe3ef;
    border-radius:8px;
    padding:12px;
    margin-bottom:10px;
    font-size:13px;
}

.sh-decision-head {
    display:flex;
    gap:10px;
    align-items:flex-start;
    justify-content:space-between;
}

.sh-eyebrow {
    font-size:11px;
    text-transform:uppercase;
    letter-spacing:.04em;
    color:#64748b;
    font-weight:800;
    margin-bottom:5px;
}

.sh-missing-docs {
    display:flex;
    align-items:center;
    gap:10px;
    justify-content:space-between;
    flex-wrap:wrap;
    margin-top:10px;
    padding:10px;
    border:1px solid #fed7aa;
    border-radius:8px;
    background:#fff7ed;
    color:#7c2d12;
}

.sh-missing-docs b {
    color:#7c2d12;
}

.sh-review-audit {
    margin-top:10px;
    padding:9px 10px;
    border:1px solid #e2e8f0;
    border-radius:8px;
    background:#f8fafc;
    display:grid;
    grid-template-columns:minmax(220px, 1fr) minmax(220px, 1fr);
    gap:8px 14px;
    color:#334155;
}
.sh-review-audit b { display:block; color:#0f172a; font-size:12px; margin-bottom:2px; }
.sh-review-audit span { display:block; font-size:11.5px; line-height:1.4; color:#64748b; }

.sh-mini-actions {
    display:flex;
    gap:6px;
    flex-wrap:wrap;
    justify-content:flex-end;
}

.sh-mini-actions button {
    border:1px solid #dbe3ef;
    border-radius:7px;
    background:#fff;
    color:#334155;
    padding:5px 9px;
    font-size:12px;
    font-weight:600;
    cursor:pointer;
}

.sh-mini-actions button:hover {
    background:#f8fafc;
}

.cmp-impact-cell {
    padding:7px 10px;
    border-bottom:1px dotted #e5e7eb;
    vertical-align:top;
    min-width:145px;
    color:#475569;
    background:#fff;
}
.cmp-impact-cell.attention { background:#fff7ed; }
.cmp-impact-cell b {
    display:block;
    color:#0f172a;
    font-size:11.5px;
    line-height:1.25;
    margin-bottom:2px;
}
.cmp-impact-cell span,
.cmp-impact-cell small {
    display:block;
    font-size:10.5px;
    line-height:1.3;
    color:#64748b;
}
.cmp-impact-cell.attention b { color:#7f1d1d; }

.sh-checklist-grid {
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(230px,1fr));
    gap:8px;
}

.sh-check-card {
    border:1px solid #e5e7eb;
    border-radius:7px;
    padding:9px;
    background:#fff;
    cursor:pointer;
}

.sh-check-card:hover {
    border-color:#cbd5e1;
    background:#f8fafc;
}

.sh-state-dot {
    width:9px;
    height:9px;
    border-radius:999px;
    flex:none;
    background:#94a3b8;
}

.sh-state-dot.pass { background:#16a34a; }
.sh-state-dot.review { background:#f59e0b; }
.sh-state-dot.block { background:#dc2626; }

.sh-evidence-section {
    margin-bottom:10px;
}

.sh-evidence-toggle {
    width:100%;
    display:flex;
    align-items:center;
    gap:10px;
    border:1px solid #dbe3ef;
    border-radius:8px;
    background:#f8fafc;
    color:#0f172a;
    padding:10px 12px;
    cursor:pointer;
    text-align:left;
}

.sh-evidence-toggle:hover {
    border-color:#bfdbfe;
    background:#f1f5f9;
}

.sh-evidence-title {
    flex:1;
    min-width:0;
    display:flex;
    align-items:center;
    gap:8px;
    font-size:13px;
    font-weight:800;
}

.sh-evidence-title i {
    color:#1e4f8b;
}

.sh-evidence-title small {
    min-width:0;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    color:#64748b;
    font-size:12px;
    font-weight:600;
}

.sh-evidence-toggle-text {
    color:#1e4f8b;
    font-size:12px;
    font-weight:800;
    white-space:nowrap;
}

.sh-evidence-chevron {
    color:#64748b;
    transition:transform .16s ease;
}

.sh-evidence-body {
    margin-top:8px;
}

.sh-evidence-section.sh-collapsed .sh-evidence-body {
    display:none;
}

.sh-evidence-section:not(.sh-collapsed) .sh-evidence-chevron {
    transform:rotate(180deg);
}

.sh-walk-card {
    border:1px solid #dbe3ef;
    border-radius:8px;
    background:#fff;
    padding:12px;
    margin-bottom:10px;
}

/* Rule Library table */
.tpl-toolbar {
    display:flex;
    align-items:center;
    justify-content:flex-start;
    gap:8px;
    flex-wrap:wrap;
    margin:14px 0 10px;
}

.tpl-primary-action {
    margin:0;
    white-space:nowrap;
}

.tpl-search {
    min-width:260px;
    max-width:440px;
    flex:1 1 280px;
    display:flex;
    align-items:center;
    gap:8px;
    border:1px solid #dbe3ef;
    border-radius:8px;
    background:#fff;
    padding:8px 10px;
}

.tpl-search i {
    color:#94a3b8;
}

.tpl-search input {
    border:0;
    outline:0;
    width:100%;
    font-size:13px;
    background:transparent;
    color:#0f172a;
}

.tpl-filter-select-row {
    display:flex;
    align-items:center;
    gap:8px;
    flex-wrap:wrap;
}

.tpl-inline-filter {
    display:flex;
    align-items:center;
    gap:6px;
    color:#64748b;
    font-size:12px;
    font-weight:700;
    white-space:nowrap;
}

.tpl-inline-filter select {
    min-width:150px;
    max-width:220px;
    padding:7px 10px;
    border:1px solid #dbe3ef;
    border-radius:6px;
    background:#fff;
    color:#0f172a;
    font-size:13px;
}

.tpl-filter-row {
    display:flex;
    gap:6px;
    flex-wrap:wrap;
}

.tpl-filter-stack {
    display:flex;
    flex-direction:column;
    align-items:flex-end;
    gap:8px;
}

.tpl-filter-group {
    display:flex;
    align-items:center;
    justify-content:flex-end;
    gap:8px;
    flex-wrap:wrap;
}

.tpl-filter-label {
    color:#64748b;
    font-size:12px;
    font-weight:700;
    white-space:nowrap;
}

.tpl-filter-chip {
    padding:7px 12px;
    border:1px solid #dbe3ef;
    border-radius:999px;
    background:#fff;
    color:#475569;
    font-size:12px;
    font-weight:700;
    cursor:pointer;
}

.tpl-filter-chip.active {
    border-color:#1e4f8b;
    background:#1e4f8b;
    color:#fff;
}

.tpl-table-summary {
    color:#64748b;
    font-size:12px;
    margin:6px 0 8px;
}

.tpl-table-scroll {
    overflow:auto;
    border:1px solid #dbe3ef;
    border-radius:8px;
    background:#fff;
    box-shadow:0 1px 3px rgba(15, 23, 42, .04);
}

.tpl-rule-table {
    width:100%;
    min-width:1500px;
    border-collapse:separate;
    border-spacing:0;
    font-size:12px;
}

.tpl-rule-table th {
    position:sticky;
    top:0;
    z-index:2;
    background:#f8fafc;
    color:#475569;
    border-bottom:1px solid #dbe3ef;
    font-size:11px;
    font-weight:800;
    text-align:left;
    text-transform:uppercase;
    letter-spacing:.02em;
    padding:10px;
    white-space:nowrap;
}

.tpl-rule-table td {
    border-bottom:1px solid #eef2f7;
    color:#0f172a;
    vertical-align:top;
    padding:10px;
}

.tpl-rule-table tr:hover td {
    background:#fbfdff;
}

.tpl-sticky-col {
    position:sticky;
    left:0;
    z-index:3;
    background:#fff;
    min-width:230px;
    max-width:270px;
    box-shadow:1px 0 0 #e2e8f0;
}

.tpl-rule-table th.tpl-sticky-col {
    background:#f8fafc;
    z-index:4;
}

.tpl-rule-name {
    font-size:13px;
    font-weight:800;
    line-height:1.35;
}

.tpl-rule-meta {
    margin-top:3px;
    color:#64748b;
    font-size:11px;
    text-transform:capitalize;
}

.tpl-purpose-cell {
    min-width:240px;
    max-width:320px;
    color:#334155;
    line-height:1.45;
}

.tpl-doc-col {
    min-width:92px;
    text-align:center;
}

.tpl-req-pill {
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-width:74px;
    border-radius:999px;
    padding:3px 8px;
    font-size:11px;
    font-weight:800;
}

.tpl-req-pill.required {
    background:#fee2e2;
    color:#991b1b;
}

.tpl-req-pill.optional {
    background:#f1f5f9;
    color:#475569;
}

.tpl-empty {
    color:#cbd5e1;
}

.tpl-category-pill {
    display:inline-flex;
    align-items:center;
    border-radius:999px;
    padding:3px 8px;
    background:#e0f2fe;
    color:#075985;
    font-size:11px;
    font-weight:800;
    white-space:nowrap;
}

.tpl-category-pill.banking { background:#eef2ff; color:#3730a3; }
.tpl-category-pill.customs { background:#e0f2fe; color:#075985; }
.tpl-category-pill.fta { background:#dcfce7; color:#166534; }
.tpl-category-pill.forwarder { background:#fef3c7; color:#92400e; }
.tpl-category-pill.exporter { background:#fae8ff; color:#86198f; }
.tpl-category-pill.importer { background:#ede9fe; color:#5b21b6; }

.tpl-outcome-cell {
    min-width:170px;
}

.tpl-outcome-stack {
    display:flex;
    flex-wrap:wrap;
    gap:4px;
}

.tpl-outcome-pill {
    border-radius:999px;
    padding:3px 7px;
    font-size:11px;
    font-weight:800;
    white-space:nowrap;
}

.tpl-outcome-pill.ready { background:#dcfce7; color:#166534; }
.tpl-outcome-pill.review { background:#fef3c7; color:#92400e; }
.tpl-outcome-pill.block { background:#fee2e2; color:#991b1b; }

.tpl-outcome-note {
    color:#64748b;
    font-size:11px;
    line-height:1.4;
    margin-top:5px;
}

.tpl-md-cell {
    min-width:210px;
}

.tpl-md-stack {
    display:flex;
    flex-wrap:wrap;
    gap:4px;
}

.tpl-md-chip,
.tpl-md-more {
    display:inline-flex;
    flex-direction:column;
    align-items:flex-start;
    gap:1px;
    border-radius:6px;
    padding:4px 7px;
    background:#f8fafc;
    border:1px solid #e2e8f0;
    color:#475569;
    font-size:11px;
    font-weight:700;
}
.tpl-md-chip b {
    max-width:150px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}
.tpl-md-chip small {
    color:#64748b;
    font-size:10px;
    font-weight:800;
    text-transform:uppercase;
}
.tpl-md-chip.system { background:#eff6ff; border-color:#bfdbfe; color:#1d4ed8; }
.tpl-md-chip.organization { background:#ecfdf5; border-color:#bbf7d0; color:#166534; }
.tpl-md-chip.private { background:#f5f3ff; border-color:#ddd6fe; color:#5b21b6; }
.tpl-md-chip.external { background:#fff7ed; border-color:#fed7aa; color:#9a3412; }

.tpl-rules-cell {
    min-width:90px;
}

.tpl-rules-cell span,
.tpl-rules-cell small {
    display:block;
    color:#64748b;
    font-size:11px;
}

.tpl-actions-cell {
    min-width:150px;
}

.tpl-action-btn {
    display:inline-flex;
    align-items:center;
    gap:5px;
    margin:0 4px 5px 0;
    padding:6px 9px;
    border:1px solid #dbe3ef;
    border-radius:6px;
    background:#fff;
    color:#334155;
    font-size:12px;
    font-weight:700;
    cursor:pointer;
}

.tpl-action-btn:hover {
    border-color:#bfdbfe;
    color:#1e4f8b;
}

.tpl-action-btn.ok {
    border-color:#bbf7d0;
    background:#f0fdf4;
    color:#166534;
}

.tpl-action-btn.warn {
    border-color:#fed7aa;
    background:#fff7ed;
    color:#9a3412;
}

.tpl-action-btn.danger {
    border-color:#fecaca;
    color:#991b1b;
}

.tpl-action-btn.disabled {
    opacity:.55;
    cursor:not-allowed;
}

.rule-editor-backdrop {
    position:fixed;
    inset:0;
    width:100vw;
    height:100vh;
    background:rgba(0,0,0,.42);
    z-index:1000;
    align-items:center;
    justify-content:center;
    padding:24px;
}

.rule-editor-panel {
    width:min(900px,94vw);
    max-height:92vh;
    overflow:auto;
    background:#fff;
    border:1px solid #d4d4d8;
    border-radius:12px;
    box-shadow:0 18px 60px rgba(15,23,42,.25);
    padding:24px 32px 22px;
    color:#111827;
}

.tpl-builder-steps {
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:10px;
    margin:0 0 18px;
}

.tpl-builder-step {
    display:grid;
    grid-template-columns:30px 1fr;
    grid-template-rows:auto auto;
    column-gap:9px;
    align-items:center;
    min-height:58px;
    border:1px solid #dbeafe;
    border-radius:10px;
    background:#f8fbff;
    color:#1e3a8a;
    padding:9px 12px;
    text-align:left;
    cursor:pointer;
}

.tpl-builder-step > span {
    grid-row:1 / 3;
    display:grid;
    place-items:center;
    width:28px;
    height:28px;
    border-radius:999px;
    background:#2563eb;
    color:#fff;
    font-weight:800;
}

.tpl-builder-step b { font-size:12px; }
.tpl-builder-step small { color:#64748b; font-size:10px; line-height:1.25; }
.tpl-builder-step:hover { border-color:#60a5fa; background:#eff6ff; }
.tpl-builder-anchor { scroll-margin-top:16px; }

.tpl-rule-filterbar {
    display:grid;
    grid-template-columns:minmax(220px,1fr) minmax(135px,auto) minmax(150px,auto) auto;
    gap:10px;
    align-items:end;
    margin:0 0 8px;
    padding:10px;
    border:1px solid #e2e8f0;
    border-radius:9px;
    background:#fff;
}

.tpl-rule-filterbar > label { display:grid; gap:4px; color:#64748b; font-size:10px; font-weight:700; }
.tpl-rule-filterbar select,
.tpl-rule-filterbar input {
    width:100%;
    min-height:36px;
    border:1px solid #cbd5e1;
    border-radius:7px;
    background:#fff;
    padding:6px 9px;
    color:#0f172a;
    font-size:12px;
}
.tpl-rule-search { position:relative; }
.tpl-rule-search i { position:absolute; left:10px; bottom:11px; color:#94a3b8; }
.tpl-rule-search input { padding-left:30px; }
.tpl-rule-filter-clear { min-height:36px; white-space:nowrap; }
.tpl-rule-filter-summary { margin:0 0 8px; color:#64748b; font-size:11px; }

.rule-editor-step-title {
    display:flex;
    align-items:center;
    gap:10px;
    margin:22px 0 12px;
    padding-top:14px;
    border-top:1px solid #e2e8f0;
}
.rule-editor-step-title:first-of-type { margin-top:0; padding-top:0; border-top:0; }
.rule-editor-step-title > span {
    display:grid;
    place-items:center;
    flex:0 0 30px;
    width:30px;
    height:30px;
    border-radius:999px;
    background:#dbeafe;
    color:#1d4ed8;
    font-size:13px;
    font-weight:800;
}
.rule-editor-step-title > div { display:grid; gap:2px; }
.rule-editor-step-title b { color:#0f172a; font-size:15px; }
.rule-editor-step-title small { color:#64748b; font-size:11px; }
.rule-editor-field-friendly {
    margin-top:7px;
    padding:7px 9px;
    border-radius:7px;
    background:#eff6ff;
    color:#1e40af;
    font-size:11px;
}
.rule-editor-field-friendly:empty { display:none; }
.rule-editor-subfield-label {
    display:block;
    margin:0 0 5px;
    color:#334155;
    font-size:11px;
    font-weight:800;
}
.rule-editor-optional-settings {
    padding:12px;
    border:1px solid #dbeafe;
    border-radius:10px;
    background:#f8fbff;
}
.rule-editor-condition-preview {
    display:none;
    margin-top:10px;
    padding:9px 11px;
    border-left:3px solid #22c55e;
    border-radius:7px;
    background:#f0fdf4;
    color:#166534;
    font-size:12px;
    line-height:1.4;
}
.rule-editor-condition-guide {
    margin-top:10px;
    padding:10px 12px;
    border:1px solid #dbeafe;
    border-radius:8px;
    background:#fff;
    color:#334155;
    font-size:12px;
    line-height:1.45;
}
.rule-editor-condition-guide strong { color:#1e3a8a; }
.rule-editor-condition-guide ol {
    margin:6px 0 0 20px;
    padding:0;
}
.rule-editor-condition-guide li + li { margin-top:3px; }
#re-aw-pattern { font-family:inherit; }
.rule-editor-condition-advanced {
    margin-top:9px;
    padding:8px 10px;
    border:1px dashed #cbd5e1;
    border-radius:8px;
    background:#f8fafc;
}
.rule-editor-condition-advanced summary,
.rule-editor-condition-examples > summary {
    color:#475569;
    font-size:12px;
    font-weight:700;
    cursor:pointer;
}
.rule-editor-condition-advanced .rule-editor-subfield-label { margin-top:9px; }
.rule-editor-condition-presets {
    grid-column:1 / -1;
    padding:10px 12px;
    border:1px solid #e2e8f0;
    border-radius:8px;
    background:#fff;
}
.rule-editor-condition-presets > strong {
    display:block;
    margin-bottom:7px;
    color:#334155;
    font-size:12px;
}
.rule-editor-condition-preset-actions {
    display:flex;
    flex-wrap:wrap;
    gap:7px;
}
.rule-editor-condition-preset-actions button {
    border:1px solid #bfdbfe;
    border-radius:999px;
    background:#eff6ff;
    color:#1d4ed8;
    padding:6px 10px;
    font:inherit;
    font-size:11px;
    font-weight:700;
    cursor:pointer;
}
.rule-editor-condition-preset-actions button:hover {
    border-color:#60a5fa;
    background:#dbeafe;
}
.rule-editor-condition-presets p {
    margin:7px 0 0;
    color:#64748b;
    font-size:11px;
}
.rule-editor-condition-examples {
    margin-top:10px;
    padding:9px 11px;
    border:1px solid #e2e8f0;
    border-radius:8px;
    background:#fff;
}
.rule-editor-condition-example-grid {
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:8px;
    margin-top:9px;
}
.rule-editor-condition-example-grid article {
    display:grid;
    gap:4px;
    padding:9px;
    border-radius:7px;
    background:#f8fafc;
    color:#475569;
    font-size:11px;
    line-height:1.4;
}
.rule-editor-condition-example-grid b { color:#0f172a; }

.rule-editor-head {
    display:flex;
    justify-content:space-between;
    align-items:flex-start;
    gap:16px;
    margin-bottom:18px;
}

.rule-editor-head h3 {
    margin:0;
    color:#050505;
    font-size:22px;
    line-height:1.1;
    font-weight:800;
    letter-spacing:0;
}

.rule-editor-template-name {
    color:#73706c;
    font-size:14px;
    font-weight:700;
    padding-top:4px;
    text-align:right;
}

.rule-editor-section {
    margin-bottom:18px;
}

.rule-editor-label,
.rule-editor-section h4 {
    display:block;
    margin:0 0 8px;
    color:#0a0a0a;
    font-size:15px;
    line-height:1.2;
    font-weight:800;
}

.rule-editor-field-input,
.rule-editor-select {
    width:100%;
    min-height:42px;
    border:1px solid #d4d4d8;
    border-radius:8px;
    background:#fff;
    color:#111827;
    padding:7px 12px;
    font-size:16px;
    line-height:1.2;
}

.rule-editor-field-input {
    font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
}

.rule-editor-help {
    margin-top:6px;
    color:#73706c;
    font-size:13px;
    line-height:1.35;
}

.tpl-doc-requirement-help {
    margin:0 0 8px;
    color:#64748b;
    font-size:11px;
    line-height:1.35;
}

.tpl-required-groups-head {
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:10px;
    margin-top:14px;
    padding-top:12px;
    border-top:1px solid #e2e8f0;
}

.tpl-required-groups-head strong {
    display:block;
    color:#334155;
    font-size:12px;
}

.tpl-required-groups-head p {
    margin:3px 0 0;
    color:#64748b;
    font-size:11px;
    line-height:1.35;
}

.tpl-required-groups {
    display:grid;
    gap:10px;
    margin-top:10px;
}

.tpl-required-group-empty {
    display:grid;
    gap:3px;
    padding:10px 12px;
    border:1px dashed #93c5fd;
    border-radius:8px;
    background:#eff6ff;
    color:#1e3a8a;
    font-size:11px;
}

.tpl-required-group {
    padding:10px;
    border:1px solid #bfdbfe;
    border-radius:9px;
    background:#f8fbff;
}

.tpl-required-group.invalid {
    border-color:#f59e0b;
    background:#fffbeb;
}

.tpl-required-group > header {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:8px;
}

.tpl-required-group > header strong {
    color:#1e3a8a;
    font-size:12px;
}

.tpl-required-group-summary {
    margin-left:8px;
    padding:2px 7px;
    border-radius:999px;
    background:#dbeafe;
    color:#1d4ed8;
    font-size:10px;
    font-weight:700;
}

.tpl-icon-btn {
    border:0;
    background:transparent;
    color:#64748b;
    cursor:pointer;
}

.tpl-icon-btn.danger:hover { color:#b91c1c; }

.tpl-required-group-docs {
    display:flex;
    flex-wrap:wrap;
    gap:6px;
    margin:8px 0;
}

.tpl-required-group-docs > span {
    display:inline-flex;
    align-items:center;
    gap:5px;
    padding:3px 8px;
    border:1px solid #93c5fd;
    border-radius:999px;
    background:#fff;
    color:#1e3a8a;
    font-size:11px;
    font-weight:700;
}

.tpl-required-group-docs button {
    border:0;
    background:transparent;
    color:#64748b;
    cursor:pointer;
    padding:0;
}

.tpl-required-group-docs em {
    color:#92400e;
    font-size:11px;
}

.tpl-required-group-error {
    margin:6px 0;
    color:#b45309;
    font-size:11px;
    font-weight:700;
}

.tpl-required-group-controls,
.tpl-required-group-merge {
    display:flex;
    flex-wrap:wrap;
    align-items:center;
    gap:6px;
    margin-top:8px;
}

.tpl-required-group-controls > select,
.tpl-required-group-merge > select,
.tpl-required-group-controls label select {
    min-height:32px;
    border:1px solid #cbd5e1;
    border-radius:6px;
    background:#fff;
    padding:4px 8px;
    font-size:11px;
}

.tpl-required-group-controls > select { flex:1 1 180px; }

.tpl-required-group-controls label {
    display:inline-flex;
    align-items:center;
    gap:5px;
    color:#475569;
    font-size:11px;
}

.rule-editor-example {
    display:none;
    margin-top:8px;
    padding:9px 11px;
    border-left:3px solid #60a5fa;
    border-radius:6px;
    background:#f8fafc;
    color:#475569;
    font-size:12px;
    line-height:1.45;
}

.rule-editor-section-head {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:14px;
}

.rule-editor-add-doc,
.rule-editor-btn {
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:8px;
    min-height:34px;
    border:1px solid #bdbdbd;
    border-radius:10px;
    background:#fff;
    color:#111;
    padding:6px 14px;
    font-size:13px;
    font-weight:700;
    cursor:pointer;
}

.rule-editor-add-doc:hover,
.rule-editor-btn:hover {
    border-color:#2563eb;
    color:#1d4ed8;
}

.rule-editor-doc-picker {
    display:flex;
    flex-wrap:wrap;
    gap:10px;
    margin:10px 0 10px;
}

.rule-editor-doc-group {
    display:flex;
    flex-wrap:wrap;
    gap:8px;
    min-width:0;
    margin:0;
    padding:8px 10px 10px;
    border:1px solid #e2e8f0;
    border-radius:10px;
}

.rule-editor-doc-group legend {
    padding:0 4px;
    color:#475569;
    font-size:11px;
    font-weight:800;
}

.rule-editor-doc-picker.collapsed .rule-editor-doc-group:not(:has(label.selected)) {
    display:none;
}

.rule-editor-doc-picker.collapsed label:not(.selected) {
    display:none;
}

.rule-editor-doc-picker label {
    display:inline-flex;
    align-items:center;
    gap:7px;
    min-height:28px;
    border-radius:999px;
    background:#f1f0eb;
    color:#706d68;
    padding:4px 14px;
    font-size:13px;
    font-weight:700;
    cursor:pointer;
}

.rule-editor-doc-picker label.selected {
    background:#111;
    color:#fff;
}

.rule-editor-doc-picker input {
    position:static;
    width:14px;
    height:14px;
    margin:0;
    opacity:1;
    accent-color:#2563eb;
}

.rule-editor-doc-picker label:focus-within {
    outline:2px solid #2563eb;
    outline-offset:2px;
}

.rule-editor-doc-table-wrap {
    margin-top:12px;
    border:1px solid #d7d7d7;
    border-radius:10px;
    overflow:hidden;
}

.rule-editor-doc-table {
    width:100%;
    border-collapse:collapse;
    table-layout:fixed;
}

.rule-editor-doc-table th {
    background:#f3f1ec;
    color:#3f3f3f;
    text-align:left;
    padding:10px 14px;
    font-size:13px;
    line-height:1.2;
    font-weight:500;
}

.rule-editor-doc-table th:nth-child(1) { width:36%; }
.rule-editor-doc-table th:nth-child(3) { width:120px; text-align:center; }

.rule-editor-doc-table td {
    border-top:1px solid #d7d7d7;
    padding:12px 14px;
    vertical-align:middle;
    background:#fff;
}

.rule-editor-doc-name {
    font-size:14px;
    font-weight:700;
    color:#111;
}

.rule-editor-doc-name small {
    color:#73706c;
    font-size:12px;
    font-weight:700;
}

.rule-editor-doc-field {
    width:100%;
    min-height:40px;
    border:1px solid #d7d7d7;
    border-radius:8px;
    background:#fff;
    color:#111;
    padding:6px 12px;
    font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
    font-size:15px;
    font-weight:700;
}

.rule-editor-doc-field:disabled {
    background:#faf9f6;
    color:#73706c;
}

.rule-editor-compare-cell {
    text-align:center;
}

.rule-editor-compare {
    width:18px;
    height:18px;
    accent-color:#1f5a22;
}

.rule-editor-grid {
    display:grid;
    grid-template-columns:minmax(0,1fr) minmax(0,1fr);
    gap:18px 28px;
    margin-top:18px;
}

.rule-editor-logic-extra {
    margin-top:8px;
}

.rule-editor-logic-extra input,
.rule-editor-logic-extra select {
    width:100%;
    min-height:36px;
    border:1px solid #d4d4d8;
    border-radius:8px;
    padding:6px 10px;
    font-size:13px;
}

.rule-editor-segment,
.rule-editor-severity {
    display:grid;
    grid-template-columns:1fr 1fr;
    border:1px solid #bdbdbd;
    border-radius:10px;
    overflow:hidden;
    min-height:40px;
}

.rule-editor-severity {
    grid-template-columns:1fr 1fr 1fr;
    border:0;
    gap:10px;
}

.rule-editor-segment label,
.rule-editor-severity label {
    display:flex;
    align-items:center;
    justify-content:center;
    cursor:pointer;
    background:#fff;
    color:#404040;
    font-size:13px;
    font-weight:700;
}

.rule-editor-segment label + label {
    border-left:1px solid #d4d4d8;
}

.rule-editor-segment input,
.rule-editor-severity input {
    position:absolute;
    opacity:0;
    pointer-events:none;
}

.rule-editor-segment label:has(input:checked) {
    background:#dbeafe;
    color:#1d4ed8;
}

.rule-editor-severity label {
    border-radius:10px;
    background:#f3f1ec;
    min-height:38px;
}

.rule-editor-severity label.critical:has(input:checked) {
    background:#fee2e2;
    color:#991b1b;
}

.rule-editor-severity label.warning:has(input:checked) {
    background:#f8ecd7;
    color:#7c4a03;
}

.rule-editor-severity label.info:has(input:checked) {
    background:#e0f2fe;
    color:#075985;
}

.rule-editor-normalize {
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:8px 14px;
}

.rule-editor-normalize label {
    display:flex;
    align-items:flex-start;
    gap:7px;
    color:#3f3f3f;
    font-size:13px;
    line-height:1.2;
}

.rule-editor-normalize label > span {
    display:grid;
    gap:2px;
}

.rule-editor-normalize label small {
    color:#73706c;
    font-size:10px;
    line-height:1.3;
}

.rule-editor-normalize input {
    width:15px;
    height:15px;
    accent-color:#2563eb;
}

.rule-editor-advanced {
    margin-top:8px;
}

.rule-editor-advanced summary {
    display:inline-flex;
    cursor:pointer;
    color:#2563eb;
    font-size:13px;
    font-weight:700;
    margin-bottom:10px;
}

.rule-editor-actions {
    display:flex;
    justify-content:flex-end;
    gap:12px;
    border-top:1px solid #d7d7d7;
    margin-top:16px;
    padding-top:18px;
}

.rule-editor-btn {
    min-width:104px;
    min-height:40px;
    font-size:14px;
}

.rule-editor-btn.primary {
    background:#3569b8;
    border-color:#3569b8;
    color:#fff;
}

.rule-editor-btn.danger {
    color:#8a2d2b;
}

@media (max-width: 760px) {
    .rule-editor-panel {
        padding:22px 18px;
    }
    .rule-editor-head,
    .rule-editor-section-head {
        flex-direction:column;
        align-items:stretch;
    }
    .rule-editor-template-name {
        text-align:left;
    }
    .rule-editor-grid {
        grid-template-columns:1fr;
    }
    .rule-editor-condition-example-grid {
        grid-template-columns:1fr;
    }
    .tpl-builder-steps,
    .tpl-rule-filterbar {
        grid-template-columns:1fr;
    }
    .rule-editor-doc-table {
        min-width:720px;
    }
    .rule-editor-doc-table-wrap {
        overflow:auto;
    }
}

.tpl-inline-icon {
    border:0;
    background:transparent;
    color:#64748b;
    cursor:pointer;
    padding:2px 4px;
    margin-left:4px;
}

.tpl-empty-state {
    border:1px dashed #cbd5e1;
    border-radius:8px;
    background:#fff;
    color:#64748b;
    padding:18px;
    font-size:13px;
}

@media (max-width: 760px) {
    .tpl-toolbar {
        align-items:stretch;
    }
    .tpl-primary-action {
        width:100%;
        justify-content:center;
    }
    .tpl-search {
        min-width:100%;
        max-width:none;
    }
    .tpl-filter-select-row {
        width:100%;
    }
    .tpl-inline-filter {
        width:100%;
        justify-content:space-between;
    }
    .tpl-inline-filter select {
        flex:1;
        max-width:none;
    }
    .tpl-filter-stack {
        align-items:flex-start;
        width:100%;
    }
    .tpl-filter-group {
        justify-content:flex-start;
    }
    .tpl-rule-table {
        min-width:1320px;
    }
    .tpl-sticky-col {
        min-width:190px;
    }
}

.sh-create-card {
    background:#fff;
    border-radius:10px;
    width:min(1180px,94vw);
    max-height:92vh;
    overflow:hidden;
    box-shadow:0 18px 55px rgba(15,23,42,.24);
    display:flex;
    flex-direction:column;
}
.sh-create-head {
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:14px;
    padding:18px 22px 12px;
    border-bottom:1px solid #e2e8f0;
}
.sh-create-head h3 {
    margin:0;
    font-size:20px;
    color:#0f172a;
}
.sh-create-head p {
    margin:4px 0 0;
    color:#64748b;
    font-size:13px;
}
.sh-create-head button {
    border:0;
    background:#f8fafc;
    color:#64748b;
    border-radius:8px;
    padding:8px 10px;
    cursor:pointer;
}
.sh-create-steps {
    display:flex;
    gap:8px;
    padding:12px 22px;
    border-bottom:1px solid #e2e8f0;
    background:#f8fafc;
}
.sh-create-steps span {
    border:1px solid #dbe3ef;
    border-radius:999px;
    padding:4px 10px;
    font-size:12px;
    font-weight:800;
    color:#64748b;
    background:#fff;
}
.sh-create-steps span.active {
    border-color:#bfdbfe;
    background:#eff6ff;
    color:#1d4ed8;
}
.sh-create-grid {
    min-height:0;
    overflow:auto;
    display:grid;
    grid-template-columns:minmax(520px,1.12fr) minmax(320px,.88fr);
    gap:14px;
    padding:18px 22px;
    align-items:stretch;
}
.sh-create-section {
    border:1px solid #e2e8f0;
    border-radius:8px;
    background:#fff;
    padding:14px;
    min-width:0;
}
.sh-create-docs-panel {
    display:flex;
    flex-direction:column;
}
.sh-create-details-panel {
    background:#fbfdff;
}
.sh-create-section h4 {
    display:flex;
    align-items:center;
    gap:8px;
    margin:0 0 12px;
    color:#0f172a;
    font-size:15px;
}
.sh-create-section h4 i { color:#1d4ed8; }
.sh-create-section label {
    display:block;
    font-size:12px;
    color:#64748b;
    font-weight:700;
    margin:10px 0 4px;
}
.sh-create-section .sh-required-label,
.sh-required-label {
    display:flex;
    align-items:center;
    gap:5px;
}
.sh-required-label span:first-child {
    display:inline-flex;
    align-items:center;
    gap:6px;
}
.sh-required-star {
    color:#dc2626;
    font-weight:900;
    font-size:14px;
    line-height:1;
}
.sh-create-section input,
.sh-create-section select {
    width:100%;
    border:1px solid #dbe3ef;
    border-radius:7px;
    padding:8px 10px;
    font-size:13px;
    color:#0f172a;
    background:#fff;
}
.sh-create-section input.sh-field-invalid,
.sh-create-section select.sh-field-invalid,
.sh-fullset-drop.sh-field-invalid,
.sh-existing-list.sh-field-invalid {
    border-color:#ef4444 !important;
    background:#fff7f7;
    box-shadow:0 0 0 3px rgba(239,68,68,.12);
}
.sh-field-error {
    display:none;
    margin:5px 0 0;
    color:#b91c1c;
    font-size:12px;
    font-weight:700;
    line-height:1.35;
}
.sh-field-error.active {
    display:block;
}
.sh-status-error {
    color:#b91c1c;
    font-weight:800;
    display:inline-flex;
    align-items:center;
    gap:6px;
}
.sh-validation-pointer {
    position:fixed;
    z-index:2000;
    pointer-events:none;
    background:#b91c1c;
    color:#fff;
    border-radius:8px;
    padding:6px 10px;
    font-size:12px;
    font-weight:800;
    box-shadow:0 10px 24px rgba(185,28,28,.24);
}
.sh-validation-pointer::after {
    content:"";
    position:absolute;
    right:14px;
    bottom:-7px;
    width:0;
    height:0;
    border-left:7px solid transparent;
    border-right:7px solid transparent;
    border-top:7px solid #b91c1c;
}
@keyframes shFieldPulse {
    0%, 100% { box-shadow:0 0 0 3px rgba(239,68,68,.12); }
    45% { box-shadow:0 0 0 6px rgba(239,68,68,.24); }
}
.sh-field-pulse {
    animation:shFieldPulse .8s ease-in-out 2;
}
.ocr-submit-btn[data-incomplete="true"] {
    opacity:.92;
}
.sh-rule-summary {
    margin-top:10px;
    border:1px solid #dbe3ef;
    border-radius:8px;
    background:#f8fafc;
    padding:10px;
    color:#475569;
    font-size:12px;
    line-height:1.45;
}
.sh-rule-summary .rule-title {
    display:flex;
    align-items:center;
    gap:8px;
    margin-bottom:6px;
    color:#0f172a;
    font-weight:800;
}
.sh-rule-docs {
    display:flex;
    flex-wrap:wrap;
    gap:5px;
    margin-top:7px;
}
.sh-rule-coverage {
    margin-top:7px;
    color:#475569;
    font-size:12px;
}
.sh-rule-doc-chip {
    border:1px solid #dbe3ef;
    border-radius:999px;
    background:#fff;
    color:#475569;
    padding:2px 8px;
    font-size:11px;
    font-weight:800;
}
.sh-rule-doc-chip.required {
    border-color:#fecaca;
    background:#fff1f2;
    color:#991b1b;
}
.sh-rule-doc-chip.covered {
    border-color:#bbf7d0;
    background:#f0fdf4;
    color:#166534;
}
.sh-source-choice-label {
    display:flex;
    align-items:center;
    gap:6px;
    margin:2px 0 10px;
    color:#0f172a;
    font-size:13px;
    font-weight:800;
}
.sh-source-cards {
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:10px;
    margin-bottom:12px;
}
.sh-source-mode-card {
    display:grid !important;
    grid-template-columns:18px 34px 1fr;
    align-items:center;
    gap:10px;
    margin:0 !important;
    padding:13px;
    border:1px solid #dbe3ef;
    border-radius:8px;
    background:#fff;
    color:#0f172a;
    cursor:pointer;
    min-width:0;
    transition:border-color .16s ease, background .16s ease, box-shadow .16s ease;
}
.sh-source-mode-card:hover {
    border-color:#bfdbfe;
    background:#f8fbff;
}
.sh-source-mode-card.active {
    border-color:#2563eb;
    background:#eff6ff;
    box-shadow:0 0 0 3px rgba(37,99,235,.08);
}
.sh-source-mode-card input {
    width:16px;
    height:16px;
    margin:0;
    padding:0;
    border:0;
    accent-color:#2563eb;
}
.sh-source-mode-icon {
    width:34px;
    height:34px;
    border-radius:8px;
    background:#eef2ff;
    color:#1d4ed8;
    display:inline-flex;
    align-items:center;
    justify-content:center;
}
.sh-source-mode-card.active .sh-source-mode-icon {
    background:#dbeafe;
}
.sh-source-mode-card b {
    display:block;
    font-size:13px;
    line-height:1.25;
    color:#0f172a;
}
.sh-source-mode-card small {
    display:block;
    margin-top:2px;
    color:#64748b;
    font-size:11px;
    line-height:1.35;
}
.sh-source-mode-card em {
    grid-column:3;
    justify-self:start;
    border:1px solid #bfdbfe;
    border-radius:999px;
    background:#fff;
    color:#1d4ed8;
    padding:3px 8px;
    font-size:10px;
    font-style:normal;
    font-weight:900;
    white-space:nowrap;
}
.sh-source-option-title {
    display:grid;
    grid-template-columns:24px 1fr;
    gap:8px;
    align-items:center;
    margin:2px 0 8px;
}
.sh-source-option-title span {
    width:22px;
    height:22px;
    border-radius:999px;
    background:#eff6ff;
    border:1px solid #bfdbfe;
    color:#1d4ed8;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    font-size:12px;
    font-weight:900;
}
.sh-source-option-title b {
    color:#0f172a;
    font-size:13px;
}
.sh-source-option-title small {
    grid-column:2;
    color:#64748b;
    font-size:11px;
    line-height:1.35;
}
.sh-fullset-drop {
    border:1px dashed #94a3b8;
    border-radius:8px;
    background:#f8fafc;
    padding:28px 18px;
    display:flex;
    flex-direction:column;
    align-items:center;
    gap:6px;
    text-align:center;
    color:#475569;
    cursor:pointer;
    margin-bottom:0;
    min-height:132px;
    justify-content:center;
}
.sh-fullset-drop.drag-over,
.sh-fullset-drop.has-file {
    border-color:#2563eb;
    background:#eff6ff;
}
.sh-fullset-drop i {
    color:#1d4ed8;
    font-size:30px;
}
.sh-fullset-drop b {
    color:#0f172a;
    font-size:15px;
}
.sh-fullset-drop span {
    font-size:12px;
}
.sh-existing-toggle-card {
    display:grid !important;
    grid-template-columns:18px 32px 1fr auto;
    align-items:center;
    gap:10px;
    margin:12px 0 0 !important;
    padding:11px 12px;
    border:1px solid #dbe3ef;
    border-radius:8px;
    background:#fff;
    color:#0f172a;
    cursor:pointer;
    transition:border-color .16s ease, background .16s ease, box-shadow .16s ease;
}
.sh-existing-toggle-card:hover {
    border-color:#bfdbfe;
    background:#f8fbff;
}
.sh-existing-toggle-card.active {
    border-color:#2563eb;
    background:#eff6ff;
    box-shadow:0 0 0 3px rgba(37,99,235,.08);
}
.sh-existing-toggle-card input {
    width:16px;
    height:16px;
    margin:0;
    padding:0;
    border:0;
    border-radius:0;
    background:transparent;
    accent-color:#2563eb;
}
.sh-existing-toggle-icon {
    width:32px;
    height:32px;
    border-radius:8px;
    background:#eef2ff;
    color:#1d4ed8;
    display:inline-flex;
    align-items:center;
    justify-content:center;
}
.sh-existing-toggle-card.active .sh-existing-toggle-icon {
    background:#dbeafe;
}
.sh-existing-toggle-copy {
    display:block;
    min-width:0;
}
.sh-existing-toggle-copy b {
    display:block;
    color:#0f172a;
    font-size:13px;
    line-height:1.25;
}
.sh-existing-toggle-copy small {
    display:block;
    margin-top:2px;
    color:#64748b;
    font-size:11px;
    line-height:1.35;
}
.sh-existing-toggle-state {
    border:1px solid #e2e8f0;
    border-radius:999px;
    background:#f8fafc;
    color:#64748b;
    padding:4px 8px;
    font-size:10px;
    font-weight:900;
    white-space:nowrap;
}
.sh-existing-toggle-card.active .sh-existing-toggle-state {
    border-color:#bfdbfe;
    background:#fff;
    color:#1d4ed8;
}
.sh-existing-panel {
    margin-top:10px;
}
.sh-existing-step-note {
    display:flex;
    align-items:flex-start;
    gap:10px;
    border:1px solid #dbeafe;
    border-radius:8px;
    background:#eff6ff;
    color:#1e3a8a;
    padding:11px 12px;
}
.sh-existing-step-note i {
    margin-top:2px;
    color:#1d4ed8;
}
.sh-existing-step-note b {
    display:block;
    color:#0f172a;
    font-size:13px;
}
.sh-existing-step-note span {
    display:block;
    margin-top:2px;
    color:#475569;
    font-size:12px;
    line-height:1.4;
}
.sh-existing-head {
    display:flex;
    justify-content:space-between;
    align-items:flex-end;
    gap:10px;
    margin-bottom:8px;
}
.sh-existing-head[hidden],
.sh-existing-list[hidden] {
    display:none !important;
}
.sh-existing-head b {
    display:block;
    font-size:13px;
    color:#0f172a;
}
.sh-existing-head span {
    display:block;
    font-size:11px;
    color:#64748b;
    margin-top:2px;
}
.sh-existing-tools {
    display:flex;
    align-items:center;
    gap:8px;
    min-width:min(430px, 100%);
}
.sh-existing-tools select {
    max-width:170px;
    min-width:150px;
}
.sh-existing-tools input {
    max-width:230px;
    min-width:180px;
}
.sh-existing-list {
    border:1px solid #e2e8f0;
    border-radius:8px;
    max-height:340px;
    overflow:auto;
}
.sh-existing-row {
    display:grid;
    grid-template-columns:24px 1fr minmax(130px, max-content);
    gap:8px;
    align-items:center;
    padding:9px 10px;
    border-bottom:1px dotted #e2e8f0;
    background:#fff;
}
.sh-existing-row:last-child { border-bottom:0; }
.sh-existing-row.disabled { opacity:.55; background:#f8fafc; }
.sh-existing-row .doc-main {
    min-width:0;
}
.sh-existing-row .doc-title {
    display:flex;
    align-items:center;
    gap:6px;
    min-width:0;
    font-size:12px;
    color:#0f172a;
}
.sh-existing-row .doc-title span {
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}
.sh-existing-row .doc-meta {
    margin-top:2px;
    font-size:11px;
    color:#64748b;
}
.sh-existing-type-pill {
    justify-self:end;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:4px;
    min-width:0;
    max-width:180px;
    border:1px solid #dbe3ef;
    border-radius:999px;
    padding:5px 9px;
    background:#f8fafc;
    color:#334155;
    font-size:12px;
    font-weight:800;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}
.sh-existing-type-pill small {
    color:#64748b;
    font-size:10px;
    font-weight:800;
}
.sh-existing-type-pill.required {
    border-color:#fecaca;
    background:#fff1f2;
    color:#991b1b;
}
.sh-existing-type-pill.required small {
    color:#b91c1c;
}
.sh-existing-type-pill.optional {
    border-color:#dbe3ef;
    background:#f8fafc;
}
.sh-existing-type-pill.unmatched {
    border-color:#fde68a;
    background:#fffbeb;
    color:#92400e;
}
.sh-existing-type-pill.unmatched small {
    color:#a16207;
}
.sh-existing-row select {
    border:1px solid #dbe3ef;
    border-radius:6px;
    padding:6px 8px;
    font-size:12px;
}
.sh-create-foot {
    border-top:1px solid #e2e8f0;
    padding:12px 22px;
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:12px;
    background:#fff;
}
.sh-create-foot > div:first-child {
    color:#64748b;
    font-size:12px;
}
.sh-create-foot > div:last-child {
    display:flex;
    gap:10px;
    margin-left:auto;
}
.muted {
    color:#64748b;
    font-size:12px;
}
.sh-preview-tools {
    display:flex;
    align-items:center;
    gap:8px;
    padding:6px 10px;
    border-bottom:1px solid #e2e8f0;
    background:#f8fafc;
}
.sh-preview-tools button {
    width:28px;
    height:28px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    border:1px solid #dbe3ef;
    border-radius:6px;
    background:#fff;
    color:#1e4f8b;
    cursor:pointer;
}
.sh-preview-tools button:hover {
    border-color:#93c5fd;
    background:#eff6ff;
}
.sh-preview-tools input[type="range"] {
    flex:1;
    min-width:90px;
    accent-color:#1e4f8b;
}
.sh-preview-mouse-hint {
    color:#64748b;
    font-size:11px;
    font-weight:700;
    white-space:nowrap;
}
.sh-preview-tools span {
    min-width:42px;
    text-align:right;
    color:#475569;
    font-size:12px;
    font-weight:700;
}
#sh-preview-pane {
    grid-column:1;
    min-height:0 !important;
    max-height:calc(100dvh - 180px);
}
.sh-preview-resizer {
    grid-column:2;
    display:flex;
    align-items:center;
    justify-content:center;
    min-width:10px;
    cursor:col-resize;
    user-select:none;
    touch-action:none;
}
.sh-preview-resizer span {
    width:4px;
    height:54px;
    border-radius:999px;
    background:#cbd5e1;
    box-shadow:0 0 0 1px rgba(255,255,255,.6);
}
.sh-preview-resizer:hover span,
.sh-preview-resizing .sh-preview-resizer span {
    background:#2563eb;
}
.sh-preview-resizing {
    cursor:col-resize;
    user-select:none;
}
#sh-preview-body {
    overscroll-behavior:contain;
    touch-action:none;
    scroll-behavior:auto;
    min-height:0 !important;
    flex:1 1 auto;
    overflow:auto;
}
#sh-preview-body.sh-preview-pan-ready {
    cursor:grab;
}
#sh-preview-body.sh-preview-pan-ready .pdfa-page,
#sh-preview-body.sh-preview-pan-ready .pdfa-page canvas {
    cursor:grab;
}
#sh-preview-body.sh-preview-panning {
    cursor:grabbing;
    user-select:none;
}
#sh-preview-body.sh-preview-panning * {
    cursor:grabbing !important;
}
#sh-results-pane {
    grid-column:3;
    width:100%;
    min-width:0;
}
.zia-compare-scroll {
    width:100%;
    max-height:calc(100vh - 355px);
    min-height:220px;
}
.zia-compare-table thead th {
    position:sticky;
    top:0;
    z-index:5;
}
.zia-compare-table .sh-sticky-col {
    position:sticky;
    z-index:4;
    box-shadow:1px 0 0 #e5e7eb;
}
.zia-compare-table thead .sh-sticky-col {
    z-index:8;
}
.zia-compare-table .sh-sticky-col-1 {
    left:0;
    min-width:46px;
    width:46px;
}
.zia-compare-table .sh-sticky-col-2 {
    left:46px;
    min-width:92px;
    width:92px;
}
.zia-compare-table .sh-sticky-col-3 {
    left:138px;
    min-width:220px;
    width:220px;
}
.zia-compare-table .sh-compare-cell-unmatch {
    position:relative;
    outline:2px solid #dc2626;
    outline-offset:-2px;
    background:#fef2f2 !important;
}
.zia-compare-table .sh-compare-line-unmatch {
    outline:2px solid #dc2626;
    outline-offset:-2px;
    border-radius:4px;
    background:#fef2f2;
    padding:3px 4px;
}
.pdfa-scroll-stack {
    overflow:visible;
    background:#1f2937;
    padding:14px;
    gap:14px;
    align-items:flex-start;
    flex-direction:column;
    width:max-content;
    min-width:100%;
    box-sizing:border-box;
}
.pdfa-scroll-stack.sh-preview-sheet-stack {
    overflow:auto;
    background:#f1f5f9;
    padding:16px;
    align-items:stretch;
    width:100%;
    min-width:0;
}
.sh-sheet-preview {
    width:100%;
    min-width:520px;
    background:#fff;
    border:1px solid #dbe3ef;
    border-radius:8px;
    box-shadow:0 2px 8px rgba(15,23,42,.08);
    overflow:hidden;
}
.sh-sheet-preview-head {
    display:flex;
    justify-content:space-between;
    gap:12px;
    align-items:flex-start;
    padding:12px 14px;
    border-bottom:1px solid #e2e8f0;
    background:#f8fafc;
}
.sh-sheet-preview-title {
    display:flex;
    align-items:center;
    gap:8px;
    color:#0f172a;
    font-size:13px;
    font-weight:800;
}
.sh-sheet-preview-title i {
    color:#15803d;
}
.sh-sheet-preview-meta,
.sh-sheet-preview-note {
    color:#64748b;
    font-size:12px;
    margin-top:4px;
}
.sh-sheet-preview-note {
    padding:10px 14px 12px;
    border-top:1px solid #e2e8f0;
    background:#f8fafc;
}
.sh-sheet-preview-table-wrap {
    max-height:620px;
    overflow:auto;
}
.sh-sheet-preview-table {
    width:100%;
    min-width:max-content;
    border-collapse:separate;
    border-spacing:0;
    font-size:12px;
    color:#1f2937;
}
.sh-sheet-preview-table th,
.sh-sheet-preview-table td {
    max-width:260px;
    padding:7px 9px;
    border-right:1px solid #e5e7eb;
    border-bottom:1px solid #e5e7eb;
    vertical-align:top;
    white-space:pre-wrap;
    overflow-wrap:anywhere;
}
.sh-sheet-preview-table th {
    position:sticky;
    top:0;
    z-index:1;
    background:#eff6ff;
    color:#1e3a8a;
    font-weight:800;
}
.sh-sheet-preview-table tr:nth-child(even) td {
    background:#f8fafc;
}
.pdfa-page {
    position:relative;
    flex:0 0 auto;
    display:block;
    margin:0 auto 14px;
    background:#fff;
    box-shadow:0 2px 8px rgba(0,0,0,0.14);
    border-radius:4px;
}
.pdfa-page canvas {
    display:block;
    border-radius:4px;
    user-select:none;
    -webkit-user-drag:none;
}
.pdfa-layer {
    position:absolute;
    inset:0;
    pointer-events:none;
}
.pdfa-highlight {
    position:absolute;
    border:1.5px solid currentColor;
    border-radius:3px;
    background:rgba(253,224,71,.24);
    color:#ca8a04;
    cursor:pointer;
    pointer-events:auto;
    padding:0;
    min-width:10px;
    min-height:10px;
}
.pdfa-highlight.pdfa-match {
    color:#16a34a;
    background:rgba(34,197,94,.16);
}
.pdfa-highlight.pdfa-critical {
    color:#dc2626;
    background:rgba(239,68,68,.18);
}
.pdfa-highlight.pdfa-warning {
    color:#d97706;
    background:rgba(245,158,11,.2);
}
.pdfa-highlight.pdfa-info {
    color:#ca8a04;
    background:rgba(253,224,71,.24);
}
.pdfa-marker {
    position:absolute;
    top:-10px;
    left:-4px;
    font-size:18px;
    line-height:1;
    text-shadow:0 1px 2px rgba(0,0,0,.25);
}
.pdfa-tooltip {
    display:none;
    position:absolute;
    left:0;
    top:100%;
    z-index:25;
    min-width:180px;
    max-width:300px;
    background:#0f172a;
    color:#fff;
    border-radius:7px;
    padding:8px 10px;
    font-size:11px;
    line-height:1.35;
    text-align:left;
    box-shadow:0 8px 24px rgba(15,23,42,.25);
}
.pdfa-highlight:hover .pdfa-tooltip,
.pdfa-highlight:focus .pdfa-tooltip {
    display:block;
}
.pdfa-pin-mode {
    cursor:crosshair;
}
.pdfa-pin-mode .pdfa-page {
    outline:2px dashed #facc15;
    outline-offset:3px;
}
.pdfa-modal {
    position:fixed;
    inset:0;
    z-index:5000;
    background:rgba(15,23,42,.55);
    align-items:center;
    justify-content:center;
    padding:18px;
}
.pdfa-modal-card {
    width:min(520px,96vw);
    background:#fff;
    border-radius:12px;
    box-shadow:0 24px 70px rgba(15,23,42,.28);
    overflow:hidden;
}
.pdfa-modal-head {
    display:flex;
    align-items:flex-start;
    gap:12px;
    justify-content:space-between;
    padding:16px 18px;
    border-bottom:1px solid #e2e8f0;
    background:#f8fafc;
}
.pdfa-modal-head h3 {
    margin:0;
    font-size:18px;
    color:#0f172a;
}
.pdfa-modal-head p {
    margin:3px 0 0;
    color:#64748b;
    font-size:12px;
}
#pdfa-ann-cancel {
    border:none;
    background:#eef2f7;
    color:#475569;
    border-radius:8px;
    width:32px;
    height:32px;
    font-size:20px;
    cursor:pointer;
}
.pdfa-modal-body {
    padding:16px 18px;
    display:grid;
    gap:12px;
}
.pdfa-modal-body label {
    display:grid;
    gap:5px;
    color:#334155;
    font-size:12px;
    font-weight:800;
}
.pdfa-modal-body input,
.pdfa-modal-body select,
.pdfa-modal-body textarea {
    width:100%;
    border:1px solid #cbd5e1;
    border-radius:8px;
    padding:9px 10px;
    font-size:13px;
    color:#0f172a;
    background:#fff;
}
.pdfa-modal-body textarea {
    resize:vertical;
}
.pdfa-modal-actions {
    display:flex;
    justify-content:flex-end;
    gap:10px;
    padding:14px 18px;
    border-top:1px solid #e2e8f0;
    background:#fff;
}
.pdfa-secondary,
.pdfa-primary {
    border-radius:8px;
    padding:9px 14px;
    font-weight:800;
    font-size:13px;
    cursor:pointer;
}
.pdfa-secondary {
    border:1px solid #cbd5e1;
    background:#fff;
    color:#334155;
}
.pdfa-primary {
    border:1px solid #2563eb;
    background:#2563eb;
    color:#fff;
}
.ocr-field-edit-input,
.sh-field-edit-input {
    width:100%;
    border:1px solid #93c5fd;
    border-radius:6px;
    padding:5px 7px;
    font-size:12px;
    line-height:1.45;
    font-family:inherit;
    background:#eff6ff;
}
.ocr-field-edit-input {
    display:block;
    min-height:32px;
    max-height:420px;
    overflow:auto;
    padding:6px 8px;
    font-size:13px;
    resize:vertical;
}
.ocr-field-row-dirty .ocr-field-edit-input {
    border-color:#2563eb;
    background:#fff;
    box-shadow:0 0 0 2px rgba(37,99,235,.12);
}
.sh-field-edit-input.is-dirty {
    border-color:#2563eb;
    background:#fff;
    box-shadow:0 0 0 2px rgba(37,99,235,.12);
}
textarea.sh-field-edit-input {
    display:block;
    min-height:54px;
    max-height:180px;
    padding:8px 9px;
    resize:vertical;
    overflow:auto;
    white-space:pre-wrap;
    word-break:break-word;
    color:#0f172a;
}
textarea.sh-field-edit-input::placeholder {
    color:#64748b;
}
.sh-edited-badge {
    display:inline-flex;
    align-items:center;
    gap:4px;
    margin-top:4px;
    padding:2px 7px;
    border-radius:999px;
    background:#fef3c7;
    color:#92400e;
    font-size:10.5px;
    font-weight:800;
    line-height:1.2;
    text-transform:uppercase;
    letter-spacing:.02em;
}
.ocr-field-row-edited {
    background:#fffbeb;
}
.ocr-field-readonly-value {
    display:block;
    white-space:pre-wrap;
    word-break:break-word;
    line-height:1.45;
}
.ocr-edit-state,
.sh-edit-state {
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:4px;
    border-radius:999px;
    background:#fffbeb;
    color:#92400e;
    border:1px solid #fde68a;
    font-size:11px;
    font-weight:800;
    padding:3px 8px;
}
.ocr-field-save-btn {
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-width:64px;
    border:1px solid #cbd5e1;
    border-radius:6px;
    background:#f8fafc;
    color:#64748b;
    font-size:12px;
    font-weight:800;
    padding:6px 10px;
    cursor:pointer;
}
.ocr-field-save-btn.is-dirty {
    border-color:#2563eb;
    background:#2563eb;
    color:#fff;
}
.ocr-field-save-btn:disabled {
    opacity:.65;
    cursor:not-allowed;
}
.zia-doc-review-toolbar {
    display:flex;
    align-items:center;
    gap:8px;
    flex-wrap:wrap;
}
.zia-doc-review-toolbar--shipment {
    padding:10px 12px;
    margin:-4px 0 12px 74px;
    border:1px solid #e2e8f0;
    border-radius:10px;
    background:#f8fafc;
}
.sh-detail-actionbar {
    display:flex;
    align-items:center;
    justify-content:flex-end;
    gap:8px;
    flex-wrap:wrap;
}
.sh-detail-nav {
    display:inline-flex;
    align-items:center;
    gap:6px;
    padding:3px;
    border:1px solid #e2e8f0;
    border-radius:10px;
    background:#f8fafc;
    color:#475569;
    flex:0 0 auto;
}
.sh-detail-nav button {
    width:30px;
    height:28px;
    border:1px solid #e2e8f0;
    border-radius:8px;
    background:#fff;
    color:#1e4f8b;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    cursor:pointer;
}
.sh-detail-nav button:hover:not(:disabled) {
    border-color:#93c5fd;
    background:#eff6ff;
    color:#1d4ed8;
}
.sh-detail-nav button:disabled {
    opacity:.42;
    cursor:not-allowed;
    color:#94a3b8;
}
.sh-detail-nav span {
    min-width:44px;
    text-align:center;
    font-size:12px;
    font-weight:800;
    color:#475569;
    font-variant-numeric:tabular-nums;
}
.sh-results-actionbar {
    display:inline-flex;
    align-items:center;
    justify-content:flex-end;
    gap:8px;
    flex-wrap:wrap;
}
.sh-results-actionbar #sh-detail-overall {
    margin-right:4px;
}
.ocr-review-table-toolbar {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    padding:8px 12px;
    border-bottom:1px solid #e2e8f0;
    background:#fff;
}
.ocr-review-table-title {
    display:inline-flex;
    align-items:center;
    gap:6px;
    color:#334155;
    font-size:12px;
    font-weight:900;
    white-space:nowrap;
}
.ocr-review-table-title i {
    color:#2563eb;
}
.ocr-review-table-actions {
    display:inline-flex;
    align-items:center;
    justify-content:flex-end;
    gap:8px;
    flex-wrap:wrap;
}
.ocr-review-split {
    display:grid;
    grid-template-columns: minmax(420px, 760px) 10px minmax(520px, 1fr);
    gap:0;
    height:calc(100vh - 200px);
    align-items:stretch;
    border:0;
    border-radius:0;
    overflow:visible;
    background:transparent;
    transition:grid-template-columns .16s ease;
}
.ocr-source-preview-pane,
.ocr-review-data-pane {
    border:1px solid #e2e8f0;
    border-radius:10px;
    overflow:hidden;
    background:#fff;
    display:flex;
    flex-direction:column;
    min-width:0;
}
.ocr-source-preview-header {
    display:flex;
    align-items:center;
    gap:8px;
    padding:8px 12px;
    background:#f8fafc;
    border-bottom:1px solid #e2e8f0;
    color:#64748b;
    font-size:11px;
    font-weight:800;
}
.ocr-source-preview-header button,
.ocr-source-preview-rail button {
    border:1px solid #e2e8f0;
    background:#fff;
    border-radius:6px;
    color:#475569;
    cursor:pointer;
    display:inline-flex;
    align-items:center;
    justify-content:center;
}
.ocr-source-preview-header button {
    width:28px;
    height:24px;
}
.ocr-source-preview-main {
    flex:1;
    min-height:0;
    display:flex;
    flex-direction:column;
    position:relative;
}
.ocr-validation-scope-note {
    display:flex;
    align-items:flex-start;
    gap:7px;
    padding:7px 12px;
    border-bottom:1px solid #e2e8f0;
    background:#f8fafc;
    color:#64748b;
    font-size:11px;
    line-height:1.45;
}
.ocr-validation-scope-note i { color:#2563eb; margin-top:2px; }
.ocr-source-preview-error {
    position:absolute;
    inset:0;
    z-index:2;
    display:flex;
    align-items:center;
    justify-content:center;
    flex-direction:column;
    gap:10px;
    padding:24px;
    text-align:center;
    background:#fff;
    color:#991b1b;
}
.ocr-source-preview-error .ocr-preview-error-actions {
    display:flex;
    gap:8px;
    flex-wrap:wrap;
    justify-content:center;
}
#ocr-pdf-iframe {
    flex:1;
    width:100%;
    border:none;
}
#ocr-source-excel-preview {
    flex:1;
    overflow:auto;
}
.ocr-source-preview-rail {
    display:none;
    flex:1;
    align-items:center;
    justify-content:flex-start;
    flex-direction:column;
    gap:12px;
    padding:10px 0;
    color:#64748b;
    background:#fff;
}
.ocr-source-preview-rail button {
    width:28px;
    height:28px;
    color:#1e4f8b;
}
.ocr-source-preview-rail div {
    writing-mode:vertical-rl;
    transform:rotate(180deg);
    font-size:11px;
    font-weight:800;
    letter-spacing:.06em;
    text-transform:uppercase;
}
.ocr-source-preview-resizer {
    display:flex;
    align-items:center;
    justify-content:center;
    cursor:col-resize;
    user-select:none;
    touch-action:none;
}
.ocr-source-preview-resizer span {
    width:3px;
    height:42px;
    border-radius:999px;
    background:#cbd5e1;
}
.ocr-source-preview-resizer:hover span,
body.ocr-preview-resizing .ocr-source-preview-resizer span {
    background:#2563eb;
}
body.ocr-preview-resizing,
body.ocr-preview-resizing * {
    cursor:col-resize !important;
    user-select:none !important;
}
.ocr-review-split.is-collapsed {
    grid-template-columns:44px minmax(0, 1fr);
}
.ocr-review-split.is-collapsed .ocr-source-preview-pane {
    min-width:44px;
}
.ocr-review-split.is-collapsed .ocr-source-preview-header,
.ocr-review-split.is-collapsed .ocr-source-preview-main,
.ocr-review-split.is-collapsed .ocr-source-preview-resizer {
    display:none !important;
}
.ocr-review-split.is-collapsed .ocr-source-preview-rail {
    display:flex;
}
.zia-toolbar-btn {
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:6px;
    border:1px solid #cbd5e1;
    border-radius:8px;
    background:#fff;
    color:#334155;
    font-size:12px;
    font-weight:800;
    line-height:1;
    min-height:32px;
    padding:7px 12px;
    cursor:pointer;
    white-space:nowrap;
}
.zia-toolbar-btn:hover {
    border-color:#93c5fd;
    color:#1d4ed8;
}
.zia-toolbar-btn:disabled {
    opacity:.55;
    cursor:not-allowed;
}
.zia-toolbar-btn--primary {
    border-color:#2563eb;
    background:#2563eb;
    color:#fff;
}
.zia-toolbar-btn--primary:hover {
    border-color:#1d4ed8;
    background:#1d4ed8;
    color:#fff;
}
.zia-toolbar-btn--success {
    border-color:#16a34a;
    background:#16a34a;
    color:#fff;
}
.zia-toolbar-btn--success:hover {
    border-color:#15803d;
    background:#15803d;
    color:#fff;
}
.zia-toolbar-btn--soft {
    border-color:#bfdbfe;
    background:#eff6ff;
    color:#1e40af;
}
.zia-toolbar-btn--review {
    border-color:#16a34a;
    background:#dcfce7;
    color:#166534;
    box-shadow:0 1px 0 rgba(22, 101, 52, .08);
}
.zia-toolbar-btn--review:hover {
    border-color:#15803d;
    background:#bbf7d0;
    color:#14532d;
}
.zia-review-controls {
    display:inline-flex;
    align-items:center;
    gap:6px;
    padding-left:8px;
    border-left:1px solid #e2e8f0;
}
.zia-review-controls strong {
    color:#334155;
    font-size:12px;
    font-weight:900;
    white-space:nowrap;
}
.zia-review-choice {
    border:1px solid #cbd5e1;
    border-radius:999px;
    background:#fff;
    color:#475569;
    font-size:12px;
    font-weight:900;
    min-height:30px;
    padding:6px 11px;
    cursor:pointer;
}
.zia-review-choice.is-active[data-decision="approved"],
.zia-review-choice.is-active#ocr-review-approve-btn,
.zia-review-choice.is-active#sh-inline-approve-btn {
    border-color:#86efac;
    background:#dcfce7;
    color:#166534;
}
.zia-review-choice.is-active[data-decision="rejected"],
.zia-review-choice.is-active[data-decision="needs_correction"],
.zia-review-choice.is-active#ocr-review-reject-btn,
.zia-review-choice.is-active#sh-inline-reject-btn {
    border-color:#fecaca;
    background:#fee2e2;
    color:#991b1b;
}
.zia-review-note {
    min-width:180px;
    max-width:280px;
    min-height:30px;
    border:1px solid #cbd5e1;
    border-radius:8px;
    background:#fff;
    color:#0f172a;
    font-size:12px;
    font-weight:600;
    padding:6px 9px;
}
.zia-review-note--modal {
    width:100%;
    max-width:none;
    min-height:96px;
    resize:vertical;
    line-height:1.45;
}
.zia-review-modal-choices {
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:10px;
}
.zia-review-modal-choices .zia-review-choice {
    border-radius:8px;
    min-height:42px;
}
@media (max-width: 1100px) {
    .zia-doc-review-toolbar--shipment {
        margin-left:0;
    }
    .zia-review-controls {
        width:100%;
        border-left:0;
        padding-left:0;
    }
}
.ocr-page-accuracy {
    display:flex;
    flex-direction:column;
    gap:2px;
    line-height:1.2;
}
.ocr-page-accuracy span {
    color:#64748b;
    font-size:10.5px;
    white-space:nowrap;
}
.ocr-edited-badge,
.sh-edited-badge {
    display:inline-block;
    margin-left:6px;
    padding:1px 6px;
    border-radius:999px;
    background:#fef3c7;
    color:#92400e;
    font-size:10px;
    font-weight:800;
}
.sh-file-icon-pdf {
    color:#b91c1c;
}
.sh-file-icon-excel {
    color:#166534;
}
.sh-rule-outcome {
    margin-top:5px;
}
.sh-existing-message,
.attach-doc-message {
    padding:14px;
    color:#64748b;
    font-size:13px;
    text-align:center;
}
.sh-existing-message.error,
.attach-doc-message.error {
    color:#991b1b;
}
.attach-doc-message.spacious {
    padding:18px;
    line-height:1.45;
}
.attach-slot-state.ready {
    color:#166534;
    background:#ecfdf5;
}
.attach-slot-state.missing {
    color:#991b1b;
    background:#fef2f2;
}
.attach-slot-state.empty {
    color:#64748b;
    background:#f8fafc;
}
.sh-ob-include-cell {
    display:flex;
    align-items:center;
    justify-content:center;
}
.sh-preview-empty-icon {
    font-size:36px;
    color:#cbd5e1;
}
.sh-preview-excel-icon {
    font-size:34px;
    color:#166534;
}
.sh-preview-loading-icon {
    font-size:24px;
    color:#1e4f8b;
}
.sh-preview-error-icon {
    font-size:28px;
    color:#ef4444;
}
.sh-preview-note {
    max-width:360px;
}
.sh-preview-download-btn {
    margin-top:10px;
}
.sh-pdf-modal-panel {
    background:#fff;
    border-radius:10px;
    width:min(960px,94vw);
    height:min(88vh,820px);
    display:flex;
    flex-direction:column;
    box-shadow:0 12px 40px rgba(0,0,0,0.25);
    overflow:hidden;
}
.sh-pdf-modal-head {
    display:flex;
    align-items:center;
    gap:10px;
    padding:10px 14px;
    border-bottom:1px solid #e2e8f0;
    background:#fafbfc;
}
.sh-pdf-modal-icon {
    color:#b91c1c;
}
.sh-pdf-modal-title {
    font-size:13px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    flex:1;
}
.sh-pdf-modal-newtab {
    font-size:12px;
    color:#1e4f8b;
    text-decoration:none;
    padding:4px 8px;
}
.sh-pdf-modal-close {
    border:none;
    background:none;
    font-size:18px;
    cursor:pointer;
    color:#475569;
    padding:2px 8px;
}
.sh-pdf-modal-frame {
    flex:1;
    width:100%;
    border:none;
}
#sh-detail-meta {
    margin-top:6px !important;
    color:#334155 !important;
    min-width:0;
}
.sh-detail-meta-grid {
    display:flex;
    align-items:center;
    gap:6px;
    flex-wrap:wrap;
    max-width:100%;
}
.sh-detail-info-card {
    display:inline-flex;
    align-items:center;
    gap:6px;
    min-height:30px;
    max-width:280px;
    padding:4px 8px;
    border:1px solid #d8e2ef;
    border-radius:8px;
    background:#fff;
    box-shadow:none;
    min-width:0;
}
.sh-detail-info-card--rule {
    max-width:min(520px, 100%);
    border-color:#bfdbfe;
    background:#f8fbff;
}
.sh-detail-info-card--compact {
    max-width:230px;
}
.sh-detail-info-card--status {
    max-width:190px;
}
.sh-detail-info-card--status .sh-detail-info-value {
    display:none;
}
.sh-detail-info-icon {
    width:20px;
    height:20px;
    flex:0 0 20px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    border-radius:6px;
    background:#eaf2ff;
    color:#2563eb;
    font-size:10px;
}
.sh-detail-info-body {
    display:flex;
    flex-direction:row;
    align-items:center;
    gap:5px;
    min-width:0;
    max-width:100%;
}
.sh-detail-info-label {
    color:#475569;
    font-size:10px;
    line-height:1.1;
    font-weight:900;
    letter-spacing:.04em;
    text-transform:uppercase;
    white-space:nowrap;
    flex:0 0 auto;
}
.sh-detail-info-label::after {
    content:":";
}
.sh-detail-info-value {
    color:#0f172a;
    font-size:12px;
    line-height:1.25;
    font-weight:800;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}
.sh-detail-info-sub {
    color:#64748b;
    font-size:11px;
    line-height:1.2;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    flex:0 1 auto;
}
.sh-detail-info-sub::before {
    content:"(";
}
.sh-detail-info-sub::after {
    content:")";
}
.sh-detail-status-pill,
.sh-detail-doc-status {
    display:inline-flex;
    align-items:center;
    gap:5px;
    width:max-content;
    max-width:100%;
    border-radius:999px;
    padding:3px 8px;
    font-size:11px;
    font-weight:800;
    line-height:1.2;
    white-space:nowrap;
}
.sh-detail-status-pill {
    color:var(--sh-pill-fg, #475569);
    background:var(--sh-pill-bg, #f8fafc);
    border:1px solid var(--sh-pill-border, #cbd5e1);
}
.sh-detail-doc-status {
    min-height:30px;
    padding:4px 8px;
    border-radius:8px;
}
.sh-detail-doc-status--ok {
    color:#166534;
    background:#ecfdf5;
    border:1px solid #86efac;
}
.sh-detail-doc-status--missing {
    color:#9a3412;
    background:#fff7ed;
    border:1px solid #fed7aa;
}
.sh-rule-guide-btn,
.sh-rule-switch-btn {
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:5px;
    width:max-content;
    margin-left:3px;
    border:1px solid #bfdbfe;
    background:#eff6ff;
    color:#1d4ed8;
    border-radius:7px;
    padding:4px 8px;
    font-size:11px;
    font-weight:900;
    line-height:1.2;
    cursor:pointer;
    box-shadow:none;
    white-space:nowrap;
    flex:0 0 auto;
}
.sh-rule-guide-btn:hover,
.sh-rule-guide-btn:focus-visible,
.sh-rule-switch-btn:hover,
.sh-rule-switch-btn:focus-visible {
    background:#dbeafe;
    border-color:#93c5fd;
    color:#1e40af;
    outline:none;
}
.sh-rule-switch-btn {
    background:#fff;
    color:#1e40af;
}
.sh-rule-switch-copy {
    margin:0 0 14px;
    color:#64748b;
    font-size:13px;
    line-height:1.45;
}
.sh-rule-switch-current {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    margin:0 0 12px;
    padding:10px 12px;
    border:1px solid #dbeafe;
    border-radius:8px;
    background:#eff6ff;
    color:#1e3a8a;
    font-size:13px;
}
.sh-rule-switch-current span {
    color:#475569;
    font-weight:800;
}
.sh-rule-switch-current b {
    min-width:0;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}
.sh-rule-switch-coverage {
    display:grid;
    gap:10px;
    margin-top:12px;
}
.sh-rule-switch-section {
    border:1px solid #e2e8f0;
    border-radius:8px;
    padding:10px 12px;
    background:#fff;
}
.sh-rule-switch-section b {
    display:block;
    margin-bottom:8px;
    color:#0f172a;
    font-size:12px;
}
.sh-rule-switch-slots {
    display:flex;
    flex-wrap:wrap;
    gap:6px;
}
.sh-rule-switch-slot {
    display:inline-flex;
    align-items:center;
    gap:5px;
    padding:4px 8px;
    border-radius:999px;
    border:1px solid #cbd5e1;
    background:#f8fafc;
    color:#475569;
    font-size:11px;
    font-weight:800;
}
.sh-rule-switch-slot.is-present {
    border-color:#86efac;
    background:#ecfdf5;
    color:#166534;
}
.sh-rule-switch-slot.is-missing {
    border-color:#fed7aa;
    background:#fff7ed;
    color:#9a3412;
}
.sh-rule-switch-muted,
.sh-rule-switch-empty {
    color:#64748b;
    font-size:12px;
}
.sh-rule-switch-warning,
.sh-rule-switch-error {
    display:flex;
    align-items:flex-start;
    gap:8px;
    padding:9px 10px;
    border-radius:8px;
    font-size:12px;
    line-height:1.45;
}
.sh-rule-switch-warning {
    border:1px solid #fed7aa;
    background:#fff7ed;
    color:#9a3412;
}
.sh-rule-switch-error {
    margin-top:12px;
    border:1px solid #fecaca;
    background:#fef2f2;
    color:#991b1b;
    font-weight:700;
}
.sh-rule-stale-banner {
    display:flex;
    align-items:center;
    gap:10px;
    margin-top:8px;
    padding:9px 11px;
    border:1px solid #fbbf24;
    border-radius:8px;
    background:#fffbeb;
    color:#92400e;
    font-size:12px;
    line-height:1.35;
}
.sh-rule-stale-icon {
    width:24px;
    height:24px;
    flex:0 0 24px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    border-radius:7px;
    background:#fef3c7;
    color:#b45309;
}
.sh-rule-stale-copy {
    display:flex;
    flex-direction:column;
    gap:1px;
    min-width:0;
    flex:1 1 auto;
}
.sh-rule-stale-copy strong {
    color:#78350f;
    font-size:12px;
    font-weight:900;
}
.sh-rule-stale-copy span {
    color:#92400e;
    font-size:11px;
}
.sh-rule-stale-action {
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:6px;
    flex:0 0 auto;
    border:1px solid #f59e0b;
    border-radius:7px;
    background:#fff7ed;
    color:#9a3412;
    padding:6px 10px;
    font-size:11px;
    font-weight:900;
    cursor:pointer;
}
.sh-rule-stale-action:hover,
.sh-rule-stale-action:focus-visible {
    background:#fed7aa;
    color:#7c2d12;
    outline:none;
}
.sh-rule-stale-action:disabled {
    cursor:wait;
    opacity:.75;
}
.rule-explain-overlay {
    position:fixed;
    inset:0;
    z-index:7000;
    display:none;
    align-items:center;
    justify-content:center;
    padding:24px;
    background:rgba(15,23,42,0.58);
}
.rule-explain-overlay.is-open {
    display:flex;
}
.rule-explain-dialog {
    width:min(1180px, calc(100vw - 48px));
    max-height:calc(100vh - 48px);
    display:flex;
    flex-direction:column;
    background:#fff;
    border:1px solid #dbe3ef;
    border-radius:10px;
    box-shadow:0 24px 70px rgba(15,23,42,0.28);
    overflow:hidden;
}
.rule-explain-head,
.rule-explain-foot {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:16px;
    padding:16px 20px;
    border-bottom:1px solid #e2e8f0;
    background:#f8fafc;
}
.rule-explain-foot {
    border-top:1px solid #e2e8f0;
    border-bottom:none;
    color:#64748b;
    font-size:12px;
}
.rule-explain-eyebrow {
    color:#2563eb;
    font-size:11px;
    font-weight:800;
    letter-spacing:.04em;
    text-transform:uppercase;
}
.rule-explain-head h2 {
    margin:2px 0 2px;
    color:#0f172a;
    font-size:20px;
    line-height:1.2;
}
#rule-explain-subtitle {
    margin:0;
    color:#64748b;
    font-size:13px;
}
.rule-explain-close,
.rule-explain-secondary {
    border:1px solid #cbd5e1;
    background:#fff;
    color:#334155;
    border-radius:8px;
    cursor:pointer;
    font-weight:700;
}
.rule-explain-close {
    width:34px;
    height:34px;
}
.rule-explain-secondary {
    padding:8px 14px;
}
.rule-explain-close:hover,
.rule-explain-secondary:hover {
    background:#f1f5f9;
}
.rule-explain-body {
    flex:1;
    min-height:0;
    overflow:auto;
    padding:18px 20px 22px;
}
.rule-explain-summary {
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;
    gap:16px;
    border:1px solid #dbeafe;
    background:#eff6ff;
    border-radius:8px;
    padding:14px 16px;
}
.rule-explain-summary b {
    color:#0f172a;
}
.rule-explain-summary p {
    margin:5px 0 0;
    color:#475569;
    font-size:13px;
    line-height:1.45;
}
.rule-explain-counts {
    display:grid;
    grid-template-columns:repeat(3, minmax(92px, 1fr));
    gap:8px;
}
.rule-explain-counts span {
    border:1px solid #bfdbfe;
    background:#fff;
    border-radius:8px;
    padding:8px 10px;
    color:#475569;
    font-size:12px;
    text-align:center;
}
.rule-explain-counts b {
    display:block;
    color:#1d4ed8;
    font-size:18px;
}
.rule-explain-section {
    margin-top:18px;
}
.rule-explain-section h3 {
    margin:0 0 8px;
    color:#0f172a;
    font-size:15px;
}
.rule-explain-docs {
    display:flex;
    flex-wrap:wrap;
    gap:8px;
}
.rule-explain-doc-chip {
    display:inline-flex;
    align-items:center;
    gap:7px;
    border:1px solid #dbe3ef;
    background:#fff;
    border-radius:999px;
    padding:6px 10px;
    color:#334155;
    font-size:12px;
}
.rule-explain-doc-chip.required {
    border-color:#fecaca;
    background:#fff1f2;
}
.rule-explain-doc-chip.optional {
    border-color:#dbeafe;
    background:#eff6ff;
}
.rule-explain-doc-chip small {
    color:#64748b;
    font-weight:700;
}
.rule-explain-section-head {
    display:flex;
    align-items:flex-end;
    justify-content:space-between;
    gap:16px;
    margin-bottom:10px;
}
.rule-explain-section-head p {
    margin:0;
    color:#64748b;
    font-size:12px;
}
.rule-explain-filter-tools {
    display:flex;
    align-items:center;
    justify-content:flex-end;
    flex-wrap:wrap;
    gap:8px;
}
.rule-explain-filter-group {
    display:inline-flex;
    align-items:center;
    gap:6px;
    padding:3px;
    border:1px solid #dbe3ef;
    border-radius:999px;
    background:#f8fafc;
}
.rule-explain-filter-chip {
    display:inline-flex;
    align-items:center;
    gap:5px;
    border:1px solid transparent;
    background:transparent;
    color:#475569;
    border-radius:999px;
    padding:6px 9px;
    font-size:12px;
    font-weight:800;
    cursor:pointer;
}
.rule-explain-filter-chip b {
    min-width:18px;
    border-radius:999px;
    background:#e2e8f0;
    color:#334155;
    padding:1px 5px;
    text-align:center;
    font-size:11px;
}
.rule-explain-filter-chip.active {
    border-color:#bfdbfe;
    background:#eff6ff;
    color:#1d4ed8;
}
.rule-explain-filter-chip.critical.active {
    border-color:#fecaca;
    background:#fef2f2;
    color:#991b1b;
}
.rule-explain-filter-chip.warning.active {
    border-color:#fed7aa;
    background:#fff7ed;
    color:#9a3412;
}
.rule-explain-filter-chip.info.active {
    border-color:#bae6fd;
    background:#f0f9ff;
    color:#075985;
}
.rule-explain-section-head input {
    width:min(320px, 42vw);
    border:1px solid #cbd5e1;
    border-radius:8px;
    padding:8px 10px;
    font-size:13px;
}
.rule-explain-table-wrap {
    border:1px solid #dbe3ef;
    border-radius:8px;
    overflow:auto;
    max-height:58vh;
}
.rule-explain-table {
    width:100%;
    min-width:1060px;
    border-collapse:collapse;
    font-size:12px;
    color:#1e293b;
}
.rule-explain-table th {
    position:sticky;
    top:0;
    z-index:1;
    background:#f1f5f9;
    border-bottom:1px solid #cbd5e1;
    color:#334155;
    padding:10px;
    text-align:left;
    font-size:11px;
    text-transform:uppercase;
}
.rule-explain-table td {
    border-bottom:1px solid #e2e8f0;
    padding:10px;
    vertical-align:top;
    line-height:1.42;
}
.rule-explain-field {
    display:flex;
    gap:9px;
    min-width:190px;
}
.rule-explain-field b {
    display:block;
    color:#0f172a;
    font-size:13px;
}
.rule-explain-field code,
.rule-explain-doc-row code {
    color:#475569;
    font-family:ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size:11px;
}
.rule-explain-no {
    flex:0 0 auto;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    width:24px;
    height:24px;
    border-radius:999px;
    background:#dbeafe;
    color:#1d4ed8;
    font-size:11px;
    font-weight:800;
}
.rule-explain-severity {
    display:inline-flex;
    margin-top:5px;
    padding:2px 7px;
    border-radius:999px;
    background:#f1f5f9;
    color:#475569;
    font-size:10px;
    font-weight:800;
    text-transform:uppercase;
}
.rule-explain-severity.high,
.rule-explain-severity.critical {
    background:#fee2e2;
    color:#991b1b;
}
.rule-explain-severity.warning {
    background:#ffedd5;
    color:#9a3412;
}
.rule-explain-severity.info {
    background:#e0f2fe;
    color:#075985;
}
.rule-explain-doc-row {
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:10px;
    padding:5px 0;
    border-bottom:1px dashed #e2e8f0;
}
.rule-explain-doc-row:last-child {
    border-bottom:none;
}
.rule-explain-doc-row b,
.rule-explain-doc-row span {
    display:block;
}
.rule-explain-doc-row span {
    color:#64748b;
    font-size:11px;
}
.rule-explain-normalizer {
    display:inline-flex;
    margin:5px 5px 0 0;
    border:1px solid #bfdbfe;
    background:#eff6ff;
    color:#1d4ed8;
    border-radius:999px;
    padding:2px 7px;
    font-size:11px;
    font-weight:700;
}
.rule-explain-muted {
    color:#94a3b8;
}
.rule-explain-loading,
.rule-explain-error,
.rule-explain-empty {
    padding:22px;
    text-align:center;
    color:#64748b;
}
.rule-explain-error {
    color:#991b1b;
    background:#fef2f2;
    border:1px solid #fecaca;
    border-radius:8px;
}
.tpl-md-link-panel {
    margin-top:14px;
    border:1px solid #dbe3ef;
    background:#fff;
    border-radius:8px;
    padding:12px;
}
.tpl-md-link-head {
    display:flex;
    justify-content:space-between;
    align-items:flex-start;
    gap:12px;
    margin-bottom:10px;
}
.tpl-md-link-head h4 {
    margin:0;
    font-size:14px;
    color:#0f172a;
}
.tpl-md-link-head p {
    margin:3px 0 0;
    font-size:12px;
    color:#64748b;
}
.tpl-md-link-actions,
.tpl-md-link-tools {
    display:flex;
    align-items:center;
    gap:8px;
    flex-wrap:wrap;
}
.tpl-md-link-tools {
    justify-content:space-between;
    margin:8px 0 10px;
}
.tpl-md-link-tools input,
.tpl-md-link-version,
.tpl-md-link-table select {
    border:1px solid #cbd5e1;
    border-radius:6px;
    background:#fff;
    color:#0f172a;
    font-size:12px;
    padding:7px 9px;
}
.tpl-md-link-tools input {
    min-width:240px;
}
.tpl-md-link-primary,
.tpl-md-link-secondary {
    border:1px solid #cbd5e1;
    border-radius:6px;
    padding:7px 10px;
    font-size:12px;
    font-weight:700;
    cursor:pointer;
    background:#fff;
    color:#1e293b;
}
.tpl-md-link-primary {
    border-color:#2563eb;
    background:#2563eb;
    color:#fff;
}
.tpl-md-link-primary:disabled {
    opacity:.55;
    cursor:not-allowed;
}
.tpl-md-link-warning,
.tpl-md-link-error {
    display:flex;
    align-items:center;
    gap:8px;
    border-radius:8px;
    padding:9px 10px;
    font-size:12px;
    font-weight:700;
    margin-bottom:10px;
}
.tpl-md-link-warning {
    background:#fff7ed;
    border:1px solid #fed7aa;
    color:#9a3412;
}
.tpl-md-link-error {
    background:#fef2f2;
    border:1px solid #fecaca;
    color:#991b1b;
}
.tpl-md-link-table-wrap {
    overflow:auto;
    border:1px solid #e2e8f0;
    border-radius:8px;
}
.tpl-md-link-table {
    width:100%;
    border-collapse:collapse;
    min-width:880px;
}
.tpl-md-link-table th,
.tpl-md-link-table td {
    border-bottom:1px solid #edf2f7;
    padding:9px 10px;
    text-align:left;
    vertical-align:top;
    font-size:12px;
}
.tpl-md-link-table th {
    background:#f8fafc;
    color:#475569;
    font-size:11px;
    text-transform:uppercase;
    letter-spacing:.04em;
}
.tpl-md-link-table td small {
    display:block;
    margin-top:3px;
    color:#64748b;
}
.tpl-md-link-table select {
    width:100%;
    min-width:220px;
}
.tpl-md-link-severity {
    display:inline-flex;
    align-items:center;
    border-radius:999px;
    padding:2px 7px;
    font-size:11px;
    font-weight:800;
    background:#f1f5f9;
    color:#475569;
}
.tpl-md-link-severity.critical {
    background:#fee2e2;
    color:#991b1b;
}
.tpl-md-link-severity.warning {
    background:#ffedd5;
    color:#9a3412;
}
.tpl-md-link-severity.info {
    background:#e0f2fe;
    color:#075985;
}
.tpl-md-link-empty {
    padding:18px;
    color:#64748b;
    text-align:center;
    font-size:13px;
}
[data-zia-css*="display:none"] {
    display:none;
}
@media (max-width: 900px) {
    .rule-explain-overlay {
        padding:10px;
    }
    .rule-explain-dialog {
        width:calc(100vw - 20px);
        max-height:calc(100vh - 20px);
    }
    .rule-explain-summary,
    .rule-explain-section-head {
        grid-template-columns:1fr;
        flex-direction:column;
        align-items:stretch;
    }
    .rule-explain-filter-tools {
        justify-content:flex-start;
    }
    .rule-explain-filter-group {
        width:100%;
        overflow-x:auto;
        border-radius:10px;
    }
    .rule-explain-counts {
        grid-template-columns:1fr;
    }
    .rule-explain-section-head input {
        width:100%;
    }
    .sh-create-grid {
        grid-template-columns:1fr;
    }
    .sh-source-cards {
        grid-template-columns:1fr;
    }
    .sh-existing-toggle-card {
        grid-template-columns:18px 32px 1fr;
    }
    .sh-existing-toggle-state {
        grid-column:3;
        justify-self:start;
    }
    .sh-existing-head {
        align-items:stretch;
        flex-direction:column;
    }
    .sh-existing-tools {
        flex-direction:column;
        align-items:stretch;
        min-width:0;
    }
    .sh-existing-tools input,
    .sh-existing-tools select {
        max-width:none;
        min-width:0;
    }
    .sh-existing-row {
        grid-template-columns:24px 1fr;
    }
    .sh-existing-type-pill {
        grid-column:2;
        justify-self:start;
    }
}
.tpl-stale-impact { color:#b42318; font-weight:700; }
