/* Client workspace. Loaded last; uses the operator workspace's visual language. */
.form-card .similar-tickets-notice { margin: 0 0 20px; padding: 16px 20px; border: 1px solid var(--accent-line); border-left: 5px solid var(--primary); border-radius: 9px; background: var(--accent-soft); color: var(--accent-text); font-size: clamp(18px,2.5vw,24px); font-weight: 800; line-height: 1.4; overflow-wrap: anywhere; }
.form-card .similar-tickets-notice[hidden] { display: none; }
.topbar nav .nav-unread-count { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: #dc2626; color: #fff; font-size: 11px; font-weight: 700; line-height: 1; flex-shrink: 0; }
.topbar nav .nav-unread-count[hidden] { display: none; }
.topbar nav .nav-shared-count { font-size: 11px; min-width: 20px; text-align: center; color: var(--muted); }
.knowledge-suggestions { margin: 12px 0 18px; padding: 14px 18px; border: 1px solid var(--accent-line); border-radius: 10px; background: var(--accent-soft); overflow-wrap: anywhere; }
.knowledge-suggestions[hidden] { display: none; }
.knowledge-suggestions ul { margin: 6px 0 0; padding-left: 20px; }
.knowledge-suggestions li { margin: 6px 0; }
.knowledge-suggestions a { display: inline-block; padding: 3px 0; }
:root {
  --primary: #2563eb; --primary2: #1d4ed8; --text: #33455f; --muted: #65768d;
  --line: #e1e7f0; --card: #fff; --bg: #f3f6fa; --soft: #f7f9fc;
  --accent-soft: #edf4ff; --accent-line: #d4e3fb; --accent-text: #285cb5;
  --danger-soft: #fff3f4; --danger-line: #f0d1d7; --danger-text: #a33348;
  --shadow: 0 3px 12px #243b5305; --radius: 12px;
  font-family: 'Segoe UI', Arial, sans-serif; background: var(--bg); color-scheme: light;
}
body { background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.55; transition: none; }
h1, h2, h3 { color: var(--text); }
body.dark {
  --primary: #3978ef; --primary2: #4c86f4; --text: #dce6f5; --muted: #a2b2c9;
  --line: #2c3d55; --card: #172235; --bg: #101a2a; --soft: #1c2a40;
  --accent-soft: #203657; --accent-line: #365684; --accent-text: #a8caff;
  --danger-soft: #382633; --danger-line: #684252; --danger-text: #ffb4c2;
  background: var(--bg); color: var(--text); color-scheme: dark;
}
body, input, select, textarea, button { font-family: 'Segoe UI', Arial, sans-serif; }
* { scrollbar-width: thin; scrollbar-color: #aebdd0 transparent; }
::selection { background: #cbdfff; color: #173e80; }
a { color: var(--accent-text); text-underline-offset: 3px; }
button, a, input, select, textarea, .paperclip { -webkit-tap-highlight-color: transparent; }
button, .hero-actions>button {
  min-height: 40px; padding: 9px 15px; border: 1px solid transparent; border-radius: 8px;
  background: var(--primary); color: #fff; font-size: 13px; font-weight: 600;
  box-shadow: none; transition: background .15s, border-color .15s; cursor: pointer;
}
button:hover { background: var(--primary2); transform: none; }
button:disabled { opacity: .55; cursor: not-allowed; }
button.secondary, .secondary, body.dark .secondary {
  background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 15px; box-shadow: none; font-weight: 600; text-decoration: none;
}
.secondary:hover, body.dark .secondary:hover { background: var(--soft); border-color: var(--accent-line); color: var(--accent-text); }
button:focus-visible, a:focus-visible, summary:focus-visible, .paperclip:focus-visible { outline: 3px solid #8fb4f6; outline-offset: 3px; }
input, select, textarea {
  width: 100%; min-width: 0; min-height: 40px; padding: 9px 11px; margin: 0;
  border: 1px solid var(--line); border-radius: 8px; background: var(--card);
  color: var(--text); font-size: 14px; font-weight: 400; box-shadow: none;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input:focus, select:focus, textarea:focus, body.dark input:focus, body.dark select:focus, body.dark textarea:focus {
  border-color: #8aaff1; outline: none; box-shadow: 0 0 0 3px #2563eb15;
}
textarea { resize: vertical; line-height: 1.6; }
body.dark input, body.dark select, body.dark textarea { background: var(--soft); color: var(--text); }
body.dark .chat { background: var(--soft); }
body.dark .auth-screen { background: var(--bg); }
body.dark .operator-pill { background: var(--soft); color: var(--muted); }
body.dark .list .ticket b { color: var(--accent-text); }
label { color: var(--text); }
.portal-icon { display: block; width: 18px; height: 18px; flex: 0 0 18px; }
.topbar, body.dark .topbar {
  position: relative; top: 0; max-width: none; min-height: 68px; height: auto; margin: 0;
  padding: 12px max(24px,calc((100% - 1240px)/2)); gap: 16px;
  background: var(--card); border: 0; border-bottom: 1px solid var(--line);
  border-radius: 0; box-shadow: none; flex-wrap: wrap; justify-content: flex-start;
}
.brand { flex-shrink: 0; gap: 12px; }
.topbar .brand-logo { width: 88px; max-height: 32px; }
.brand-caption { border-left: 1px solid var(--line); padding-left: 12px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.brand-caption b { display: block; font-size: 12px; color: var(--text); font-weight: 600; }
.topbar nav { display: flex; flex-wrap: wrap; gap: 4px; }
.topbar nav a { display: flex; align-items: center; gap: 7px; padding: 8px 10px; border: 1px solid transparent; border-radius: 8px; color: var(--muted); font-size: 13px; font-weight: 500; }
.topbar nav a:hover, .topbar nav a.active, body.dark nav a:hover, body.dark nav a.active { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent-line); }
.account-controls { display: flex; align-items: center; gap: 8px; margin-left: auto; min-width: 0; }
.topbar .user-badge { flex: initial; flex-basis: auto; max-width: 155px; font-weight: 500; font-size: 11px; overflow-wrap: anywhere; }
.topbar .small { min-height: 36px; padding: 7px 9px; font-size: 11px; white-space: nowrap; }
.theme-toggle, body.dark .theme-toggle { display: grid; place-items: center; flex: 0 0 36px; width: 36px; height: 36px; min-height: 36px; padding: 8px; border: 1px solid var(--line); background: var(--card); color: var(--muted); border-radius: 8px; }
.theme-toggle span, body.dark .theme-toggle span { position: static; transform: none; opacity: 1; transition: none; }
.theme-toggle .sun { display: none; }.theme-toggle .moon { display: block; transform: none; opacity: 1; }
body.dark .theme-toggle .sun { display: block; transform: none; opacity: 1; }body.dark .theme-toggle .moon { display: none; }
main { width: 100%; max-width: 1288px; margin: 26px auto; padding: 0 24px 32px; }
.page { min-width: 0; animation: none; }
.card, .quick-card, .auth-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 24px; box-shadow: var(--shadow); }
.hero { display: grid; grid-template-columns: minmax(0,1.35fr) minmax(320px,.85fr); gap: 20px; padding: 0; align-items: stretch; }
.hero-copy, body.dark .hero-copy { position: relative; min-width: 0; padding: 32px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.hero-copy::after { display: none; }
.eyebrow, .section-head>span, .section-head>div>span, body.dark .eyebrow, body.dark .section-head span {
  display: inline-block; padding: 0; border-radius: 0; background: transparent;
  color: var(--accent-text); font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
}
.hero-copy h1 { margin: 18px 0 14px; max-width: 560px; font-size: clamp(28px,3vw,40px); font-weight: 650; line-height: 1.18; letter-spacing: -.035em; color: var(--text); background: none; -webkit-text-fill-color: currentColor; }
.hero-copy>p { font-size: 14px; line-height: 1.8; max-width: 500px; color: var(--muted); margin: 0 0 24px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; }
.hero-actions>* { display: inline-flex; justify-content: center; align-items: center; gap: 8px; min-height: 42px; font-size: 13px; }
.stats { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; padding-top: 24px; margin-top: 32px; border-top: 1px solid var(--line); }
.stats>div { min-width: 0; padding: 12px; background: var(--soft); border: 1px solid var(--line); border-radius: 8px; }.stats b { display: block; color: var(--text); font-size: 19px; font-weight: 600; }.stats span { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.quick-card { padding: 24px; border-top: 3px solid var(--accent-line); }
.quick-content>b { font-size: 17px; font-weight: 600; }
.status-dot { width: 7px; height: 7px; background: #269676; box-shadow: 0 0 0 3px #26967612; }
.quick-warning { margin: 16px 0; padding: 11px 12px; border: 1px solid var(--danger-line); border-left: 3px solid #d87888; border-radius: 8px; background: var(--danger-soft); color: var(--danger-text); font-size: 12px; font-weight: 500; line-height: 1.65; }
.quick-content>p { font-size: 13px; color: var(--muted); line-height: 1.7; }
.quick-card textarea, body.dark .quick-card textarea { min-height: 120px; background: var(--soft); font-size: 14px; }
.quick-attach { margin: 10px 0; font-size: 12px; }.quick-content>button { width: 100%; }
.section-head { margin-bottom: 22px; }.section-head h2 { font-size: 23px; font-weight: 600; letter-spacing: -.025em; margin: 6px 0; line-height: 1.3; }
.section-head p { font-size: 13px; margin: 8px 0 0; color: var(--muted); }
.section-head.row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.form-card { max-width: 900px; margin-inline: auto; }
.grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }.grid .wide { grid-column: 1/-1; }
.form-card label { display: block; min-width: 0; font-size: 13px; font-weight: 600; }
.form-card label input, .form-card label select, .form-card label textarea { margin-top: 7px; }
.form-card textarea { min-height: 128px; }.custom-fields { margin: 18px 0; gap: 16px; padding: 16px; border: 1px solid var(--accent-line); border-radius: 9px; background: var(--accent-soft); }
.custom-fields:empty { display: none; }.custom-fields textarea { min-height: 96px; }
.form-card>.grid { margin-bottom: 18px; }.form-card>button { margin-top: 12px; min-width: 200px; }
.attach-row { grid-template-columns: minmax(0,1fr) 44px; gap: 10px; margin-top: 12px; align-items: stretch; }
.drop, body.dark .drop { padding: 16px; border: 1px dashed var(--line); border-radius: 8px; background: var(--soft); color: var(--muted); font-size: 12px; }
.drop b { font-weight: 500; color: var(--text); }.drop span { display: block; margin-top: 3px; font-size: 11px; }
.drop.dragover { border-color: var(--primary); background: var(--accent-soft); box-shadow: 0 0 0 3px #2563eb12; }
.paperclip, body.dark .paperclip { border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: var(--card); min-height: 40px; }
.paperclip:hover { border-color: var(--accent-line); color: var(--accent-text); }
.file-list, .attachments { gap: 6px; margin: 10px 0; min-width: 0; }.file-list:empty { display: none; }
.file-chip, .attachments a, body.dark .file-chip, body.dark .attachments a { min-width: 0; max-width: 100%; overflow-wrap: anywhere; background: var(--accent-soft); color: var(--accent-text); border: 1px solid var(--accent-line); border-radius: 7px; font-size: 12px; font-weight: 500; padding: 6px 9px; }
.file-chip button { flex-shrink: 0; min-width: 28px; min-height: 28px; padding: 2px 7px; background: transparent; color: var(--accent-text); border: 1px solid var(--accent-line); border-radius: 5px; }
#formState { color: var(--muted); font-size: 13px; }#formState:empty { display: none; }
#search { max-width: 560px; background: var(--soft); }
.ticket-groups { gap: 18px; margin-top: 18px; }.ticket-groups h3 { font-size: 12px; font-weight: 600; margin: 0 0 12px; color: var(--muted); }
.list { display: grid; gap: 8px; padding: 0; min-height: 0; }
.list .ticket, body.dark .list .ticket { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0; padding: 15px 16px; border-radius: 9px; background: var(--card); border: 1px solid var(--line); box-shadow: none; }
.list .ticket:hover, body.dark .list .ticket:hover { background: var(--soft); border-color: var(--accent-line); box-shadow: none; transform: none; }
.list .ticket>div { min-width: 0; overflow-wrap: anywhere; }.list .ticket>div:last-child { display: flex; flex-wrap: wrap; gap: 6px; flex-shrink: 0; }
.list .ticket b { color: var(--accent-text); font: 600 11px Consolas,monospace; }.list .ticket small { margin-top: 6px; color: var(--muted); font-size: 11px; }
.badge, body.dark .badge { display: inline-flex; background: var(--accent-soft); color: var(--accent-text); border-radius: 5px; padding: 4px 7px; font-size: 11px; font-weight: 500; white-space: normal; }
.badge.critical, body.dark .badge.critical { background: var(--danger-soft); color: var(--danger-text); }
.archive-block { margin: 0; padding-top: 16px; opacity: 1; }.archive-block summary { font-size: 13px; font-weight: 500; }.archive-block summary span, body.dark .archive-block summary span { background: var(--soft); color: var(--muted); font-size: 11px; }
#ticket { max-width: 1080px; }.back-link, body.dark .back-link { background: transparent; color: var(--muted); padding: 0; margin-bottom: 12px; min-height: 32px; font-size: 12px; font-weight: 500; border: 0; }
.back-link:hover, body.dark .back-link:hover { background: transparent; color: var(--accent-text); }
.ticket-shell { gap: 16px; padding-bottom: 16px; margin-bottom: 16px; }.ticket-shell>div { min-width: 0; }.ticket-shell h2 { font-size: 21px; line-height: 1.4; margin: 0 0 6px; font-weight: 600; letter-spacing: -.02em; }
.meta-line { font-size: 12px; color: var(--muted); }.meta-line b { font-weight: 500; color: var(--text); }
.operator-pill { flex-shrink: 0; padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--soft); color: var(--muted); font-size: 11px; }
.ticket-form-summary { margin: 0 0 18px; padding: 0; border: 1px solid var(--accent-line); border-left: 3px solid var(--primary); border-radius: 9px; overflow: hidden; background: var(--card); }
.ticket-form-summary>b { display: block; padding: 11px 14px; background: var(--accent-soft); color: var(--accent-text); font-size: 13px; font-weight: 600; }
.ticket-form-summary dl { display: grid; grid-template-columns: minmax(110px,.35fr) minmax(0,1fr); margin: 0; padding: 0 14px; }
.ticket-form-summary dt, .ticket-form-summary dd { margin: 0; padding: 10px 0; border-top: 1px solid var(--line); font-size: 13px; overflow-wrap: anywhere; }
.ticket-form-summary dt { padding-right: 16px; color: var(--muted); font-weight: 400; }.ticket-form-summary dd { color: var(--text); font-weight: 500; white-space: pre-wrap; }
.ticket-form-summary dt:first-child, .ticket-form-summary dt:first-child+dd { border-top: 0; }
.chat { min-height: 240px; max-height: 52dvh; padding: 16px; gap: 14px; background: var(--soft); border: 1px solid var(--line); border-radius: 10px; overflow-y: auto; }
.msg, .msg:not(.agent), body.dark .msg:not(.agent) { max-width: 85%; padding: 11px 14px; border: 1px solid var(--accent-line); border-radius: 10px 10px 3px 10px; background: var(--accent-soft); color: var(--text); font-size: 14px; box-shadow: none; }
.msg.agent, body.dark .msg.agent { background: var(--card); border-color: var(--line); border-radius: 10px 10px 10px 3px; color: var(--text); }
.msg b { font-size: 12px; font-weight: 600; }.msg small, body.dark .msg small { font-size: 10px; color: var(--muted); }
.reply-box, body.dark .reply-box { display: grid; grid-template-columns: minmax(0,1fr) 40px auto; gap: 10px; align-items: end; margin-top: 12px; padding: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: none; }
.reply-box textarea { min-height: 68px; max-height: 240px; margin: 0; background: var(--soft); font-size: 14px; }.reply-box .paperclip { width: 40px; height: 40px; margin: 0; }.reply-box button { margin: 0; }
.kb-grid { grid-template-columns: repeat(auto-fit,minmax(min(100%,270px),1fr)); gap: 14px; }.kb-grid article { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: 9px; background: var(--card); }
.kb-grid article:hover { background: var(--soft); border-color: var(--accent-line); }.kb-grid h3 { font-size: 15px; color: var(--text); margin: 0 0 10px; font-weight: 600; }.kb-grid p { color: var(--muted); font-size: 13px; line-height: 1.7; }.kb-grid small, .kb-article small { color: var(--muted); font-size: 11px; }
.kb-article { max-width: 800px; line-height: 1.85; }.kb-article h1 { font-size: 26px; color: var(--text); letter-spacing: -.02em; }.kb-article p { white-space: pre-wrap; }.kb-article table { display: block; max-width: 100%; overflow-x: auto; }
.empty { padding: 28px 16px; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); background: var(--soft); text-align: center; font-size: 13px; }
.auth-screen { background: var(--bg); min-height: 100dvh; padding: 24px; }.auth-card { width: min(440px,100%); padding: 32px; border-top: 3px solid var(--primary); }.auth-card h1 { font-size: 26px; line-height: 1.25; letter-spacing: -.03em; margin: 18px 0 12px; }.auth-card p { font-size: 13px; color: var(--muted); }.auth-card label { display: block; font-size: 12px; font-weight: 500; }.auth-card input { margin: 6px 0 14px; }.auth-card button { margin-top: 4px; }.auth-card h2 { font-size: 20px; }
.auth-brand { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 11px; }.auth-brand img { width: 88px; height: 34px; }
.totp-setup, body.dark .totp-setup { background: var(--soft); border: 1px solid var(--line); border-radius: 8px; }.totp-setup code, body.dark .totp-setup code { background: var(--card); color: var(--accent-text); border-radius: 6px; }.totp-setup img { max-width: 100%; height: auto; }
.urgent-dialog { border: 1px solid var(--danger-line); border-top: 3px solid #d87888; border-radius: 12px; padding: 24px; }.urgent-dialog h2 { font-size: 20px; }.urgent-dialog::backdrop { background: #101a2a99; }
.toast { max-width: calc(100vw - 32px); right: 16px; bottom: 16px; padding: 12px 16px; background: var(--text); color: var(--card); border-radius: 9px; font-size: 13px; box-shadow: 0 8px 30px #101a2a26; overflow-wrap: anywhere; pointer-events: none; }
@media (max-width: 1200px) {
  .topbar { gap: 12px; }.topbar nav { order: 3; width: 100%; }.account-controls { margin-left: auto; }.topbar .user-badge { max-width: 240px; }
}
@media (max-width: 900px) {
  main { margin: 20px auto; padding: 0 16px 24px; }.topbar { padding: 12px 16px; }
  .hero { grid-template-columns: minmax(0,1fr); gap: 16px; }.hero-copy { padding: 26px; }.hero-copy h1 { max-width: 620px; }.quick-card textarea { min-height: 100px; }
}
@media (max-width: 600px) {
  main { margin: 14px auto; padding: 0 12px 20px; }.topbar { padding: 12px; gap: 12px; }.topbar .brand-logo { width: 80px; }
  .account-controls { flex: 1 1 100%; flex-wrap: wrap; margin: 0; gap: 6px; }.topbar .user-badge { flex: 1 1 100%; max-width: none; font-size: 12px; }.topbar .small { font-size: 12px; min-height: 44px; padding-inline: 12px; }.theme-toggle { min-height: 44px; height: 44px; flex-basis: 44px; width: 44px; }
  .topbar nav { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 5px; }.topbar nav a { min-height: 44px; padding: 9px 10px; font-size: 12px; justify-content: flex-start; }
  .card, .quick-card, .hero-copy { padding: 18px; border-radius: 10px; }.hero-copy h1 { font-size: 30px; }.hero-copy>p { font-size: 14px; }.hero-actions>* { flex: 1 1 100%; white-space: normal; }
  .stats { grid-template-columns: minmax(0,1fr); gap: 8px; margin-top: 24px; padding-top: 18px; }.stats>div { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 12px; }.stats b { font-size: 16px; }.stats span { font-size: 11px; margin-top: 0; }
  input, select, textarea { font-size: 16px; min-height: 44px; }.quick-card textarea, .reply-box textarea { font-size: 16px; }button, .paperclip { min-height: 44px; }
  .section-head { margin-bottom: 18px; }.section-head h2 { font-size: 21px; }.grid, .custom-fields { grid-template-columns: minmax(0,1fr); gap: 14px; }.custom-fields { padding: 12px; }.form-card>button { width: 100%; min-width: 0; }
  .list .ticket { flex-direction: column; align-items: stretch; padding: 13px; gap: 10px; }.list .ticket>div:last-child { flex-shrink: 1; }
  .ticket-shell { flex-direction: column; align-items: flex-start; gap: 10px; }.ticket-shell h2 { font-size: 19px; }.operator-pill { align-self: flex-start; }
  .ticket-form-summary dl { grid-template-columns: minmax(0,1fr); padding: 0 12px; }.ticket-form-summary dt { padding: 10px 0 3px; font-size: 11px; }.ticket-form-summary dd { padding: 0 0 10px; border-top: 0; }
  .chat { min-height: 230px; max-height: 60dvh; padding: 10px; }.msg, .msg:not(.agent) { max-width: 95%; padding: 10px 12px; }
  .reply-box { grid-template-columns: 44px minmax(0,1fr); gap: 8px; }.reply-box textarea { grid-column: 1/-1; min-height: 88px; }.reply-box .paperclip { width: 44px; height: 44px; }.reply-box button { justify-self: end; }
  .file-chip button { min-width: 36px; min-height: 36px; }.kb-grid article { padding: 16px; }.auth-screen { padding: 16px; }.auth-card { padding: 24px; }.auth-card h1 { font-size: 24px; }.urgent-dialog { padding: 20px; }
}