:root {
    --bg: #f4f6f9;
    --surface: #ffffff;
    --text: #172033;
    --muted: #667085;
    --border: #d9dee8;
    --primary: #1f5eff;
    --primary-dark: #1748c9;
    --danger: #b42318;
    --success: #067647;
    --warning: #b54708;
    --shadow: 0 1px 3px rgba(16, 24, 40, .08);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; }
a { color: #174ea6; text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar { min-height: 64px; padding: 0 28px; display: flex; align-items: center; gap: 28px; background: #111827; color: white; box-shadow: var(--shadow); }
.brand { color: white; font-weight: 750; letter-spacing: .01em; font-size: 1.08rem; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.nav { display: flex; align-items: center; gap: 20px; flex: 1; }
.nav a, .user-menu a { color: #dbe4f3; }
.user-menu { display: flex; align-items: center; gap: 16px; font-size: .92rem; }
.container { max-width: 1320px; margin: 0 auto; padding: 26px; min-height: calc(100vh - 120px); }
.page-heading { margin-bottom: 18px; }
h1, h2 { margin: 0; line-height: 1.25; }
h1 { font-size: 1.65rem; }
h2 { font-size: 1.12rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 22px; box-shadow: var(--shadow); margin-bottom: 20px; }
.card-header { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 18px; }
.narrow, .login-card { max-width: 560px; margin-left: auto; margin-right: auto; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.metric { background: white; border: 1px solid var(--border); border-radius: 10px; padding: 20px; box-shadow: var(--shadow); }
.metric strong { display: block; font-size: 1.9rem; }
.metric span { color: var(--muted); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 11px; text-align: left; border-bottom: 1px solid #e7eaf0; vertical-align: top; }
th { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .045em; background: #fafbfc; }
tr:last-child td { border-bottom: 0; }
.form-grid { display: grid; gap: 16px; }
.form-grid.two-column { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.compact { gap: 11px; }
.span-2 { grid-column: 1 / -1; }
label { display: grid; gap: 6px; font-weight: 650; font-size: .9rem; }
input, select, textarea { width: 100%; border: 1px solid #c7ceda; border-radius: 7px; padding: 10px 11px; background: white; color: var(--text); font: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(31, 94, 255, .17); border-color: var(--primary); }
textarea { resize: vertical; }
.checkbox { display: flex; align-items: center; gap: 9px; font-weight: 500; }
.checkbox input { width: auto; }
.help, .muted { color: var(--muted); font-size: .84rem; font-weight: 400; }
.actions, .filters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filters input { min-width: 220px; }
.filters select { width: auto; min-width: 145px; }
.button { display: inline-flex; justify-content: center; align-items: center; border: 1px solid var(--primary); border-radius: 7px; padding: 9px 14px; background: var(--primary); color: white; font-weight: 700; cursor: pointer; font-size: .9rem; }
.button:hover { background: var(--primary-dark); text-decoration: none; }
.button.secondary { background: white; color: #344054; border-color: #c7ceda; }
.button.secondary:hover { background: #f7f8fa; }
.alert { padding: 12px 14px; border-radius: 7px; margin-bottom: 16px; border: 1px solid transparent; }
.alert-error { color: #7a271a; background: #fef3f2; border-color: #fecdca; }
.alert-success { color: #05603a; background: #ecfdf3; border-color: #abefc6; }
.badge { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 999px; font-size: .76rem; font-weight: 750; background: #eef2f7; color: #344054; white-space: nowrap; }
.badge-status-open { background: #eef4ff; color: #3538cd; }
.badge-status-in_progress { background: #fff6ed; color: #b54708; }
.badge-status-waiting_client { background: #fdf2fa; color: #c11574; }
.badge-status-resolved { background: #ecfdf3; color: #067647; }
.badge-status-closed { background: #f2f4f7; color: #475467; }
.badge-priority-low { background: #f2f4f7; color: #475467; }
.badge-priority-normal { background: #eef4ff; color: #3538cd; }
.badge-priority-high { background: #fff6ed; color: #b54708; }
.badge-priority-urgent { background: #fef3f2; color: #b42318; }
.ticket-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 20px; }
.ticket-meta { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; color: var(--muted); margin-bottom: 14px; }
.ticket-main h2 { margin-bottom: 16px; font-size: 1.35rem; }
.ticket-side dl { margin: 0; display: grid; grid-template-columns: 88px 1fr; gap: 10px 12px; }
.ticket-side dt { color: var(--muted); font-size: .84rem; }
.ticket-side dd { margin: 0; }
.prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.timeline { display: grid; gap: 13px; margin-top: 16px; }
.comment { border: 1px solid var(--border); border-radius: 8px; padding: 15px; background: #fbfcfe; }
.comment.internal { background: #fffaeb; border-color: #fedf89; }
.comment header { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .85rem; }
.comment header strong { color: var(--text); }
.attachment { margin: 10px 0 0; }
.empty { color: var(--muted); padding: 12px 0; }
.footer { text-align: center; color: var(--muted); padding: 16px; font-size: .82rem; }
code { background: #f2f4f7; padding: 2px 5px; border-radius: 4px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
@media (max-width: 900px) {
    .topbar { align-items: flex-start; flex-wrap: wrap; padding: 16px 20px; gap: 14px; }
    .nav { order: 3; width: 100%; overflow-x: auto; }
    .user-menu { margin-left: auto; }
    .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ticket-layout { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
    .container { padding: 16px; }
    .metrics, .form-grid.two-column { grid-template-columns: 1fr; }
    .span-2 { grid-column: auto; }
    .card-header { align-items: stretch; flex-direction: column; }
    .filters { align-items: stretch; }
    .filters input, .filters select { width: 100%; min-width: 0; }
    .user-menu span { display: none; }
}

/* Version 2 client workspace */
.client-hero { display: flex; justify-content: space-between; align-items: center; gap: 22px; padding: 24px 26px; margin-bottom: 0; border-radius: 10px 10px 0 0; }
.client-title-line { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.client-title-line h1 { font-size: 1.65rem; }
.client-meta { display: flex; flex-wrap: wrap; gap: 8px 20px; color: var(--muted); margin-top: 8px; font-size: .9rem; }
.client-tabs { display: flex; overflow-x: auto; gap: 0; background: var(--surface); border: 1px solid var(--border); border-top: 0; box-shadow: var(--shadow); margin-bottom: 20px; }
.client-tabs a { display: inline-flex; align-items: center; gap: 7px; color: #475467; padding: 15px 18px 13px; border-bottom: 3px solid transparent; white-space: nowrap; font-weight: 650; font-size: .9rem; }
.client-tabs a:hover { text-decoration: none; background: #fafbfc; color: var(--text); }
.client-tabs a.active { color: var(--text); border-bottom-color: #f43f78; }
.client-tabs a span { display: inline-flex; min-width: 20px; height: 20px; justify-content: center; align-items: center; border-radius: 999px; background: #eef2f7; color: #475467; font-size: .7rem; padding: 0 6px; }
.client-metrics .metric { color: inherit; }
.client-metrics .metric:hover { text-decoration: none; border-color: #aab6ca; }
.overview-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .85fr); gap: 20px; }
.detail-grid { display: grid; grid-template-columns: 130px 1fr; gap: 12px 18px; margin: 0; }
.detail-grid dt { color: var(--muted); font-size: .84rem; }
.detail-grid dd { margin: 0; min-width: 0; }
.compact-list { display: grid; gap: 1px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--border); }
.compact-list a { display: grid; gap: 3px; padding: 12px 14px; background: white; color: var(--text); }
.compact-list a:hover { text-decoration: none; background: #f8fafc; }
.compact-list span { color: var(--muted); font-size: .82rem; }
.compact-button { padding: 5px 8px; font-size: .75rem; }
.vault-secret { display: inline-block; max-width: 300px; overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: #f2f4f7; border-radius: 5px; padding: 4px 7px; }
.vault-secret.revealed { background: #ecfdf3; color: #05603a; }
.vault-buttons { display: flex; gap: 6px; margin-top: 7px; }
.button-error { border-color: var(--danger) !important; color: var(--danger) !important; }
.article-list { display: grid; gap: 14px; }
.article-card { border: 1px solid var(--border); border-radius: 8px; padding: 17px; background: #fbfcfe; }
.article-card h3 { margin: 0 0 5px; font-size: 1rem; }
.article-card p { margin: 8px 0 0; }
.article-preview { color: #344054; }
.checklist-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.checklist-card { display: block; color: var(--text); border: 1px solid var(--border); border-radius: 9px; padding: 17px; background: #fbfcfe; }
.checklist-card:hover { text-decoration: none; border-color: #aab6ca; background: white; }
.checklist-card h3 { margin: 0; font-size: 1rem; }
.checklist-card .card-header { margin-bottom: 8px; }
.progress { height: 8px; border-radius: 999px; background: #e7eaf0; overflow: hidden; margin: 14px 0 8px; }
.progress span { display: block; height: 100%; background: var(--primary); }
.progress.large { height: 12px; }
.checklist-summary { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: .8rem; }
.checklist-items { display: grid; gap: 10px; margin-top: 16px; }
.checklist-item { display: grid; grid-template-columns: auto 1fr auto; align-items: start; gap: 12px; padding: 13px; border: 1px solid var(--border); border-radius: 8px; background: #fbfcfe; }
.checklist-item.completed strong { color: var(--muted); text-decoration: line-through; }
.check-button { display: inline-grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 2px solid #98a2b3; border-radius: 6px; background: white; cursor: pointer; font-weight: 800; line-height: 1; color: white; appearance: none; -webkit-appearance: none; }
.checklist-item.completed .check-button { background: var(--success); border-color: var(--success); }
.link-button { border: 0; background: transparent; color: #174ea6; cursor: pointer; padding: 2px; font: inherit; font-size: .85rem; }
.link-button.danger { color: var(--danger); }
.actions > input { flex: 1; min-width: 220px; }

@media (max-width: 900px) {
    .client-hero { align-items: flex-start; flex-direction: column; }
    .overview-grid { grid-template-columns: 1fr; }
    .checklist-grid { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
    .client-hero { padding: 18px; }
    .client-tabs a { padding-left: 13px; padding-right: 13px; }
    .detail-grid { grid-template-columns: 1fr; gap: 4px; }
    .detail-grid dd { margin-bottom: 10px; }
    .checklist-summary { flex-direction: column; gap: 4px; }
}

/* Version 3 script library */
.page-toolbar { margin-bottom: 18px; }
.page-toolbar h1 { margin: 0 0 4px; }
.page-toolbar p { margin: 0; }
.inline-form { display: inline; }
.script-filters { margin-bottom: 18px; }
.badge-global { background: #ecfdf3; color: #067647; }
.script-type-powershell { background: #eef4ff; color: #3538cd; }
.script-type-cmd { background: #f2f4f7; color: #344054; }
.code-editor, .script-code { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace; tab-size: 4; }
.code-editor { min-height: 420px; line-height: 1.5; white-space: pre; overflow-wrap: normal; overflow-x: auto; }
.assignment-fieldset { border: 1px solid var(--border); border-radius: 9px; padding: 17px; display: grid; gap: 12px; }
.assignment-fieldset legend { font-weight: 750; padding: 0 7px; }
.radio-option { display: flex; grid-template-columns: none; flex-direction: row; align-items: flex-start; gap: 10px; padding: 10px; border: 1px solid var(--border); border-radius: 8px; background: #fbfcfe; }
.radio-option input { width: auto; margin-top: 3px; }
.radio-option span { display: grid; gap: 3px; }
.radio-option small { color: var(--muted); font-weight: 400; }
.client-selector { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.client-selector.is-disabled { opacity: .55; pointer-events: none; }
.client-selector-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; background: #f8fafc; border-bottom: 1px solid var(--border); }
.client-selector-toolbar input { max-width: 360px; }
.client-selector-list { max-height: 310px; overflow-y: auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--border); }
.client-choice { display: flex; grid-template-columns: none; flex-direction: row; align-items: center; gap: 10px; padding: 11px 13px; background: white; font-weight: 600; }
.client-choice[hidden] { display: none; }
.client-choice input { width: auto; }
.client-choice span { display: flex; justify-content: space-between; gap: 10px; width: 100%; }
.client-choice small { color: var(--muted); font-weight: 400; }
.script-details { margin: 20px 0; }
.assigned-client-details { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; margin-bottom: 20px; }
.assigned-client-details summary { cursor: pointer; font-weight: 700; }
.tag-list { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.script-code-header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 24px; }
.script-code-header h2 { margin: 0 0 10px; }
.script-code { background: #101828; color: #f2f4f7; border-radius: 9px; padding: 18px; overflow: auto; max-height: 720px; line-height: 1.5; white-space: pre; }
.script-code code { background: transparent; color: inherit; padding: 0; }

@media (max-width: 760px) {
    .client-selector-list { grid-template-columns: 1fr; }
    .client-selector-toolbar, .script-code-header { align-items: stretch; flex-direction: column; }
    .client-selector-toolbar input { max-width: none; }
}

/* Version 4 invoices */
.invoice-filters { margin-bottom: 18px; }
.invoice-metric-note { margin: -10px 0 18px; }
.badge-invoice-draft { background: #f2f4f7; color: #475467; }
.badge-invoice-sent { background: #eef4ff; color: #3538cd; }
.badge-invoice-partial { background: #fff6ed; color: #b54708; }
.badge-invoice-paid { background: #ecfdf3; color: #067647; }
.badge-invoice-overdue { background: #fef3f2; color: #b42318; }
.badge-invoice-void { background: #f2f4f7; color: #667085; text-decoration: line-through; }
.invoice-items-section { border: 1px solid var(--border); border-radius: 9px; padding: 17px; background: #fbfcfe; }
.invoice-items-section .card-header { margin-bottom: 12px; }
.invoice-items-table input { min-width: 170px; }
.invoice-items-table td:first-child input { min-width: 320px; }
.numeric-column { text-align: right; }
.invoice-number-input { text-align: right; min-width: 120px !important; }
.invoice-line-total { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.invoice-totals-preview { margin: 16px 0 0 auto; width: min(100%, 380px); display: grid; gap: 8px; }
.invoice-totals-preview > div { display: flex; justify-content: space-between; gap: 24px; padding: 5px 0; }
.invoice-grand-total { border-top: 2px solid var(--text); padding-top: 10px !important; font-size: 1.08rem; }
.invoice-page-actions { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.invoice-document { max-width: 1040px; margin-left: auto; margin-right: auto; padding: 42px; }
.invoice-document-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 30px; padding-bottom: 26px; border-bottom: 2px solid var(--text); }
.invoice-brand { font-size: 1.35rem; font-weight: 800; margin-bottom: 8px; }
.invoice-heading-block { text-align: right; display: grid; gap: 7px; justify-items: end; }
.invoice-heading-block h1 { font-size: 2.3rem; letter-spacing: .08em; }
.invoice-heading-block strong { font-size: 1.12rem; }
.invoice-address-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, .7fr); gap: 36px; padding: 28px 0; }
.invoice-address-grid > div { display: grid; gap: 4px; align-content: start; }
.invoice-label { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 7px; }
.invoice-meta-grid { display: grid; grid-template-columns: 130px 1fr; gap: 8px 14px; margin: 0; }
.invoice-meta-grid dt { color: var(--muted); }
.invoice-meta-grid dd { margin: 0; text-align: right; }
.invoice-title { margin: 4px 0 18px; font-size: 1.25rem; }
.invoice-print-table th.numeric-column, .invoice-print-table td.numeric-column { text-align: right; }
.invoice-summary-area { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, .65fr); gap: 40px; margin-top: 28px; }
.invoice-notes { display: grid; gap: 18px; }
.invoice-notes h3 { margin: 0 0 6px; font-size: .95rem; }
.invoice-notes p { margin: 0; }
.invoice-total-grid { display: grid; grid-template-columns: 1fr auto; gap: 10px 24px; margin: 0; align-content: start; }
.invoice-total-grid dt { color: var(--muted); }
.invoice-total-grid dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.invoice-total-row { border-top: 1px solid var(--border); padding-top: 12px; font-weight: 800; color: var(--text) !important; }
.invoice-balance-row { border-top: 2px solid var(--text); padding-top: 12px; font-weight: 850; color: var(--text) !important; font-size: 1.05rem; }
.invoice-document-footer { border-top: 1px solid var(--border); margin-top: 36px; padding-top: 14px; font-size: .78rem; }

@media (max-width: 760px) {
    .invoice-page-actions, .invoice-document-header { align-items: stretch; flex-direction: column; }
    .invoice-heading-block { text-align: left; justify-items: start; }
    .invoice-address-grid, .invoice-summary-area { grid-template-columns: 1fr; }
    .invoice-document { padding: 22px; }
}

@media print {
    body { background: white; }
    .topbar, .footer, .no-print, .alert { display: none !important; }
    .container { max-width: none; padding: 0; }
    .invoice-document { border: 0; box-shadow: none; margin: 0; max-width: none; padding: 0; }
    .invoice-document a { color: inherit; text-decoration: none; }
    .invoice-print-table { font-size: 11pt; }
    @page { margin: 16mm; }
}

/* Version 5 SLA policies and technician alerts */
.topbar-actions { display: flex; align-items: center; gap: 18px; margin-left: auto; }
.alert-center { position: relative; }
.alert-bell { position: relative; width: 40px; height: 40px; display: inline-grid; place-items: center; border: 1px solid rgba(255,255,255,.22); border-radius: 999px; background: rgba(255,255,255,.07); color: white; cursor: pointer; }
.alert-bell:hover { background: rgba(255,255,255,.14); }
.alert-bell svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.alert-bell.has-alerts { background: #b42318; border-color: #fda29b; animation: alert-pulse 1.15s ease-in-out infinite; }
.alert-count { position: absolute; top: -6px; right: -7px; min-width: 21px; height: 21px; display: inline-flex; align-items: center; justify-content: center; padding: 0 6px; border: 2px solid #111827; border-radius: 999px; background: #f04438; color: white; font-size: .67rem; font-weight: 850; }
@keyframes alert-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(240,68,56,.2); transform: scale(1); } 50% { box-shadow: 0 0 0 8px rgba(240,68,56,0); transform: scale(1.06); } }
.alert-panel { position: absolute; z-index: 1000; top: calc(100% + 12px); right: 0; width: min(430px, calc(100vw - 30px)); max-height: 560px; overflow: hidden; border: 1px solid var(--border); border-radius: 11px; background: white; color: var(--text); box-shadow: 0 18px 45px rgba(16,24,40,.22); }
.alert-panel-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 15px 16px; border-bottom: 1px solid var(--border); background: #f8fafc; }
.alert-panel-header > div { display: grid; gap: 2px; }
.alert-panel-header span { color: var(--muted); font-size: .78rem; }
.alert-list { max-height: 470px; overflow-y: auto; }
.alert-list .empty { padding: 22px 16px; margin: 0; text-align: center; }
.alert-item { display: grid; grid-template-columns: 10px 1fr auto; gap: 11px; padding: 14px 14px 13px; border-bottom: 1px solid #eaecf0; }
.alert-item:last-child { border-bottom: 0; }
.alert-severity { width: 10px; height: 10px; margin-top: 5px; border-radius: 999px; background: #98a2b3; }
.alert-item.severity-warning .alert-severity { background: #f79009; }
.alert-item.severity-critical .alert-severity { background: #d92d20; box-shadow: 0 0 0 4px #fee4e2; }
.alert-item-content { min-width: 0; display: grid; gap: 4px; }
.alert-item-content strong { font-size: .9rem; }
.alert-item-content p { margin: 0; color: #475467; font-size: .82rem; line-height: 1.4; }
.alert-item-meta { display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: .75rem; }
.alert-dismiss { align-self: start; border: 0; background: transparent; color: #667085; cursor: pointer; font-size: 1.05rem; line-height: 1; padding: 2px 4px; }
.alert-dismiss:hover { color: var(--danger); }
.alert-toast-stack { position: fixed; z-index: 1200; top: 78px; right: 22px; width: min(420px, calc(100vw - 30px)); display: grid; gap: 12px; pointer-events: none; }
.alert-toast { pointer-events: auto; border: 1px solid #fda29b; border-left: 6px solid #d92d20; border-radius: 10px; padding: 15px 16px; background: white; box-shadow: 0 18px 38px rgba(16,24,40,.22); animation: alert-slide-in .24s ease-out; }
.alert-toast.warning { border-color: #fec84b; border-left-color: #f79009; }
.alert-toast-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.alert-toast h3 { margin: 0; font-size: .98rem; }
.alert-toast p { margin: 7px 0 12px; color: #475467; font-size: .86rem; }
.alert-toast-actions { display: flex; gap: 10px; align-items: center; }
.alert-toast-close { border: 0; background: transparent; cursor: pointer; color: #667085; font-size: 1.15rem; line-height: 1; }
@keyframes alert-slide-in { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: translateX(0); } }

.badge-sla-active { background: #eef4ff; color: #3538cd; }
.badge-sla-warning { background: #fff6ed; color: #b54708; }
.badge-sla-breached { background: #fef3f2; color: #b42318; animation: sla-badge-pulse 1.3s ease-in-out infinite; }
.badge-sla-met { background: #ecfdf3; color: #067647; }
.badge-sla-stopped { background: #f2f4f7; color: #475467; }
.sla-countdown { font-variant-numeric: tabular-nums; margin-left: 4px; }
.row-sla-warning td:first-child { box-shadow: inset 4px 0 0 #f79009; }
.row-sla-breached { background: #fff7f6; }
.row-sla-breached td:first-child { box-shadow: inset 4px 0 0 #d92d20; }
@keyframes sla-badge-pulse { 0%,100% { opacity: 1; } 50% { opacity: .62; } }

.sla-settings { border: 1px solid var(--border); border-radius: 9px; padding: 18px; display: grid; gap: 15px; }
.sla-settings legend { padding: 0 7px; font-weight: 800; }
.sla-toggle { padding-bottom: 13px; border-bottom: 1px solid var(--border); }
.sla-settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.sla-settings-grid.is-disabled { opacity: .5; pointer-events: none; }
.input-group { display: flex; align-items: stretch; gap: 0; }
.input-group input { border-radius: 7px 0 0 7px; }
.input-group select, .input-suffix { width: auto; min-width: 112px; border-left: 0; border-radius: 0 7px 7px 0; }
.input-suffix { display: inline-flex; align-items: center; padding: 0 12px; border: 1px solid #c7ceda; background: #f8fafc; color: #475467; font-weight: 600; }

@media (max-width: 900px) {
    .topbar-actions { margin-left: auto; }
}
@media (max-width: 700px) {
    .sla-settings-grid { grid-template-columns: 1fr; }
    .alert-toast-stack { top: 94px; right: 15px; }
    .alert-panel { position: fixed; top: 72px; right: 15px; left: 15px; width: auto; }
}

/* Version 6 client management */
.client-title-wrap,.client-list-name{display:flex;align-items:center;gap:14px}.client-title-wrap>div{min-width:0}.client-logo{width:72px;height:72px;object-fit:contain;border:1px solid var(--border);border-radius:10px;background:white;padding:6px}.client-logo.small{width:42px;height:42px;border-radius:8px}.custom-fields{border:1px solid var(--border);border-radius:9px;padding:18px}.custom-fields legend{font-weight:750;padding:0 7px}.custom-field-display dd{overflow-wrap:anywhere}.badge-sla-active{background:#ecfdf3;color:#067647}

/* Version 8.1 ticket administration */
.settings-list{display:grid;gap:12px}.settings-row{display:grid;grid-template-columns:minmax(150px,1.4fr) minmax(130px,1fr) 90px 90px repeat(3,minmax(105px,auto)) auto;gap:12px;align-items:end;padding:14px;border:1px solid var(--border);border-radius:9px;background:#fff}.settings-row.priority-row{grid-template-columns:minmax(150px,1.4fr) minmax(130px,1fr) 90px 90px repeat(2,minmax(105px,auto)) auto}.settings-row.new-row{background:#f8fafc;border-style:dashed}.settings-row label{margin:0}.settings-row input[type=color]{min-height:42px;padding:4px}.template-editor{padding:16px 0}.template-editor+.inline-form{margin-top:-8px;margin-bottom:12px}.button.danger{background:#b42318;color:#fff;border-color:#b42318}
@media(max-width:1100px){.settings-row,.settings-row.priority-row{grid-template-columns:repeat(2,minmax(0,1fr))}.settings-row .button{align-self:end}}
@media(max-width:650px){.settings-row,.settings-row.priority-row{grid-template-columns:1fr}}

/* Version 8.3.3 password vault inline icon actions */
.vault-value-inline {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}
.vault-password-inline {
    min-width: max-content;
}
.vault-buttons {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 0;
}
.vault-icon-button {
    min-width: 34px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    line-height: 1;
    white-space: nowrap;
    font-size: .9rem;
}
.vault-value-inline code {
    overflow-wrap: anywhere;
}

/* Version 8.3.4 password form fixes */
.password-form-current-secret {
    min-height: 42px;
}
.password-form-input-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px;
    align-items: center;
}
.password-form-input-row .password-input-toggle {
    height: 42px;
    min-width: 42px;
}

/* Version 8.3.5 single editable password field */
.password-form-secret-field {
    display: grid;
    gap: 8px;
}
.password-form-secret-field > input {
    width: 100%;
}
.password-form-secret-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.password-form-secret-actions .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 92px;
}
.password-form-secret-actions .button-error {
    color: #b42318;
    border-color: #f04438;
    background: #fff5f4;
}

/* Version 8.3.6 password editor side drawer */
.password-drawer-open {
    overflow: hidden;
}
.password-drawer-overlay {
    position: fixed;
    z-index: 3000;
    inset: 0;
    display: flex;
    justify-content: flex-end;
}
.password-drawer-overlay[hidden] {
    display: none;
}
.password-drawer-backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: rgba(15, 23, 42, .34);
    cursor: default;
}
.password-drawer-panel {
    position: relative;
    z-index: 1;
    width: min(500px, 100vw);
    height: 100%;
    background: #fff;
    box-shadow: -18px 0 46px rgba(15, 23, 42, .22);
    animation: password-drawer-slide-in .2s ease-out;
}
.password-drawer-close {
    position: absolute;
    z-index: 3;
    top: 14px;
    right: 16px;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    color: #475467;
    font-size: 1.45rem;
    line-height: 1;
    cursor: pointer;
}
.password-drawer-close:hover {
    background: #f8fafc;
    color: var(--text);
}
.password-drawer-frame {
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
}
@keyframes password-drawer-slide-in {
    from { transform: translateX(28px); opacity: .78; }
    to { transform: translateX(0); opacity: 1; }
}

.password-drawer-document {
    min-height: 100vh;
    margin: 0;
    background: #fff;
}
.password-drawer-content {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 0;
}
.password-editor-header {
    padding: 24px 58px 18px 22px;
    border-bottom: 1px solid var(--border);
    background: #fff;
}
.password-editor-header h2 {
    margin: 0 0 4px;
    font-size: 1.15rem;
}
.password-editor-header p {
    margin: 0;
    font-size: .78rem;
}
.password-editor-form-drawer {
    flex: 1;
    display: block;
    overflow-y: auto;
    padding: 20px 22px 96px;
}
.password-editor-form-drawer > label {
    display: block;
    margin-bottom: 17px;
}
.password-editor-form-drawer input,
.password-editor-form-drawer select,
.password-editor-form-drawer textarea {
    margin-top: 7px;
}
.password-editor-form-drawer .password-form-secret-actions {
    margin-top: 8px;
}
.password-editor-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}
.password-editor-form-drawer .password-editor-actions {
    position: fixed;
    right: 0;
    bottom: 0;
    width: min(500px, 100vw);
    padding: 14px 22px;
    border-top: 1px solid var(--border);
    background: rgba(255, 255, 255, .97);
    box-shadow: 0 -8px 20px rgba(15, 23, 42, .05);
}
.password-editor-form-drawer .password-editor-actions .button {
    min-width: 82px;
}

@media (max-width: 620px) {
    .password-drawer-panel,
    .password-editor-form-drawer .password-editor-actions {
        width: 100vw;
    }
    .password-editor-header {
        padding-left: 18px;
    }
    .password-editor-form-drawer {
        padding-left: 18px;
        padding-right: 18px;
    }
}

/* Version 8.4.0 password people and expandable account groups */
.password-vault-header {
    align-items: flex-start;
}
.password-vault-empty {
    padding: 34px 20px;
    text-align: center;
    border: 1px dashed var(--border);
    border-radius: 10px;
    background: #fbfcfe;
}
.password-vault-empty h3 {
    margin: 0 0 6px;
}
.password-vault-empty p {
    max-width: 620px;
    margin: 0 auto 18px;
}
.password-person-list {
    display: grid;
    gap: 12px;
}
.password-person-group {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
}
.password-person-group > summary {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 66px;
    padding: 12px 16px;
    cursor: pointer;
    list-style: none;
    background: #fbfcfe;
    user-select: none;
}
.password-person-group > summary::-webkit-details-marker {
    display: none;
}
.password-person-group[open] > summary {
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
}
.password-person-chevron {
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 22px;
    color: #667085;
    font-size: 1.45rem;
    line-height: 1;
    transform: rotate(0deg);
    transition: transform .16s ease;
}
.password-person-group[open] .password-person-chevron {
    transform: rotate(90deg);
}
.password-person-avatar {
    width: 40px;
    height: 40px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 40px;
    border-radius: 999px;
    background: #eef4ff;
    color: #3538cd;
    font-weight: 800;
    letter-spacing: .025em;
}
.password-person-unassigned .password-person-avatar {
    background: #fff6ed;
    color: #b54708;
}
.password-person-summary-text {
    min-width: 0;
    display: grid;
    gap: 2px;
}
.password-person-summary-text strong {
    overflow-wrap: anywhere;
}
.password-person-summary-text span {
    color: var(--muted);
    font-size: .84rem;
}
.password-person-body {
    padding: 14px 16px 16px;
}
.password-person-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}
.password-person-table-wrap {
    margin: 0 -16px -16px;
}
.password-person-table-wrap table {
    min-width: 920px;
}
.password-person-table-wrap th:first-child,
.password-person-table-wrap td:first-child {
    padding-left: 16px;
}
.password-person-table-wrap th:last-child,
.password-person-table-wrap td:last-child {
    padding-right: 16px;
}
.password-person-empty {
    margin: 8px 0 2px;
}
.password-unassigned-note {
    margin: 0 0 14px;
}
.password-editor-alert {
    margin: 16px 22px 0;
}
.password-editor-no-people {
    margin: 22px;
    padding: 18px;
    border: 1px dashed var(--border);
    border-radius: 9px;
    background: #fbfcfe;
}
.password-editor-no-people p {
    margin: 0 0 12px;
}

@media (max-width: 700px) {
    .password-vault-header {
        align-items: stretch;
        flex-direction: column;
    }
    .password-vault-header .actions,
    .password-person-actions {
        justify-content: flex-start;
        flex-wrap: wrap;
    }
    .password-person-group > summary {
        padding-left: 12px;
        padding-right: 12px;
    }
    .password-person-body {
        padding-left: 12px;
        padding-right: 12px;
    }
    .password-person-table-wrap {
        margin-left: -12px;
        margin-right: -12px;
    }
}


/* WELMS v8.4.2 password owner selection */
.password-new-person-fields {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--border, #d8dee8);
    border-radius: 10px;
    background: var(--surface-soft, #f8fafc);
}

.password-new-person-fields[hidden] {
    display: none !important;
}

/* WELMS v8.4.3: password vault search */
.password-vault-search {
    margin: 18px 0;
    padding: 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}
.password-vault-search > label {
    display: block;
    margin-bottom: 7px;
    font-weight: 700;
}
.password-vault-search-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.password-vault-search-row input[type="search"] {
    flex: 1 1 auto;
    min-width: 0;
}
.password-vault-search-help {
    margin: 7px 0 0;
    font-size: 0.9rem;
}
.password-vault-no-results {
    margin: 18px 0;
}
.password-person-group[hidden],
.password-search-row[hidden] {
    display: none !important;
}
@media (max-width: 640px) {
    .password-vault-search-row {
        align-items: stretch;
        flex-direction: column;
    }
    .password-vault-search-row .button {
        width: 100%;
    }
}

/* v8.4.4: client logo shown beside the client name on every client section page */
.client-title-line .client-logo-header {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    border-radius: 9px;
    margin-left: 2px;
}
.client-title-line .client-logo-empty {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-style: dashed;
    background: #f8fafc;
    color: #98a2b3;
}
.client-title-line .client-logo-empty svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}
@media (max-width: 640px) {
    .client-title-line .client-logo-header {
        width: 42px;
        height: 42px;
        flex-basis: 42px;
    }
}

/* Version 8.4.5 larger client logo in shared client-page header */
.client-title-line {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}
.client-title-line h1 {
    flex: 0 0 auto;
}
.client-logo.client-logo-header {
    width: 200px;
    height: 92px;
    flex: 0 0 200px;
    object-fit: contain;
    object-position: center;
    padding: 8px;
    border-radius: 10px;
    background: #fff;
}
.client-logo-header.client-logo-empty {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-style: dashed;
}
.client-logo-header.client-logo-empty svg {
    width: 36px;
    height: 36px;
}
.client-status-badges {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

@media (max-width: 760px) {
    .client-logo.client-logo-header {
        width: 150px;
        height: 72px;
        flex-basis: 150px;
    }
    .client-status-badges {
        width: 100%;
    }
}

/* WELMS v8.5.0: general and multi-client knowledge base */
.kb-page-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}
.kb-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.kb-filters {
    margin-bottom: 18px;
}
.kb-filters input[type="search"] {
    flex: 1 1 360px;
}
.kb-library-list {
    margin-top: 4px;
}
.kb-library-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}
.kb-library-card-header > div {
    min-width: 0;
}
.kb-assigned-clients {
    margin-top: 13px;
    border-top: 1px solid var(--border);
    padding-top: 11px;
}
.kb-assigned-clients summary {
    cursor: pointer;
    color: #174ea6;
    font-weight: 700;
    font-size: .86rem;
}
.kb-assigned-clients p {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: .84rem;
}
.kb-general-section {
    padding: 0;
    overflow: hidden;
}
.kb-general-section > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 22px;
    cursor: pointer;
    list-style: none;
    user-select: none;
    background: #fbfcfe;
}
.kb-general-section > summary::-webkit-details-marker {
    display: none;
}
.kb-general-section > summary::before {
    content: "›";
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 22px;
    margin-right: -6px;
    color: #667085;
    font-size: 1.45rem;
    line-height: 1;
    transition: transform .16s ease;
}
.kb-general-section[open] > summary::before {
    transform: rotate(90deg);
}
.kb-general-section > summary > span:first-of-type {
    display: grid;
    gap: 2px;
    flex: 1;
}
.kb-general-section > summary small {
    color: var(--muted);
    font-weight: 400;
}
.kb-general-section[open] > summary {
    border-bottom: 1px solid var(--border);
}
.kb-general-content {
    padding: 20px 22px 22px;
}
.kb-general-article {
    background: #f8fafc;
}
.kb-editor-form .assignment-fieldset {
    margin: 0;
}

@media (max-width: 760px) {
    .kb-page-toolbar,
    .kb-library-card-header {
        align-items: stretch;
        flex-direction: column;
    }
    .kb-metrics {
        grid-template-columns: 1fr;
    }
    .kb-general-section > summary {
        padding: 17px;
    }
    .kb-general-content {
        padding: 17px;
    }
}

/* WELMS Security v2 */
[hidden] { display: none !important; }
button:disabled,
.button:disabled { cursor: not-allowed; opacity: .58; }
.alert-warning { color: #7a2e0e; background: #fffaeb; border-color: #fedf89; }
.badge-success { color: #05603a; background: #ecfdf3; border: 1px solid #abefc6; }
.badge-warning { color: #93370d; background: #fffaeb; border: 1px solid #fedf89; }
.badge-danger { color: #912018; background: #fef3f2; border: 1px solid #fecdca; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.topbar-actions { min-width: 0; }
.user-security-link { display: grid; gap: 0; line-height: 1.2; }
.user-security-link small { color: #9ba9be; font-size: .7rem; }
.security-note { margin: 16px 0 0; color: var(--muted); font-size: .8rem; line-height: 1.55; }

.auth-shell {
    width: min(1120px, 100%);
    min-height: calc(100vh - 180px);
    margin: 20px auto 10px;
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(380px, .8fr);
    align-items: stretch;
    border-radius: 18px;
    overflow: hidden;
    background: #0f172a;
    box-shadow: 0 28px 70px rgba(15, 23, 42, .18);
}
.auth-intro {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(36px, 7vw, 78px);
    color: #fff;
    background:
        radial-gradient(circle at 15% 18%, rgba(86, 144, 255, .32), transparent 34%),
        radial-gradient(circle at 90% 80%, rgba(72, 214, 180, .18), transparent 34%),
        linear-gradient(145deg, #111b33 0%, #172554 52%, #123c54 100%);
}
.security-kicker {
    display: inline-flex;
    align-self: flex-start;
    margin-bottom: 18px;
    border: 1px solid rgba(255,255,255,.24);
    border-radius: 999px;
    padding: 5px 10px;
    color: #bfdbfe;
    background: rgba(255,255,255,.06);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .13em;
}
.auth-intro h1 { max-width: 620px; font-size: clamp(2rem, 4vw, 3.3rem); letter-spacing: -.035em; }
.auth-intro > p { max-width: 600px; margin: 20px 0 28px; color: #cbd5e1; font-size: 1rem; }
.auth-trust-list { display: flex; flex-wrap: wrap; gap: 9px; }
.auth-trust-list span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 999px;
    padding: 7px 11px;
    color: #e2e8f0;
    background: rgba(255,255,255,.06);
    font-size: .78rem;
    font-weight: 650;
}
.auth-trust-list span::before { content: "✓"; color: #6ee7b7; font-weight: 900; }
.auth-shell > .auth-card { margin: 0; border: 0; border-radius: 0; box-shadow: none; }
.auth-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(30px, 5vw, 56px);
}
.auth-card-wide { width: min(680px, 100%); }
.auth-card-heading { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.auth-card-heading h1,
.auth-card-heading h2 { margin-bottom: 3px; font-size: 1.45rem; }
.security-icon {
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    color: #fff;
    background: linear-gradient(145deg, #2563eb, #1748c9);
    box-shadow: 0 9px 20px rgba(31, 94, 255, .24);
    font-weight: 850;
}
.auth-submit { width: 100%; min-height: 44px; margin-top: 3px; }
.auth-checkbox { align-items: flex-start; color: #344054; }
.auth-single { min-height: calc(100vh - 190px); display: grid; place-items: center; padding: 24px 0; }
.auth-single .auth-card { margin: 0; }
.auth-help-row { display: flex; justify-content: space-between; gap: 16px; margin-top: 18px; }
.mfa-code-input { max-width: 320px; font-size: 1.15rem; letter-spacing: .12em; font-variant-numeric: tabular-nums; }

.mfa-setup-grid { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 28px; align-items: center; margin: 6px 0 26px; }
.qr-panel {
    min-height: 268px;
    display: grid;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
    background: #fff;
    box-shadow: inset 0 0 0 7px #f8fafc;
}
.qr-panel img,
.qr-panel canvas { max-width: 100%; height: auto; }
.security-steps { margin: 0 0 20px; padding-left: 22px; color: #344054; }
.security-steps li { margin-bottom: 9px; }
.manual-label { margin: 0 0 7px; color: var(--muted); font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.secret-key { display: block; max-width: 100%; margin-bottom: 10px; padding: 11px 12px; overflow-wrap: anywhere; font-size: .92rem; letter-spacing: .07em; }
.mfa-confirm-form { padding-top: 22px; border-top: 1px solid var(--border); }

.recovery-card { max-width: 720px; }
.recovery-codes {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 22px 0;
}
.recovery-codes code {
    display: block;
    border: 1px solid var(--border);
    padding: 11px 12px;
    background: #f8fafc;
    text-align: center;
    font-size: .95rem;
    font-weight: 750;
    letter-spacing: .08em;
}

.security-summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.security-status-card { display: flex; align-items: center; gap: 14px; margin: 0; min-width: 0; }
.security-status-card > div { min-width: 0; display: grid; gap: 2px; }
.security-status-card strong { overflow-wrap: anywhere; font-size: 1.05rem; }
.security-status-card small { color: var(--muted); font-size: .75rem; }
.security-status-icon {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: #344054;
    background: #f2f4f7;
    font-size: 1rem;
    font-weight: 850;
}
.security-status-icon.is-good { color: #05603a; background: #dcfae6; }
.security-status-icon.is-warning { color: #93370d; background: #fef0c7; }
.policy-banner {
    display: grid;
    gap: 4px;
    margin-bottom: 20px;
    border-left: 4px solid #2563eb;
    border-radius: 8px;
    padding: 14px 16px;
    color: #344054;
    background: #eff6ff;
}
.security-preferences { align-items: end; }
.security-notification-check { min-height: 43px; align-items: center; }
.session-list { display: grid; gap: 10px; }
.session-row {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    background: #fff;
}
.session-row.is-current { border-color: #84adff; box-shadow: inset 3px 0 0 #2563eb; background: #f8fbff; }
.session-device-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    color: #475467;
    background: #f2f4f7;
}
.session-main { min-width: 0; display: grid; gap: 2px; }
.session-main strong,
.session-main span,
.session-main small { overflow-wrap: anywhere; }
.session-main span { color: #475467; font-size: .84rem; }
.session-main small { color: var(--muted); font-size: .75rem; }
.session-state { display: grid; justify-items: end; gap: 6px; }
.security-action-grid .card { margin: 0; }
.danger-zone { border-color: #fecdca; background: #fffafa; }
.password-policy-box {
    display: grid;
    gap: 3px;
    border: 1px solid #bfd2ff;
    border-radius: 9px;
    padding: 13px 15px;
    color: #344054;
    background: #f5f8ff;
}
.password-policy-box span { color: var(--muted); font-size: .82rem; font-weight: 400; }
.settings-check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; border: 1px solid var(--border); border-radius: 9px; padding: 15px; background: #f8fafc; }

.security-metrics { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.security-metrics article {
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 17px;
    background: #fff;
    box-shadow: var(--shadow);
}
.security-metrics span { display: block; color: var(--muted); font-size: .77rem; }
.security-metrics strong { display: block; margin-top: 4px; font-size: 1.65rem; }
.table-subtext { display: block; margin-top: 3px; color: var(--muted); font-size: .72rem; font-weight: 400; }
.security-row-actions { display: flex; flex-wrap: wrap; gap: 5px 10px; min-width: 190px; }
.security-row-actions form { margin: 0; }
.security-user-table td { vertical-align: middle; }

.session-warning-open { overflow: hidden; }
.session-guard {
    position: fixed;
    z-index: 5000;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
}
.session-guard-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .68); backdrop-filter: blur(3px); }
.session-guard-dialog {
    position: relative;
    z-index: 1;
    width: min(480px, 100%);
    border: 1px solid #d0d5dd;
    border-radius: 15px;
    padding: 28px;
    background: #fff;
    box-shadow: 0 30px 80px rgba(15, 23, 42, .32);
    text-align: center;
}
.session-guard-dialog .security-icon { margin: 0 auto 16px; background: linear-gradient(145deg, #f79009, #b54708); }
.session-guard-dialog h2 { margin-bottom: 9px; font-size: 1.35rem; }
.session-guard-dialog p { margin: 8px 0; }
.session-guard-dialog [data-session-countdown] { font-variant-numeric: tabular-nums; }
.session-guard-dialog .actions { justify-content: center; margin-top: 20px; }

@media (max-width: 1180px) {
    .security-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .security-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-intro { padding: 38px; }
    .auth-intro h1 { font-size: 2rem; }
    .auth-shell > .auth-card { min-height: 440px; }
    .mfa-setup-grid { grid-template-columns: 1fr; }
    .qr-panel { width: min(290px, 100%); margin: 0 auto; }
}
@media (max-width: 700px) {
    .grid-2,
    .security-summary-grid,
    .settings-check-grid,
    .recovery-codes { grid-template-columns: 1fr; }
    .security-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .session-row { grid-template-columns: 38px minmax(0, 1fr); align-items: start; }
    .session-state { grid-column: 2; justify-items: start; }
    .auth-card { padding: 28px 22px; }
    .auth-intro { padding: 30px 24px; }
}
@media (max-width: 460px) {
    .security-metrics { grid-template-columns: 1fr; }
    .auth-help-row { align-items: flex-start; flex-direction: column; }
    .session-guard-dialog { padding: 24px 18px; }
}

@media print {
    .topbar,
    .footer,
    .page-heading,
    .recovery-card .actions,
    .security-note,
    .alert-toast-stack,
    .session-guard { display: none !important; }
    body { background: #fff; }
    .container { max-width: none; min-height: 0; padding: 0; }
    .card { border: 0; box-shadow: none; }
    .recovery-codes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Security v2: CSRF-protected sign-out forms styled as navigation links. */
.logout-inline { display: inline-flex; margin: 0; }
.logout-link { border: 0; background: transparent; color: #dbe4f3; cursor: pointer; padding: 0; font: inherit; }
.logout-link:hover { text-decoration: underline; }
.auth-setup-cancel { margin-top: 12px; }

/* WELMS 8.8: client checklist templates and ticket checklist workspace. */
.inline-check { display: flex; grid-template-columns: none; align-items: center; gap: 9px; font-weight: 600; }
.inline-check input { width: auto; flex: 0 0 auto; }
.inline-details { position: relative; }
.inline-details > summary { list-style: none; cursor: pointer; }
.inline-details > summary::-webkit-details-marker { display: none; }
.template-popover-form {
    position: absolute;
    z-index: 40;
    right: 0;
    top: calc(100% + 8px);
    width: min(390px, 82vw);
    display: grid;
    gap: 12px;
    padding: 15px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    box-shadow: 0 18px 45px rgba(15, 23, 42, .18);
}
.template-popover-form textarea { min-height: 90px; }
.template-title-with-status,
.template-summary-title-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.template-title-with-status h2,
.template-summary-title-line h3 { margin: 0; }
.badge-checklist-active,
.badge-checklist-complete { background: #ecfdf3; color: #067647; }
.badge-checklist-inactive { background: #f2f4f7; color: #667085; }
.badge-checklist-open { background: #eef4ff; color: #3538cd; }

.template-card-grid { display: grid; gap: 14px; }
.template-summary-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fbfcfe;
}
.template-summary-card.inactive { background: #f8fafc; opacity: .82; }
.template-summary-card-main { min-width: 0; }
.template-summary-card h3 { font-size: 1.02rem; }
.template-summary-card p { margin: 8px 0 0; overflow-wrap: anywhere; }
.checklist-template-hero .card-header { align-items: flex-start; }
.template-item-tree { display: grid; gap: 11px; }
.template-item {
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fbfcfe;
}
.template-item .template-item { margin: 12px 0 0 28px; background: #fff; }
.template-item-main { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.template-item-text { min-width: 0; overflow-wrap: anywhere; }
.template-item-text strong { font-size: .94rem; font-weight: 700; }
.template-item-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.template-item-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex: 0 0 auto; }
.template-item-additions { margin-top: 12px; }
.template-item-additions > summary,
.ticket-checklist-item-details > summary { color: #174ea6; cursor: pointer; font-size: .84rem; font-weight: 650; }
.template-item-addition-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 12px; }
.checklist-attachment-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 11px; }
.checklist-attachment-list.compact { margin-top: 9px; }
.checklist-attachment-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 9px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #fff;
    font-size: .82rem;
}
.checklist-attachment-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 5px 8px;
    border: 1px solid #d0d5dd;
    border-radius: 999px;
    background: #fff;
    font-size: .78rem;
    overflow-wrap: anywhere;
}
.checklist-attachment-pill span { color: var(--muted); font-size: .72rem; }
.checklist-add-root-form { max-width: 780px; }

.ticket-checklist-card { border-color: #bfd2ff; background: #fbfdff; }
.ticket-checklist-summary,
.ticket-checklist-progress-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}
.ticket-checklist-percent { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.ticket-checklist-progress-copy { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.ticket-checklist-workspace-header .eyebrow { margin: 0 0 6px; color: var(--muted); font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .045em; }
.ticket-checklist-workspace-header h2 { font-size: 1.4rem; }
.ticket-checklist-instance-list { display: grid; gap: 18px; }
.ticket-checklist-instance { margin-bottom: 0; }
.ticket-checklist-instance-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.ticket-checklist-instance-header h3 { margin: 0; font-size: 1.08rem; }
.ticket-checklist-instance-header p { margin: 5px 0 0; }
.ticket-checklist-instance-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.ticket-checklist-tree { display: grid; gap: 10px; margin-top: 14px; }
.ticket-checklist-item {
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 13px;
    background: #fff;
}
.ticket-checklist-item .ticket-checklist-item { margin: 11px 0 0 30px; background: #fbfcfe; }
.ticket-checklist-item-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: flex-start; gap: 12px; }
.ticket-checklist-toggle { padding-top: 1px; }
.check-button.checked,
.checklist-rollup-check.checked,
.ticket-checklist-item.completed > .ticket-checklist-item-row > .ticket-checklist-toggle .check-button { background: var(--success) !important; border-color: var(--success) !important; color: #fff !important; }
.check-button-mark { display: inline-grid; place-items: center; width: 100%; height: 100%; font-size: 1rem; line-height: 1; pointer-events: none; }
.checklist-rollup-check { display: inline-grid; place-items: center; cursor: default; }
.ticket-checklist-item-content { min-width: 0; }
.ticket-checklist-item-title { font-size: .94rem; font-weight: 700; overflow-wrap: anywhere; }
.ticket-checklist-item.completed > .ticket-checklist-item-row > .ticket-checklist-item-content > .ticket-checklist-item-title { color: #667085; text-decoration: line-through; }
.ticket-checklist-item-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 9px; margin-top: 6px; }
.ticket-checklist-edit-tools { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 7px; }
.ticket-checklist-item-details { margin-top: 9px; }
.ticket-checklist-item-details form { margin-top: 10px; max-width: 680px; }
.ticket-checklist-notes { display: grid; gap: 7px; margin-top: 10px; }
.ticket-checklist-note {
    padding: 9px 11px;
    border-left: 3px solid #84adff;
    border-radius: 0 7px 7px 0;
    background: #f5f8ff;
}
.ticket-checklist-note p { margin: 0; font-size: .86rem; overflow-wrap: anywhere; }
.ticket-checklist-note small,
.ticket-checklist-activity-list small { display: block; margin-top: 5px; color: var(--muted); font-size: .74rem; }
.ticket-checklist-add-item-form { margin-top: 16px; padding-top: 16px; border-top: 1px dashed #d0d5dd; }
.ticket-checklist-management { margin-top: 20px; }
.ticket-checklist-lower-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.ticket-checklist-lower-grid > .card { min-width: 0; }
.ticket-checklist-lower-grid summary { cursor: pointer; }
.ticket-checklist-activity-list { display: grid; gap: 9px; margin-top: 14px; max-height: 520px; overflow: auto; }
.ticket-checklist-activity-list article { padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: #fbfcfe; }
.ticket-checklist-activity-list p { margin: 0; overflow-wrap: anywhere; }

@media (max-width: 900px) {
    .template-summary-card,
    .ticket-checklist-instance-header { align-items: stretch; flex-direction: column; }
    .template-item-addition-grid,
    .ticket-checklist-lower-grid { grid-template-columns: 1fr; }
    .ticket-checklist-item-row { grid-template-columns: auto minmax(0, 1fr); }
    .ticket-checklist-edit-tools { grid-column: 2; justify-content: flex-start; }
}
@media (max-width: 620px) {
    .template-item-main { flex-direction: column; }
    .template-item-actions { width: 100%; }
    .template-item .template-item,
    .ticket-checklist-item .ticket-checklist-item { margin-left: 14px; }
    .ticket-checklist-summary,
    .ticket-checklist-progress-row { align-items: flex-start; flex-direction: column; }
    .template-popover-form { position: fixed; inset: 12% 12px auto; width: auto; max-height: 76vh; overflow: auto; }
}

/* WELMS 8.8: undefined checklist library and client assignment workflow. */
.badge-checklist-undefined { background: #fff7ed; color: #9a3412; }
.badge-checklist-assigned { background: #eff6ff; color: #1d4ed8; }
.checklist-library-hero .card-header { align-items: flex-start; }
.checklist-library-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: 16px;
}
.checklist-library-stats > div {
    display: grid;
    gap: 2px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fbfcfe;
}
.checklist-library-stats strong { font-size: 1.45rem; font-variant-numeric: tabular-nums; }
.checklist-library-stats span { color: var(--muted); font-size: .8rem; font-weight: 650; }
.checklist-library-search {
    display: flex;
    align-items: end;
    gap: 10px;
    margin-top: 16px;
}
.checklist-library-search label { flex: 1 1 360px; }
.checklist-library-card { align-items: stretch; }
.checklist-library-card-actions {
    display: grid;
    align-content: center;
    justify-items: end;
    gap: 12px;
    width: min(430px, 46%);
}
.checklist-assignment-form {
    display: grid;
    grid-template-columns: minmax(210px, 1fr) auto;
    align-items: end;
    gap: 9px;
    width: 100%;
    padding-top: 11px;
    border-top: 1px dashed #d0d5dd;
}
.checklist-assignment-form label { min-width: 0; }
.checklist-client-assign-form { max-width: 820px; }

@media (max-width: 1000px) {
    .checklist-library-card-actions { justify-items: stretch; width: 100%; }
    .checklist-library-card-actions > .actions { justify-content: flex-start; }
}
@media (max-width: 760px) {
    .checklist-library-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .checklist-library-search { align-items: stretch; flex-direction: column; }
    .checklist-library-search label { flex-basis: auto; }
    .checklist-assignment-form { grid-template-columns: 1fr; }
}

/* WELMS 8.9: ticket-local checklist snapshots expanded directly on tickets. */
.ticket-checklist-inline {
    margin-top: 4px;
    border: 1px solid #bfd2ff;
    border-radius: 11px;
    background: #fff;
    overflow: visible;
}
.ticket-checklist-inline > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 16px 18px;
    cursor: pointer;
    list-style: none;
    border-radius: 10px;
    background: #f5f8ff;
}
.ticket-checklist-inline > summary::-webkit-details-marker { display: none; }
.ticket-checklist-inline > summary::before {
    content: '▸';
    flex: 0 0 auto;
    color: #174ea6;
    font-size: 1rem;
    transform: translateY(-1px);
    transition: transform .15s ease;
}
.ticket-checklist-inline[open] > summary::before { transform: rotate(90deg) translateX(-1px); }
.ticket-checklist-inline > summary > span:first-of-type {
    display: grid;
    flex: 1 1 auto;
    gap: 3px;
    min-width: 0;
}
.ticket-checklist-inline > summary small {
    color: var(--muted);
    font-size: .8rem;
    font-weight: 500;
}
.ticket-checklist-inline-summary-status {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
}
.ticket-checklist-inline-body { padding: 18px; }
.ticket-checklist-instance-list.inline-on-ticket { margin-top: 18px; }
.ticket-checklist-inline-instance {
    min-width: 0;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fbfcfe;
}
.ticket-checklist-inline-instance .ticket-checklist-tree { margin-bottom: 0; }
.ticket-checklist-inline-options {
    margin-top: 20px;
    border-top: 1px solid var(--border);
}
.ticket-checklist-inline-options > summary {
    padding: 16px 2px 4px;
    cursor: pointer;
    list-style-position: inside;
}
.ticket-checklist-inline-options > summary .muted { margin-left: 6px; font-size: .82rem; font-weight: 500; }
.ticket-checklist-inline-options-body {
    display: grid;
    gap: 20px;
    padding-top: 16px;
}
.ticket-checklist-inline-options-body .ticket-checklist-management { margin-top: 0; }
.ticket-checklist-option-section {
    padding-top: 18px;
    border-top: 1px dashed #d0d5dd;
}
.ticket-checklist-option-section h3 { margin-top: 0; }
.ticket-checklist-copy-note { margin: 9px 0 0; max-width: 780px; }

@media (max-width: 760px) {
    .ticket-checklist-inline > summary { align-items: flex-start; flex-wrap: wrap; padding: 14px; }
    .ticket-checklist-inline-summary-status { width: 100%; padding-left: 24px; }
    .ticket-checklist-inline-body { padding: 14px; }
    .ticket-checklist-inline-instance { padding: 13px; }
    .ticket-checklist-inline-options > summary .muted { display: block; margin: 4px 0 0 18px; }
}

/* WELMS 8.9.2: compact Add checklist launcher on tickets without a checklist. */
.ticket-checklist-add-launcher {
    margin: 0 0 20px;
}
.ticket-checklist-add-launcher > summary {
    width: max-content;
    max-width: 100%;
    gap: 8px;
    list-style: none;
    user-select: none;
}
.ticket-checklist-add-launcher > summary::-webkit-details-marker { display: none; }
.ticket-checklist-add-launcher > summary::before {
    content: '+';
    display: inline-grid;
    place-items: center;
    width: 18px;
    height: 18px;
    border: 1px solid rgba(255, 255, 255, .78);
    border-radius: 50%;
    font-size: .9rem;
    line-height: 1;
}
.ticket-checklist-add-launcher[open] > summary::before { content: '\2212'; }
.ticket-checklist-add-launcher > summary:focus-visible {
    outline: 3px solid rgba(31, 94, 255, .24);
    outline-offset: 3px;
}
.ticket-checklist-create-panel {
    margin-top: 12px;
    margin-bottom: 0;
}
.ticket-checklist-create-panel .card-header { align-items: flex-start; }

@media (max-width: 760px) {
    .ticket-checklist-add-launcher > summary { width: 100%; }
    .ticket-checklist-create-panel { padding: 18px; }
}

/* WELMS 8.9.4: quick contact creation from the New Ticket form. */
.ticket-contact-field {
    display: grid;
    gap: 6px;
    min-width: 0;
}
.ticket-contact-field > label {
    display: block;
}
.ticket-contact-control-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 9px;
    align-items: start;
}
.ticket-new-contact-button {
    min-height: 42px;
    white-space: nowrap;
}
.ticket-contact-dialog {
    width: min(720px, calc(100% - 32px));
    max-height: calc(100vh - 40px);
    margin: auto;
    padding: 22px;
    overflow: auto;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 24px 60px rgba(16, 24, 40, .28);
}
.ticket-contact-dialog::backdrop {
    background: rgba(15, 23, 42, .58);
    backdrop-filter: blur(2px);
}
.ticket-contact-dialog-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}
.ticket-contact-dialog-header h2 {
    margin: 0 0 5px;
}
.ticket-contact-dialog-header p {
    margin: 0;
}
.ticket-contact-dialog-close {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: #475467;
    cursor: pointer;
    font-size: 1.55rem;
    line-height: 1;
}
.ticket-contact-dialog-close:hover {
    background: #f7f8fa;
    color: var(--text);
}
.ticket-contact-primary {
    min-height: 42px;
    align-self: end;
}
.ticket-contact-dialog-actions {
    margin-top: 2px;
}

@media (max-width: 620px) {
    .ticket-contact-control-row {
        grid-template-columns: 1fr;
    }
    .ticket-new-contact-button {
        width: 100%;
    }
    .ticket-contact-dialog {
        width: calc(100% - 20px);
        max-height: calc(100vh - 20px);
        padding: 18px;
    }
    .ticket-contact-dialog-header {
        gap: 10px;
    }
}
.secure-share-ticket-control{display:flex;gap:.75rem;align-items:end;flex-wrap:wrap;padding:1rem;border:1px solid var(--border-color,#dbe2ea);border-radius:.6rem;background:#f8fafc}.secure-share-ticket-control label{min-width:260px;flex:1}.secure-share-view{max-width:760px;margin:3rem auto}.secure-share-secret{display:flex;gap:1rem;align-items:center}.secure-share-secret code{display:block;flex:1;padding:1.25rem;font-size:1.1rem;overflow-wrap:anywhere;background:#f1f5f9;border-radius:.5rem}

/* Public secure-password viewer */
.secure-share-view {
    max-width: 700px;
    margin: 3rem auto;
    padding: clamp(1.5rem, 4vw, 2.25rem);
    border-radius: 12px;
}
.secure-share-view > h1 {
    margin: 0 0 1.5rem;
    text-align: center;
    color: #12345b;
    font-size: clamp(1.75rem, 4vw, 2.1rem);
}
.secure-share-label {
    margin: -0.4rem 0 1rem;
    text-align: center;
    color: var(--muted, #667085);
    font-weight: 600;
}
.secure-share-secret-panel {
    min-height: 90px;
    display: flex;
    align-items: center;
    padding: 1.25rem;
    border-left: 4px solid #2384c6;
    border-radius: 6px;
    background: #f6f8fa;
}
.secure-share-secret-panel code {
    display: block;
    width: 100%;
    color: #111827;
    background: transparent;
    font-size: 1rem;
    line-height: 1.6;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}
.secure-share-copy-button {
    margin-top: 1rem;
    background: #28a745;
    border-color: #28a745;
}
.secure-share-copy-button:hover,
.secure-share-copy-button:focus-visible {
    background: #218838;
    border-color: #1e7e34;
}
.secure-share-meta {
    margin: 3rem 0 1.5rem;
}
.secure-share-meta > div {
    display: grid;
    grid-template-columns: minmax(150px, 0.8fr) minmax(0, 1.7fr);
    gap: 1rem;
    padding: 0.18rem 0;
}
.secure-share-meta dt {
    font-weight: 700;
    color: #111827;
}
.secure-share-meta dd {
    margin: 0;
    color: #1f2937;
}
.secure-share-expiry-notice {
    padding: 1rem;
    border-radius: 7px;
    background: #fff3cd;
    color: #8a5a00;
    line-height: 1.55;
}
.secure-share-error {
    margin-bottom: 0;
}
@media (max-width: 560px) {
    .secure-share-view {
        margin: 1.25rem auto;
    }
    .secure-share-meta > div {
        grid-template-columns: 1fr;
        gap: 0.1rem;
        padding: 0.45rem 0;
    }
}
.secure-share-reveal-form {
    margin-top: 1rem;
}
.secure-share-load-status {
    margin: 0.75rem 0 0;
    color: var(--muted, #667085);
    font-size: 0.92rem;
}
.secure-share-reveal-error {
    margin-top: 1rem;
    margin-bottom: 0;
}

/* Administration hub */
.admin-section-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 0 20px;
}
.admin-section-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    font-weight: 650;
    box-shadow: var(--shadow);
}
.access-user-list { display: grid; gap: 12px; }
.access-user-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fbfcfe;
    overflow: hidden;
}
.access-user-card > summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding: 16px 18px;
    cursor: pointer;
    list-style: none;
}
.access-user-card > summary::-webkit-details-marker { display: none; }
.access-user-card > summary::after {
    content: '+';
    flex: 0 0 auto;
    font-size: 1.35rem;
    color: var(--muted);
}
.access-user-card[open] > summary::after { content: '−'; }
.access-user-card > summary > span:first-child { display: grid; gap: 2px; }
.access-user-card > summary small { color: var(--muted); font-weight: 400; }
.access-user-summary-meta {
    margin-left: auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    color: var(--muted);
    font-size: .9rem;
}
.access-permission-form {
    padding: 0 18px 18px;
    border-top: 1px solid var(--border);
}
.permission-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    padding: 18px 0;
}
.permission-option {
    display: grid;
    gap: 6px;
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    cursor: pointer;
}
.permission-option-title { display: flex; align-items: center; gap: 9px; }
.permission-option-title input { width: auto; margin: 0; }
.permission-option small { color: var(--muted); line-height: 1.35; }
.permission-unavailable { opacity: .58; cursor: not-allowed; background: #f3f4f6; }
.import-template-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.import-template-grid article {
    min-width: 0;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fbfcfe;
}
.import-template-grid h3 { margin: 0 0 10px; font-size: 1rem; }
.import-template-grid code {
    display: block;
    max-width: 100%;
    overflow-wrap: anywhere;
    white-space: normal;
    padding: 10px;
    border-radius: 6px;
    background: #eef2f7;
    font-size: .78rem;
    line-height: 1.45;
}
.admin-import-form { max-width: 900px; }

@media (max-width: 980px) {
    .permission-grid, .import-template-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 680px) {
    .access-user-card > summary { align-items: flex-start; }
    .access-user-summary-meta { display: grid; justify-items: end; }
    .permission-grid, .import-template-grid { grid-template-columns: 1fr; }
}
.access-reset-form { padding: 0 18px 18px; }

/* Gestion orders inside the client workspace */
.client-order-metrics .metric { color: inherit; }
.client-order-metrics .metric:hover { text-decoration: none; border-color: #aab6ca; }
.client-order-filters { margin-bottom: 18px; }
.client-order-description { min-width: 260px; max-width: 430px; }
.client-order-description .muted { margin-top: 4px; }
.client-orders-table { min-width: 1320px; }
.client-orders-table td { font-size: .88rem; }
.badge-order-open { background: #eef4ff; color: #3538cd; }
.badge-order-ready { background: #fff6ed; color: #b54708; }
.badge-order-completed { background: #ecfdf3; color: #067647; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 18px; color: var(--muted); }

@media (max-width: 620px) {
    .client-orders-heading { align-items: stretch; }
    .pagination { justify-content: space-between; }
}

/* WELMS 8.98: fixed left application navigation. */
:root { --app-sidebar-width: 244px; }

body.has-sidebar {
    min-height: 100vh;
    padding-left: var(--app-sidebar-width);
}

.has-sidebar .app-sidebar {
    position: fixed;
    z-index: 1100;
    inset: 0 auto 0 0;
    width: var(--app-sidebar-width);
    height: 100vh;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0 14px 16px;
    overflow: visible;
    background: #111827;
    color: #fff;
    box-shadow: 5px 0 18px rgba(15, 23, 42, .12);
}

.sidebar-header {
    min-height: 78px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,.1);
}

.has-sidebar .brand {
    min-width: 0;
    white-space: normal;
    line-height: 1.25;
}

.has-sidebar .nav {
    order: initial;
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 3px;
    padding: 14px 0;
    overflow-x: hidden;
    overflow-y: auto;
}

.has-sidebar .nav a {
    display: flex;
    align-items: center;
    min-height: 38px;
    padding: 8px 11px;
    border-radius: 7px;
    color: #dbe4f3;
    font-size: .88rem;
    font-weight: 620;
    line-height: 1.25;
}

.has-sidebar .nav a:hover,
.has-sidebar .nav a.active,
.has-sidebar .nav a[aria-current="page"] {
    color: #fff;
    background: rgba(255,255,255,.1);
    text-decoration: none;
}

.has-sidebar .nav .sidebar-menu-group {
    width: 100%;
    margin: 0;
}

.has-sidebar .nav .sidebar-menu-group > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 38px;
    padding: 8px 11px;
    border-radius: 7px;
    color: #dbe4f3;
    font-size: .88rem;
    font-weight: 620;
    line-height: 1.25;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.has-sidebar .nav .sidebar-menu-group > summary::-webkit-details-marker { display: none; }
.has-sidebar .nav .sidebar-menu-group > summary::after {
    content: '\203A';
    flex: 0 0 auto;
    font-size: 1.15rem;
    line-height: 1;
    opacity: .75;
    transition: transform .15s ease;
}
.has-sidebar .nav .sidebar-menu-group[open] > summary::after { transform: rotate(90deg); }
.has-sidebar .nav .sidebar-menu-group > summary:hover,
.has-sidebar .nav .sidebar-menu-group.is-current > summary {
    color: #fff;
    background: rgba(255,255,255,.1);
}

.has-sidebar .nav .sidebar-subnav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 3px 0 5px 11px;
    padding: 2px 0 2px 10px;
    border-left: 1px solid rgba(255,255,255,.16);
}

.has-sidebar .nav .sidebar-subnav a {
    min-height: 31px;
    padding: 6px 9px;
    border-radius: 6px;
    color: #aebbd0;
    font-size: .80rem;
    font-weight: 560;
}

.has-sidebar .nav .sidebar-subnav a:hover,
.has-sidebar .nav .sidebar-subnav a.is-active,
.has-sidebar .nav .sidebar-subnav a[aria-current="page"] {
    color: #fff;
    background: rgba(255,255,255,.08);
}

.has-sidebar .topbar-actions {
    width: 100%;
    min-width: 0;
    display: grid;
    align-items: stretch;
    gap: 10px;
    margin: 0;
    padding-top: 14px;
    border-top: 1px solid rgba(255,255,255,.1);
}

.has-sidebar .alert-center { width: 100%; }
.has-sidebar .alert-bell {
    width: 100%;
    height: auto;
    min-height: 40px;
    display: flex;
    justify-content: flex-start;
    gap: 10px;
    padding: 8px 11px;
    border-radius: 7px;
}
.has-sidebar .alert-bell svg { flex: 0 0 21px; }
.alert-bell-label { font-size: .88rem; font-weight: 650; }
.has-sidebar .alert-count {
    top: 8px;
    right: 9px;
    border-color: #111827;
}
.has-sidebar .alert-panel {
    top: auto;
    right: auto;
    bottom: 0;
    left: calc(100% + 12px);
}

.has-sidebar .user-menu {
    width: 100%;
    display: grid;
    align-items: stretch;
    gap: 5px;
    margin: 0;
}
.has-sidebar .user-security-link,
.has-sidebar .logout-link {
    width: 100%;
    border-radius: 7px;
    padding: 8px 11px;
    text-align: left;
}
.has-sidebar .user-security-link:hover,
.has-sidebar .logout-link:hover {
    background: rgba(255,255,255,.08);
    text-decoration: none;
}
.has-sidebar .logout-inline { width: 100%; }

.mobile-appbar,
.sidebar-backdrop,
.sidebar-close { display: none; }

.has-sidebar .container {
    width: 100%;
    max-width: 1320px;
}

@media (max-width: 900px) {
    body.has-sidebar {
        padding-left: 0;
        padding-top: 62px;
    }

    .has-sidebar .app-sidebar {
        width: min(290px, 88vw);
        padding: 0 14px 16px;
        transform: translateX(-105%);
        transition: transform .2s ease;
        box-shadow: 14px 0 38px rgba(15, 23, 42, .3);
    }

    body.sidebar-open .app-sidebar { transform: translateX(0); }

    .mobile-appbar {
        position: fixed;
        z-index: 1050;
        inset: 0 0 auto 0;
        height: 62px;
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 0 16px;
        background: #111827;
        box-shadow: var(--shadow);
    }

    .sidebar-mobile-toggle,
    .sidebar-close {
        width: 38px;
        height: 38px;
        display: inline-grid;
        place-items: center;
        flex: 0 0 38px;
        border: 1px solid rgba(255,255,255,.2);
        border-radius: 7px;
        background: rgba(255,255,255,.07);
        color: #fff;
        cursor: pointer;
        font: inherit;
        font-size: 1.25rem;
    }

    .sidebar-close { font-size: 1.6rem; line-height: 1; }
    .mobile-brand { color: #fff; font-weight: 750; }
    .mobile-brand:hover { text-decoration: none; }

    .sidebar-backdrop {
        position: fixed;
        z-index: 1075;
        inset: 0;
        width: 100%;
        height: 100%;
        border: 0;
        padding: 0;
        background: rgba(15, 23, 42, .55);
        cursor: default;
    }
    body.sidebar-open .sidebar-backdrop { display: block; }
    body.sidebar-open { overflow: hidden; }

    .has-sidebar .alert-panel {
        position: fixed;
        top: 72px;
        right: 15px;
        bottom: auto;
        left: 15px;
        width: auto;
    }
    .has-sidebar .alert-toast-stack { top: 76px; }
}

@media (max-width: 620px) {
    .mobile-appbar { padding: 0 12px; }
    .mobile-brand { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

@media print {
    body.has-sidebar { padding: 0; }
    .mobile-appbar,
    .sidebar-backdrop { display: none !important; }
}

/* WELMS 8.98: same-origin Gestion and Domains application shell. */
body.legacy-shell-page {
    overflow: hidden;
}

.legacy-shell-page .container {
    width: 100%;
    max-width: none;
    height: 100vh;
    min-height: 0;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.legacy-shell-page .container > .alert {
    flex: 0 0 auto;
    margin: 12px 14px 0;
}

.legacy-shell-page .footer {
    display: none;
}

.legacy-app-shell {
    width: 100%;
    height: auto;
    min-height: 0;
    flex: 1 1 auto;
    overflow: hidden;
    background: #fff;
}

.legacy-app-frame {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
}

@media (max-width: 900px) {
    .legacy-shell-page .container {
        height: calc(100vh - 62px);
    }
}

@media print {
    body.legacy-shell-page { overflow: visible; }
    .legacy-shell-page .container,
    .legacy-app-shell,
    .legacy-app-frame { height: auto; min-height: 100vh; }
}

/* v10.12 device connectivity status colors */
.badge-online {
    background: #ecfdf3;
    color: #067647;
    border: 1px solid #abefc6;
}

.badge-offline {
    background: #fef3f2;
    color: #b42318;
    border: 1px solid #fecdca;
}


/* WELMS v10.14 - dashboard-style inline ticket dropdown badges */
.ticket-inline-form {
    display: inline-flex;
    align-items: center;
    margin: 0;
}
.ticket-inline-select {
    width: auto;
    min-width: 0;
    max-width: 150px;
    min-height: 28px;
    padding: 4px 28px 4px 10px;
    border-radius: 999px;
    font-size: .76rem;
    font-weight: 750;
    line-height: 1.2;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 12px 12px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M6 8l4 4 4-4' stroke='%23667085' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    box-shadow: none;
}
.ticket-inline-select.ticket-inline-colored {
    color: var(--ticket-pill-color, #475569);
    background-color: var(--ticket-pill-bg, #f2f4f7);
    border-color: var(--ticket-pill-border, #d0d5dd);
}
.ticket-inline-select.ticket-inline-assigned {
    color: #475467;
    background-color: #f8fafc;
    border-color: #d0d5dd;
    font-weight: 700;
}
.ticket-inline-select:hover {
    filter: brightness(.98);
}
.ticket-inline-select:focus {
    outline: 2px solid rgba(31, 94, 255, .16);
    outline-offset: 1px;
    border-color: var(--ticket-pill-color, #98a2b3);
}
.ticket-inline-select option {
    color: #172033;
    background: #fff;
    font-weight: 500;
}
@media (max-width: 900px) {
    .ticket-inline-select { max-width: 132px; }
}


/* WELMS v10.15 - Atera-inspired ticket queue */
.ticket-queue-card {
    padding: 0;
    overflow: hidden;
}
.ticket-queue-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 20px;
    border-bottom: 1px solid #e7eaf0;
    background: #fff;
}
.ticket-queue-filters {
    flex: 1 1 auto;
}
.ticket-queue-filters input {
    flex: 0 1 390px;
}
.ticket-queue-empty {
    padding: 24px 20px;
    margin: 0;
}
.ticket-queue-wrap {
    overflow-x: auto;
}
.ticket-queue-table {
    min-width: 1050px;
    table-layout: fixed;
    background: #fff;
}
.ticket-queue-table thead th {
    height: 42px;
    padding: 10px 14px;
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
    color: #475467;
    font-size: .75rem;
    font-weight: 650;
    text-transform: none;
    letter-spacing: 0;
    vertical-align: middle;
}
.ticket-queue-table thead th:nth-child(1) { width: 76px; }
.ticket-queue-table thead th:nth-child(2) { width: 41%; }
.ticket-queue-table thead th:nth-child(3) { width: 15%; }
.ticket-queue-table thead th:nth-child(4) { width: 19%; }
.ticket-queue-table thead th:nth-child(5) { width: 10%; }
.ticket-queue-table thead th:nth-child(6) { width: 15%; }
.ticket-queue-table td {
    padding: 15px 14px;
    border-bottom: 1px solid #e9edf2;
    vertical-align: middle;
    background: transparent;
}
.ticket-queue-table tbody tr:last-child td {
    border-bottom: 0;
}
.ticket-queue-row {
    min-height: 88px;
    background: #fff;
}
.ticket-queue-row:hover {
    background: #fbfcfe;
}
.ticket-queue-row.row-sla-breached {
    background: #fffaf9;
}
.ticket-queue-row.row-sla-warning {
    background: #fffcf5;
}
.ticket-queue-row.row-sla-breached td:first-child {
    box-shadow: inset 3px 0 0 #ef4444;
}
.ticket-queue-row.row-sla-warning td:first-child {
    box-shadow: inset 3px 0 0 #f59e0b;
}
.ticket-customer-column,
.ticket-customer-cell {
    text-align: center;
}
.ticket-customer-logo {
    width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid #d8dee8;
    border-radius: 6px;
    background: #fff;
    color: #475467;
    font-size: .88rem;
    font-weight: 650;
    line-height: 1;
}
.ticket-customer-logo:hover {
    text-decoration: none;
    border-color: #b7c0ce;
}
.ticket-customer-logo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 4px;
}
.ticket-details-cell {
    min-width: 360px;
}
.ticket-details-title {
    display: flex;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
    margin-bottom: 5px;
}
.ticket-number-link {
    flex: 0 0 auto;
    color: #667085;
    font-size: .78rem;
    font-weight: 500;
}
.ticket-subject-link {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #101828;
    font-weight: 700;
}
.ticket-subject-link:hover {
    color: #174ea6;
}
.ticket-details-client,
.ticket-details-meta {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    color: #667085;
    font-size: .78rem;
    line-height: 1.45;
}
.ticket-details-client {
    margin-bottom: 3px;
}
.ticket-details-client a {
    color: #1685e6;
    font-weight: 500;
}
.ticket-details-client > span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ticket-details-meta {
    color: #7b8494;
}
.ticket-sla-cell .badge {
    white-space: normal;
    line-height: 1.25;
}
.ticket-technician-control {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
}
.ticket-technician-avatar {
    width: 25px;
    height: 25px;
    flex: 0 0 25px;
    display: inline-grid;
    place-items: center;
    border: 1px solid #d0d5dd;
    border-radius: 999px;
    background: #f8fafc;
    color: #667085;
    font-size: .57rem;
    font-weight: 700;
}
.ticket-technician-control .ticket-inline-form {
    min-width: 0;
    max-width: calc(100% - 32px);
}
.ticket-inline-select.ticket-inline-minimal {
    min-height: 28px;
    padding: 3px 24px 3px 2px;
    border: 0;
    border-radius: 0;
    background-color: transparent;
    box-shadow: none;
    font-size: .79rem;
    font-weight: 500;
    background-position: right 4px center;
}
.ticket-inline-select.ticket-inline-minimal:hover {
    background-color: #f8fafc;
}
.ticket-inline-select.ticket-inline-minimal:focus {
    outline: 1px solid #b9cdfc;
    outline-offset: 1px;
    border-color: transparent;
}
.ticket-inline-select.ticket-inline-assigned {
    max-width: 165px;
    color: #101828;
}
.ticket-inline-select.ticket-inline-priority {
    max-width: 100px;
    color: var(--ticket-pill-color, #101828);
}
.ticket-status-pill {
    max-width: 165px;
    min-height: 30px;
    padding: 4px 29px 4px 11px;
    font-size: .77rem;
    font-weight: 600;
}
.ticket-readonly-value {
    color: #101828;
    font-size: .79rem;
}

@media (max-width: 1180px) {
    .ticket-queue-table { min-width: 980px; }
    .ticket-queue-table thead th:nth-child(2) { width: 38%; }
    .ticket-queue-table thead th:nth-child(4) { width: 20%; }
}

@media (max-width: 760px) {
    .ticket-queue-toolbar {
        align-items: stretch;
        flex-direction: column;
    }
    .ticket-queue-filters {
        align-items: stretch;
    }
    .ticket-queue-filters input,
    .ticket-queue-filters select,
    .ticket-queue-filters .button {
        width: 100%;
        min-width: 0;
    }
}
