.staff-login {
  display:grid;
  grid-template-columns:minmax(0,1.08fr) minmax(0,1fr);
  gap:0;
  width:min(840px,calc(100% - 32px));
  margin:clamp(40px,11vh,118px) auto;
  overflow:hidden;
  border:1px solid #dcd6ec;
  border-radius:24px;
  background:#fff;
  box-shadow:0 18px 60px #3730621c;
}
.login-brand { display:grid; align-content:center; gap:12px; min-height:340px; padding:clamp(24px,5vw,48px); background:radial-gradient(ellipse at 8% 10%,#493567,#262045 75%); color:#fff }
.login-logo { display:block; width:auto; height:clamp(42px,8vw,62px); margin-bottom:5px }
.login-brand h1 { font-size:clamp(25px,4.5vw,39px); letter-spacing:-.055em; line-height:1.05 }
.login-brand p { color:#decfed }
.login-panel { padding:clamp(23px,5vw,48px); align-self:center }
.login-panel h2 { font-size:27px; margin-bottom:16px; letter-spacing:-.035em }
.login-panel form,.workspace-form { display:grid; gap:10px }
.login-panel label,.workspace-dialog label,.crm-section label { display:grid; gap:4px; color:var(--muted); font-size:12px; min-width:0 }
.login-panel input,.workspace-dialog input:not([type=checkbox]),.workspace-dialog select,.workspace-dialog textarea,.crm-section input,.crm-section select {
  width:100%; border:1px solid var(--line); border-radius:9px; padding:8px 9px; background:#fbfaff; color:var(--ink); min-width:0;
}
.workspace-dialog select,.crm-section select { font:inherit }
.workspace-dialog textarea { min-height:96px; resize:vertical; font:inherit }
.workspace-dialog label:has(input[type=checkbox]) { display:flex; align-items:center; justify-content:space-between; padding:7px 0; gap:8px }
.workspace-dialog input[type=checkbox] { width:auto; margin:0; accent-color:var(--accent) }
.workspace-dialog button[type=submit] { justify-self:start }
.workspace-feedback { color:#8f2749; font-size:12px; overflow-wrap:anywhere }
.workspace-feedback[data-severity=success] { color:#206f57 }
.login-panel .workspace-feedback { margin-top:10px }
.rail-admin { margin-top:auto }
.rail-admin:not([hidden]) + .rail-settings { margin-top:0 }
.native-customer,.crm-section { display:grid; gap:10px }
.native-customer h2 { font-size:18px }
.customer-card .customer-name-edit { display:flex; align-items:center; gap:6px; min-width:0; max-width:100%; width:fit-content; padding:0; border:0; color:var(--ink); background:none; font-weight:750; text-align:left; overflow-wrap:anywhere }
.customer-name-edit:hover,.customer-name-edit:focus-visible { color:var(--accent-deep) }
.customer-name-icon { flex:none; color:var(--accent-deep); font-size:14px }
.customer-name-form { display:grid; gap:5px; min-width:0 }
.customer-name-form input { width:100%; min-width:0; padding:4px 6px; border:1px solid #b5a6dd; border-radius:6px; color:var(--ink); background:white; font-size:12px }
.customer-card .customer-name-controls { display:flex; flex-wrap:wrap; gap:4px }
.customer-name-controls button { padding:2px 5px; font-size:10px }
.native-customer .chat-context-links { display:flex; flex-wrap:wrap; gap:5px }
.native-customer .chat-context-links a { padding:5px 7px; text-decoration:none; background:#f6f2fe; color:#48317d; font-size:11px }
.context-block,.crm-section { border:1px solid var(--line); border-radius:11px; padding:9px; background:#fbfaff; min-width:0 }
.context-block { display:grid; gap:4px }
.context-block h3 { margin:0; font-size:13px }
.context-block a,.context-product-title { overflow-wrap:anywhere; font-size:12px }
.context-block small { line-height:1.3 }
.crm-section summary { cursor:pointer; font-size:13px; font-weight:700 }
.crm-section details[open] form { margin-top:7px }
.crm-section details > .workspace-feedback { margin-top:5px }
.crm-section h3,.workspace-panel h3 { margin:0; font-size:14px; letter-spacing:-.015em }
.crm-section form { display:grid; gap:6px }
.crm-section form button { justify-self:start; padding:6px 9px; font-size:12px }
.staff-note { justify-content:center }
.staff-note .chat-bubble { display:grid; gap:3px; width:min(90%,540px); max-width:100%; border:1px solid #e5c461; border-left:4px solid #d5a727; border-radius:10px; background:#fff6d9; color:#503b1b; box-shadow:none }
.staff-note strong { font-size:12px }
.staff-note small { color:#72582e }
.phrase-card p,.detail-description { white-space:pre-wrap; overflow-wrap:anywhere }
.composer-modes,.composer-modes div,.workspace-actions { display:flex; align-items:center; flex-wrap:wrap; gap:5px }
.composer-modes { justify-content:space-between }
.composer-modes button { border:1px solid transparent; border-radius:7px; background:transparent; color:var(--muted); font-weight:650; font-size:12px; padding:4px 7px }
.composer-modes button[aria-pressed=true] { border-color:#e0d5f6; color:var(--accent-deep); background:var(--tint) }
.composer-modes #crm-note-mode[aria-pressed=true] { border-color:#ebd7a6; color:#61451b; background:#fff4d6 }
.composer-modes :where(#crm-phrases,#crm-sent-phrases) { border-color:var(--line) }
.crm-note-form { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:end; gap:6px }
.crm-note-form textarea { border:1px solid #e7d6ae; border-radius:9px; background:#fffbf0; color:#442e1c; min-height:54px; min-width:0; resize:vertical; padding:8px }
.crm-note-form small { grid-column:1/-1 }
.crm-note-form button { font-size:12px }
.workspace-dialog { width:min(780px,calc(100vw - 22px)); max-height:calc(100dvh - 22px); overflow:auto; padding:18px }
.workspace-dialog > header { position:sticky; top:-18px; z-index:1; background:white; margin:-18px -18px 12px; padding:14px 18px; border-bottom:1px solid var(--line) }
#workspace-body { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,.85fr); gap:12px; align-items:start }
#workspace-body > :only-child { grid-column:1/-1 }
.workspace-panel { display:grid; gap:10px; min-width:0; border:1px solid var(--line); border-radius:12px; padding:12px }
.workspace-panel form { margin:0 }
.workspace-hint { color:var(--muted); font-size:12px }
.detail-value { font-size:23px; letter-spacing:-.04em }
.detail-avatar { width:48px; height:48px; border-radius:12px; object-fit:cover }
.operator-menu { max-width:140px; overflow:hidden; text-overflow:ellipsis }
.detail-facts { display:grid; grid-template-columns:minmax(100px,.35fr) minmax(0,1fr); gap:7px 12px; margin:0 }
.detail-facts dt { color:var(--muted) }
.detail-facts dd { margin:0; overflow-wrap:anywhere }
.staff-rows,.phrase-list { display:grid; gap:7px; max-height:400px; overflow:auto }
.staff-row,.phrase-card { display:grid; gap:7px; border:1px solid var(--line); border-radius:8px; background:#fcfbff; padding:8px }
.staff-row { grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto; align-items:center }
.staff-row div { display:grid }
.staff-row :is(strong,small) { overflow-wrap:anywhere }
.staff-row button,.phrase-card button { padding:4px 6px; font-size:11px }
.admin-summary { display:flex; flex-wrap:wrap; gap:10px; align-items:center; color:#463673; font-size:12px }
.rail-sales { margin-top:0; display:grid; place-items:center }
.phrase-picker { border:1px solid #ded4f3; border-radius:11px; background:#fbf8ff; padding:8px; display:grid; gap:6px }
.phrase-picker-head,.sales-directory-toolbar { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:6px }
.phrase-picker-head input { min-width:0; border:1px solid var(--line); border-radius:8px; background:#fff; padding:6px 9px }
.phrase-picker-results,.sales-directory-results { display:grid; gap:4px; max-height: min(22vh,190px); overflow:auto }
.phrase-choice { display:grid; gap:1px; text-align:left; border:1px solid #e5dcf6; border-radius:8px; background:#fff; padding:6px 9px; min-width:0; color:var(--ink) }
.phrase-choice:hover { background:var(--tint) }
.phrase-choice span,.sale-contact span,.sale-contact strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap }
.phrase-choice span { color:var(--muted); font-size:12px }
.composer-suggestions { display:grid; gap:4px; max-height:120px; overflow:auto; padding:6px; border:1px solid #ded4f3; border-radius:10px; background:#faf7ff }
.composer-suggestions > small { padding:0 3px; font-weight:700 }
.suggestion-choice { display:grid; gap:1px; text-align:left; background:white; color:var(--ink); min-width:0; padding:5px 8px; border:1px solid #e9e1f6; border-radius:7px; font-size:12px }
.suggestion-choice:hover { color:var(--accent-deep); background:#f0eafa }
.suggestion-choice strong { overflow:hidden; white-space:nowrap; text-overflow:ellipsis }
.suggestion-choice small { font-size:10px }
.sales-directory-results { max-height:min(55dvh,580px); gap:5px }
.sale-contact { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1.5fr) auto; align-items:center; gap:9px; border:1px solid var(--line); border-radius:8px; background:#fcfbff; padding:8px }
.sale-contact div { display:grid; min-width:0 }
.sale-contact button { font-size:12px }
@media (max-width:700px) {
  .operator-menu { display:none }
  #workspace-body,.staff-login { grid-template-columns:1fr }
  .staff-login { margin:18px auto }
  .login-brand { min-height:0 }
  .crm-note-form { grid-template-columns:1fr }
  .crm-note-form button { justify-self:start }
  .sale-contact { grid-template-columns:minmax(0,1fr) auto }
  .sale-contact div:nth-child(2) { grid-column:1/-1; grid-row:2 }
}


.sales-directory-toolbar { grid-template-columns:minmax(0,1fr) minmax(135px,auto) auto }
.customer-order-history-panel { display:grid; gap:10px }
.customer-order-history-name { font-weight:650 }
.customer-order-history-list { margin:0; padding:0; list-style:none; max-height:55dvh; overflow:auto }
.customer-order-history-list li { display:grid; gap:3px; padding:10px 2px; border-bottom:1px solid var(--line); overflow-wrap:anywhere }
.customer-order-history-list a { width:fit-content; font-weight:650; color:var(--accent-deep) }
.customer-order-history-list small { color:var(--muted) }
.customer-order-history-panel > button { justify-self:start }
.customer-status-label[data-status=problem] { color:#8b5200 }
.customer-status-label[data-status=negative_review] { color:#a63548 }
.customer-status-label[data-status=p2_sharing_enabled] { color:#4a4897 }
.customer-status-label[data-status=account_theft] { color:#8e3341 }
[data-theme=dark] .customer-status-label[data-status=problem] { color:#e7b46b }
[data-theme=dark] .customer-status-label[data-status=negative_review] { color:#ed98a9 }
[data-theme=dark] .customer-status-label[data-status=p2_sharing_enabled] { color:#b9b5f1 }
[data-theme=dark] .customer-status-label[data-status=account_theft] { color:#ff9a9e }
@media (max-width:520px) {
  .sales-directory-toolbar { grid-template-columns:minmax(0,1fr) auto }
  .sales-directory-toolbar input { grid-column:1/-1 }
}
