:root { --ink:#182230; --muted:#667085; --line:#e7eaf0; --canvas:#f7f8fa; --surface:#fff; --blue:#0d6b5c; --blue-dark:#0a5a4d; --blue-soft:#e9f4f1; --green:#15714e; --green-soft:#e8f5ef; --violet:#7a4f8f; --violet-soft:#f3eef7; --orange:#a3600e; --orange-soft:#f9efe2; --red:#b03d3d; --sidebar:#0e2c26; --sidebar-muted:#93aca5; --font:'DM Sans',sans-serif; --display:'Manrope',sans-serif; }
*{box-sizing:border-box} body{margin:0;background:var(--canvas);color:var(--ink);font-family:var(--font);font-size:calc(15px * var(--ui-scale, 1));-webkit-font-smoothing:antialiased}.app-shell{display:grid;grid-template-columns:calc(310px * var(--ui-scale, 1)) minmax(0,1fr) calc(286px * var(--ui-scale, 1));min-height:100vh}.sidebar{background:var(--sidebar);color:white;padding:calc(26px * var(--ui-scale, 1)) calc(20px * var(--ui-scale, 1)) calc(20px * var(--ui-scale, 1));display:flex;flex-direction:column;min-height:100vh}.brand{color:#fff;text-decoration:none;font:bold calc(26px * var(--ui-scale, 1)) var(--display);letter-spacing:calc(-1.4px * var(--ui-scale, 1));display:flex;align-items:center;gap:calc(12px * var(--ui-scale, 1));padding:0 calc(10px * var(--ui-scale, 1)) calc(28px * var(--ui-scale, 1))}.brand-dot{color:#8ad0c0}.brand-mark{width:calc(28px * var(--ui-scale, 1));height:calc(28px * var(--ui-scale, 1));display:flex;align-items:flex-end;gap:calc(3px * var(--ui-scale, 1));padding:calc(5px * var(--ui-scale, 1));border-radius:calc(12px * var(--ui-scale, 1));background:linear-gradient(145deg,#12806d,#0d6b5c)}.brand-mark span{display:block;width:calc(4px * var(--ui-scale, 1));background:#fff;border-radius:calc(10px * var(--ui-scale, 1))}.brand-mark span:nth-child(1){height:calc(8px * var(--ui-scale, 1))}.brand-mark span:nth-child(2){height:calc(14px * var(--ui-scale, 1))}.brand-mark span:nth-child(3){height:calc(18px * var(--ui-scale, 1))}.workspace-switcher{display:flex;align-items:center;gap:calc(11px * var(--ui-scale, 1));padding:calc(13px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1));background:#17352e;border:calc(1px * var(--ui-scale, 1)) solid #1f4239;border-radius:calc(14px * var(--ui-scale, 1));margin:0 0 calc(25px * var(--ui-scale, 1))}.workspace-avatar,.user-avatar{width:calc(34px * var(--ui-scale, 1));height:calc(34px * var(--ui-scale, 1));border-radius:calc(12px * var(--ui-scale, 1));background:#d9ede7;color:#0d6b5c;display:grid;place-items:center;font-size:calc(12px * var(--ui-scale, 1));font-weight:700}.workspace-switcher strong,.workspace-switcher small{display:block}.workspace-switcher strong{font-size:calc(13.5px * var(--ui-scale, 1))}.workspace-switcher small{color:#9db0a8;font-size:calc(12px * var(--ui-scale, 1));margin-top:calc(2px * var(--ui-scale, 1))}.chevron{margin-left:auto;color:var(--muted)}.primary-nav{display:grid;gap:calc(5px * var(--ui-scale, 1))}.nav-item{border:0;background:transparent;color:var(--sidebar-muted);border-radius:calc(12px * var(--ui-scale, 1));padding:calc(12px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1));text-align:left;font:600 calc(14px * var(--ui-scale, 1)) var(--font);cursor:pointer;display:flex;align-items:center;gap:calc(12px * var(--ui-scale, 1))}.nav-icon{width:calc(22px * var(--ui-scale, 1));height:calc(22px * var(--ui-scale, 1));display:inline-flex;align-items:center;justify-content:center;color:currentColor;flex:0 0 calc(22px * var(--ui-scale, 1))}.nav-item:hover{color:#fff;background:#16241f}.nav-item.active{background:#17584c;color:#fff}.nav-item b{margin-left:auto;background:#d99a3d;color:#241303;border-radius:calc(12px * var(--ui-scale, 1));font-size:calc(12px * var(--ui-scale, 1));padding:calc(3px * var(--ui-scale, 1)) calc(7px * var(--ui-scale, 1))}.sidebar-section-label{font-size:calc(12px * var(--ui-scale, 1));font-weight:700;color:#9db0a8;letter-spacing:.08em;margin:calc(30px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1)) calc(13px * var(--ui-scale, 1))}.agents-list{display:grid;gap:calc(6px * var(--ui-scale, 1))}.agent-mini{display:flex;gap:calc(11px * var(--ui-scale, 1));align-items:center;padding:calc(10px * var(--ui-scale, 1)) calc(11px * var(--ui-scale, 1));border-radius:calc(12px * var(--ui-scale, 1))}.agent-mini:hover{background:#14251f}.agent-avatar{width:calc(36px * var(--ui-scale, 1));height:calc(36px * var(--ui-scale, 1));border-radius:50%;background:#1e3a31;color:#cfe7de;display:grid;place-items:center;font-size:calc(12px * var(--ui-scale, 1));font-weight:700;position:relative}.agent-avatar:after{content:'';position:absolute;width:calc(9px * var(--ui-scale, 1));height:calc(9px * var(--ui-scale, 1));border:calc(2px * var(--ui-scale, 1)) solid var(--sidebar);right:calc(-1px * var(--ui-scale, 1));bottom:calc(-1px * var(--ui-scale, 1));border-radius:50%;background:var(--green)}.agent-avatar.busy:after{background:#b5670f}.agent-avatar.offline:after{background:#85958c}.agent-mini strong{font-size:calc(13.5px * var(--ui-scale, 1));display:block}.agent-mini small{display:block;color:#8b9c93;font-size:calc(12px * var(--ui-scale, 1));margin-top:calc(2px * var(--ui-scale, 1))}.agent-status-controls{display:flex;gap:calc(4px * var(--ui-scale, 1));margin-left:auto}.agent-status-controls button{width:calc(9px * var(--ui-scale, 1));height:calc(9px * var(--ui-scale, 1));border-radius:50%;border:0;background:#56645e;padding:0;cursor:pointer}.agent-status-controls button.active{outline:calc(2px * var(--ui-scale, 1)) solid #d9ede7;outline-offset:calc(1px * var(--ui-scale, 1))}.sidebar-footer{margin-top:auto;color:#93a199;font-size:calc(12px * var(--ui-scale, 1));padding:calc(18px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1)) 0;display:flex;gap:calc(8px * var(--ui-scale, 1));align-items:center;border-top:calc(1px * var(--ui-scale, 1)) solid #17584c}.status-dot{width:calc(8px * var(--ui-scale, 1));height:calc(8px * var(--ui-scale, 1));background:#2fa678;border-radius:50%;display:inline-block;box-shadow:0 0 0 calc(3px * var(--ui-scale, 1)) rgba(47, 166, 120,.12)}.main-content{min-width:0;display:flex;flex-direction:column}.topbar{height:calc(72px * var(--ui-scale, 1));background:rgba(255,255,255,.92);border-bottom:calc(1px * var(--ui-scale, 1)) solid var(--line);display:flex;align-items:center;justify-content:space-between;padding:0 calc(32px * var(--ui-scale, 1));position:sticky;top:0;z-index:5}.global-search{height:calc(38px * var(--ui-scale, 1));width:calc(375px * var(--ui-scale, 1));border:calc(1px * var(--ui-scale, 1)) solid var(--line);background:#fafbfc;border-radius:calc(12px * var(--ui-scale, 1));display:flex;align-items:center;gap:calc(8px * var(--ui-scale, 1));padding:0 calc(10px * var(--ui-scale, 1));color:#667085}.global-search span{font-size:calc(19px * var(--ui-scale, 1))}.global-search input,.lookup-input-wrap input,.composer input,.email-composer>input,.customer-form input,.customer-form select{border:0;outline:0;background:transparent;font:inherit;color:var(--ink);width:100%}.global-search kbd{font:600 calc(12px * var(--ui-scale, 1)) var(--font);color:#667085;background:#f1f3f6;border-radius:calc(10px * var(--ui-scale, 1));padding:calc(3px * var(--ui-scale, 1)) calc(5px * var(--ui-scale, 1));white-space:nowrap}.topbar-actions{display:flex;align-items:center;gap:calc(15px * var(--ui-scale, 1))}.icon-button{border:0;background:transparent;color:#667085;font:600 calc(16px * var(--ui-scale, 1)) var(--font);cursor:pointer;position:relative;width:calc(35px * var(--ui-scale, 1));height:calc(35px * var(--ui-scale, 1));border-radius:calc(12px * var(--ui-scale, 1))}.icon-button:hover{background:#f2f4f7}.icon-button i{position:absolute;width:calc(5px * var(--ui-scale, 1));height:calc(5px * var(--ui-scale, 1));background:var(--red);border-radius:50%;top:calc(8px * var(--ui-scale, 1));right:calc(7px * var(--ui-scale, 1))}.user-menu{border:0;background:transparent;display:flex;align-items:center;gap:calc(8px * var(--ui-scale, 1));font:600 calc(12px * var(--ui-scale, 1)) var(--font);color:#344054}.mobile-menu{display:none}.content-scroll{padding:calc(31px * var(--ui-scale, 1)) calc(32px * var(--ui-scale, 1)) calc(50px * var(--ui-scale, 1))}.tab-view{display:none}.tab-view.active{display:block}.page-heading{display:flex;justify-content:space-between;gap:calc(20px * var(--ui-scale, 1));align-items:flex-end;margin-bottom:calc(26px * var(--ui-scale, 1))}.page-heading.compact{margin-bottom:calc(20px * var(--ui-scale, 1))}.eyebrow{color:var(--blue);font-size:calc(12px * var(--ui-scale, 1));font-weight:700;letter-spacing:.12em;margin:0 0 calc(7px * var(--ui-scale, 1));display:flex;gap:calc(7px * var(--ui-scale, 1));align-items:center}.eyebrow .status-dot{width:calc(6px * var(--ui-scale, 1));height:calc(6px * var(--ui-scale, 1))}.page-heading h1{font:800 calc(25px * var(--ui-scale, 1)) var(--display);letter-spacing:calc(-.9px * var(--ui-scale, 1));margin:0 0 calc(5px * var(--ui-scale, 1))}.page-heading>div>p:not(.eyebrow){color:var(--muted);margin:0;font-size:calc(13px * var(--ui-scale, 1))}.heading-actions{display:flex;gap:calc(9px * var(--ui-scale, 1))}.button{border:0;border-radius:calc(12px * var(--ui-scale, 1));padding:calc(9px * var(--ui-scale, 1)) calc(13px * var(--ui-scale, 1));font:700 calc(12px * var(--ui-scale, 1)) var(--font);cursor:pointer;display:inline-flex;gap:calc(7px * var(--ui-scale, 1));align-items:center;justify-content:center;transition:.18s}.button-primary{color:#fff;background:var(--blue);box-shadow:0 calc(1px * var(--ui-scale, 1)) calc(2px * var(--ui-scale, 1)) rgba(15, 23, 42,.16)}.button-primary:hover{background:var(--blue-dark)}.button-secondary{color:#344054;background:#fff;border:calc(1px * var(--ui-scale, 1)) solid #d9dee7}.button-secondary:hover{background:#f8fafc}.button-full{width:100%;padding:calc(11px * var(--ui-scale, 1))}.metric-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:calc(13px * var(--ui-scale, 1));margin-bottom:calc(20px * var(--ui-scale, 1))}.metric-card{background:#fff;border:calc(1px * var(--ui-scale, 1)) solid var(--line);border-radius:calc(12px * var(--ui-scale, 1));padding:calc(17px * var(--ui-scale, 1));display:flex;gap:calc(12px * var(--ui-scale, 1));min-width:0}.metric-icon,.quick-icon{width:calc(35px * var(--ui-scale, 1));height:calc(35px * var(--ui-scale, 1));border-radius:calc(12px * var(--ui-scale, 1));display:grid;place-items:center;font-size:calc(16px * var(--ui-scale, 1));flex:0 0 auto}.blue{background:var(--blue-soft);color:var(--blue)}.green{background:var(--green-soft);color:var(--green)}.violet{background:var(--violet-soft);color:var(--violet)}.orange{background:var(--orange-soft);color:var(--orange)}.metric-card span{color:var(--muted);font-size:calc(12px * var(--ui-scale, 1));display:block;white-space:nowrap}.metric-card strong{font:800 calc(21px * var(--ui-scale, 1)) var(--display);letter-spacing:calc(-.7px * var(--ui-scale, 1));display:block;margin:calc(2px * var(--ui-scale, 1)) 0 calc(1px * var(--ui-scale, 1))}.metric-card small{color:#667085;font-size:calc(12px * var(--ui-scale, 1));white-space:nowrap}.dashboard-grid{display:grid;grid-template-columns:1.02fr .98fr;gap:calc(20px * var(--ui-scale, 1))}.surface{background:#fff;border:calc(1px * var(--ui-scale, 1)) solid var(--line);border-radius:calc(14px * var(--ui-scale, 1))}.activity-card,.customer-lookup{min-height:calc(330px * var(--ui-scale, 1))}.surface-heading{display:flex;justify-content:space-between;align-items:flex-start;padding:calc(19px * var(--ui-scale, 1)) calc(20px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1))}.surface-heading h2,.rail-heading h2,.thread-panel-head h2{font:700 calc(14px * var(--ui-scale, 1)) var(--display);letter-spacing:calc(-.2px * var(--ui-scale, 1));margin:0 0 calc(4px * var(--ui-scale, 1))}.surface-heading p,.rail-heading p{color:#667085;margin:0;font-size:calc(12px * var(--ui-scale, 1))}.live-chip{color:var(--green);font-size:calc(12px * var(--ui-scale, 1));font-weight:700;padding:calc(5px * var(--ui-scale, 1)) calc(7px * var(--ui-scale, 1));background:var(--green-soft);border-radius:calc(10px * var(--ui-scale, 1));display:inline-flex;align-items:center;gap:calc(5px * var(--ui-scale, 1))}.live-chip i{width:calc(5px * var(--ui-scale, 1));height:calc(5px * var(--ui-scale, 1));background:var(--green);border-radius:50%}.call-log-list {
  max-height: calc(720px * var(--ui-scale, 1));
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  border-top: calc(1px * var(--ui-scale, 1)) solid #f1f3f6;
}

.call-log-list::-webkit-scrollbar {
  width: calc(6px * var(--ui-scale, 1));
}
.call-log-list::-webkit-scrollbar-track {
  background: #f8fafc;
  border-radius: calc(10px * var(--ui-scale, 1));
}
.call-log-list::-webkit-scrollbar-thumb {
  background: #d4cbbb;
  border-radius: calc(10px * var(--ui-scale, 1));
}
.call-log-list::-webkit-scrollbar-thumb:hover {
  background: #8b968f;
}

.call-log {
  padding: calc(5px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)) !important;
  display: flex !important;
  align-items: center !important;
  gap: calc(8px * var(--ui-scale, 1)) !important;
  border-bottom: calc(1px * var(--ui-scale, 1)) solid #f1f3f6 !important;
  min-height: 0 !important;
}
.call-log:last-child { border: 0 !important; }
.log-symbol {
  width: calc(24px * var(--ui-scale, 1)) !important;
  height: calc(24px * var(--ui-scale, 1)) !important;
  font-size: calc(12px * var(--ui-scale, 1)) !important;
  flex: 0 0 calc(24px * var(--ui-scale, 1)) !important;
  border-radius: 50% !important;
  display: grid !important;
  place-items: center !important;
}
.call-log-main {
  min-width: 0 !important;
  flex: 1 !important;
  overflow: hidden !important;
}
.call-log-main strong {
  display: block !important;
  font-size: calc(12px * var(--ui-scale, 1)) !important;
  line-height: 1.15 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
.call-log-main span {
  display: block !important;
  font-size: calc(12px * var(--ui-scale, 1)) !important;
  color: var(--muted) !important;
  margin-top: calc(1px * var(--ui-scale, 1)) !important;
  line-height: 1.1 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
.log-right {
  text-align: right !important;
  font-size: calc(12px * var(--ui-scale, 1)) !important;
  color: #667085 !important;
  line-height: 1.1 !important;
  flex: 0 0 auto !important;
}
.call-status {
  font-weight: 700 !important;
  text-transform: capitalize !important;
  color: var(--green) !important;
  display: block !important;
  margin-top: calc(1px * var(--ui-scale, 1)) !important;
  font-size: calc(12px * var(--ui-scale, 1)) !important;
}.call-status.missed{color:var(--red)}.lookup-input-wrap{margin:0 calc(20px * var(--ui-scale, 1));display:flex;align-items:center;gap:calc(8px * var(--ui-scale, 1));border:calc(1px * var(--ui-scale, 1)) solid #d9dee7;border-radius:calc(12px * var(--ui-scale, 1));padding:calc(4px * var(--ui-scale, 1)) calc(5px * var(--ui-scale, 1)) calc(4px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1))}.lookup-input-wrap>span{font-size:calc(18px * var(--ui-scale, 1));color:#667085}.lookup-input-wrap input{font-size:calc(12px * var(--ui-scale, 1))}.lookup-input-wrap .button{padding:calc(8px * var(--ui-scale, 1)) calc(11px * var(--ui-scale, 1))}.search-results{margin:calc(17px * var(--ui-scale, 1)) calc(20px * var(--ui-scale, 1))}.empty-state{min-height:calc(168px * var(--ui-scale, 1));border:calc(1px * var(--ui-scale, 1)) dashed #d9dee7;border-radius:calc(12px * var(--ui-scale, 1));display:grid;place-content:center;text-align:center;color:#667085;font-size:calc(12px * var(--ui-scale, 1));padding:calc(20px * var(--ui-scale, 1))}.empty-state p{margin:calc(6px * var(--ui-scale, 1)) 0 0}.empty-icon{font-size:calc(25px * var(--ui-scale, 1));color:#b8bdb6}.search-card{border:calc(1px * var(--ui-scale, 1)) solid #e7eaf0;border-radius:calc(12px * var(--ui-scale, 1));padding:calc(12px * var(--ui-scale, 1));display:flex;gap:calc(10px * var(--ui-scale, 1));align-items:center;margin-bottom:calc(8px * var(--ui-scale, 1))}.search-card:last-child{margin:0}.customer-initial{width:calc(32px * var(--ui-scale, 1));height:calc(32px * var(--ui-scale, 1));display:grid;place-items:center;border-radius:calc(12px * var(--ui-scale, 1));background:var(--blue-soft);color:var(--blue);font-weight:700;font-size:calc(12px * var(--ui-scale, 1))}.search-card-main{flex:1;min-width:0}.search-card-main strong{font-size:calc(12px * var(--ui-scale, 1))}.search-card-main p{font-size:calc(12px * var(--ui-scale, 1));color:var(--muted);margin:calc(3px * var(--ui-scale, 1)) 0 0}.location-pill{font-size:calc(12px * var(--ui-scale, 1));color:#6d4382;background:#f3eef7;border-radius:calc(10px * var(--ui-scale, 1));padding:calc(4px * var(--ui-scale, 1)) calc(6px * var(--ui-scale, 1));font-weight:700;display:inline-block;margin-top:calc(5px * var(--ui-scale, 1))}.hidden{display:none}.search-card-actions{display:flex;gap:calc(4px * var(--ui-scale, 1))}.small-action{border:calc(1px * var(--ui-scale, 1)) solid #d0d5dd;background:#fff;border-radius:calc(10px * var(--ui-scale, 1));padding:calc(5px * var(--ui-scale, 1)) calc(6px * var(--ui-scale, 1));cursor:pointer;color:#475467;font-size:calc(12px * var(--ui-scale, 1))}.small-action:hover{background:#f8fafc;color:var(--blue)}.utility-rail{background:#fff;border-left:calc(1px * var(--ui-scale, 1)) solid var(--line);padding:calc(22px * var(--ui-scale, 1)) calc(19px * var(--ui-scale, 1));min-height:100vh}.service-card{background:linear-gradient(135deg,#e9f4f1,#f7f6f0);border:calc(1px * var(--ui-scale, 1)) solid #dbe8e3;border-radius:calc(14px * var(--ui-scale, 1));padding:calc(15px * var(--ui-scale, 1))}.service-card-top{display:flex;justify-content:space-between;align-items:center;margin-bottom:calc(14px * var(--ui-scale, 1))}.service-icon{display:grid;place-items:center;width:calc(29px * var(--ui-scale, 1));height:calc(29px * var(--ui-scale, 1));background:#fff;color:var(--blue);border-radius:calc(12px * var(--ui-scale, 1));font-weight:700}.service-card h2{color:#667085;font-size:calc(12px * var(--ui-scale, 1));margin:0 0 calc(4px * var(--ui-scale, 1))}.service-card strong{font:700 calc(16px * var(--ui-scale, 1)) var(--display);letter-spacing:calc(-.4px * var(--ui-scale, 1))}.service-card p{font-size:calc(12px * var(--ui-scale, 1));color:#667085;margin:calc(5px * var(--ui-scale, 1)) 0 0}.rail-section{padding:calc(23px * var(--ui-scale, 1)) calc(1px * var(--ui-scale, 1));border-bottom:calc(1px * var(--ui-scale, 1)) solid var(--line)}.rail-heading{margin-bottom:calc(14px * var(--ui-scale, 1))}.rail-heading.inline{display:flex;justify-content:space-between;align-items:center}.field-label{font-size:calc(12px * var(--ui-scale, 1));font-weight:700;color:#667085;display:block;margin-bottom:calc(6px * var(--ui-scale, 1))}.utility-rail select{width:100%;border:calc(1px * var(--ui-scale, 1)) solid #d9dee7;border-radius:calc(12px * var(--ui-scale, 1));padding:calc(9px * var(--ui-scale, 1));background:#fff;color:#344054;font:calc(12px * var(--ui-scale, 1)) var(--font);outline-color:var(--blue)}.simulation-actions{display:grid;gap:calc(5px * var(--ui-scale, 1));margin-top:calc(11px * var(--ui-scale, 1))}.quick-action{border:0;border-radius:calc(12px * var(--ui-scale, 1));background:#f8fafc;padding:calc(8px * var(--ui-scale, 1));display:flex;align-items:center;gap:calc(8px * var(--ui-scale, 1));text-align:left;cursor:pointer}.quick-action:hover{background:#f2f4f7}.quick-icon{width:calc(29px * var(--ui-scale, 1));height:calc(29px * var(--ui-scale, 1));border-radius:calc(12px * var(--ui-scale, 1));font-size:calc(13px * var(--ui-scale, 1))}.quick-action strong,.quick-action small{display:block}.quick-action strong{font-size:calc(12px * var(--ui-scale, 1))}.quick-action small{color:#667085;font-size:calc(12px * var(--ui-scale, 1));margin-top:calc(1px * var(--ui-scale, 1))}.text-button{color:var(--blue);border:0;background:transparent;padding:0;font:700 calc(12px * var(--ui-scale, 1)) var(--font);cursor:pointer}.locations-summary{display:grid;grid-template-columns:repeat(4,1fr);gap:calc(5px * var(--ui-scale, 1))}.location-cell{height:calc(28px * var(--ui-scale, 1));display:grid;place-items:center;border:calc(1px * var(--ui-scale, 1)) solid #e7eaf0;border-radius:calc(10px * var(--ui-scale, 1));color:#667085;font-size:calc(12px * var(--ui-scale, 1));font-weight:700}.inbox-layout{display:grid;grid-template-columns:calc(265px * var(--ui-scale, 1)) 1fr;min-height:calc(570px * var(--ui-scale, 1));overflow:hidden}.thread-panel{border-right:calc(1px * var(--ui-scale, 1)) solid var(--line);background:#f8fafc}.thread-panel-head{padding:calc(18px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1));display:flex;align-items:center;justify-content:space-between;border-bottom:calc(1px * var(--ui-scale, 1)) solid var(--line)}.count-pill{color:var(--blue);font-size:calc(12px * var(--ui-scale, 1));font-weight:700;background:var(--blue-soft);border-radius:calc(12px * var(--ui-scale, 1));padding:calc(3px * var(--ui-scale, 1)) calc(6px * var(--ui-scale, 1))}.thread-list{max-height:calc(520px * var(--ui-scale, 1));overflow:auto}.thread-item{padding:calc(13px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1));border-bottom:calc(1px * var(--ui-scale, 1)) solid #e7eaf0;cursor:pointer;border-left:calc(2px * var(--ui-scale, 1)) solid transparent}.thread-item:hover{background:#f8f5ee}.thread-item.active{background:#e9f4f1;border-left-color:var(--blue)}.thread-item-top{display:flex;justify-content:space-between;gap:calc(8px * var(--ui-scale, 1))}.thread-item strong{font-size:calc(12px * var(--ui-scale, 1));white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.thread-item time{font-size:calc(12px * var(--ui-scale, 1));color:#667085;white-space:nowrap}.thread-item p{font-size:calc(12px * var(--ui-scale, 1));color:#667085;margin:calc(4px * var(--ui-scale, 1)) 0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.thread-meta{font-size:calc(12px * var(--ui-scale, 1));color:#667085}.conversation-panel{min-width:0;display:flex;flex-direction:column}.conversation-head{padding:calc(18px * var(--ui-scale, 1)) calc(20px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1));border-bottom:calc(1px * var(--ui-scale, 1)) solid var(--line);display:flex;justify-content:space-between}.conversation-kicker{font-size:calc(12px * var(--ui-scale, 1));color:#667085;font-weight:700;letter-spacing:.08em;margin:0 0 calc(3px * var(--ui-scale, 1))}.conversation-head h2{font:700 calc(15px * var(--ui-scale, 1)) var(--display);margin:0}.subtle{background:#f8fafc;font-size:calc(12px * var(--ui-scale, 1))}.message-history{flex:1;min-height:calc(395px * var(--ui-scale, 1));max-height:calc(430px * var(--ui-scale, 1));overflow:auto;padding:calc(22px * var(--ui-scale, 1));background:linear-gradient(#fff,#fbfaf5);display:flex;flex-direction:column;gap:calc(11px * var(--ui-scale, 1))}.message-row{display:flex;max-width:77%;gap:calc(8px * var(--ui-scale, 1))}.message-row.agent{align-self:flex-end;flex-direction:row-reverse}.message-bubble{padding:calc(9px * var(--ui-scale, 1)) calc(11px * var(--ui-scale, 1));border-radius:calc(12px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)) calc(3px * var(--ui-scale, 1));background:#f2f1ea;color:#344054;font-size:calc(12px * var(--ui-scale, 1));line-height:1.45}.message-row.agent .message-bubble{background:var(--blue);color:#fff;border-radius:calc(12px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)) calc(3px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1))}.message-meta{font-size:calc(12px * var(--ui-scale, 1));color:#667085;margin-top:calc(4px * var(--ui-scale, 1))}.message-row.agent .message-meta{text-align:right}.composer,.email-composer{margin:calc(13px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1));border:calc(1px * var(--ui-scale, 1)) solid #ddd4c4;border-radius:calc(12px * var(--ui-scale, 1));padding:calc(4px * var(--ui-scale, 1)) calc(4px * var(--ui-scale, 1)) calc(4px * var(--ui-scale, 1)) calc(11px * var(--ui-scale, 1));display:flex;align-items:center;gap:calc(8px * var(--ui-scale, 1))}.composer input{font-size:calc(12px * var(--ui-scale, 1))}.composer .button{padding:calc(8px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1))}.email-composer{display:block;padding:0;margin-bottom:calc(16px * var(--ui-scale, 1))}.email-composer>input{display:block;padding:calc(10px * var(--ui-scale, 1)) calc(11px * var(--ui-scale, 1));border-bottom:calc(1px * var(--ui-scale, 1)) solid #e7eaf0;font-size:calc(12px * var(--ui-scale, 1))}.email-composer .composer{margin:0;border:0;border-radius:0}.directory-card{overflow:hidden}.directory-toolbar{padding:calc(14px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1));display:flex;justify-content:space-between;align-items:center;border-bottom:calc(1px * var(--ui-scale, 1)) solid var(--line)}.compact-input{margin:0;width:calc(290px * var(--ui-scale, 1));height:calc(34px * var(--ui-scale, 1))}.compact-input .button{display:none}.muted-label{font-size:calc(12px * var(--ui-scale, 1));color:#667085}.customer-directory{max-height:calc(540px * var(--ui-scale, 1));overflow:auto}.customer-row{display:grid;grid-template-columns:2fr 1.3fr 1.4fr 1fr;gap:calc(15px * var(--ui-scale, 1));align-items:center;padding:calc(13px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1));border-bottom:calc(1px * var(--ui-scale, 1)) solid #f1eee6}.customer-name{display:flex;align-items:center;gap:calc(9px * var(--ui-scale, 1))}.customer-name strong{font-size:calc(12px * var(--ui-scale, 1))}.customer-name small,.customer-contact{font-size:calc(12px * var(--ui-scale, 1));color:#667085;display:block;margin-top:calc(2px * var(--ui-scale, 1))}.customer-code{font-size:calc(12px * var(--ui-scale, 1));color:var(--blue);background:var(--blue-soft);font-weight:700;padding:calc(3px * var(--ui-scale, 1)) calc(5px * var(--ui-scale, 1));border-radius:calc(10px * var(--ui-scale, 1))}.modal-backdrop{display:none;position:fixed;inset:0;background:rgba(15, 23, 42,.45);z-index:20;place-items:center;padding:calc(20px * var(--ui-scale, 1))}.modal-backdrop.active{display:grid}.modal-card{position:relative;width:min(calc(455px * var(--ui-scale, 1)),100%);background:#fff;border-radius:calc(14px * var(--ui-scale, 1));padding:calc(27px * var(--ui-scale, 1));box-shadow:0 calc(20px * var(--ui-scale, 1)) calc(45px * var(--ui-scale, 1)) rgba(15, 23, 42,.2)}.modal-card h2{font:800 calc(20px * var(--ui-scale, 1)) var(--display);margin:0 0 calc(5px * var(--ui-scale, 1));letter-spacing:calc(-.5px * var(--ui-scale, 1))}.modal-description{color:var(--muted);font-size:calc(12px * var(--ui-scale, 1));line-height:1.5;margin:0 0 calc(19px * var(--ui-scale, 1))}.modal-close{position:absolute;right:calc(15px * var(--ui-scale, 1));top:calc(13px * var(--ui-scale, 1));border:0;background:transparent;color:#667085;font-size:calc(24px * var(--ui-scale, 1));cursor:pointer}.customer-form{display:grid;gap:calc(12px * var(--ui-scale, 1))}.customer-form label{color:#475467;font-size:calc(12px * var(--ui-scale, 1));font-weight:700;display:grid;gap:calc(5px * var(--ui-scale, 1))}.customer-form input,.customer-form select{border:calc(1px * var(--ui-scale, 1)) solid #d9dee7;border-radius:calc(12px * var(--ui-scale, 1));padding:calc(9px * var(--ui-scale, 1));font-size:calc(12px * var(--ui-scale, 1))}.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:calc(10px * var(--ui-scale, 1))}.incoming-call{text-align:center;width:min(calc(380px * var(--ui-scale, 1)),100%)}.call-pulse{width:calc(50px * var(--ui-scale, 1));height:calc(50px * var(--ui-scale, 1));margin:0 auto calc(12px * var(--ui-scale, 1));border-radius:50%;background:var(--blue-soft);color:var(--blue);font-size:calc(22px * var(--ui-scale, 1));display:grid;place-items:center;box-shadow:0 0 0 calc(8px * var(--ui-scale, 1)) rgba(13, 107, 92,.08)}.call-number{font:600 calc(16px * var(--ui-scale, 1)) var(--display);margin:0;color:#667085}.call-details{display:grid;grid-template-columns:1fr 1fr;gap:calc(8px * var(--ui-scale, 1));text-align:left;margin:calc(20px * var(--ui-scale, 1)) 0}.call-details div{padding:calc(9px * var(--ui-scale, 1));background:#f8fafc;border-radius:calc(12px * var(--ui-scale, 1))}.call-details div:last-child{grid-column:1/-1}.call-details span,.call-details strong{display:block}.call-details span{font-size:calc(12px * var(--ui-scale, 1));color:#667085;margin-bottom:calc(3px * var(--ui-scale, 1))}.call-details strong{font-size:calc(12px * var(--ui-scale, 1))}.toast-container{position:fixed;right:calc(20px * var(--ui-scale, 1));bottom:calc(20px * var(--ui-scale, 1));z-index:30;display:grid;gap:calc(8px * var(--ui-scale, 1))}.toast{background:#182230;color:#fff;border-radius:calc(12px * var(--ui-scale, 1));padding:calc(11px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1));font-size:calc(12px * var(--ui-scale, 1));box-shadow:0 calc(8px * var(--ui-scale, 1)) calc(25px * var(--ui-scale, 1)) rgba(15, 23, 42,.2);animation:slideIn .25s ease}.toast.success{border-left:calc(3px * var(--ui-scale, 1)) solid #2fa678}@keyframes slideIn{from{opacity:0;transform:translateY(calc(8px * var(--ui-scale, 1)))}to{opacity:1;transform:none}}@media(max-width:1320px){.app-shell{grid-template-columns:calc(230px * var(--ui-scale, 1)) minmax(0,1fr)}.utility-rail{display:none}.metric-grid{grid-template-columns:repeat(2,1fr)}}@media(max-width:900px){.app-shell{display:block}.sidebar{display:none}.topbar{padding:0 calc(16px * var(--ui-scale, 1))}.mobile-menu{display:block;border:0;background:transparent;font-size:calc(20px * var(--ui-scale, 1))}.global-search{width:min(60vw,calc(380px * var(--ui-scale, 1)))}.content-scroll{padding:calc(22px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1))}.dashboard-grid{grid-template-columns:1fr}.page-heading{align-items:flex-start;flex-direction:column}.customer-row{grid-template-columns:1.5fr 1fr}.customer-row .customer-contact{display:none}}@media(max-width:600px){.topbar{height:calc(60px * var(--ui-scale, 1))}.user-menu>span:not(.user-avatar){display:none}.global-search kbd{display:none}.metric-grid{grid-template-columns:1fr 1fr}.metric-card{padding:calc(12px * var(--ui-scale, 1))}.metric-card small{display:none}.inbox-layout{grid-template-columns:1fr}.thread-panel{border-right:0;border-bottom:calc(1px * var(--ui-scale, 1)) solid var(--line)}.thread-list{max-height:calc(180px * var(--ui-scale, 1))}.message-history{min-height:calc(290px * var(--ui-scale, 1))}.form-grid{grid-template-columns:1fr}.heading-actions{width:100%}.heading-actions .button{flex:1}.customer-row{display:flex;justify-content:space-between}.customer-row .location-pill{display:none}}
/* Customer actions */
.customer-row{grid-template-columns:2fr 1.3fr 1.4fr 1fr auto}
.customer-actions{display:flex;justify-content:flex-end}
.delete-action{color:var(--red);font-size:calc(16px * var(--ui-scale, 1));line-height:1;width:calc(27px * var(--ui-scale, 1));height:calc(27px * var(--ui-scale, 1));padding:0}
.delete-action:hover{background:#fbeded;color:#9c2f2f}
@media(max-width:900px){.customer-row{grid-template-columns:1.5fr 1fr auto}}

/* Contact import and customer/driver directory */
.directory-type-tabs{display:flex;gap:calc(7px * var(--ui-scale, 1));margin-bottom:calc(12px * var(--ui-scale, 1))}
.directory-type-tab{border:calc(1px * var(--ui-scale, 1)) solid #d9dee7;background:#fff;color:#667085;border-radius:calc(12px * var(--ui-scale, 1));padding:calc(8px * var(--ui-scale, 1)) calc(13px * var(--ui-scale, 1));font:700 calc(12px * var(--ui-scale, 1)) var(--font);cursor:pointer}
.directory-type-tab span{display:inline-grid;place-items:center;min-width:calc(20px * var(--ui-scale, 1));margin-left:calc(4px * var(--ui-scale, 1));padding:calc(2px * var(--ui-scale, 1)) calc(5px * var(--ui-scale, 1));border-radius:calc(12px * var(--ui-scale, 1));background:#f1f3f6;color:#667085;font-size:calc(12px * var(--ui-scale, 1))}
.directory-type-tab.active{border-color:#b9dbd0;background:var(--blue-soft);color:var(--blue)}
.directory-type-tab.active span{background:#fff;color:var(--blue)}
.import-format-hint{padding:calc(10px * var(--ui-scale, 1)) calc(18px * var(--ui-scale, 1));border-bottom:calc(1px * var(--ui-scale, 1)) solid #f1eee6;background:#f8fafc;color:#667085;font-size:calc(12px * var(--ui-scale, 1))}
.import-format-hint strong{color:#667085;font-weight:600}
.import-result{padding:calc(10px * var(--ui-scale, 1)) calc(18px * var(--ui-scale, 1));border-bottom:calc(1px * var(--ui-scale, 1)) solid #cfe9dc;background:#eef7f1;color:#146349;font-size:calc(12px * var(--ui-scale, 1));line-height:1.45}
.driver-row{grid-template-columns:2fr 1.3fr 1.4fr 1fr}
@media(max-width:900px){.driver-row{grid-template-columns:1.5fr 1fr 1fr}}
/* Email inbox */
.email-tools{padding:calc(11px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1));border-bottom:calc(1px * var(--ui-scale, 1)) solid var(--line);display:grid;gap:calc(8px * var(--ui-scale, 1))}
.email-search{margin:0;width:100%;height:calc(34px * var(--ui-scale, 1))}
.email-filter,.email-recipient select{width:100%;border:calc(1px * var(--ui-scale, 1)) solid #d9dee7;border-radius:calc(12px * var(--ui-scale, 1));padding:calc(8px * var(--ui-scale, 1)) calc(9px * var(--ui-scale, 1));background:#fff;color:#344054;font:calc(12px * var(--ui-scale, 1)) var(--font);outline-color:var(--blue)}
.email-recipient{padding:calc(13px * var(--ui-scale, 1)) calc(20px * var(--ui-scale, 1));border-bottom:calc(1px * var(--ui-scale, 1)) solid var(--line);display:flex;align-items:center;gap:calc(10px * var(--ui-scale, 1))}
.email-recipient label{font-size:calc(12px * var(--ui-scale, 1));font-weight:700;color:#667085}
.email-recipient select{flex:1;min-width:0}
.email-inbox-layout .thread-list{max-height:calc(470px * var(--ui-scale, 1))}
@media(max-width:600px){.email-recipient{align-items:stretch;flex-direction:column;gap:calc(6px * var(--ui-scale, 1))}.email-inbox-layout .thread-list{max-height:calc(180px * var(--ui-scale, 1))}}
/* Active call transfer actions */
.agent-call-actions{margin-left:auto;display:flex;align-items:center}
.transfer-agent-button{width:calc(30px * var(--ui-scale, 1));height:calc(30px * var(--ui-scale, 1));display:inline-grid;place-items:center;border:calc(1px * var(--ui-scale, 1)) solid #8fc9b9;background:#e9f4f1;color:#0a5a4d;border-radius:calc(10px * var(--ui-scale, 1));padding:0;cursor:pointer}
.transfer-agent-button:hover{background:#d9f0ea;color:#0b4f44}
.transfer-agent-button svg{width:calc(16px * var(--ui-scale, 1));height:calc(16px * var(--ui-scale, 1));fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.agents-list{justify-items:stretch;text-align:center}
.sidebar .sidebar-section-label{margin-left:0;margin-right:0;text-align:center}
.agent-department-group{width:100%;text-align:center}
.agent-department-group + .agent-department-group{margin-top:calc(16px * var(--ui-scale, 1));padding-top:calc(14px * var(--ui-scale, 1));border-top:calc(1px * var(--ui-scale, 1)) solid rgba(123, 135, 127,.2)}
.agent-department-heading{margin:0 0 calc(8px * var(--ui-scale, 1));padding:0 calc(2px * var(--ui-scale, 1));color:#93aca5;font-size:calc(12px * var(--ui-scale, 1));font-weight:800;letter-spacing:.1em;text-align:center}
.agent-department-empty{padding:calc(8px * var(--ui-scale, 1)) calc(4px * var(--ui-scale, 1));color:#93aca5;font-size:calc(12px * var(--ui-scale, 1));font-style:italic;text-align:center}
.agent-call-actions + .agent-status-controls{margin-left:0}
.recent-contact-grid{display:grid;grid-template-columns:1fr 1fr;gap:calc(9px * var(--ui-scale, 1));text-align:left;margin:calc(16px * var(--ui-scale, 1)) 0}
.recent-contact-section{min-width:0;padding:calc(10px * var(--ui-scale, 1));background:#f8fafc;border-radius:calc(12px * var(--ui-scale, 1))}
.recent-contact-section h3{font:700 calc(12px * var(--ui-scale, 1)) var(--display);margin:0 0 calc(7px * var(--ui-scale, 1));color:#475467}
.recent-contact-list{display:grid;gap:calc(6px * var(--ui-scale, 1));max-height:calc(126px * var(--ui-scale, 1));overflow:auto}
.recent-message{padding:calc(7px * var(--ui-scale, 1));background:#fff;border:calc(1px * var(--ui-scale, 1)) solid #e7eaf0;border-radius:calc(10px * var(--ui-scale, 1));overflow:hidden}
.recent-message strong,.recent-message p,.recent-message time{display:block}
.recent-message strong{font-size:calc(12px * var(--ui-scale, 1));white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.recent-message p{font-size:calc(12px * var(--ui-scale, 1));line-height:1.35;color:#667085;margin:calc(2px * var(--ui-scale, 1)) 0}
.recent-message time{font-size:calc(12px * var(--ui-scale, 1));color:#667085}
.recent-empty{font-size:calc(12px * var(--ui-scale, 1));color:#667085}
.call-modal-actions{display:grid;gap:calc(7px * var(--ui-scale, 1))}
@media(max-width:600px){.recent-contact-grid{grid-template-columns:1fr}}

/* Email layout alignment */
.email-tools {
  padding: calc(10px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1));
  border-bottom: calc(1px * var(--ui-scale, 1)) solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}
.email-search {
  width: 100% !important;
  max-width: 100%;
  height: calc(34px * var(--ui-scale, 1)) !important;
  margin: 0 !important;
  display: flex !important;
  align-items: center !important;
  padding: 0 calc(10px * var(--ui-scale, 1)) !important;
  border: calc(1px * var(--ui-scale, 1)) solid #d9dee7;
  border-radius: calc(12px * var(--ui-scale, 1));
  background: #fff;
  overflow: hidden;
}
.email-search > span {
  flex: 0 0 auto;
  font-size: calc(15px * var(--ui-scale, 1));
  color: #667085;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.email-search > input {
  flex: 1 1 auto !important;
  width: 100% !important;
  min-width: 0 !important;
  height: 100% !important;
  padding: 0 0 0 calc(6px * var(--ui-scale, 1)) !important;
  margin: 0 !important;
  font-size: calc(12px * var(--ui-scale, 1)) !important;
  box-sizing: border-box;
}
.ticket-controls {
  display: flex;
  align-items: flex-end;
  gap: calc(10px * var(--ui-scale, 1));
}
#btn-claim-ticket {
  align-self: flex-end !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: calc(28px * var(--ui-scale, 1));
  padding: 0 calc(10px * var(--ui-scale, 1)) !important;
  margin: 0;
  white-space: nowrap;
}

.search-card{cursor:pointer}
.search-card:focus{outline:calc(2px * var(--ui-scale, 1)) solid var(--blue);outline-offset:calc(2px * var(--ui-scale, 1))}
.customer-detail-view{display:block;min-height:calc(168px * var(--ui-scale, 1))}
.customer-detail-back{margin-bottom:calc(14px * var(--ui-scale, 1))}
.customer-detail-heading{display:flex;justify-content:space-between;gap:calc(12px * var(--ui-scale, 1));align-items:flex-start;margin-bottom:calc(16px * var(--ui-scale, 1))}
.customer-detail-heading>div:first-child{display:flex;align-items:center;gap:calc(10px * var(--ui-scale, 1));min-width:0}
.customer-detail-heading h3{font:800 calc(15px * var(--ui-scale, 1)) var(--display);letter-spacing:calc(-.3px * var(--ui-scale, 1));margin:0 0 calc(3px * var(--ui-scale, 1))}
.customer-detail-heading p,.customer-detail-heading small{display:block;color:var(--muted);font-size:calc(12px * var(--ui-scale, 1));margin:0}
.customer-detail-heading small{margin-top:calc(3px * var(--ui-scale, 1));color:#667085}
.customer-detail-actions{display:flex;gap:calc(5px * var(--ui-scale, 1));flex-shrink:0}
.customer-detail-actions .button{padding:calc(7px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1));font-size:calc(12px * var(--ui-scale, 1))}
.customer-detail-actions .button:disabled{opacity:.45;cursor:not-allowed}
.customer-favorite-button{width:calc(36px * var(--ui-scale, 1));height:calc(36px * var(--ui-scale, 1));display:inline-grid;place-items:center;flex:0 0 auto;border:calc(1px * var(--ui-scale, 1)) solid #d0d5dd;border-radius:calc(12px * var(--ui-scale, 1));background:#fff;color:#667085;cursor:pointer;transition:color .18s,background .18s,border-color .18s,transform .18s}.customer-favorite-button:hover{color:#b5670f;border-color:#d9a94d;background:#fdf8ee}.customer-favorite-button.is-favorite{color:#b5670f;border-color:#d99a3d;background:#fdf8ee}.customer-favorite-button:active{transform:scale(.94)}.customer-favorite-button svg{width:calc(19px * var(--ui-scale, 1));height:calc(19px * var(--ui-scale, 1));fill:currentColor;stroke:currentColor;stroke-width:1.5;stroke-linejoin:round}
.customer-history-grid{display:grid;grid-template-columns:1fr 1fr;gap:calc(10px * var(--ui-scale, 1))}
.customer-history-column{min-width:0;border:calc(1px * var(--ui-scale, 1)) solid #e7eaf0;border-radius:calc(12px * var(--ui-scale, 1));padding:calc(10px * var(--ui-scale, 1));background:#f8fafc}
.history-column-heading{display:flex;align-items:center;justify-content:space-between;margin-bottom:calc(8px * var(--ui-scale, 1))}
.history-column-heading h3{font:700 calc(12px * var(--ui-scale, 1)) var(--display);margin:0}
.history-column-heading span{font-size:calc(12px * var(--ui-scale, 1));color:var(--blue);background:var(--blue-soft);padding:calc(3px * var(--ui-scale, 1)) calc(6px * var(--ui-scale, 1));border-radius:calc(12px * var(--ui-scale, 1))}
.history-message-list{display:grid;gap:calc(6px * var(--ui-scale, 1));max-height:calc(260px * var(--ui-scale, 1));overflow-y:auto;overscroll-behavior:contain;scrollbar-gutter:stable}
.history-message{background:#fff;border:calc(1px * var(--ui-scale, 1)) solid #e7eaf0;border-radius:calc(10px * var(--ui-scale, 1));padding:calc(8px * var(--ui-scale, 1))}
.history-message.agent-message{background:#eef6f2;border-color:#d3e9e0}
.history-message-author,.history-message strong,.history-message p,.history-message time{display:block}
.history-message-author{font-size:calc(12px * var(--ui-scale, 1));font-weight:700;text-transform:uppercase;letter-spacing:.04em;color:#667085;margin-bottom:calc(3px * var(--ui-scale, 1))}
.history-message.agent-message .history-message-author{color:var(--blue)}
.history-message strong{font-size:calc(12px * var(--ui-scale, 1));white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.history-message p{font-size:calc(12px * var(--ui-scale, 1));line-height:1.35;color:#667085;margin:calc(3px * var(--ui-scale, 1)) 0}
.history-message time{font-size:calc(12px * var(--ui-scale, 1));color:#667085}
.history-empty{padding:calc(16px * var(--ui-scale, 1)) calc(4px * var(--ui-scale, 1));color:#667085;font-size:calc(12px * var(--ui-scale, 1));text-align:center}
@media(max-width:600px){.customer-detail-heading{display:block}.customer-detail-actions{margin-top:calc(12px * var(--ui-scale, 1))}.customer-detail-actions .button{flex:1}.customer-history-grid{grid-template-columns:1fr}}

/* ================================================================
   DESIGN REFRESH v3 — Balanced, Accessible, Modern
   Scaled ~10% down from v2. Customer search is now central.
   ================================================================ */

/* --- 1. GLOBAL --- */
body { font-size: calc(14.5px * var(--ui-scale, 1)); line-height: 1.5; }
.page-heading h1 { font-size: calc(26px * var(--ui-scale, 1)); letter-spacing: calc(-.9px * var(--ui-scale, 1)); }
.page-heading > div > p:not(.eyebrow) { font-size: calc(13.5px * var(--ui-scale, 1)); }
.eyebrow { font-size: calc(12px * var(--ui-scale, 1)); letter-spacing: .13em; }
.button { padding: calc(9px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1)); font-size: calc(12.5px * var(--ui-scale, 1)); border-radius: calc(12px * var(--ui-scale, 1)); transition: all .22s ease; }
.button-primary { box-shadow: 0 calc(2px * var(--ui-scale, 1)) calc(5px * var(--ui-scale, 1)) rgba(13, 107, 92,.18); }
.button-primary:hover { box-shadow: 0 calc(3px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)) rgba(13, 107, 92,.24); transform: translateY(calc(-1px * var(--ui-scale, 1))); }
.button-secondary:hover { border-color: #bfc6bd; }

/* --- 2. SIDEBAR --- */
.sidebar { padding: calc(26px * var(--ui-scale, 1)) calc(20px * var(--ui-scale, 1)) calc(20px * var(--ui-scale, 1)); }
.nav-item { padding: calc(12px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1)); font-size: calc(14px * var(--ui-scale, 1)); border-radius: calc(12px * var(--ui-scale, 1)); gap: calc(12px * var(--ui-scale, 1)); }
.nav-item > span { font-size: calc(20px * var(--ui-scale, 1)); }
.nav-item b { font-size: calc(12px * var(--ui-scale, 1)); padding: calc(3px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1)); }
.agent-mini { padding: calc(11px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)); gap: calc(11px * var(--ui-scale, 1)); border-radius: calc(12px * var(--ui-scale, 1)); }
.agent-avatar { width: calc(36px * var(--ui-scale, 1)); height: calc(36px * var(--ui-scale, 1)); font-size: calc(12.5px * var(--ui-scale, 1)); }
.agent-avatar:after { width: calc(9px * var(--ui-scale, 1)); height: calc(9px * var(--ui-scale, 1)); }
.agent-mini strong { font-size: calc(13.5px * var(--ui-scale, 1)); }
.agent-mini small { font-size: calc(12px * var(--ui-scale, 1)); margin-top: calc(2px * var(--ui-scale, 1)); }
.agent-status-controls button { width: calc(9px * var(--ui-scale, 1)); height: calc(9px * var(--ui-scale, 1)); }
.sidebar-section-label { font-size: calc(12px * var(--ui-scale, 1)); margin: calc(32px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1)) calc(13px * var(--ui-scale, 1)); }
.workspace-switcher strong { font-size: calc(13.5px * var(--ui-scale, 1)); }
.workspace-switcher small { font-size: calc(12px * var(--ui-scale, 1)); }

/* --- DYNAMIC AGENT ACTION CONTROLS ROW --- */
.agent-controls-row {
  display: flex;
  align-items: center;
  gap: calc(8px * var(--ui-scale, 1));
  margin: calc(-15px * var(--ui-scale, 1)) 0 calc(22px * var(--ui-scale, 1)) 0;
}

.agent-controls-row .queue-profile-accordion {
  margin: 0;
  flex: 1;
  min-width: 0;
}

/* Dynamic Button Color States for Kø Profil Status Card (Matching Left Sidebar Menu Style) */
.queue-card-wrapper {
  width: 100%;
  border-radius: calc(10px * var(--ui-scale, 1));
  padding: calc(6px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: calc(3px * var(--ui-scale, 1));
  background: #17352e !important;
  border: calc(1px * var(--ui-scale, 1)) solid #1f4239 !important;
  box-shadow: none !important;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.queue-card-wrapper:hover {
  background: #1a2d26 !important;
  border-color: #2b473c !important;
}

.queue-card-wrapper .queue-accordion-btn {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  width: 100%;
  min-height: calc(26px * var(--ui-scale, 1));
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: calc(8px * var(--ui-scale, 1));
  cursor: pointer;
  text-align: left;
  position: relative;
}

.topbar { position: relative !important; }
.global-search-wrap {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  justify-content: center;
  align-items: center;
}

.queue-card-actions-row {
  display: flex;
  gap: calc(12px * var(--ui-scale, 1));
  align-items: center;
  justify-content: center;
  width: 100%;
  padding-top: calc(9px * var(--ui-scale, 1));
  border-top: calc(1px * var(--ui-scale, 1)) solid rgba(255, 255, 255, 0.12);
  margin-top: calc(2px * var(--ui-scale, 1));
}

.queue-card-actions-row .pause-control-container {
  flex: 0 0 auto;
}

.queue-card-actions-row .btn-agent-action {
  width: calc(44px * var(--ui-scale, 1)) !important;
  height: calc(36px * var(--ui-scale, 1)) !important;
  border-radius: calc(12px * var(--ui-scale, 1)) !important;
  font-size: calc(16px * var(--ui-scale, 1)) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.queue-accordion-btn .queue-btn-icon {
  width: calc(32px * var(--ui-scale, 1));
  height: calc(32px * var(--ui-scale, 1));
  border-radius: calc(12px * var(--ui-scale, 1));
  background: #d9ede7;
  color: #0d6b5c;
  display: grid;
  place-items: center;
  font-size: calc(15px * var(--ui-scale, 1));
  font-weight: 700;
  flex: 0 0 calc(32px * var(--ui-scale, 1));
  margin: 0;
}

.queue-accordion-btn .queue-btn-text {
  text-align: center;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.queue-accordion-btn .queue-btn-text strong {
  color: #ffffff;
  font: 600 calc(14px * var(--ui-scale, 1)) var(--font);
  display: block;
  text-align: center;
  width: 100%;
}

/* Hidden to avoid duplicating "Ingen linje valgt" on the Område card */
.zisson-line-summary {
  display: none !important;
}

.zisson-line-summary[data-state="on"] { color: #7ee0bf; }
.zisson-line-summary[data-state="off"] { color: #9db0a8; font-style: italic; }

/* Crisp Pastel Sub-Text for Line Name & Timer (Matching Left Menu Typography) */
.status-lines-sub {
  color: #9db0a8 !important;
  font-weight: 600 !important;
  font-size: calc(12px * var(--ui-scale, 1)) !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: calc(2px * var(--ui-scale, 1));
  text-shadow: none !important;
  display: block;
  text-align: center !important;
  width: 100%;
}

.status-timer-sub {
  font-size: calc(12px * var(--ui-scale, 1)) !important;
  color: #7b8a80 !important;
  font-weight: 600 !important;
  margin-top: calc(1px * var(--ui-scale, 1));
  text-shadow: none !important;
  display: block;
  text-align: center;
}

.queue-accordion-btn .queue-chevron {
  color: rgba(255, 255, 255, 0.9);
  flex: 0 0 calc(32px * var(--ui-scale, 1));
  width: calc(32px * var(--ui-scale, 1));
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-left: auto;
}

/* Action Control Buttons (Vibrant Action Buttons) */
.btn-agent-action {
  width: calc(42px * var(--ui-scale, 1));
  height: calc(42px * var(--ui-scale, 1));
  border-radius: calc(12px * var(--ui-scale, 1));
  border: calc(1px * var(--ui-scale, 1)) solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(16px * var(--ui-scale, 1));
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.btn-agent-action:hover {
  transform: translateY(calc(-1px * var(--ui-scale, 1)));
}

.btn-agent-action:active {
  transform: translateY(0);
}

.btn-agent-action.disabled-gray {
  background: #2f3d37 !important;
  border-color: #44524c !important;
  color: #8a9690 !important;
  box-shadow: none !important;
  opacity: 0.65;
}

.btn-pause {
  background: #b5670f;
  border-color: #d99a3d;
  color: #ffffff;
  box-shadow: 0 calc(2px * var(--ui-scale, 1)) calc(6px * var(--ui-scale, 1)) rgba(181, 103, 15, 0.2);
}

.btn-pause:hover {
  background: #b5670f;
}

.btn-pause.active-resume {
  background: #0f805f;
  border-color: #3fbf83;
  color: #ffffff;
  box-shadow: 0 calc(2px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1)) rgba(15, 128, 95, 0.3);
  animation: pulseResume 2s infinite;
}

.btn-pause.active-resume:hover {
  background: #0f805f;
}

@keyframes pulseResume {
  0% { box-shadow: 0 0 0 0 rgba(15, 128, 95, 0.5); }
  70% { box-shadow: 0 0 0 calc(8px * var(--ui-scale, 1)) rgba(15, 128, 95, 0); }
  100% { box-shadow: 0 0 0 0 rgba(15, 128, 95, 0); }
}

.btn-logout {
  background: #c24747;
  border-color: #d98a8a;
  color: #ffffff;
  box-shadow: 0 calc(2px * var(--ui-scale, 1)) calc(6px * var(--ui-scale, 1)) rgba(194, 71, 71, 0.2);
}

.btn-logout:hover {
  background: #b03d3d;
}

/* Pause Dropdown Menu */
.pause-control-container {
  position: relative;
}

.pause-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(46px * var(--ui-scale, 1));
  right: 0;
  width: calc(140px * var(--ui-scale, 1));
  background: #14251f;
  border: calc(1px * var(--ui-scale, 1)) solid #24382f;
  border-radius: calc(12px * var(--ui-scale, 1));
  padding: calc(5px * var(--ui-scale, 1));
  box-shadow: 0 calc(8px * var(--ui-scale, 1)) calc(24px * var(--ui-scale, 1)) rgba(0, 0, 0, 0.45);
  z-index: 20;
  animation: fadeInDown 0.18s ease forwards;
}

.pause-control-container.open .pause-dropdown-menu {
  display: flex;
  flex-direction: column;
  gap: calc(3px * var(--ui-scale, 1));
}

.pause-option-btn {
  background: transparent;
  border: 0;
  color: #e4e7ec;
  padding: calc(8px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
  font-family: inherit;
  font-size: calc(12.5px * var(--ui-scale, 1));
  font-weight: 600;
  text-align: left;
  border-radius: calc(10px * var(--ui-scale, 1));
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: calc(8px * var(--ui-scale, 1));
  transition: background-color 0.15s ease;
}

.pause-option-btn:hover {
  background: #23382e;
  color: #fff;
}

.queue-profile-accordion {
  position: relative;
}

.queue-accordion-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: calc(9px * var(--ui-scale, 1));
  padding: calc(10px * var(--ui-scale, 1)) calc(11px * var(--ui-scale, 1));
  background: #152720;
  border: calc(1px * var(--ui-scale, 1)) solid #24382f;
  border-radius: calc(12px * var(--ui-scale, 1));
  color: #fff;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.queue-accordion-btn:hover {
  background: #1a342a;
  border-color: #2d4f42;
}

.queue-btn-icon {
  width: calc(28px * var(--ui-scale, 1));
  height: calc(28px * var(--ui-scale, 1));
  border-radius: calc(12px * var(--ui-scale, 1));
  background: rgba(18, 128, 109, 0.15);
  color: #8ad0c0;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.queue-btn-text {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  min-width: 0;
}

.queue-btn-text strong {
  font-size: calc(12px * var(--ui-scale, 1));
  color: #e4e7ec;
  font-weight: 700;
}

.queue-btn-text small {
  font-size: calc(12px * var(--ui-scale, 1));
  color: #8ea79e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: calc(1px * var(--ui-scale, 1));
}

.queue-chevron {
  font-size: calc(12px * var(--ui-scale, 1));
  color: #8ea79e;
  transition: transform 0.25s ease;
}

.queue-profile-accordion.open .queue-chevron {
  transform: rotate(180deg);
  color: #8ad0c0;
}

.queue-panel-content {
  display: none;
  margin-top: calc(8px * var(--ui-scale, 1));
  padding: calc(10px * var(--ui-scale, 1));
  background: #14251f;
  border: calc(1px * var(--ui-scale, 1)) solid #24382f;
  border-radius: calc(12px * var(--ui-scale, 1));
  box-shadow: 0 calc(8px * var(--ui-scale, 1)) calc(24px * var(--ui-scale, 1)) rgba(0, 0, 0, 0.4);
  animation: fadeInDown 0.2s ease forwards;
}

.queue-profile-accordion.open .queue-panel-content {
  display: block;
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(calc(-6px * var(--ui-scale, 1))); }
  to { opacity: 1; transform: translateY(0); }
}

.queue-toggle-list {
  display: flex;
  flex-direction: column;
  gap: calc(6px * var(--ui-scale, 1));
}

.queue-toggle-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(7px * var(--ui-scale, 1)) calc(9px * var(--ui-scale, 1));
  background: #182c25;
  border: calc(1px * var(--ui-scale, 1)) solid #25423a;
  border-radius: calc(12px * var(--ui-scale, 1));
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.queue-toggle-item:hover {
  background: #23382e;
  border-color: #2f5245;
}

.queue-info {
  display: flex;
  flex-direction: column;
  gap: calc(1px * var(--ui-scale, 1));
}

.queue-info strong {
  font-size: calc(12px * var(--ui-scale, 1));
  color: #e4e7ec;
  font-weight: 600;
}

.queue-info small {
  font-size: calc(12px * var(--ui-scale, 1));
  color: #8ea79e;
}

/* Modern iOS/SaaS Toggle Switch Slider */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: calc(34px * var(--ui-scale, 1));
  height: calc(18px * var(--ui-scale, 1));
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #32453c;
  transition: 0.25s ease;
  border-radius: calc(18px * var(--ui-scale, 1));
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: calc(14px * var(--ui-scale, 1));
  width: calc(14px * var(--ui-scale, 1));
  left: calc(2px * var(--ui-scale, 1));
  bottom: calc(2px * var(--ui-scale, 1));
  background-color: #ffffff;
  transition: 0.25s ease;
  border-radius: 50%;
  box-shadow: 0 calc(1px * var(--ui-scale, 1)) calc(3px * var(--ui-scale, 1)) rgba(0,0,0,0.3);
}

.toggle-switch input:checked + .toggle-slider {
  background-color: #0f8a76;
  box-shadow: 0 0 calc(8px * var(--ui-scale, 1)) rgba(15, 138, 118, 0.4);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(calc(16px * var(--ui-scale, 1)));
}

/* --- 3. TOPBAR --- */
.topbar { height: calc(74px * var(--ui-scale, 1)); backdrop-filter: blur(calc(12px * var(--ui-scale, 1))); }
.global-search { height: calc(40px * var(--ui-scale, 1)); width: calc(400px * var(--ui-scale, 1)); border-radius: calc(12px * var(--ui-scale, 1)); padding: 0 calc(12px * var(--ui-scale, 1)); }
.global-search input { font-size: calc(13.5px * var(--ui-scale, 1)); }
.global-search kbd { font-size: calc(12px * var(--ui-scale, 1)); padding: calc(3px * var(--ui-scale, 1)) calc(6px * var(--ui-scale, 1)); border-radius: calc(10px * var(--ui-scale, 1)); }
.user-menu { font-size: calc(12.5px * var(--ui-scale, 1)); gap: calc(8px * var(--ui-scale, 1)); }
.workspace-avatar, .user-avatar { width: calc(30px * var(--ui-scale, 1)); height: calc(30px * var(--ui-scale, 1)); font-size: calc(12px * var(--ui-scale, 1)); border-radius: calc(12px * var(--ui-scale, 1)); }

/* --- 4. METRICS --- */
.metric-grid { gap: calc(14px * var(--ui-scale, 1)); margin-bottom: calc(22px * var(--ui-scale, 1)); }
.metric-card { padding: calc(18px * var(--ui-scale, 1)) calc(20px * var(--ui-scale, 1)); border-radius: calc(14px * var(--ui-scale, 1)); gap: calc(13px * var(--ui-scale, 1)); box-shadow: 0 calc(1px * var(--ui-scale, 1)) calc(3px * var(--ui-scale, 1)) rgba(15, 23, 42,.04); transition: box-shadow .2s ease, transform .2s ease; }
.metric-card:hover { box-shadow: 0 calc(3px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1)) rgba(15, 23, 42,.07); transform: translateY(calc(-1px * var(--ui-scale, 1))); }
.metric-icon, .quick-icon { width: calc(37px * var(--ui-scale, 1)); height: calc(37px * var(--ui-scale, 1)); border-radius: calc(12px * var(--ui-scale, 1)); font-size: calc(17px * var(--ui-scale, 1)); }
.metric-card span { font-size: calc(12px * var(--ui-scale, 1)); }
.metric-card strong { font-size: calc(23px * var(--ui-scale, 1)); letter-spacing: calc(-.7px * var(--ui-scale, 1)); }
.metric-card small { font-size: calc(12px * var(--ui-scale, 1)); }

/* --- 5. DASHBOARD LAYOUT — Customer Search is Central --- */
.surface { border-radius: calc(14px * var(--ui-scale, 1)); box-shadow: 0 calc(1px * var(--ui-scale, 1)) calc(3px * var(--ui-scale, 1)) rgba(15, 23, 42,.03); }
.surface-heading { padding: calc(20px * var(--ui-scale, 1)) calc(22px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1)); }
.surface-heading h2, .rail-heading h2, .thread-panel-head h2 { font-size: calc(15px * var(--ui-scale, 1)); letter-spacing: calc(-.25px * var(--ui-scale, 1)); }
.surface-heading p, .rail-heading p { font-size: calc(12px * var(--ui-scale, 1)); }
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: calc(18px * var(--ui-scale, 1));
}
.customer-lookup {
  order: -1;
  min-height: calc(340px * var(--ui-scale, 1));
}
.activity-card {
  min-height: calc(650px * var(--ui-scale, 1));
  max-height: none;
  overflow: visible;
}
.content-scroll { padding: calc(30px * var(--ui-scale, 1)) calc(32px * var(--ui-scale, 1)) calc(50px * var(--ui-scale, 1)); }

/* --- 6. CALL LOGS (compact list fitting 15+ items on screen) --- */
.call-log {
  padding: calc(6px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1)) !important;
  gap: calc(10px * var(--ui-scale, 1)) !important;
}
.log-symbol {
  width: calc(26px * var(--ui-scale, 1)) !important;
  height: calc(26px * var(--ui-scale, 1)) !important;
  font-size: calc(13px * var(--ui-scale, 1)) !important;
  flex: 0 0 calc(26px * var(--ui-scale, 1)) !important;
}
.call-log-main strong {
  font-size: calc(12px * var(--ui-scale, 1)) !important;
  line-height: 1.25 !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.call-log-main span {
  font-size: calc(12px * var(--ui-scale, 1)) !important;
  margin-top: calc(1px * var(--ui-scale, 1)) !important;
  line-height: 1.2 !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.log-right {
  font-size: calc(12px * var(--ui-scale, 1)) !important;
  line-height: 1.2 !important;
}
.call-status {
  font-size: calc(12px * var(--ui-scale, 1)) !important;
  margin-top: calc(1px * var(--ui-scale, 1)) !important;
}

/* --- 7. CUSTOMER SEARCH & CARDS --- */
.lookup-input-wrap { margin: 0 calc(22px * var(--ui-scale, 1)); padding: calc(5px * var(--ui-scale, 1)) calc(6px * var(--ui-scale, 1)) calc(5px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)); border-radius: calc(12px * var(--ui-scale, 1)); }
.lookup-input-wrap input { font-size: calc(13.5px * var(--ui-scale, 1)); }
.lookup-input-wrap .button { padding: calc(8px * var(--ui-scale, 1)) calc(13px * var(--ui-scale, 1)); }
.search-results { margin: calc(18px * var(--ui-scale, 1)) calc(22px * var(--ui-scale, 1)); }
.search-card { padding: calc(13px * var(--ui-scale, 1)) calc(13px * var(--ui-scale, 1)); border-radius: calc(12px * var(--ui-scale, 1)); gap: calc(12px * var(--ui-scale, 1)); margin-bottom: calc(9px * var(--ui-scale, 1)); transition: border-color .2s ease, box-shadow .2s ease; }
.search-card:hover { border-color: #d0d5dd; box-shadow: 0 calc(2px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1)) rgba(15, 23, 42,.05); }
.customer-initial { width: calc(35px * var(--ui-scale, 1)); height: calc(35px * var(--ui-scale, 1)); border-radius: calc(12px * var(--ui-scale, 1)); font-size: calc(12px * var(--ui-scale, 1)); }
.search-card-main strong { font-size: calc(13px * var(--ui-scale, 1)); }
.search-card-main p { font-size: calc(12px * var(--ui-scale, 1)); margin: calc(3px * var(--ui-scale, 1)) 0 0; }
.customer-code { font-size: calc(12px * var(--ui-scale, 1)); padding: calc(3px * var(--ui-scale, 1)) calc(6px * var(--ui-scale, 1)); border-radius: calc(10px * var(--ui-scale, 1)); }
.small-action { padding: calc(6px * var(--ui-scale, 1)) calc(7px * var(--ui-scale, 1)); border-radius: calc(10px * var(--ui-scale, 1)); font-size: calc(12px * var(--ui-scale, 1)); }
.location-pill { font-size: calc(12px * var(--ui-scale, 1)); padding: calc(4px * var(--ui-scale, 1)) calc(7px * var(--ui-scale, 1)); border-radius: calc(10px * var(--ui-scale, 1)); }
.empty-state { font-size: calc(12.5px * var(--ui-scale, 1)); min-height: calc(180px * var(--ui-scale, 1)); border-radius: calc(12px * var(--ui-scale, 1)); }
.empty-icon { font-size: calc(28px * var(--ui-scale, 1)); }

/* --- 8. ★ INCOMING CALL POPUP ★ --- */
.modal-backdrop { background: rgba(10, 31, 26,.55); backdrop-filter: blur(calc(6px * var(--ui-scale, 1))); }
.modal-card { border-radius: calc(15px * var(--ui-scale, 1)); padding: calc(28px * var(--ui-scale, 1)); box-shadow: 0 calc(22px * var(--ui-scale, 1)) calc(55px * var(--ui-scale, 1)) rgba(10, 31, 26,.26); }
.modal-card h2 { font-size: calc(20px * var(--ui-scale, 1)); }
.modal-close { right: calc(16px * var(--ui-scale, 1)); top: calc(14px * var(--ui-scale, 1)); font-size: calc(26px * var(--ui-scale, 1)); width: calc(34px * var(--ui-scale, 1)); height: calc(34px * var(--ui-scale, 1)); border-radius: calc(12px * var(--ui-scale, 1)); display: grid; place-items: center; }
.modal-close:hover { background: #f2f4f7; }

.incoming-call { width: min(calc(510px * var(--ui-scale, 1)), 95vw); padding: calc(36px * var(--ui-scale, 1)) calc(32px * var(--ui-scale, 1)); }
.incoming-call .eyebrow { justify-content: center; font-size: calc(12px * var(--ui-scale, 1)); letter-spacing: .15em; margin-bottom: calc(9px * var(--ui-scale, 1)); }
.call-pulse {
  width: calc(68px * var(--ui-scale, 1)); height: calc(68px * var(--ui-scale, 1)); margin: 0 auto calc(16px * var(--ui-scale, 1));
  font-size: calc(30px * var(--ui-scale, 1)); border-radius: 50%;
  box-shadow: 0 0 0 calc(10px * var(--ui-scale, 1)) rgba(13, 107, 92,.1), 0 0 0 calc(22px * var(--ui-scale, 1)) rgba(13, 107, 92,.04);
  animation: pulseRing 2s ease-out infinite;
}
@keyframes pulseRing {
  0% { box-shadow: 0 0 0 calc(9px * var(--ui-scale, 1)) rgba(13, 107, 92,.12), 0 0 0 calc(18px * var(--ui-scale, 1)) rgba(13, 107, 92,.05); }
  50% { box-shadow: 0 0 0 calc(14px * var(--ui-scale, 1)) rgba(13, 107, 92,.08), 0 0 0 calc(27px * var(--ui-scale, 1)) rgba(13, 107, 92,.02); }
  100% { box-shadow: 0 0 0 calc(9px * var(--ui-scale, 1)) rgba(13, 107, 92,.12), 0 0 0 calc(18px * var(--ui-scale, 1)) rgba(13, 107, 92,.05); }
}
.incoming-call h2 { font-size: calc(25px * var(--ui-scale, 1)); letter-spacing: calc(-.6px * var(--ui-scale, 1)); margin-bottom: calc(3px * var(--ui-scale, 1)); }
.call-number { font-size: calc(18px * var(--ui-scale, 1)); letter-spacing: calc(-.2px * var(--ui-scale, 1)); }
.call-details { gap: calc(10px * var(--ui-scale, 1)); margin: calc(22px * var(--ui-scale, 1)) 0; }
.call-details div { padding: calc(12px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1)); border-radius: calc(12px * var(--ui-scale, 1)); background: #f5f2ea; }
.call-details span { font-size: calc(12px * var(--ui-scale, 1)); margin-bottom: calc(4px * var(--ui-scale, 1)); font-weight: 600; letter-spacing: .03em; text-transform: uppercase; }
.call-details strong { font-size: calc(14px * var(--ui-scale, 1)); }
.call-modal-actions { gap: calc(9px * var(--ui-scale, 1)); }
.call-modal-actions .button { padding: calc(13px * var(--ui-scale, 1)); font-size: calc(14px * var(--ui-scale, 1)); border-radius: calc(12px * var(--ui-scale, 1)); }

/* Recent SMS/Email context inside call popup */
.recent-contact-grid { gap: calc(12px * var(--ui-scale, 1)); margin: calc(22px * var(--ui-scale, 1)) 0; }
.recent-contact-section { padding: calc(14px * var(--ui-scale, 1)); border-radius: calc(12px * var(--ui-scale, 1)); background: #f7f8fa; }
.recent-contact-section h3 { font-size: calc(13px * var(--ui-scale, 1)); margin-bottom: calc(9px * var(--ui-scale, 1)); letter-spacing: calc(-.1px * var(--ui-scale, 1)); }
.recent-contact-list { gap: calc(7px * var(--ui-scale, 1)); max-height: calc(180px * var(--ui-scale, 1)); }
.recent-message { padding: calc(10px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)); border-radius: calc(12px * var(--ui-scale, 1)); }
.recent-message strong { font-size: calc(12px * var(--ui-scale, 1)); }
.recent-message p { font-size: calc(12px * var(--ui-scale, 1)); line-height: 1.45; margin: calc(3px * var(--ui-scale, 1)) 0; }
.recent-message time { font-size: calc(12px * var(--ui-scale, 1)); }
.recent-empty { font-size: calc(12px * var(--ui-scale, 1)); }

/* --- 9. ★ CUSTOMER DETAIL — History Panels ★ --- */
.customer-detail-back .text-button { font-size: calc(12.5px * var(--ui-scale, 1)); padding: calc(5px * var(--ui-scale, 1)) 0; }
.customer-detail-heading { gap: calc(14px * var(--ui-scale, 1)); margin-bottom: calc(20px * var(--ui-scale, 1)); }
.customer-detail-heading > div:first-child { gap: calc(12px * var(--ui-scale, 1)); }
.customer-detail-heading h3 { font-size: calc(18px * var(--ui-scale, 1)); letter-spacing: calc(-.4px * var(--ui-scale, 1)); margin-bottom: calc(4px * var(--ui-scale, 1)); }
.customer-detail-heading p { font-size: calc(12.5px * var(--ui-scale, 1)); }
.customer-detail-heading small { font-size: calc(12px * var(--ui-scale, 1)); margin-top: calc(3px * var(--ui-scale, 1)); }
.customer-detail-actions { gap: calc(6px * var(--ui-scale, 1)); }
.customer-detail-actions .button { padding: calc(8px * var(--ui-scale, 1)) calc(11px * var(--ui-scale, 1)); font-size: calc(12px * var(--ui-scale, 1)); }
.customer-history-grid { gap: calc(14px * var(--ui-scale, 1)); }
.customer-history-column { padding: calc(14px * var(--ui-scale, 1)); border-radius: calc(14px * var(--ui-scale, 1)); }
.history-column-heading { margin-bottom: calc(10px * var(--ui-scale, 1)); }
.history-column-heading h3 { font-size: calc(13px * var(--ui-scale, 1)); }
.history-column-heading span { font-size: calc(12px * var(--ui-scale, 1)); padding: calc(3px * var(--ui-scale, 1)) calc(7px * var(--ui-scale, 1)); }
.history-message-list { max-height: calc(360px * var(--ui-scale, 1)); gap: calc(7px * var(--ui-scale, 1)); }
.history-message { padding: calc(11px * var(--ui-scale, 1)) calc(13px * var(--ui-scale, 1)); border-radius: calc(12px * var(--ui-scale, 1)); }
.history-message-author { font-size: calc(12px * var(--ui-scale, 1)); margin-bottom: calc(4px * var(--ui-scale, 1)); }
.history-message.agent-message .history-message-author { font-size: calc(12px * var(--ui-scale, 1)); }
.history-message strong { font-size: calc(12px * var(--ui-scale, 1)); }
.history-message p { font-size: calc(12px * var(--ui-scale, 1)); line-height: 1.5; margin: calc(4px * var(--ui-scale, 1)) 0; }
.history-message time { font-size: calc(12px * var(--ui-scale, 1)); }
.history-empty { font-size: calc(12px * var(--ui-scale, 1)); padding: calc(22px * var(--ui-scale, 1)) calc(6px * var(--ui-scale, 1)); }

/* --- 10. ★ SMS / EMAIL INBOX ★ --- */
.inbox-layout { min-height: calc(600px * var(--ui-scale, 1)); }
.thread-panel-head { padding: calc(18px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1)); }
.thread-list { max-height: calc(550px * var(--ui-scale, 1)); }
.thread-item { padding: calc(14px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1)); }
.thread-item strong { font-size: calc(13px * var(--ui-scale, 1)); }
.thread-item time { font-size: calc(12px * var(--ui-scale, 1)); }
.thread-item p { font-size: calc(12px * var(--ui-scale, 1)); margin: calc(4px * var(--ui-scale, 1)) 0; }
.thread-meta { font-size: calc(12px * var(--ui-scale, 1)); }
.count-pill { font-size: calc(12px * var(--ui-scale, 1)); padding: calc(3px * var(--ui-scale, 1)) calc(7px * var(--ui-scale, 1)); }
.conversation-head { padding: calc(18px * var(--ui-scale, 1)) calc(22px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1)); }
.conversation-kicker { font-size: calc(12px * var(--ui-scale, 1)); }
.conversation-head h2 { font-size: calc(16px * var(--ui-scale, 1)); }
.message-history { min-height: calc(430px * var(--ui-scale, 1)); max-height: calc(490px * var(--ui-scale, 1)); padding: calc(24px * var(--ui-scale, 1)); gap: calc(12px * var(--ui-scale, 1)); }
.message-row { max-width: 76%; }
.message-bubble { padding: calc(11px * var(--ui-scale, 1)) calc(15px * var(--ui-scale, 1)); border-radius: calc(12px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)) calc(3px * var(--ui-scale, 1)); font-size: calc(13.5px * var(--ui-scale, 1)); line-height: 1.5; }
.message-row.agent .message-bubble { border-radius: calc(12px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)) calc(3px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)); }
.message-meta { font-size: calc(12px * var(--ui-scale, 1)); margin-top: calc(4px * var(--ui-scale, 1)); }
.composer { margin: calc(14px * var(--ui-scale, 1)) calc(18px * var(--ui-scale, 1)); padding: calc(5px * var(--ui-scale, 1)) calc(5px * var(--ui-scale, 1)) calc(5px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)); border-radius: calc(12px * var(--ui-scale, 1)); }
.composer input { font-size: calc(13.5px * var(--ui-scale, 1)); }
.composer .button { padding: calc(9px * var(--ui-scale, 1)) calc(13px * var(--ui-scale, 1)); }

/* Email specifics */
.email-tools { padding: calc(12px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)); gap: calc(9px * var(--ui-scale, 1)); }
.email-search { width: auto; height: calc(36px * var(--ui-scale, 1)); min-width: 0; overflow: hidden; }
.email-search input { flex: 1 1 auto; width: auto; min-width: 0; }
.email-filter, .email-recipient select { padding: calc(9px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1)); font-size: calc(12.5px * var(--ui-scale, 1)); border-radius: calc(12px * var(--ui-scale, 1)); }
.email-recipient { padding: calc(14px * var(--ui-scale, 1)) calc(22px * var(--ui-scale, 1)); gap: calc(11px * var(--ui-scale, 1)); }
.email-recipient label { font-size: calc(12.5px * var(--ui-scale, 1)); }
.email-inbox-layout .thread-list { max-height: calc(500px * var(--ui-scale, 1)); }
.email-composer > input { padding: calc(12px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1)); font-size: calc(12.5px * var(--ui-scale, 1)); }

/* --- 11. CUSTOMER DIRECTORY --- */
.directory-toolbar { padding: calc(14px * var(--ui-scale, 1)) calc(18px * var(--ui-scale, 1)); }
.compact-input { width: calc(300px * var(--ui-scale, 1)); height: calc(36px * var(--ui-scale, 1)); }
.muted-label { font-size: calc(12.5px * var(--ui-scale, 1)); }
.customer-directory { max-height: calc(570px * var(--ui-scale, 1)); }
.customer-row { padding: calc(14px * var(--ui-scale, 1)) calc(18px * var(--ui-scale, 1)); gap: calc(16px * var(--ui-scale, 1)); }
.customer-name { gap: calc(11px * var(--ui-scale, 1)); }
.customer-name strong { font-size: calc(13px * var(--ui-scale, 1)); }
.customer-name small, .customer-contact { font-size: calc(12px * var(--ui-scale, 1)); }
.customer-code { font-size: calc(12px * var(--ui-scale, 1)); padding: calc(3px * var(--ui-scale, 1)) calc(6px * var(--ui-scale, 1)); }
.delete-action { width: calc(30px * var(--ui-scale, 1)); height: calc(30px * var(--ui-scale, 1)); font-size: calc(17px * var(--ui-scale, 1)); border-radius: calc(10px * var(--ui-scale, 1)); }

/* Customer form modal */
.modal-description { font-size: calc(13px * var(--ui-scale, 1)); margin-bottom: calc(20px * var(--ui-scale, 1)); }
.customer-form { gap: calc(13px * var(--ui-scale, 1)); }
.customer-form label { font-size: calc(12.5px * var(--ui-scale, 1)); gap: calc(5px * var(--ui-scale, 1)); }
.customer-form input, .customer-form select { padding: calc(10px * var(--ui-scale, 1)) calc(11px * var(--ui-scale, 1)); font-size: calc(13px * var(--ui-scale, 1)); border-radius: calc(12px * var(--ui-scale, 1)); }
.form-grid { gap: calc(11px * var(--ui-scale, 1)); }

/* Transfer button */
.transfer-agent-button { padding: 0; border-radius: calc(10px * var(--ui-scale, 1)); }

/* --- 12. UTILITY RAIL --- */
.utility-rail { padding: calc(24px * var(--ui-scale, 1)) calc(20px * var(--ui-scale, 1)); }
.service-card { padding: calc(16px * var(--ui-scale, 1)); border-radius: calc(14px * var(--ui-scale, 1)); }
.service-icon { width: calc(32px * var(--ui-scale, 1)); height: calc(32px * var(--ui-scale, 1)); border-radius: calc(12px * var(--ui-scale, 1)); }
.service-card h2 { font-size: calc(12px * var(--ui-scale, 1)); }
.service-card strong { font-size: calc(17px * var(--ui-scale, 1)); }
.service-card p { font-size: calc(12px * var(--ui-scale, 1)); }
.rail-section { padding: calc(24px * var(--ui-scale, 1)) calc(2px * var(--ui-scale, 1)); }
.field-label { font-size: calc(12px * var(--ui-scale, 1)); margin-bottom: calc(7px * var(--ui-scale, 1)); }
.utility-rail select { padding: calc(10px * var(--ui-scale, 1)); font-size: calc(12.5px * var(--ui-scale, 1)); border-radius: calc(12px * var(--ui-scale, 1)); }
.simulation-actions { gap: calc(6px * var(--ui-scale, 1)); margin-top: calc(12px * var(--ui-scale, 1)); }
.quick-action { padding: calc(10px * var(--ui-scale, 1)) calc(9px * var(--ui-scale, 1)); border-radius: calc(12px * var(--ui-scale, 1)); gap: calc(9px * var(--ui-scale, 1)); }
.quick-action:hover { background: #efebe1; }
.quick-icon { width: calc(32px * var(--ui-scale, 1)); height: calc(32px * var(--ui-scale, 1)); border-radius: calc(12px * var(--ui-scale, 1)); font-size: calc(14px * var(--ui-scale, 1)); }
.quick-action strong { font-size: calc(12px * var(--ui-scale, 1)); }
.quick-action small { font-size: calc(12px * var(--ui-scale, 1)); }
.text-button { font-size: calc(12px * var(--ui-scale, 1)); }
.location-cell { height: calc(30px * var(--ui-scale, 1)); font-size: calc(12px * var(--ui-scale, 1)); border-radius: calc(10px * var(--ui-scale, 1)); }

/* --- 13. TOASTS --- */
.toast { padding: calc(12px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1)); font-size: calc(13px * var(--ui-scale, 1)); border-radius: calc(12px * var(--ui-scale, 1)); box-shadow: 0 calc(8px * var(--ui-scale, 1)) calc(30px * var(--ui-scale, 1)) rgba(15, 23, 42,.22); }
.toast.success { border-left: calc(4px * var(--ui-scale, 1)) solid #2fa678; }

/* --- 14. MICRO-ANIMATIONS --- */
.surface { transition: box-shadow .25s ease; }
.surface:hover { box-shadow: 0 calc(2px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1)) rgba(15, 23, 42,.06); }
.modal-backdrop.active { animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-card { animation: modalSlideUp .3s cubic-bezier(.22,.61,.36,1); }
@keyframes modalSlideUp {
  from { opacity: 0; transform: translateY(calc(14px * var(--ui-scale, 1))) scale(.97); }
  to { opacity: 1; transform: none; }
}
.search-card, .thread-item, .customer-row { transition: background .15s ease, border-color .15s ease, box-shadow .15s ease; }
.nav-item { transition: background .15s ease, color .15s ease; }
.small-action { transition: all .15s ease; }
.small-action:hover { transform: scale(1.06); }

/* --- 15. SCROLLBAR --- */
.thread-list::-webkit-scrollbar,
.message-history::-webkit-scrollbar,
.customer-directory::-webkit-scrollbar,
.history-message-list::-webkit-scrollbar,
.recent-contact-list::-webkit-scrollbar {
  width: calc(5px * var(--ui-scale, 1));
}
.thread-list::-webkit-scrollbar-track,
.message-history::-webkit-scrollbar-track,
.customer-directory::-webkit-scrollbar-track,
.history-message-list::-webkit-scrollbar-track,
.recent-contact-list::-webkit-scrollbar-track {
  background: transparent;
}
.thread-list::-webkit-scrollbar-thumb,
.message-history::-webkit-scrollbar-thumb,
.customer-directory::-webkit-scrollbar-thumb,
.history-message-list::-webkit-scrollbar-thumb,
.recent-contact-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: calc(10px * var(--ui-scale, 1));
}
.thread-list::-webkit-scrollbar-thumb:hover,
.message-history::-webkit-scrollbar-thumb:hover,
.customer-directory::-webkit-scrollbar-thumb:hover,
.history-message-list::-webkit-scrollbar-thumb:hover,
.recent-contact-list::-webkit-scrollbar-thumb:hover {
  background: #9aa39c;
}

/* --- 16. RESPONSIVE --- */
@media (max-width: 600px) {
  .incoming-call { padding: calc(24px * var(--ui-scale, 1)) calc(18px * var(--ui-scale, 1)); }
  .incoming-call h2 { font-size: calc(20px * var(--ui-scale, 1)); }
  .call-pulse { width: calc(56px * var(--ui-scale, 1)); height: calc(56px * var(--ui-scale, 1)); font-size: calc(24px * var(--ui-scale, 1)); }
  .call-number { font-size: calc(16px * var(--ui-scale, 1)); }
  .call-details strong { font-size: calc(12px * var(--ui-scale, 1)); }
  .recent-contact-section h3 { font-size: calc(12px * var(--ui-scale, 1)); }
  .message-history { min-height: calc(320px * var(--ui-scale, 1)); max-height: calc(400px * var(--ui-scale, 1)); }
  .history-message-list { max-height: calc(280px * var(--ui-scale, 1)); }
  .dashboard-grid { grid-template-columns: 1fr; }
}

/* E-post 2.0: compact mailbox layout with progressive disclosure. */
.email-page-heading { margin-bottom: calc(10px * var(--ui-scale, 1)); }
.email-toolbar-row { display: flex; align-items: center; justify-content: space-between; gap: calc(12px * var(--ui-scale, 1)); margin-bottom: calc(10px * var(--ui-scale, 1)); }
.email-folder-tabs { display: inline-flex; align-items: center; gap: calc(4px * var(--ui-scale, 1)); padding: calc(3px * var(--ui-scale, 1)); border: calc(1px * var(--ui-scale, 1)) solid #e4e7ec; border-radius: calc(12px * var(--ui-scale, 1)); background: #fff; }
.email-folder-btn { border: 0; border-radius: calc(10px * var(--ui-scale, 1)); padding: calc(7px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1)); background: transparent; color: #667085; font: 700 calc(12px * var(--ui-scale, 1)) var(--font); cursor: pointer; }
.email-folder-btn span { margin-left: calc(4px * var(--ui-scale, 1)); padding: calc(2px * var(--ui-scale, 1)) calc(5px * var(--ui-scale, 1)); border-radius: calc(999px * var(--ui-scale, 1)); background: #efebe0; color: #475467; font-size: calc(12px * var(--ui-scale, 1)); }
.email-folder-btn.active { color: #0a5a4d; background: #e9f4f1; }
.email-folder-btn.active span { color: #fff; background: #0d6b5c; }
.email-toolbar-row .ticket-filter-bar { margin: 0; }
.email-list-search { display: flex; align-items: center; gap: calc(7px * var(--ui-scale, 1)); margin: calc(9px * var(--ui-scale, 1)) calc(11px * var(--ui-scale, 1)); padding: calc(7px * var(--ui-scale, 1)) calc(9px * var(--ui-scale, 1)); border: calc(1px * var(--ui-scale, 1)) solid #e4e7ec; border-radius: calc(12px * var(--ui-scale, 1)); background: #fff; color: #667085; }
.email-list-search input { min-width: 0; width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font: calc(12px * var(--ui-scale, 1)) var(--font); }

#email-tab .email-heading-actions-row { margin-top: calc(8px * var(--ui-scale, 1)); gap: calc(8px * var(--ui-scale, 1)); }
#email-tab .ticket-controls { gap: calc(7px * var(--ui-scale, 1)); }
#email-tab .ticket-controls .button,
#email-tab .ticket-select { min-height: calc(30px * var(--ui-scale, 1)); height: calc(30px * var(--ui-scale, 1)); }
.email-more-wrap { position: relative; align-self: flex-end; }
.email-more-button { min-width: calc(34px * var(--ui-scale, 1)); padding: 0 calc(8px * var(--ui-scale, 1)) !important; font-size: calc(14px * var(--ui-scale, 1)) !important; letter-spacing: calc(1px * var(--ui-scale, 1)); }
.email-more-menu { position: absolute; z-index: 18; right: 0; top: calc(100% + calc(6px * var(--ui-scale, 1))); display: grid; min-width: calc(205px * var(--ui-scale, 1)); padding: calc(6px * var(--ui-scale, 1)); border: calc(1px * var(--ui-scale, 1)) solid #e4e7ec; border-radius: calc(12px * var(--ui-scale, 1)); background: #fff; box-shadow: 0 calc(14px * var(--ui-scale, 1)) calc(34px * var(--ui-scale, 1)) rgba(15, 23, 42,.16); }
.email-more-menu.hidden { display: none; }
.email-more-menu button { border: 0; border-radius: calc(10px * var(--ui-scale, 1)); padding: calc(9px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1)); background: transparent; color: #344054; font: 650 calc(12px * var(--ui-scale, 1)) var(--font); text-align: left; cursor: pointer; }
.email-more-menu button:hover { background: #f8fafc; }
.email-more-menu button.danger { color: #b03d3d; }
/* The Ring/SMS number chooser sits on the page body, placed from the button's rect. :where keeps it at the same weight as .email-more-menu, so the phone bottom sheet below still wins. */
:where(.email-more-menu).contact-number-menu { position: fixed; right: auto; left: var(--cnm-left, 0); top: var(--cnm-top, 0); z-index: 2147483000; }
/* On the body the menu has no page around it to give the dark text colour. */
html[data-theme="dark"] .contact-number-menu button { color: var(--ink); }
html[data-theme="dark"] .contact-number-menu button:hover, html[data-theme="dark"] .contact-number-menu button:focus-visible { background: rgba(255, 255, 255, .07); }
.email-menu-separator { height: calc(1px * var(--ui-scale, 1)); margin: calc(4px * var(--ui-scale, 1)) calc(3px * var(--ui-scale, 1)); background: #e9e2d6; }

#email-tab .email-recipient-bar { padding: calc(8px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1)); gap: calc(6px * var(--ui-scale, 1)); }
#email-tab .recipient-row { gap: calc(7px * var(--ui-scale, 1)); }
#email-tab .recipient-row label { width: calc(52px * var(--ui-scale, 1)); font-size: calc(12px * var(--ui-scale, 1)); }
#email-tab .recipient-row input { padding: calc(6px * var(--ui-scale, 1)) calc(9px * var(--ui-scale, 1)); font-size: calc(12px * var(--ui-scale, 1)); }
.email-copy-fields { display: grid; grid-template-columns: 1fr 1fr; gap: calc(10px * var(--ui-scale, 1)); }
.email-forward-mode-button { width: calc(31px * var(--ui-scale, 1)); height: calc(31px * var(--ui-scale, 1)); flex: 0 0 calc(31px * var(--ui-scale, 1)); display: grid; place-items: center; border: calc(1px * var(--ui-scale, 1)) solid #d9dee7; border-radius: calc(12px * var(--ui-scale, 1)); background: #fff; color: #475467; cursor: pointer; }
.email-forward-mode-button:hover:not(:disabled) { color: #0a5a4d; border-color: #b4d9cc; background: #e9f4f1; }
.email-forward-mode-button:disabled { opacity: .4; cursor: default; }
.email-forward-mode-button svg { width: calc(17px * var(--ui-scale, 1)); height: calc(17px * var(--ui-scale, 1)); fill: currentColor; transform: scaleX(-1); }
.email-wide-toggle { width: calc(31px * var(--ui-scale, 1)); height: calc(31px * var(--ui-scale, 1)); flex: 0 0 calc(31px * var(--ui-scale, 1)); display: grid; place-items: center; border: calc(1px * var(--ui-scale, 1)) solid #d9dee7; border-radius: calc(12px * var(--ui-scale, 1)); background: #fff; color: #475467; cursor: pointer; }
.email-wide-toggle:hover { color: #0a5a4d; border-color: #b4d9cc; background: #e9f4f1; }
.email-wide-toggle.active { color: #fff; border-color: #0d6b5c; background: #0d6b5c; }
.email-wide-toggle svg { width: calc(16px * var(--ui-scale, 1)); height: calc(16px * var(--ui-scale, 1)); fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

#email-tab .email-forward-selection-bar { padding: calc(7px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1)); }
#email-tab .email-forward-selection-bar > div { display: flex; gap: calc(7px * var(--ui-scale, 1)); margin-left: auto; }
#email-tab .email-forward-selection-bar .button { min-height: calc(28px * var(--ui-scale, 1)); }

#email-tab .message-history { padding: calc(13px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1)); gap: calc(12px * var(--ui-scale, 1)); background: #f8f5ee; }
.email-message-card { width: 94%; align-self: flex-start; border: calc(1px * var(--ui-scale, 1)) solid #e7eaf0; border-radius: calc(12px * var(--ui-scale, 1)); background: #fff; box-shadow: 0 calc(1px * var(--ui-scale, 1)) calc(2px * var(--ui-scale, 1)) rgba(15, 23, 42,.04); }
.email-message-card.agent { align-self: flex-end; border-color: #c9e0d8; }
.email-message-card .email-message-wrap { width: 100%; gap: 0; }
.email-message-card .email-message-content { flex: 1; width: 100%; }
.email-message-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: calc(12px * var(--ui-scale, 1)); padding: calc(10px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)); border-bottom: calc(1px * var(--ui-scale, 1)) solid #e7eaf0; background: #fbfaf5; border-radius: calc(10px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1)) 0 0; }
.email-message-card.agent .email-message-card-head { background: #eef6f2; }
.email-message-card-head strong,
.email-message-card-head span { display: block; }
.email-message-card-head strong { color: #202b26; font-size: calc(12px * var(--ui-scale, 1)); }
.email-message-card-head span { margin-top: calc(3px * var(--ui-scale, 1)); color: #64748b; font-size: calc(12px * var(--ui-scale, 1)); }
.email-message-card-head time { color: #667085; font-size: calc(12px * var(--ui-scale, 1)); white-space: nowrap; }
.email-body-html { padding: calc(13px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1)); color: #344054; font-size: calc(12px * var(--ui-scale, 1)); line-height: 1.55; overflow-wrap: anywhere; }
.email-body-html p:first-child { margin-top: 0; }
.email-body-html p:last-child { margin-bottom: 0; }
.email-body-html img { display: block; max-width: 100%; height: auto; margin: calc(8px * var(--ui-scale, 1)) 0; border-radius: calc(10px * var(--ui-scale, 1)); }
.email-body-html img:not([src]) { display: none; }
.email-body-html blockquote { margin: calc(12px * var(--ui-scale, 1)) 0; padding: calc(8px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)); border-left: calc(3px * var(--ui-scale, 1)) solid #d0d5dd; color: #64748b; background: #f8fafc; }
.email-load-images { margin: 0 calc(14px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1)); border: 0; background: transparent; color: #0d6b5c; font: 700 calc(12px * var(--ui-scale, 1)) var(--font); cursor: pointer; }
.email-message-select { display: none; flex: 0 0 calc(31px * var(--ui-scale, 1)); width: calc(31px * var(--ui-scale, 1)); height: calc(38px * var(--ui-scale, 1)); margin: 0; }
.email-forward-selecting .email-message-select { display: grid; }
.email-forward-selecting .email-message-card { cursor: pointer; }
.email-topic-separator { position: relative; display: flex; align-items: center; justify-content: center; width: 100%; margin: calc(5px * var(--ui-scale, 1)) 0; color: #64748b; font-size: calc(12px * var(--ui-scale, 1)); font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.email-topic-separator::before { content: ''; position: absolute; left: 0; right: 0; height: calc(1px * var(--ui-scale, 1)); background: #e4e7ec; }
.email-topic-separator span { position: relative; max-width: 70%; overflow: hidden; padding: 0 calc(9px * var(--ui-scale, 1)); background: #f8f5ee; text-overflow: ellipsis; white-space: nowrap; }
.email-message-attachments { display: flex; flex-wrap: wrap; align-items: flex-start; gap: calc(8px * var(--ui-scale, 1)); padding: 0 calc(14px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)); }
.email-message-file-attachment { display: inline-flex; align-items: center; gap: calc(6px * var(--ui-scale, 1)); padding: calc(6px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1)); border: calc(1px * var(--ui-scale, 1)) solid #dbd6c6; border-radius: calc(12px * var(--ui-scale, 1)); background: #f8fafc; color: #2a594c; font-size: calc(12px * var(--ui-scale, 1)); font-weight: 700; text-decoration: none; }
.email-message-file-attachment svg,
.email-message-image-attachment figcaption svg { width: calc(15px * var(--ui-scale, 1)); height: calc(15px * var(--ui-scale, 1)); flex: 0 0 calc(15px * var(--ui-scale, 1)); fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.email-message-image-attachment { width: min(calc(260px * var(--ui-scale, 1)), 100%); overflow: hidden; margin: 0; border: calc(1px * var(--ui-scale, 1)) solid #dbd6c6; border-radius: calc(12px * var(--ui-scale, 1)); background: #f8fafc; }
.email-message-image-preview { display: grid; place-items: center; min-height: calc(110px * var(--ui-scale, 1)); padding: calc(7px * var(--ui-scale, 1)); border-bottom: calc(1px * var(--ui-scale, 1)) solid #dbd6c6; background: #eef4ef; }
.email-message-image-preview img { display: block; width: 100%; height: calc(140px * var(--ui-scale, 1)); object-fit: contain; border-radius: calc(10px * var(--ui-scale, 1)); background: #fff; }
.email-message-image-attachment figcaption { display: flex; align-items: center; justify-content: space-between; gap: calc(8px * var(--ui-scale, 1)); padding: calc(7px * var(--ui-scale, 1)) calc(9px * var(--ui-scale, 1)); color: #2a594c; font-size: calc(12px * var(--ui-scale, 1)); font-weight: 700; }
.email-message-image-attachment figcaption > span { min-width: 0; display: flex; align-items: center; gap: calc(5px * var(--ui-scale, 1)); }
.email-message-image-attachment figcaption > span > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.email-message-image-attachment figcaption > a { flex: 0 0 auto; color: var(--blue); text-decoration: none; }
.email-forwarded-stack { display: grid; gap: calc(10px * var(--ui-scale, 1)); margin: 0 calc(14px * var(--ui-scale, 1)) calc(13px * var(--ui-scale, 1)); }
.email-forwarded-card { overflow: hidden; border: calc(1px * var(--ui-scale, 1)) solid #e4e7ec; border-left: calc(3px * var(--ui-scale, 1)) solid #6aa892; border-radius: calc(12px * var(--ui-scale, 1)); background: #fff; }
.email-forwarded-card header { display: flex; justify-content: space-between; gap: calc(12px * var(--ui-scale, 1)); padding: calc(8px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1)); border-bottom: calc(1px * var(--ui-scale, 1)) solid #e9e2d6; background: #f8fafc; }
.email-forwarded-card header strong { font-size: calc(12px * var(--ui-scale, 1)); }
.email-forwarded-card header span { color: #64748b; font-size: calc(12px * var(--ui-scale, 1)); }
.email-forwarded-body { padding: calc(10px * var(--ui-scale, 1)); color: #475467; font-size: calc(12px * var(--ui-scale, 1)); line-height: 1.5; }
.email-forward-summary { margin: 0 calc(14px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)); }

#email-tab .ticket-compose-area { background: #fff; }
#email-tab .email-composer { margin: calc(8px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)) calc(11px * var(--ui-scale, 1)); border-radius: calc(12px * var(--ui-scale, 1)); }
#email-tab .email-subject-row {
  display: flex;
  align-items: center;
  gap: calc(7px * var(--ui-scale, 1));
  padding: calc(4px * var(--ui-scale, 1));
  border-bottom: calc(1px * var(--ui-scale, 1)) solid #e7eaf0;
}
#email-tab .email-subject-row > input {
  flex: 1 1 auto;
  min-width: 0;
  padding: calc(4px * var(--ui-scale, 1)) calc(7px * var(--ui-scale, 1));
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: calc(12.5px * var(--ui-scale, 1)) var(--font);
}
#email-tab .email-subject-row .email-composer-expand-button {
  flex: 0 0 auto;
  min-height: calc(31px * var(--ui-scale, 1));
  padding: calc(7px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
}

#email-tab .ticket-controls.draft-controls {
  display: flex !important;
  justify-content: flex-end;
}

#email-tab .ticket-controls.draft-controls > :not(.email-more-wrap),
#email-tab .ticket-controls.draft-controls .email-more-menu > :not([data-email-action="delete"]) {
  display: none !important;
}
.email-format-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: calc(4px * var(--ui-scale, 1)); padding: calc(5px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1)); border-bottom: calc(1px * var(--ui-scale, 1)) solid #e7eaf0; background: #fafbfc; }
.email-format-toolbar.hidden { display: none; }
.email-format-select { height: calc(27px * var(--ui-scale, 1)); padding: 0 calc(8px * var(--ui-scale, 1)); border: calc(1px * var(--ui-scale, 1)) solid var(--line, #d0d5dd); border-radius: calc(8px * var(--ui-scale, 1)); background: var(--surface, #fff); color: var(--ink, #344054); font: 600 calc(12px * var(--ui-scale, 1)) var(--font); cursor: pointer; max-width: calc(148px * var(--ui-scale, 1)); }
.email-format-select--size { max-width: calc(96px * var(--ui-scale, 1)); }
.email-format-divider { width: calc(1px * var(--ui-scale, 1)); height: calc(18px * var(--ui-scale, 1)); background: var(--line, #e4e7ec); margin: 0 calc(2px * var(--ui-scale, 1)); }
.email-format-toolbar button { min-width: calc(28px * var(--ui-scale, 1)); height: calc(27px * var(--ui-scale, 1)); padding: 0 calc(7px * var(--ui-scale, 1)); border: 0; border-radius: calc(10px * var(--ui-scale, 1)); background: transparent; color: #475467; font: 650 calc(12px * var(--ui-scale, 1)) var(--font); cursor: pointer; }
.email-format-toolbar button:hover { color: #0a5a4d; background: #e9f4f1; }
.email-rich-editor { min-height: calc(74px * var(--ui-scale, 1)); max-height: calc(170px * var(--ui-scale, 1)); overflow-y: auto; padding: calc(10px * var(--ui-scale, 1)) calc(11px * var(--ui-scale, 1)); outline: 0; color: #202b26; font-size: calc(12px * var(--ui-scale, 1)); line-height: 1.5; }
.email-rich-editor:empty::before { content: attr(data-placeholder); color: #667085; pointer-events: none; }
.email-composer-actions { display: flex; align-items: center; justify-content: space-between; gap: calc(10px * var(--ui-scale, 1)); padding: calc(7px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1)); border-top: calc(1px * var(--ui-scale, 1)) solid #e7eaf0; }
.email-compose-tools,
.email-compose-submit { display: flex; align-items: center; gap: calc(7px * var(--ui-scale, 1)); }
.email-composer-actions .button { min-height: calc(31px * var(--ui-scale, 1)); padding: calc(7px * var(--ui-scale, 1)) calc(9px * var(--ui-scale, 1)); }

@media (min-width: 901px) {
  #email-tab.active { display: flex; flex-direction: column; height: calc(100vh - calc(134px * var(--ui-scale, 1))); min-height: calc(620px * var(--ui-scale, 1)); gap: 0; }
  #email-tab .email-inbox-layout { display: grid; flex: 1 1 auto; min-height: 0 !important; height: auto; overflow: hidden !important; }
  #email-tab .thread-panel,
  #email-tab .conversation-panel { min-height: 0; overflow: hidden; }
  #email-tab .thread-panel { display: flex; flex-direction: column; }
  #email-tab .email-inbox-layout .thread-list { flex: 1 1 auto; min-height: 0; max-height: none !important; overflow-y: auto !important; }
  #email-tab .email-inbox-layout .message-history { flex: 1 1 auto; min-height: calc(180px * var(--ui-scale, 1)) !important; max-height: none !important; overflow-y: auto !important; }
  #email-tab .conversation-head { padding: calc(10px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1)) calc(9px * var(--ui-scale, 1)); }
}

.email-more-menu #btn-delete-email {
  align-self: auto;
  width: 100%;
  height: auto;
  margin: 0;
  padding: calc(9px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1)) !important;
  white-space: normal;
}

@media (max-width: 900px) {
  .email-toolbar-row { align-items: stretch; flex-direction: column; }
  .email-folder-tabs { align-self: flex-start; }
  .email-toolbar-row .ticket-filter-bar { overflow-x: auto; padding-bottom: calc(2px * var(--ui-scale, 1)); }
  .email-copy-fields { grid-template-columns: 1fr; }
  #email-tab .email-recipient-bar { padding: calc(9px * var(--ui-scale, 1)) calc(11px * var(--ui-scale, 1)); }
  .email-more-menu { position: fixed; left: calc(16px * var(--ui-scale, 1)); right: calc(16px * var(--ui-scale, 1)); top: auto; bottom: calc(20px * var(--ui-scale, 1)); min-width: 0; }
  .email-message-card { width: 100%; }
  .email-composer-actions { align-items: stretch; flex-direction: column; }
  .email-compose-tools,
  .email-compose-submit { width: 100%; }
  .email-compose-submit { justify-content: flex-end; }
  .email-compose-tools .template-picker { flex: 1; }
  .email-compose-tools #btn-email-templates { width: 100%; }
}

@media (max-width: 600px) {
  .email-page-heading > div > p:not(.eyebrow) { display: none; }
  .email-page-heading { gap: calc(8px * var(--ui-scale, 1)); }
  #email-tab .recipient-row label { width: calc(46px * var(--ui-scale, 1)); }
  #email-tab .email-heading-actions-row { align-items: flex-start; }
  #email-tab .ticket-controls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
  #email-tab .ticket-control-group { min-width: 0; }
  #email-tab .ticket-control-group .ticket-select { width: 100%; }
  .email-more-wrap { align-self: end; }
  .email-rich-editor { min-height: calc(92px * var(--ui-scale, 1)); max-height: calc(220px * var(--ui-scale, 1)); }
  .email-forward-selection-bar { align-items: flex-start !important; flex-direction: column; }
  #email-tab .email-forward-selection-bar > div { width: 100%; margin-left: 0; }
  #email-tab .email-forward-selection-bar .button { flex: 1; }
}

/* ================================================================
   17. TICKET SYSTEM STYLES
   ================================================================ */

.ticket-filter-bar {
  display: flex;
  gap: calc(8px * var(--ui-scale, 1));
  margin-bottom: calc(14px * var(--ui-scale, 1));
}
.ticket-filter-btn {
  border: calc(1px * var(--ui-scale, 1)) solid #d9dee7;
  background: #fff;
  color: #475467;
  font: 600 calc(12.5px * var(--ui-scale, 1)) var(--font);
  padding: calc(7px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1));
  border-radius: calc(12px * var(--ui-scale, 1));
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: calc(6px * var(--ui-scale, 1));
  transition: all .15s ease;
}
.ticket-filter-btn:hover {
  background: #f8fafc;
  border-color: #d0d5dd;
}
.ticket-filter-btn.active {
  background: var(--blue-soft);
  color: var(--blue);
  border-color: #bfe0d6;
  font-weight: 700;
}
.filter-count {
  background: #e6f0ec;
  color: var(--blue);
  font-size: calc(12px * var(--ui-scale, 1));
  padding: calc(2px * var(--ui-scale, 1)) calc(6px * var(--ui-scale, 1));
  border-radius: calc(12px * var(--ui-scale, 1));
  font-weight: 700;
}
.ticket-filter-btn.active .filter-count {
  background: var(--blue);
  color: #fff;
}

.activity-heading { gap: calc(16px * var(--ui-scale, 1)); flex-wrap: wrap; }
.activity-heading > div { min-width: 0; flex: 1 1 auto; }
.activity-filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: calc(7px * var(--ui-scale, 1));
  margin-top: calc(12px * var(--ui-scale, 1));
  flex: 1 0 100%;
  width: 100%;
  min-width: 0;
}
.activity-log-search {
  flex: 0 1 calc(360px * var(--ui-scale, 1));
  width: calc(360px * var(--ui-scale, 1));
  height: calc(34px * var(--ui-scale, 1));
  display: flex;
  align-items: center;
  gap: calc(8px * var(--ui-scale, 1));
  margin-top: 0;
  padding: 0 calc(10px * var(--ui-scale, 1));
  border: calc(1px * var(--ui-scale, 1)) solid #d9dee7;
  border-radius: calc(12px * var(--ui-scale, 1));
  background: #fafbfc;
  color: #667085;
}
.activity-log-search span { font-size: calc(17px * var(--ui-scale, 1)); line-height: 1; }
.activity-log-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: 500 calc(12px * var(--ui-scale, 1)) var(--font);
}
.activity-log-search:focus-within { border-color: #8fc9b9; box-shadow: 0 0 0 calc(3px * var(--ui-scale, 1)) rgba(13, 107, 92, .1); }
.activity-filter-btn {
  border: calc(1px * var(--ui-scale, 1)) solid #d9dee7;
  background: #fff;
  color: #475467;
  font: 600 calc(12px * var(--ui-scale, 1)) var(--font);
  padding: calc(6px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
  border-radius: calc(12px * var(--ui-scale, 1));
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: calc(6px * var(--ui-scale, 1));
  min-width: 0;
}
.activity-filter-btn .filter-count { flex: 0 0 auto; }
/* "Vis flere" under the activity feed, which draws 150 entries at a time. */
.activity-show-more {
  display: flex;
  justify-content: center;
  padding: calc(10px * var(--ui-scale, 1)) 0 calc(14px * var(--ui-scale, 1));
}
.activity-filter-btn:hover { background: #f8fafc; border-color: #d0d5dd; }
.activity-filter-btn.active { background: var(--blue-soft); color: var(--blue); border-color: #bfe0d6; font-weight: 700; }
.activity-filter-btn.active .filter-count { background: var(--blue); color: #fff; }

.activity-agent-dropdown-wrap {
  position: relative;
  display: inline-flex;
}

.activity-agent-btn {
  display: inline-flex;
  align-items: center;
  gap: calc(6px * var(--ui-scale, 1));
  font: 600 calc(12px * var(--ui-scale, 1)) var(--font);
  cursor: pointer;
  white-space: nowrap;
}

.activity-agent-btn svg {
  flex: 0 0 auto;
}

.activity-agent-btn .chevron-down {
  transition: transform 0.18s ease;
}

.activity-agent-btn[aria-expanded="true"] .chevron-down {
  transform: rotate(180deg);
}

.activity-agent-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: calc(15px * var(--ui-scale, 1));
  height: calc(15px * var(--ui-scale, 1));
  border-radius: 50%;
  background: rgba(13, 107, 92, .18);
  color: var(--blue, #0d6b5c);
  font-size: calc(12px * var(--ui-scale, 1));
  font-weight: 700;
  line-height: 1;
  margin-left: calc(2px * var(--ui-scale, 1));
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.activity-agent-clear:hover {
  background: var(--blue, #0d6b5c);
  color: #fff;
}

.activity-agent-clear.hidden {
  display: none !important;
}

.activity-agent-menu {
  position: absolute;
  top: calc(100% + calc(4px * var(--ui-scale, 1)));
  left: 0;
  z-index: 60;
  min-width: calc(210px * var(--ui-scale, 1));
  max-height: calc(300px * var(--ui-scale, 1));
  overflow-y: auto;
  background: var(--surface, #fff);
  border: calc(1px * var(--ui-scale, 1)) solid var(--line, #e7eaf0);
  border-radius: calc(12px * var(--ui-scale, 1));
  box-shadow: 0 calc(8px * var(--ui-scale, 1)) calc(24px * var(--ui-scale, 1)) rgba(15, 23, 42, .14);
  padding: calc(6px * var(--ui-scale, 1));
  display: flex;
  flex-direction: column;
  gap: calc(2px * var(--ui-scale, 1));
}

.activity-agent-menu.hidden {
  display: none !important;
}

.activity-agent-menu-header {
  padding: calc(6px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1)) calc(4px * var(--ui-scale, 1));
  font-size: calc(10px * var(--ui-scale, 1));
  font-weight: 800;
  color: var(--muted, #667085);
  text-transform: uppercase;
  letter-spacing: .08em;
  border-top: calc(1px * var(--ui-scale, 1)) solid var(--line, #e7eaf0);
  margin-top: calc(4px * var(--ui-scale, 1));
}

.activity-agent-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: calc(6px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
  border: 0;
  border-radius: calc(8px * var(--ui-scale, 1));
  background: transparent;
  color: var(--ink, #182230);
  font: 500 calc(12.5px * var(--ui-scale, 1)) var(--font);
  text-align: left;
  cursor: pointer;
  transition: background 0.12s;
}

.activity-agent-option:hover {
  background: var(--canvas, #f8fafc);
  color: var(--ink, #182230);
}

.activity-agent-option.active {
  background: var(--blue-soft, #e8f3ef);
  color: var(--blue, #0d6b5c);
  font-weight: 700;
}

.activity-agent-option .agent-opt-check {
  font-size: calc(12px * var(--ui-scale, 1));
  font-weight: 800;
  color: var(--blue, #0d6b5c);
}

html[data-theme="dark"] .activity-agent-menu {
  background: #151e2b;
  border-color: #29384b;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
}

html[data-theme="dark"] .activity-agent-menu-header {
  border-color: #29384b;
  color: #8da1b9;
}

html[data-theme="dark"] .activity-agent-option {
  color: #c9d5e6;
}

html[data-theme="dark"] .activity-agent-option:hover {
  background: #1c283a;
  color: #fff;
}

html[data-theme="dark"] .activity-agent-option.active {
  background: rgba(var(--rh-accent-rgb, 76, 208, 155), .16);
  color: var(--rh-accent, #4cd09b);
}

html[data-theme="dark"] .activity-agent-option .agent-opt-check {
  color: var(--rh-accent, #4cd09b);
}

html[data-theme="dark"] .activity-agent-btn.active {
  background: rgba(var(--rh-accent-rgb, 76, 208, 155), .16);
  border-color: var(--rh-accent, #4cd09b);
  color: var(--rh-accent, #4cd09b);
}

html[data-theme="dark"] .activity-agent-clear {
  background: rgba(var(--rh-accent-rgb, 76, 208, 155), .25);
  color: var(--rh-accent, #4cd09b);
}

html[data-theme="dark"] .activity-agent-clear:hover {
  background: var(--rh-accent, #4cd09b);
  color: #0b1320;
}
.missed-call-callback {
  flex: 0 0 auto;
  border: calc(1px * var(--ui-scale, 1)) solid #e5b8b8;
  background: #fcf0f0;
  color: #a83a3a;
  border-radius: calc(10px * var(--ui-scale, 1));
  padding: calc(5px * var(--ui-scale, 1)) calc(7px * var(--ui-scale, 1));
  font: 700 calc(12px * var(--ui-scale, 1)) var(--font);
  cursor: pointer;
  white-space: nowrap;
}
.missed-call-callback:hover { background: #fbe9e9; border-color: #d89797; }

.ticket-meta-row {
  display: flex;
  align-items: center;
  gap: calc(8px * var(--ui-scale, 1));
  margin-top: calc(5px * var(--ui-scale, 1));
}
.thread-item-trailing {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: calc(7px * var(--ui-scale, 1));
}
.email-thread-attachment {
  display: inline-flex;
  align-items: center;
  gap: calc(2px * var(--ui-scale, 1));
  color: #4a7a6c;
  font-size: calc(12px * var(--ui-scale, 1));
  font-weight: 800;
}
.email-thread-attachment svg {
  width: calc(13px * var(--ui-scale, 1));
  height: calc(13px * var(--ui-scale, 1));
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ticket-badge {
  font-size: calc(12px * var(--ui-scale, 1));
  font-weight: 700;
  padding: calc(2px * var(--ui-scale, 1)) calc(7px * var(--ui-scale, 1));
  border-radius: calc(10px * var(--ui-scale, 1));
  text-transform: uppercase;
  letter-spacing: .03em;
}
.badge-open { background: #ecf5f1; color: #0a5a4d; }
.badge-progress { background: #f9efe2; color: #94580a; }
.badge-draft { background: #f2f4f7; color: #667085; }
.badge-waiting { background: #f3eef7; color: #6d4382; }
.badge-resolved { background: #e0f3e6; color: #15714e; }
.badge-closed { background: #f8fafc; color: #64748b; }

.ticket-controls {
  display: flex;
  align-items: center;
  gap: calc(12px * var(--ui-scale, 1));
}
.ticket-controls > .button {
  align-self: center;
  white-space: nowrap;
}
.ticket-control-group {
  display: flex;
  flex-direction: column;
  gap: calc(3px * var(--ui-scale, 1));
}
.ticket-control-label {
  font-size: calc(12px * var(--ui-scale, 1));
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
}
.ticket-select {
  border: calc(1px * var(--ui-scale, 1)) solid #d9dee7;
  border-radius: calc(12px * var(--ui-scale, 1));
  padding: calc(5px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1));
  background: #fff;
  font: 600 calc(12px * var(--ui-scale, 1)) var(--font);
  color: var(--ink);
  outline-color: var(--blue);
  cursor: pointer;
}
.ticket-select:hover {
  border-color: #b2bcb3;
}

.ticket-compose-area {
  border-top: calc(1px * var(--ui-scale, 1)) solid var(--line);
}

.email-message-heading { display: flex; align-items: flex-start; gap: calc(7px * var(--ui-scale, 1)); }
.email-message-heading strong { flex: 1; min-width: 0; }
.email-message-wrap { display: flex; align-items: flex-start; gap: calc(6px * var(--ui-scale, 1)); }
.email-message-content { min-width: 0; }
.email-message-select { display: grid; place-items: center; width: calc(23px * var(--ui-scale, 1)); height: calc(25px * var(--ui-scale, 1)); margin-top: calc(4px * var(--ui-scale, 1)); color: #64748b; cursor: pointer; }
.email-message-select input { width: calc(15px * var(--ui-scale, 1)); height: calc(15px * var(--ui-scale, 1)); accent-color: var(--blue); cursor: pointer; }
.email-forward-button {
  position: relative;
  flex: 0 0 auto;
  width: calc(25px * var(--ui-scale, 1));
  height: calc(25px * var(--ui-scale, 1));
  display: grid;
  place-items: center;
  padding: 0;
  color: #64748b;
  background: rgba(255,255,255,.72);
  border: calc(1px * var(--ui-scale, 1)) solid rgba(123, 135, 127,.5);
  border-radius: 50%;
  cursor: pointer;
}
.message-row.agent .email-forward-button { color: #bfe8dd; background: rgba(10, 35, 31,.18); border-color: rgba(191, 232, 221,.4); }
.email-forward-button:hover { color: #0a5a4d; background: #fff; transform: translateX(calc(1px * var(--ui-scale, 1))); }
.email-forward-button svg { width: calc(16px * var(--ui-scale, 1)); height: calc(16px * var(--ui-scale, 1)); fill: currentColor; stroke: none; }
.email-forward-button::after {
  content: attr(data-tooltip);
  position: absolute;
  z-index: 4;
  right: 0;
  bottom: calc(100% + calc(6px * var(--ui-scale, 1)));
  padding: calc(4px * var(--ui-scale, 1)) calc(6px * var(--ui-scale, 1));
  color: #fff;
  background: #182230;
  border-radius: calc(10px * var(--ui-scale, 1));
  font: 700 calc(12px * var(--ui-scale, 1)) var(--font);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateY(calc(2px * var(--ui-scale, 1)));
  transition: opacity .15s, transform .15s;
}
.email-forward-button:hover::after, .email-forward-button:focus-visible::after { opacity: 1; transform: translateY(0); }
.email-forward-summary { margin-top: calc(6px * var(--ui-scale, 1)); color: #0a5a4d; font-size: calc(12px * var(--ui-scale, 1)); font-weight: 700; }
.message-row.agent .email-forward-summary { color: #bfe8dd; }
.email-forward-selection-bar { display: flex; align-items: center; justify-content: space-between; gap: calc(10px * var(--ui-scale, 1)); padding: calc(8px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1)); border-bottom: calc(1px * var(--ui-scale, 1)) solid var(--line); background: #f8fafc; color: #0b4f44; font-size: calc(12px * var(--ui-scale, 1)); font-weight: 700; }
.email-forward-selection-bar.hidden,
.email-attachments.hidden { display: none; }
.email-forward-selection-bar .button { padding: calc(6px * var(--ui-scale, 1)) calc(9px * var(--ui-scale, 1)); font-size: calc(12px * var(--ui-scale, 1)); }
.email-forward-selection-bar svg { width: calc(16px * var(--ui-scale, 1)); height: calc(16px * var(--ui-scale, 1)); fill: currentColor; }
.email-attachments { display: flex; flex-wrap: wrap; gap: calc(6px * var(--ui-scale, 1)); padding: calc(8px * var(--ui-scale, 1)) calc(11px * var(--ui-scale, 1)); border-bottom: calc(1px * var(--ui-scale, 1)) solid #e7eaf0; background: #f8fafc; }
.email-attachment-chip { display: inline-flex; align-items: center; gap: calc(5px * var(--ui-scale, 1)); max-width: 100%; padding: calc(4px * var(--ui-scale, 1)) calc(7px * var(--ui-scale, 1)); border: calc(1px * var(--ui-scale, 1)) solid #d9e9e2; border-radius: calc(999px * var(--ui-scale, 1)); background: #fff; color: #2a594c; font-size: calc(12px * var(--ui-scale, 1)); font-weight: 700; }
.email-attachment-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: calc(170px * var(--ui-scale, 1)); }
.email-attachment-chip button { border: 0; background: transparent; color: #64748b; font: 700 calc(14px * var(--ui-scale, 1)) var(--font); line-height: 1; cursor: pointer; padding: 0 calc(1px * var(--ui-scale, 1)); }
.email-attachment-button { cursor: pointer; }
.email-message-attachment-summary { display: inline-flex; align-items: center; gap: calc(5px * var(--ui-scale, 1)); margin: calc(6px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)); color: #467a69; font-size: calc(12px * var(--ui-scale, 1)); font-weight: 700; }
.email-message-attachment-summary svg { width: calc(15px * var(--ui-scale, 1)); height: calc(15px * var(--ui-scale, 1)); fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.message-row.agent .email-message-attachment-summary { color: #bfe8dd; }
@media (max-width: 600px) { .email-forward-selection-bar { padding: calc(8px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)); } .email-message-wrap { gap: calc(3px * var(--ui-scale, 1)); } .email-message-select { width: calc(19px * var(--ui-scale, 1)); } .email-forward-button { width: calc(23px * var(--ui-scale, 1)); height: calc(23px * var(--ui-scale, 1)); } }

.admin-agents-list-container { display: grid; gap: calc(12px * var(--ui-scale, 1)); margin-bottom: calc(18px * var(--ui-scale, 1)); max-height: 58vh; overflow-y: auto; padding: calc(2px * var(--ui-scale, 1)) calc(6px * var(--ui-scale, 1)) calc(2px * var(--ui-scale, 1)) 0; }
.agent-admin-card { border: calc(1px * var(--ui-scale, 1)) solid #dbd5c6; border-radius: calc(14px * var(--ui-scale, 1)); background: #fff; overflow: hidden; box-shadow: 0 calc(4px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1)) rgba(22, 58, 47, .04); }
.agent-admin-card-header { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: calc(12px * var(--ui-scale, 1)); min-height: calc(72px * var(--ui-scale, 1)); padding: calc(10px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1)); background: #fff; }
.agent-admin-card.is-expanded .agent-admin-card-header { background: #f8fafc; border-bottom: calc(1px * var(--ui-scale, 1)) solid #e4ddcf; }
.agent-admin-summary { min-width: 0; display: grid; grid-template-columns: auto minmax(calc(150px * var(--ui-scale, 1)), 1fr) minmax(calc(120px * var(--ui-scale, 1)), auto) auto; align-items: center; gap: calc(12px * var(--ui-scale, 1)); padding: 0; border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.agent-admin-avatar { width: calc(42px * var(--ui-scale, 1)); height: calc(42px * var(--ui-scale, 1)); border-radius: calc(14px * var(--ui-scale, 1)); display: grid; place-items: center; flex: 0 0 auto; color: #0a5a4d; background: #e9f4f1; font: 800 calc(15px * var(--ui-scale, 1)) var(--display); }
.agent-admin-identity { min-width: 0; display: block; }
.agent-admin-identity strong, .agent-admin-identity small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-admin-identity strong { color: #202b26; font: 800 calc(14px * var(--ui-scale, 1)) var(--display); }
.agent-admin-identity small { max-width: calc(360px * var(--ui-scale, 1)); margin-top: calc(3px * var(--ui-scale, 1)); color: #64748b; font-size: calc(12px * var(--ui-scale, 1)); }
.agent-admin-department-summary { display: flex; justify-content: flex-end; gap: calc(5px * var(--ui-scale, 1)); flex-wrap: wrap; }
.agent-admin-department-summary span { padding: calc(5px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1)); border-radius: calc(999px * var(--ui-scale, 1)); background: #efebe0; color: #4d5c55; font: 700 calc(12px * var(--ui-scale, 1)) var(--font); white-space: nowrap; }
.agent-admin-edit-label { display: inline-flex; align-items: center; gap: calc(5px * var(--ui-scale, 1)); color: #0d6b5c; font: 750 calc(12px * var(--ui-scale, 1)) var(--font); white-space: nowrap; }
.agent-admin-chevron { display: inline-block; font-size: calc(15px * var(--ui-scale, 1)); transform-origin: center; transition: transform .18s ease; }
.agent-admin-card.is-expanded .agent-admin-chevron { transform: rotate(180deg); }
.agent-admin-state { display: flex; align-items: center; justify-content: flex-end; gap: calc(8px * var(--ui-scale, 1)); }
.agent-account-status { border-radius: calc(999px * var(--ui-scale, 1)); padding: calc(5px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1)); font-size: calc(12px * var(--ui-scale, 1)); font-weight: 800; white-space: nowrap; }
.agent-account-status.active { color: #0c6647; background: #e8f5ef; }
.agent-account-status.invitation_sent { color: #0a5a4d; background: #e9f4f1; }
.agent-account-status.not_invited { color: #667085; background: #e7eaf0; }
.agent-admin-delete { width: calc(32px * var(--ui-scale, 1)); height: calc(32px * var(--ui-scale, 1)); display: grid; place-items: center; border: calc(1px * var(--ui-scale, 1)) solid #e7eaf0; border-radius: calc(12px * var(--ui-scale, 1)); background: #fff; cursor: pointer; filter: grayscale(1); opacity: .72; }
.agent-admin-delete:hover { border-color: #eec9c9; background: #fcf1f1; filter: none; opacity: 1; }
.agent-admin-details { display: none; }
.agent-admin-card.is-expanded .agent-admin-details { display: grid; gap: 0; }
.agent-admin-section { padding: calc(17px * var(--ui-scale, 1)) calc(18px * var(--ui-scale, 1)); border-bottom: calc(1px * var(--ui-scale, 1)) solid #eeeae0; }
.agent-admin-section-heading { display: flex; align-items: flex-start; gap: calc(10px * var(--ui-scale, 1)); margin-bottom: calc(13px * var(--ui-scale, 1)); }
.agent-admin-section-heading strong, .agent-admin-section-heading small { display: block; }
.agent-admin-section-heading strong { color: #20352c; font: 800 calc(12px * var(--ui-scale, 1)) var(--font); }
.agent-admin-section-heading small { margin-top: calc(2px * var(--ui-scale, 1)); color: #64748b; font: 600 calc(12px * var(--ui-scale, 1)) var(--font); }
.agent-admin-section-icon { width: calc(23px * var(--ui-scale, 1)); height: calc(23px * var(--ui-scale, 1)); display: grid; place-items: center; border-radius: calc(12px * var(--ui-scale, 1)); background: #e9f4f1; color: #0d6b5c; font: 800 calc(12px * var(--ui-scale, 1)) var(--font); }
.agent-admin-fields { display: grid; grid-template-columns: 1fr .8fr 1.25fr; gap: calc(12px * var(--ui-scale, 1)); }
.agent-admin-fields label { display: grid; gap: calc(6px * var(--ui-scale, 1)); color: #475467; font-size: calc(12px * var(--ui-scale, 1)); font-weight: 800; }
.agent-admin-fields label > span { color: #667085; font-size: calc(12px * var(--ui-scale, 1)); font-weight: 650; }
.agent-admin-fields input, .agent-admin-fields select { min-width: 0; width: 100%; min-height: calc(42px * var(--ui-scale, 1)); border: calc(1px * var(--ui-scale, 1)) solid #d0d5dd; border-radius: calc(12px * var(--ui-scale, 1)); padding: calc(9px * var(--ui-scale, 1)) calc(11px * var(--ui-scale, 1)); background: #fff; color: var(--ink); font: 650 calc(13px * var(--ui-scale, 1)) var(--font); outline-color: var(--blue); }
.agent-admin-departments { min-width: 0; margin: 0; padding: 0; border: 0; }
.agent-admin-department-options { display: flex; align-items: center; flex-wrap: wrap; gap: calc(8px * var(--ui-scale, 1)); min-height: calc(34px * var(--ui-scale, 1)); }
.agent-admin-department-option { display: inline-flex; align-items: center; gap: calc(7px * var(--ui-scale, 1)); border: calc(1px * var(--ui-scale, 1)) solid #d8d1c2; border-radius: calc(999px * var(--ui-scale, 1)); padding: calc(8px * var(--ui-scale, 1)) calc(11px * var(--ui-scale, 1)); background: #f8fafc; color: #344054; font: 750 calc(12px * var(--ui-scale, 1)) var(--font); cursor: pointer; }
.agent-admin-department-option:has(input:checked) { border-color: #9ccfbf; background: #e9f4f1; color: #0a5a4d; }
.agent-admin-card .agent-admin-department-option input { width: calc(15px * var(--ui-scale, 1)); min-width: calc(15px * var(--ui-scale, 1)); height: calc(15px * var(--ui-scale, 1)); min-height: calc(15px * var(--ui-scale, 1)); margin: 0; padding: 0 !important; accent-color: var(--blue); }
.agent-admin-invitation-panel { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: calc(14px * var(--ui-scale, 1)); padding: calc(15px * var(--ui-scale, 1)) calc(18px * var(--ui-scale, 1)); background: #f8fafc; }
.agent-admin-invitation-copy { min-width: 0; display: flex; align-items: center; gap: calc(10px * var(--ui-scale, 1)); }
.agent-admin-invitation-copy strong, .agent-admin-invitation-copy small { display: block; }
.agent-admin-invitation-copy strong { color: #20352c; font: 800 calc(12px * var(--ui-scale, 1)) var(--font); }
.agent-admin-invitation-copy small { margin-top: calc(2px * var(--ui-scale, 1)); color: #64748b; font: 600 calc(12px * var(--ui-scale, 1)) var(--font); }
.agent-admin-invitation-icon { width: calc(34px * var(--ui-scale, 1)); height: calc(34px * var(--ui-scale, 1)); display: grid; place-items: center; border-radius: calc(12px * var(--ui-scale, 1)); background: #e9f4f1; color: #0d6b5c; font-size: calc(16px * var(--ui-scale, 1)); }
.agent-admin-invitation-actions { display: flex; align-items: center; gap: calc(8px * var(--ui-scale, 1)); }
.agent-admin-invitation-actions .button { min-height: calc(36px * var(--ui-scale, 1)); padding: calc(7px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)); font-size: calc(12px * var(--ui-scale, 1)); }
.agent-admin-invitation-actions .button:disabled { opacity: .45; cursor: not-allowed; }
.admin-agent-empty { min-height: calc(210px * var(--ui-scale, 1)); display: grid; place-items: center; align-content: center; gap: calc(6px * var(--ui-scale, 1)); border: calc(1px * var(--ui-scale, 1)) dashed #d0d5dd; border-radius: calc(14px * var(--ui-scale, 1)); background: #f8fafc; text-align: center; color: #64748b; }
.admin-agent-empty > span { width: calc(44px * var(--ui-scale, 1)); height: calc(44px * var(--ui-scale, 1)); display: grid; place-items: center; border-radius: calc(14px * var(--ui-scale, 1)); background: #e9f4f1; color: #0d6b5c; font-size: calc(22px * var(--ui-scale, 1)); }
.admin-agent-empty strong { color: #334155; font-size: calc(13px * var(--ui-scale, 1)); }
.admin-agent-empty p { margin: 0 0 calc(8px * var(--ui-scale, 1)); font-size: calc(12px * var(--ui-scale, 1)); }

/* Recipient Bar & CC styling */
.email-recipient-bar {
  padding: calc(12px * var(--ui-scale, 1)) calc(22px * var(--ui-scale, 1));
  border-bottom: calc(1px * var(--ui-scale, 1)) solid var(--line);
  background: #fafbfc;
  display: flex;
  flex-direction: column;
  gap: calc(8px * var(--ui-scale, 1));
}
.recipient-row {
  display: flex;
  align-items: center;
  gap: calc(10px * var(--ui-scale, 1));
}
.recipient-row label {
  font-size: calc(12px * var(--ui-scale, 1));
  font-weight: 700;
  color: #667085;
  width: calc(28px * var(--ui-scale, 1));
}
.recipient-row input {
  flex: 1;
  border: calc(1px * var(--ui-scale, 1)) solid #d9dee7;
  border-radius: calc(12px * var(--ui-scale, 1));
  padding: calc(7px * var(--ui-scale, 1)) calc(11px * var(--ui-scale, 1));
  font: calc(12.5px * var(--ui-scale, 1)) var(--font);
  background: #fff;
  color: var(--ink);
  outline-color: var(--blue);
}
.recipient-row input[readonly] {
  background: #f2f1ea;
  color: #344054;
  font-weight: 600;
  border-color: #e2dbcc;
}
.message-cc {
  font-size: calc(12px * var(--ui-scale, 1));
  color: #4fb3a0;
  margin-top: calc(4px * var(--ui-scale, 1));
  font-style: italic;
}

/* Contact info grid for customer detail view */
.customer-detail-heading > div.customer-detail-identity {
  display: grid;
  grid-template-columns: calc(35px * var(--ui-scale, 1)) minmax(0, auto);
  grid-template-rows: minmax(calc(35px * var(--ui-scale, 1)), auto) auto;
  column-gap: calc(12px * var(--ui-scale, 1));
  row-gap: calc(7px * var(--ui-scale, 1));
  align-items: center;
  min-width: 0;
}
.customer-detail-identity > .customer-initial {
  grid-column: 1;
  grid-row: 1;
  align-self: center;
}
.customer-detail-identity > h3 {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  margin: 0;
  font-size: calc(20px * var(--ui-scale, 1));
  line-height: 1.15;
}
.customer-detail-badges {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: calc(8px * var(--ui-scale, 1));
  min-width: 0;
}
.customer-detail-badges .customer-code,
.customer-detail-badges .location-pill {
  white-space: nowrap;
}
.customer-detail-badges .location-pill {
  margin-top: 0;
}

.customer-info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: calc(10px * var(--ui-scale, 1));
  padding: calc(16px * var(--ui-scale, 1)) calc(20px * var(--ui-scale, 1));
  border-bottom: calc(1px * var(--ui-scale, 1)) solid var(--line);
  background: #fafbfc;
}
.info-field {
  display: flex;
  flex-direction: column;
  gap: calc(3px * var(--ui-scale, 1));
}
.info-field.full-width {
  grid-column: 1 / -1;
}
.info-label {
  font-size: calc(12px * var(--ui-scale, 1));
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #667085;
}
.info-field strong {
  font-size: calc(12.5px * var(--ui-scale, 1));
  font-weight: 600;
  color: var(--ink);
  word-break: break-word;
}
@media (max-width: 600px) {
  .customer-detail-heading > div.customer-detail-identity {
    grid-template-columns: calc(35px * var(--ui-scale, 1)) minmax(0, 1fr);
  }
  .customer-info-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Authentication feedback must remain visible above the login and invitation
   overlays; previously the messages were rendered behind both layers. */
.toast-container {
  z-index: 100100;
}

.auth-invitation-feedback {
  margin: 0 0 calc(15px * var(--ui-scale, 1));
  padding: calc(11px * var(--ui-scale, 1)) calc(13px * var(--ui-scale, 1));
  border: calc(1px * var(--ui-scale, 1)) solid transparent;
  border-radius: calc(12px * var(--ui-scale, 1));
  font-size: calc(13px * var(--ui-scale, 1));
  font-weight: 650;
  line-height: 1.45;
  text-align: center;
}

.auth-invitation-feedback.error {
  border-color: #eec9c9;
  background: #fbecec;
  color: #862929;
}

.auth-invitation-feedback.success {
  border-color: #b6e6c6;
  background: #ecf8f1;
  color: #186046;
}

.auth-access-message {
  margin: calc(16px * var(--ui-scale, 1)) 0 0;
  padding: calc(11px * var(--ui-scale, 1)) calc(13px * var(--ui-scale, 1));
  border: calc(1px * var(--ui-scale, 1)) solid #eec9c9;
  border-radius: calc(12px * var(--ui-scale, 1));
  background: #fbecec;
  color: #862929;
  font-size: calc(13px * var(--ui-scale, 1));
  font-weight: 650;
  line-height: 1.45;
  text-align: center;
}

@media (max-width: 900px) {
  /* Give the entire mobile workspace a small top margin, including search. */
  .main-content {
    padding-top: calc(18px * var(--ui-scale, 1));
  }
}

/* Clickable directory rows & action buttons */
.customer-row.clickable-row {
  cursor: pointer;
  transition: background-color .15s ease;
}
.customer-row.clickable-row:hover {
  background-color: #f8fafc;
}
.customer-name-title {
  display: inline-flex;
  align-items: center;
  gap: calc(5px * var(--ui-scale, 1));
  min-width: 0;
}
.customer-favorite-indicator {
  color: #b5670f;
  font-size: calc(15px * var(--ui-scale, 1));
  line-height: 1;
  text-shadow: 0 calc(1px * var(--ui-scale, 1)) calc(2px * var(--ui-scale, 1)) rgba(148, 88, 10, .18);
}
.row-chevron {
  font-size: calc(18px * var(--ui-scale, 1));
  color: #b8bdb6;
  font-weight: 700;
  padding-right: calc(5px * var(--ui-scale, 1));
  text-align: right;
}
.customer-row.clickable-row:hover .row-chevron {
  color: var(--blue);
}
.customer-actions {
  display: flex;
  align-items: center;
  gap: calc(6px * var(--ui-scale, 1));
  justify-content: flex-end;
}
.customer-actions .small-action {
  padding: calc(4px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1));
  font-size: calc(12px * var(--ui-scale, 1));
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: calc(4px * var(--ui-scale, 1));
}
.customer-actions .delete-action {
  color: #c24747;
  border-color: #eaa8a8;
  padding: calc(4px * var(--ui-scale, 1)) calc(7px * var(--ui-scale, 1));
}
.customer-actions .delete-action:hover {
  background: #fbecec;
  color: #b03d3d;
}

/* Custom Delete Confirmation Modal */
.delete-modal-card {
  text-align: center;
  width: min(calc(400px * var(--ui-scale, 1)), 100%);
}
.delete-icon-wrap {
  width: calc(48px * var(--ui-scale, 1));
  height: calc(48px * var(--ui-scale, 1));
  border-radius: 50%;
  background: #fbecec;
  color: #c24747;
  font-size: calc(22px * var(--ui-scale, 1));
  display: grid;
  place-items: center;
  margin: 0 auto calc(12px * var(--ui-scale, 1));
}
.red-eyebrow {
  color: #c24747 !important;
}
.modal-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: calc(10px * var(--ui-scale, 1));
  margin-top: calc(18px * var(--ui-scale, 1));
}
.button-danger {
  background: #c24747;
  color: #fff;
  border: 0;
  box-shadow: 0 calc(1px * var(--ui-scale, 1)) calc(2px * var(--ui-scale, 1)) rgba(194, 71, 71, 0.2);
}
.button-danger:hover {
  background: #b03d3d;
}

/* Agent Status Indicator Dots (Green, Orange, Red) */
.agent-status-controls {
  display: flex;
  gap: calc(5px * var(--ui-scale, 1));
  align-items: center;
  margin-left: auto;
}

.agent-status-controls button {
  width: calc(9px * var(--ui-scale, 1));
  height: calc(9px * var(--ui-scale, 1));
  border-radius: 50%;
  border: 0;
  padding: 0;
  cursor: pointer;
  opacity: 0.35;
  transition: all .2s ease;
}

.agent-status-controls button:hover {
  opacity: 0.8;
  transform: scale(1.15);
}

/* Green dot - Available */
.agent-status-controls button[data-agent-status="AVAILABLE"] {
  background-color: #1f9a63;
}
.agent-status-controls button[data-agent-status="AVAILABLE"].active {
  opacity: 1;
  box-shadow: 0 0 calc(8px * var(--ui-scale, 1)) rgba(31, 154, 99, 0.6);
  transform: scale(1.2);
}

/* Orange dot - Busy */
.agent-status-controls button[data-agent-status="BUSY"] {
  background-color: #c1621a;
}
.agent-status-controls button[data-agent-status="BUSY"].active {
  opacity: 1;
  box-shadow: 0 0 calc(8px * var(--ui-scale, 1)) rgba(193, 98, 26, 0.6);
  transform: scale(1.2);
}

/* Red dot - Offline */
.agent-status-controls button[data-agent-status="OFFLINE"] {
  background-color: #c24747;
}
.agent-status-controls button[data-agent-status="OFFLINE"].active {
  opacity: 1;
  box-shadow: 0 0 calc(8px * var(--ui-scale, 1)) rgba(194, 71, 71, 0.6);
  transform: scale(1.2);
}

.dashboard-grid.single-column {
  grid-template-columns: 1fr;
}

/* Floating Live Search Overlay */
.global-search-wrap {
  position: relative;
}
.search-clear-btn {
  border: 0;
  background: #ebe7dd;
  color: #475467;
  font-size: calc(15px * var(--ui-scale, 1));
  font-weight: 700;
  cursor: pointer;
  width: calc(22px * var(--ui-scale, 1));
  height: calc(22px * var(--ui-scale, 1));
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
  transition: all 0.15s ease;
  flex-shrink: 0;
  z-index: 10;
  position: relative;
}
.search-clear-btn:hover {
  color: #0c2620;
  background: #cbd5e1;
}

.live-search-overlay {
  position: fixed;
  top: calc(72px * var(--ui-scale, 1));
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(640px * var(--ui-scale, 1)), 94vw);
  background: #ffffff;
  border: calc(1px * var(--ui-scale, 1)) solid #cbd5e1;
  border-radius: calc(14px * var(--ui-scale, 1));
  box-shadow: 0 calc(20px * var(--ui-scale, 1)) calc(48px * var(--ui-scale, 1)) rgba(15, 23, 42, 0.22);
  max-height: calc(520px * var(--ui-scale, 1));
  overflow-y: auto;
  z-index: 9999;
  padding: calc(14px * var(--ui-scale, 1));
}
.live-search-overlay.hidden {
  display: none !important;
}

.search-section-title {
  font-size: calc(12px * var(--ui-scale, 1));
  font-weight: 700;
  color: #667085;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: calc(12px * var(--ui-scale, 1)) calc(6px * var(--ui-scale, 1)) calc(6px * var(--ui-scale, 1));
}
.search-section-title:first-child {
  margin-top: calc(2px * var(--ui-scale, 1));
}

.live-search-card {
  display: flex;
  align-items: center;
  gap: calc(12px * var(--ui-scale, 1));
  padding: calc(10px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1));
  border-radius: calc(12px * var(--ui-scale, 1));
  cursor: pointer;
  transition: background 0.15s ease;
  border-bottom: calc(1px * var(--ui-scale, 1)) solid #f2f4f7;
}
.live-search-card:last-child {
  border-bottom: 0;
}
.live-search-card:hover {
  background: #f8fafc;
}
.live-search-card-main {
  flex: 1;
  min-width: 0;
}
.live-search-card-main strong {
  font-size: calc(13px * var(--ui-scale, 1));
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: calc(8px * var(--ui-scale, 1));
}
.live-search-card-main p {
  font-size: calc(12px * var(--ui-scale, 1));
  color: var(--muted);
  margin: calc(3px * var(--ui-scale, 1)) 0 0;
}
.live-search-empty {
  padding: calc(30px * var(--ui-scale, 1)) calc(20px * var(--ui-scale, 1));
  text-align: center;
  color: var(--muted);
  font-size: calc(13px * var(--ui-scale, 1));
}

.detail-modal-card {
  max-width: calc(680px * var(--ui-scale, 1));
  width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  padding: calc(24px * var(--ui-scale, 1));
}
.detail-modal-card .customer-detail-heading {
  margin-top: calc(10px * var(--ui-scale, 1));
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: calc(16px * var(--ui-scale, 1));
  margin-bottom: calc(20px * var(--ui-scale, 1));
}
.detail-modal-card .customer-info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: calc(12px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1));
  background: #f8fafc;
  padding: calc(16px * var(--ui-scale, 1));
  border-radius: calc(12px * var(--ui-scale, 1));
  border: calc(1px * var(--ui-scale, 1)) solid #e7eaf0;
  margin-bottom: calc(20px * var(--ui-scale, 1));
}

/* Mobile Responsive Enhancements */
@keyframes slideInLeft {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}

@media (max-width: 900px) {
  .sidebar {
    display: none;
  }
  .sidebar.mobile-open {
    display: flex !important;
    position: fixed;
    inset: 0 auto 0 0;
    width: calc(270px * var(--ui-scale, 1));
    z-index: 1000;
    box-shadow: calc(6px * var(--ui-scale, 1)) 0 calc(30px * var(--ui-scale, 1)) rgba(0, 0, 0, 0.4);
    animation: slideInLeft 0.22s ease-out;
  }
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(10, 35, 31, 0.55);
    backdrop-filter: blur(calc(2px * var(--ui-scale, 1)));
    z-index: 999;
  }
  .global-search {
    width: 100%;
    max-width: calc(320px * var(--ui-scale, 1));
  }
}

/* Email delete confirmation: application dialog, not the browser prompt. */
.email-delete-modal {
  max-width: calc(460px * var(--ui-scale, 1));
  padding: calc(28px * var(--ui-scale, 1));
  border: calc(1px * var(--ui-scale, 1)) solid #eec9c9;
  box-shadow: 0 calc(24px * var(--ui-scale, 1)) calc(70px * var(--ui-scale, 1)) rgba(124, 45, 45, 0.22);
}

.email-delete-modal .delete-icon-wrap {
  width: calc(52px * var(--ui-scale, 1));
  height: calc(52px * var(--ui-scale, 1));
  display: grid;
  place-items: center;
  margin-bottom: calc(14px * var(--ui-scale, 1));
  border-radius: calc(16px * var(--ui-scale, 1));
  color: #9c2f2f;
  background: linear-gradient(135deg, #fbecec, #f9dcdc);
  border: calc(1px * var(--ui-scale, 1)) solid #eec9c9;
  font-size: calc(24px * var(--ui-scale, 1));
}

.email-delete-modal .modal-actions-grid {
  margin-top: calc(24px * var(--ui-scale, 1));
}

.active-agent-select-wrapper.agent-selector-locked {
  opacity: 0.82;
}

.active-agent-select-wrapper.agent-selector-locked select {
  cursor: not-allowed;
}

#ticket-agent-select:disabled {
  cursor: not-allowed;
  color: #64748b;
  background: #f8fafc;
}

@media (max-width: 760px) {
  .agent-admin-card {
    grid-template-columns: 1fr !important;
  }
}

/* On mobile, agent administration behaves like a fixed workspace: the form
   controls remain reachable while the agent list is the only scroll area. */
@media (max-width: 900px) {
  .admin-company-toolbar {
    grid-template-columns: 1fr;
    gap: calc(10px * var(--ui-scale, 1));
    padding: calc(13px * var(--ui-scale, 1));
  }

  .admin-agent-directory-toolbar { grid-template-columns: 1fr auto; }
  .admin-agent-directory-heading { grid-column: 1 / -1; }

  #admin-agent-settings-modal {
    padding: calc(12px * var(--ui-scale, 1));
    place-items: stretch;
  }

  #admin-agent-settings-modal .admin-agent-modal {
    width: 100% !important;
    height: 100%;
    max-height: none;
    padding: calc(22px * var(--ui-scale, 1)) calc(18px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1)) !important;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  #admin-agent-settings-modal .admin-agent-modal > .eyebrow,
  #admin-agent-settings-modal .admin-agent-modal > h2,
  #admin-agent-settings-modal .admin-agent-modal > .modal-description {
    flex: 0 0 auto;
  }

  #admin-agents-form {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    flex-direction: column;
  }

  #admin-agents-form > .admin-company-toolbar,
  #admin-agents-form > .admin-mailbox-card,
  #admin-agents-form > .admin-agent-directory-toolbar,
  #admin-agents-form > .admin-agent-form-actions {
    flex: 0 0 auto;
  }

  #admin-agents-list-container {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none !important;
    margin-bottom: calc(16px * var(--ui-scale, 1)) !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    padding-right: calc(4px * var(--ui-scale, 1)) !important;
  }

  #admin-agents-form > .admin-agent-form-actions {
    padding-bottom: 0 !important;
  }
}

/* Agent settings: a spacious, readable desktop form. */
.admin-agent-modal {
  width: min(calc(1080px * var(--ui-scale, 1)), calc(100vw - calc(48px * var(--ui-scale, 1)))) !important;
  max-height: calc(100vh - calc(48px * var(--ui-scale, 1)));
  overflow: hidden auto;
  padding: calc(34px * var(--ui-scale, 1)) !important;
}

.admin-agent-modal #admin-agents-list-container {
  max-height: 58vh !important;
}

.admin-company-toolbar {
  display: grid;
  grid-template-columns: minmax(calc(220px * var(--ui-scale, 1)), .8fr) minmax(0, 1.2fr);
  gap: calc(18px * var(--ui-scale, 1));
  align-items: end;
  margin: 0 0 calc(18px * var(--ui-scale, 1));
  padding: calc(15px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1));
  border: calc(1px * var(--ui-scale, 1)) solid #d0d5dd;
  border-radius: calc(14px * var(--ui-scale, 1));
  background: linear-gradient(135deg, #f8fafc, #ecf5f1);
}

.admin-company-toolbar label {
  display: block;
  margin: 0 0 calc(6px * var(--ui-scale, 1));
  color: #64748b;
  font: 700 calc(12px * var(--ui-scale, 1)) var(--font);
}

.admin-company-toolbar select {
  width: 100%;
  min-height: calc(40px * var(--ui-scale, 1));
  padding: 0 calc(11px * var(--ui-scale, 1));
  border: calc(1px * var(--ui-scale, 1)) solid #b4c4ba;
  border-radius: calc(12px * var(--ui-scale, 1));
  background: #fff;
  color: #1e2a25;
  font: 700 calc(14px * var(--ui-scale, 1)) var(--font);
}

.admin-company-context {
  min-width: 0;
  padding: calc(2px * var(--ui-scale, 1)) 0;
}

.admin-company-context strong,
.admin-company-context small {
  display: block;
}

.admin-company-context strong {
  color: #1d463a;
  font: 750 calc(15px * var(--ui-scale, 1)) var(--font);
}

.admin-company-context small {
  margin-top: calc(4px * var(--ui-scale, 1));
  color: #64748b;
  font: 600 calc(12px * var(--ui-scale, 1)) var(--font);
}

.admin-mailbox-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: calc(13px * var(--ui-scale, 1));
  margin: 0 0 calc(18px * var(--ui-scale, 1));
  padding: calc(14px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1));
  border: calc(1px * var(--ui-scale, 1)) solid #d0d5dd;
  border-radius: calc(14px * var(--ui-scale, 1));
  background: #fff;
}

.admin-mailbox-icon {
  width: calc(40px * var(--ui-scale, 1));
  height: calc(40px * var(--ui-scale, 1));
  display: grid;
  place-items: center;
  border-radius: calc(12px * var(--ui-scale, 1));
  background: #e9f4f1;
  color: #0d6b5c;
  font-size: calc(19px * var(--ui-scale, 1));
}

.admin-mailbox-copy {
  min-width: 0;
}

.admin-mailbox-copy strong,
.admin-mailbox-copy span,
.admin-mailbox-copy small {
  display: block;
}

.admin-mailbox-copy strong {
  color: #1e2a25;
  font: 750 calc(13px * var(--ui-scale, 1)) var(--font);
}

.admin-mailbox-copy span {
  margin-top: calc(2px * var(--ui-scale, 1));
  overflow: hidden;
  color: #334155;
  font: 700 calc(13px * var(--ui-scale, 1)) var(--font);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-mailbox-copy small {
  margin-top: calc(7px * var(--ui-scale, 1));
  color: #64748b;
  font: 600 calc(12px * var(--ui-scale, 1)) var(--font);
}

.admin-mailbox-copy small.connected { color: #0c6647; }
.admin-mailbox-copy small.disconnected { color: #94580a; }

.admin-agent-directory-toolbar {
  display: grid;
  grid-template-columns: minmax(calc(120px * var(--ui-scale, 1)), auto) minmax(calc(220px * var(--ui-scale, 1)), 1fr) auto;
  align-items: center;
  gap: calc(12px * var(--ui-scale, 1));
  margin-bottom: calc(14px * var(--ui-scale, 1));
}

.admin-agent-directory-heading strong,
.admin-agent-directory-heading span { display: block; }
.admin-agent-directory-heading strong { color: #1d332a; font: 800 calc(14px * var(--ui-scale, 1)) var(--font); }
.admin-agent-directory-heading span { margin-top: calc(2px * var(--ui-scale, 1)); color: #87968d; font: 650 calc(12px * var(--ui-scale, 1)) var(--font); }
.admin-agent-search-field { min-width: 0; }
.admin-agent-search-field input { width: 100%; min-height: calc(40px * var(--ui-scale, 1)); padding: calc(9px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)) calc(9px * var(--ui-scale, 1)) calc(34px * var(--ui-scale, 1)); border: calc(1px * var(--ui-scale, 1)) solid #d0d5dd; border-radius: calc(12px * var(--ui-scale, 1)); background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238493a5' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat calc(11px * var(--ui-scale, 1)) center; color: #20352c; font: 650 calc(12px * var(--ui-scale, 1)) var(--font); outline-color: #9ccfbf; }
.admin-agent-directory-toolbar > .button { min-height: calc(40px * var(--ui-scale, 1)); padding: calc(8px * var(--ui-scale, 1)) calc(13px * var(--ui-scale, 1)); font-size: calc(12px * var(--ui-scale, 1)); }
.admin-agent-form-actions { position: sticky; bottom: 0; z-index: 2; display: flex; justify-content: flex-end; gap: calc(10px * var(--ui-scale, 1)); padding-top: calc(14px * var(--ui-scale, 1)); border-top: calc(1px * var(--ui-scale, 1)) solid #e7eaf0; background: #fff; }
.admin-agent-modal-title { margin-top: calc(5px * var(--ui-scale, 1)); }
.admin-agent-modal-description { margin-bottom: calc(20px * var(--ui-scale, 1)); }

/* Match the right rail's dimensions to the left navigation. */
@media (min-width: 1321px) {
  .app-shell {
    grid-template-columns: calc(310px * var(--ui-scale, 1)) minmax(0, 1fr) calc(310px * var(--ui-scale, 1));
  }
}

.utility-rail {
  min-height: 100vh;
  padding: calc(26px * var(--ui-scale, 1)) calc(20px * var(--ui-scale, 1)) calc(20px * var(--ui-scale, 1));
  display: flex;
  flex-direction: column;
  border-left: calc(1px * var(--ui-scale, 1)) solid var(--line);
}

.agent-controls-rail-section {
  padding-top: 0 !important;
  width: 100%;
}

/* Kø Profil is its own control. The line actions are shown compactly below it. */
#queue-card-wrapper .queue-accordion-btn {
  min-height: calc(26px * var(--ui-scale, 1));
  gap: calc(8px * var(--ui-scale, 1));
}

#queue-card-wrapper .queue-btn-text strong {
  font: 700 calc(12.5px * var(--ui-scale, 1)) var(--font) !important;
  letter-spacing: 0;
}

#queue-card-wrapper .status-lines-sub {
  font: 600 calc(11.5px * var(--ui-scale, 1)) var(--font) !important;
}

#queue-agent-actions[hidden] {
  display: none !important;
}

#queue-agent-actions {
  display: flex;
  gap: calc(6px * var(--ui-scale, 1));
  width: 100%;
  margin-top: calc(4px * var(--ui-scale, 1));
  padding: 0;
  border: 0;
}

#queue-agent-actions .pause-control-container,
#queue-agent-actions .btn-agent-action {
  flex: 1 1 0;
}

#queue-agent-actions .btn-agent-action {
  width: 100% !important;
  height: calc(28px * var(--ui-scale, 1)) !important;
  min-height: calc(28px * var(--ui-scale, 1)) !important;
  border-radius: calc(6px * var(--ui-scale, 1)) !important;
  font: 700 calc(11.5px * var(--ui-scale, 1)) var(--font) !important;
  padding: 0 calc(8px * var(--ui-scale, 1)) !important;
  box-shadow: none !important;
}

#queue-agent-actions .pause-dropdown-menu {
  top: calc(100% + calc(4px * var(--ui-scale, 1)));
  right: auto;
  left: 0;
  width: max-content;
  min-width: calc(180px * var(--ui-scale, 1));
}

#queue-agent-actions .pause-dropdown-menu button {
  font: 600 calc(13px * var(--ui-scale, 1)) var(--font);
}

@media (max-width: 1000px) {
  .admin-agent-modal {
    width: min(calc(720px * var(--ui-scale, 1)), calc(100vw - calc(32px * var(--ui-scale, 1)))) !important;
    padding: calc(24px * var(--ui-scale, 1)) !important;
  }

  .agent-admin-summary { grid-template-columns: auto minmax(calc(130px * var(--ui-scale, 1)), 1fr) auto; }
  .agent-admin-department-summary { display: none; }
  .agent-admin-fields { grid-template-columns: 1fr 1fr; }
  .agent-admin-fields label:last-child { grid-column: 1 / -1; }
}

@media (max-width: 600px) {
  .topbar {
    padding: 0 calc(12px * var(--ui-scale, 1));
    gap: calc(8px * var(--ui-scale, 1));
  }

  .admin-mailbox-card {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .admin-mailbox-card .button {
    grid-column: 1 / -1;
    width: 100%;
  }
  .admin-agent-directory-toolbar { grid-template-columns: 1fr auto; }
  .admin-agent-directory-heading { grid-column: 1 / -1; }
  .admin-agent-search-field { min-width: 0; }
  .agent-admin-card-header { grid-template-columns: minmax(0, 1fr); }
  .agent-admin-summary { grid-template-columns: auto minmax(0, 1fr) auto; width: 100%; }
  .agent-admin-state { justify-content: space-between; padding-left: calc(54px * var(--ui-scale, 1)); }
  .agent-admin-fields { grid-template-columns: 1fr; }
  .agent-admin-fields label:last-child { grid-column: auto; }
  .agent-admin-invitation-panel { grid-template-columns: 1fr; }
  .agent-admin-invitation-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .agent-admin-invitation-actions .button { width: 100%; }
  .global-search {
    max-width: calc(220px * var(--ui-scale, 1));
  }
  .customer-detail-inpage-card .customer-detail-heading {
    flex-direction: column;
    align-items: stretch;
    gap: calc(14px * var(--ui-scale, 1));
  }
  .customer-detail-inpage-card .customer-detail-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: calc(8px * var(--ui-scale, 1));
    width: 100%;
  }
  .customer-detail-inpage-card .customer-detail-actions .button {
    width: 100%;
    justify-content: center;
    font-size: calc(12px * var(--ui-scale, 1));
    padding: calc(8px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
  }
  .inbox-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .thread-panel {
    border-right: 0;
    border-bottom: calc(1px * var(--ui-scale, 1)) solid var(--line);
  }
  .thread-list {
    max-height: calc(180px * var(--ui-scale, 1));
  }
  .conversation-panel {
    min-height: calc(420px * var(--ui-scale, 1));
  }
  .message-history {
  min-height: calc(260px * var(--ui-scale, 1));
  max-height: calc(320px * var(--ui-scale, 1));
}

.clickable-sms-item:hover,
.clickable-email-item:hover {
  background: #e9f4f1 !important;
  border-color: #a7d5c7 !important;
  transform: translateY(calc(-1px * var(--ui-scale, 1)));
  box-shadow: 0 calc(2px * var(--ui-scale, 1)) calc(6px * var(--ui-scale, 1)) rgba(13, 107, 92, 0.1);
  transition: all 0.15s ease;
}

.log-symbol.violet-icon { background: #f3eef7; color: #8a5fa0; }
.log-symbol.orange-icon { background: #f9efe2; color: #c1621a; }
.call-status.live-status { color: #0d6b5c; }
.call-status.closed-status { color: #64748b; }

}

.badge-count-wrap,
.nav-item .badge-count-wrap {
  margin-left: calc(6px * var(--ui-scale, 1)) !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: calc(3px * var(--ui-scale, 1)) !important;
  font-size: calc(13px * var(--ui-scale, 1)) !important;
  font-weight: 600 !important;
  color: #64748b !important;
  line-height: 1 !important;
}

.total-num,
.nav-item .total-num,
.badge-count-wrap .total-num {
  font-size: calc(13px * var(--ui-scale, 1)) !important;
  color: #98a29b !important;
  font-weight: 600 !important;
}

.unread-oval,
.nav-item .unread-oval {
  background: var(--blue) !important;
  color: #ffffff !important;
  border-radius: calc(12px * var(--ui-scale, 1)) !important;
  padding: calc(1px * var(--ui-scale, 1)) calc(7px * var(--ui-scale, 1)) !important;
  font-size: calc(12px * var(--ui-scale, 1)) !important;
  font-weight: 700 !important;
  min-width: calc(18px * var(--ui-scale, 1)) !important;
  height: calc(18px * var(--ui-scale, 1)) !important;
  line-height: calc(16px * var(--ui-scale, 1)) !important;
  text-align: center !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: 0 calc(1px * var(--ui-scale, 1)) calc(3px * var(--ui-scale, 1)) rgba(13, 107, 92, 0.4) !important;
}

.thread-item.unread-thread {
  background-color: #eaf5f1 !important;
  border-left: calc(3.5px * var(--ui-scale, 1)) solid #0d6b5c !important;
}

.thread-item.unread-thread:hover {
  background-color: #d9f0ea !important;
}

.unread-dot {
  color: #0d6b5c;
  font-size: calc(12px * var(--ui-scale, 1));
  margin-left: calc(4px * var(--ui-scale, 1));
  vertical-align: middle;
}

.clickable-log {
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  position: relative !important;
}

.clickable-log:hover {
  background: #ecf6f1 !important;
}

.clickable-log.selected-log {
  background: #eaf5f1 !important;
  border-left: calc(3.5px * var(--ui-scale, 1)) solid #0d6b5c !important;
}

.log-action-overlay {
  display: none !important;
  position: absolute !important;
  inset: 0 !important;
  background: rgba(236, 245, 241, 0.94) !important;
  border-radius: calc(10px * var(--ui-scale, 1)) !important;
  z-index: 5 !important;
  align-items: center !important;
  justify-content: center !important;
}

.clickable-log.selected-log .log-action-overlay {
  display: flex !important;
}

.log-open-btn-centered {
  background: #0d6b5c !important;
  color: #ffffff !important;
  border: 0 !important;
  border-radius: calc(14px * var(--ui-scale, 1)) !important;
  padding: calc(3px * var(--ui-scale, 1)) calc(18px * var(--ui-scale, 1)) !important;
  font-size: calc(12px * var(--ui-scale, 1)) !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1.4 !important;
  box-shadow: 0 calc(2px * var(--ui-scale, 1)) calc(6px * var(--ui-scale, 1)) rgba(13, 107, 92, 0.4) !important;
  transition: all 0.15s ease !important;
}

.log-open-btn-centered:hover {
  background: #0a5a4d !important;
  transform: scale(1.06) !important;
  box-shadow: 0 calc(4px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1)) rgba(13, 107, 92, 0.5) !important;
}

/* Mobile Viewport Container & Overflow Fixes */
@media (max-width: 768px) {
  html, body {
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
  }

  .app-shell, .main-content, .content-scroll {
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
    padding-left: calc(10px * var(--ui-scale, 1)) !important;
    padding-right: calc(10px * var(--ui-scale, 1)) !important;
  }

  .dashboard-grid, .metric-grid, .surface, .activity-card {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    min-width: 0 !important;
  }

  /* Metric cards responsive column layout on mobile */
  .metric-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: calc(8px * var(--ui-scale, 1)) !important;
  }

  .metric-card {
    flex-direction: column !important;
    align-items: flex-start !important;
    padding: calc(10px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1)) !important;
    gap: calc(3px * var(--ui-scale, 1)) !important;
    min-width: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .metric-icon {
    width: calc(26px * var(--ui-scale, 1)) !important;
    height: calc(26px * var(--ui-scale, 1)) !important;
    font-size: calc(13px * var(--ui-scale, 1)) !important;
    flex: 0 0 calc(26px * var(--ui-scale, 1)) !important;
    border-radius: calc(12px * var(--ui-scale, 1)) !important;
    margin-bottom: calc(2px * var(--ui-scale, 1)) !important;
  }

  .metric-card > div {
    min-width: 0 !important;
    width: 100% !important;
    overflow: hidden !important;
  }

  .metric-card span {
    font-size: calc(12px * var(--ui-scale, 1)) !important;
    font-weight: 600 !important;
    white-space: normal !important;
    word-break: break-word !important;
    line-height: 1.25 !important;
    display: block !important;
    width: 100% !important;
  }

  .metric-card strong {
    font-size: calc(18px * var(--ui-scale, 1)) !important;
    line-height: 1.2 !important;
    display: block !important;
    margin: calc(2px * var(--ui-scale, 1)) 0 calc(1px * var(--ui-scale, 1)) !important;
  }

  .metric-card small {
    font-size: calc(12px * var(--ui-scale, 1)) !important;
    color: #667085 !important;
    white-space: normal !important;
    word-break: break-word !important;
    line-height: 1.2 !important;
    display: block !important;
  }

  /* Call log items responsiveness on mobile */
  .call-log {
    padding: calc(6px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1)) !important;
    gap: calc(8px * var(--ui-scale, 1)) !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .call-log-main {
    min-width: 0 !important;
    flex: 1 !important;
    overflow: hidden !important;
  }

  .call-log-main strong {
    font-size: calc(12px * var(--ui-scale, 1)) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: block !important;
    max-width: 100% !important;
  }

  .call-log-main span {
    font-size: calc(12px * var(--ui-scale, 1)) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: block !important;
    max-width: 100% !important;
  }

  .log-right {
    font-size: calc(12px * var(--ui-scale, 1)) !important;
    flex: 0 0 auto !important;
  }

  /* Agent list items responsiveness */
  .agent-mini {
    padding: calc(6px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1)) !important;
    gap: calc(6px * var(--ui-scale, 1)) !important;
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: hidden !important;
  }

  .agent-mini > span:nth-child(2) {
    min-width: 0 !important;
    flex: 1 !important;
    overflow: hidden !important;
  }

  .agent-mini strong {
    font-size: calc(12px * var(--ui-scale, 1)) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: block !important;
  }

  .agent-mini small {
    font-size: calc(12px * var(--ui-scale, 1)) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: block !important;
  }

  /* Ticket filter bar scrollable on mobile */
  .ticket-filter-bar, .activity-filter-bar {
    display: flex !important;
    overflow-x: auto !important;
    white-space: nowrap !important;
    padding-bottom: calc(4px * var(--ui-scale, 1)) !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    gap: calc(6px * var(--ui-scale, 1)) !important;
  }

  .activity-filter-bar {
    flex-wrap: wrap !important;
    overflow-x: hidden !important;
  }

  .activity-log-search {
    flex: 1 0 100%;
    width: 100%;
    margin-top: calc(4px * var(--ui-scale, 1));
  }

  .ticket-filter-btn {
    flex: 0 0 auto !important;
    padding: calc(6px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1)) !important;
    font-size: calc(12px * var(--ui-scale, 1)) !important;
  }

  /* Customer table & lists responsive overflow */
  .customer-directory, .customer-row, .call-log-list, .search-card {
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }

  /* Dedicated E-post Mobile Responsiveness & Layout Fixes */
  .email-inbox-layout {
    grid-template-columns: 1fr !important;
    min-height: auto !important;
    width: 100% !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }

  .email-inbox-layout .thread-panel {
    border-right: 0 !important;
    border-bottom: calc(1px * var(--ui-scale, 1)) solid var(--line) !important;
    width: 100% !important;
  }

  .email-inbox-layout .thread-list {
    max-height: calc(180px * var(--ui-scale, 1)) !important;
  }

  #email-tab .conversation-panel {
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }

  #email-tab .conversation-head {
    padding: calc(12px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1)) !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: calc(10px * var(--ui-scale, 1)) !important;
  }

  #email-tab .conversation-head > div:first-child {
    width: 100% !important;
  }

  #email-tab .conversation-head h2 {
    font-size: calc(14px * var(--ui-scale, 1)) !important;
    word-break: break-word !important;
  }

  .ticket-controls {
    width: 100% !important;
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: calc(8px * var(--ui-scale, 1)) !important;
    margin-top: calc(6px * var(--ui-scale, 1)) !important;
    box-sizing: border-box !important;
  }

  .ticket-control-group {
    width: 100% !important;
    min-width: 0 !important;
  }

  .ticket-control-label {
    font-size: calc(12px * var(--ui-scale, 1)) !important;
  }

  .ticket-select {
    width: 100% !important;
    box-sizing: border-box !important;
    font-size: calc(12px * var(--ui-scale, 1)) !important;
    padding: calc(5px * var(--ui-scale, 1)) calc(6px * var(--ui-scale, 1)) !important;
  }

  .ticket-controls > .button, #btn-claim-ticket {
    grid-column: span 2 !important;
    width: 100% !important;
    justify-content: center !important;
    font-size: calc(12px * var(--ui-scale, 1)) !important;
    padding: calc(6px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1)) !important;
  }

  .email-recipient-bar {
    padding: calc(8px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)) !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .recipient-row {
    width: 100% !important;
    gap: calc(6px * var(--ui-scale, 1)) !important;
  }

  .recipient-row label {
    font-size: calc(12px * var(--ui-scale, 1)) !important;
    width: calc(32px * var(--ui-scale, 1)) !important;
    flex: 0 0 calc(32px * var(--ui-scale, 1)) !important;
  }

  .recipient-row input {
    flex: 1 !important;
    min-width: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
    font-size: calc(12px * var(--ui-scale, 1)) !important;
    padding: calc(6px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1)) !important;
  }

  #email-chat-history {
    padding: calc(12px * var(--ui-scale, 1)) !important;
    min-height: calc(240px * var(--ui-scale, 1)) !important;
    max-height: calc(340px * var(--ui-scale, 1)) !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  #email-chat-history .message-row {
    max-width: 88% !important;
  }

  #email-chat-history .message-bubble {
    padding: calc(9px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)) !important;
    font-size: calc(12px * var(--ui-scale, 1)) !important;
    word-break: break-word !important;
    line-height: 1.4 !important;
  }

  .ticket-compose-area {
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .email-composer {
    margin: calc(8px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)) !important;
    width: auto !important;
    box-sizing: border-box !important;
    border: calc(1px * var(--ui-scale, 1)) solid #ddd4c4 !important;
    border-radius: calc(12px * var(--ui-scale, 1)) !important;
  }

  .email-composer > input {
    padding: calc(8px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1)) !important;
    font-size: calc(12px * var(--ui-scale, 1)) !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .email-composer .composer {
    margin: 0 !important;
    padding: calc(4px * var(--ui-scale, 1)) calc(4px * var(--ui-scale, 1)) calc(4px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1)) !important;
    gap: calc(6px * var(--ui-scale, 1)) !important;
    width: 100% !important;
    box-sizing: border-box !important;
    border: 0 !important;
    border-top: calc(1px * var(--ui-scale, 1)) solid #e7eaf0 !important;
    border-radius: 0 !important;
  }

  .email-composer .composer input {
    font-size: calc(12px * var(--ui-scale, 1)) !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  .email-composer .composer .button {
    padding: calc(7px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1)) !important;
    font-size: calc(12px * var(--ui-scale, 1)) !important;
    flex: 0 0 auto !important;
  }
}

.edit-agent-phone-btn {
  background: none !important;
  border: none !important;
  cursor: pointer !important;
  font-size: calc(12px * var(--ui-scale, 1)) !important;
  opacity: 0.65 !important;
  padding: 0 calc(2px * var(--ui-scale, 1)) !important;
}
.edit-agent-phone-btn:hover {
  opacity: 1 !important;
}
.agent-phone-display {
  color: #8ad0c0 !important;
  font-size: calc(12px * var(--ui-scale, 1)) !important;
  cursor: pointer !important;
  font-weight: 600 !important;
}
.agent-phone-display:hover {
  text-decoration: underline !important;
}

/* Glassmorphic Ongoing Call Control Banner */
.active-call-control-banner {
  background: linear-gradient(135deg, #0a231f 0%, #1e2a25 100%) !important;
  border: calc(1px * var(--ui-scale, 1)) solid rgba(15, 138, 118, 0.4) !important;
  border-radius: calc(14px * var(--ui-scale, 1)) !important;
  padding: calc(14px * var(--ui-scale, 1)) calc(18px * var(--ui-scale, 1)) !important;
  margin-bottom: calc(20px * var(--ui-scale, 1)) !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  color: #fff !important;
  box-shadow: 0 calc(4px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1)) rgba(0, 0, 0, 0.15), 0 0 0 calc(1px * var(--ui-scale, 1)) rgba(15, 138, 118, 0.2) !important;
  gap: calc(16px * var(--ui-scale, 1)) !important;
  flex-wrap: wrap !important;
}

.call-banner-left {
  display: flex !important;
  align-items: center !important;
  gap: calc(14px * var(--ui-scale, 1)) !important;
}

.call-live-pulse {
  width: calc(12px * var(--ui-scale, 1)) !important;
  height: calc(12px * var(--ui-scale, 1)) !important;
  border-radius: 50% !important;
  background: #1f9a63 !important;
  box-shadow: 0 0 0 0 rgba(31, 154, 99, 0.7) !important;
  animation: pulseGreen 1.5s infinite !important;
}

@keyframes pulseGreen {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(31, 154, 99, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 calc(8px * var(--ui-scale, 1)) rgba(31, 154, 99, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(31, 154, 99, 0); }
}

.call-title-row {
  display: flex !important;
  align-items: center !important;
  gap: calc(10px * var(--ui-scale, 1)) !important;
}

.call-title-row strong {
  font-size: calc(15px * var(--ui-scale, 1)) !important;
  color: #f2f7f3 !important;
}

.call-timer-chip {
  background: #0f8a76 !important;
  color: #fff !important;
  font-family: monospace !important;
  font-size: calc(13px * var(--ui-scale, 1)) !important;
  font-weight: 700 !important;
  padding: calc(2px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1)) !important;
  border-radius: calc(10px * var(--ui-scale, 1)) !important;
  letter-spacing: calc(1px * var(--ui-scale, 1)) !important;
}

.call-agent-info {
  color: #64748b !important;
  font-size: calc(12px * var(--ui-scale, 1)) !important;
  margin-top: calc(3px * var(--ui-scale, 1)) !important;
  display: block !important;
}

.call-agent-info strong {
  color: #e4e7ec !important;
}

.status-badge-blue {
  background: rgba(15, 138, 118, 0.2) !important;
  color: #4fb3a0 !important;
  padding: calc(2px * var(--ui-scale, 1)) calc(6px * var(--ui-scale, 1)) !important;
  border-radius: calc(10px * var(--ui-scale, 1)) !important;
  font-size: calc(12px * var(--ui-scale, 1)) !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
}

.call-banner-right {
  display: flex !important;
  align-items: center !important;
  gap: calc(12px * var(--ui-scale, 1)) !important;
}

.transfer-control-group {
  display: flex !important;
  align-items: center !important;
  gap: calc(6px * var(--ui-scale, 1)) !important;
}

.transfer-select {
  background: #334155 !important;
  color: #f2f7f3 !important;
  border: calc(1px * var(--ui-scale, 1)) solid #64748b !important;
  font-size: calc(12px * var(--ui-scale, 1)) !important;
  padding: calc(6px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1)) !important;
  border-radius: calc(10px * var(--ui-scale, 1)) !important;
}

.btn-compact {
  padding: calc(6px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)) !important;
  font-size: calc(12px * var(--ui-scale, 1)) !important;
}

.btn-danger-call {
  background: #b03d3d !important;
  color: #ffffff !important;
  border: none !important;
  padding: calc(7px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1)) !important;
  font-size: calc(12.5px * var(--ui-scale, 1)) !important;
  font-weight: 700 !important;
  border-radius: calc(10px * var(--ui-scale, 1)) !important;
  cursor: pointer !important;
  transition: all 0.2s !important;
  box-shadow: 0 calc(2px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1)) rgba(176, 61, 61, 0.4) !important;
}

.btn-danger-call:hover {
  background: #9c2f2f !important;
  transform: translateY(calc(-1px * var(--ui-scale, 1))) !important;
}

/* Global live-call controls stay available on every page. */
#active-call-control-host {
  position: sticky;
  top: 0;
  z-index: 15;
}

.global-active-call-panel {
  margin: calc(12px * var(--ui-scale, 1)) calc(32px * var(--ui-scale, 1)) 0;
  padding: calc(11px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1));
  border: calc(1px * var(--ui-scale, 1)) solid rgba(15, 138, 118, .45);
  border-radius: calc(14px * var(--ui-scale, 1));
  background: linear-gradient(135deg, #0a231f, #1e2a25);
  box-shadow: 0 calc(8px * var(--ui-scale, 1)) calc(20px * var(--ui-scale, 1)) rgba(10, 35, 31, .18);
  color: #f2f7f3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(14px * var(--ui-scale, 1));
}

.global-call-summary,
.global-call-actions {
  display: flex;
  align-items: center;
  gap: calc(10px * var(--ui-scale, 1));
  min-width: 0;
}

.global-call-summary > div {
  display: grid;
  gap: calc(2px * var(--ui-scale, 1));
  min-width: 0;
}

.global-call-summary strong { font-size: calc(13px * var(--ui-scale, 1)); }
.global-call-summary span:not(.global-call-pulse) { color: #cfd8d2; font-size: calc(12px * var(--ui-scale, 1)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.global-call-summary .global-call-participants { color: #a7d5c7; }
.global-call-context, .global-call-recent { display: flex; flex-wrap: wrap; gap: calc(4px * var(--ui-scale, 1)) calc(6px * var(--ui-scale, 1)); min-width: 0; }
.global-call-summary .global-call-context-chip { color: #bfe8dd; background: rgba(15, 138, 118, .18); border: calc(1px * var(--ui-scale, 1)) solid rgba(167, 213, 199, .24); border-radius: calc(10px * var(--ui-scale, 1)); padding: calc(2px * var(--ui-scale, 1)) calc(5px * var(--ui-scale, 1)); font-size: calc(12px * var(--ui-scale, 1)); white-space: nowrap; }
.global-call-summary .global-call-recent span { color: #cfd8d2; background: rgba(10, 35, 31, .28); border-radius: calc(10px * var(--ui-scale, 1)); padding: calc(2px * var(--ui-scale, 1)) calc(5px * var(--ui-scale, 1)); font-size: calc(12px * var(--ui-scale, 1)); max-width: 100%; white-space: nowrap; }
.global-call-recent b { color: #a7d5c7; font-weight: 700; }
.global-call-summary .global-call-unknown { color: #d9a94d; font-size: calc(12px * var(--ui-scale, 1)); font-style: italic; }
.global-call-zisson { margin-top: calc(3px * var(--ui-scale, 1)); }
.sms-zisson-result { margin-top: calc(4px * var(--ui-scale, 1)); }

.zisson-lookup-line {
  font-size: calc(12px * var(--ui-scale, 1));
  opacity: .85;
}

.zisson-lookup-line.is-error { color: #e06666; opacity: 1; }

.zisson-lookup-chip {
  border: calc(1px * var(--ui-scale, 1)) solid currentColor;
  border-radius: calc(10px * var(--ui-scale, 1));
  padding: calc(1px * var(--ui-scale, 1)) calc(6px * var(--ui-scale, 1));
  font-size: calc(12px * var(--ui-scale, 1));
  white-space: nowrap;
  opacity: .9;
}

.zisson-lookup-chip b { font-weight: 600; }
.zisson-lookup-chip small { opacity: .7; margin-left: calc(3px * var(--ui-scale, 1)); }

/* Employee number from the contact card, written the way Zisson shows it. */
.zisson-lookup-ansatt {
  margin-left: calc(4px * var(--ui-scale, 1));
  padding: 0 calc(4px * var(--ui-scale, 1));
  border-radius: calc(6px * var(--ui-scale, 1));
  background: rgba(127, 127, 127, .18);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: calc(11px * var(--ui-scale, 1));
}

/* "＋ Lagre": opens RelayHub's contact form prefilled from the Zisson match. */
.zisson-lookup-save {
  margin-left: calc(5px * var(--ui-scale, 1));
  padding: 0 calc(4px * var(--ui-scale, 1));
  border: 0;
  border-radius: calc(6px * var(--ui-scale, 1));
  background: rgba(127, 127, 127, .22);
  color: inherit;
  font: inherit;
  font-size: calc(11px * var(--ui-scale, 1));
  cursor: pointer;
}

.zisson-lookup-save:hover { background: rgba(127, 127, 127, .34); }

.zisson-lookup-button {
  padding: calc(2px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1));
  font-size: calc(12px * var(--ui-scale, 1));
}
.global-call-pulse { width: calc(10px * var(--ui-scale, 1)); height: calc(10px * var(--ui-scale, 1)); flex: 0 0 calc(10px * var(--ui-scale, 1)); border-radius: 50%; background: #1f9a63; box-shadow: 0 0 0 0 rgba(31, 154, 99, .65); animation: pulseGreen 1.5s infinite; }
.global-call-timer { margin-left: calc(4px * var(--ui-scale, 1)); background: #0d6b5c; border-radius: calc(10px * var(--ui-scale, 1)); padding: calc(3px * var(--ui-scale, 1)) calc(7px * var(--ui-scale, 1)); font: 700 calc(13px * var(--ui-scale, 1)) ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: calc(.5px * var(--ui-scale, 1)); }
.global-call-actions .button { min-height: calc(34px * var(--ui-scale, 1)); white-space: nowrap; }
.global-call-mute.is-muted { color: #f9efe2; background: #94580a; border-color: #a3600e; }
.global-call-menu { position: relative; min-width: 0; }
.global-call-menu-trigger { width: 100%; min-height: calc(34px * var(--ui-scale, 1)); padding: calc(7px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1)); color: #f2f7f3; background: #334155; border: calc(1px * var(--ui-scale, 1)) solid #64748b; border-radius: calc(10px * var(--ui-scale, 1)); }
.global-call-menu-trigger:hover:not(:disabled), .global-call-menu-trigger[aria-expanded="true"] { background: #34473c; border-color: #8ad0c0; }
.global-call-menu-trigger:disabled { opacity: .62; cursor: not-allowed; }
.global-call-menu-trigger svg { width: calc(17px * var(--ui-scale, 1)); height: calc(17px * var(--ui-scale, 1)); fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.global-call-dropdown { position: absolute; z-index: 16; top: calc(100% + calc(7px * var(--ui-scale, 1))); right: 0; width: min(calc(250px * var(--ui-scale, 1)), calc(100vw - calc(48px * var(--ui-scale, 1)))); padding: calc(5px * var(--ui-scale, 1)); display: grid; gap: calc(3px * var(--ui-scale, 1)); background: #14251f; border: calc(1px * var(--ui-scale, 1)) solid #64748b; border-radius: calc(12px * var(--ui-scale, 1)); box-shadow: 0 calc(12px * var(--ui-scale, 1)) calc(26px * var(--ui-scale, 1)) rgba(10, 35, 31, .36); }
.global-call-dropdown[hidden] { display: none !important; }
.global-call-menu-item { width: 100%; border: 0; border-radius: calc(10px * var(--ui-scale, 1)); padding: calc(8px * var(--ui-scale, 1)) calc(9px * var(--ui-scale, 1)); color: #f2f7f3; background: transparent; text-align: left; font: 700 calc(12px * var(--ui-scale, 1)) var(--font); cursor: pointer; }
.global-call-menu-item:hover { background: #23382e; }
.global-call-menu-item small { display: block; margin-top: calc(2px * var(--ui-scale, 1)); color: #9db0a8; font: 600 calc(12px * var(--ui-scale, 1)) var(--font); }
.global-call-menu-item:disabled { cursor: not-allowed; }
.global-call-menu-item:disabled:hover { background: transparent; }
.global-call-emergency-option { color: #eec9c9; background: rgba(124, 45, 45, .18); border: calc(1px * var(--ui-scale, 1)) solid rgba(217, 138, 138, .28); opacity: .72; }
.global-call-emergency-option:disabled:hover { background: rgba(124, 45, 45, .18); }
.global-call-emergency-option small { color: #cfd8d2; }
.global-call-menu-empty { padding: calc(9px * var(--ui-scale, 1)); color: #9db0a8; font-size: calc(12px * var(--ui-scale, 1)); text-align: center; }

@media (max-width: 900px) {
  #active-call-control-host { top: 0; }
  .global-active-call-panel { margin: calc(8px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1)) 0; align-items: stretch; flex-direction: column; gap: calc(10px * var(--ui-scale, 1)); }
  .global-call-summary { width: 100%; }
  .global-call-actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr auto; }
  .global-call-menu { min-width: 0; }
}

@media (max-width: 480px) {
  .global-call-summary { flex-wrap: wrap; }
  .global-call-timer { margin-left: auto; }
  .global-call-actions { grid-template-columns: 1fr 1fr; }
  .global-call-hangup { grid-column: 1 / -1; }
  .global-call-summary .global-call-recent span { max-width: 100%; }
  .global-call-dropdown { right: auto; left: 0; width: min(calc(280px * var(--ui-scale, 1)), calc(100vw - calc(48px * var(--ui-scale, 1)))); }
}

/* Topbar Active Agent Selector */
.active-agent-select-wrapper {
  position: relative !important;
  display: inline-block !important;
}

.topbar-agent-native-select {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  opacity: 0 !important;
  cursor: pointer !important;
  z-index: 5 !important;
}

.user-menu {
  border: calc(1px * var(--ui-scale, 1)) solid #d0d5dd !important;
  background: #ffffff !important;
  padding: calc(6px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)) !important;
  border-radius: calc(12px * var(--ui-scale, 1)) !important;
  display: flex !important;
  align-items: center !important;
  gap: calc(10px * var(--ui-scale, 1)) !important;
  box-shadow: 0 calc(1px * var(--ui-scale, 1)) calc(3px * var(--ui-scale, 1)) rgba(15, 23, 42, 0.06) !important;
  transition: all 0.2s !important;
}

.user-menu:hover {
  background: #f8fafc !important;
  border-color: #0f8a76 !important;
}

.active-agent-info-wrap {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  text-align: left !important;
}

.active-agent-label {
  font-size: calc(12.5px * var(--ui-scale, 1)) !important;
  font-weight: 700 !important;
  color: #0a231f !important;
  line-height: 1.2 !important;
}

.active-agent-phone {
  font-size: calc(12px * var(--ui-scale, 1)) !important;
  font-weight: 600 !important;
  color: #0d6b5c !important;
  margin-top: calc(1px * var(--ui-scale, 1)) !important;
}

/* Authentication Login Overlay */
.auth-screen-backdrop {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: #0a231f !important;
  z-index: 99999 !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  padding: calc(20px * var(--ui-scale, 1)) !important;
  transition: opacity 0.3s ease !important;
}

.auth-screen-backdrop.hidden {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Modal Overlay Styling */
.modal-overlay {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(10, 35, 31, 0.75) !important;
  backdrop-filter: blur(calc(8px * var(--ui-scale, 1))) !important;
  z-index: 100000 !important;
  display: none !important;
  justify-content: center !important;
  align-items: center !important;
  padding: calc(20px * var(--ui-scale, 1)) !important;
}

.modal-overlay.active {
  display: flex !important;
}

.auth-card {
  width: 100% !important;
  max-width: calc(420px * var(--ui-scale, 1)) !important;
  background: #ffffff !important;
  border-radius: calc(16px * var(--ui-scale, 1)) !important;
  padding: calc(32px * var(--ui-scale, 1)) !important;
  box-shadow: 0 calc(20px * var(--ui-scale, 1)) calc(40px * var(--ui-scale, 1)) rgba(0, 0, 0, 0.25), 0 0 0 calc(1px * var(--ui-scale, 1)) rgba(255, 255, 255, 0.1) !important;
}

/* RelayHub entrance page */
.auth-screen-backdrop {
  min-height: 100dvh !important;
  height: 100dvh !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  padding: clamp(calc(20px * var(--ui-scale, 1)), 4vw, calc(56px * var(--ui-scale, 1))) !important;
  background:
    radial-gradient(circle at 9% 12%, rgba(13, 107, 92, 0.26), transparent 28rem),
    radial-gradient(circle at 84% 82%, rgba(47, 166, 120, 0.16), transparent 26rem),
    #0a1f18 !important;
}

.auth-landing-shell {
  width: min(calc(1100px * var(--ui-scale, 1)), 100%);
  min-height: min(calc(700px * var(--ui-scale, 1)), calc(100dvh - calc(40px * var(--ui-scale, 1))));
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(calc(360px * var(--ui-scale, 1)), 0.85fr);
  align-items: stretch;
  gap: clamp(calc(32px * var(--ui-scale, 1)), 7vw, calc(92px * var(--ui-scale, 1)));
}

.auth-landing-story {
  align-self: center;
  color: #f2f7f3;
  padding: clamp(calc(16px * var(--ui-scale, 1)), 3vw, calc(34px * var(--ui-scale, 1))) 0;
}

.auth-landing-brand {
  display: inline-flex;
  align-items: center;
  gap: calc(10px * var(--ui-scale, 1));
  color: #ffffff;
  font-size: calc(25px * var(--ui-scale, 1));
  font-weight: 800;
  letter-spacing: -0.04em;
}

.auth-landing-brand .brand-mark {
  width: calc(27px * var(--ui-scale, 1));
  height: calc(27px * var(--ui-scale, 1));
}

.auth-landing-eyebrow {
  margin: calc(70px * var(--ui-scale, 1)) 0 calc(13px * var(--ui-scale, 1));
  color: #9ccfbf;
  font-size: calc(12px * var(--ui-scale, 1));
  font-weight: 800;
  letter-spacing: 0.18em;
}

.auth-landing-story h1 {
  max-width: calc(620px * var(--ui-scale, 1));
  margin: 0;
  color: #ffffff;
  font-family: "Manrope", sans-serif;
  font-size: clamp(calc(44px * var(--ui-scale, 1)), 6.3vw, calc(76px * var(--ui-scale, 1)));
  font-weight: 800;
  line-height: 0.98;
  letter-spacing: -0.065em;
}

.auth-landing-story h1 span {
  color: #9ccfbf;
}

.auth-landing-intro {
  max-width: calc(540px * var(--ui-scale, 1));
  margin: calc(23px * var(--ui-scale, 1)) 0 calc(32px * var(--ui-scale, 1));
  color: #b3c0b8;
  font-size: calc(18px * var(--ui-scale, 1));
  line-height: 1.55;
}

.auth-landing-benefits {
  display: grid;
  gap: calc(12px * var(--ui-scale, 1));
  max-width: calc(500px * var(--ui-scale, 1));
  margin: 0;
  padding: 0;
  list-style: none;
}

.auth-landing-benefits li {
  display: flex;
  align-items: center;
  gap: calc(14px * var(--ui-scale, 1));
  min-height: calc(61px * var(--ui-scale, 1));
  padding: calc(11px * var(--ui-scale, 1)) calc(15px * var(--ui-scale, 1));
  border: calc(1px * var(--ui-scale, 1)) solid rgba(170, 205, 193, 0.16);
  border-radius: calc(14px * var(--ui-scale, 1));
  background: rgba(20, 45, 38, 0.62);
}

.auth-benefit-icon {
  display: inline-grid;
  flex: 0 0 calc(31px * var(--ui-scale, 1));
  width: calc(31px * var(--ui-scale, 1));
  height: calc(31px * var(--ui-scale, 1));
  place-items: center;
  border-radius: calc(12px * var(--ui-scale, 1));
  background: rgba(27, 138, 118, 0.2);
  color: #b4d9cc;
  font-family: "DM Sans", sans-serif;
  font-size: calc(21px * var(--ui-scale, 1));
  font-weight: 700;
}

.auth-landing-benefits strong,
.auth-landing-benefits small {
  display: block;
}

.auth-landing-benefits strong {
  color: #f2f7f3;
  font-size: calc(14px * var(--ui-scale, 1));
  line-height: 1.3;
}

.auth-landing-benefits small {
  margin-top: calc(2px * var(--ui-scale, 1));
  color: #9dafaa;
  font-size: calc(12px * var(--ui-scale, 1));
  line-height: 1.35;
}

.auth-landing-security {
  margin: calc(26px * var(--ui-scale, 1)) 0 0;
  color: #88978e;
  font-size: calc(12px * var(--ui-scale, 1));
  font-weight: 600;
}

.auth-landing-security::before {
  content: "✓";
  display: inline-grid;
  width: calc(17px * var(--ui-scale, 1));
  height: calc(17px * var(--ui-scale, 1));
  margin-right: calc(8px * var(--ui-scale, 1));
  place-items: center;
  border: calc(1px * var(--ui-scale, 1)) solid rgba(139, 183, 255, 0.45);
  border-radius: 50%;
  color: #b4d9cc;
  font-size: calc(12px * var(--ui-scale, 1));
}

.auth-card.auth-login-card {
  align-self: center;
  transform: translateY(clamp(calc(12px * var(--ui-scale, 1)), 2vh, calc(24px * var(--ui-scale, 1))));
  max-width: calc(440px * var(--ui-scale, 1)) !important;
  padding: calc(34px * var(--ui-scale, 1)) !important;
  border: calc(1px * var(--ui-scale, 1)) solid rgba(255, 255, 255, 0.62);
  box-shadow: 0 calc(28px * var(--ui-scale, 1)) calc(64px * var(--ui-scale, 1)) rgba(0, 0, 0, 0.34), 0 0 0 calc(1px * var(--ui-scale, 1)) rgba(20, 45, 38, 0.08) !important;
}

@media (max-width: 800px) {
  .auth-screen-backdrop {
    align-items: flex-start !important;
    padding: calc(24px * var(--ui-scale, 1)) calc(18px * var(--ui-scale, 1)) !important;
  }

  .auth-landing-shell {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 0;
  }

  .auth-landing-story {
    display: contents;
  }

  .auth-landing-brand {
    order: 1;
    margin: calc(4px * var(--ui-scale, 1)) calc(2px * var(--ui-scale, 1)) 0;
  }

  .auth-landing-eyebrow {
    order: 2;
    margin: calc(38px * var(--ui-scale, 1)) calc(2px * var(--ui-scale, 1)) calc(13px * var(--ui-scale, 1));
  }

  .auth-landing-story h1 {
    order: 3;
    margin: 0 calc(2px * var(--ui-scale, 1));
    font-size: clamp(calc(42px * var(--ui-scale, 1)), 13vw, calc(62px * var(--ui-scale, 1)));
  }

  .auth-card.auth-login-card {
    order: 5;
    margin: calc(26px * var(--ui-scale, 1)) 0 calc(28px * var(--ui-scale, 1));
  }

  .auth-landing-intro {
    order: 4;
    margin: calc(16px * var(--ui-scale, 1)) calc(2px * var(--ui-scale, 1)) 0;
    font-size: calc(16px * var(--ui-scale, 1));
  }

  .auth-landing-benefits {
    order: 6;
    gap: calc(8px * var(--ui-scale, 1));
    margin: 0 calc(2px * var(--ui-scale, 1));
  }

  .auth-landing-benefits li {
    min-height: calc(53px * var(--ui-scale, 1));
    padding: calc(9px * var(--ui-scale, 1)) calc(11px * var(--ui-scale, 1));
  }

  .auth-landing-security {
    order: 7;
    margin: calc(19px * var(--ui-scale, 1)) calc(2px * var(--ui-scale, 1)) 0;
  }

  .auth-card.auth-login-card {
    max-width: none !important;
    padding: calc(26px * var(--ui-scale, 1)) calc(22px * var(--ui-scale, 1)) !important;
    transform: none;
  }
}

.microsoft-sso-button {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: calc(12px * var(--ui-scale, 1)) !important;
  background: #2f2f2f !important;
  color: #ffffff !important;
  font-weight: 600 !important;
  font-size: calc(14px * var(--ui-scale, 1)) !important;
  padding: calc(12px * var(--ui-scale, 1)) calc(18px * var(--ui-scale, 1)) !important;
  border-radius: calc(12px * var(--ui-scale, 1)) !important;
  border: calc(1px * var(--ui-scale, 1)) solid #1f1f1f !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  width: 100% !important;
}

.microsoft-sso-button:hover {
  background: #000000 !important;
  transform: translateY(calc(-1px * var(--ui-scale, 1))) !important;
  box-shadow: 0 calc(4px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)) rgba(0, 0, 0, 0.15) !important;
}

/* Email controls: keep deletion aligned with Status and Agent selectors. */
#email-tab .ticket-controls {
  align-items: flex-end;
}

#email-tab #btn-delete-email {
  align-self: flex-end;
  height: calc(28px * var(--ui-scale, 1));
  margin: 0;
  padding: 0 calc(10px * var(--ui-scale, 1)) !important;
  white-space: nowrap;
}

/* Queue profile reflects the selected agent's line status. */
#queue-card-wrapper.status-btn-green {
  background: linear-gradient(135deg, #15714e, #186046) !important;
  border-color: #54c98f !important;
}

#queue-card-wrapper.status-btn-light-orange {
  background: linear-gradient(135deg, #cd7f3a, #c1621a) !important;
  border-color: #e2b183 !important;
}

#queue-card-wrapper.status-btn-purple {
  background: linear-gradient(135deg, #8a5fa0, #6d4382) !important;
  border-color: #cbb3da !important;
}

#queue-card-wrapper.status-btn-gray {
  background: #17352e !important;
  border-color: #1f4239 !important;
}

#queue-card-wrapper.status-btn-green:hover {
  background: linear-gradient(135deg, #178a5a, #15714e) !important;
  border-color: #a5e0bd !important;
}

#queue-card-wrapper.status-btn-light-orange:hover {
  background: linear-gradient(135deg, #e2b183, #cd7f3a) !important;
  border-color: #ecd5b8 !important;
}

#queue-card-wrapper.status-btn-purple:hover {
  background: linear-gradient(135deg, #ab84c4, #7a4f8f) !important;
  border-color: #e6d9ee !important;
}

#queue-card-wrapper.status-btn-green .queue-btn-icon,
#queue-card-wrapper.status-btn-light-orange .queue-btn-icon,
#queue-card-wrapper.status-btn-purple .queue-btn-icon {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

#queue-card-wrapper.status-btn-green .queue-btn-text,
#queue-card-wrapper.status-btn-light-orange .queue-btn-text,
#queue-card-wrapper.status-btn-purple .queue-btn-text,
#queue-card-wrapper.status-btn-green .queue-btn-text small,
#queue-card-wrapper.status-btn-light-orange .queue-btn-text small,
#queue-card-wrapper.status-btn-purple .queue-btn-text small {
  color: #fff;
}

/* On desktop, the search is centered in the space between the menu and active agent. */
@media (min-width: 901px) {
  .topbar {
    position: sticky !important;
    justify-content: flex-end;
  }

  .topbar .global-search-wrap {
    position: absolute !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
  }

  .topbar .topbar-actions {
    margin-left: auto;
    position: relative;
    z-index: 1;
  }
}

/* The active-agent field lives above Sentralbord in the right rail. */
.utility-agent-select {
  width: 100%;
  margin-bottom: calc(14px * var(--ui-scale, 1));
}

.utility-agent-select .active-agent-select-wrapper {
  display: block !important;
  width: 100%;
}

.utility-agent-select .user-menu {
  width: 100%;
}

.utility-agent-select .active-agent-phone {
  width: auto !important;
  padding: 0 !important;
  border: 0 !important;
  color: #64748b !important;
  background: transparent !important;
  font-size: calc(12px * var(--ui-scale, 1)) !important;
}

/* Kø Profil: a larger, centered status summary with state-specific contrast. */
#queue-card-wrapper .queue-accordion-btn {
  min-height: calc(104px * var(--ui-scale, 1));
  position: relative;
  justify-content: center;
  text-align: center;
  padding: calc(9px * var(--ui-scale, 1)) calc(44px * var(--ui-scale, 1)) !important;
}

#queue-card-wrapper .queue-btn-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  align-self: stretch;
  justify-content: flex-start;
  text-align: center;
}

#queue-card-wrapper .queue-btn-text strong {
  font-size: calc(17px * var(--ui-scale, 1)) !important;
  line-height: 1.2;
}

#queue-card-wrapper .status-lines-sub {
  font-size: calc(14px * var(--ui-scale, 1)) !important;
  line-height: 1.3;
  text-align: center !important;
}

#queue-card-wrapper .status-timer-sub {
  font-size: calc(14px * var(--ui-scale, 1)) !important;
  line-height: 1.35;
  margin-top: auto;
  padding-top: calc(10px * var(--ui-scale, 1));
  text-align: center !important;
}

#queue-card-wrapper #status-timer-text {
  font-size: inherit;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

#queue-card-wrapper .queue-btn-icon {
  position: absolute;
  left: calc(12px * var(--ui-scale, 1));
  top: 50%;
  transform: translateY(-50%);
}

#queue-card-wrapper .queue-chevron {
  position: absolute;
  right: calc(14px * var(--ui-scale, 1));
  top: 50%;
  transform: translateY(-50%);
}

#queue-card-wrapper.status-btn-green .queue-btn-text,
#queue-card-wrapper.status-btn-green .queue-btn-text small,
#queue-card-wrapper.status-btn-green .queue-btn-icon,
#queue-card-wrapper.status-btn-green .queue-chevron {
  color: #bfe8dd !important;
}

#queue-card-wrapper.status-btn-light-orange .queue-btn-text,
#queue-card-wrapper.status-btn-light-orange .queue-btn-text small,
#queue-card-wrapper.status-btn-light-orange .queue-btn-icon,
#queue-card-wrapper.status-btn-light-orange .queue-chevron {
  color: #202b26 !important;
}

#queue-card-wrapper.status-btn-light-orange .queue-btn-icon {
  background: rgba(255, 255, 255, 0.45) !important;
}

/* The subject gets a full row; garage and controls sit directly beneath it. */
#email-tab .email-conversation-head {
  display: block;
}

#email-tab .email-heading-content {
  min-width: 0;
}

#email-tab .email-heading-content > h2 {
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#email-tab .email-heading-actions-row {
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: calc(12px * var(--ui-scale, 1));
  margin-top: calc(12px * var(--ui-scale, 1));
}

#email-tab .email-context-labels {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: calc(12px * var(--ui-scale, 1));
  padding-bottom: calc(1px * var(--ui-scale, 1));
}

#email-tab .ticket-controls {
  flex: 0 1 auto;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: flex-end;
}

#email-tab #btn-claim-ticket {
  min-height: calc(28px * var(--ui-scale, 1));
  height: calc(28px * var(--ui-scale, 1));
  padding: 0 calc(10px * var(--ui-scale, 1)) !important;
  white-space: nowrap;
  font-size: calc(12px * var(--ui-scale, 1));
}

/* Conversation shortcuts stay on the same left-aligned row as the depot. */
.conversation-contact-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: calc(8px * var(--ui-scale, 1));
}

.button-contact-action,
#email-tab .ticket-controls > .button-contact-action {
  min-height: calc(28px * var(--ui-scale, 1));
  height: calc(28px * var(--ui-scale, 1));
  padding: 0 calc(10px * var(--ui-scale, 1)) !important;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#email-tab .ticket-controls > .button-contact-action {
  align-self: flex-end;
  font-size: calc(12px * var(--ui-scale, 1));
}

.sms-conversation-head {
  align-items: flex-start;
  gap: calc(12px * var(--ui-scale, 1));
}

.sms-conversation-head .conversation-contact-actions {
  margin-left: auto;
}

.direct-call-search-card .customer-initial {
  background: #e9f4f1;
  color: #0d6b5c;
}

.direct-call-search-card .small-action {
  color: #fff;
  background: #0d6b5c;
  border-color: #0d6b5c;
}

.direct-call-search-card .small-action:hover {
  background: #0a5a4d;
}

/* Center the company contact card and the selected-agent control. */
.utility-rail .service-card {
  text-align: center;
  position: relative;
  background: #17352e;
  border-color: #1f4239;
  border-radius: calc(12px * var(--ui-scale, 1));
}

.utility-rail .service-card strong,
.utility-rail .service-card p {
  display: block;
  color: #9db0a8;
}

.utility-rail .service-card strong {
  color: #bfe8dd;
}

.utility-rail .service-card-heading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(28px * var(--ui-scale, 1));
  margin-bottom: calc(5px * var(--ui-scale, 1));
}

.utility-rail .service-card-heading .service-icon {
  width: calc(28px * var(--ui-scale, 1));
  height: calc(28px * var(--ui-scale, 1));
  border-radius: calc(12px * var(--ui-scale, 1));
  color: #8ad0c0;
  background: rgba(18, 128, 109, 0.15);
  position: absolute;
  left: calc(12px * var(--ui-scale, 1));
  top: 50%;
  transform: translateY(-50%);
}

.utility-rail .service-card-heading h2 {
  margin: 0;
  color: #fff;
}

.utility-agent-select .user-menu,
.utility-agent-select .active-agent-info-wrap {
  justify-content: center;
  text-align: center;
}

.utility-agent-select .user-menu {
  position: relative;
}

.utility-agent-select .active-agent-info-wrap {
  flex: 1;
  align-items: center;
}

.utility-agent-select .user-menu > .chevron {
  position: absolute;
  right: calc(12px * var(--ui-scale, 1));
}

/* Kø Profil selects lines; the current status and timer have their own thin card. */
#queue-card-wrapper .queue-accordion-btn {
  min-height: calc(52px * var(--ui-scale, 1));
  padding: calc(5px * var(--ui-scale, 1)) calc(44px * var(--ui-scale, 1)) !important;
}

#queue-card-wrapper .queue-btn-text {
  justify-content: center;
}

.queue-timer-card {
  width: 100%;
  min-height: unset;
  margin-top: calc(7px * var(--ui-scale, 1));
  padding: calc(3px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1));
  border: calc(1px * var(--ui-scale, 1)) solid rgba(255, 255, 255, 0.12);
  border-radius: calc(6px * var(--ui-scale, 1));
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: rgba(0, 0, 0, 0.2) !important;
}

.queue-timer-card[hidden] {
  display: none !important;
}

.queue-timer-card .status-timer-sub {
  margin: 0;
  padding: 0;
  font-size: calc(11.5px * var(--ui-scale, 1)) !important;
  font-weight: 600;
  line-height: 1.25;
}

.queue-timer-card #status-timer-text {
  font-size: inherit;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

#queue-timer-card.status-btn-green,
#queue-timer-card.status-btn-light-orange,
#queue-timer-card.status-btn-purple,
#queue-timer-card.status-btn-gray {
  background: rgba(0, 0, 0, 0.2) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  color: #fff !important;
}

#queue-timer-card .status-timer-sub,
#queue-timer-card .status-timer-sub span {
  color: inherit !important;
}

@media (max-width: 900px) {
  #email-tab .email-heading-content > h2 {
    white-space: normal;
  }

  #email-tab .email-heading-actions-row {
    align-items: stretch;
    flex-direction: column;
  }

  .sms-conversation-head .conversation-contact-actions {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }
}

@media (max-width: 900px) {
  .topbar .global-search-wrap {
    position: relative !important;
    left: auto !important;
    transform: none !important;
  }

  .topbar .topbar-actions {
    margin-left: 0;
  }
}
/* Email bodies are normalized to readable text while preserving paragraph breaks. */
.email-body-text {
  white-space: pre-wrap;
}
#btn-enable-notifications.notification-enabled {
  color: var(--green);
  border-color: #b0e0c4;
  background: var(--green-soft);
}
.notification-toggle {
  width: calc(36px * var(--ui-scale, 1));
  height: calc(35px * var(--ui-scale, 1));
  padding: 0 !important;
  font-size: calc(17px * var(--ui-scale, 1)) !important;
}
.notification-toggle.notification-disabled {
  color: #667085;
  background: #f8fafc;
}

.notification-permission-modal {
  max-width: calc(430px * var(--ui-scale, 1));
}

.notification-permission-icon {
  width: calc(52px * var(--ui-scale, 1));
  height: calc(52px * var(--ui-scale, 1));
  display: grid;
  place-items: center;
  margin-bottom: calc(14px * var(--ui-scale, 1));
  border: calc(1px * var(--ui-scale, 1)) solid #c9e6dd;
  border-radius: calc(16px * var(--ui-scale, 1));
  color: #0a5a4d;
  background: #ecf5f1;
  font-size: calc(24px * var(--ui-scale, 1));
}

.mobile-operation-controls {
  display: none;
}

.mobile-sentralbord-slot {
  display: none;
}

.mobile-sms-list-button {
  display: inline-flex;
  flex: 0 0 auto;
  margin: 0 calc(12px * var(--ui-scale, 1)) 0 0;
}

.sms-composer-actions {
  display: contents;
}

@media (max-width: 900px) {
  /* Mobile overview focuses on the live call feed rather than summary cards. */
  #dashboard-tab .metric-grid {
    display: none;
  }

  .content-scroll.mobile-scroll-locked {
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  /* Keep the dashboard inside the mobile viewport; only the call log scrolls. */
  #dashboard-tab.active {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    height: auto;
    min-height: 0;
    overflow: hidden;
    gap: calc(12px * var(--ui-scale, 1));
  }

  #dashboard-tab .page-heading {
    flex: 0 0 auto;
    margin: 0;
  }

  #dashboard-tab .dashboard-grid {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
  }

  #dashboard-tab .activity-card {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    height: 100%;
    max-height: none;
    overflow: hidden;
  }

  #dashboard-tab .call-log-list {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  /* Ansatte uses the same fixed frame: only the directory or detail scrolls. */
  #customers-tab.active {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    height: auto;
    min-height: 0;
    overflow: hidden;
    gap: calc(12px * var(--ui-scale, 1));
  }

  #customers-tab .page-heading {
    flex: 0 0 auto;
    margin: 0;
  }

  #customers-tab #customer-directory-card {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
  }

  /* The directory must truly disappear while a contact detail is open. */
  #customers-tab #customer-directory-card.hidden {
    display: none !important;
  }

  #customers-tab .customer-directory,
  #customers-tab #customer-detail-view-container:not(.hidden) {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .sidebar.mobile-open {
    display: flex !important;
    flex-direction: column !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    overflow-y: hidden !important;
    box-sizing: border-box !important;
    padding: calc(10px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1)) !important;
    gap: calc(3px * var(--ui-scale, 1)) !important;
  }

  .sidebar.mobile-open #agents-list {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    scrollbar-width: thin !important;
  }

  .mobile-operation-controls {
    display: flex !important;
    flex-direction: column !important;
    gap: calc(3px * var(--ui-scale, 1)) !important;
    margin: 0 !important;
    padding-bottom: calc(4px * var(--ui-scale, 1)) !important;
    border-bottom: calc(1px * var(--ui-scale, 1)) solid rgba(255, 255, 255, 0.1) !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  .mobile-operation-controls .utility-agent-select,
  .mobile-operation-controls .agent-controls-rail-section,
  .mobile-sentralbord-slot,
  .mobile-sentralbord-slot .service-card {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .mobile-operation-controls .utility-agent-select {
    margin: 0;
  }

  .mobile-operation-controls .utility-agent-select .user-menu,
  .mobile-operation-controls .active-agent-select-wrapper,
  .mobile-operation-controls #queue-card-wrapper,
  .mobile-operation-controls .queue-profile-accordion {
    width: 100%;
    min-width: 0;
  }

  .mobile-operation-controls .agent-controls-rail-section {
    padding: 0 !important;
  }

  .mobile-operation-controls #queue-agent-actions {
    margin-bottom: 0;
  }

  .mobile-sentralbord-slot {
    display: block !important;
    margin: 0 !important;
    padding-top: 0 !important;
  }

  .sidebar.mobile-open .sidebar-footer {
    margin-top: calc(8px * var(--ui-scale, 1));
  }

  /* On mobile, open one SMS conversation at a time. */
  #sms-tab.active {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    gap: calc(12px * var(--ui-scale, 1));
  }

  #sms-tab .inbox-layout {
    display: block;
    flex: 1 1 auto;
    min-height: 0;
  }

  #sms-tab .thread-panel,
  #sms-tab .conversation-panel {
    height: 100%;
    min-height: 0;
  }

  #sms-tab .thread-panel {
    display: flex;
    flex-direction: column;
  }

  #sms-tab .inbox-layout.mobile-sms-thread-open .thread-panel {
    display: none;
  }

  #sms-tab .inbox-layout:not(.mobile-sms-thread-open) .conversation-panel {
    display: none;
  }

  #sms-tab .thread-list,
  #sms-tab .message-history {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
  }

  .mobile-sms-list-button {
    display: inline-flex;
    margin-bottom: calc(10px * var(--ui-scale, 1));
  }

  .sms-conversation-head {
    display: block;
    flex: 0 0 auto;
  }

  .sms-composer {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: calc(10px * var(--ui-scale, 1));
    padding: calc(10px * var(--ui-scale, 1));
    flex: 0 0 auto;
  }

  .sms-composer-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: calc(8px * var(--ui-scale, 1));
  }

  .sms-composer-actions .button,
  .sms-composer-actions .send-action-wrap {
    width: 100%;
  }

  .sms-composer-actions .send-action-wrap {
    display: flex;
  }

  .sms-composer input {
    min-height: calc(42px * var(--ui-scale, 1));
    padding: 0 calc(4px * var(--ui-scale, 1));
  }
}

@media (max-width: 900px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  .app-shell,
  .main-content {
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  .main-content {
    display: flex;
    flex-direction: column;
  }

  .content-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  /* E-post follows the same list-first mobile flow as SMS. */
  #email-tab.active {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    gap: calc(12px * var(--ui-scale, 1));
  }

  #email-tab .email-inbox-layout {
    display: block;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
  }

  #email-tab .thread-panel,
  #email-tab .conversation-panel {
    height: 100%;
    min-height: 0;
    width: 100%;
    max-width: 100%;
  }

  #email-tab .thread-panel {
    display: flex;
    flex-direction: column;
  }

  #email-tab .email-inbox-layout.mobile-email-thread-open .thread-panel {
    display: none;
  }

  #email-tab .email-inbox-layout:not(.mobile-email-thread-open) .conversation-panel {
    display: none;
  }

  #email-tab .thread-list,
  #email-tab #email-chat-history {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none !important;
  }

  .mobile-email-list-button {
    display: inline-flex;
    margin-bottom: calc(10px * var(--ui-scale, 1));
  }

  #email-tab .email-conversation-head {
    display: block;
    flex: 0 0 auto;
    overflow-x: hidden;
  }

  #email-tab .email-heading-content,
  #email-tab .email-heading-actions-row,
  #email-tab .ticket-controls,
  #email-tab .email-recipient-bar,
  #email-tab .ticket-compose-area,
  #email-tab .email-composer {
    max-width: 100%;
    min-width: 0;
  }

  #email-tab .email-composer .composer {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    padding: calc(8px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1)) !important;
    gap: calc(9px * var(--ui-scale, 1));
  }

  #email-tab .email-composer .composer > input {
    order: 2;
    flex: 1 1 100%;
    min-height: calc(40px * var(--ui-scale, 1));
  }

  #email-tab .email-composer .composer > div[style] {
    order: 1;
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: calc(7px * var(--ui-scale, 1)) !important;
    width: 100%;
    min-width: 0;
  }

  #email-tab .email-composer .composer > div[style] > *,
  #email-tab .email-composer .composer > div[style] .button,
  #email-tab .email-composer .composer > div[style] .send-action-wrap {
    width: 100%;
    min-width: 0;
  }
}

.mobile-email-list-button {
  display: none;
}

@media (max-width: 900px) {
  .mobile-email-list-button {
    display: inline-flex;
  }
}

@media (max-width: 900px) {
  /* Keep the company contact card visually identical to the inactive Kø Profil card. */
  .mobile-sentralbord-slot #sentralbord-card {
    background: #17352e !important;
    border-color: #1f4239 !important;
  }

  .mobile-sentralbord-slot #sentralbord-card .service-card-heading h2 {
    color: #e4e7ec;
  }

  .mobile-sentralbord-slot #sentralbord-card strong {
    color: #e4e7ec;
  }

  .mobile-sentralbord-slot #sentralbord-card p {
    color: #8ea79e;
  }

  .mobile-sentralbord-slot #sentralbord-card .service-icon {
    color: #8ad0c0;
    background: rgba(18, 128, 109, 0.15);
  }

  /* Match the mobile navigation label size, including Oversikt. */
  #queue-card-wrapper .queue-btn-text strong {
    font: 600 calc(14px * var(--ui-scale, 1)) var(--font) !important;
  }
}

/* Thin request indicator placed directly under the Send button. */
.send-action-wrap {
  position: relative;
  display: inline-flex;
  padding-bottom: calc(4px * var(--ui-scale, 1));
}

.send-progress {
  position: absolute;
  right: calc(2px * var(--ui-scale, 1));
  bottom: 0;
  left: calc(2px * var(--ui-scale, 1));
  height: calc(2px * var(--ui-scale, 1));
  overflow: hidden;
  border-radius: calc(99px * var(--ui-scale, 1));
  background: rgba(13, 107, 92, .15);
  opacity: 0;
  transition: opacity .16s ease;
}

.send-progress > span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  transition: width .12s linear;
}

.send-action-wrap.is-sending .send-progress {
  opacity: 1;
}

.send-action-wrap.is-sending .button {
  cursor: wait;
  opacity: .88;
}

/* Align Sentralbord with the Kø Profil card in the right rail. */
.utility-rail .service-card-heading {
  position: relative;
}

.utility-rail .service-card-heading h2 {
  font: 600 calc(17px * var(--ui-scale, 1)) var(--font) !important;
  letter-spacing: 0;
}

.utility-rail .service-card-heading .service-icon {
  left: calc(12px * var(--ui-scale, 1));
  top: 50%;
  width: calc(32px * var(--ui-scale, 1));
  height: calc(32px * var(--ui-scale, 1));
  border-radius: calc(12px * var(--ui-scale, 1));
  color: #0d6b5c;
  background: #d9ede7;
}

.agent-controls-rail-section {
  padding-top: calc(8px * var(--ui-scale, 1)) !important;
}

/* Personal message templates for SMS and email. */
.template-picker {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
}

.template-trigger {
  white-space: nowrap;
}

.template-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + calc(8px * var(--ui-scale, 1)));
  width: min(calc(310px * var(--ui-scale, 1)), calc(100vw - calc(40px * var(--ui-scale, 1))));
  max-height: calc(320px * var(--ui-scale, 1));
  overflow-y: auto;
  padding: calc(7px * var(--ui-scale, 1));
  border: calc(1px * var(--ui-scale, 1)) solid #d8d2c3;
  border-radius: calc(12px * var(--ui-scale, 1));
  background: #fff;
  box-shadow: 0 calc(14px * var(--ui-scale, 1)) calc(34px * var(--ui-scale, 1)) rgba(15, 23, 42, .18);
  z-index: 35;
}

.template-menu-list {
  display: grid;
  gap: calc(3px * var(--ui-scale, 1));
}

.template-menu-item {
  display: flex;
  align-items: stretch;
  gap: calc(4px * var(--ui-scale, 1));
}

.template-insert-button {
  min-width: 0;
  flex: 1;
  padding: calc(8px * var(--ui-scale, 1)) calc(9px * var(--ui-scale, 1));
  border: 0;
  border-radius: calc(12px * var(--ui-scale, 1));
  background: transparent;
  color: #344054;
  cursor: pointer;
  text-align: left;
}

.template-insert-button:hover {
  background: #ecf5f1;
}

.template-insert-button strong,
.template-insert-button small {
  display: block;
}

.template-insert-button strong {
  font: 700 calc(12px * var(--ui-scale, 1)) var(--font);
}

.template-insert-button small {
  margin-top: calc(2px * var(--ui-scale, 1));
  overflow: hidden;
  color: #667085;
  font-size: calc(12px * var(--ui-scale, 1));
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-delete-button {
  width: calc(28px * var(--ui-scale, 1));
  border: 0;
  border-radius: calc(12px * var(--ui-scale, 1));
  background: transparent;
  color: #667085;
  cursor: pointer;
  font-size: calc(18px * var(--ui-scale, 1));
}

.template-delete-button:hover {
  color: #9c2f2f;
  background: #fbeded;
}

.template-menu-empty {
  margin: calc(5px * var(--ui-scale, 1)) calc(4px * var(--ui-scale, 1)) calc(9px * var(--ui-scale, 1));
  color: #667085;
  font-size: calc(12px * var(--ui-scale, 1));
  text-align: center;
}

.template-add-button {
  width: 100%;
  margin-top: calc(5px * var(--ui-scale, 1));
  padding: calc(8px * var(--ui-scale, 1));
  border: calc(1px * var(--ui-scale, 1)) dashed #b6c1b8;
  border-radius: calc(12px * var(--ui-scale, 1));
  background: #f8fafc;
  color: #0d6b5c;
  cursor: pointer;
  font: 700 calc(12px * var(--ui-scale, 1)) var(--font);
}

.template-add-button:hover {
  background: #e9f4f1;
  border-color: #8ad0c0;
}

.message-template-modal {
  max-width: calc(470px * var(--ui-scale, 1));
}

.message-template-form {
  display: grid;
  gap: calc(13px * var(--ui-scale, 1));
}

.message-template-form label {
  display: grid;
  gap: calc(5px * var(--ui-scale, 1));
  color: #475467;
  font-size: calc(12px * var(--ui-scale, 1));
  font-weight: 700;
}

.message-template-form input,
.message-template-form textarea {
  width: 100%;
  border: calc(1px * var(--ui-scale, 1)) solid #cbd5e1;
  border-radius: calc(12px * var(--ui-scale, 1));
  color: var(--ink);
  font: inherit;
  outline-color: var(--blue);
  padding: calc(10px * var(--ui-scale, 1)) calc(11px * var(--ui-scale, 1));
}

.message-template-form textarea {
  min-height: calc(130px * var(--ui-scale, 1));
  resize: vertical;
}

@media (max-width: 600px) {
  .template-trigger {
    padding: calc(8px * var(--ui-scale, 1)) calc(9px * var(--ui-scale, 1)) !important;
  }

  /* Open template menus into the mobile viewport, never past its left edge. */
  .template-menu {
    right: auto;
    left: 0;
    width: min(calc(310px * var(--ui-scale, 1)), calc(100vw - calc(24px * var(--ui-scale, 1))));
    max-height: min(calc(320px * var(--ui-scale, 1)), 45dvh);
  }
}

/* Desktop workspace: fixed side rails and header, scrollable central content. */
@media (min-width: 901px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  .app-shell {
    height: 100vh;
    min-height: 0;
  }

  .sidebar,
  .utility-rail {
    height: 100vh;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .main-content {
    height: 100vh;
    min-height: 0;
    overflow: hidden;
  }

  .topbar {
    flex: 0 0 auto;
  }

  .content-scroll {
    flex: 1 1 auto;
    min-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
    overscroll-behavior: contain;
  }

  /* Keep the overview complete in the first desktop viewport. */
  #dashboard-tab.active {
    display: grid;
    height: 100%;
    min-height: 0;
    box-sizing: border-box;
    padding: calc(16px * var(--ui-scale, 1)) 0;
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: calc(14px * var(--ui-scale, 1));
  }

  #dashboard-tab .page-heading,
  #dashboard-tab .metric-grid {
    margin: 0;
  }

  #dashboard-tab .metric-grid {
    gap: calc(11px * var(--ui-scale, 1));
  }

  #dashboard-tab .metric-card {
    padding: calc(13px * var(--ui-scale, 1)) calc(15px * var(--ui-scale, 1));
  }

  #dashboard-tab .dashboard-grid {
    min-height: 0;
  }

  #dashboard-tab .activity-card {
    display: flex;
    min-height: 0;
    height: 100%;
    overflow: hidden;
    flex-direction: column;
  }

  #dashboard-tab .surface-heading {
    padding: calc(15px * var(--ui-scale, 1)) calc(18px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
  }

  #dashboard-tab .call-log-list {
    min-height: 0;
    max-height: none;
    flex: 1 1 auto;
    overflow-y: auto;
  }

  /* Keep inboxes and the customer directory within the desktop workspace too.
     Lists and message histories become the overflow reserve when needed. */
  #sms-tab.active,
  #email-tab.active,
  #customers-tab.active {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    box-sizing: border-box;
    padding: calc(16px * var(--ui-scale, 1)) 0;
    gap: calc(12px * var(--ui-scale, 1));
  }

  #sms-tab .page-heading,
  #email-tab .page-heading,
  #customers-tab .page-heading,
  #sms-tab .ticket-filter-bar,
  #email-tab .ticket-filter-bar {
    flex: 0 0 auto;
    margin: 0;
  }

  #sms-tab .inbox-layout,
  #email-tab .inbox-layout {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
  }

  #sms-tab .thread-panel,
  #email-tab .thread-panel,
  #sms-tab .conversation-panel,
  #email-tab .conversation-panel {
    min-height: 0;
  }

  #sms-tab .conversation-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
  }

  #sms-tab .thread-panel,
  #email-tab .thread-panel {
    display: flex;
    flex-direction: column;
  }

  #sms-tab .thread-list,
  #email-tab .thread-list,
  #sms-tab .message-history,
  #email-tab .message-history {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
  }

  #customers-tab #customer-directory-card {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    flex-direction: column;
  }

  /* Do not let the desktop directory compete with an open contact detail. */
  #customers-tab #customer-directory-card.hidden {
    display: none !important;
  }

  #customers-tab .customer-directory,
  #customers-tab #customer-detail-view-container:not(.hidden) {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
  }
}

/* Fine alignment for the fixed side panels. */
.utility-rail .service-card-heading {
  position: static;
}

.utility-rail .service-card-heading .service-icon {
  /* Queue icon: calc(14px * var(--ui-scale, 1)) wrapper padding + calc(12px * var(--ui-scale, 1)) button inset. */
  left: calc(26px * var(--ui-scale, 1));
}

.workspace-switcher strong {
  font-size: calc(18px * var(--ui-scale, 1));
}

.workspace-switcher small {
  font-size: calc(14px * var(--ui-scale, 1));
}

.workspace-department-select {
  display: none;
  width: 100%;
  margin-top: calc(8px * var(--ui-scale, 1));
  border: calc(1px * var(--ui-scale, 1)) solid #2f4a3f;
  border-radius: calc(12px * var(--ui-scale, 1));
  background: #142822;
  color: #bfe8dd;
  font: 600 calc(12px * var(--ui-scale, 1)) var(--font);
  padding: calc(7px * var(--ui-scale, 1)) calc(9px * var(--ui-scale, 1));
}

.workspace-switcher.has-department-switcher {
  display: grid;
  grid-template-columns: calc(34px * var(--ui-scale, 1)) minmax(0, 1fr) auto;
}

.workspace-switcher.has-department-switcher .workspace-department-select {
  display: block;
  grid-column: 1 / -1;
}

.workspace-switcher .workspace-department-select.hidden {
  display: none;
}

.agents-empty-state {
  width: 100%;
  padding: calc(10px * var(--ui-scale, 1));
  color: #64748b;
  font-size: calc(12px * var(--ui-scale, 1));
  font-style: italic;
  text-align: center;
}

#queue-card-wrapper .queue-btn-icon {
  left: 0;
}

#queue-card-wrapper .status-lines-sub {
  font: 400 calc(14px * var(--ui-scale, 1)) var(--font) !important;
}

.flow-action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: calc(5px * var(--ui-scale, 1));
  min-width: calc(31px * var(--ui-scale, 1));
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.flow-action-button:hover:not(:disabled) {
  transform: translateY(calc(-1px * var(--ui-scale, 1)));
  box-shadow: 0 calc(4px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1)) rgba(15, 23, 42, .1);
}

.flow-action-icon {
  width: calc(15px * var(--ui-scale, 1));
  height: calc(15px * var(--ui-scale, 1));
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

[data-search-sms], [data-sms-customer] {
  color: #0d6b5c;
  border-color: #c9e6dd;
  background: #ecf5f1;
}

/* Mobile SMS uses one scrollable conversation frame so the name, actions,
   history and composer move together, matching the e-post reading flow. */
@media (max-width: 900px) {
  #sms-tab .inbox-layout.mobile-sms-thread-open .conversation-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    overscroll-behavior: contain;
  }

  #sms-tab .inbox-layout.mobile-sms-thread-open .message-history {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
  }
}

[data-search-email], [data-email-customer] {
  color: #b34d7a;
  border-color: #ecc9dd;
  background: #f9eef4;
}

.video-action {
  color: #7a4f8f;
  border-color: #e6d9ee;
  background: #f3eef7;
}

.video-action:hover:not(:disabled) {
  background: #e6d9ee;
  color: #6d4382;
}

.softphone-toggle { width: calc(36px * var(--ui-scale, 1)); height: calc(36px * var(--ui-scale, 1)); padding: 0; color: #667085; background: #f8fafc; border-color: #d9dee7; }
.softphone-toggle:hover:not(.active) { color: #667085; background: #f1f3f6; }
.softphone-toggle svg { width: calc(18px * var(--ui-scale, 1)); height: calc(18px * var(--ui-scale, 1)); fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.softphone-toggle.active { color: #fff; background: #15714e; border-color: #15714e; box-shadow: 0 0 0 calc(3px * var(--ui-scale, 1)) rgba(31, 154, 99, .18); }

/* E-post has enough room for message text and uses the central page scroll.
   The conversation is no longer squeezed into a small internal history box. */
@media (min-width: 901px) {
  #email-tab.active {
    height: auto;
    min-height: 0;
  }

  #email-tab .email-inbox-layout {
    flex: 0 0 auto;
    min-height: max(calc(640px * var(--ui-scale, 1)), calc(100vh - calc(180px * var(--ui-scale, 1))));
    overflow: visible;
  }

  #email-tab .email-inbox-layout .thread-list,
  #email-tab .email-inbox-layout .message-history {
    flex: 0 0 auto;
    max-height: none;
    overflow: visible;
  }

  #email-tab .email-inbox-layout .message-history {
    min-height: calc(520px * var(--ui-scale, 1));
  }
}

@media (max-width: 600px) {
  .live-search-card,
  .search-card {
    align-items: flex-start;
  }

  .live-search-card .search-card-actions,
  .search-card .search-card-actions {
    flex: 0 0 calc(132px * var(--ui-scale, 1));
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: calc(5px * var(--ui-scale, 1));
  }

  .live-search-card .search-card-actions .small-action,
  .search-card .search-card-actions .small-action {
    width: 100%;
    min-width: 0;
    padding: calc(6px * var(--ui-scale, 1)) calc(4px * var(--ui-scale, 1));
    white-space: nowrap;
  }
}

/* Final E-post 2.0 sizing overrides older mailbox rules below the main theme. */
@media (min-width: 901px) {
  #email-tab.active { display: flex; flex-direction: column; height: calc(100vh - calc(134px * var(--ui-scale, 1))); min-height: calc(620px * var(--ui-scale, 1)); }
  #email-tab .email-inbox-layout { display: grid; flex: 1 1 auto; height: auto; min-height: 0 !important; overflow: hidden !important; }
  #email-tab .email-inbox-layout .thread-list,
  #email-tab .email-inbox-layout .message-history { flex: 1 1 auto; min-height: 0 !important; max-height: none !important; overflow-y: auto !important; }
}

#email-tab .email-more-menu #btn-delete-email {
  align-self: auto;
  width: 100%;
  height: auto;
  margin: 0;
  padding: calc(9px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1)) !important;
  white-space: normal;
}

/* Give each e-mail view and filter the same outlined button treatment as SMS. */
#email-tab .email-toolbar-row {
  justify-content: flex-start;
}

#email-tab .email-toolbar-tabs {
  display: flex;
  align-items: center;
  gap: calc(4px * var(--ui-scale, 1));
  padding: calc(3px * var(--ui-scale, 1));
  border: calc(1px * var(--ui-scale, 1)) solid #e4e7ec;
  border-radius: calc(12px * var(--ui-scale, 1));
  background: #fff;
}

#email-tab .email-toolbar-tabs .email-folder-btn,
#email-tab .email-toolbar-tabs .ticket-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: calc(5px * var(--ui-scale, 1));
  min-height: calc(32px * var(--ui-scale, 1));
  padding: calc(7px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
  border: calc(1px * var(--ui-scale, 1)) solid #d9dee7;
  border-radius: calc(12px * var(--ui-scale, 1));
  background: #fff;
  color: #667085;
  font: 700 calc(12px * var(--ui-scale, 1)) var(--font);
  white-space: nowrap;
}

#email-tab .email-toolbar-tabs .email-folder-btn:hover,
#email-tab .email-toolbar-tabs .ticket-filter-btn:hover {
  border-color: #d0d5dd;
  background: #f8fafc;
}

#email-tab .email-toolbar-tabs .email-folder-btn.active,
#email-tab .email-toolbar-tabs .ticket-filter-btn.active {
  border-color: #bfe0d6;
  background: #e9f4f1;
  color: #0a5a4d;
}

#email-tab .email-toolbar-tabs .email-folder-btn span,
#email-tab .email-toolbar-tabs .filter-count {
  margin: 0;
  padding: calc(2px * var(--ui-scale, 1)) calc(6px * var(--ui-scale, 1));
  border-radius: calc(999px * var(--ui-scale, 1));
  background: #efebe0;
  color: #475467;
  font-size: calc(12px * var(--ui-scale, 1));
  font-weight: 800;
}

#email-tab .email-toolbar-tabs .active span,
#email-tab .email-toolbar-tabs .active .filter-count {
  background: #0d6b5c;
  color: #fff;
}

#email-tab .email-toolbar-divider {
  display: none;
}

/* Keep the e-mail heading compact so the conversation starts higher. */
#email-tab .email-page-heading {
  align-items: center;
  margin-bottom: calc(7px * var(--ui-scale, 1));
}

#email-tab .email-page-heading .eyebrow,
#email-tab .email-page-heading > div > p:not(.eyebrow) {
  display: none;
}

#email-tab .email-page-heading h1 {
  margin: 0;
  font-size: calc(24px * var(--ui-scale, 1));
}

#email-tab .email-page-heading #btn-new-email {
  min-height: calc(34px * var(--ui-scale, 1));
  padding: calc(8px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1));
}

/* Give an opened e-mail substantially more reading space on desktop. */
@media (min-width: 901px) {
  #email-tab.active {
    height: auto;
    min-height: 0;
  }

  #email-tab .email-inbox-layout {
    flex: 0 0 auto;
    min-height: max(calc(820px * var(--ui-scale, 1)), calc(100vh - calc(100px * var(--ui-scale, 1)))) !important;
    height: max(calc(820px * var(--ui-scale, 1)), calc(100vh - calc(100px * var(--ui-scale, 1))));
  }

  #email-tab .conversation-panel {
    min-height: calc(820px * var(--ui-scale, 1));
  }

  #email-tab .email-inbox-layout .message-history {
    min-height: calc(600px * var(--ui-scale, 1)) !important;
  }
}

@media (max-width: 900px) {
  #email-tab .email-toolbar-row {
    display: block;
  }

  #email-tab .email-toolbar-tabs {
    width: 100%;
    flex-wrap: wrap;
    align-items: stretch;
    gap: calc(4px * var(--ui-scale, 1));
    box-sizing: border-box;
  }

  #email-tab .email-toolbar-tabs .email-folder-btn,
  #email-tab .email-toolbar-tabs .ticket-filter-btn {
    min-height: calc(30px * var(--ui-scale, 1));
    padding: calc(6px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1));
    font-size: calc(12px * var(--ui-scale, 1));
  }

  #email-tab .email-toolbar-divider {
    display: none;
  }
}

/* Forwarding selection is deliberately opt-in and uses circular selectors. */
#email-tab .email-message-select {
  display: none !important;
  flex: 0 0 calc(31px * var(--ui-scale, 1));
  width: calc(31px * var(--ui-scale, 1));
  height: calc(38px * var(--ui-scale, 1));
  margin: 0;
  place-items: center;
}

#email-tab #email-chat-history.email-forward-selecting .email-message-select {
  display: grid !important;
}

#email-tab .email-message-select input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: calc(18px * var(--ui-scale, 1));
  height: calc(18px * var(--ui-scale, 1));
  margin: 0;
  border: calc(2px * var(--ui-scale, 1)) solid #b6c1b8;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

#email-tab .email-message-select input[type="checkbox"]:checked {
  border-color: #0d6b5c;
  background: #0d6b5c;
  box-shadow: inset 0 0 0 calc(3px * var(--ui-scale, 1)) #fff;
}

/* Keep the e-mail composer reachable after the expanded reading-area layout.
   The message history owns only the remaining space; the reply editor stays
   visible at the bottom instead of being pushed outside its fixed workspace. */
@media (min-width: 901px) {
  #email-tab.active {
    height: 100%;
    min-height: 0;
  }

  #email-tab .email-inbox-layout {
    flex: 1 1 auto;
    height: auto;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  #email-tab .conversation-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  #email-tab .email-conversation-head,
  #email-tab .email-recipient-bar,
  #email-tab .email-forward-selection-bar,
  #email-tab .ticket-compose-area {
    flex: 0 0 auto;
  }

  #email-tab #email-chat-history {
    flex: 1 1 auto;
    min-height: calc(140px * var(--ui-scale, 1)) !important;
    max-height: none !important;
    overflow-y: auto !important;
  }

  #email-tab .ticket-compose-area {
    border-top: calc(1px * var(--ui-scale, 1)) solid var(--line);
    background: #fff;
  }
}

/* On phones, the complete opened conversation is one scrollable frame so the
   reply field and its actions are never clipped below the viewport. */
@media (max-width: 900px) {
  #email-tab .email-inbox-layout.mobile-email-thread-open .conversation-panel {
    display: block;
    height: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  #email-tab .email-inbox-layout.mobile-email-thread-open #email-chat-history {
    display: flex;
    flex: none;
    min-height: calc(260px * var(--ui-scale, 1)) !important;
    max-height: none !important;
    overflow: visible !important;
  }

  #email-tab .ticket-compose-area {
    flex: 0 0 auto;
  }
}

@media (max-width: 900px) {
  #btn-toggle-email-wide {
    display: none;
  }
}

/* E-post detail controls: keep operational controls together and metadata calm. */
#email-tab .email-heading-actions-row {
  align-items: stretch;
  flex-direction: column;
  gap: calc(7px * var(--ui-scale, 1));
}

#email-tab .ticket-controls {
  width: 100%;
}

#email-tab .email-context-labels {
  width: 100%;
  justify-content: center;
  align-items: center;
  gap: calc(9px * var(--ui-scale, 1));
  padding-bottom: 0;
}

.email-bcc-send {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: calc(7px * var(--ui-scale, 1));
}

.email-bcc-send .recipient-row {
  flex: 1 1 auto;
  min-width: 0;
}

.email-top-send {
  min-height: calc(31px * var(--ui-scale, 1));
  padding: calc(7px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
  white-space: nowrap;
}

@media (min-width: 901px) {
  #email-tab .ticket-controls .email-more-wrap {
    align-self: flex-end;
  }
}

@media (max-width: 900px) {
  #email-tab .ticket-controls {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) calc(42px * var(--ui-scale, 1)) !important;
    align-items: end;
  }

  #email-tab .ticket-controls > .button-contact-action,
  #email-tab #btn-claim-ticket {
    grid-column: 1 / -1 !important;
  }

  #email-tab .ticket-controls .ticket-control-group {
    grid-column: auto;
  }

  #email-tab .ticket-controls .email-more-wrap {
    grid-column: 3;
    align-self: end;
    width: calc(42px * var(--ui-scale, 1));
  }

  #email-tab .ticket-controls .email-more-button {
    width: calc(42px * var(--ui-scale, 1));
    min-width: calc(42px * var(--ui-scale, 1));
    height: calc(30px * var(--ui-scale, 1));
  }

  #email-tab .email-context-labels {
    justify-content: center;
  }
}

/* Meldinger stays compact; desktop starts at the same left edge as E-post. */
#sms-tab .sms-page-heading {
  align-items: center;
  flex-direction: column;
  margin-bottom: calc(7px * var(--ui-scale, 1));
  text-align: center;
}

#sms-tab .sms-title-group {
  display: grid;
  justify-items: center;
}

#sms-tab .sms-page-heading .eyebrow {
  justify-content: center;
}

#sms-tab .sms-filter-bar {
  width: fit-content;
  max-width: 100%;
  margin: 0 auto calc(14px * var(--ui-scale, 1));
  padding: calc(4px * var(--ui-scale, 1));
  justify-content: center;
  border: calc(1px * var(--ui-scale, 1)) solid #e4e7ec;
  border-radius: calc(14px * var(--ui-scale, 1));
  background: #fff;
}

@media (min-width: 901px) {
  #sms-tab .sms-page-heading {
    align-items: flex-start;
    text-align: left;
  }

  #sms-tab .sms-title-group {
    justify-items: start;
  }

  #sms-tab .sms-page-heading .eyebrow {
    justify-content: flex-start;
  }

  #sms-tab .sms-filter-bar {
    margin: 0;
    justify-content: flex-start;
  }
}

.sms-conversation-content {
  flex: 1 1 auto;
  min-width: 0;
}

.sms-contact-meta-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: calc(7px * var(--ui-scale, 1));
  margin-top: calc(7px * var(--ui-scale, 1));
}

.sms-context-labels {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: calc(6px * var(--ui-scale, 1));
}

.sms-context-labels .location-pill {
  margin-top: 0;
}

.sms-conversation-head .conversation-contact-actions {
  width: auto;
  margin-left: 0;
}

@media (max-width: 900px) {
  #sms-tab .sms-filter-bar {
    width: 100%;
    overflow-x: visible !important;
  }

  .sms-conversation-head .sms-conversation-content {
    text-align: center;
  }

  .sms-conversation-head .conversation-kicker {
    justify-content: center;
  }

  .sms-contact-meta-actions {
    justify-content: center;
  }

  .sms-conversation-head .conversation-contact-actions {
    width: auto;
    justify-content: center;
  }
}

/* Keep e-mail context labels visually equal and anchored below the controls. */
#email-tab .email-context-labels {
  justify-content: flex-start;
  align-items: center;
  flex-wrap: wrap;
  gap: calc(9px * var(--ui-scale, 1));
}

#email-tab .email-context-labels > .location-pill,
#email-tab .email-context-labels > .customer-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: calc(116px * var(--ui-scale, 1));
  height: calc(29px * var(--ui-scale, 1));
  margin: 0;
  padding: 0 calc(9px * var(--ui-scale, 1));
  box-sizing: border-box;
  font-size: calc(12px * var(--ui-scale, 1));
  line-height: 1;
  white-space: nowrap;
}

/* Utvid turns the complete opened e-mail into one internal scroll frame, like
   the mobile detail view. This keeps recipients, messages and the reply editor
   inside the card instead of making the page itself grow. */
@media (min-width: 901px) {
  #email-tab.email-vertical-expanded {
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  #email-tab .email-inbox-layout.email-vertical-mode {
    grid-template-columns: calc(265px * var(--ui-scale, 1)) minmax(0, 1fr) !important;
    flex: 1 1 auto;
    height: auto;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  #email-tab .email-inbox-layout.email-vertical-mode .thread-panel {
    display: flex !important;
  }

  #email-tab .email-inbox-layout.email-vertical-mode .conversation-panel {
    display: block;
    height: 100%;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }

  #email-tab .email-inbox-layout.email-vertical-mode #email-chat-history {
    display: flex;
    flex: none;
    min-height: max(calc(680px * var(--ui-scale, 1)), calc(100vh - calc(230px * var(--ui-scale, 1)))) !important;
    max-height: none !important;
    overflow: visible !important;
  }
}

/* The composer can grow independently from the reading pane. Attached images
   remain visible as previews inside the compose card. */
#email-tab .email-composer.composer-expanded .email-rich-editor {
  min-height: calc(360px * var(--ui-scale, 1));
  max-height: min(56vh, calc(560px * var(--ui-scale, 1)));
}

#email-tab .email-composer.composer-expanded .email-subject-row {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
}

#email-tab .conversation-panel.email-composer-expanded {
  overflow-y: auto !important;
  overscroll-behavior: contain;
}

#email-tab .conversation-panel.email-composer-expanded #email-chat-history {
  flex: 0 0 calc(180px * var(--ui-scale, 1));
  min-height: calc(180px * var(--ui-scale, 1)) !important;
}

#email-tab .email-composer.composer-expanded .email-attachments {
  max-height: calc(190px * var(--ui-scale, 1));
  overflow-y: auto;
}

#email-tab .email-composer-expand-button.active {
  color: #0a5a4d;
  border-color: #bfe0d6;
  background: #e9f4f1;
}

#email-tab .email-attachments {
  align-items: flex-start;
  border-top: calc(1px * var(--ui-scale, 1)) solid #e7eaf0;
  border-bottom: 0;
}

#email-tab .email-attachment-preview {
  position: relative;
  width: calc(118px * var(--ui-scale, 1));
  margin: 0;
  padding: calc(4px * var(--ui-scale, 1));
  border: calc(1px * var(--ui-scale, 1)) solid #d9e9e2;
  border-radius: calc(12px * var(--ui-scale, 1));
  background: #fff;
}

#email-tab .email-attachment-preview img {
  display: block;
  width: calc(108px * var(--ui-scale, 1));
  height: calc(76px * var(--ui-scale, 1));
  border-radius: calc(10px * var(--ui-scale, 1));
  object-fit: cover;
  background: #f8fafc;
}

#email-tab .email-attachment-preview figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(4px * var(--ui-scale, 1));
  padding: calc(4px * var(--ui-scale, 1)) calc(1px * var(--ui-scale, 1)) 0;
  color: #2a594c;
  font-size: calc(12px * var(--ui-scale, 1));
  font-weight: 700;
}

#email-tab .email-attachment-preview figcaption span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#email-tab .email-attachment-preview button {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: #64748b;
  font: 700 calc(14px * var(--ui-scale, 1)) var(--font);
  line-height: 1;
  cursor: pointer;
  padding: 0 calc(1px * var(--ui-scale, 1));
}

@media (max-width: 900px) {
  #email-tab .email-composer.composer-expanded .email-rich-editor {
    min-height: calc(280px * var(--ui-scale, 1));
    max-height: 52vh;
  }

  #email-tab .email-compose-tools {
    flex-wrap: wrap;
  }

  #email-tab .email-subject-row .email-composer-expand-button {
    min-width: calc(78px * var(--ui-scale, 1));
  }
}

/* Statistics — High-density operational layout */
#statistics-tab {
  --stats-calls: #0d6b5c;
  --stats-sms: #7a4f8f;
  --stats-email: #17835f;
  --stats-bg-subtle: rgba(15, 23, 42, 0.025);
  --stats-border: var(--line, #e2e8f0);
  font-variant-numeric: tabular-nums;
}

html[data-mode="dark"] #statistics-tab {
  --stats-calls: #2dd4bf;
  --stats-sms: #c084fc;
  --stats-email: #4ade80;
  --stats-bg-subtle: rgba(255, 255, 255, 0.03);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Integrated Toolbar */
.statistics-toolbar {
  position: relative;
  overflow: visible !important;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: calc(12px * var(--ui-scale, 1));
  padding: calc(10px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1));
  margin-bottom: calc(12px * var(--ui-scale, 1));
  border-radius: calc(10px * var(--ui-scale, 1));
}

.statistics-toolbar-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: calc(10px * var(--ui-scale, 1));
}

.statistics-toolbar-title h1 {
  margin: 0;
  font-size: calc(18px * var(--ui-scale, 1));
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.statistics-period-badge {
  display: inline-flex;
  align-items: center;
  padding: calc(3px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1));
  border-radius: calc(6px * var(--ui-scale, 1));
  background: var(--stats-bg-subtle);
  border: 1px solid var(--stats-border);
  color: var(--muted);
  font-size: calc(12px * var(--ui-scale, 1));
  font-weight: 600;
}

.statistics-day-drilldown {
  display: inline-flex;
  align-items: center;
  gap: calc(8px * var(--ui-scale, 1));
  padding: calc(3px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1));
  border-radius: calc(6px * var(--ui-scale, 1));
  background: rgba(13, 107, 92, 0.08);
  border: 1px solid rgba(13, 107, 92, 0.22);
  font-size: calc(12px * var(--ui-scale, 1));
}

.statistics-day-drilldown.hidden {
  display: none;
}

.statistics-day-drilldown strong {
  color: var(--ink);
  font-weight: 600;
}

.statistics-day-drilldown button {
  border: 0;
  background: transparent;
  color: var(--stats-calls);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.statistics-day-drilldown button:hover {
  text-decoration: underline;
}

.statistics-toolbar-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: calc(8px * var(--ui-scale, 1));
}

.statistics-period-filter {
  display: inline-flex;
  padding: calc(2px * var(--ui-scale, 1));
  border-radius: calc(8px * var(--ui-scale, 1));
  background: var(--stats-bg-subtle);
  border: 1px solid var(--stats-border);
}

.statistics-period-button {
  min-height: calc(30px * var(--ui-scale, 1));
  padding: 0 calc(11px * var(--ui-scale, 1));
  border: 0;
  border-radius: calc(6px * var(--ui-scale, 1));
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: calc(12px * var(--ui-scale, 1));
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.statistics-period-button:hover {
  color: var(--ink);
}

.statistics-period-button.active {
  background: var(--panel-solid, #ffffff);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.statistics-department-filter {
  margin: 0;
}

.statistics-department-filter.single-option {
  display: none;
}

.statistics-department-filter select,
.statistics-agent-select select,
.statistics-week-select {
  min-height: calc(34px * var(--ui-scale, 1));
  padding: 0 calc(10px * var(--ui-scale, 1));
  border: 1px solid var(--stats-border);
  border-radius: calc(8px * var(--ui-scale, 1));
  background: var(--panel-solid, #ffffff);
  color: var(--ink);
  font: inherit;
  font-size: calc(12px * var(--ui-scale, 1));
  font-weight: 600;
}

.statistics-week-picker {
  display: inline-flex;
  align-items: center;
  gap: calc(4px * var(--ui-scale, 1));
}
.statistics-week-picker.hidden {
  display: none !important;
}
.statistics-week-step {
  min-width: calc(30px * var(--ui-scale, 1));
  min-height: calc(34px * var(--ui-scale, 1));
  padding: 0 calc(8px * var(--ui-scale, 1));
  font-size: calc(16px * var(--ui-scale, 1));
  line-height: 1;
}

/* Clickable date badge and calendar-style week picker dropdown (2026-11-26). */
.statistics-week-popover-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.statistics-period-trigger {
  gap: calc(6px * var(--ui-scale, 1));
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.14s ease, color 0.14s ease, background-color 0.14s ease;
}
.statistics-period-trigger:hover,
.statistics-period-trigger[aria-expanded="true"],
.statistics-period-trigger.is-calendar-week {
  color: var(--ink);
  border-color: var(--ink);
}
.statistics-calendar-icon {
  width: calc(13px * var(--ui-scale, 1));
  height: calc(13px * var(--ui-scale, 1));
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}
.statistics-period-caret {
  font-size: calc(10px * var(--ui-scale, 1));
  opacity: 0.72;
}
.statistics-week-popover {
  position: absolute;
  top: calc(100% + calc(8px * var(--ui-scale, 1)));
  left: 0;
  z-index: 80;
  width: calc(304px * var(--ui-scale, 1));
  padding: calc(12px * var(--ui-scale, 1));
  border-radius: calc(14px * var(--ui-scale, 1));
  border: 1px solid var(--stats-border, #e4e7ec);
  background: var(--surface, #ffffff);
  color: var(--ink, #141414);
  box-shadow: 0 calc(16px * var(--ui-scale, 1)) calc(38px * var(--ui-scale, 1)) rgba(15, 23, 42, 0.18);
}
.statistics-week-popover.hidden {
  display: none !important;
}
.statistics-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(8px * var(--ui-scale, 1));
  margin-bottom: calc(10px * var(--ui-scale, 1));
}
.statistics-cal-title {
  font-size: calc(13.5px * var(--ui-scale, 1));
  font-weight: 700;
  color: var(--ink);
}
.statistics-cal-nav {
  width: calc(28px * var(--ui-scale, 1));
  height: calc(28px * var(--ui-scale, 1));
  border-radius: calc(8px * var(--ui-scale, 1));
  border: 1px solid var(--stats-border, #e4e7ec);
  background: var(--stats-bg-subtle, #f4f4f6);
  color: var(--ink);
  font-size: calc(16px * var(--ui-scale, 1));
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.statistics-cal-nav:hover:not(:disabled) {
  border-color: var(--ink);
}
.statistics-cal-nav:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.statistics-cal-weekdays {
  display: grid;
  grid-template-columns: calc(34px * var(--ui-scale, 1)) repeat(7, minmax(0, 1fr));
  align-items: center;
  text-align: center;
  font-size: calc(10.5px * var(--ui-scale, 1));
  font-weight: 700;
  color: var(--muted);
  padding: 0 calc(4px * var(--ui-scale, 1)) calc(6px * var(--ui-scale, 1));
}
.statistics-cal-wk-head {
  text-align: left;
  padding-left: calc(4px * var(--ui-scale, 1));
}
.statistics-cal-grid {
  display: flex;
  flex-direction: column;
  gap: calc(3px * var(--ui-scale, 1));
}
.statistics-cal-week {
  display: grid;
  grid-template-columns: calc(34px * var(--ui-scale, 1)) repeat(7, minmax(0, 1fr));
  align-items: center;
  width: 100%;
  padding: calc(6px * var(--ui-scale, 1)) calc(4px * var(--ui-scale, 1));
  border: 0;
  border-radius: calc(9px * var(--ui-scale, 1));
  background: transparent;
  color: var(--ink);
  font: 600 calc(12px * var(--ui-scale, 1)) var(--font);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}
.statistics-cal-week:hover:not(:disabled):not(.is-selected) {
  background: var(--stats-bg-subtle, rgba(15, 23, 42, 0.06));
}
.statistics-cal-week.is-selected {
  background: var(--ink, #141414);
  color: var(--surface, #ffffff);
}
.statistics-cal-week:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.statistics-cal-wk {
  font-size: calc(11px * var(--ui-scale, 1));
  font-weight: 700;
  color: var(--muted);
  text-align: left;
  padding-left: calc(4px * var(--ui-scale, 1));
}
.statistics-cal-week.is-selected .statistics-cal-wk {
  color: inherit;
  opacity: 0.85;
}
.statistics-cal-day {
  text-align: center;
  line-height: 1.3;
  position: relative;
}
.statistics-cal-day.is-outside {
  opacity: 0.42;
  font-weight: 500;
}
.statistics-cal-day.is-today {
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.statistics-cal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(6px * var(--ui-scale, 1));
  margin-top: calc(10px * var(--ui-scale, 1));
  padding-top: calc(8px * var(--ui-scale, 1));
  border-top: 1px solid var(--stats-border, #e4e7ec);
}
.statistics-cal-foot-btn {
  border: 1px solid var(--stats-border, #e4e7ec);
  border-radius: calc(8px * var(--ui-scale, 1));
  background: transparent;
  color: var(--ink);
  font: 600 calc(11.5px * var(--ui-scale, 1)) var(--font);
  padding: calc(5px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1));
  cursor: pointer;
}
.statistics-cal-foot-btn.is-primary {
  background: var(--stats-bg-subtle, #f4f4f6);
}
.statistics-cal-foot-btn:hover:not(:disabled) {
  border-color: var(--ink);
}
.statistics-cal-foot-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}
html[data-theme="dark"] .statistics-week-popover {
  background: var(--surface, #171717);
  border-color: var(--line, #2e2e2e);
  box-shadow: 0 calc(18px * var(--ui-scale, 1)) calc(42px * var(--ui-scale, 1)) rgba(0, 0, 0, 0.55);
}
@media (max-width: 640px) {
  .statistics-week-popover {
    position: fixed;
    left: 12px;
    right: 12px;
    top: auto;
    bottom: 16px;
    width: auto;
    z-index: 200;
  }
}

.statistics-refresh-btn,
.statistics-export-btn {
  min-height: calc(34px * var(--ui-scale, 1));
  padding: 0 calc(12px * var(--ui-scale, 1));
  font-size: calc(12px * var(--ui-scale, 1));
  border-radius: calc(8px * var(--ui-scale, 1));
}

.statistics-export-btn {
  display: inline-flex;
  align-items: center;
  gap: calc(6px * var(--ui-scale, 1));
  font-weight: 700;
  white-space: nowrap;
}

.statistics-export-icon {
  width: calc(14px * var(--ui-scale, 1));
  height: calc(14px * var(--ui-scale, 1));
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.statistics-loading,
.statistics-error {
  padding: calc(16px * var(--ui-scale, 1));
  margin-bottom: calc(12px * var(--ui-scale, 1));
  font-size: calc(13px * var(--ui-scale, 1));
  font-weight: 600;
  border-radius: calc(10px * var(--ui-scale, 1));
}

.statistics-error {
  border-color: rgba(180, 35, 24, 0.28);
  color: #b42318;
}

.statistics-content {
  display: grid;
  gap: calc(12px * var(--ui-scale, 1));
}
/* Hidden until the first figures arrive: the empty cards under the loading
   box made the whole page jump up when the box went away. */
.statistics-content.hidden { display: none; }

/* Dots */
.statistics-dot {
  display: inline-block;
  width: calc(8px * var(--ui-scale, 1));
  height: calc(8px * var(--ui-scale, 1));
  border-radius: 2px;
  flex-shrink: 0;
}

.statistics-dot.calls { background: var(--stats-calls); }
.statistics-dot.sms { background: var(--stats-sms); }
.statistics-dot.email { background: var(--stats-email); }

/* 4-Column KPI Ledger */
.statistics-kpi-ledger {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-radius: calc(10px * var(--ui-scale, 1));
  overflow: hidden;
}

.statistics-kpi-cell {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: calc(8px * var(--ui-scale, 1));
  padding: calc(14px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1));
  border-right: 1px solid var(--stats-border);
}

.statistics-kpi-cell:last-child {
  border-right: 0;
}

.statistics-kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(8px * var(--ui-scale, 1));
}

.statistics-kpi-label {
  display: inline-flex;
  align-items: center;
  gap: calc(6px * var(--ui-scale, 1));
  font-size: calc(12px * var(--ui-scale, 1));
  font-weight: 700;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.statistics-kpi-meta {
  font-size: calc(12px * var(--ui-scale, 1));
  color: var(--muted);
  font-weight: 500;
}

.statistics-kpi-meta strong {
  color: var(--ink);
  font-weight: 700;
}

.statistics-kpi-main {
  display: flex;
  align-items: baseline;
  gap: calc(6px * var(--ui-scale, 1));
}

.statistics-kpi-main strong {
  font-size: calc(24px * var(--ui-scale, 1));
  font-weight: 750;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.statistics-kpi-main span {
  font-size: calc(12px * var(--ui-scale, 1));
  color: var(--muted);
  font-weight: 500;
}

.statistics-kpi-bar {
  height: calc(4px * var(--ui-scale, 1));
  border-radius: 2px;
  background: var(--stats-bg-subtle);
  overflow: hidden;
  display: flex;
}

.statistics-kpi-bar.split {
  gap: 1px;
}

.statistics-kpi-bar > span,
.statistics-kpi-bar > i {
  display: block;
  height: 100%;
  transition: width 0.2s ease;
}

.statistics-kpi-bar .calls { background: var(--stats-calls); }
.statistics-kpi-bar .sms { background: var(--stats-sms); }
.statistics-kpi-bar .email { background: var(--stats-email); }

.statistics-kpi-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: calc(6px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1));
  margin: 0;
  padding-top: calc(4px * var(--ui-scale, 1));
  border-top: 1px solid var(--stats-border);
  font-size: calc(12px * var(--ui-scale, 1));
}

.statistics-kpi-breakdown > div {
  display: inline-flex;
  align-items: baseline;
  gap: calc(4px * var(--ui-scale, 1));
}

.statistics-kpi-breakdown dt {
  color: var(--muted);
  font-weight: 500;
}

.statistics-kpi-breakdown dd {
  margin: 0;
  color: var(--ink);
  font-weight: 700;
}

/* Main Grid: Timeline + Per avdeling */
.statistics-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(calc(300px * var(--ui-scale, 1)), 1fr);
  gap: calc(12px * var(--ui-scale, 1));
  align-items: stretch;
}

.statistics-chart-card,
.statistics-department-card,
.statistics-depot-demand-card,
.statistics-agent-card {
  border-radius: calc(10px * var(--ui-scale, 1));
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.statistics-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: calc(10px * var(--ui-scale, 1));
  padding: calc(12px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1));
  border-bottom: 1px solid var(--stats-border);
}

.statistics-heading-inline {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: calc(8px * var(--ui-scale, 1));
}

.statistics-card-heading h2 {
  margin: 0;
  font-size: calc(14px * var(--ui-scale, 1));
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.statistics-card-subtitle {
  font-size: calc(12px * var(--ui-scale, 1));
  color: var(--muted);
  font-weight: 500;
}

.statistics-chart-legend {
  display: inline-flex;
  align-items: center;
  gap: calc(12px * var(--ui-scale, 1));
  font-size: calc(12px * var(--ui-scale, 1));
  color: var(--muted);
  font-weight: 600;
}

.statistics-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: calc(5px * var(--ui-scale, 1));
}

.statistics-chart-legend i {
  width: calc(8px * var(--ui-scale, 1));
  height: calc(8px * var(--ui-scale, 1));
  border-radius: 2px;
}

.statistics-chart-legend i.calls { background: var(--stats-calls); }
.statistics-chart-legend i.sms { background: var(--stats-sms); }
.statistics-chart-legend i.email { background: var(--stats-email); }

/* Timeline Chart */
.statistics-timeline {
  padding: calc(14px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1));
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow-x: auto;
}

.statistics-chart-frame {
  display: grid;
  grid-template-columns: calc(26px * var(--ui-scale, 1)) minmax(calc(480px * var(--ui-scale, 1)), 1fr);
  gap: calc(8px * var(--ui-scale, 1));
  align-items: stretch;
  min-height: calc(200px * var(--ui-scale, 1));
}

.statistics-chart-yaxis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-bottom: calc(22px * var(--ui-scale, 1));
  font-size: calc(11px * var(--ui-scale, 1));
  color: var(--muted);
  text-align: right;
  user-select: none;
}

.statistics-chart-grid {
  display: grid;
  grid-template-columns: repeat(var(--statistics-buckets, 24), minmax(calc(16px * var(--ui-scale, 1)), 1fr));
  gap: calc(4px * var(--ui-scale, 1));
  align-items: end;
}

.statistics-bar-group {
  display: grid;
  grid-template-rows: 1fr calc(18px * var(--ui-scale, 1));
  gap: calc(4px * var(--ui-scale, 1));
  height: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: center;
}

.statistics-bar-group.selectable {
  cursor: pointer;
  border-radius: calc(4px * var(--ui-scale, 1));
}

.statistics-bar-group.selectable:hover .statistics-bars {
  border-bottom-color: var(--stats-calls);
  background: rgba(13, 107, 92, 0.06);
}

.statistics-bars {
  height: calc(176px * var(--ui-scale, 1));
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: end;
  gap: 1px;
  padding: calc(4px * var(--ui-scale, 1)) 1px 0;
  border-bottom: 1px solid var(--stats-border);
  background:
    linear-gradient(to bottom, var(--stats-border) 1px, transparent 1px) 0 0 / 100% 50% repeat-y;
}

.statistics-bar {
  display: block;
  width: 100%;
  height: var(--bar-height, 0%);
  min-height: 0;
  border-radius: 2px 2px 0 0;
}

.statistics-bar.calls { background: var(--stats-calls); }
.statistics-bar.sms { background: var(--stats-sms); }
.statistics-bar.email { background: var(--stats-email); }

.statistics-axis-label {
  color: var(--muted);
  font-size: calc(11px * var(--ui-scale, 1));
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
}

/* Department List (Per avdeling) */
.statistics-department-list {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.statistics-dept-block {
  padding: calc(12px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1));
  border-bottom: 1px solid var(--stats-border);
}

.statistics-dept-block:last-child {
  border-bottom: 0;
}

.statistics-dept-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: calc(8px * var(--ui-scale, 1));
  margin-bottom: calc(8px * var(--ui-scale, 1));
}

.statistics-dept-header h3 {
  margin: 0;
  font-size: calc(13px * var(--ui-scale, 1));
  font-weight: 700;
  color: var(--ink);
}

.statistics-dept-summary {
  display: inline-flex;
  align-items: center;
  gap: calc(5px * var(--ui-scale, 1));
  font-size: calc(12px * var(--ui-scale, 1));
  color: var(--muted);
}

.statistics-dept-summary strong {
  color: var(--ink);
  font-weight: 700;
}

.statistics-dept-sep {
  opacity: 0.5;
}

.statistics-dept-channels {
  display: grid;
  gap: calc(6px * var(--ui-scale, 1));
}

.statistics-dept-channel-row {
  display: grid;
  grid-template-columns: calc(64px * var(--ui-scale, 1)) calc(56px * var(--ui-scale, 1)) calc(68px * var(--ui-scale, 1)) 1fr calc(42px * var(--ui-scale, 1));
  align-items: center;
  gap: calc(8px * var(--ui-scale, 1));
  font-size: calc(12px * var(--ui-scale, 1));
}

.statistics-dept-channel-name {
  display: inline-flex;
  align-items: center;
  gap: calc(6px * var(--ui-scale, 1));
  font-weight: 600;
  color: var(--ink);
}

.statistics-dept-channel-counts {
  color: var(--muted);
  text-align: right;
  font-size: calc(11.5px * var(--ui-scale, 1));
}

.statistics-dept-channel-time {
  color: var(--muted);
  text-align: right;
  font-size: calc(11.5px * var(--ui-scale, 1));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.statistics-dept-channel-bar {
  height: calc(5px * var(--ui-scale, 1));
  border-radius: 2px;
  background: var(--stats-bg-subtle);
  overflow: hidden;
}

.statistics-dept-channel-bar > span {
  display: block;
  height: 100%;
}

.statistics-dept-channel-bar .calls { background: var(--stats-calls); }
.statistics-dept-channel-bar .sms { background: var(--stats-sms); }
.statistics-dept-channel-bar .email { background: var(--stats-email); }

.statistics-dept-channel-rate {
  text-align: right;
  font-weight: 700;
  color: var(--ink);
}

/* Operational Data Tables (Depots & Agents) */
.statistics-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.statistics-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: calc(12.5px * var(--ui-scale, 1));
}

.statistics-data-table th,
.statistics-data-table td {
  padding: calc(9px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1));
  border-bottom: 1px solid var(--stats-border);
  text-align: left;
  vertical-align: middle;
}

.statistics-data-table thead th {
  font-size: calc(11px * var(--ui-scale, 1));
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  background: var(--stats-bg-subtle);
  white-space: nowrap;
}

.statistics-data-table tbody tr:last-child td {
  border-bottom: 0;
}

.statistics-data-table th.num,
.statistics-data-table td.num {
  text-align: right;
  white-space: nowrap;
}

.statistics-data-table td.muted-cell {
  color: var(--muted);
}

/* Depot Table specifics */
.depot-name-cell {
  min-width: calc(220px * var(--ui-scale, 1));
}

.statistics-depot-title-row {
  display: flex;
  align-items: center;
  gap: calc(8px * var(--ui-scale, 1));
  margin-bottom: calc(5px * var(--ui-scale, 1));
}

.statistics-depot-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: calc(18px * var(--ui-scale, 1));
  font-size: calc(11px * var(--ui-scale, 1));
  font-weight: 600;
  color: var(--muted);
}

.statistics-depot-demand-track {
  height: calc(4px * var(--ui-scale, 1));
  max-width: calc(240px * var(--ui-scale, 1));
  border-radius: 2px;
  background: var(--stats-bg-subtle);
  overflow: hidden;
}

.statistics-depot-demand-fill {
  display: flex;
  height: 100%;
  min-width: 0;
}

.statistics-depot-demand-fill i {
  display: block;
  height: 100%;
}

.statistics-depot-demand-fill .calls { background: var(--stats-calls); }
.statistics-depot-demand-fill .sms { background: var(--stats-sms); }
.statistics-depot-demand-fill .email { background: var(--stats-email); }

.statistics-cell-pair {
  display: inline-flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: calc(6px * var(--ui-scale, 1));
}

.statistics-cell-pair strong {
  color: var(--ink);
  font-weight: 700;
}

.statistics-cell-pair small {
  color: var(--muted);
  font-size: calc(11px * var(--ui-scale, 1));
  min-width: calc(34px * var(--ui-scale, 1));
  text-align: right;
}

.statistics-unanswered-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: calc(24px * var(--ui-scale, 1));
  padding: calc(1px * var(--ui-scale, 1)) calc(6px * var(--ui-scale, 1));
  border-radius: calc(4px * var(--ui-scale, 1));
  font-size: calc(11.5px * var(--ui-scale, 1));
  font-weight: 600;
  color: var(--muted);
}

.statistics-unanswered-badge.warn {
  background: rgba(180, 35, 24, 0.1);
  color: #b42318;
  font-weight: 700;
}

html[data-mode="dark"] .statistics-unanswered-badge.warn {
  background: rgba(248, 113, 113, 0.16);
  color: #f87171;
}

/* Agent Split View */
.statistics-agent-controls {
  display: flex;
  align-items: center;
  gap: calc(8px * var(--ui-scale, 1));
}

.statistics-agent-select {
  display: inline-flex;
  align-items: center;
  gap: calc(8px * var(--ui-scale, 1));
  margin: 0;
  font-size: calc(12px * var(--ui-scale, 1));
  color: var(--muted);
  font-weight: 600;
}

.statistics-agent-split {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(calc(280px * var(--ui-scale, 1)), 1fr);
  align-items: stretch;
}

.statistics-agent-chart {
  border-right: 1px solid var(--stats-border);
  min-width: 0;
}

.statistics-agent-row {
  cursor: pointer;
  transition: background-color 0.1s ease;
}

.statistics-agent-row:hover {
  background: var(--stats-bg-subtle);
}

.statistics-agent-row.active {
  background: rgba(13, 107, 92, 0.07);
}

html[data-mode="dark"] .statistics-agent-row.active {
  background: rgba(45, 212, 191, 0.1);
}

.statistics-agent-name {
  font-weight: 600;
  color: var(--ink);
}

.statistics-inline-total {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: calc(8px * var(--ui-scale, 1));
  min-width: calc(90px * var(--ui-scale, 1));
}

.statistics-inline-bar {
  width: calc(48px * var(--ui-scale, 1));
  height: calc(4px * var(--ui-scale, 1));
  border-radius: 2px;
  background: var(--stats-bg-subtle);
  overflow: hidden;
}

.statistics-inline-bar > span {
  display: block;
  height: 100%;
  background: var(--stats-calls);
}

/* Agent Hourly / Daily Breakdown Pane */
.statistics-agent-hourly {
  padding: calc(14px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1));
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: calc(12px * var(--ui-scale, 1));
  min-width: 0;
}

.statistics-hourly-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: calc(8px * var(--ui-scale, 1));
}

.statistics-hourly-heading h3 {
  margin: 0;
  font-size: calc(13.5px * var(--ui-scale, 1));
  font-weight: 700;
  color: var(--ink);
}

.statistics-hourly-heading p {
  margin: calc(2px * var(--ui-scale, 1)) 0 0;
  font-size: calc(11.5px * var(--ui-scale, 1));
  color: var(--muted);
}

.statistics-hourly-summary {
  display: inline-flex;
  align-items: center;
  gap: calc(6px * var(--ui-scale, 1));
  font-size: calc(12px * var(--ui-scale, 1));
  color: var(--muted);
}

.statistics-hourly-summary strong {
  color: var(--ink);
  font-weight: 700;
}

.statistics-hourly-grid {
  display: grid;
  grid-template-columns: repeat(var(--hourly-buckets, 12), minmax(calc(14px * var(--ui-scale, 1)), 1fr));
  gap: calc(3px * var(--ui-scale, 1));
  align-items: end;
  min-height: calc(150px * var(--ui-scale, 1));
  padding-top: calc(8px * var(--ui-scale, 1));
  overflow-x: auto;
}

.statistics-hourly-slot {
  display: grid;
  grid-template-rows: calc(14px * var(--ui-scale, 1)) calc(112px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1));
  gap: calc(3px * var(--ui-scale, 1));
  align-items: end;
  text-align: center;
}

.statistics-hourly-val {
  font-size: calc(10.5px * var(--ui-scale, 1));
  font-weight: 600;
  color: var(--muted);
  line-height: 1;
}

.statistics-hourly-track {
  height: 100%;
  width: 100%;
  background: var(--stats-bg-subtle);
  border-bottom: 1px solid var(--stats-border);
  display: flex;
  align-items: flex-end;
  border-radius: 2px 2px 0 0;
  overflow: hidden;
}

.statistics-hourly-track i {
  display: block;
  width: 100%;
  height: var(--hourly-load, 0%);
  background: var(--stats-calls);
  border-radius: 2px 2px 0 0;
}

.statistics-hourly-lbl {
  font-size: calc(10px * var(--ui-scale, 1));
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
}

.statistics-depot-demand-empty,
.statistics-ring-empty,
.statistics-agent-empty {
  margin: 0;
  padding: calc(16px * var(--ui-scale, 1));
  color: var(--muted);
  font-size: calc(12.5px * var(--ui-scale, 1));
}

.statistics-method-note {
  margin: 0;
  padding: 0 calc(4px * var(--ui-scale, 1));
  color: var(--muted);
  font-size: calc(11.5px * var(--ui-scale, 1));
  line-height: 1.45;
}

@media (max-width: 1100px) {
  .statistics-kpi-ledger {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .statistics-kpi-cell:nth-child(2) {
    border-right: 0;
  }
  .statistics-kpi-cell:nth-child(1),
  .statistics-kpi-cell:nth-child(2) {
    border-bottom: 1px solid var(--stats-border);
  }
  .statistics-main-grid,
  .statistics-agent-split {
    grid-template-columns: 1fr;
  }
  .statistics-agent-chart {
    border-right: 0;
    border-bottom: 1px solid var(--stats-border);
  }
}

@media (max-width: 640px) {
  .statistics-toolbar {
    padding: calc(10px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1));
  }
  .statistics-toolbar-controls {
    width: 100%;
    justify-content: space-between;
  }
  .statistics-period-filter {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
  .statistics-week-picker {
    width: 100%;
  }
  .statistics-week-select {
    flex: 1 1 auto;
    min-width: 0;
  }
  .statistics-kpi-ledger {
    grid-template-columns: 1fr;
  }
  .statistics-kpi-cell {
    border-right: 0;
    border-bottom: 1px solid var(--stats-border);
  }
  .statistics-kpi-cell:last-child {
    border-bottom: 0;
  }
  .statistics-dept-channel-row {
    grid-template-columns: calc(58px * var(--ui-scale, 1)) calc(48px * var(--ui-scale, 1)) 1fr calc(40px * var(--ui-scale, 1));
  }
  .statistics-dept-channel-time {
    display: none;
  }
}

/* Interactive row affordances */
.statistics-depot-row.clickable,
.statistics-dept-block.clickable {
  cursor: pointer;
  transition: background-color 0.14s ease;
}

.statistics-depot-row.clickable:hover,
.statistics-dept-block.clickable:hover {
  background: var(--stats-bg-subtle);
}

.statistics-row-action {
  margin-left: auto;
  font-size: calc(11px * var(--ui-scale, 1));
  font-weight: 700;
  color: var(--stats-calls);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.statistics-depot-row.clickable:hover .statistics-row-action,
.statistics-depot-row.clickable:focus-visible .statistics-row-action,
.statistics-dept-block.clickable:hover .statistics-row-action,
.statistics-dept-block.clickable:focus-visible .statistics-row-action {
  opacity: 1;
  transform: translateX(0);
}

.statistics-row-chevron {
  color: var(--muted);
  font-size: calc(12px * var(--ui-scale, 1));
  opacity: 0.45;
  transition: opacity 0.15s ease, transform 0.15s ease, color 0.15s ease;
}

.statistics-agent-row:hover .statistics-row-chevron {
  opacity: 1;
  color: var(--stats-calls);
  transform: translateX(2px);
}

.statistics-open-detail-btn {
  border: 1px solid var(--stats-border);
  border-radius: calc(6px * var(--ui-scale, 1));
  background: var(--surface, #fff);
  color: var(--stats-calls);
  padding: calc(3px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1));
  font: 700 calc(11.5px * var(--ui-scale, 1)) var(--font);
  cursor: pointer;
  transition: background-color 0.14s ease, border-color 0.14s ease;
}

.statistics-open-detail-btn:hover {
  background: rgba(13, 107, 92, 0.08);
  border-color: var(--stats-calls);
}

/* Fullscreen Dynamic Statistics Popup Overlay (Agent / Depot / Department) */
body.statistics-detail-open {
  overflow: hidden;
}

.statistics-detail-page,
.statistics-detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 1350;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(8px, 1.4vw, 22px);
  background: rgba(8, 17, 24, 0.56);
  backdrop-filter: blur(22px) saturate(165%);
  -webkit-backdrop-filter: blur(22px) saturate(165%);
  animation: statsOverlayBackdropIn 0.26s cubic-bezier(0.16, 1, 0.3, 1);
}

:root[data-mode="dark"] .statistics-detail-overlay {
  background: rgba(4, 9, 14, 0.68);
}

.statistics-detail-page.hidden,
.statistics-detail-overlay.hidden {
  display: none !important;
}

@keyframes statsOverlayBackdropIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes statsModalShellPopIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.975);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.statistics-detail-modal-shell {
  width: min(1620px, 100%);
  height: min(95vh, 100%);
  max-height: 95vh;
  display: flex;
  flex-direction: column;
  background: color-mix(in srgb, var(--surface, #ffffff) 93%, transparent);
  border: 1px solid color-mix(in srgb, var(--stats-border, #dce4e1) 80%, rgba(255, 255, 255, 0.35));
  border-radius: calc(18px * var(--ui-scale, 1));
  box-shadow:
    0 32px 90px rgba(4, 12, 18, 0.42),
    0 8px 28px rgba(4, 12, 18, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  overflow: hidden;
  animation: statsModalShellPopIn 0.34s cubic-bezier(0.16, 1, 0.3, 1);
}

.statistics-detail-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: calc(16px * var(--ui-scale, 1)) calc(20px * var(--ui-scale, 1)) calc(24px * var(--ui-scale, 1));
  display: flex;
  flex-direction: column;
  gap: calc(14px * var(--ui-scale, 1));
  background:
    radial-gradient(circle at 12% 0%, rgba(13, 107, 92, 0.06), transparent 38%),
    radial-gradient(circle at 88% 0%, rgba(122, 79, 143, 0.06), transparent 38%),
    var(--bg, #f4f7f6);
}

/* Sticky Top Command Bar inside Fullscreen Popup */
.statistics-detail-nav {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: calc(12px * var(--ui-scale, 1));
  padding: calc(13px * var(--ui-scale, 1)) calc(20px * var(--ui-scale, 1));
  background: color-mix(in srgb, var(--surface, #ffffff) 96%, transparent);
  border-bottom: 1px solid var(--stats-border);
  z-index: 5;
}

.statistics-popup-loader-bar {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: transparent;
  overflow: hidden;
  pointer-events: none;
}

.statistics-popup-loader-bar span {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--stats-calls), var(--stats-sms), var(--stats-email), var(--stats-calls));
  background-size: 200% 100%;
  transform: translateX(-100%);
  opacity: 0;
}

.is-loading-charts .statistics-popup-loader-bar span,
.statistics-detail-page.is-loading-charts .statistics-popup-loader-bar span {
  opacity: 1;
  animation: statsLaserSweep 1.1s cubic-bezier(0.22, 1, 0.36, 1) infinite;
}

@keyframes statsLaserSweep {
  0% {
    transform: translateX(-85%);
  }
  50% {
    transform: translateX(0%);
  }
  100% {
    transform: translateX(95%);
  }
}

.statistics-detail-nav-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: calc(12px * var(--ui-scale, 1));
}

.statistics-detail-nav-center {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: calc(10px * var(--ui-scale, 1));
}

.statistics-back-btn {
  min-height: calc(34px * var(--ui-scale, 1));
  padding: calc(6px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1));
  font-size: calc(12.5px * var(--ui-scale, 1));
  font-weight: 700;
  border-radius: calc(8px * var(--ui-scale, 1));
}

.statistics-detail-title-block h2 {
  margin: calc(2px * var(--ui-scale, 1)) 0 0;
  font-size: calc(19px * var(--ui-scale, 1));
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.statistics-detail-badges {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: calc(8px * var(--ui-scale, 1));
}

.statistics-entity-pill {
  display: inline-flex;
  align-items: center;
  padding: calc(2px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1));
  border-radius: calc(999px * var(--ui-scale, 1));
  font-size: calc(10px * var(--ui-scale, 1));
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(13, 107, 92, 0.12);
  color: var(--stats-calls);
}

.statistics-entity-pill.depot {
  background: rgba(23, 131, 95, 0.14);
  color: var(--stats-email);
}

.statistics-entity-meta {
  font-size: calc(11.5px * var(--ui-scale, 1));
  color: var(--muted);
  font-weight: 600;
}

/* Live Dynamic Status Pill */
.statistics-live-status {
  display: inline-flex;
  align-items: center;
  gap: calc(6px * var(--ui-scale, 1));
  padding: calc(2px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1));
  border-radius: 999px;
  font-size: calc(10.5px * var(--ui-scale, 1));
  font-weight: 700;
  background: rgba(13, 107, 92, 0.1);
  color: var(--stats-calls);
  transition: all 0.25s ease;
}

.statistics-live-status.is-loading {
  background: rgba(122, 79, 143, 0.14);
  color: var(--stats-sms);
}

.statistics-live-status .pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 0 currentColor;
  animation: statsStatusPulse 1.4s infinite;
}

@keyframes statsStatusPulse {
  0% {
    transform: scale(0.95);
    opacity: 1;
  }
  50% {
    transform: scale(1.25);
    opacity: 0.55;
  }
  100% {
    transform: scale(0.95);
    opacity: 1;
  }
}

/* Entity Type Tabs & Period Filter inside Popup */
.statistics-entity-type-tabs,
.statistics-chart-mode-tabs {
  display: inline-flex;
  align-items: center;
  padding: 2px;
  border-radius: calc(8px * var(--ui-scale, 1));
  background: var(--stats-bg-subtle);
  border: 1px solid var(--stats-border);
  gap: 2px;
}

.entity-type-tab,
.chart-mode-btn {
  appearance: none;
  border: 0;
  background: transparent;
  padding: calc(4px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
  border-radius: calc(6px * var(--ui-scale, 1));
  font: 700 calc(11.5px * var(--ui-scale, 1)) var(--font);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.16s ease;
}

.entity-type-tab:hover,
.chart-mode-btn:hover {
  color: var(--ink);
}

.entity-type-tab.active,
.chart-mode-btn.active {
  background: var(--surface, #fff);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.statistics-detail-nav-right {
  display: flex;
  align-items: center;
  gap: calc(8px * var(--ui-scale, 1));
}

.statistics-switcher-group {
  display: inline-flex;
  align-items: center;
  gap: calc(4px * var(--ui-scale, 1));
}

.statistics-replay-btn {
  min-height: calc(32px * var(--ui-scale, 1));
  padding: 0 calc(10px * var(--ui-scale, 1));
  font-size: calc(12px * var(--ui-scale, 1));
  font-weight: 700;
}

.statistics-step-btn {
  min-width: calc(32px * var(--ui-scale, 1));
  min-height: calc(32px * var(--ui-scale, 1));
  padding: 0 calc(8px * var(--ui-scale, 1));
  font-size: calc(16px * var(--ui-scale, 1));
  line-height: 1;
}

.statistics-detail-switcher {
  height: calc(32px * var(--ui-scale, 1));
  max-width: calc(230px * var(--ui-scale, 1));
  padding: 0 calc(26px * var(--ui-scale, 1)) 0 calc(10px * var(--ui-scale, 1));
  border: 1px solid var(--stats-border);
  border-radius: calc(7px * var(--ui-scale, 1));
  background-color: var(--surface, #fff);
  color: var(--ink);
  font: 600 calc(12.5px * var(--ui-scale, 1)) var(--font);
  cursor: pointer;
}

.statistics-popup-close-btn {
  appearance: none;
  width: calc(34px * var(--ui-scale, 1));
  height: calc(34px * var(--ui-scale, 1));
  border-radius: calc(8px * var(--ui-scale, 1));
  border: 1px solid var(--stats-border);
  background: var(--stats-bg-subtle);
  color: var(--ink);
  font-size: calc(14px * var(--ui-scale, 1));
  font-weight: 800;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.16s ease;
}

.statistics-popup-close-btn:hover {
  background: rgba(180, 35, 24, 0.12);
  border-color: rgba(180, 35, 24, 0.3);
  color: #b42318;
  transform: scale(1.04);
}

/* Detail KPI Gauge + Sparkline Cards */
.statistics-detail-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: calc(12px * var(--ui-scale, 1));
}

.statistics-detail-kpi-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: calc(8px * var(--ui-scale, 1));
  padding: calc(14px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
  border-radius: calc(14px * var(--ui-scale, 1));
  position: relative;
  overflow: hidden;
  border: 1px solid var(--stats-border);
  box-shadow: 0 6px 20px rgba(9, 22, 28, 0.04);
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 0.42s cubic-bezier(0.22, 1, 0.36, 1) calc(var(--card-idx, 0) * 55ms),
    transform 0.42s cubic-bezier(0.22, 1, 0.36, 1) calc(var(--card-idx, 0) * 55ms),
    box-shadow 0.2s ease;
}

.is-animated .statistics-detail-kpi-card,
.statistics-detail-page.is-animated .statistics-detail-kpi-card {
  opacity: 1;
  transform: translateY(0);
}

.statistics-detail-kpi-card:hover {
  box-shadow: 0 10px 26px rgba(9, 22, 28, 0.08);
}

.statistics-detail-kpi-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--stats-calls);
}

.statistics-detail-kpi-card.calls::before { background: var(--stats-calls); }
.statistics-detail-kpi-card.sms::before { background: var(--stats-sms); }
.statistics-detail-kpi-card.email::before { background: var(--stats-email); }

.detail-kpi-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(10px * var(--ui-scale, 1));
}

.detail-kpi-info {
  display: flex;
  flex-direction: column;
  gap: calc(3px * var(--ui-scale, 1));
  min-width: 0;
}

.detail-kpi-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: calc(6px * var(--ui-scale, 1));
  font-size: calc(11px * var(--ui-scale, 1));
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.detail-kpi-number {
  font-size: calc(30px * var(--ui-scale, 1));
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.detail-kpi-sub {
  font-size: calc(11px * var(--ui-scale, 1));
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-kpi-sub strong {
  color: var(--ink);
}

/* Mini KPI Sparkline */
.detail-kpi-sparkline-wrap {
  width: 100%;
  height: calc(34px * var(--ui-scale, 1));
  margin-top: calc(2px * var(--ui-scale, 1));
}

.detail-kpi-sparkline {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.sparkline-area {
  opacity: 0;
  transition: opacity 0.7s ease 0.25s;
}

.is-animated .sparkline-area,
.statistics-detail-page.is-animated .sparkline-area {
  opacity: 0.16;
}

.sparkline-area.calls,
.sparkline-area.total { fill: var(--stats-calls); }
.sparkline-area.sms { fill: var(--stats-sms); }
.sparkline-area.email { fill: var(--stats-email); }

.sparkline-line {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sparkline-line.calls,
.sparkline-line.total { stroke: var(--stats-calls); }
.sparkline-line.sms { stroke: var(--stats-sms); }
.sparkline-line.email { stroke: var(--stats-email); }

.sparkline-end-dot {
  opacity: 0;
  transform: scale(0.3);
  transform-box: fill-box;
  transform-origin: center;
  transition: opacity 0.35s ease 0.85s, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) 0.85s;
}

.is-animated .sparkline-end-dot,
.statistics-detail-page.is-animated .sparkline-end-dot {
  opacity: 1;
  transform: scale(1);
}

.sparkline-end-dot.calls,
.sparkline-end-dot.total { fill: var(--stats-calls); }
.sparkline-end-dot.sms { fill: var(--stats-sms); }
.sparkline-end-dot.email { fill: var(--stats-email); }

/* Animated Radial SVG Gauge */
.statistics-radial-wrap {
  position: relative;
  width: calc(62px * var(--ui-scale, 1));
  height: calc(62px * var(--ui-scale, 1));
  flex: 0 0 auto;
  display: grid;
  place-items: center;
}

.statistics-radial-gauge {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.statistics-radial-gauge .gauge-track {
  fill: none;
  stroke: var(--stats-bg-subtle);
  stroke-width: 5.5;
}

.statistics-radial-gauge .gauge-value {
  fill: none;
  stroke: var(--ink);
  stroke-width: 5.5;
  stroke-linecap: round;
  filter: drop-shadow(0 2px 5px rgba(13, 107, 92, 0.22));
  transition: stroke-dashoffset 1.05s cubic-bezier(0.22, 1, 0.36, 1);
}

.statistics-radial-gauge .gauge-value.calls { stroke: var(--stats-calls); }
.statistics-radial-gauge .gauge-value.sms { stroke: var(--stats-sms); filter: drop-shadow(0 2px 5px rgba(122, 79, 143, 0.24)); }
.statistics-radial-gauge .gauge-value.email { stroke: var(--stats-email); filter: drop-shadow(0 2px 5px rgba(23, 131, 95, 0.24)); }
.statistics-radial-gauge .gauge-value.total { stroke: var(--stats-calls); }

.statistics-radial-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: calc(11.5px * var(--ui-scale, 1));
  font-weight: 800;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* Detail Charts Grid (Hybrid Trend + Concentric/Benchmark) */
.statistics-detail-charts-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.62fr) minmax(calc(340px * var(--ui-scale, 1)), 1fr);
  gap: calc(14px * var(--ui-scale, 1));
  align-items: stretch;
}

.statistics-detail-chart-card,
.statistics-detail-side-card,
.statistics-detail-table-card {
  border-radius: calc(14px * var(--ui-scale, 1));
  border: 1px solid var(--stats-border);
  box-shadow: 0 8px 24px rgba(9, 22, 28, 0.045);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.statistics-detail-chart-card h3,
.statistics-detail-side-card h3,
.statistics-detail-table-card h3 {
  margin: 0;
  font-size: calc(15px * var(--ui-scale, 1));
  font-weight: 800;
  color: var(--ink);
}

.statistics-detail-chart-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: calc(10px * var(--ui-scale, 1));
}

.statistics-peak-pill {
  padding: calc(3px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
  border-radius: calc(999px * var(--ui-scale, 1));
  background: var(--stats-bg-subtle);
  border: 1px solid var(--stats-border);
  font-size: calc(11.5px * var(--ui-scale, 1));
  color: var(--muted);
}

.statistics-peak-pill strong {
  color: var(--ink);
}

/* Hybrid Trend + Animated Bar Chart */
.statistics-detail-hybrid-chart {
  display: grid;
  grid-template-columns: calc(34px * var(--ui-scale, 1)) minmax(0, 1fr);
  gap: calc(10px * var(--ui-scale, 1));
  padding: calc(16px * var(--ui-scale, 1)) calc(18px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
  flex: 1;
  align-items: stretch;
}

.statistics-detail-y-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: calc(16px * var(--ui-scale, 1)) 0 calc(24px * var(--ui-scale, 1));
  font-size: calc(11px * var(--ui-scale, 1));
  font-weight: 600;
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.statistics-detail-plot-area {
  position: relative;
  min-height: calc(255px * var(--ui-scale, 1));
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.statistics-detail-trend-svg {
  position: absolute;
  inset: 0 0 calc(24px * var(--ui-scale, 1)) 0;
  width: 100%;
  height: calc(100% - calc(24px * var(--ui-scale, 1)));
  pointer-events: none;
  z-index: 2;
  overflow: visible;
}

.trend-grid-line {
  stroke: var(--stats-border);
  stroke-width: 1;
  stroke-dasharray: 4 4;
  opacity: 0.75;
}

.trend-grid-line.base {
  stroke-dasharray: none;
  opacity: 1;
}

.trend-area-path {
  opacity: 0;
  transition: opacity 0.85s ease 0.18s;
}

.is-animated .trend-area-path,
.statistics-detail-page.is-animated .trend-area-path {
  opacity: 1;
}

.trend-line-path {
  fill: none;
  stroke: var(--stats-calls);
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 4px 8px rgba(13, 107, 92, 0.25));
}

.trend-line-path.channel-calls {
  stroke: var(--stats-calls);
  stroke-width: 2.2;
}

.trend-line-path.channel-sms {
  stroke: var(--stats-sms);
  stroke-width: 2.2;
  filter: drop-shadow(0 3px 6px rgba(122, 79, 143, 0.25));
}

.trend-line-path.channel-email {
  stroke: var(--stats-email);
  stroke-width: 2.2;
  filter: drop-shadow(0 3px 6px rgba(23, 131, 95, 0.25));
}

.trend-dot {
  fill: var(--surface, #fff);
  stroke: var(--stats-calls);
  stroke-width: 2.5;
  opacity: 0;
  transform: scale(0.2);
  transform-box: fill-box;
  transform-origin: center;
  transition:
    opacity 0.36s ease var(--dot-delay, 180ms),
    transform 0.42s cubic-bezier(0.34, 1.56, 0.64, 1) var(--dot-delay, 180ms);
}

.is-animated .trend-dot,
.statistics-detail-page.is-animated .trend-dot {
  opacity: 1;
  transform: scale(1);
}

.statistics-detail-bars-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(var(--detail-buckets, 12), minmax(calc(16px * var(--ui-scale, 1)), 1fr));
  gap: calc(4px * var(--ui-scale, 1));
  height: 100%;
  min-height: calc(245px * var(--ui-scale, 1));
  align-items: end;
}

.statistics-detail-bars-grid.is-lines-only .detail-bar-stack {
  opacity: 0.12;
}

.statistics-detail-bar-col {
  position: relative;
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  font: inherit;
  height: 100%;
  display: grid;
  grid-template-rows: calc(18px * var(--ui-scale, 1)) 1fr calc(20px * var(--ui-scale, 1));
  gap: calc(4px * var(--ui-scale, 1));
  align-items: end;
  text-align: center;
}

.statistics-detail-bar-col.is-drillable {
  cursor: pointer;
}

.statistics-detail-bar-col:hover .detail-bar-well {
  background: rgba(13, 107, 92, 0.08);
}

/* Interactive Glass Tooltip on Bar Hover */
.detail-bar-tooltip {
  position: absolute;
  bottom: calc(100% - 8px);
  left: 50%;
  transform: translate(-50%, 6px) scale(0.95);
  min-width: calc(126px * var(--ui-scale, 1));
  padding: calc(8px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
  border-radius: calc(10px * var(--ui-scale, 1));
  background: rgba(12, 22, 29, 0.92);
  backdrop-filter: blur(10px);
  color: #fff;
  font-size: calc(11px * var(--ui-scale, 1));
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: left;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
  pointer-events: none;
  opacity: 0;
  z-index: 20;
  transition: opacity 0.16s ease, transform 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}

.statistics-detail-bar-col:hover .detail-bar-tooltip,
.statistics-detail-bar-col:focus-visible .detail-bar-tooltip {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.detail-bar-tooltip strong {
  font-size: calc(11.5px * var(--ui-scale, 1));
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  padding-bottom: 3px;
  margin-bottom: 2px;
}

.detail-bar-tooltip span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: rgba(255, 255, 255, 0.82);
}

.detail-bar-tooltip span i {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 4px;
}

.detail-bar-tooltip span i.calls { background: var(--stats-calls); }
.detail-bar-tooltip span i.sms { background: var(--stats-sms); }
.detail-bar-tooltip span i.email { background: var(--stats-email); }

.detail-bar-top-val {
  font-size: calc(10.5px * var(--ui-scale, 1));
  font-weight: 700;
  color: var(--ink);
  opacity: 0;
  transform: translateY(5px);
  transition:
    opacity 0.35s ease calc(var(--bucket-idx, 0) * 20ms + 240ms),
    transform 0.35s ease calc(var(--bucket-idx, 0) * 20ms + 240ms);
}

.is-animated .detail-bar-top-val,
.statistics-detail-page.is-animated .detail-bar-top-val {
  opacity: 0.9;
  transform: translateY(0);
}

.detail-bar-well {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  border-radius: 6px 6px 2px 2px;
  transition: background-color 0.14s ease;
}

.detail-bar-stack {
  width: 72%;
  max-width: calc(28px * var(--ui-scale, 1));
  height: var(--bar-h, 0%);
  display: flex;
  flex-direction: column-reverse;
  border-radius: 6px 6px 2px 2px;
  overflow: hidden;
  transform: scaleY(0);
  transform-origin: bottom;
  box-shadow: 0 2px 8px rgba(13, 107, 92, 0.12);
}

.detail-bar-stack i {
  display: block;
  width: 100%;
}

.detail-bar-stack .calls { background: linear-gradient(180deg, color-mix(in srgb, var(--stats-calls) 88%, #fff), var(--stats-calls)); }
.detail-bar-stack .sms { background: linear-gradient(180deg, color-mix(in srgb, var(--stats-sms) 88%, #fff), var(--stats-sms)); }
.detail-bar-stack .email { background: linear-gradient(180deg, color-mix(in srgb, var(--stats-email) 88%, #fff), var(--stats-email)); }

.detail-bar-lbl {
  font-size: calc(10.5px * var(--ui-scale, 1));
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
}

/* Intensity Rhythm Heatmap Strip */
.statistics-rhythm-strip {
  display: flex;
  align-items: center;
  gap: calc(12px * var(--ui-scale, 1));
  padding: calc(8px * var(--ui-scale, 1)) calc(18px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1));
  border-top: 1px solid var(--stats-border);
  background: color-mix(in srgb, var(--stats-bg-subtle) 55%, transparent);
}

.rhythm-strip-title {
  font-size: calc(10.5px * var(--ui-scale, 1));
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  white-space: nowrap;
}

.rhythm-strip-cells {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(var(--detail-buckets, 12), minmax(0, 1fr));
  gap: 3px;
}

.rhythm-cell {
  height: calc(10px * var(--ui-scale, 1));
  border-radius: 3px;
  background: var(--stats-calls);
  opacity: 0;
  transform: scaleY(0.3);
  transition:
    opacity 0.45s ease var(--cell-delay, 0ms),
    transform 0.45s cubic-bezier(0.22, 1, 0.36, 1) var(--cell-delay, 0ms);
}

.is-animated .rhythm-cell,
.statistics-detail-page.is-animated .rhythm-cell {
  opacity: var(--cell-alpha, 0.08);
  transform: scaleY(1);
}

/* Concentric Rings + Benchmark Comparison Card */
.statistics-detail-concentric-row {
  display: grid;
  grid-template-columns: calc(146px * var(--ui-scale, 1)) minmax(0, 1fr);
  gap: calc(16px * var(--ui-scale, 1));
  align-items: center;
  padding: calc(16px * var(--ui-scale, 1));
  border-bottom: 1px solid var(--stats-border);
}

.statistics-concentric-visual {
  position: relative;
  width: calc(142px * var(--ui-scale, 1));
  height: calc(142px * var(--ui-scale, 1));
  display: grid;
  place-items: center;
}

.statistics-concentric-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.statistics-concentric-svg .concentric-track {
  fill: none;
  stroke: var(--stats-bg-subtle);
  stroke-width: 10.5;
}

.statistics-concentric-svg .concentric-arc {
  fill: none;
  stroke-width: 10.5;
  stroke-linecap: round;
  transition: stroke-dashoffset 1.15s cubic-bezier(0.22, 1, 0.36, 1);
}

.statistics-concentric-svg .concentric-arc.calls {
  stroke: var(--stats-calls);
  filter: drop-shadow(0 2px 6px rgba(13, 107, 92, 0.25));
}
.statistics-concentric-svg .concentric-arc.sms {
  stroke: var(--stats-sms);
  filter: drop-shadow(0 2px 6px rgba(122, 79, 143, 0.25));
}
.statistics-concentric-svg .concentric-arc.email {
  stroke: var(--stats-email);
  filter: drop-shadow(0 2px 6px rgba(23, 131, 95, 0.25));
}

.statistics-concentric-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.statistics-concentric-center strong {
  font-size: calc(20px * var(--ui-scale, 1));
  font-weight: 800;
  line-height: 1.05;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.statistics-concentric-center small {
  font-size: calc(10px * var(--ui-scale, 1));
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.statistics-concentric-legend {
  display: flex;
  flex-direction: column;
  gap: calc(9px * var(--ui-scale, 1));
}

.statistics-concentric-legend > div {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: calc(7px * var(--ui-scale, 1));
  font-size: calc(12px * var(--ui-scale, 1));
}

.statistics-concentric-legend span {
  color: var(--muted);
}

.statistics-concentric-legend strong {
  color: var(--ink);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Main-page Concentric Banner + Agent Mini Hybrid + Inline Bar */
.statistics-main-concentric-banner {
  padding: calc(10px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1));
  grid-template-columns: calc(120px * var(--ui-scale, 1)) minmax(0, 1fr);
  gap: calc(12px * var(--ui-scale, 1));
  margin-bottom: calc(6px * var(--ui-scale, 1));
}

.statistics-main-concentric-banner .statistics-concentric-visual {
  width: calc(116px * var(--ui-scale, 1));
  height: calc(116px * var(--ui-scale, 1));
}

.statistics-dept-items-wrap {
  display: flex;
  flex-direction: column;
  gap: calc(8px * var(--ui-scale, 1));
  padding: calc(4px * var(--ui-scale, 1)) 0;
}

.statistics-agent-mini-hybrid {
  padding: calc(8px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1)) calc(6px * var(--ui-scale, 1));
}

.statistics-agent-mini-hybrid .statistics-detail-plot-area,
.statistics-agent-mini-hybrid .statistics-detail-bars-grid {
  min-height: calc(172px * var(--ui-scale, 1));
}

.statistics-agent-inline-track {
  display: inline-flex;
  width: calc(62px * var(--ui-scale, 1));
  height: calc(6px * var(--ui-scale, 1));
  margin-right: calc(8px * var(--ui-scale, 1));
  vertical-align: middle;
}

/* Animated Benchmark Bars */
.statistics-benchmark-list {
  padding: calc(14px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1));
  display: flex;
  flex-direction: column;
  gap: calc(12px * var(--ui-scale, 1));
  flex: 1;
  justify-content: center;
}

.statistics-benchmark-item {
  display: grid;
  gap: calc(5px * var(--ui-scale, 1));
}

.statistics-benchmark-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: calc(8px * var(--ui-scale, 1));
  font-size: calc(12px * var(--ui-scale, 1));
}

.statistics-benchmark-head > span:first-child {
  display: inline-flex;
  align-items: center;
  gap: calc(6px * var(--ui-scale, 1));
}

.statistics-benchmark-vals small {
  color: var(--muted);
  font-size: calc(11px * var(--ui-scale, 1));
}

.statistics-benchmark-bars {
  display: grid;
  gap: calc(4px * var(--ui-scale, 1));
}

.benchmark-track {
  height: calc(7px * var(--ui-scale, 1));
  border-radius: 999px;
  background: var(--stats-bg-subtle);
  overflow: hidden;
}

.benchmark-track.avg {
  height: calc(4px * var(--ui-scale, 1));
}

.benchmark-fill {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--stats-calls);
}

.benchmark-fill.calls { background: linear-gradient(90deg, var(--stats-calls), color-mix(in srgb, var(--stats-calls) 80%, #fff)); }
.benchmark-fill.sms { background: linear-gradient(90deg, var(--stats-sms), color-mix(in srgb, var(--stats-sms) 80%, #fff)); }
.benchmark-fill.email { background: linear-gradient(90deg, var(--stats-email), color-mix(in srgb, var(--stats-email) 80%, #fff)); }
.benchmark-fill.total { background: linear-gradient(90deg, var(--ink), var(--stats-calls)); }
.benchmark-fill.avg { background: var(--muted); opacity: 0.45; }

/* Detail Table Animated Bars */
.statistics-detail-table-scroll {
  max-height: calc(340px * var(--ui-scale, 1));
  overflow-y: auto;
}

.detail-load-cell {
  width: 34%;
  min-width: calc(140px * var(--ui-scale, 1));
}

.detail-anim-bar {
  width: 0%;
}

.is-zero-row td {
  opacity: 0.55;
}

@media (max-width: 1180px) {
  .statistics-detail-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .statistics-detail-charts-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .statistics-detail-overlay {
    padding: 0;
  }
  .statistics-detail-modal-shell {
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
  .statistics-detail-kpi-grid {
    grid-template-columns: 1fr;
  }
  .statistics-detail-concentric-row {
    grid-template-columns: 1fr;
    justify-items: center;
  }
  .statistics-concentric-legend {
    width: 100%;
  }
}

/* Readability scale: enlarge content text only. Controls, badges, labels,
   icons, padding and card dimensions deliberately keep their compact size. */
.page-heading h1,
.customer-detail-heading h3,
.modal-card h2,
.incoming-call h2 {
  font-size: calc(28.6px * var(--ui-scale, 1));
}

.customer-detail-heading h3 { font-size: calc(19.8px * var(--ui-scale, 1)); }
.modal-card h2 { font-size: calc(22px * var(--ui-scale, 1)); }
.incoming-call h2 { font-size: calc(27.5px * var(--ui-scale, 1)); }

.page-heading > div > p:not(.eyebrow),
.modal-description { font-size: calc(14.3px * var(--ui-scale, 1)); }
.page-heading > div > p:not(.eyebrow) { font-size: calc(14.85px * var(--ui-scale, 1)); }
.surface-heading p,
.rail-heading p,
.customer-detail-heading small,
.service-card p { font-size: calc(12.65px * var(--ui-scale, 1)); }
.customer-detail-heading p { font-size: calc(13.75px * var(--ui-scale, 1)); }

.surface-heading h2,
.rail-heading h2,
.thread-panel-head h2,
.statistics-channel-heading h2 {
  font-size: calc(16.5px * var(--ui-scale, 1));
}
.conversation-head h2 { font-size: calc(17.6px * var(--ui-scale, 1)); }
.history-column-heading h3,
.recent-contact-section h3 { font-size: calc(14.3px * var(--ui-scale, 1)); }

.metric-card span,
.search-card-main p,
.customer-name small,
.customer-contact,
.thread-item p { font-size: calc(12.65px * var(--ui-scale, 1)); }
.metric-card small,
.thread-meta,
.email-forwarded-card header strong { font-size: calc(12px * var(--ui-scale, 1)); }
.email-message-card-head span,
.email-message-card-head time { font-size: calc(12px * var(--ui-scale, 1)); }
.email-forwarded-body { font-size: calc(13.31px * var(--ui-scale, 1)); }
.statistics-channel-values span,
.statistics-channel-secondary,
.statistics-method-note { font-size: calc(12px * var(--ui-scale, 1)); }
.statistics-depot-demand-name small,
.statistics-depot-demand-values,
.statistics-table td small { font-size: calc(12px * var(--ui-scale, 1)); }
.statistics-table { font-size: calc(12px * var(--ui-scale, 1)); }

.metric-card strong,
.statistics-channel-heading > strong,
.statistics-depot-demand-total {
  font-size: calc(19.8px * var(--ui-scale, 1));
}
.metric-card strong { font-size: calc(25.3px * var(--ui-scale, 1)); }
.service-card strong { font-size: calc(18.7px * var(--ui-scale, 1)); }

.search-card-main strong,
.customer-name strong,
.thread-item strong { font-size: calc(14.3px * var(--ui-scale, 1)); }
.history-message strong,
.email-message-card-head strong { font-size: calc(13.2px * var(--ui-scale, 1)); }
.statistics-depot-demand-name strong,
.statistics-table td strong { font-size: calc(12.1px * var(--ui-scale, 1)); }

.message-bubble { font-size: calc(14.85px * var(--ui-scale, 1)); }
.history-message p,
.email-rich-editor { font-size: calc(13.2px * var(--ui-scale, 1)); }
.email-body-html { font-size: calc(14.52px * var(--ui-scale, 1)); }

.call-number { font-size: calc(19.8px * var(--ui-scale, 1)); }
.call-details strong { font-size: calc(15.4px * var(--ui-scale, 1)); }
.recent-message p { font-size: calc(13.2px * var(--ui-scale, 1)); }

@media (max-width: 600px) {
  .incoming-call h2 { font-size: calc(22px * var(--ui-scale, 1)); }
}

/* Persistent workspace theme */
.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(8px * var(--ui-scale, 1));
  padding: 0 calc(6px * var(--ui-scale, 1)) calc(20px * var(--ui-scale, 1));
  flex-shrink: 0;
}

.brand-row .brand {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0;
  white-space: nowrap;
}

.sidebar-header-actions {
  display: flex;
  align-items: center;
  gap: calc(6px * var(--ui-scale, 1));
  flex: 0 0 auto;
}

.sidebar-header-actions .softphone-toggle,
.sidebar-header-actions .notification-toggle,
.sidebar-header-actions .theme-toggle {
  width: calc(34px * var(--ui-scale, 1)) !important;
  height: calc(34px * var(--ui-scale, 1)) !important;
  flex: 0 0 calc(34px * var(--ui-scale, 1)) !important;
  display: grid !important;
  place-items: center !important;
  padding: 0 !important;
  border: calc(1px * var(--ui-scale, 1)) solid #1f4239 !important;
  border-radius: calc(12px * var(--ui-scale, 1)) !important;
  background: #17352e !important;
  color: #9db0a8 !important;
  cursor: pointer;
  transition: all .2s ease;
  box-sizing: border-box;
}

.sidebar-header-actions .softphone-toggle:hover:not(.active),
.sidebar-header-actions .notification-toggle:hover,
.sidebar-header-actions .theme-toggle:hover {
  background: #1e453c !important;
  border-color: #2b594d !important;
  color: #fff !important;
  transform: translateY(calc(-1px * var(--ui-scale, 1)));
}

.sidebar-header-actions .softphone-toggle svg {
  width: calc(17px * var(--ui-scale, 1));
  height: calc(17px * var(--ui-scale, 1));
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-header-actions .softphone-toggle.active {
  color: #fff !important;
  background: #15714e !important;
  border-color: #2fa678 !important;
  box-shadow: 0 0 0 calc(3px * var(--ui-scale, 1)) rgba(47, 166, 120, .25) !important;
}

.sidebar-header-actions .notification-toggle {
  font-size: calc(16px * var(--ui-scale, 1)) !important;
  line-height: 1 !important;
}

.sidebar-header-actions .notification-toggle.notification-enabled {
  background: rgba(138, 208, 192, 0.16) !important;
  border-color: #2fa678 !important;
  color: #8ad0c0 !important;
}

.sidebar-header-actions .notification-toggle.notification-disabled {
  background: #17352e !important;
  border-color: #1f4239 !important;
  color: #728a82 !important;
  opacity: 0.75;
}

.sidebar-header-actions .notification-toggle.notification-blocked {
  background: rgba(220, 38, 38, 0.15) !important;
  border-color: #dc2626 !important;
  color: #f87171 !important;
}

.theme-toggle {
  width: calc(34px * var(--ui-scale, 1));
  height: calc(34px * var(--ui-scale, 1));
  flex: 0 0 calc(34px * var(--ui-scale, 1));
  display: grid;
  place-items: center;
  padding: 0;
  border: calc(1px * var(--ui-scale, 1)) solid #334155;
  border-radius: calc(12px * var(--ui-scale, 1));
  background: #17352e;
  color: #64748b;
  cursor: pointer;
  transition: color .2s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.theme-toggle:hover { color: #cfd8d2; border-color: #4c5c54; transform: translateY(calc(-1px * var(--ui-scale, 1))); }
.theme-toggle:focus-visible { outline: calc(2px * var(--ui-scale, 1)) solid #9ccfbf; outline-offset: calc(2px * var(--ui-scale, 1)); }
.theme-toggle svg { width: calc(19px * var(--ui-scale, 1)); height: calc(19px * var(--ui-scale, 1)); fill: currentColor; }
.theme-toggle { position: relative; }
html[data-theme="dark"] .theme-toggle,
.theme-toggle[aria-expanded="true"] {
  color: #d99a3d;
  background: rgba(217, 154, 61, .12);
  border-color: rgba(217, 154, 61, .55);
  box-shadow: 0 0 calc(16px * var(--ui-scale, 1)) rgba(217, 154, 61, .16);
}
html[data-theme="dark"] .theme-toggle:hover,
.theme-toggle[aria-expanded="true"]:hover { color: #e8b45e; border-color: #d99a3d; }

/* Theme picker (Fjord / Havn / Terrakotta / Grafitt x lys / mørk) */
.theme-picker-trigger .theme-icon-sun { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.theme-picker-trigger .theme-icon-moon { display: none; }
html[data-theme="dark"] .theme-picker-trigger .theme-icon-sun { display: none; }
html[data-theme="dark"] .theme-picker-trigger .theme-icon-moon { display: block; }
.theme-trigger-dot {
  position: absolute; right: calc(4px * var(--ui-scale, 1)); bottom: calc(4px * var(--ui-scale, 1)); width: calc(8px * var(--ui-scale, 1)); height: calc(8px * var(--ui-scale, 1)); border-radius: 50%;
  background: var(--blue); box-shadow: 0 0 0 calc(2px * var(--ui-scale, 1)) var(--sidebar);
}
.theme-picker-topbar { display: none !important; position: relative; }
.theme-picker-topbar svg { width: calc(18px * var(--ui-scale, 1)); height: calc(18px * var(--ui-scale, 1)); fill: currentColor; }
.theme-picker-topbar .theme-trigger-dot { box-shadow: 0 0 0 calc(2px * var(--ui-scale, 1)) var(--surface); right: calc(3px * var(--ui-scale, 1)); bottom: calc(3px * var(--ui-scale, 1)); }
@media (max-width: 900px) {
  .theme-picker-topbar { display: inline-flex !important; align-items: center; justify-content: center; width: calc(44px * var(--ui-scale, 1)); min-width: calc(44px * var(--ui-scale, 1)); height: calc(44px * var(--ui-scale, 1)); min-height: calc(44px * var(--ui-scale, 1)); padding: 0 !important; }
  .theme-picker-topbar .theme-icon-moon { display: none; }
  html[data-theme="dark"] .theme-picker-topbar .theme-icon-moon { display: block; }
}
.theme-picker {
  position: fixed; z-index: 60; width: calc(340px * var(--ui-scale, 1)); max-width: calc(100vw - calc(24px * var(--ui-scale, 1)));
  background: var(--surface); color: var(--ink); border: calc(1px * var(--ui-scale, 1)) solid var(--line); border-radius: calc(16px * var(--ui-scale, 1));
  box-shadow: 0 calc(18px * var(--ui-scale, 1)) calc(48px * var(--ui-scale, 1)) rgba(15, 23, 42, .22); padding: calc(14px * var(--ui-scale, 1));
}
.theme-picker[hidden] { display: none; }
.theme-picker-head h2 { font: 700 calc(15px * var(--ui-scale, 1)) var(--display); margin: 0 0 calc(3px * var(--ui-scale, 1)); letter-spacing: calc(-.2px * var(--ui-scale, 1)); }
.theme-picker-head p { margin: 0 0 calc(10px * var(--ui-scale, 1)); font-size: calc(12px * var(--ui-scale, 1)); color: var(--muted); line-height: 1.4; }
.theme-picker-list { list-style: none; margin: 0; padding: 0; display: grid; gap: calc(6px * var(--ui-scale, 1)); }
.theme-option {
  display: flex; align-items: center; gap: calc(10px * var(--ui-scale, 1)); padding: calc(7px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1)); border-radius: calc(12px * var(--ui-scale, 1)); border: calc(1px * var(--ui-scale, 1)) solid transparent;
}
.theme-option.is-active { border-color: var(--line); background: var(--canvas); }
.theme-option-text { flex: 1; min-width: 0; }
.theme-option-text strong { display: flex; align-items: center; gap: calc(6px * var(--ui-scale, 1)); font-size: calc(14px * var(--ui-scale, 1)); }
.theme-option.is-active .theme-option-text strong::after {
  content: 'Aktiv'; font-size: calc(12px * var(--ui-scale, 1)); font-weight: 700; color: var(--blue); background: var(--blue-soft); border-radius: calc(10px * var(--ui-scale, 1)); padding: calc(1px * var(--ui-scale, 1)) calc(7px * var(--ui-scale, 1));
}
.theme-option-text small { display: block; font-size: calc(12px * var(--ui-scale, 1)); color: var(--muted); margin-top: calc(1px * var(--ui-scale, 1)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.theme-swatch { flex: 0 0 calc(34px * var(--ui-scale, 1)); width: calc(34px * var(--ui-scale, 1)); height: calc(34px * var(--ui-scale, 1)); border-radius: calc(10px * var(--ui-scale, 1)); overflow: hidden; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; box-shadow: inset 0 0 0 calc(1px * var(--ui-scale, 1)) rgba(15, 23, 42, .12); }
.theme-swatch i:first-child { grid-row: 1 / 3; }
.theme-swatch--fjord i:nth-child(1) { background: #0e2c26; }
.theme-swatch--fjord i:nth-child(2) { background: #0d6b5c; }
.theme-swatch--fjord i:nth-child(3) { background: #f7f8fa; }
.theme-swatch--havn i:nth-child(1) { background: #0b1f3a; }
.theme-swatch--havn i:nth-child(2) { background: #1d4ed8; }
.theme-swatch--havn i:nth-child(3) { background: #f1f5fa; }
.theme-swatch--terrakotta i:nth-child(1) { background: #24282c; }
.theme-swatch--terrakotta i:nth-child(2) { background: #a8441c; }
.theme-swatch--terrakotta i:nth-child(3) { background: #f8f1e8; }
.theme-swatch--grafitt i:nth-child(1) { background: #151515; }
.theme-swatch--grafitt i:nth-child(2) { background: #c0176a; }
.theme-swatch--grafitt i:nth-child(3) { background: #f3f3f3; }
.theme-mode-buttons { display: flex; gap: calc(4px * var(--ui-scale, 1)); }
.theme-mode-btn {
  width: calc(40px * var(--ui-scale, 1)); height: calc(40px * var(--ui-scale, 1)); display: grid; place-items: center; padding: 0; cursor: pointer;
  border: calc(1px * var(--ui-scale, 1)) solid var(--line); border-radius: calc(12px * var(--ui-scale, 1)); background: var(--surface); color: var(--muted);
}
.theme-mode-btn svg { width: calc(18px * var(--ui-scale, 1)); height: calc(18px * var(--ui-scale, 1)); fill: currentColor; }
.theme-mode-btn[data-theme-mode="light"] svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.theme-mode-btn:hover { color: var(--ink); border-color: var(--muted); }
.theme-mode-btn[aria-pressed="true"] { color: var(--blue); background: var(--blue-soft); border: calc(2px * var(--ui-scale, 1)) solid var(--blue); }
.theme-mode-btn:focus-visible { outline: calc(2px * var(--ui-scale, 1)) solid var(--blue); outline-offset: calc(2px * var(--ui-scale, 1)); }
@media (max-width: 900px) {
  .theme-picker.is-sheet { left: calc(12px * var(--ui-scale, 1)) !important; right: calc(12px * var(--ui-scale, 1)); top: calc(68px * var(--ui-scale, 1)) !important; width: auto; max-width: calc(420px * var(--ui-scale, 1)); margin: 0 auto; }
  .theme-mode-btn { width: calc(44px * var(--ui-scale, 1)); height: calc(44px * var(--ui-scale, 1)); }
  .theme-option { padding: calc(6px * var(--ui-scale, 1)); }
}
@media (max-width: 380px) {
  .theme-option-text small { display: none; }
}

html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e7edf7;
  --muted: #9aa9bc;
  --line: #29384b;
  --canvas: #0b1220;
  --surface: #111c2c;
  --blue: #60a5fa;
  --blue-dark: #3b82f6;
  --blue-soft: #172b47;
  --green: #4ade80;
  --green-soft: #102c24;
  --violet: #a78bfa;
  --violet-soft: #272142;
  --orange: #fb923c;
  --orange-soft: #382416;
  --red: #f87171;
  --sidebar: #080e19;
  --sidebar-muted: #9aa8bb;
}

html[data-theme="dark"] body,
html[data-theme="dark"] .main-content,
html[data-theme="dark"] .content-scroll { background: var(--canvas); color: var(--ink); }

html[data-theme="dark"] .sidebar { background: var(--sidebar); }
html[data-theme="dark"] .workspace-switcher,
html[data-theme="dark"] .queue-card-wrapper { background: #111c2c !important; border-color: #29384b !important; }
html[data-theme="dark"] .nav-item.active { background: #1d2b40; }
html[data-theme="dark"] .nav-item:hover { background: #172438; }
html[data-theme="dark"] .sidebar-footer { border-color: #243247; }

html[data-theme="dark"] .topbar {
  background: rgba(11, 18, 32, .94);
  border-color: var(--line);
}

html[data-theme="dark"] .mobile-menu { color: var(--ink); }
html[data-theme="dark"] .global-search,
html[data-theme="dark"] .lookup-input-wrap,
html[data-theme="dark"] .activity-log-search,
html[data-theme="dark"] .email-list-search,
html[data-theme="dark"] .email-search {
  background: #0f172a;
  border-color: #334155;
  color: #94a3b8;
}

html[data-theme="dark"] .global-search input,
html[data-theme="dark"] .lookup-input-wrap input,
html[data-theme="dark"] .activity-log-search input,
html[data-theme="dark"] .email-list-search input,
html[data-theme="dark"] .email-search input { color: var(--ink); background: transparent; }
html[data-theme="dark"] .global-search kbd { color: #9db0a8; background: #1d2a3d; }

html[data-theme="dark"] .button-secondary,
html[data-theme="dark"] .small-action,
html[data-theme="dark"] .directory-type-tab,
html[data-theme="dark"] .activity-filter-btn,
html[data-theme="dark"] .ticket-filter-btn,
html[data-theme="dark"] .statistics-period-button,
html[data-theme="dark"] .statistics-day-drilldown button,
html[data-theme="dark"] .email-forward-mode-button,
html[data-theme="dark"] .email-wide-toggle,
html[data-theme="dark"] .customer-favorite-button {
  color: #cbd5e1;
  background: #111c2c;
  border-color: #334155;
}

html[data-theme="dark"] .button-secondary:hover,
html[data-theme="dark"] .small-action:hover,
html[data-theme="dark"] .directory-type-tab:hover,
html[data-theme="dark"] .activity-filter-btn:hover,
html[data-theme="dark"] .ticket-filter-btn:hover { background: #1e293b; border-color: #3a4b66; }

html[data-theme="dark"] .directory-type-tab.active,
html[data-theme="dark"] .activity-filter-btn.active,
html[data-theme="dark"] .ticket-filter-btn.active,
html[data-theme="dark"] .statistics-period-button.active { color: #93c5fd; background: var(--blue-soft); border-color: #1e3a5f; }

html[data-theme="dark"] :is(input, textarea, select, [contenteditable="true"]) {
  color: var(--ink);
  caret-color: #93c5fd;
}

html[data-theme="dark"] :is(.email-filter, .email-recipient select, .ticket-select, .statistics-department-filter select, .statistics-agent-select select, .statistics-week-select, .utility-rail select, .customer-form input, .customer-form select, .message-template-form input, .message-template-form textarea, .admin-company-toolbar select, .admin-agent-fields input, .admin-agent-fields select, .admin-agent-search-field input) {
  color: var(--ink);
  background-color: #0f172a;
  border-color: #334155;
}

html[data-theme="dark"] :is(.surface, .metric-card, .thread-panel, .utility-rail, .modal-card, .search-card, .customer-history-column, .history-message, .email-folder-tabs, .email-more-menu, .email-message-card, .email-forwarded-card, .admin-company-toolbar, .admin-mailbox-card, .admin-agent-directory-toolbar, .statistics-response-time-card, .statistics-ring-item, .statistics-channel-card, .statistics-chart-card, .statistics-department-card, .statistics-depot-card, .statistics-depot-demand-card, .statistics-agent-card, .statistics-ring-modal-card, .modal-channel-card) {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
}

html[data-theme="dark"] :is(.surface, .metric-card):hover { box-shadow: 0 calc(4px * var(--ui-scale, 1)) calc(18px * var(--ui-scale, 1)) rgba(0, 0, 0, .18); }
html[data-theme="dark"] :is(.page-heading h1, .surface-heading h2, .rail-heading h2, .thread-panel-head h2, .conversation-head h2, .customer-detail-heading h3, .modal-card h2, .metric-card strong, .customer-name strong, .search-card-main strong, .thread-item strong, .history-message strong, .statistics-card-heading h2, .statistics-channel-heading h2, .statistics-channel-heading > strong, .statistics-response-time-card strong, .statistics-depot-demand-name strong, .statistics-depot-demand-total, .statistics-table td strong, .statistics-ring-header-row h3, .statistics-ring-copy h3, .statistics-ring-copy strong, .modal-ring-center strong, .modal-channel-stat-item strong, .admin-company-context strong, .admin-agent-directory-heading strong) { color: var(--ink); }

html[data-theme="dark"] :is(.page-heading > div > p:not(.eyebrow), .surface-heading p, .rail-heading p, .modal-description, .metric-card span, .metric-card small, .customer-name small, .customer-contact, .thread-item p, .thread-meta, .statistics-card-heading p, .statistics-channel-values span, .statistics-channel-secondary, .statistics-method-note) { color: var(--muted); }

html[data-theme="dark"] .call-log-list { border-color: var(--line); }
html[data-theme="dark"] .call-log { border-color: #243247 !important; }
html[data-theme="dark"] .call-log-list::-webkit-scrollbar-track { background: #0b1220; }
html[data-theme="dark"] .call-log-list::-webkit-scrollbar-thumb { background: #3a4b66; }
html[data-theme="dark"] .empty-state { color: #94a3b8; border-color: #334155; }

html[data-theme="dark"] .thread-panel { border-color: var(--line); }
html[data-theme="dark"] .thread-item { border-color: #243247; }
html[data-theme="dark"] .thread-item:hover { background: #172438; }
html[data-theme="dark"] .thread-item.active,
html[data-theme="dark"] .thread-item.unread-thread { background: #172b47; border-left-color: #60a5fa; }
html[data-theme="dark"] .conversation-head,
html[data-theme="dark"] .email-tools,
html[data-theme="dark"] .email-recipient,
html[data-theme="dark"] .directory-toolbar { border-color: var(--line); }
html[data-theme="dark"] .message-history { background: linear-gradient(#0b1220, #0b1220); }
html[data-theme="dark"] .message-bubble { color: #e2e8f0; background: #172438; }
html[data-theme="dark"] .message-row.agent .message-bubble { color: #fff; background: #1d4ed8; }

html[data-theme="dark"] .email-message-card-head,
html[data-theme="dark"] .email-forwarded-card header,
html[data-theme="dark"] .email-format-toolbar,
html[data-theme="dark"] .email-attachments,
html[data-theme="dark"] .email-forward-selection-bar {
  color: var(--ink);
  background: #1e293b;
  border-color: var(--line);
}
html[data-theme="dark"] .email-message-card.agent .email-message-card-head { background: #172b47; }
html[data-theme="dark"] .email-message-card-head strong,
html[data-theme="dark"] .email-body-html,
html[data-theme="dark"] .email-forwarded-body,
html[data-theme="dark"] .email-rich-editor { color: #e2e8f0; }
/* Dark mode reads e-mail text in the theme's colour, except inside a table
   cell that has its own colour (an Excel header): that cell keeps its colour
   and its text colour, as the sender made it. */
html[data-theme="dark"] .email-body-html :is(p, span, div, td, th, strong, em, blockquote):not(:is(td, th)[style*="background"], :is(td, th)[style*="background"] *, [bgcolor], [bgcolor] *) { color: inherit !important; background-color: transparent !important; }
html[data-theme="dark"] .email-body-html :is(td, th) { border-color: rgba(255, 255, 255, .28) !important; }
html[data-theme="dark"] .email-body-html a { color: #93c5fd !important; }
html[data-theme="dark"] .email-body-html blockquote { color: #94a3b8; background: #1e293b; border-color: #475569; }
html[data-theme="dark"] .email-topic-separator span { background: #0b1220; }
html[data-theme="dark"] .email-topic-separator::before { background: var(--line); }
html[data-theme="dark"] .email-attachment-chip,
html[data-theme="dark"] .email-message-file-attachment,
html[data-theme="dark"] .email-message-image-attachment { color: #93c5fd; background: #132033; border-color: #1e3a5f; }

html[data-theme="dark"] .customer-row { border-color: #243247; }
html[data-theme="dark"] .customer-row.clickable-row:hover { background: #152033; }
html[data-theme="dark"] .customer-info-grid,
html[data-theme="dark"] .call-details div,
html[data-theme="dark"] .recent-contact-section { color: var(--ink); background: #152033; border-color: var(--line); }
html[data-theme="dark"] .history-message.agent-message { background: #172b47; border-color: #1e3a5f; }

html[data-theme="dark"] .modal-close,
html[data-theme="dark"] .icon-button { color: #9db0a8; }
html[data-theme="dark"] .modal-close:hover,
html[data-theme="dark"] .icon-button:hover { color: var(--ink); background: #172438; }
html[data-theme="dark"] .admin-agent-form-actions { background: var(--surface); border-color: var(--line); }
html[data-theme="dark"] .admin-agent-empty { color: var(--muted); background: #0f172a; border-color: #334155; }

html[data-theme="dark"] .statistics-day-drilldown { background: #132033; border-color: #1e3a5f; }
html[data-theme="dark"] .statistics-chart-grid { background: repeating-linear-gradient(to bottom, transparent 0, transparent calc(43px * var(--ui-scale, 1)), #29384b calc(44px * var(--ui-scale, 1))); border-color: #334155; }
html[data-theme="dark"] .statistics-bar-group.selectable:hover { background: #172b47; }
html[data-theme="dark"] :is(.statistics-progress, .statistics-depot-demand-track, .statistics-hourly-track) { background: #29384b; }
html[data-theme="dark"] .statistics-depot-demand-row,
html[data-theme="dark"] .statistics-table td,
html[data-theme="dark"] .statistics-table th { border-color: #29384b; }
html[data-theme="dark"] .statistics-table th { color: #9db0a8; background: #111c2c; }
html[data-theme="dark"] .statistics-agent-grid line { stroke: #334155; }
html[data-theme="dark"] .statistics-agent-axis-label { fill: #94a3b8; }
html[data-theme="dark"] .statistics-ring-modal-rings-wrap,
html[data-theme="dark"] .statistics-ring-modal-distribution { background: #0f172a; border-color: var(--line); }
html[data-theme="dark"] .statistics-ring-modal-header { border-color: var(--line); }

html[data-theme="dark"] .live-search-overlay { background: rgba(11, 18, 32, .98); border-color: var(--line); }
html[data-theme="dark"] .toast { background: #1e293b; color: #f2f7f3; }

@media (prefers-reduced-motion: reduce) {
  .theme-toggle { transition: none; }
}

/* Theme-following colours that app.js paints inline (statistics agents, queue-profile label).
   Theme files override these; values here are the Fjord defaults. */
:root {
  --stats-agent-1: #0d6b5c; --stats-agent-2: #7a4f8f; --stats-agent-3: #17835f; --stats-agent-4: #b5670f; --stats-agent-5: #b34d7a;
  --stats-agent-6: #0f8a76; --stats-agent-7: #7d8f1f; --stats-agent-8: #a55db8; --stats-agent-9: #4b5a54; --stats-agent-10: #b03d3d;
  --queue-profile-label: #8ad0c0;
}

/* Dark theme surface harmonization: remove bright islands without flattening hierarchy. */
html[data-theme="dark"] {
  --dark-surface-low: #0b1220;
  --dark-surface-mid: #111c2c;
  --dark-surface-high: #152033;
  --dark-border-soft: #29384b;
  --dark-border-strong: #334155;
}

html[data-theme="dark"] .user-menu {
  color: #e2e8f0 !important;
  background: var(--dark-surface-high) !important;
  border-color: var(--dark-border-strong) !important;
  box-shadow: 0 calc(8px * var(--ui-scale, 1)) calc(24px * var(--ui-scale, 1)) rgba(0, 0, 0, .18) !important;
}
html[data-theme="dark"] .user-menu:hover { background: #1e293b !important; }
html[data-theme="dark"] .active-agent-label { color: #e7edf7 !important; }
html[data-theme="dark"] :is(.workspace-avatar, .user-avatar, .service-icon, .queue-btn-icon) {
  color: #93c5fd;
  background: #1e293b;
}
html[data-theme="dark"] .utility-rail .service-card-heading .service-icon {
  color: #93c5fd;
  background: #1e293b;
}

html[data-theme="dark"] :is(.service-card, .quick-action, .location-cell) {
  color: var(--ink);
  background: var(--dark-surface-high);
  border-color: var(--dark-border-soft);
}
html[data-theme="dark"] .service-card { background: linear-gradient(145deg, #152033, #111c2c); }
html[data-theme="dark"] .quick-action:hover { background: #1e293b; }
html[data-theme="dark"] :is(.service-card h2, .service-card p, .field-label, .location-cell) { color: #94a3b8; }

html[data-theme="dark"] :is(.import-format-hint, .email-recipient-bar, #email-tab .ticket-compose-area) {
  color: #94a3b8;
  background: var(--dark-surface-mid);
  border-color: var(--dark-border-soft);
}
html[data-theme="dark"] :is(.location-pill, .customer-code) {
  color: #c4b5fd !important;
  background: #272142 !important;
}

html[data-theme="dark"] :is(#email-tab .email-toolbar-tabs, #sms-tab .sms-filter-bar, .email-folder-tabs) {
  background: var(--dark-surface-high);
  border-color: var(--dark-border-strong);
  box-shadow: inset 0 calc(1px * var(--ui-scale, 1)) 0 rgba(255, 255, 255, .025);
}
html[data-theme="dark"] #email-tab .email-toolbar-tabs :is(.email-folder-btn, .ticket-filter-btn),
html[data-theme="dark"] #sms-tab .sms-filter-bar .ticket-filter-btn {
  color: #94a3b8;
  background: var(--dark-surface-mid);
  border-color: var(--dark-border-soft);
}
html[data-theme="dark"] #email-tab .email-toolbar-tabs :is(.email-folder-btn, .ticket-filter-btn):hover,
html[data-theme="dark"] #sms-tab .sms-filter-bar .ticket-filter-btn:hover {
  color: #e2e8f0;
  background: #1e293b;
  border-color: #475569;
}
html[data-theme="dark"] #email-tab .email-toolbar-tabs :is(.email-folder-btn, .ticket-filter-btn).active,
html[data-theme="dark"] #sms-tab .sms-filter-bar .ticket-filter-btn.active {
  color: #93c5fd;
  background: #123524;
  border-color: #3d5f4c;
}
html[data-theme="dark"] #email-tab .email-toolbar-tabs :is(.email-folder-btn, .ticket-filter-btn) span,
html[data-theme="dark"] #email-tab .email-toolbar-tabs .filter-count,
html[data-theme="dark"] #sms-tab .sms-filter-bar .filter-count,
html[data-theme="dark"] .filter-count {
  color: #cbd5e1;
  background: #1e293b;
}
html[data-theme="dark"] #email-tab .email-toolbar-tabs .active :is(span, .filter-count),
html[data-theme="dark"] #sms-tab .sms-filter-bar .active .filter-count {
  color: #fff;
  background: #2563eb;
}

html[data-theme="dark"] #email-tab .message-history {
  background: linear-gradient(180deg, #0b1220, #080e19);
}
html[data-theme="dark"] #email-tab :is(.email-recipient-bar, .email-composer, .email-subject-row, .email-attachments, .email-format-toolbar) {
  background: var(--dark-surface-mid);
  border-color: var(--dark-border-soft);
}
html[data-theme="dark"] #email-tab :is(.recipient-row input, .email-rich-editor, .email-subject-row input, .email-format-select) {
  color: #e2e8f0;
  background: var(--dark-surface-low);
  border-color: var(--dark-border-strong);
}
html[data-theme="dark"] #email-tab .recipient-row input[readonly] {
  color: #94a3b8;
  background: #0f172a;
  border-color: var(--dark-border-soft);
}
html[data-theme="dark"] #email-tab .recipient-row label { color: #94a3b8; }
html[data-theme="dark"] #email-tab :is(.email-rich-editor, input)::placeholder { color: #94a3b8; }
html[data-theme="dark"] #email-tab :is(.email-message-image-preview, .email-message-image-preview img, .email-attachment-preview) {
  background: var(--dark-surface-low);
  border-color: var(--dark-border-soft);
}

html[data-theme="dark"] :is(.template-menu, .email-more-menu, .agent-admin-card, .agent-admin-card-header) {
  color: var(--ink);
  background: var(--dark-surface-high);
  border-color: var(--dark-border-soft);
}
html[data-theme="dark"] .template-insert-button { color: #e2e8f0; }
html[data-theme="dark"] .template-insert-button:hover { background: #1e293b; }
html[data-theme="dark"] .agent-admin-card.is-expanded .agent-admin-card-header { background: #1e293b; border-color: var(--dark-border-soft); }
html[data-theme="dark"] .agent-admin-delete { background: var(--dark-surface-mid); border-color: var(--dark-border-soft); }
html[data-theme="dark"] .agent-admin-section-heading strong { color: #e2e8f0; }
html[data-theme="dark"] :is(.agent-account-status.not_invited, .badge-closed, .badge-draft) { color: #cbd5e1; background: #29384b; }
html[data-theme="dark"] .badge-open { color: #93c5fd; background: #123524; }
html[data-theme="dark"] .badge-progress { color: #fbbf24; background: #382416; }
html[data-theme="dark"] .badge-waiting { color: #c4b5fd; background: #272142; }
html[data-theme="dark"] .badge-resolved { color: #4ade80; background: #123524; }

html[data-theme="dark"] .statistics-agent-hourly {
  background: linear-gradient(145deg, #132033, #111c2c);
  border-color: var(--dark-border-soft);
}
html[data-theme="dark"] :is(.statistics-agent-select select, .statistics-agent-key) {
  color: #cbd5e1;
  background: var(--dark-surface-high);
  border-color: var(--dark-border-soft);
}
html[data-theme="dark"] .statistics-agent-key:hover { background: #1e293b; }
html[data-theme="dark"] .statistics-response-time-card.sms .statistics-response-time-icon,
html[data-theme="dark"] .statistics-channel-card.sms .statistics-channel-icon { color: #c4b5fd; background: #272142; }
html[data-theme="dark"] .statistics-response-time-card.email .statistics-response-time-icon,
html[data-theme="dark"] .statistics-channel-card.email .statistics-channel-icon { color: #93c5fd; background: #102c24; }

/* Keep global-search results calm while scanning contacts in dark mode. */
html[data-theme="dark"] .live-search-card {
  border-bottom-color: #1e293b;
}
html[data-theme="dark"] .live-search-card:hover,
html[data-theme="dark"] .live-search-card:focus-visible {
  background: #1e293b;
}
html[data-theme="dark"] .live-search-card:focus-visible {
  outline: calc(2px * var(--ui-scale, 1)) solid #3b82f6;
  outline-offset: calc(-2px * var(--ui-scale, 1));
}
html[data-theme="dark"] .live-search-card-main strong { color: #e2e8f0; }
html[data-theme="dark"] .live-search-card-main p { color: #94a3b8; }

/* Authentication is always the fixed light experience, regardless of workspace theme. */
#auth-login-screen {
  color-scheme: light;
  --ink: #182230;
  --muted: #667085;
  --line: #e7eaf0;
  --surface: #fff;
  --blue: #0d6b5c;
  --blue-dark: #0a5a4d;
}
html[data-theme="dark"] #auth-login-screen :is(input, textarea, select) {
  color: #182230 !important;
  background-color: #fff !important;
  border-color: #d0d5dd !important;
  caret-color: #0d6b5c;
}
html[data-theme="dark"] #auth-login-screen :is(input, textarea)::placeholder {
  color: #64748b !important;
  opacity: 1;
}
html[data-theme="dark"] #auth-login-screen .button-secondary {
  color: #344054;
  background: #fff;
  border-color: #d9dee7;
}
html[data-theme="dark"] #auth-login-screen .button-secondary:hover {
  background: #f8fafc;
  border-color: #d0d5dd;
}

/* Contact creation must remain reachable on a phone, including the fields and
   save action below the fold. The phone input itself stays an ordinary,
   editable input; JavaScript only provides +47 as its starting value. */
@media (max-width: 640px) {
  #customer-modal {
    align-items: start;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: calc(12px * var(--ui-scale, 1));
  }

#customer-modal .modal-card {
    width: 100%;
    max-height: calc(100dvh - calc(24px * var(--ui-scale, 1)));
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    margin: 0;
  }
}

/* Mobile administration uses one page-level scroll surface so vertical swipes
   work from cards, labels and the center of the editor. */
@media (max-width: 900px) {
  .content-scroll.admin-page-scroll {
    display: block;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
  }

  .content-scroll.admin-page-scroll .admin-agents-page.active,
  .content-scroll.admin-page-scroll .admin-agents-workspace,
  .content-scroll.admin-page-scroll .admin-agents-directory-panel,
  .content-scroll.admin-page-scroll .admin-agent-editor-panel,
  .content-scroll.admin-page-scroll .admin-agent-editor-body {
    height: auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
    touch-action: pan-y;
  }

  .content-scroll.admin-page-scroll .admin-agents-workspace {
    display: block;
  }

  .content-scroll.admin-page-scroll #admin-agents-list-container {
    flex: none;
    max-height: none !important;
    overflow: visible !important;
    overscroll-behavior: auto;
    touch-action: pan-y;
  }

  .content-scroll.admin-page-scroll .admin-agent-editor-body {
    flex: none;
    padding-right: 0;
    overscroll-behavior: auto;
  }

  .content-scroll.admin-page-scroll .admin-agents-page.mobile-editing .admin-agents-directory-panel {
    display: none;
    pointer-events: auto;
    user-select: auto;
  }

  .content-scroll.admin-page-scroll .admin-agents-page.mobile-editing .admin-agent-editor-panel {
    display: flex;
    box-shadow: none;
  }

  .content-scroll.admin-page-scroll .admin-agent-form-actions {
    position: static;
    margin-top: calc(16px * var(--ui-scale, 1));
  }
}

/* Keep the account action compact and visually aligned with the adjacent icon controls. */
.topbar-actions #btn-logout {
  width: calc(36px * var(--ui-scale, 1));
  min-width: calc(36px * var(--ui-scale, 1));
  height: calc(36px * var(--ui-scale, 1));
  min-height: calc(36px * var(--ui-scale, 1));
  padding: 0 !important;
  gap: 0;
  overflow: hidden;
  font-size: 0;
}

.topbar-actions #btn-logout svg {
  width: calc(18px * var(--ui-scale, 1));
  height: calc(18px * var(--ui-scale, 1));
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Dashboard density: keep the live feed attached to the viewport. */
@media (max-width: 900px) {
  #dashboard-tab.active {
    min-height: 0;
    height: 100%;
    gap: calc(8px * var(--ui-scale, 1));
  }

  #dashboard-tab .page-heading {
    gap: calc(8px * var(--ui-scale, 1));
  }

  #dashboard-tab .page-heading > div > p:not(.eyebrow) {
    display: none;
  }

  #dashboard-tab .page-heading h1 {
    font-size: clamp(calc(22px * var(--ui-scale, 1)), 6vw, calc(28px * var(--ui-scale, 1)));
    margin-bottom: 0;
  }

  #dashboard-tab .heading-actions {
    gap: calc(8px * var(--ui-scale, 1));
  }

  #dashboard-tab .heading-actions .button {
    min-height: calc(44px * var(--ui-scale, 1));
  }

  #dashboard-tab .activity-card {
    border-radius: calc(14px * var(--ui-scale, 1));
  }

  #dashboard-tab .surface-heading {
    padding: calc(14px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
  }

  #dashboard-tab .activity-heading > div {
    min-width: 0;
    width: 100%;
  }

  #dashboard-tab .activity-heading > .live-chip {
    flex: 0 0 auto;
  }

  #dashboard-tab .activity-filter-bar {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-column: 1 / -1;
    overflow: visible !important;
    width: 100%;
    min-width: 0;
    padding-bottom: 0 !important;
    margin-top: calc(9px * var(--ui-scale, 1));
    gap: calc(8px * var(--ui-scale, 1)) !important;
  }

  #dashboard-tab .activity-filter-btn {
    width: 100%;
    min-width: 0;
    min-height: calc(38px * var(--ui-scale, 1));
    padding: calc(7px * var(--ui-scale, 1)) calc(6px * var(--ui-scale, 1));
    justify-content: center;
    font-size: clamp(calc(10px * var(--ui-scale, 1)), 3vw, calc(11.5px * var(--ui-scale, 1)));
    white-space: nowrap;
  }

  #dashboard-tab .activity-log-search {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
    min-height: calc(38px * var(--ui-scale, 1));
    margin-top: 0;
  }

  #dashboard-tab .call-log-list {
    padding-bottom: max(calc(10px * var(--ui-scale, 1)), env(safe-area-inset-bottom));
  }
}

/* Agentadministrasjon: a two-pane working surface with independent scroll areas. */
.admin-agents-page.active {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  gap: calc(18px * var(--ui-scale, 1));
}

.admin-agents-page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: calc(18px * var(--ui-scale, 1));
  flex: 0 0 auto;
}

.admin-agents-page-header h1 {
  margin: 0 0 calc(5px * var(--ui-scale, 1));
  font: 800 calc(25px * var(--ui-scale, 1)) var(--display);
  letter-spacing: calc(-.9px * var(--ui-scale, 1));
}

.admin-agents-page-header p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  font-size: calc(13px * var(--ui-scale, 1));
}

.admin-agents-workspace {
  display: grid;
  grid-template-columns: minmax(calc(290px * var(--ui-scale, 1)), .78fr) minmax(0, 1.65fr);
  gap: calc(16px * var(--ui-scale, 1));
  flex: 1 1 auto;
  min-height: 0;
}

.admin-agents-directory-panel,
.admin-agent-editor-panel {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: calc(1px * var(--ui-scale, 1)) solid var(--line);
  border-radius: calc(14px * var(--ui-scale, 1));
  background: var(--surface);
}

.admin-agents-directory-panel {
  display: flex;
  flex-direction: column;
  padding: calc(14px * var(--ui-scale, 1));
}

.admin-agents-directory-panel .admin-company-toolbar {
  grid-template-columns: 1fr;
  gap: calc(8px * var(--ui-scale, 1));
  margin-bottom: calc(14px * var(--ui-scale, 1));
  padding: calc(12px * var(--ui-scale, 1));
}

.admin-agents-directory-panel .admin-company-context small {
  font-size: calc(12px * var(--ui-scale, 1));
}

.admin-agents-directory-panel .admin-agent-directory-toolbar {
  grid-template-columns: 1fr auto;
  margin-bottom: calc(10px * var(--ui-scale, 1));
}

.admin-agents-directory-panel .admin-agent-directory-heading {
  grid-column: 1 / -1;
}

.admin-agents-directory-panel .admin-agent-search-field {
  grid-column: 1;
  grid-row: 2;
}

.admin-agents-directory-panel .admin-agent-directory-toolbar > .button {
  grid-column: 2;
  grid-row: 2;
}

.admin-agents-directory-panel #admin-agents-list-container {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none !important;
  margin: 0 !important;
  padding-right: calc(3px * var(--ui-scale, 1));
  overflow-y: auto;
  overscroll-behavior: contain;
}

.admin-agent-editor-panel {
  display: flex;
  flex-direction: column;
  padding: calc(18px * var(--ui-scale, 1));
}

.admin-agent-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(12px * var(--ui-scale, 1));
  flex: 0 0 auto;
  padding-bottom: calc(14px * var(--ui-scale, 1));
  border-bottom: calc(1px * var(--ui-scale, 1)) solid var(--line);
}

.admin-agent-editor-header strong,
.admin-agent-editor-kicker {
  display: block;
}

.admin-agent-editor-kicker {
  margin-bottom: calc(3px * var(--ui-scale, 1));
  color: var(--blue);
  font-size: calc(12px * var(--ui-scale, 1));
  font-weight: 800;
  letter-spacing: .08em;
}

.admin-agent-editor-header strong {
  color: var(--ink);
  font: 800 calc(16px * var(--ui-scale, 1)) var(--display);
}

.admin-agent-editor-status {
  max-width: 42%;
  overflow: hidden;
  color: var(--muted);
  font-size: calc(12px * var(--ui-scale, 1));
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-agent-editor-panel .admin-mailbox-card {
  flex: 0 0 auto;
  margin: calc(14px * var(--ui-scale, 1)) 0;
  padding: calc(11px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1));
}

.admin-agent-editor-panel .admin-mailbox-card .button {
  min-height: calc(38px * var(--ui-scale, 1));
}

.admin-agent-editor-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: calc(3px * var(--ui-scale, 1));
}

.admin-agent-editor-empty {
  display: grid;
  flex: 1 1 auto;
  min-height: calc(180px * var(--ui-scale, 1));
  place-items: center;
  align-content: center;
  gap: calc(7px * var(--ui-scale, 1));
  color: var(--muted);
  text-align: center;
}

.admin-agent-editor-empty > span {
  display: grid;
  width: calc(48px * var(--ui-scale, 1));
  height: calc(48px * var(--ui-scale, 1));
  place-items: center;
  border-radius: calc(14px * var(--ui-scale, 1));
  color: var(--blue);
  background: var(--blue-soft);
  font-size: calc(23px * var(--ui-scale, 1));
}

.admin-agent-editor-empty strong {
  color: var(--ink);
  font-size: calc(14px * var(--ui-scale, 1));
}

.admin-agent-editor-empty p {
  max-width: calc(300px * var(--ui-scale, 1));
  margin: 0;
  font-size: calc(12px * var(--ui-scale, 1));
  line-height: 1.45;
}

.admin-agent-form-actions {
  flex: 0 0 auto;
  margin-top: calc(14px * var(--ui-scale, 1));
  padding-top: calc(14px * var(--ui-scale, 1));
}

.agent-admin-card.is-selected {
  border-color: #9ccfbf;
  box-shadow: 0 0 0 calc(3px * var(--ui-scale, 1)) rgba(13, 107, 92, .1);
}

.agent-admin-card.is-selected .agent-admin-card-header {
  background: #f8fafc;
}

@media (max-width: 900px) {
  .admin-agents-page.active {
    height: auto;
    min-height: 100%;
    gap: calc(12px * var(--ui-scale, 1));
  }

  .admin-agents-page-header {
    align-items: flex-start;
  }

  .admin-agents-page-header h1 {
    font-size: calc(23px * var(--ui-scale, 1));
  }

  .admin-agents-page-header p:not(.eyebrow) {
    display: none;
  }

  .admin-agents-page-header .button {
    min-height: calc(42px * var(--ui-scale, 1));
  }

  .admin-agents-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
    overflow: hidden;
  }

  .admin-agents-directory-panel,
  .admin-agent-editor-panel {
    min-height: calc(100dvh - calc(144px * var(--ui-scale, 1)));
  }

  .admin-agent-editor-panel {
    display: none;
    padding: calc(14px * var(--ui-scale, 1));
  }

  .admin-agents-page.mobile-editing .admin-agents-directory-panel {
    display: flex;
    grid-area: 1 / 1;
    pointer-events: none;
    user-select: none;
  }

  .admin-agents-page.mobile-editing .admin-agent-editor-panel {
    display: flex;
    grid-area: 1 / 1;
    z-index: 1;
    background: var(--surface);
    box-shadow: calc(-18px * var(--ui-scale, 1)) 0 calc(32px * var(--ui-scale, 1)) rgba(10, 35, 31, .14);
  }

  .admin-agents-directory-panel .admin-agent-directory-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .admin-agents-directory-panel .admin-agent-directory-toolbar > .button {
    grid-column: 2;
    grid-row: 2;
  }

  .admin-agents-directory-panel .admin-agent-search-field {
    grid-column: 1;
    grid-row: 2;
  }

  .admin-agent-fields {
    grid-template-columns: 1fr;
    gap: calc(10px * var(--ui-scale, 1));
  }

  .admin-agent-editor-panel .admin-mailbox-card {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .admin-agent-editor-panel .admin-mailbox-card .button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .admin-agent-form-actions {
    position: sticky;
    bottom: 0;
    margin-left: calc(-14px * var(--ui-scale, 1));
    margin-right: calc(-14px * var(--ui-scale, 1));
    padding: calc(12px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1)) max(calc(12px * var(--ui-scale, 1)), env(safe-area-inset-bottom));
  }
}

@media (max-width: 520px) {
  .admin-agents-page-header {
    gap: calc(8px * var(--ui-scale, 1));
  }

  .admin-agents-page-header .button {
    padding-left: calc(10px * var(--ui-scale, 1));
    padding-right: calc(10px * var(--ui-scale, 1));
  }

  .agent-admin-summary {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: calc(9px * var(--ui-scale, 1));
  }

  .agent-admin-department-summary,
  .agent-admin-edit-label {
    display: none;
  }

  .agent-admin-state {
    gap: calc(5px * var(--ui-scale, 1));
  }

  .agent-account-status {
    max-width: calc(82px * var(--ui-scale, 1));
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* Accessibility and responsive refinements. */
:where(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: calc(3px * var(--ui-scale, 1)) solid #8fc9b9;
  outline-offset: calc(2px * var(--ui-scale, 1));
}

:where(.surface-heading p, .rail-heading p, .metric-card small, .customer-name small,
  .customer-contact, .thread-item time, .thread-item p, .thread-meta, .message-meta,
  .conversation-kicker, .muted-label) {
  color: #667085;
}

.agent-status-controls button {
  width: calc(24px * var(--ui-scale, 1));
  height: calc(24px * var(--ui-scale, 1));
  min-width: calc(24px * var(--ui-scale, 1));
  min-height: calc(24px * var(--ui-scale, 1));
  border: calc(4px * var(--ui-scale, 1)) solid transparent;
  background-clip: padding-box;
}

.agent-status-controls button:focus-visible {
  outline: calc(3px * var(--ui-scale, 1)) solid #8fc9b9;
  outline-offset: calc(1px * var(--ui-scale, 1));
}

.modal-overlay,
.modal-backdrop {
  overscroll-behavior: contain;
}

@media (max-width: 900px) {
  .topbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: calc(8px * var(--ui-scale, 1));
    padding: 0 calc(12px * var(--ui-scale, 1));
  }

  .global-search-wrap,
  .global-search {
    min-width: 0;
    width: 100%;
    max-width: none;
  }

  .topbar-actions {
    gap: calc(4px * var(--ui-scale, 1));
  }

  .topbar-actions .button {
    min-width: calc(36px * var(--ui-scale, 1));
    min-height: calc(36px * var(--ui-scale, 1));
    padding: 0;
  }

  .topbar-actions #btn-logout {
    width: calc(36px * var(--ui-scale, 1));
    overflow: hidden;
    font-size: 0;
  }

  .sidebar.mobile-open {
    width: min(calc(310px * var(--ui-scale, 1)), 86vw);
  }

  .content-scroll {
    padding-left: calc(12px * var(--ui-scale, 1));
    padding-right: calc(12px * var(--ui-scale, 1));
  }
}

@media (max-width: 800px) {
  #auth-login-screen .auth-card.auth-login-card {
    margin-top: calc(16px * var(--ui-scale, 1));
    margin-bottom: calc(18px * var(--ui-scale, 1));
    padding: calc(22px * var(--ui-scale, 1)) !important;
  }

  #auth-login-screen .auth-header {
    margin-bottom: calc(4px * var(--ui-scale, 1));
  }

  #auth-login-screen .auth-divider {
    margin: calc(12px * var(--ui-scale, 1)) 0 !important;
  }

  #auth-login-screen .auth-login-card input {
    padding-top: calc(9px * var(--ui-scale, 1)) !important;
    padding-bottom: calc(9px * var(--ui-scale, 1)) !important;
  }

  #auth-login-screen .microsoft-sso-button {
    min-height: calc(44px * var(--ui-scale, 1));
  }
}

@media (max-width: 600px) {
  .modal-overlay,
  .modal-backdrop {
    align-items: flex-start;
    overflow-y: auto;
    padding: calc(12px * var(--ui-scale, 1));
  }

  .modal-overlay .modal-card,
  .modal-backdrop .modal-card {
    width: 100%;
    max-height: calc(100dvh - calc(24px * var(--ui-scale, 1)));
    overflow-y: auto;
    margin: 0;
  }

  .heading-actions {
    gap: calc(7px * var(--ui-scale, 1));
  }

  .heading-actions .button {
    min-height: calc(42px * var(--ui-scale, 1));
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ── Fjord · tilgjengelighet: skip-lenke + synlig fokusring ─────── */
.skip-link {
  position: absolute;
  left: calc(16px * var(--ui-scale, 1));
  top: calc(-64px * var(--ui-scale, 1));
  z-index: 120;
  background: #0e2c26;
  color: #fff;
  font: 700 calc(14px * var(--ui-scale, 1)) var(--font);
  padding: calc(12px * var(--ui-scale, 1)) calc(18px * var(--ui-scale, 1));
  border-radius: calc(14px * var(--ui-scale, 1));
  text-decoration: none;
  box-shadow: 0 calc(10px * var(--ui-scale, 1)) calc(28px * var(--ui-scale, 1)) rgba(10, 35, 31, .35);
  transition: top .16s ease;
}
.skip-link:focus { top: calc(12px * var(--ui-scale, 1)); outline: calc(2px * var(--ui-scale, 1)) solid #8ad0c0; outline-offset: calc(2px * var(--ui-scale, 1)); }
body:has(#auth-login-screen:not(.hidden)) .skip-link { display: none; }
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: calc(2px * var(--ui-scale, 1)) solid var(--blue);
  outline-offset: calc(2px * var(--ui-scale, 1));
  border-radius: inherit;
}
html[data-theme="dark"] :where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline-color: #60a5fa;
}
@media (prefers-reduced-motion: reduce) {
  .skip-link { transition: none; }
}

/* ── Fjord · mørk modus-fikser for komponenter med lyse flater ──── */
.search-clear-btn.hidden { display: none; }
html[data-theme="dark"] .missed-call-callback { background: #3a2322; border-color: #5c3635; color: #f87171; }
html[data-theme="dark"] .missed-call-callback:hover { background: #452a2a; border-color: #6b3f3f; }
html[data-theme="dark"] .ticket-select { background: #172438; border-color: #29384b; color: var(--ink); }
html[data-theme="dark"] .statistics-depot-demand-name > span { background: #172438; color: #9aa9bc; }
html[data-theme="dark"] .statistics-ring-expand-icon { background: #1e293b; color: #9aa9bc; }

/* Fjord · prioritetsindikator (erstatter emoji-fargede sirkler) */
.priority-dot { display: inline-block; width: calc(8px * var(--ui-scale, 1)); height: calc(8px * var(--ui-scale, 1)); border-radius: 50%; margin-right: calc(4px * var(--ui-scale, 1)); vertical-align: middle; }
.priority-urgent { background: #b03d3d; }
.priority-high { background: #d99a3d; }
.priority-normal { background: var(--blue); }
.priority-low { background: #b8bdb6; }
html[data-theme="dark"] .priority-normal { background: #60a5fa; }
html[data-theme="dark"] .priority-low { background: #64748b; }

/* Mobile: the main workspace card fills the remaining viewport (Oversikt, Meldinger, E-post, Kontakter). */
@media (max-width: 900px) {
  .content-scroll.mobile-scroll-locked {
    display: flex;
    flex-direction: column;
    flex: 1 1 0%;
    min-height: 0;
    overflow: hidden;
    padding-top: calc(10px * var(--ui-scale, 1)) !important;
    padding-bottom: max(calc(8px * var(--ui-scale, 1)), env(safe-area-inset-bottom)) !important;
  }

  .content-scroll.mobile-scroll-locked > .tab-view.active {
    display: flex !important;
    flex-direction: column;
    flex: 1 1 0%;
    min-height: 0;
    height: auto;
    overflow: hidden;
  }

  .content-scroll.mobile-scroll-locked #dashboard-tab .dashboard-grid,
  .content-scroll.mobile-scroll-locked #dashboard-tab .activity-card,
  .content-scroll.mobile-scroll-locked #customers-tab #customer-directory-card {
    display: flex;
    flex-direction: column;
    flex: 1 1 0%;
    min-height: 0;
    height: auto;
    overflow: hidden;
  }

  /* Inbox stays `display:block` so only the list or the thread is visible, not both. */
  .content-scroll.mobile-scroll-locked #sms-tab .inbox-layout,
  .content-scroll.mobile-scroll-locked #email-tab .inbox-layout {
    flex: 1 1 0%;
    min-height: 0;
    overflow: hidden;
  }

  .content-scroll.mobile-scroll-locked #sms-tab .thread-panel,
  .content-scroll.mobile-scroll-locked #sms-tab .conversation-panel,
  .content-scroll.mobile-scroll-locked #email-tab .thread-panel,
  .content-scroll.mobile-scroll-locked #email-tab .conversation-panel {
    height: 100%;
    min-height: 0;
  }

  .content-scroll.mobile-scroll-locked #dashboard-tab .call-log-list,
  .content-scroll.mobile-scroll-locked #customers-tab .customer-directory,
  .content-scroll.mobile-scroll-locked #sms-tab .thread-list,
  .content-scroll.mobile-scroll-locked #sms-tab .message-history,
  .content-scroll.mobile-scroll-locked #email-tab .thread-list,
  .content-scroll.mobile-scroll-locked #email-tab .message-history,
  .content-scroll.mobile-scroll-locked #email-tab #email-chat-history {
    flex: 1 1 0%;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

/* Mobile Meldinger: Samtaler and the composer stay put. Only the messages scroll. */
@media (max-width: 900px) {
  .content-scroll.mobile-scroll-locked #sms-tab .inbox-layout.mobile-sms-thread-open .conversation-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    overscroll-behavior: contain;
  }

  .content-scroll.mobile-scroll-locked #sms-tab .inbox-layout.mobile-sms-thread-open .sms-conversation-head,
  .content-scroll.mobile-scroll-locked #sms-tab .inbox-layout.mobile-sms-thread-open .sms-composer {
    flex: 0 0 auto;
  }

  .content-scroll.mobile-scroll-locked #sms-tab .inbox-layout.mobile-sms-thread-open .message-history {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .content-scroll.mobile-scroll-locked #email-tab .inbox-layout.mobile-email-thread-open {
    overflow-y: auto !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
  }

  .content-scroll.mobile-scroll-locked #email-tab .inbox-layout.mobile-email-thread-open .conversation-panel {
    display: block;
    height: auto;
    min-height: 100%;
    overflow: visible;
    overscroll-behavior: auto;
  }

  .content-scroll.mobile-scroll-locked #email-tab .inbox-layout.mobile-email-thread-open .message-history,
  .content-scroll.mobile-scroll-locked #email-tab .inbox-layout.mobile-email-thread-open #email-chat-history {
    flex: none;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    overscroll-behavior: auto;
  }
}

/* Modular channels: elements for channels the company has not enabled. */
.channel-off { display: none !important; }
.channel-disabled-notice {
  flex: 0 0 auto;
  height: auto;
  min-height: 0;
  align-self: stretch;
  margin: calc(10px * var(--ui-scale, 1)) 0 0 !important;
  padding: calc(8px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1));
  border: calc(1px * var(--ui-scale, 1)) solid var(--line);
  border-left: calc(3px * var(--ui-scale, 1)) solid var(--orange);
  border-radius: calc(12px * var(--ui-scale, 1));
  background: var(--orange-soft);
  color: var(--ink);
  font-size: calc(13px * var(--ui-scale, 1));
  line-height: 1.45;
}

/* Agentadministrasjon: read-only channel status (derived from number/mailbox). */
.admin-channel-list { display: grid; gap: calc(8px * var(--ui-scale, 1)); margin: 0; padding: 0; min-width: 0; }
.admin-channel-status { display: grid; gap: calc(4px * var(--ui-scale, 1)); padding: calc(12px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1)); border: calc(1px * var(--ui-scale, 1)) solid var(--line); border-radius: calc(12px * var(--ui-scale, 1)); background: var(--canvas); min-width: 0; }
.admin-channel-status.is-on { border-color: var(--blue); background: var(--blue-soft); }
.admin-channel-status-head { display: flex; align-items: center; justify-content: space-between; gap: calc(8px * var(--ui-scale, 1)); }
.admin-channel-status-head strong { font-size: calc(14px * var(--ui-scale, 1)); color: var(--ink); }
.admin-channel-status small { font-size: calc(12px * var(--ui-scale, 1)); color: var(--muted); }
.admin-channel-badge { display: inline-flex; align-items: center; min-height: calc(24px * var(--ui-scale, 1)); padding: calc(2px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1)); border-radius: calc(999px * var(--ui-scale, 1)); font-size: calc(12px * var(--ui-scale, 1)); font-weight: 800; }
.admin-channel-badge.is-on { background: var(--green-soft); color: var(--green); }
.admin-channel-badge.is-off { background: var(--surface); color: var(--muted); border: calc(1px * var(--ui-scale, 1)) solid var(--line); }
.admin-channel-source { margin: calc(4px * var(--ui-scale, 1)) 0 0; font-size: calc(12px * var(--ui-scale, 1)); font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.admin-channel-status.is-off .admin-channel-source { color: var(--muted); }
.admin-channels-feedback { margin: calc(12px * var(--ui-scale, 1)) 0 0; font-size: calc(12px * var(--ui-scale, 1)); color: var(--muted); line-height: 1.45; }
.admin-channels-feedback.is-error { color: var(--red); font-weight: 700; }
.admin-channels-loading { font-size: calc(12px * var(--ui-scale, 1)); color: var(--muted); padding: calc(8px * var(--ui-scale, 1)) 0; }

/* ==========================================================================
   Agentadministrasjon v2: three visible steps
   (1) Legg til agent  (2) Velg kanaler  (3) E-post og invitasjon
   Uses Fjord tokens only, so dark mode follows html[data-theme="dark"].
   ========================================================================== */
.admin-agents-page.ra-page.active { display: block; height: auto; min-height: 0; }
.ra-page { max-width: calc(1180px * var(--ui-scale, 1)); }
.ra-header { display: flex; align-items: flex-end; justify-content: space-between; gap: calc(18px * var(--ui-scale, 1)); flex-wrap: wrap; margin-bottom: calc(6px * var(--ui-scale, 1)); }
.ra-header-copy h1 { font: 800 calc(25px * var(--ui-scale, 1)) var(--display); letter-spacing: calc(-.9px * var(--ui-scale, 1)); margin: 0 0 calc(5px * var(--ui-scale, 1)); color: var(--ink); }
.ra-header-copy > p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: calc(13px * var(--ui-scale, 1)); }
.ra-header-actions { display: flex; align-items: center; gap: calc(8px * var(--ui-scale, 1)); flex-wrap: wrap; }
.ra-header-actions > :is(.button, .ra-back) { display: inline-flex; align-items: center; justify-content: center; gap: calc(6px * var(--ui-scale, 1)); height: calc(38px * var(--ui-scale, 1)); min-height: calc(38px * var(--ui-scale, 1)); padding: 0 calc(14px * var(--ui-scale, 1)); margin: 0; line-height: 1; white-space: nowrap; }
.ra-header-actions .ra-back-arrow { font-size: 1.2em; line-height: 1; transform: translateY(-0.5px); }
.ra-header-actions .ra-save { min-height: calc(38px * var(--ui-scale, 1)); }
.ra-company-field { display: grid; gap: calc(4px * var(--ui-scale, 1)); font-size: calc(12px * var(--ui-scale, 1)); font-weight: 700; color: var(--muted); }
.ra-company-field select { min-width: calc(200px * var(--ui-scale, 1)); min-height: calc(40px * var(--ui-scale, 1)); padding: calc(8px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)); border: calc(1px * var(--ui-scale, 1)) solid var(--line); border-radius: calc(12px * var(--ui-scale, 1)); background: var(--surface); color: var(--ink); font: 700 calc(13px * var(--ui-scale, 1)) var(--font); }
.ra-back { min-height: calc(38px * var(--ui-scale, 1)); }
.ra-company-context { margin: calc(10px * var(--ui-scale, 1)) 0 calc(16px * var(--ui-scale, 1)); font-size: calc(12px * var(--ui-scale, 1)); color: var(--muted); }
.ra-company-context strong { color: var(--ink); margin-right: calc(4px * var(--ui-scale, 1)); }

.ra-stepper { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: calc(10px * var(--ui-scale, 1)); margin-bottom: calc(18px * var(--ui-scale, 1)); counter-reset: none; }
.ra-step-link { display: flex; align-items: center; gap: calc(10px * var(--ui-scale, 1)); min-height: calc(56px * var(--ui-scale, 1)); padding: calc(10px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1)); border: calc(1px * var(--ui-scale, 1)) solid var(--line); border-radius: calc(14px * var(--ui-scale, 1)); background: var(--surface); color: var(--ink); text-align: left; cursor: pointer; font: inherit; transition: border-color .18s, background .18s; }
.ra-step-link:hover { border-color: var(--blue); }
.ra-step-num { flex: 0 0 auto; width: calc(30px * var(--ui-scale, 1)); height: calc(30px * var(--ui-scale, 1)); display: grid; place-items: center; border-radius: 50%; background: var(--blue-soft); color: var(--blue); font: 800 calc(13px * var(--ui-scale, 1)) var(--display); }
.ra-step-link.is-done .ra-step-num { background: var(--blue); color: var(--surface); }
.ra-step-text { display: grid; gap: calc(2px * var(--ui-scale, 1)); min-width: 0; }
.ra-step-text strong { font: 800 calc(13px * var(--ui-scale, 1)) var(--display); }
.ra-step-text small { font-size: calc(12px * var(--ui-scale, 1)); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ra-form { display: grid; gap: calc(18px * var(--ui-scale, 1)); }
.ra-step { background: var(--surface); border: calc(1px * var(--ui-scale, 1)) solid var(--line); border-radius: calc(16px * var(--ui-scale, 1)); padding: calc(18px * var(--ui-scale, 1)) calc(20px * var(--ui-scale, 1)) calc(20px * var(--ui-scale, 1)); scroll-margin-top: calc(16px * var(--ui-scale, 1)); }
.ra-step-header { display: flex; align-items: flex-start; gap: calc(12px * var(--ui-scale, 1)); margin-bottom: calc(16px * var(--ui-scale, 1)); }
.ra-step-badge { flex: 0 0 auto; width: calc(32px * var(--ui-scale, 1)); height: calc(32px * var(--ui-scale, 1)); display: grid; place-items: center; border-radius: calc(12px * var(--ui-scale, 1)); background: var(--blue); color: var(--surface); font: 800 calc(14px * var(--ui-scale, 1)) var(--display); }
.ra-step-heading { flex: 1 1 auto; min-width: 0; }
.ra-step-heading h2 { margin: calc(2px * var(--ui-scale, 1)) 0 calc(3px * var(--ui-scale, 1)); font: 800 calc(17px * var(--ui-scale, 1)) var(--display); letter-spacing: calc(-.3px * var(--ui-scale, 1)); color: var(--ink); outline: none; }
.ra-step-heading p { margin: 0; font-size: calc(13px * var(--ui-scale, 1)); color: var(--muted); line-height: 1.45; }
.ra-cta { min-height: calc(44px * var(--ui-scale, 1)); padding: calc(10px * var(--ui-scale, 1)) calc(18px * var(--ui-scale, 1)); font-size: calc(13px * var(--ui-scale, 1)); }

.ra-agents-layout { display: grid; grid-template-columns: minmax(calc(260px * var(--ui-scale, 1)), calc(360px * var(--ui-scale, 1))) minmax(0, 1fr); gap: calc(16px * var(--ui-scale, 1)); align-items: start; }
.ra-directory { display: grid; gap: calc(10px * var(--ui-scale, 1)); min-width: 0; }
.ra-directory-toolbar { display: grid; gap: calc(8px * var(--ui-scale, 1)); }
.ra-directory-title { display: flex; align-items: baseline; justify-content: space-between; gap: calc(8px * var(--ui-scale, 1)); }
.ra-directory-title strong { font: 800 calc(13px * var(--ui-scale, 1)) var(--display); color: var(--ink); }
.ra-directory-title span { font-size: calc(12px * var(--ui-scale, 1)); color: var(--muted); }
.ra-search input { width: 100%; min-height: calc(40px * var(--ui-scale, 1)); padding: calc(8px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)); border: calc(1px * var(--ui-scale, 1)) solid var(--line); border-radius: calc(12px * var(--ui-scale, 1)); background: var(--canvas); color: var(--ink); font: 600 calc(13px * var(--ui-scale, 1)) var(--font); }
.ra-agent-list { display: grid; gap: calc(8px * var(--ui-scale, 1)); max-height: calc(460px * var(--ui-scale, 1)); overflow-y: auto; padding-right: calc(2px * var(--ui-scale, 1)); }
.ra-agent-card { display: flex; align-items: stretch; gap: calc(4px * var(--ui-scale, 1)); border: calc(1px * var(--ui-scale, 1)) solid var(--line); border-radius: calc(14px * var(--ui-scale, 1)); background: var(--surface); transition: border-color .18s, background .18s; }
.ra-agent-card:hover { border-color: var(--blue); }
.ra-agent-card.is-selected { border-color: var(--blue); background: var(--blue-soft); box-shadow: inset calc(3px * var(--ui-scale, 1)) 0 0 var(--blue); }
.ra-agent-select { flex: 1 1 auto; min-width: 0; display: flex; align-items: flex-start; gap: calc(10px * var(--ui-scale, 1)); padding: calc(10px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)); border: 0; background: transparent; color: var(--ink); text-align: left; cursor: pointer; font: inherit; border-radius: calc(14px * var(--ui-scale, 1)); }
.ra-avatar { flex: 0 0 auto; width: calc(36px * var(--ui-scale, 1)); height: calc(36px * var(--ui-scale, 1)); display: grid; place-items: center; border-radius: calc(12px * var(--ui-scale, 1)); background: var(--blue-soft); color: var(--blue); font: 800 calc(14px * var(--ui-scale, 1)) var(--display); }
.ra-agent-card.is-selected .ra-avatar { background: var(--blue); color: var(--surface); }
.ra-agent-identity { display: grid; gap: calc(3px * var(--ui-scale, 1)); min-width: 0; }
.ra-agent-identity strong { font-size: calc(13px * var(--ui-scale, 1)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ra-agent-identity small { font-size: calc(12px * var(--ui-scale, 1)); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ra-agent-meta { display: flex; flex-wrap: wrap; gap: calc(4px * var(--ui-scale, 1)); margin-top: calc(3px * var(--ui-scale, 1)); }
.ra-status-chip, .ra-dept-chip { display: inline-flex; align-items: center; min-height: calc(22px * var(--ui-scale, 1)); padding: calc(2px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1)); border-radius: calc(999px * var(--ui-scale, 1)); font-size: calc(12px * var(--ui-scale, 1)); font-weight: 700; white-space: nowrap; }
.ra-status-chip { background: var(--orange-soft); color: var(--orange); }
.ra-status-chip.is-active { background: var(--green-soft); color: var(--green); }
.ra-status-chip.is-invitation_sent { background: var(--violet-soft); color: var(--violet); }
.ra-dept-chip { background: var(--canvas); color: var(--muted); border: calc(1px * var(--ui-scale, 1)) solid var(--line); }
.ra-dept-chip.is-empty { font-style: italic; }
.ra-agent-delete { flex: 0 0 auto; align-self: center; width: calc(36px * var(--ui-scale, 1)); height: calc(36px * var(--ui-scale, 1)); margin-right: calc(6px * var(--ui-scale, 1)); display: grid; place-items: center; border: calc(1px * var(--ui-scale, 1)) solid transparent; border-radius: calc(10px * var(--ui-scale, 1)); background: transparent; color: var(--muted); cursor: pointer; }
.ra-agent-delete:hover { color: var(--red); border-color: var(--line); background: var(--surface); }

.ra-editor { border: calc(1px * var(--ui-scale, 1)) solid var(--line); border-radius: calc(14px * var(--ui-scale, 1)); background: var(--canvas); padding: calc(14px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1)); min-width: 0; scroll-margin-top: calc(16px * var(--ui-scale, 1)); }
.ra-editor-head { display: flex; align-items: baseline; justify-content: space-between; gap: calc(10px * var(--ui-scale, 1)); margin-bottom: calc(12px * var(--ui-scale, 1)); }
.ra-kicker { font-size: calc(12px * var(--ui-scale, 1)); font-weight: 800; letter-spacing: .08em; color: var(--blue); }
.ra-editor-head strong { font: 800 calc(15px * var(--ui-scale, 1)) var(--display); color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ra-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: calc(12px * var(--ui-scale, 1)); }
.ra-field { display: grid; gap: calc(6px * var(--ui-scale, 1)); font-size: calc(12px * var(--ui-scale, 1)); font-weight: 800; color: var(--ink); }
.ra-field > span { font-weight: 600; color: var(--muted); }
.ra-field input { width: 100%; min-width: 0; min-height: calc(44px * var(--ui-scale, 1)); padding: calc(10px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)); border: calc(1px * var(--ui-scale, 1)) solid var(--line); border-radius: calc(12px * var(--ui-scale, 1)); background: var(--surface); color: var(--ink); font: 600 calc(14px * var(--ui-scale, 1)) var(--font); }
.ra-field input:focus, .ra-search input:focus, .ra-company-field select:focus { outline: calc(2px * var(--ui-scale, 1)) solid var(--blue); outline-offset: calc(1px * var(--ui-scale, 1)); border-color: var(--blue); }
.ra-fieldset { margin: calc(14px * var(--ui-scale, 1)) 0 0; padding: 0; border: 0; min-width: 0; }
.ra-fieldset legend { padding: 0; margin-bottom: calc(8px * var(--ui-scale, 1)); font-size: calc(12px * var(--ui-scale, 1)); font-weight: 800; color: var(--ink); }
.ra-chip-options { display: flex; flex-wrap: wrap; gap: calc(8px * var(--ui-scale, 1)); }
.ra-chip-option { position: relative; display: inline-flex; align-items: center; gap: calc(8px * var(--ui-scale, 1)); min-height: calc(40px * var(--ui-scale, 1)); padding: calc(8px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1)); border: calc(1px * var(--ui-scale, 1)) solid var(--line); border-radius: calc(999px * var(--ui-scale, 1)); background: var(--surface); color: var(--ink); font-size: calc(13px * var(--ui-scale, 1)); font-weight: 700; cursor: pointer; }
.ra-chip-option input { width: calc(18px * var(--ui-scale, 1)); height: calc(18px * var(--ui-scale, 1)); margin: 0; accent-color: var(--blue); }
.ra-chip-option:has(input:checked) { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); }
.ra-editor-next { display: flex; justify-content: flex-end; margin-top: calc(14px * var(--ui-scale, 1)); }
.ra-editor-next .button { min-height: calc(40px * var(--ui-scale, 1)); }

.ra-empty { display: grid; justify-items: center; gap: calc(6px * var(--ui-scale, 1)); padding: calc(26px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1)); text-align: center; color: var(--muted); border: calc(1px * var(--ui-scale, 1)) dashed var(--line); border-radius: calc(14px * var(--ui-scale, 1)); }
.ra-empty > span { font-size: calc(22px * var(--ui-scale, 1)); color: var(--blue); }
.ra-empty strong { color: var(--ink); font-size: calc(14px * var(--ui-scale, 1)); }
.ra-empty p { margin: 0; font-size: calc(12px * var(--ui-scale, 1)); }

/* Step 2: channel status cards side by side on wide screens. */
#ra-step-channels .admin-channel-list { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: calc(10px * var(--ui-scale, 1)); }
#ra-step-channels .admin-channel-status { min-height: calc(104px * var(--ui-scale, 1)); align-content: start; }

.ra-invite-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(calc(240px * var(--ui-scale, 1)), calc(320px * var(--ui-scale, 1))); gap: calc(16px * var(--ui-scale, 1)); align-items: start; }
.ra-invite-panel { display: grid; gap: calc(12px * var(--ui-scale, 1)); border: calc(1px * var(--ui-scale, 1)) solid var(--line); border-radius: calc(14px * var(--ui-scale, 1)); background: var(--canvas); padding: calc(16px * var(--ui-scale, 1)); min-width: 0; }
.ra-invite-agent { display: flex; align-items: center; gap: calc(10px * var(--ui-scale, 1)); }
.ra-invite-agent > div { display: grid; gap: calc(4px * var(--ui-scale, 1)); justify-items: start; }
.ra-invite-agent strong { font: 800 calc(14px * var(--ui-scale, 1)) var(--display); color: var(--ink); }
.ra-invite-hint, .ra-invite-requirement { margin: 0; font-size: calc(12px * var(--ui-scale, 1)); color: var(--muted); line-height: 1.45; }
.ra-invite-actions { display: flex; flex-wrap: wrap; gap: calc(10px * var(--ui-scale, 1)); }
.ra-invite-actions .button { min-height: calc(44px * var(--ui-scale, 1)); padding: calc(10px * var(--ui-scale, 1)) calc(18px * var(--ui-scale, 1)); font-size: calc(13px * var(--ui-scale, 1)); }
.ra-invite-actions .button:disabled { opacity: .5; cursor: not-allowed; }
.ra-mailbox { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: calc(10px * var(--ui-scale, 1)); padding: calc(14px * var(--ui-scale, 1)); border: calc(1px * var(--ui-scale, 1)) solid var(--line); border-radius: calc(14px * var(--ui-scale, 1)); background: var(--surface); }
.ra-mailbox .button { grid-column: 1 / -1; min-height: calc(40px * var(--ui-scale, 1)); }
.ra-mailbox-icon { width: calc(34px * var(--ui-scale, 1)); height: calc(34px * var(--ui-scale, 1)); display: grid; place-items: center; border-radius: calc(12px * var(--ui-scale, 1)); background: var(--blue-soft); color: var(--blue); }
.ra-mailbox-copy { display: grid; gap: calc(2px * var(--ui-scale, 1)); min-width: 0; }
.ra-mailbox-copy strong { font-size: calc(13px * var(--ui-scale, 1)); color: var(--ink); }
.ra-mailbox-copy span { font-size: calc(12px * var(--ui-scale, 1)); color: var(--ink); overflow-wrap: anywhere; }
.ra-mailbox-copy small { font-size: calc(12px * var(--ui-scale, 1)); color: var(--muted); }
.ra-mailbox-copy small.connected { color: var(--green); font-weight: 700; }
.ra-mailbox-copy small.disconnected { color: var(--orange); font-weight: 700; }

html[data-theme="dark"] .ra-step-link.is-done .ra-step-num,
html[data-theme="dark"] .ra-step-badge,
html[data-theme="dark"] .ra-agent-card.is-selected .ra-avatar { color: #0b1220; }

@media (max-width: 900px) {
  .ra-agents-layout, .ra-invite-layout { grid-template-columns: 1fr; }
  .ra-agent-list { max-height: none; overflow: visible; }
  #ra-step-channels .admin-channel-list { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .ra-header { align-items: stretch; }
  .ra-header-actions { width: 100%; }
  .ra-header-actions > :is(.button, .ra-back) { height: calc(40px * var(--ui-scale, 1)); min-height: calc(40px * var(--ui-scale, 1)); padding: 0 calc(12px * var(--ui-scale, 1)); font-size: calc(13px * var(--ui-scale, 1)); }
  .ra-company-field { flex: 1 1 auto; }
  .ra-company-field select { min-width: 0; width: 100%; min-height: calc(44px * var(--ui-scale, 1)); }
  .ra-back { min-height: calc(40px * var(--ui-scale, 1)); }
  .ra-stepper { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: calc(6px * var(--ui-scale, 1)); }
  .ra-step-link { flex-direction: column; align-items: center; justify-content: center; gap: calc(4px * var(--ui-scale, 1)); min-height: calc(64px * var(--ui-scale, 1)); padding: calc(8px * var(--ui-scale, 1)) calc(4px * var(--ui-scale, 1)); text-align: center; }
  .ra-step-text strong { font-size: calc(12px * var(--ui-scale, 1)); }
  .ra-step-text small { display: none; }
  .ra-step { padding: calc(14px * var(--ui-scale, 1)); border-radius: calc(14px * var(--ui-scale, 1)); }
  .ra-step-header { flex-wrap: wrap; }
  .ra-step-header .ra-cta { width: 100%; }
  .ra-fields { grid-template-columns: 1fr; }
  .ra-invite-actions .button, .ra-editor-next .button { flex: 1 1 100%; }
  .ra-header-actions .ra-save { min-height: calc(40px * var(--ui-scale, 1)); flex: 1 1 auto; }
}
.sr-only { position: absolute !important; width: calc(1px * var(--ui-scale, 1)); height: calc(1px * var(--ui-scale, 1)); padding: 0; margin: calc(-1px * var(--ui-scale, 1)); overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.ra-fields { align-items: end; }

/* Agentadministrasjon: administrators only. Hidden for everyone else even
   before JavaScript runs; the workspace switcher is only a link for admins. */
body:not(.role-admin) #admin-agents-nav,
body:not(.role-admin) #admin-agents-tab { display: none !important; }
.workspace-switcher.is-admin-entry { cursor: pointer; }


/* Mobile landscape: unlock vertical page scrolling so headings never trap content below the fold. */
@media (orientation: landscape) and (max-height: 600px), (max-width: 900px) and (orientation: landscape) {
  html,
  body {
    height: auto !important;
    min-height: 100% !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior-y: auto !important;
  }

  .app-shell {
    height: auto !important;
    min-height: 100% !important;
    min-height: 100dvh !important;
    overflow: visible !important;
  }

  .main-content {
    height: auto !important;
    min-height: 100% !important;
    min-height: 100dvh !important;
    overflow: visible !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .auth-screen-backdrop {
    position: fixed !important;
    inset: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    align-items: flex-start !important;
    padding: calc(16px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)) calc(32px * var(--ui-scale, 1)) !important;
  }

  .modal-backdrop,
  .modal-overlay {
    align-items: flex-start !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: calc(16px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)) calc(32px * var(--ui-scale, 1)) !important;
  }

  .modal-card {
    margin: calc(12px * var(--ui-scale, 1)) auto !important;
    max-height: none !important;
  }

  .content-scroll,
  .content-scroll.mobile-scroll-locked {
    display: block !important;
    flex: none !important;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior-y: auto !important;
    padding-bottom: max(calc(32px * var(--ui-scale, 1)), env(safe-area-inset-bottom)) !important;
  }

  .content-scroll > .tab-view.active,
  #dashboard-tab.active,
  #customers-tab.active,
  #sms-tab.active,
  #email-tab.active,
  #statistics-tab.active,
  #admin-agents-tab.active {
    display: flex !important;
    flex-direction: column !important;
    flex: none !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }

  #dashboard-tab .dashboard-grid,
  #dashboard-tab .activity-card,
  #customers-tab #customer-directory-card,
  #sms-tab .inbox-layout,
  #email-tab .inbox-layout,
  #email-tab .email-inbox-layout {
    flex: none !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }

  #sms-tab .thread-panel,
  #sms-tab .conversation-panel,
  #email-tab .thread-panel,
  #email-tab .conversation-panel,
  #dashboard-tab .call-log-list,
  #customers-tab .customer-directory,
  #customers-tab #customer-detail-view-container:not(.hidden),
  #sms-tab .thread-list,
  #sms-tab .message-history,
  #email-tab .thread-list,
  #email-tab .message-history,
  #email-tab #email-chat-history {
    flex: none !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }
}

/* Email Ticketing: Internal Notes, Agent Presence, and Signature */
.email-message-card.internal-note {
  border-color: rgba(217, 119, 6, 0.38);
  background: rgba(254, 243, 199, 0.45);
}

.email-message-card.internal-note .email-message-card-head {
  background: rgba(251, 191, 36, 0.18);
  border-bottom-color: rgba(217, 119, 6, 0.25);
}

.email-message-card.internal-note .email-message-card-head strong {
  color: #92400e;
}

.email-composer.internal-note-mode {
  border-color: rgba(217, 119, 6, 0.55) !important;
  background: rgba(254, 243, 199, 0.22);
}

#btn-email-internal-note.active {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(217, 119, 6, 0.55);
  color: #92400e;
  font-weight: 700;
}

.email-presence-pill {
  display: inline-flex;
  align-items: center;
  gap: calc(5px * var(--ui-scale, 1));
  padding: calc(4px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
  border-radius: calc(999px * var(--ui-scale, 1));
  font-size: calc(11.5px * var(--ui-scale, 1));
  font-weight: 600;
  color: #1e40af;
  background: rgba(59, 130, 246, 0.12);
  border: calc(1px * var(--ui-scale, 1)) solid rgba(59, 130, 246, 0.28);
}

.email-presence-pill.is-typing {
  color: #92400e;
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(217, 119, 6, 0.38);
}

.thread-presence-badge {
  display: inline-flex;
  align-items: center;
  gap: calc(3px * var(--ui-scale, 1));
  padding: calc(2px * var(--ui-scale, 1)) calc(7px * var(--ui-scale, 1));
  border-radius: calc(999px * var(--ui-scale, 1));
  font-size: calc(10.5px * var(--ui-scale, 1));
  font-weight: 600;
  color: #1e40af;
  background: rgba(59, 130, 246, 0.12);
  border: calc(1px * var(--ui-scale, 1)) solid rgba(59, 130, 246, 0.24);
}

.email-signature {
  color: var(--muted);
  font-size: calc(12.5px * var(--ui-scale, 1));
  opacity: 0.92;
}

html[data-theme="dark"] .email-message-card.internal-note {
  border-color: rgba(245, 158, 11, 0.42);
  background: rgba(120, 53, 15, 0.22);
}

html[data-theme="dark"] .email-message-card.internal-note .email-message-card-head {
  background: rgba(146, 64, 14, 0.34);
  border-bottom-color: rgba(245, 158, 11, 0.32);
}

html[data-theme="dark"] .email-message-card.internal-note .email-message-card-head strong,
html[data-theme="dark"] #btn-email-internal-note.active {
  color: #fcd34d;
}

html[data-theme="dark"] .email-composer.internal-note-mode {
  border-color: rgba(245, 158, 11, 0.55) !important;
  background: rgba(120, 53, 15, 0.16);
}

html[data-theme="dark"] .email-presence-pill,
html[data-theme="dark"] .thread-presence-badge {
  color: #93c5fd;
  background: rgba(30, 58, 138, 0.38);
  border-color: rgba(96, 165, 250, 0.35);
}

html[data-theme="dark"] .email-presence-pill.is-typing {
  color: #fcd34d;
  background: rgba(146, 64, 14, 0.38);
  border-color: rgba(245, 158, 11, 0.42);
}

.ra-invite-channel-picker {
  margin: calc(4px * var(--ui-scale, 1)) 0 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.ra-invite-channel-picker legend {
  padding: 0;
  margin-bottom: calc(8px * var(--ui-scale, 1));
  font-size: calc(12px * var(--ui-scale, 1));
  font-weight: 800;
  color: var(--ink);
}

.ra-invite-channel-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: calc(10px * var(--ui-scale, 1));
}

.ra-invite-channel-card {
  display: flex;
  align-items: flex-start;
  gap: calc(10px * var(--ui-scale, 1));
  padding: calc(10px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1));
  border: calc(1.5px * var(--ui-scale, 1)) solid var(--line);
  border-radius: calc(12px * var(--ui-scale, 1));
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.ra-invite-channel-card input[type="radio"] {
  margin-top: calc(2px * var(--ui-scale, 1));
  width: calc(17px * var(--ui-scale, 1));
  height: calc(17px * var(--ui-scale, 1));
  accent-color: var(--blue);
  flex: 0 0 auto;
}

.ra-invite-channel-card.is-selected {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.ra-invite-channel-card.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ra-invite-channel-body {
  display: grid;
  gap: calc(2px * var(--ui-scale, 1));
  min-width: 0;
}

.ra-invite-channel-body strong {
  font-size: calc(13px * var(--ui-scale, 1));
  font-weight: 800;
  color: var(--ink);
}

.ra-invite-channel-body small {
  font-size: calc(11.5px * var(--ui-scale, 1));
  color: var(--muted);
  overflow-wrap: anywhere;
}

@media (max-width: 640px) {
  .ra-invite-channel-options {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   TEST LOGIN BUTTON (LOCAL / TEST ENVIRONMENT)
   ========================================================================== */
.test-login-container {
  margin-top: calc(10px * var(--ui-scale, 1));
}

.button-test-login {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: calc(8px * var(--ui-scale, 1));
  padding: calc(11px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1));
  border-radius: calc(10px * var(--ui-scale, 1));
  border: calc(1.5px * var(--ui-scale, 1)) dashed var(--accent, #0d6b5c);
  background: rgba(13, 107, 92, 0.08);
  color: var(--ink);
  font-weight: 700;
  font-size: calc(13.5px * var(--ui-scale, 1));
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}

.button-test-login:hover {
  background: rgba(13, 107, 92, 0.15);
  border-style: solid;
  transform: translateY(calc(-1px * var(--ui-scale, 1)));
}

/* ==========================================================================
   MINIMALIST SIDEBAR TOP CONTROLS, UNIFIED FONT & DYNAMIC DESKTOP SCALING
   ========================================================================== */

.utility-rail,
.sidebar-footer {
  display: none !important;
}

:root {
  --ui-scale: 1;
}

@media (min-width: 901px) {
  .app-shell {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    height: 100dvh !important;
    min-height: 0 !important;
    max-height: 100dvh;
    overflow: hidden;
    grid-template-columns: calc(var(--sidebar-width, 268px) * var(--ui-scale, 1)) minmax(0, 1fr) !important;
    box-shadow: none;
    font-size: calc(15px * var(--ui-scale, 1));
  }

  .sidebar {
    height: 100dvh !important;
    min-height: 0 !important;
  }

  .main-content .topbar {
    padding: 0 calc(24px * var(--ui-scale, 1));
  }

  .main-content {
    height: 100dvh !important;
    max-height: 100dvh;
    overflow: hidden;
  }

  .main-content .content-scroll {
    padding: 0 calc(24px * var(--ui-scale, 1));
    overflow: hidden;
  }

  .main-content .content-scroll > .tab-view.active {
    max-width: none !important;
    width: 100% !important;
    margin: 0 !important;
  }
}

.sidebar {
  overflow-y: auto;
  scrollbar-width: thin;
}

/* Unified Font Family & Size across the ENTIRE Left Sidebar (matching Oversikt & Kontakter) */
#primary-sidebar,
#primary-sidebar button,
#primary-sidebar select,
#primary-sidebar .workspace-switcher strong,
#primary-sidebar .workspace-switcher small,
#primary-sidebar .sidebar-top-controls .active-agent-label,
#primary-sidebar .sidebar-top-controls .active-agent-phone,
#primary-sidebar .sidebar-top-controls .queue-btn-text strong,
#primary-sidebar .sidebar-top-controls .queue-btn-text small,
#primary-sidebar .sidebar-top-controls .queue-info strong,
#primary-sidebar .sidebar-top-controls .queue-info small,
#primary-sidebar .nav-item,
#primary-sidebar .agent-department-heading,
#primary-sidebar .agent-department-empty,
#primary-sidebar .agent-mini strong,
#primary-sidebar .agent-mini small {
  font-family: var(--font) !important;
  font-size: calc(14px * var(--ui-scale, 1)) !important;
  font-weight: 600 !important;
  letter-spacing: 0 !important;
}

.sidebar .workspace-switcher {
  padding: calc(10px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1));
  margin-bottom: calc(8px * var(--ui-scale, 1));
  border-radius: calc(12px * var(--ui-scale, 1));
  gap: calc(10px * var(--ui-scale, 1));
}

.sidebar .workspace-switcher > span:nth-child(2) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(8px * var(--ui-scale, 1));
  flex: 1 1 auto;
  min-width: 0;
}

.sidebar .workspace-switcher strong,
.sidebar .workspace-switcher small {
  margin: 0 !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#primary-sidebar .sidebar-top-controls,
.sidebar.mobile-open .sidebar-top-controls {
  display: flex !important;
  flex-direction: column;
  gap: calc(4px * var(--ui-scale, 1));
  margin: 0 0 calc(4px * var(--ui-scale, 1));
  padding: 0 0 calc(4px * var(--ui-scale, 1));
  border-bottom: 0;
  width: 100%;
  min-width: 0;
}

#primary-sidebar .sidebar-top-controls .utility-agent-select,
.sidebar.mobile-open .sidebar-top-controls .utility-agent-select {
  margin: 0 !important;
  width: 100%;
}

#primary-sidebar .sidebar-top-controls .active-agent-select-wrapper,
.sidebar.mobile-open .sidebar-top-controls .active-agent-select-wrapper {
  width: 100%;
}

#primary-sidebar .sidebar-top-controls .user-menu,
.sidebar.mobile-open .sidebar-top-controls .user-menu {
  display: flex;
  align-items: center;
  gap: calc(8px * var(--ui-scale, 1));
  width: 100%;
  min-height: calc(30px * var(--ui-scale, 1));
  padding: calc(4px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1));
  border-radius: calc(8px * var(--ui-scale, 1));
  background: rgba(255, 255, 255, 0.06);
  border: calc(1px * var(--ui-scale, 1)) solid rgba(255, 255, 255, 0.1);
  color: #f8fafc;
  box-sizing: border-box;
}

#primary-sidebar .sidebar-top-controls .user-avatar,
.sidebar.mobile-open .sidebar-top-controls .user-avatar {
  width: calc(22px * var(--ui-scale, 1));
  height: calc(22px * var(--ui-scale, 1));
  font-size: calc(10.5px * var(--ui-scale, 1)) !important;
  flex-shrink: 0;
}

#primary-sidebar .sidebar-top-controls .active-agent-info-wrap,
.sidebar.mobile-open .sidebar-top-controls .active-agent-info-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(6px * var(--ui-scale, 1));
  flex: 1 1 auto;
  min-width: 0;
}

#primary-sidebar .sidebar-top-controls .active-agent-label,
.sidebar.mobile-open .sidebar-top-controls .active-agent-label {
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: calc(12.5px * var(--ui-scale, 1)) !important;
}

#primary-sidebar .sidebar-top-controls .active-agent-phone,
.sidebar.mobile-open .sidebar-top-controls .active-agent-phone {
  color: #9db0a8;
  white-space: nowrap;
  margin: 0;
  font-size: calc(11px * var(--ui-scale, 1)) !important;
}

#primary-sidebar .sidebar-top-controls .user-menu > .chevron,
.sidebar.mobile-open .sidebar-top-controls .user-menu > .chevron {
  font-size: calc(11px * var(--ui-scale, 1)) !important;
  color: #9db0a8;
  margin-left: calc(2px * var(--ui-scale, 1));
}

/* Minimalist Område accordion in sidebar */
#primary-sidebar .sidebar-top-controls #agent-controls-rail-section,
.sidebar.mobile-open .sidebar-top-controls #agent-controls-rail-section {
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  width: 100%;
}

#primary-sidebar .sidebar-top-controls #queue-card-wrapper,
.sidebar.mobile-open .sidebar-top-controls #queue-card-wrapper {
  border-radius: calc(9px * var(--ui-scale, 1)) !important;
  min-height: calc(28px * var(--ui-scale, 1)) !important;
  padding: calc(5px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1)) !important;
  gap: calc(3px * var(--ui-scale, 1)) !important;
}

#primary-sidebar .sidebar-top-controls #btn-toggle-queue-panel,
.sidebar.mobile-open .sidebar-top-controls #btn-toggle-queue-panel {
  min-height: calc(24px * var(--ui-scale, 1)) !important;
  padding: 0 !important;
  gap: calc(8px * var(--ui-scale, 1)) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  text-align: left !important;
}

#primary-sidebar .sidebar-top-controls .queue-btn-icon,
.sidebar.mobile-open .sidebar-top-controls .queue-btn-icon {
  width: calc(18px * var(--ui-scale, 1)) !important;
  height: calc(18px * var(--ui-scale, 1)) !important;
  border-radius: calc(4px * var(--ui-scale, 1)) !important;
  flex-shrink: 0;
}

#primary-sidebar .sidebar-top-controls .queue-btn-text,
.sidebar.mobile-open .sidebar-top-controls .queue-btn-text {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: calc(6px * var(--ui-scale, 1)) !important;
  flex: 1 1 auto;
  min-width: 0;
}

#primary-sidebar .sidebar-top-controls .queue-btn-text strong,
.sidebar.mobile-open .sidebar-top-controls .queue-btn-text strong {
  margin: 0 !important;
  font-size: calc(12.5px * var(--ui-scale, 1)) !important;
}

#primary-sidebar .sidebar-top-controls .queue-btn-text small,
.sidebar.mobile-open .sidebar-top-controls .queue-btn-text small {
  margin: 0 !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(130px * var(--ui-scale, 1));
  font-size: calc(11.5px * var(--ui-scale, 1)) !important;
}

#primary-sidebar .sidebar-top-controls .queue-chevron,
.sidebar.mobile-open .sidebar-top-controls .queue-chevron {
  font-size: calc(11px * var(--ui-scale, 1)) !important;
  position: static !important;
  transform: none !important;
}

/* Divider line under Agentadministrasjon separating navigation from agent status list */
#primary-sidebar .sidebar-agents-divider {
  border: 0;
  height: calc(1px * var(--ui-scale, 1));
  background: rgba(255, 255, 255, 0.14);
  margin: calc(14px * var(--ui-scale, 1)) 0;
  width: 100%;
  flex-shrink: 0;
}

#primary-sidebar .agent-department-heading {
  text-transform: none !important;
  color: var(--sidebar-muted) !important;
  margin: 0 0 calc(8px * var(--ui-scale, 1)) !important;
  text-align: left !important;
  padding: 0 calc(10px * var(--ui-scale, 1)) !important;
}

#primary-sidebar .agent-mini {
  text-align: left !important;
}

/* Compact Sentralbord bar with phone number AND central email directly under the logo */
#primary-sidebar .sidebar-sentralbord-footer {
  display: block !important;
  margin: calc(-4px * var(--ui-scale, 1)) 0 calc(4px * var(--ui-scale, 1)) !important;
  padding: 0 !important;
  border: 0 !important;
  width: 100%;
}

#primary-sidebar #sentralbord-card {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) !important;
  grid-template-rows: auto auto !important;
  align-items: center !important;
  column-gap: calc(7px * var(--ui-scale, 1)) !important;
  row-gap: calc(1px * var(--ui-scale, 1)) !important;
  padding: calc(5px * var(--ui-scale, 1)) calc(9px * var(--ui-scale, 1)) !important;
  margin: 0 !important;
  border-radius: calc(9px * var(--ui-scale, 1)) !important;
  background: rgba(255, 255, 255, 0.04) !important;
  border: calc(1px * var(--ui-scale, 1)) solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: none !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

#primary-sidebar #sentralbord-card .service-card-heading {
  grid-column: 1;
  grid-row: 1 / span 2;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 !important;
  min-width: 0;
}

#primary-sidebar #sentralbord-card .service-icon {
  width: calc(19px * var(--ui-scale, 1)) !important;
  height: calc(19px * var(--ui-scale, 1)) !important;
  border-radius: calc(5px * var(--ui-scale, 1)) !important;
  background: rgba(56, 189, 248, 0.14) !important;
  color: #7dd3fc !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0;
}

#primary-sidebar #sentralbord-card .service-icon svg {
  width: calc(12px * var(--ui-scale, 1)) !important;
  height: calc(12px * var(--ui-scale, 1)) !important;
}

#primary-sidebar #sentralbord-card .service-card-heading h2 {
  display: none !important;
}

#primary-sidebar #sentralbord-card strong#central-number-display:not(.channel-off) {
  grid-column: 2;
  grid-row: 1;
  display: block !important;
  margin: 0 !important;
  font-family: var(--font) !important;
  font-size: calc(11.5px * var(--ui-scale, 1)) !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
  color: #e2e8f0 !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#primary-sidebar #sentralbord-card #central-email-display:not(.channel-off) {
  grid-column: 2;
  grid-row: 2;
  display: block !important;
  margin: 0 !important;
  font-family: var(--font) !important;
  font-size: calc(10.5px * var(--ui-scale, 1)) !important;
  font-weight: 500 !important;
  line-height: 1.2 !important;
  color: #94a3b8 !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* ==========================================================================
   EMAIL TICKETING SYSTEM V2 — STREAMLINED DESK & MOBILE ARCHITECTURE
   ========================================================================== */

#email-tab.et-redesign {
  display: none;
  flex-direction: column;
  gap: calc(6px * var(--ui-scale, 1));
}

#email-tab.et-redesign.active {
  display: flex;
}

@media (min-width: 901px) {
  #email-tab.et-redesign.active {
    height: 100%;
    min-height: 0;
    max-height: 100%;
  }
}

/* Compact Unboxed Header */
#email-tab .et-command-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(10px * var(--ui-scale, 1));
  padding: 0;
  margin: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  flex: 0 0 auto;
}

#email-tab .et-command-title-group {
  min-width: 0;
}

#email-tab .et-command-title-group .eyebrow {
  display: none;
}

.et-title-row {
  display: flex;
  align-items: center;
  gap: calc(10px * var(--ui-scale, 1));
  flex-wrap: wrap;
}

.et-title-row h1 {
  margin: 0;
  font-size: calc(20px * var(--ui-scale, 1));
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.et-mailbox-address {
  display: none !important;
}

.et-kpi-strip.hidden {
  display: none !important;
}

.et-command-actions {
  display: flex;
  align-items: center;
  gap: calc(6px * var(--ui-scale, 1));
  flex-shrink: 0;
}

.et-action-btn {
  min-height: calc(32px * var(--ui-scale, 1));
  padding: calc(5px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
  font-size: calc(12px * var(--ui-scale, 1));
  font-weight: 700;
  border-radius: calc(8px * var(--ui-scale, 1));
  white-space: nowrap;
}

.et-action-btn.active {
  border-color: var(--blue, #0d6b5c);
  color: var(--blue, #0d6b5c);
  background: var(--blue-soft, rgba(13, 107, 92, 0.08));
}

/* Vertical Left Rail for Folders & Status Filters on Desktop */
#email-tab .et-toolbar-bar {
  display: flex;
  flex-direction: column;
  padding: calc(8px * var(--ui-scale, 1)) calc(6px * var(--ui-scale, 1));
  margin: 0;
  background: var(--canvas);
  border-right: calc(1px * var(--ui-scale, 1)) solid var(--line);
  flex: 0 0 auto;
  min-width: 0;
}

#email-tab .email-toolbar-tabs.et-folder-status-tabs {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: calc(4px * var(--ui-scale, 1));
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  width: 100%;
  box-sizing: border-box;
}

.et-segmented-folders,
.et-segmented-statuses {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: calc(2px * var(--ui-scale, 1));
  width: 100%;
}

#email-tab .et-folder-status-tabs .email-toolbar-divider {
  display: block !important;
  width: 100%;
  height: calc(1px * var(--ui-scale, 1));
  background: var(--line);
  margin: calc(5px * var(--ui-scale, 1)) 0;
  flex-shrink: 0;
}

#email-tab .email-toolbar-tabs.et-folder-status-tabs :is(.email-folder-btn, .ticket-filter-btn) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: calc(30px * var(--ui-scale, 1));
  padding: calc(5px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1));
  border-radius: calc(7px * var(--ui-scale, 1));
  border: calc(1px * var(--ui-scale, 1)) solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: calc(12px * var(--ui-scale, 1));
  font-weight: 600;
  gap: calc(6px * var(--ui-scale, 1));
  box-sizing: border-box;
  text-align: left;
}

#email-tab .email-toolbar-tabs.et-folder-status-tabs :is(.email-folder-btn, .ticket-filter-btn):hover {
  color: var(--ink);
  background: rgba(15, 23, 42, 0.04);
}

#email-tab .email-toolbar-tabs.et-folder-status-tabs :is(.email-folder-btn, .ticket-filter-btn).active {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
  box-shadow: 0 calc(1px * var(--ui-scale, 1)) calc(2px * var(--ui-scale, 1)) rgba(15, 23, 42, 0.05);
  font-weight: 700;
}

#email-tab .email-toolbar-tabs.et-folder-status-tabs .et-folder-label {
  background: transparent !important;
  padding: 0 !important;
  color: inherit !important;
  font-size: calc(12px * var(--ui-scale, 1)) !important;
  font-weight: inherit !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#email-tab .email-toolbar-tabs.et-folder-status-tabs :is(#email-folder-count-drafts, #email-folder-count-spam, .filter-count) {
  padding: calc(1px * var(--ui-scale, 1)) calc(5px * var(--ui-scale, 1));
  border-radius: calc(5px * var(--ui-scale, 1));
  font-size: calc(11px * var(--ui-scale, 1));
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: rgba(15, 23, 42, 0.06);
  color: var(--muted);
}

/* Inbox counter: ONLY the new-emails digit is colored in blue! */
#email-tab #email-folder-count-inbox {
  display: inline-flex;
  align-items: center;
  gap: calc(1px * var(--ui-scale, 1));
  padding: 0 !important;
  background: transparent !important;
  color: var(--muted) !important;
  font-size: calc(11.5px * var(--ui-scale, 1));
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

#email-tab #email-folder-count-inbox .et-count-new,
#email-tab #email-folder-count-inbox .inbox-new-count {
  color: #2563eb !important;
  background: transparent !important;
  padding: 0 !important;
  font-size: calc(11.5px * var(--ui-scale, 1)) !important;
  font-weight: 800 !important;
}

#email-tab #email-folder-count-inbox .et-count-sep,
#email-tab #email-folder-count-inbox .et-count-total,
#email-tab #email-folder-count-inbox .inbox-count-sep,
#email-tab #email-folder-count-inbox .inbox-total-count {
  background: transparent !important;
  color: var(--muted) !important;
  padding: 0 !important;
  font-weight: 600 !important;
}

/* Queue Controls (Search + 2 Compact Dropdowns inside Queue Panel) */
.et-queue-controls {
  display: flex;
  flex-direction: column;
  gap: calc(6px * var(--ui-scale, 1));
  padding: calc(8px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
  border-bottom: calc(1px * var(--ui-scale, 1)) solid var(--line);
  background: var(--surface);
  flex: 0 0 auto;
}

.et-queue-search-row {
  display: flex;
  align-items: center;
  gap: calc(6px * var(--ui-scale, 1));
}

.et-queue-search {
  margin: 0 !important;
  height: calc(32px * var(--ui-scale, 1));
  flex: 1 1 auto;
  min-width: 0;
}

.et-mobile-filter-btn,
.et-mobile-inspector-bar {
  display: none;
}

.et-precision-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: calc(6px * var(--ui-scale, 1));
}

.et-filter-select {
  width: 100%;
  min-width: 0;
  height: calc(28px * var(--ui-scale, 1));
  padding: 0 calc(18px * var(--ui-scale, 1)) 0 calc(7px * var(--ui-scale, 1));
  font-size: calc(11px * var(--ui-scale, 1));
  font-weight: 600;
  color: var(--ink);
  background-color: var(--canvas);
  border: calc(1px * var(--ui-scale, 1)) solid var(--line);
  border-radius: calc(7px * var(--ui-scale, 1));
  cursor: pointer;
  text-overflow: ellipsis;
}

.et-pull-refresh {
  padding: calc(7px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
  text-align: center;
  font-size: calc(11.5px * var(--ui-scale, 1));
  font-weight: 700;
  color: var(--blue, #0d6b5c);
  background: var(--blue-soft, #e9f4f1);
  border-bottom: calc(1px * var(--ui-scale, 1)) solid var(--line);
  flex: 0 0 auto;
}

body.et-resizing-panels,
body.et-resizing-panels * {
  cursor: col-resize !important;
  user-select: none !important;
}

/* Desktop Workspace Grid (min-width: 901px only!) */
@media (min-width: 901px) {
  #email-tab .et-workspace-layout {
    --et-queue-width: calc(330px * var(--ui-scale, 1));
    display: grid !important;
    grid-template-columns: calc(146px * var(--ui-scale, 1)) var(--et-queue-width, calc(330px * var(--ui-scale, 1))) minmax(0, 1fr) minmax(calc(265px * var(--ui-scale, 1)), calc(300px * var(--ui-scale, 1)));
    flex: 1 1 auto;
    min-height: 0 !important;
    height: auto;
    border: calc(1px * var(--ui-scale, 1)) solid var(--line);
    border-radius: calc(14px * var(--ui-scale, 1));
    overflow: hidden !important;
    background: var(--surface);
  }

  #email-tab .et-workspace-layout:has(#email-inspector-panel.hidden) {
    grid-template-columns: calc(146px * var(--ui-scale, 1)) var(--et-queue-width, calc(330px * var(--ui-scale, 1))) minmax(0, 1fr);
  }

  /* Hide Utvid buttons on desktop as requested */
  #email-tab #btn-toggle-email-wide,
  #email-tab #btn-toggle-email-composer {
    display: none !important;
  }
}

/* Pane 1: Smart Queue Panel */
.et-queue-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  border-right: calc(1px * var(--ui-scale, 1)) solid var(--line);
  background: var(--surface);
  min-height: 0;
}

/* Horizontal Drag Resizer Handle along the right edge of the email list */
.et-queue-resizer {
  position: absolute;
  top: 0;
  right: calc(-5px * var(--ui-scale, 1));
  bottom: 0;
  width: calc(10px * var(--ui-scale, 1));
  cursor: col-resize;
  z-index: 20;
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.et-queue-resizer::after {
  content: "";
  width: calc(3px * var(--ui-scale, 1));
  height: calc(36px * var(--ui-scale, 1));
  border-radius: calc(999px * var(--ui-scale, 1));
  background: var(--line);
  opacity: 0.55;
  transition: background-color 0.15s ease, height 0.15s ease, opacity 0.15s ease;
}

.et-queue-resizer:hover::after,
.et-queue-resizer.is-dragging::after {
  background: var(--blue, #0d6b5c);
  height: calc(56px * var(--ui-scale, 1));
  opacity: 1;
}

.et-queue-head {
  display: none !important;
}

.et-ticket-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding: calc(6px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
  display: flex;
  flex-direction: column;
  gap: calc(4px * var(--ui-scale, 1));
}

/* Optional Sender Group Header when "Etter avsender" is selected */
.et-sender-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(6px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1)) calc(3px * var(--ui-scale, 1));
  margin-top: calc(4px * var(--ui-scale, 1));
  font-size: calc(10.5px * var(--ui-scale, 1));
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  border-bottom: calc(1px * var(--ui-scale, 1)) solid var(--line);
}

.et-sender-group-header small {
  font-size: calc(10px * var(--ui-scale, 1));
  font-weight: 700;
  padding: calc(1px * var(--ui-scale, 1)) calc(5px * var(--ui-scale, 1));
  border-radius: calc(999px * var(--ui-scale, 1));
  background: var(--canvas);
  color: var(--muted);
}

/* Minimalist, Modern Ticket Card */
.et-ticket-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: calc(3px * var(--ui-scale, 1));
  padding: calc(9px * var(--ui-scale, 1)) calc(11px * var(--ui-scale, 1));
  border: calc(1px * var(--ui-scale, 1)) solid transparent;
  border-bottom-color: var(--line);
  border-radius: calc(9px * var(--ui-scale, 1));
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.14s ease, background-color 0.14s ease;
}

.et-ticket-card.unread-thread {
  background: var(--canvas);
  border-color: rgba(13, 107, 92, 0.22);
}

.et-ticket-card:hover {
  background: var(--canvas);
  border-color: var(--line);
}

.et-ticket-card.active {
  background: var(--blue-soft, rgba(13, 107, 92, 0.08));
  border-color: var(--blue, #0d6b5c);
}

.et-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(8px * var(--ui-scale, 1));
}

.et-card-id-group {
  display: flex;
  align-items: center;
  gap: calc(6px * var(--ui-scale, 1));
  min-width: 0;
}

.et-ticket-num {
  font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: calc(10.5px * var(--ui-scale, 1));
  font-weight: 600;
  color: var(--muted);
  opacity: 0.8;
  flex-shrink: 0;
}

.et-card-customer {
  font-size: calc(13px * var(--ui-scale, 1));
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.et-ticket-card.unread-thread .et-card-customer {
  font-weight: 800;
}

.et-card-time {
  font-size: calc(11px * var(--ui-scale, 1));
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.et-card-subject-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(6px * var(--ui-scale, 1));
}

.et-card-subject {
  font-size: calc(12.5px * var(--ui-scale, 1));
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.et-ticket-card.unread-thread .et-card-subject {
  font-weight: 700;
}

.et-card-bottom-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(8px * var(--ui-scale, 1));
  min-width: 0;
}

.et-card-snippet {
  margin: 0;
  font-size: calc(11.5px * var(--ui-scale, 1));
  line-height: 1.3;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1 1 auto;
  min-width: 0;
}

/* Vibrant Colorful Metadata Pills & Waiting Timers (E-post & Meldinger) */
.et-colorful-meta-row,
.et-case-badges-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: calc(5px * var(--ui-scale, 1));
  margin-top: calc(7px * var(--ui-scale, 1));
}

.et-case-badges-row.hidden {
  display: none !important;
}

.et-meta-pill {
  display: inline-flex;
  align-items: center;
  gap: calc(4px * var(--ui-scale, 1));
  padding: calc(2px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1));
  border-radius: calc(999px * var(--ui-scale, 1));
  font-size: calc(11px * var(--ui-scale, 1));
  font-weight: 700;
  line-height: 1.35;
  white-space: nowrap;
  border: calc(1px * var(--ui-scale, 1)) solid transparent;
  font-variant-numeric: tabular-nums;
}

/* Status: Ny (Vivid Blue) */
.et-meta-pill.pill-status-open {
  background: #dbeafe;
  color: #1d4ed8;
  border-color: #93c5fd;
}

/* Status: Under arbeid (Vivid Amber/Orange) */
.et-meta-pill.pill-status-progress {
  background: #fef3c7;
  color: #b45309;
  border-color: #fcd34d;
}

/* Status: Lukket (Vivid Emerald Green) */
.et-meta-pill.pill-status-closed {
  background: #d1fae5;
  color: #047857;
  border-color: #6ee7b7;
}

/* Status: Utkast (Vivid Purple) */
.et-meta-pill.pill-status-draft {
  background: #f3e8ff;
  color: #6d28d9;
  border-color: #d8b4fe;
}

/* Assigned Agent: Who took the email (Vivid Violet/Indigo) */
.et-meta-pill.pill-agent {
  background: #ede9fe;
  color: #5b21b6;
  border-color: #c4b5fd;
}

/* Unassigned New Email: Ikke tildelt */
.et-meta-pill.pill-unassigned {
  background: #f1f5f9;
  color: #475569;
  border-color: #cbd5e1;
}

/* Depot / Garaj (Vivid Sky Cyan) */
.et-meta-pill.pill-depot {
  background: #e0f2fe;
  color: #0369a1;
  border-color: #7dd3fc;
}

.et-meta-pill.pill-neutral {
  background: #f1f5f9;
  color: #334155;
  border-color: #cbd5e1;
}

/* SMS source marker: Socialboards (diverted BML SMS) and MBN (agent line) */
.et-meta-pill.pill-source-socialboards {
  background: #eef2ff;
  color: #4338ca;
  border-color: #a5b4fc;
}

.et-meta-pill.pill-source-mbn {
  background: #ecfdf5;
  color: #047857;
  border-color: #6ee7b7;
}

.et-meta-pill.pill-source-zisson {
  background: #ecfeff;
  color: #0e7490;
  border-color: #67e8f9;
}

.et-meta-pill.pill-source-mixed {
  background: #fffbeb;
  color: #b45309;
  border-color: #fcd34d;
}

/* Waiting Timer Badges (colored by how long customer has been waiting) */
.et-meta-pill.pill-waiting.waiting-normal {
  background: #e0e7ff;
  color: #3730a3;
  border-color: #a5b4fc;
}

.et-meta-pill.pill-waiting.waiting-warning {
  background: #ffedd5;
  color: #c2410c;
  border-color: #fdba74;
}

.et-meta-pill.pill-waiting.waiting-critical {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fca5a5;
}

/* Dark mode variants for colorful pills */
html[data-theme="dark"] .et-meta-pill.pill-status-open {
  background: rgba(37, 99, 235, 0.24);
  color: #93c5fd;
  border-color: rgba(96, 165, 250, 0.45);
}

html[data-theme="dark"] .et-meta-pill.pill-status-progress {
  background: rgba(217, 119, 6, 0.24);
  color: #fcd34d;
  border-color: rgba(251, 191, 36, 0.45);
}

html[data-theme="dark"] .et-meta-pill.pill-status-closed {
  background: rgba(5, 150, 105, 0.24);
  color: #6ee7b7;
  border-color: rgba(52, 211, 153, 0.45);
}

html[data-theme="dark"] .et-meta-pill.pill-agent {
  background: rgba(124, 58, 237, 0.24);
  color: #ddd6fe;
  border-color: rgba(167, 139, 250, 0.45);
}

html[data-theme="dark"] .et-meta-pill.pill-unassigned {
  background: rgba(148, 163, 184, 0.18);
  color: #cbd5e1;
  border-color: rgba(148, 163, 184, 0.38);
}

html[data-theme="dark"] .et-meta-pill.pill-depot {
  background: rgba(2, 132, 199, 0.24);
  color: #7dd3fc;
  border-color: rgba(56, 189, 248, 0.45);
}

html[data-theme="dark"] .et-meta-pill.pill-source-socialboards {
  background: rgba(79, 70, 229, 0.25);
  color: #c7d2fe;
  border-color: rgba(129, 140, 248, 0.45);
}

html[data-theme="dark"] .et-meta-pill.pill-source-mbn {
  background: rgba(5, 150, 105, 0.24);
  color: #6ee7b7;
  border-color: rgba(52, 211, 153, 0.45);
}

html[data-theme="dark"] .et-meta-pill.pill-source-mixed {
  background: rgba(217, 119, 6, 0.24);
  color: #fcd34d;
  border-color: rgba(251, 191, 36, 0.45);
}

html[data-theme="dark"] .et-meta-pill.pill-source-zisson {
  background: rgba(6, 182, 212, 0.2);
  color: #67e8f9;
  border-color: rgba(34, 211, 238, 0.45);
}

html[data-theme="dark"] .et-meta-pill.pill-waiting.waiting-normal {
  background: rgba(79, 70, 229, 0.25);
  color: #c7d2fe;
  border-color: rgba(129, 140, 248, 0.45);
}

html[data-theme="dark"] .et-meta-pill.pill-waiting.waiting-warning {
  background: rgba(234, 88, 12, 0.25);
  color: #fdba74;
  border-color: rgba(251, 146, 60, 0.45);
}

html[data-theme="dark"] .et-meta-pill.pill-waiting.waiting-critical {
  background: rgba(220, 38, 38, 0.26);
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.45);
}

/* Single-Email Reading Pane (Never Chat-Style!) */
.et-timeline-history {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: calc(14px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1));
  display: flex;
  flex-direction: column;
  gap: calc(10px * var(--ui-scale, 1));
}

.et-single-email-switcher {
  display: inline-flex;
  align-items: center;
  gap: calc(6px * var(--ui-scale, 1));
  flex-wrap: wrap;
  padding: calc(4px * var(--ui-scale, 1));
  background: var(--canvas);
  border: calc(1px * var(--ui-scale, 1)) solid var(--line);
  border-radius: calc(10px * var(--ui-scale, 1));
  align-self: flex-start;
}

.et-single-email-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: calc(12px * var(--ui-scale, 1));
  font-weight: 700;
  padding: calc(5px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
  border-radius: calc(7px * var(--ui-scale, 1));
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: calc(5px * var(--ui-scale, 1));
}

.et-single-email-tab.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 calc(1px * var(--ui-scale, 1)) calc(3px * var(--ui-scale, 1)) rgba(15, 23, 42, 0.08);
}

.email-message-card.et-single-email-doc {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  align-self: stretch !important;
  border: calc(1px * var(--ui-scale, 1)) solid var(--line);
  border-radius: calc(12px * var(--ui-scale, 1));
  background: var(--surface);
  box-shadow: 0 calc(2px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1)) rgba(15, 23, 42, 0.04);
}

.email-message-card.et-single-email-doc .email-message-card-head {
  padding: calc(12px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1));
  background: var(--canvas);
  border-bottom: calc(1px * var(--ui-scale, 1)) solid var(--line);
}

.email-message-card.et-single-email-doc .email-body-html {
  padding: calc(18px * var(--ui-scale, 1)) calc(18px * var(--ui-scale, 1));
  font-size: calc(14px * var(--ui-scale, 1));
  line-height: 1.6;
}

.et-doc-sender-addr {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: calc(12px * var(--ui-scale, 1));
  color: var(--muted);
  font-weight: 500;
}

.et-empty-timeline {
  margin: auto;
  max-width: calc(400px * var(--ui-scale, 1));
  text-align: center;
}

.et-empty-card {
  padding: calc(24px * var(--ui-scale, 1)) calc(20px * var(--ui-scale, 1));
  border: calc(1px * var(--ui-scale, 1)) dashed var(--line);
  border-radius: calc(12px * var(--ui-scale, 1));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(6px * var(--ui-scale, 1));
}

.et-empty-card h3 {
  margin: calc(4px * var(--ui-scale, 1)) 0 0;
  font-size: calc(15px * var(--ui-scale, 1));
  font-weight: 800;
}

.et-empty-card p {
  margin: 0;
  font-size: calc(12.5px * var(--ui-scale, 1));
  color: var(--muted);
  line-height: 1.45;
}

.et-msg-header-inline {
  display: flex;
  align-items: center;
  gap: calc(7px * var(--ui-scale, 1));
  flex-wrap: wrap;
  min-width: 0;
}

.et-msg-header-inline strong {
  font-size: calc(13px * var(--ui-scale, 1));
  font-weight: 700;
  color: var(--ink);
}

.et-msg-role-tag {
  font-size: calc(11px * var(--ui-scale, 1));
  font-weight: 700;
  padding: calc(2px * var(--ui-scale, 1)) calc(7px * var(--ui-scale, 1));
  border-radius: calc(999px * var(--ui-scale, 1));
}

.et-msg-role-tag.is-inbound {
  background: #dbeafe;
  color: #1d4ed8;
}

.et-msg-role-tag.is-outbound {
  background: #d1fae5;
  color: #047857;
}

.et-msg-cc {
  font-size: calc(11.5px * var(--ui-scale, 1));
  color: var(--muted);
}

/* Smart Mode-Switching Composer Dock */
.et-composer-dock {
  border-top: calc(1px * var(--ui-scale, 1)) solid var(--line);
  background: var(--surface);
  padding: calc(8px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
  overflow: visible !important;
}

.et-smart-composer,
.email-composer.et-smart-composer {
  display: flex;
  flex-direction: column;
  align-items: stretch !important;
  justify-content: flex-start;
  width: 100% !important;
  max-width: 100%;
  box-sizing: border-box;
  gap: calc(6px * var(--ui-scale, 1));
  overflow: visible !important;
}

.email-composer.et-smart-composer > * {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.email-composer.et-smart-composer #email-text-input {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box;
  align-self: stretch;
}

.email-composer.et-smart-composer .email-composer-actions {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(8px * var(--ui-scale, 1));
  overflow: visible !important;
}

/* Ensure Maler popup in E-post opens to the right and is never cut off */
#email-tab .template-picker {
  position: relative;
}

#email-tab #email-template-menu,
#email-tab .template-menu {
  left: 0 !important;
  right: auto !important;
  bottom: calc(100% + calc(8px * var(--ui-scale, 1))) !important;
  width: min(calc(320px * var(--ui-scale, 1)), calc(100vw - calc(32px * var(--ui-scale, 1)))) !important;
  z-index: 80 !important;
}

/* 3-dots button in composer visible on both desktop and mobile to hide non-essential buttons */
.et-mobile-tools-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-height: calc(32px * var(--ui-scale, 1));
  min-width: calc(34px * var(--ui-scale, 1));
  padding: calc(4px * var(--ui-scale, 1)) calc(9px * var(--ui-scale, 1));
  font-size: calc(13px * var(--ui-scale, 1));
  font-weight: 800;
  letter-spacing: calc(1px * var(--ui-scale, 1));
  border-radius: calc(8px * var(--ui-scale, 1));
}

.et-mobile-tools-btn.active {
  border-color: var(--blue, #0d6b5c) !important;
  color: var(--blue, #0d6b5c) !important;
  background: var(--blue-soft, rgba(13, 107, 92, 0.12)) !important;
}

/* Hide non-essential composer buttons (A, Signatur) until 3-dots button is clicked */
#email-tab:not(.mobile-composer-tools-open) .et-secondary-compose-tool {
  display: none !important;
}

.et-composer-mode-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  box-sizing: border-box;
  gap: calc(8px * var(--ui-scale, 1));
  flex-wrap: wrap;
}

.et-composer-modes {
  display: inline-flex;
  align-items: center;
  gap: calc(3px * var(--ui-scale, 1));
  background: var(--canvas);
  padding: calc(2px * var(--ui-scale, 1));
  border-radius: calc(8px * var(--ui-scale, 1));
  border: calc(1px * var(--ui-scale, 1)) solid var(--line);
}

.et-mode-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: calc(11.5px * var(--ui-scale, 1));
  font-weight: 700;
  padding: calc(4px * var(--ui-scale, 1)) calc(9px * var(--ui-scale, 1));
  border-radius: calc(6px * var(--ui-scale, 1));
  cursor: pointer;
}

.et-mode-tab.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 calc(1px * var(--ui-scale, 1)) calc(2px * var(--ui-scale, 1)) rgba(0, 0, 0, 0.06);
}

.et-composer-head-tools {
  display: flex;
  align-items: center;
  gap: calc(6px * var(--ui-scale, 1));
  min-width: 0;
}

.et-recipient-toggle-btn {
  border: calc(1px * var(--ui-scale, 1)) solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: calc(11px * var(--ui-scale, 1));
  font-weight: 700;
  padding: calc(4px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1));
  border-radius: calc(7px * var(--ui-scale, 1));
  cursor: pointer;
}

.et-recipient-toggle-btn:hover {
  color: var(--ink);
  border-color: var(--ink);
}

/* Collapsible Recipient & Subject Drawer */
.et-recipient-drawer,
.email-recipient-bar.et-recipient-drawer,
.email-recipient-bar.et-recipient-drawer.hidden {
  display: none !important;
  flex-direction: column;
  width: 100%;
  box-sizing: border-box;
  gap: calc(6px * var(--ui-scale, 1));
  padding: calc(8px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
  background: var(--canvas);
  border: calc(1px * var(--ui-scale, 1)) solid var(--line);
  border-radius: calc(9px * var(--ui-scale, 1));
}

.et-recipient-drawer.is-expanded:not(.hidden),
.email-recipient-bar.et-recipient-drawer.is-expanded:not(.hidden) {
  display: flex !important;
}

.et-contact-quick-select {
  max-width: calc(210px * var(--ui-scale, 1));
  height: calc(30px * var(--ui-scale, 1));
  font-size: calc(12px * var(--ui-scale, 1));
  border: calc(1px * var(--ui-scale, 1)) solid var(--line);
  border-radius: calc(6px * var(--ui-scale, 1));
  padding: 0 calc(8px * var(--ui-scale, 1));
  background: var(--surface);
  color: var(--ink);
}

.et-subject-field-row {
  display: flex;
  align-items: center;
  gap: calc(8px * var(--ui-scale, 1));
}

.et-subject-field-row label {
  font-size: calc(12px * var(--ui-scale, 1));
  font-weight: 700;
  color: var(--muted);
  min-width: calc(44px * var(--ui-scale, 1));
}

.et-subject-field-row input {
  flex: 1;
  min-width: 0;
}

/* Hurtigsvar Bar: Always visible with a very thin, minimalist horizontal scrollbar */
#email-tab #et-quick-reply-bar,
.et-quick-reply-bar {
  display: flex !important;
  align-items: center;
  gap: calc(5px * var(--ui-scale, 1));
  overflow-x: auto !important;
  overflow-y: hidden;
  flex-wrap: nowrap !important;
  padding: calc(2px * var(--ui-scale, 1)) calc(2px * var(--ui-scale, 1)) calc(4px * var(--ui-scale, 1));
  scrollbar-width: thin;
  scrollbar-color: rgba(100, 116, 139, 0.35) transparent;
}

#email-tab #et-quick-reply-bar::-webkit-scrollbar,
.et-quick-reply-bar::-webkit-scrollbar {
  display: block !important;
  height: calc(3px * var(--ui-scale, 1)) !important;
}

#email-tab #et-quick-reply-bar::-webkit-scrollbar-track,
.et-quick-reply-bar::-webkit-scrollbar-track {
  background: transparent;
}

#email-tab #et-quick-reply-bar::-webkit-scrollbar-thumb,
.et-quick-reply-bar::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.35);
  border-radius: calc(999px * var(--ui-scale, 1));
}

#email-tab #et-quick-reply-bar:hover::-webkit-scrollbar-thumb,
.et-quick-reply-bar:hover::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.6);
}

.et-quick-reply-label {
  font-size: calc(11px * var(--ui-scale, 1));
  font-weight: 700;
  color: var(--muted);
  flex-shrink: 0;
}

.et-quick-chip {
  border: calc(1px * var(--ui-scale, 1)) solid var(--line);
  background: var(--canvas);
  color: var(--ink);
  font-size: calc(11px * var(--ui-scale, 1));
  font-weight: 600;
  padding: calc(3px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1));
  border-radius: calc(6px * var(--ui-scale, 1));
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: border-color 0.14s ease, background-color 0.14s ease;
}

.et-quick-chip:hover {
  border-color: var(--blue, #0d6b5c);
  background: var(--blue-soft, rgba(13, 107, 92, 0.08));
}

.et-always-close-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

/* Pane 3: Customer 360° & Ticket Context Inspector */
.et-inspector-panel {
  border-left: calc(1px * var(--ui-scale, 1)) solid var(--line);
  background: var(--surface);
  overflow-y: auto;
  min-height: 0;
}

.et-inspector-content {
  padding: calc(12px * var(--ui-scale, 1));
  display: flex;
  flex-direction: column;
  gap: calc(12px * var(--ui-scale, 1));
}

.et-inspector-empty {
  padding: calc(32px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1));
  text-align: center;
  color: var(--muted);
}

.et-inspector-empty-icon {
  font-size: calc(24px * var(--ui-scale, 1));
  display: block;
  margin-bottom: calc(6px * var(--ui-scale, 1));
  opacity: 0.65;
}

.et-inspector-empty h3 {
  margin: 0 0 calc(4px * var(--ui-scale, 1));
  font-size: calc(14px * var(--ui-scale, 1));
  color: var(--ink);
}

.et-inspector-empty p {
  margin: 0;
  font-size: calc(12px * var(--ui-scale, 1));
  line-height: 1.45;
}

.et-inspector-section {
  padding: calc(11px * var(--ui-scale, 1));
  border: calc(1px * var(--ui-scale, 1)) solid var(--line);
  border-radius: calc(10px * var(--ui-scale, 1));
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: calc(8px * var(--ui-scale, 1));
}

.et-inspector-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(8px * var(--ui-scale, 1));
}

.et-inspector-eyebrow {
  font-size: calc(10px * var(--ui-scale, 1));
  font-weight: 800;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.et-contact-match-badge {
  font-size: calc(10px * var(--ui-scale, 1));
  font-weight: 700;
  padding: calc(2px * var(--ui-scale, 1)) calc(6px * var(--ui-scale, 1));
  border-radius: calc(5px * var(--ui-scale, 1));
}

.et-contact-match-badge.is-matched {
  background: rgba(13, 107, 92, 0.12);
  color: #0d6b5c;
}

.et-contact-match-badge.is-unmatched {
  background: rgba(100, 116, 139, 0.14);
  color: var(--muted);
}

.et-customer-hero {
  display: flex;
  align-items: center;
  gap: calc(10px * var(--ui-scale, 1));
}

.et-customer-avatar {
  width: calc(38px * var(--ui-scale, 1));
  height: calc(38px * var(--ui-scale, 1));
  border-radius: calc(9px * var(--ui-scale, 1));
  background: var(--blue-soft, rgba(13, 107, 92, 0.14));
  color: var(--blue, #0d6b5c);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: calc(13.5px * var(--ui-scale, 1));
  flex-shrink: 0;
}

.et-customer-hero-copy {
  min-width: 0;
}

.et-customer-hero-copy h4 {
  margin: 0;
  font-size: calc(13.5px * var(--ui-scale, 1));
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.et-customer-hero-copy p {
  margin: calc(2px * var(--ui-scale, 1)) 0 0;
  font-size: calc(11.5px * var(--ui-scale, 1));
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.et-customer-role {
  display: inline-block;
  margin-top: calc(2px * var(--ui-scale, 1));
  font-size: calc(11px * var(--ui-scale, 1));
  font-weight: 600;
  color: var(--blue, #0d6b5c);
}

.et-customer-kv-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: calc(6px * var(--ui-scale, 1));
}

.et-kv-cell {
  padding: calc(6px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1));
  border-radius: calc(7px * var(--ui-scale, 1));
  background: var(--canvas);
  border: calc(1px * var(--ui-scale, 1)) solid var(--line);
  display: flex;
  flex-direction: column;
  gap: calc(2px * var(--ui-scale, 1));
  min-width: 0;
}

.et-kv-cell span {
  font-size: calc(10px * var(--ui-scale, 1));
  color: var(--muted);
}

.et-kv-cell strong {
  font-size: calc(11.5px * var(--ui-scale, 1));
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.et-inspector-quick-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: calc(5px * var(--ui-scale, 1));
}

.et-insp-btn {
  padding: calc(5px * var(--ui-scale, 1)) calc(6px * var(--ui-scale, 1));
  font-size: calc(11px * var(--ui-scale, 1));
  font-weight: 700;
  justify-content: center;
}

.et-ticket-code-chip {
  font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: calc(11px * var(--ui-scale, 1));
  font-weight: 700;
  color: var(--muted);
}

.et-case-meta-list {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: calc(6px * var(--ui-scale, 1));
}

.et-case-meta-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(8px * var(--ui-scale, 1));
  font-size: calc(11.5px * var(--ui-scale, 1));
}

.et-case-meta-list dt {
  color: var(--muted);
}

.et-case-meta-list dd {
  margin: 0;
  font-weight: 600;
  color: var(--ink);
  text-align: right;
}

.et-inspector-attachments,
.et-cross-history-list {
  display: flex;
  flex-direction: column;
  gap: calc(5px * var(--ui-scale, 1));
}

.et-inspector-attachment-item,
.et-cross-item {
  display: flex;
  align-items: center;
  gap: calc(8px * var(--ui-scale, 1));
  padding: calc(6px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1));
  border-radius: calc(7px * var(--ui-scale, 1));
  border: calc(1px * var(--ui-scale, 1)) solid var(--line);
  background: var(--canvas);
  color: var(--ink);
  text-decoration: none;
  font-size: calc(11.5px * var(--ui-scale, 1));
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.et-cross-item.is-static {
  cursor: default;
}

.et-inspector-attachment-item:hover,
.et-cross-item:not(.is-static):hover {
  border-color: var(--blue, #0d6b5c);
}

.et-att-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.et-att-copy strong,
.et-cross-title {
  font-size: calc(11.5px * var(--ui-scale, 1));
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.et-att-copy small,
.et-cross-item small {
  font-size: calc(10px * var(--ui-scale, 1));
  color: var(--muted);
  flex-shrink: 0;
}

.et-cross-tag {
  font-size: calc(10px * var(--ui-scale, 1));
  font-weight: 800;
  padding: calc(2px * var(--ui-scale, 1)) calc(5px * var(--ui-scale, 1));
  border-radius: calc(5px * var(--ui-scale, 1));
  background: var(--blue-soft, rgba(13, 107, 92, 0.1));
  color: var(--blue, #0d6b5c);
  flex-shrink: 0;
}

.et-inspector-muted {
  margin: 0;
  font-size: calc(11.5px * var(--ui-scale, 1));
  color: var(--muted);
  line-height: 1.45;
}

/* ============================================================================
   KONTAKTER DETAIL & SMS/EMAIL HISTORY REDESIGN (Desktop + Mobile)
   ============================================================================ */
.customer-detail-inpage-card {
  padding: calc(20px * var(--ui-scale, 1)) calc(22px * var(--ui-scale, 1));
  display: flex;
  flex-direction: column;
  gap: calc(16px * var(--ui-scale, 1));
}

.cd-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(10px * var(--ui-scale, 1));
  margin-bottom: 0;
}

.cd-manage-actions {
  display: flex;
  align-items: center;
  gap: calc(8px * var(--ui-scale, 1));
}

.cd-hero-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(16px * var(--ui-scale, 1));
  flex-wrap: wrap;
  padding-bottom: calc(14px * var(--ui-scale, 1));
  border-bottom: calc(1px * var(--ui-scale, 1)) solid var(--line);
}

.cd-role-meta {
  font-size: calc(12.5px * var(--ui-scale, 1));
  font-weight: 600;
  color: var(--muted);
}

.cd-comm-actions {
  display: flex;
  align-items: center;
  gap: calc(8px * var(--ui-scale, 1));
  flex-wrap: wrap;
}

/* Quick contact strip & mobile info toggle are hidden on desktop (full grid is shown) */
.cd-quick-contact-strip,
.cd-mobile-info-toggle,
.cd-history-toolbar {
  display: none;
}

.customer-detail-inpage-card .customer-history-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: calc(18px * var(--ui-scale, 1));
  width: 100%;
}

.customer-detail-inpage-card .customer-history-column {
  display: flex;
  flex-direction: column;
  gap: calc(10px * var(--ui-scale, 1));
  min-width: 0;
  background: var(--canvas);
  border: calc(1px * var(--ui-scale, 1)) solid var(--line);
  border-radius: calc(12px * var(--ui-scale, 1));
  padding: calc(14px * var(--ui-scale, 1));
}

.customer-detail-inpage-card .history-column-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(8px * var(--ui-scale, 1));
  padding-bottom: calc(8px * var(--ui-scale, 1));
  border-bottom: calc(1px * var(--ui-scale, 1)) solid var(--line);
}

.customer-detail-inpage-card .history-column-heading h3 {
  margin: 0;
  font-size: calc(14px * var(--ui-scale, 1));
  font-weight: 800;
  color: var(--ink);
}

.customer-detail-inpage-card .history-column-heading span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: calc(24px * var(--ui-scale, 1));
  height: calc(22px * var(--ui-scale, 1));
  padding: 0 calc(7px * var(--ui-scale, 1));
  border-radius: calc(6px * var(--ui-scale, 1));
  background: var(--surface);
  border: calc(1px * var(--ui-scale, 1)) solid var(--line);
  font-size: calc(11.5px * var(--ui-scale, 1));
  font-weight: 800;
  color: var(--ink);
}

.customer-detail-inpage-card .history-message-list {
  display: flex;
  flex-direction: column;
  gap: calc(10px * var(--ui-scale, 1));
  max-height: calc(440px * var(--ui-scale, 1));
  overflow-y: auto;
  padding-right: calc(2px * var(--ui-scale, 1));
}

.customer-detail-inpage-card .history-message {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: calc(6px * var(--ui-scale, 1));
  padding: calc(12px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1));
  border-radius: calc(10px * var(--ui-scale, 1));
  background: var(--surface);
  border: calc(1px * var(--ui-scale, 1)) solid var(--line);
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
  min-width: 0;
}

.customer-detail-inpage-card .history-message:hover {
  border-color: var(--blue, #0d6b5c);
  box-shadow: 0 calc(4px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)) rgba(15, 23, 42, 0.06);
}

.customer-detail-inpage-card .history-message.agent-message {
  border-left: calc(3px * var(--ui-scale, 1)) solid var(--blue, #0d6b5c);
}

.customer-detail-inpage-card .history-message-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(8px * var(--ui-scale, 1));
  flex-wrap: wrap;
}

.customer-detail-inpage-card .history-message-author {
  font-size: calc(11.5px * var(--ui-scale, 1));
  font-weight: 800;
  color: var(--blue, #0d6b5c);
}

.customer-detail-inpage-card .history-message-meta {
  display: inline-flex;
  align-items: center;
  gap: calc(8px * var(--ui-scale, 1));
  margin-left: auto;
}

.customer-detail-inpage-card .history-message-meta time {
  font-size: calc(11px * var(--ui-scale, 1));
  color: var(--muted);
  font-weight: 600;
}

.customer-detail-inpage-card .history-open-hint {
  font-size: calc(11px * var(--ui-scale, 1));
  font-weight: 700;
  color: var(--blue, #0d6b5c);
  opacity: 0.85;
}

.customer-detail-inpage-card .history-email-subject {
  display: block;
  font-size: calc(13px * var(--ui-scale, 1));
  font-weight: 800;
  color: var(--ink);
  line-height: 1.35;
  word-break: break-word;
}

.customer-detail-inpage-card .history-sms-text,
.customer-detail-inpage-card .email-body-text {
  margin: 0;
  font-size: calc(12.5px * var(--ui-scale, 1));
  line-height: 1.5;
  color: var(--ink);
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.customer-detail-inpage-card .history-empty {
  padding: calc(20px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1));
  text-align: center;
  font-size: calc(12.5px * var(--ui-scale, 1));
  color: var(--muted);
  background: var(--surface);
  border: calc(1px * var(--ui-scale, 1)) dashed var(--line);
  border-radius: calc(10px * var(--ui-scale, 1));
}

/* Medium Desktop (901px - 1260px): Inspector opens as an overlay drawer on the right */
@media (min-width: 901px) and (max-width: 1260px) {
  #email-tab .et-workspace-layout {
    position: relative;
    grid-template-columns: calc(146px * var(--ui-scale, 1)) var(--et-queue-width, calc(315px * var(--ui-scale, 1))) minmax(0, 1fr) !important;
  }

  #email-tab .et-inspector-panel:not(.hidden) {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: calc(300px * var(--ui-scale, 1));
    z-index: 25;
    box-shadow: calc(-8px * var(--ui-scale, 1)) 0 calc(24px * var(--ui-scale, 1)) rgba(15, 23, 42, 0.14);
  }
}

/* Mobile (< 900px): Minimalist Zero-Horizontal-Swipe UI & Collapsible Menus */
@media (max-width: 900px) {
  #email-tab.et-redesign.active {
    gap: calc(6px * var(--ui-scale, 1));
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  #email-tab .et-queue-resizer {
    display: none !important;
  }

  #email-tab .et-command-header {
    padding: 0;
    gap: calc(6px * var(--ui-scale, 1));
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: nowrap !important;
  }

  #email-tab .et-title-row {
    flex-wrap: nowrap;
    gap: calc(6px * var(--ui-scale, 1));
    min-width: 0;
  }

  #email-tab .et-title-row h1 {
    font-size: calc(19px * var(--ui-scale, 1));
    flex-shrink: 0;
  }

  #email-tab .et-mailbox-address {
    display: none !important;
  }

  #email-tab #btn-toggle-email-inspector {
    display: none;
  }

  #email-tab .et-action-btn {
    min-height: calc(31px * var(--ui-scale, 1));
    padding: calc(4px * var(--ui-scale, 1)) calc(9px * var(--ui-scale, 1));
    font-size: calc(11.5px * var(--ui-scale, 1));
  }

  /* Zero Horizontal Swipe Filter Bar on Mobile */
  #email-tab .et-toolbar-bar {
    border-right: 0;
    border-bottom: calc(1px * var(--ui-scale, 1)) solid var(--line);
    padding: calc(4px * var(--ui-scale, 1));
  }

  #email-tab .email-toolbar-tabs.et-folder-status-tabs {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: calc(5px * var(--ui-scale, 1));
    padding: calc(3px * var(--ui-scale, 1));
    overflow-x: hidden !important;
    flex-wrap: nowrap;
  }

  #email-tab .et-folder-status-tabs .email-toolbar-divider {
    display: none !important;
  }

  /* Hide secondary folders (Utkast/Søppelpost) unless filter drawer is open, keep Innboks + 3 status tabs visible */
  #email-tab:not(.mobile-filters-open) .et-segmented-folders {
    display: flex;
    width: 100%;
  }

  #email-tab:not(.mobile-filters-open) .et-segmented-folders .email-folder-btn:not([data-email-folder="INBOX"]) {
    display: none !important;
  }

  #email-tab.mobile-filters-open .et-segmented-folders {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: calc(4px * var(--ui-scale, 1));
    width: 100%;
    padding-bottom: calc(4px * var(--ui-scale, 1));
    border-bottom: calc(1px * var(--ui-scale, 1)) solid var(--line);
  }

  /* Status tabs fit 100% width with zero horizontal scroll */
  #email-tab:not(.mobile-filters-open) .et-segmented-statuses {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: calc(3px * var(--ui-scale, 1));
    width: 100%;
  }

  #email-tab.mobile-filters-open .et-segmented-statuses {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: calc(4px * var(--ui-scale, 1));
    width: 100%;
  }

  #email-tab .email-toolbar-tabs.et-folder-status-tabs :is(.email-folder-btn, .ticket-filter-btn) {
    width: 100%;
    min-width: 0;
    min-height: calc(30px * var(--ui-scale, 1));
    padding: calc(4px * var(--ui-scale, 1)) calc(4px * var(--ui-scale, 1)) !important;
    font-size: calc(11px * var(--ui-scale, 1)) !important;
    justify-content: center !important;
    gap: calc(3px * var(--ui-scale, 1)) !important;
    white-space: nowrap !important;
    overflow: visible !important;
    text-overflow: clip !important;
    box-sizing: border-box !important;
  }

  /* Search row + Mobile Filter toggle button */
  .et-mobile-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: calc(4px * var(--ui-scale, 1));
    height: calc(34px * var(--ui-scale, 1));
    min-height: calc(34px * var(--ui-scale, 1));
    padding: 0 calc(10px * var(--ui-scale, 1));
    font-size: calc(11.5px * var(--ui-scale, 1));
    font-weight: 700;
    border-radius: calc(8px * var(--ui-scale, 1));
    flex-shrink: 0;
    white-space: nowrap;
  }

  .et-mobile-filter-btn.has-active-filter,
  #email-tab.mobile-filters-open .et-mobile-filter-btn {
    border-color: var(--blue, #0d6b5c);
    color: var(--blue, #0d6b5c);
    background: var(--blue-soft, rgba(13, 107, 92, 0.08));
  }

  .et-mobile-filter-badge {
    color: var(--blue, #0d6b5c);
    font-size: calc(14px * var(--ui-scale, 1));
    line-height: 1;
  }

  /* Hide precision dropdowns on mobile until "☰ Filtre" is tapped */
  #email-tab:not(.mobile-filters-open) .et-precision-filters {
    display: none !important;
  }

  #email-tab.mobile-filters-open .et-precision-filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: calc(5px * var(--ui-scale, 1));
    padding-top: calc(2px * var(--ui-scale, 1));
  }

  /* When a ticket is opened on mobile, hide the top header & filter tabs so the conversation gets 100% height */
  #email-tab:has(.mobile-email-thread-open) .et-command-header,
  #email-tab:has(.mobile-email-thread-open) .et-toolbar-bar {
    display: none !important;
  }

  #email-tab .et-workspace-layout {
    position: relative;
    display: block !important;
    flex: 1 1 0% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    border-radius: calc(12px * var(--ui-scale, 1));
    overflow-x: hidden !important;
  }

  #email-tab .et-queue-head {
    display: none;
  }

  #email-tab .et-queue-panel {
    border-right: 0;
    height: 100%;
    min-height: 0;
    overflow-x: hidden;
  }

  /* The folder tabs sit above the list in the same box. As a block, the list
     took the box's full height under them and its last cards were clipped
     below the edge. The list now takes only what the tabs leave. */
  #email-tab .et-workspace-layout:not(.mobile-email-thread-open) {
    display: flex !important;
    flex-direction: column;
  }

  #email-tab .et-workspace-layout:not(.mobile-email-thread-open) > .et-toolbar-bar {
    flex: 0 0 auto;
  }

  #email-tab .et-workspace-layout:not(.mobile-email-thread-open) > .et-queue-panel {
    flex: 1 1 0%;
    height: auto;
  }

  #email-tab .et-ticket-card {
    padding: calc(9px * var(--ui-scale, 1)) calc(11px * var(--ui-scale, 1));
    gap: calc(3px * var(--ui-scale, 1));
  }

  /* Mobile opened conversation top navigation bar */
  .et-mobile-case-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: calc(6px * var(--ui-scale, 1));
    margin-bottom: calc(6px * var(--ui-scale, 1));
    width: 100%;
  }

  .et-mobile-case-actions {
    display: flex;
    align-items: center;
    gap: calc(5px * var(--ui-scale, 1));
  }

  .et-mobile-case-bar .mobile-email-list-button,
  .et-mobile-case-btn,
  .mobile-email-inspector-button {
    margin-bottom: 0;
    min-height: calc(30px * var(--ui-scale, 1));
    padding: calc(4px * var(--ui-scale, 1)) calc(9px * var(--ui-scale, 1));
    font-size: calc(11.5px * var(--ui-scale, 1));
    font-weight: 700;
    border-radius: calc(8px * var(--ui-scale, 1));
    white-space: nowrap;
  }

  .et-mobile-case-btn.active,
  .mobile-email-inspector-button.active {
    border-color: var(--blue, #0d6b5c);
    color: var(--blue, #0d6b5c);
    background: var(--blue-soft, rgba(13, 107, 92, 0.08));
  }

  #email-tab .et-case-header {
    padding: calc(8px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
  }

  #email-tab .et-case-subject-row h2 {
    font-size: calc(14.5px * var(--ui-scale, 1));
    white-space: normal;
  }

  #email-tab .et-case-sender-sub {
    white-space: normal;
  }

  #email-tab .et-case-controls-row {
    display: block;
    width: 100%;
    margin-top: calc(6px * var(--ui-scale, 1));
    padding-top: calc(8px * var(--ui-scale, 1));
    border-top: calc(1px * var(--ui-scale, 1)) solid var(--line);
  }

  #email-tab .ticket-controls {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: calc(6px * var(--ui-scale, 1)) !important;
    align-items: center;
    width: 100%;
  }

  #email-tab .ticket-controls.hidden {
    display: none !important;
  }

  /* Minimalist Full-Width Mobile Composer */
  #email-tab .et-composer-dock {
    padding: calc(8px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
    width: 100%;
    box-sizing: border-box;
  }

  #email-tab .email-composer.et-smart-composer {
    width: 100% !important;
    max-width: 100% !important;
    align-items: stretch !important;
  }

  #email-tab .et-composer-mode-bar {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: calc(6px * var(--ui-scale, 1));
    width: 100%;
  }

  /* Keep Utvid button available on mobile as requested */
  #email-tab #btn-toggle-email-wide {
    display: none !important;
  }

  #email-tab #btn-toggle-email-composer {
    display: inline-flex !important;
    min-height: calc(28px * var(--ui-scale, 1));
    padding: calc(3px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1));
    font-size: calc(11px * var(--ui-scale, 1));
    font-weight: 700;
    border-radius: calc(7px * var(--ui-scale, 1));
  }

  #email-tab .et-recipient-toggle-btn {
    padding: calc(4px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1));
    font-size: calc(11px * var(--ui-scale, 1));
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* Recipient drawer fits 100% width on mobile without horizontal overflow */
  #email-tab .et-recipient-drawer .recipient-row,
  #email-tab .et-recipient-drawer .email-copy-fields {
    flex-wrap: wrap;
    width: 100%;
  }

  #email-tab .et-contact-quick-select {
    max-width: 100%;
    width: 100%;
  }

  #email-tab:not(.mobile-composer-tools-open) .et-secondary-compose-tool {
    display: none !important;
  }

  #email-tab.mobile-composer-tools-open .et-secondary-compose-tool {
    display: inline-flex !important;
    min-height: calc(30px * var(--ui-scale, 1)) !important;
    padding: calc(4px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1)) !important;
    font-size: calc(11px * var(--ui-scale, 1)) !important;
    font-weight: 700 !important;
    border-radius: calc(8px * var(--ui-scale, 1)) !important;
  }

  #email-tab #email-text-input {
    width: 100% !important;
    max-width: 100% !important;
    min-height: calc(68px * var(--ui-scale, 1));
    box-sizing: border-box;
  }

  /* Full-width bottom action bar on mobile */
  #email-tab .email-composer-actions {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: wrap !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    gap: calc(6px * var(--ui-scale, 1)) !important;
  }

  #email-tab .email-compose-tools {
    display: inline-flex !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: calc(5px * var(--ui-scale, 1)) !important;
    width: auto !important;
    flex: 0 0 auto !important;
  }

  #email-tab .email-attachment-button {
    min-height: calc(32px * var(--ui-scale, 1)) !important;
    padding: calc(4px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1)) !important;
    border-radius: calc(8px * var(--ui-scale, 1)) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: calc(13px * var(--ui-scale, 1)) !important;
  }

  #email-tab .email-attachment-button .et-tool-label {
    display: none;
  }

  /* Maler button sits right next to Attach */
  #email-tab .email-compose-tools .template-picker {
    display: inline-flex !important;
  }

  #email-tab .email-compose-tools #btn-email-templates {
    min-height: calc(32px * var(--ui-scale, 1)) !important;
    padding: calc(4px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1)) !important;
    font-size: calc(11.5px * var(--ui-scale, 1)) !important;
    font-weight: 700 !important;
    border-radius: calc(8px * var(--ui-scale, 1)) !important;
  }

  /* 3-dots button for more options */
  .et-mobile-tools-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: calc(32px * var(--ui-scale, 1)) !important;
    min-width: calc(32px * var(--ui-scale, 1)) !important;
    padding: calc(4px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1)) !important;
    font-size: calc(13px * var(--ui-scale, 1)) !important;
    font-weight: 800 !important;
    letter-spacing: calc(1px * var(--ui-scale, 1)) !important;
    border-radius: calc(8px * var(--ui-scale, 1)) !important;
  }

  .et-mobile-tools-btn.active {
    border-color: var(--blue, #0d6b5c) !important;
    color: var(--blue, #0d6b5c) !important;
    background: var(--blue-soft, rgba(13, 107, 92, 0.12)) !important;
  }

  #email-tab .email-compose-submit {
    display: inline-flex !important;
    align-items: center !important;
    gap: calc(6px * var(--ui-scale, 1)) !important;
    margin-left: auto !important;
    width: auto !important;
    flex: 0 0 auto !important;
    justify-content: flex-end !important;
  }

  #email-tab #btn-close-email,
  #email-tab #btn-send-email {
    min-height: calc(32px * var(--ui-scale, 1)) !important;
    padding: calc(5px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1)) !important;
    font-size: calc(12px * var(--ui-scale, 1)) !important;
    font-weight: 700 !important;
    white-space: nowrap !important;
    border-radius: calc(8px * var(--ui-scale, 1)) !important;
  }

  /* Prevent any horizontal overflow inside email message cards */
  #email-tab .et-timeline-history,
  #email-tab .email-message-card,
  #email-tab .email-message-content,
  #email-tab .email-body-html {
    max-width: 100%;
    overflow-x: hidden;
    word-break: break-word;
  }

  /* Prevent any horizontal overflow inside email message cards */
  #email-tab .et-timeline-history,
  #email-tab .email-message-card,
  #email-tab .email-message-content,
  #email-tab .email-body-html {
    max-width: 100%;
    overflow-x: hidden;
    word-break: break-word;
  }

  /* Hide inspector on mobile when in list view */
  #email-tab .email-inbox-layout:not(.mobile-email-thread-open) #email-inspector-panel {
    display: none !important;
  }

  /* When toggled open inside a mobile ticket, show Customer 360° Inspector as a clean slide-over sheet */
  #email-tab .email-inbox-layout.mobile-email-thread-open #email-inspector-panel:not(.hidden) {
    position: fixed;
    left: calc(8px * var(--ui-scale, 1));
    right: calc(8px * var(--ui-scale, 1));
    bottom: calc(8px * var(--ui-scale, 1));
    top: calc(64px * var(--ui-scale, 1));
    z-index: 60;
    display: flex;
    flex-direction: column;
    border: calc(1px * var(--ui-scale, 1)) solid var(--line);
    border-radius: calc(14px * var(--ui-scale, 1));
    background: var(--surface);
    box-shadow: 0 calc(18px * var(--ui-scale, 1)) calc(48px * var(--ui-scale, 1)) rgba(15, 23, 42, 0.28);
    overflow: hidden;
  }

  .et-mobile-inspector-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: calc(10px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1));
    border-bottom: calc(1px * var(--ui-scale, 1)) solid var(--line);
    background: var(--canvas);
    flex: 0 0 auto;
  }

  .et-mobile-inspector-bar strong {
    font-size: calc(13px * var(--ui-scale, 1));
    font-weight: 800;
  }

  .et-mobile-inspector-close {
    min-height: calc(28px * var(--ui-scale, 1));
    padding: calc(3px * var(--ui-scale, 1)) calc(9px * var(--ui-scale, 1));
    font-size: calc(11.5px * var(--ui-scale, 1));
    font-weight: 700;
  }

  #email-tab .email-inbox-layout.mobile-email-thread-open #email-inspector-panel:not(.hidden) .et-inspector-content {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* ==========================================================================
     MOBILE KONTAKTER DETAIL & SMS/E-POST HISTORY REDESIGN
     ========================================================================== */
  .customer-detail-inpage-card {
    padding: calc(12px * var(--ui-scale, 1));
    gap: calc(12px * var(--ui-scale, 1));
    border-radius: calc(12px * var(--ui-scale, 1));
  }

  .cd-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: calc(6px * var(--ui-scale, 1));
    flex-wrap: nowrap;
  }

  .cd-back-btn {
    min-height: calc(32px * var(--ui-scale, 1));
    padding: calc(5px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
    font-size: calc(11.5px * var(--ui-scale, 1));
    font-weight: 700;
    white-space: nowrap;
  }

  .cd-manage-actions {
    gap: calc(5px * var(--ui-scale, 1));
    flex-shrink: 0;
  }

  .cd-manage-btn {
    min-height: calc(32px * var(--ui-scale, 1));
    padding: calc(5px * var(--ui-scale, 1)) calc(9px * var(--ui-scale, 1));
    font-size: calc(11.5px * var(--ui-scale, 1));
    white-space: nowrap;
  }

  .cd-hero-header {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: calc(10px * var(--ui-scale, 1));
    padding-bottom: calc(10px * var(--ui-scale, 1));
  }

  .customer-detail-inpage-card .customer-detail-identity {
    display: grid;
    grid-template-columns: calc(44px * var(--ui-scale, 1)) minmax(0, 1fr);
    gap: calc(3px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
    align-items: center;
  }

  .customer-detail-inpage-card .customer-initial {
    grid-row: 1 / span 2;
    width: calc(44px * var(--ui-scale, 1));
    height: calc(44px * var(--ui-scale, 1));
    font-size: calc(15px * var(--ui-scale, 1));
    border-radius: calc(11px * var(--ui-scale, 1));
  }

  .customer-detail-inpage-card .customer-detail-identity h3 {
    margin: 0;
    font-size: calc(17px * var(--ui-scale, 1));
    line-height: 1.2;
  }

  .customer-detail-inpage-card .customer-detail-badges {
    grid-column: 2;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: calc(5px * var(--ui-scale, 1));
  }

  .cd-comm-actions {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: calc(6px * var(--ui-scale, 1));
    width: 100%;
  }

  .cd-comm-btn,
  .cd-mobile-info-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-width: 0;
    min-height: calc(34px * var(--ui-scale, 1));
    padding: calc(5px * var(--ui-scale, 1)) calc(4px * var(--ui-scale, 1));
    font-size: calc(11.5px * var(--ui-scale, 1));
    font-weight: 700;
    white-space: nowrap;
    border-radius: calc(8px * var(--ui-scale, 1));
  }

  /* Compact 2-column strip for Telefon & E-post on mobile by default */
  .cd-quick-contact-strip {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.3fr);
    gap: calc(6px * var(--ui-scale, 1));
    width: 100%;
  }

  .cd-quick-item {
    padding: calc(7px * var(--ui-scale, 1)) calc(9px * var(--ui-scale, 1));
    border-radius: calc(8px * var(--ui-scale, 1));
    background: var(--canvas);
    border: calc(1px * var(--ui-scale, 1)) solid var(--line);
    display: flex;
    flex-direction: column;
    gap: calc(2px * var(--ui-scale, 1));
    min-width: 0;
  }

  .cd-quick-item span {
    font-size: calc(10px * var(--ui-scale, 1));
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
  }

  .cd-quick-item strong {
    font-size: calc(12px * var(--ui-scale, 1));
    font-weight: 700;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Collapse the 7-field employee info grid on mobile until "Detaljer ▾" is tapped */
  .customer-detail-inpage-card:not(.mobile-info-expanded) #customer-info-grid-panel {
    display: none !important;
  }

  .customer-detail-inpage-card.mobile-info-expanded .cd-quick-contact-strip {
    display: none;
  }

  .customer-detail-inpage-card.mobile-info-expanded .cd-mobile-info-toggle {
    border-color: var(--blue, #0d6b5c);
    color: var(--blue, #0d6b5c);
    background: var(--blue-soft, rgba(13, 107, 92, 0.08));
  }

  .customer-detail-inpage-card.mobile-info-expanded #customer-info-grid-panel {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: calc(6px * var(--ui-scale, 1));
  }

  .customer-detail-inpage-card.mobile-info-expanded #customer-info-grid-panel .info-field {
    padding: calc(7px * var(--ui-scale, 1)) calc(9px * var(--ui-scale, 1));
  }

  /* Segmented Channel Filter Tabs on Mobile: Alle / Siste SMS / Siste e-post */
  .cd-history-toolbar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: calc(4px * var(--ui-scale, 1));
    padding: calc(3px * var(--ui-scale, 1));
    background: var(--canvas);
    border: calc(1px * var(--ui-scale, 1)) solid var(--line);
    border-radius: calc(10px * var(--ui-scale, 1));
    width: 100%;
    box-sizing: border-box;
  }

  .cd-history-tab {
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: calc(11.5px * var(--ui-scale, 1));
    font-weight: 700;
    padding: calc(6px * var(--ui-scale, 1)) calc(4px * var(--ui-scale, 1));
    border-radius: calc(7px * var(--ui-scale, 1));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: calc(4px * var(--ui-scale, 1));
    cursor: pointer;
    white-space: nowrap;
    min-width: 0;
  }

  .cd-history-tab span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: calc(18px * var(--ui-scale, 1));
    height: calc(18px * var(--ui-scale, 1));
    padding: 0 calc(5px * var(--ui-scale, 1));
    border-radius: calc(5px * var(--ui-scale, 1));
    background: rgba(100, 116, 139, 0.14);
    font-size: calc(10.5px * var(--ui-scale, 1));
    font-weight: 800;
  }

  .cd-history-tab.active {
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 calc(1px * var(--ui-scale, 1)) calc(3px * var(--ui-scale, 1)) rgba(15, 23, 42, 0.08);
  }

  .cd-history-tab.active span {
    background: var(--blue-soft, rgba(13, 107, 92, 0.14));
    color: var(--blue, #0d6b5c);
  }

  /* Full-width single-column history stack on mobile — never squished side by side! */
  .customer-detail-inpage-card .customer-history-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: calc(12px * var(--ui-scale, 1)) !important;
    width: 100% !important;
  }

  .customer-detail-inpage-card .customer-history-grid[data-history-view="sms"] .customer-history-column[data-history-channel="email"],
  .customer-detail-inpage-card .customer-history-grid[data-history-view="email"] .customer-history-column[data-history-channel="sms"] {
    display: none !important;
  }

  .customer-detail-inpage-card .customer-history-column {
    width: 100%;
    box-sizing: border-box;
    padding: calc(10px * var(--ui-scale, 1));
    gap: calc(8px * var(--ui-scale, 1));
  }

  .customer-detail-inpage-card .history-message-list {
    max-height: none;
    overflow-y: visible;
    gap: calc(8px * var(--ui-scale, 1));
  }

  .customer-detail-inpage-card .history-message {
    padding: calc(11px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1));
    width: 100%;
    box-sizing: border-box;
  }
}

/* ==========================================================================
   Telefonie MBN - per-agent MBN integration
   ========================================================================== */
.mbn-page {
  display: flex;
  flex-direction: column;
  gap: calc(16px * var(--ui-scale, 1));
  padding: calc(24px * var(--ui-scale, 1));
  max-width: calc(1180px * var(--ui-scale, 1));
  margin: 0 auto;
}
/* The login panels set display:flex, which beats the hidden attribute and
   would leave both the phone and the SMS-code step on screen at once. */
.mbn-page [hidden] { display: none !important; }

.mbn-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: calc(14px * var(--ui-scale, 1));
}
.mbn-eyebrow {
  margin: 0 0 calc(6px * var(--ui-scale, 1));
  color: var(--blue, #0d6b5c);
  font: 700 calc(11px * var(--ui-scale, 1)) var(--font);
  letter-spacing: 0.14em;
}
.mbn-head h1 {
  margin: 0 0 calc(5px * var(--ui-scale, 1));
  color: var(--ink, #182230);
  font: 800 calc(24px * var(--ui-scale, 1))/1.15 var(--display);
  letter-spacing: calc(-0.7px * var(--ui-scale, 1));
}
.mbn-sub {
  margin: 0;
  max-width: calc(560px * var(--ui-scale, 1));
  color: var(--muted, #667085);
  font-size: calc(13px * var(--ui-scale, 1));
  line-height: 1.5;
}
.mbn-connection-banner {
  display: inline-flex;
  align-items: center;
  gap: calc(8px * var(--ui-scale, 1));
  margin: 0;
  padding: calc(8px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1));
  border: calc(1px * var(--ui-scale, 1)) solid #f6d5d2;
  border-radius: calc(999px * var(--ui-scale, 1));
  background: #fdeceb;
  color: #b42318;
  font: 700 calc(12px * var(--ui-scale, 1)) var(--font);
  white-space: nowrap;
}
.mbn-connection-dot {
  width: calc(8px * var(--ui-scale, 1));
  height: calc(8px * var(--ui-scale, 1));
  border-radius: 50%;
  background: currentColor;
}
.mbn-connection-banner[data-state="up"] {
  border-color: #cfe9dc;
  background: #e8f5ef;
  color: #15714e;
}
.mbn-connection-banner[data-state="up"] .mbn-connection-dot {
  box-shadow: 0 0 0 calc(3px * var(--ui-scale, 1)) rgba(21, 113, 78, 0.16);
}

.mbn-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  align-items: start;
  gap: calc(16px * var(--ui-scale, 1));
}

.mbn-card {
  display: flex;
  flex-direction: column;
  gap: calc(12px * var(--ui-scale, 1));
  min-width: 0;
  padding: calc(18px * var(--ui-scale, 1));
  border: calc(1px * var(--ui-scale, 1)) solid var(--line, #e7eaf0);
  border-radius: calc(16px * var(--ui-scale, 1));
  background: var(--surface, #fff);
  box-shadow: 0 calc(1px * var(--ui-scale, 1)) calc(2px * var(--ui-scale, 1)) rgba(16, 24, 40, 0.04);
}
.mbn-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: calc(10px * var(--ui-scale, 1));
}
.mbn-account .mbn-card-head { align-items: center; }
.mbn-card-head h3 {
  margin: 0;
  color: var(--ink, #182230);
  font: 700 calc(15px * var(--ui-scale, 1)) var(--display);
  letter-spacing: calc(-0.2px * var(--ui-scale, 1));
}
.mbn-state {
  margin: calc(3px * var(--ui-scale, 1)) 0 0;
  color: var(--muted, #667085);
  font: 600 calc(12px * var(--ui-scale, 1)) var(--font);
}
.mbn-hint {
  margin: 0;
  color: var(--muted, #667085);
  font-size: calc(12px * var(--ui-scale, 1));
  line-height: 1.45;
}
.mbn-count {
  flex: 0 0 auto;
  padding: calc(3px * var(--ui-scale, 1)) calc(9px * var(--ui-scale, 1));
  border-radius: calc(999px * var(--ui-scale, 1));
  background: var(--blue-soft, #e9f4f1);
  color: var(--blue, #0d6b5c);
  font: 700 calc(11px * var(--ui-scale, 1)) var(--font);
  font-variant-numeric: tabular-nums;
}
.mbn-count:empty { display: none; }
.mbn-alert {
  margin: 0;
  padding: calc(10px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1));
  border: calc(1px * var(--ui-scale, 1)) solid #f6d5d2;
  border-radius: calc(12px * var(--ui-scale, 1));
  background: #fdeceb;
  color: #b42318;
  font-size: calc(12px * var(--ui-scale, 1));
  line-height: 1.45;
}
.mbn-login {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: calc(10px * var(--ui-scale, 1));
}
.mbn-login .mbn-field { flex: 1 1 calc(220px * var(--ui-scale, 1)); }
.mbn-login .button { flex: 0 0 auto; }

/* Zisson Login Progress & Feedback */
.zisson-progress-container {
  width: 100%;
  margin-top: calc(12px * var(--ui-scale, 1));
  padding: calc(14px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1));
  border: calc(1px * var(--ui-scale, 1)) solid #cce3de;
  border-radius: calc(12px * var(--ui-scale, 1));
  background: #f4fbf8;
  display: flex;
  flex-direction: column;
  gap: calc(10px * var(--ui-scale, 1));
  box-sizing: border-box;
}
.zisson-progress-container[data-state="error"] {
  background: #fdeceb;
  border-color: #f6d5d2;
}
.zisson-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.zisson-progress-title {
  display: flex;
  align-items: center;
  gap: calc(8px * var(--ui-scale, 1));
  font-weight: 600;
  font-size: calc(13px * var(--ui-scale, 1));
  color: #1a4d3e;
}
.zisson-progress-container[data-state="error"] .zisson-progress-title {
  color: #b42318;
}
.zisson-progress-percent {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: calc(13px * var(--ui-scale, 1));
  color: #0d6b5c;
}
.zisson-progress-container[data-state="error"] .zisson-progress-percent {
  color: #b42318;
}
.zisson-progress-track {
  width: 100%;
  height: calc(8px * var(--ui-scale, 1));
  background: #e1eee8;
  border-radius: calc(999px * var(--ui-scale, 1));
  overflow: hidden;
  position: relative;
}
.zisson-progress-container[data-state="error"] .zisson-progress-track {
  background: #f8d7d4;
}
.zisson-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #10b981 0%, #0d9488 50%, #059669 100%);
  border-radius: calc(999px * var(--ui-scale, 1));
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s;
}
.zisson-progress-container[data-state="error"] .zisson-progress-bar {
  background: #dc2626 !important;
}
.zisson-progress-spinner {
  width: calc(14px * var(--ui-scale, 1));
  height: calc(14px * var(--ui-scale, 1));
  border: 2px solid #0d9488;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
  flex: 0 0 auto;
}
.zisson-progress-container[data-state="error"] .zisson-progress-spinner {
  display: none;
}
.zisson-progress-detail {
  margin: 0;
  font-size: calc(12px * var(--ui-scale, 1));
  color: #4b6358;
  line-height: 1.45;
}
.zisson-progress-container[data-state="error"] .zisson-progress-detail {
  color: #b42318;
  font-weight: 500;
}
.zisson-mfa-badge {
  display: flex;
  align-items: center;
  gap: calc(12px * var(--ui-scale, 1));
  padding: calc(10px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1));
  border-radius: calc(10px * var(--ui-scale, 1));
  background: #e6f6ee;
  border: 1.5px solid #059669;
  margin-top: calc(4px * var(--ui-scale, 1));
  animation: fadeIn 0.2s ease-out;
}
.zisson-mfa-icon {
  font-size: calc(26px * var(--ui-scale, 1));
  line-height: 1;
}
.zisson-mfa-content {
  display: flex;
  flex-direction: column;
  gap: calc(2px * var(--ui-scale, 1));
}
.zisson-mfa-title {
  font-size: calc(11.5px * var(--ui-scale, 1));
  font-weight: 600;
  color: #065f46;
}
.zisson-mfa-number {
  font-size: calc(26px * var(--ui-scale, 1));
  font-weight: 800;
  color: #047857;
  letter-spacing: 0.05em;
  line-height: 1.1;
}
.zisson-mfa-sub {
  font-size: calc(11px * var(--ui-scale, 1));
  color: #047857;
}
.mbn-field {
  display: flex;
  flex-direction: column;
  gap: calc(6px * var(--ui-scale, 1));
  min-width: 0;
}
.mbn-field > span {
  color: var(--muted, #667085);
  font: 700 calc(11px * var(--ui-scale, 1)) var(--font);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.mbn-card input,
.mbn-card select,
.mbn-card textarea {
  width: 100%;
  padding: calc(10px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1));
  border: calc(1px * var(--ui-scale, 1)) solid #d9dee7;
  border-radius: calc(12px * var(--ui-scale, 1));
  background: #fff;
  color: var(--ink, #182230);
  font: 500 calc(13px * var(--ui-scale, 1)) var(--font);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.mbn-card input::placeholder,
.mbn-card textarea::placeholder { color: #9aa4b2; }
.mbn-card input:focus,
.mbn-card select:focus,
.mbn-card textarea:focus {
  outline: none;
  border-color: var(--blue, #0d6b5c);
  box-shadow: 0 0 0 calc(3px * var(--ui-scale, 1)) rgba(13, 107, 92, 0.12);
}
.mbn-card textarea {
  min-height: calc(84px * var(--ui-scale, 1));
  resize: vertical;
  line-height: 1.5;
}
.mbn-card-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: calc(10px * var(--ui-scale, 1));
  margin-top: auto;
  padding-top: calc(2px * var(--ui-scale, 1));
}

/* Lines, split by what they are used for: voice vs SMS, side by side. */
.mbn-lines {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: calc(24px * var(--ui-scale, 1));
  color: var(--muted, #667085);
  font-size: calc(12px * var(--ui-scale, 1));
}
.mbn-line-group { display: flex; flex-direction: column; gap: calc(8px * var(--ui-scale, 1)); }
.mbn-line-group-head {
  display: flex;
  align-items: center;
  gap: calc(8px * var(--ui-scale, 1));
}
.mbn-line-icon {
  display: grid;
  place-items: center;
  width: calc(24px * var(--ui-scale, 1));
  height: calc(24px * var(--ui-scale, 1));
  border-radius: calc(8px * var(--ui-scale, 1));
  background: var(--blue-soft, #e9f4f1);
  color: var(--blue, #0d6b5c);
}
.mbn-line-icon svg {
  width: calc(13px * var(--ui-scale, 1));
  height: calc(13px * var(--ui-scale, 1));
}
.mbn-line-group-head h4 {
  margin: 0;
  color: var(--ink, #182230);
  font: 700 calc(12px * var(--ui-scale, 1)) var(--font);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.mbn-line-badge {
  margin-left: auto;
  padding: calc(2px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1));
  border-radius: calc(999px * var(--ui-scale, 1));
  background: #f1f3f6;
  color: var(--muted, #667085);
  font: 700 calc(11px * var(--ui-scale, 1)) var(--font);
  font-variant-numeric: tabular-nums;
}
.mbn-line-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(calc(148px * var(--ui-scale, 1)), 1fr));
  gap: calc(8px * var(--ui-scale, 1));
}
.mbn-line {
  display: flex;
  align-items: center;
  gap: calc(9px * var(--ui-scale, 1));
  padding: calc(9px * var(--ui-scale, 1)) calc(11px * var(--ui-scale, 1));
  border: calc(1px * var(--ui-scale, 1)) solid var(--line, #e7eaf0);
  border-radius: calc(12px * var(--ui-scale, 1));
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.mbn-line:hover { border-color: #cbd5e1; background: #fafbfc; }
.mbn-line.is-on {
  border-color: #a9d3c6;
  background: #f1f8f5;
  box-shadow: inset 0 0 0 calc(1px * var(--ui-scale, 1)) rgba(13, 107, 92, 0.06);
}
.mbn-line input {
  -webkit-appearance: none;
  appearance: none;
  flex: 0 0 auto;
  width: calc(16px * var(--ui-scale, 1));
  height: calc(16px * var(--ui-scale, 1));
  margin: 0;
  padding: 0;
  border: calc(1.5px * var(--ui-scale, 1)) solid #cbd5e1;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.mbn-line input:checked {
  border-color: var(--blue, #0d6b5c);
  background: var(--blue, #0d6b5c);
  box-shadow: inset 0 0 0 calc(3px * var(--ui-scale, 1)) #fff;
}
.mbn-line input:focus-visible {
  outline: calc(2px * var(--ui-scale, 1)) solid var(--blue, #0d6b5c);
  outline-offset: calc(2px * var(--ui-scale, 1));
}
.mbn-line-body {
  display: flex;
  flex-direction: column;
  gap: calc(1px * var(--ui-scale, 1));
  min-width: 0;
}
.mbn-line-number {
  color: var(--ink, #182230);
  font: 600 calc(13px * var(--ui-scale, 1)) var(--font);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.mbn-line-meta { color: var(--muted, #667085); font-size: calc(11px * var(--ui-scale, 1)); }
.mbn-line.is-on .mbn-line-meta { color: var(--green, #15714e); }

/* Active call */
.mbn-call-card { background: linear-gradient(160deg, #f4fbf8 0%, #fff 62%); }
.mbn-call-card[data-state="live"] { border-color: #bfe3d7; }
.mbn-call-timer {
  flex: 0 0 auto;
  color: var(--muted, #667085);
  font: 700 calc(12px * var(--ui-scale, 1)) var(--font);
  font-variant-numeric: tabular-nums;
}
.mbn-empty {
  display: flex;
  align-items: center;
  gap: calc(9px * var(--ui-scale, 1));
  margin: 0;
  padding: calc(12px * var(--ui-scale, 1)) 0;
  color: var(--muted, #667085);
  font-size: calc(13px * var(--ui-scale, 1));
}
.mbn-call-body { display: flex; flex-direction: column; gap: calc(10px * var(--ui-scale, 1)); }
.mbn-call-phone {
  margin: 0;
  color: var(--ink, #182230);
  font: 800 calc(22px * var(--ui-scale, 1)) var(--display);
  letter-spacing: calc(-0.6px * var(--ui-scale, 1));
  font-variant-numeric: tabular-nums;
}
.mbn-call-meta {
  display: flex;
  align-items: center;
  gap: calc(7px * var(--ui-scale, 1));
  margin: 0;
  color: var(--muted, #667085);
  font-size: calc(12px * var(--ui-scale, 1));
}
.mbn-pulse {
  width: calc(7px * var(--ui-scale, 1));
  height: calc(7px * var(--ui-scale, 1));
  border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 0 0 calc(3px * var(--ui-scale, 1)) rgba(22, 163, 74, 0.16);
}
.mbn-call-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: calc(10px * var(--ui-scale, 1));
}
.mbn-transfer {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  gap: calc(8px * var(--ui-scale, 1));
  min-width: calc(200px * var(--ui-scale, 1));
}
.mbn-transfer select { flex: 1; min-width: 0; }
.mbn-page .btn-danger {
  border: 0;
  border-radius: calc(12px * var(--ui-scale, 1));
  padding: calc(9px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1));
  background: #dc2626;
  color: #fff;
  font: 700 calc(12px * var(--ui-scale, 1)) var(--font);
  cursor: pointer;
  transition: 0.15s;
}
.mbn-page .btn-danger:hover { background: #b91c1c; }

/* Top bar MBN indicator */
.mbn-link-status {
  position: relative;
  overflow: visible;
  display: inline-flex;
  align-items: center;
  gap: calc(8px * var(--ui-scale, 1));
  height: calc(44px * var(--ui-scale, 1));
  padding: 0 calc(12px * var(--ui-scale, 1));
  border-radius: calc(999px * var(--ui-scale, 1));
  border: calc(1px * var(--ui-scale, 1)) solid var(--border, #e2e8f0);
  background: var(--surface, #fff);
  color: var(--text, #111827);
  font-size: calc(12px * var(--ui-scale, 1));
  font-weight: 700;
  letter-spacing: 0.06em;
  font-family: inherit;
  cursor: pointer;
  user-select: none;
  transition: all 0.18s ease;
}
.mbn-link-status:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
  transform: translateY(calc(-1px * var(--ui-scale, 1)));
}
.mbn-link-status.active {
  background: rgba(13, 107, 92, 0.12);
  border-color: var(--blue, #0d6b5c);
  color: var(--blue, #0d6b5c);
}
html[data-theme="dark"] .mbn-link-status {
  background: #111c2c;
  border-color: #334155;
  color: #cbd5e1;
}
html[data-theme="dark"] .mbn-link-status:hover {
  background: #1e293b;
  border-color: #3a4b66;
}
html[data-theme="dark"] .mbn-link-status.active {
  background: rgba(138, 208, 192, 0.18);
  border-color: #8ad0c0;
  color: #8ad0c0;
}
.topbar,
.topbar-actions {
  overflow: visible;
}
.mbn-link-dot {
  width: calc(10px * var(--ui-scale, 1));
  height: calc(10px * var(--ui-scale, 1));
  border-radius: 50%;
  background: #dc2626;
  box-shadow: 0 0 0 calc(3px * var(--ui-scale, 1)) rgba(220, 38, 38, 0.18);
}
.mbn-link-status[data-state="up"] .mbn-link-dot {
  background: #16a34a;
  box-shadow: 0 0 0 calc(3px * var(--ui-scale, 1)) rgba(22, 163, 74, 0.22);
}
/* Compact pills: MBN and Zis sit next to the search box, so both the label and
   the dot are smaller and the two of them fit on one row. */
.mbn-link-status--compact {
  height: calc(38px * var(--ui-scale, 1));
  padding: 0 calc(10px * var(--ui-scale, 1));
  gap: calc(6px * var(--ui-scale, 1));
}
.mbn-link-status--compact .mbn-link-label {
  font-size: calc(10.5px * var(--ui-scale, 1));
  letter-spacing: 0.05em;
}
.mbn-link-status--compact .mbn-link-dot {
  width: calc(8px * var(--ui-scale, 1));
  height: calc(8px * var(--ui-scale, 1));
  box-shadow: 0 0 0 calc(2px * var(--ui-scale, 1)) rgba(220, 38, 38, 0.18);
}
.mbn-link-status--compact[data-state="up"] .mbn-link-dot {
  box-shadow: 0 0 0 calc(2px * var(--ui-scale, 1)) rgba(22, 163, 74, 0.22);
}
.mbn-card-actions {
  display: flex;
  align-items: center;
  gap: calc(8px * var(--ui-scale, 1));
  flex-wrap: wrap;
}
.mbn-queue-count {
  position: absolute;
  top: calc(-7px * var(--ui-scale, 1));
  right: calc(-7px * var(--ui-scale, 1));
  min-width: calc(18px * var(--ui-scale, 1));
  height: calc(18px * var(--ui-scale, 1));
  padding: 0 calc(5px * var(--ui-scale, 1));
  border-radius: calc(999px * var(--ui-scale, 1));
  background: #ff3b30;
  color: #fff;
  border: calc(2px * var(--ui-scale, 1)) solid #fff;
  box-shadow: 0 calc(1px * var(--ui-scale, 1)) calc(2px * var(--ui-scale, 1)) rgba(15, 23, 42, 0.28);
  font-size: calc(11px * var(--ui-scale, 1));
  font-weight: 700;
  letter-spacing: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  z-index: 4;
  pointer-events: none;
}
.mbn-queue-count[hidden] {
  display: none !important;
}
#sms-tab .conversation-panel {
  min-height: 0;
  overflow: hidden;
}
#sms-tab .sms-conversation-head,
#sms-tab .sms-composer {
  flex: 0 0 auto;
}
#sms-tab .message-history {
  overflow-y: auto;
}
#sms-tab .sms-queued-bubble {
  display: flex;
  align-items: center;
  gap: calc(10px * var(--ui-scale, 1));
}
#sms-tab .sms-vis {
  flex: 0 0 auto;
  padding: calc(4px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
  font-size: calc(12px * var(--ui-scale, 1));
}
#sms-tab .sms-vis:disabled {
  opacity: 0.7;
  cursor: wait;
}

@media (max-width: 900px) {
  .mbn-grid { grid-template-columns: minmax(0, 1fr); }
  .mbn-lines { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 700px) {
  .mbn-page { padding: calc(14px * var(--ui-scale, 1)); }
  .mbn-head { align-items: flex-start; }
  .mbn-login .mbn-field,
  .mbn-login .button { flex: 1 1 100%; }
  .mbn-line-grid { grid-template-columns: repeat(auto-fill, minmax(calc(130px * var(--ui-scale, 1)), 1fr)); }
}

/* Zisson agent panel: who is logged on right now, and with what state. */
.zisson-agent-list { display: grid; gap: calc(6px * var(--ui-scale, 1)); }
.zisson-agent-row {
  display: flex;
  align-items: center;
  gap: calc(9px * var(--ui-scale, 1));
  padding: calc(7px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
  border: calc(1px * var(--ui-scale, 1)) solid var(--line);
  border-radius: calc(12px * var(--ui-scale, 1));
  background: #fff;
  min-width: 0;
}
.zisson-agent-dot {
  width: calc(8px * var(--ui-scale, 1));
  height: calc(8px * var(--ui-scale, 1));
  border-radius: 50%;
  background: #85958c;
  flex: 0 0 auto;
  box-shadow: 0 0 0 calc(3px * var(--ui-scale, 1)) rgba(133, 149, 140, .14);
}
.zisson-agent-row[data-state="available"] .zisson-agent-dot,
.zisson-agent-dot[data-state="available"] { background: #2fa678; box-shadow: 0 0 0 calc(3px * var(--ui-scale, 1)) rgba(47, 166, 120, .16); }
.zisson-agent-row[data-state="in_call"] .zisson-agent-dot,
.zisson-agent-dot[data-state="in_call"] { background: #e06d28; box-shadow: 0 0 0 calc(3px * var(--ui-scale, 1)) rgba(224, 109, 40, .25); }
.zisson-agent-row[data-state="ringing"] .zisson-agent-dot,
.zisson-agent-dot[data-state="ringing"],
.zisson-agent-row[data-state="dialing"] .zisson-agent-dot,
.zisson-agent-dot[data-state="dialing"] { background: #f59e0b; box-shadow: 0 0 0 calc(3px * var(--ui-scale, 1)) rgba(245, 158, 11, .35); animation: pulse-ring 1.5s infinite; }
.zisson-agent-row[data-state="busy"] .zisson-agent-dot,
.zisson-agent-dot[data-state="busy"] { background: #b5670f; box-shadow: 0 0 0 calc(3px * var(--ui-scale, 1)) rgba(181, 103, 15, .16); }
.zisson-agent-row[data-state="paused"] .zisson-agent-dot,
.zisson-agent-dot[data-state="paused"] { background: #d99a3d; box-shadow: 0 0 0 calc(3px * var(--ui-scale, 1)) rgba(217, 154, 61, .16); }
.zisson-agent-row[data-state="wrapup"] .zisson-agent-dot,
.zisson-agent-dot[data-state="wrapup"] { background: #6b7fd7; box-shadow: 0 0 0 calc(3px * var(--ui-scale, 1)) rgba(107, 127, 215, .16); }
.zisson-agent-row[data-state="offline"] .zisson-agent-dot,
.zisson-agent-row[data-state="loggedoff"] .zisson-agent-dot,
.zisson-agent-dot[data-state="offline"],
.zisson-agent-dot[data-state="loggedoff"] { background: #85958c; box-shadow: 0 0 0 calc(3px * var(--ui-scale, 1)) rgba(133, 149, 140, .14); }
.zisson-agent-name {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.zisson-agent-meta {
  color: var(--muted);
  font-size: calc(12px * var(--ui-scale, 1));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}
.zisson-agent-state {
  margin-left: auto;
  font-weight: 700;
  font-size: calc(12px * var(--ui-scale, 1));
  color: var(--muted);
  white-space: nowrap;
}
.zisson-agent-row[data-state="available"] .zisson-agent-state { color: #1c7d5c; }
.zisson-agent-row[data-state="busy"] .zisson-agent-state { color: #97560c; }
.zisson-page .zisson-agents-card .mbn-card-head { align-items: flex-start; }

/* The Zisson tab is a document, not a dashboard: on desktop the workspace shell
   clips the central column, so this tab scrolls on its own. */
@media (min-width: 901px) {
  .content-scroll.page-scroll {
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

/* Sidebar agent rows that come from Zisson: the dot follows the Zisson state
   and the line under the name carries the availability in words. */
.agent-avatar.paused:after { background: #d99a3d; }
.agent-avatar.wrapup:after { background: #6b7fd7; }
.agent-avatar.in_call:after { background: #e06d28; box-shadow: 0 0 0 calc(2px * var(--ui-scale, 1)) rgba(224, 109, 40, .35); }
.agent-avatar.ringing:after,
.agent-avatar.dialing:after { background: #f59e0b; box-shadow: 0 0 0 calc(2px * var(--ui-scale, 1)) rgba(245, 158, 11, .4); animation: pulse-ring 1.5s infinite; }
/* The name and the state line always truncate instead of pushing the row past
   the 230-310 px sidebar. */
.agent-mini-text {
  flex: 1 1 auto;
  min-width: 0;
}
.agent-mini-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(6px * var(--ui-scale, 1));
  width: 100%;
  min-width: 0;
}
.agent-mini-header strong {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.agent-status-timer {
  font-size: calc(11px * var(--ui-scale, 1));
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #9db0a8;
  background: rgba(255, 255, 255, 0.08);
  padding: calc(1px * var(--ui-scale, 1)) calc(5px * var(--ui-scale, 1));
  border-radius: calc(4px * var(--ui-scale, 1));
  flex-shrink: 0;
  letter-spacing: 0.02em;
}
.agent-mini[data-zisson-state="available"] .agent-status-timer {
  color: #8ad0c0;
  background: rgba(138, 208, 192, 0.15);
}
.agent-mini[data-zisson-state="in_call"] .agent-status-timer {
  color: #f39c5b;
  background: rgba(224, 109, 40, 0.18);
}
.agent-mini[data-zisson-state="ringing"] .agent-status-timer,
.agent-mini[data-zisson-state="dialing"] .agent-status-timer {
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.18);
}
.agent-mini[data-zisson-state="paused"] .agent-status-timer {
  color: #d9b25f;
  background: rgba(217, 178, 95, 0.15);
}
.agent-mini[data-zisson-state="busy"] .agent-status-timer {
  color: #e3a75e;
  background: rgba(227, 167, 94, 0.15);
}
.agent-status-timer-sub {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: inherit;
}
.zisson-agent-row .agent-status-timer {
  margin-left: auto;
  margin-right: calc(8px * var(--ui-scale, 1));
  font-size: calc(11px * var(--ui-scale, 1));
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #9db0a8;
  background: rgba(255, 255, 255, 0.06);
  padding: calc(1px * var(--ui-scale, 1)) calc(6px * var(--ui-scale, 1));
  border-radius: calc(4px * var(--ui-scale, 1));
}
.zisson-agent-row[data-state="available"] .agent-status-timer {
  color: #8ad0c0;
  background: rgba(138, 208, 192, 0.15);
}
.zisson-agent-row[data-state="in_call"] .agent-status-timer {
  color: #f39c5b;
  background: rgba(224, 109, 40, 0.18);
}
.zisson-agent-row[data-state="ringing"] .agent-status-timer,
.zisson-agent-row[data-state="dialing"] .agent-status-timer {
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.18);
}
.zisson-agent-row[data-state="paused"] .agent-status-timer {
  color: #d9b25f;
  background: rgba(217, 178, 95, 0.15);
}
.zisson-agent-row[data-state="busy"] .agent-status-timer {
  color: #e3a75e;
  background: rgba(227, 167, 94, 0.15);
}
.agent-mini-text strong,
.agent-mini-text small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.zisson-mini-state {
  margin-top: calc(2px * var(--ui-scale, 1));
  color: var(--sidebar-muted, #8b9c93);
  font-size: calc(12px * var(--ui-scale, 1));
}
.zisson-mini-state[data-state="available"] { color: #8ad0c0; }
.zisson-mini-state[data-state="in_call"] { color: #f39c5b; font-weight: 600; }
.zisson-mini-state[data-state="ringing"],
.zisson-mini-state[data-state="dialing"] { color: #fbbf24; font-weight: 600; }
.zisson-mini-state[data-state="busy"] { color: #e3a75e; }
.zisson-mini-state[data-state="paused"] { color: #d9b25f; }
.zisson-mini-state[data-state="wrapup"] { color: #a3b1ea; }
.zisson-mini-state[data-state="offline"] { color: #85958c; }

/* Grid items default to min-width: auto, which let a long Zisson name and line
   push the whole sidebar row wider than the 230-310 px rail. */
.agent-department-group,
.agents-list > .agent-mini {
  min-width: 0;
}

/* Sidebar group header: chevron, group name and «logget på / totalt». */
.agent-department-toggle {
  display: flex;
  align-items: center;
  gap: calc(6px * var(--ui-scale, 1));
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0 calc(4px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1));
  color: #93aca5;
  font: 800 calc(12px * var(--ui-scale, 1)) var(--font);
  letter-spacing: .1em;
  text-align: left;
  cursor: pointer;
}
.agent-department-toggle:hover { color: #cfe7de; }
.agent-department-toggle svg {
  width: calc(13px * var(--ui-scale, 1));
  height: calc(13px * var(--ui-scale, 1));
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .18s ease;
}
.agent-department-toggle[aria-expanded="false"] svg { transform: rotate(-90deg); }
.agent-department-count {
  margin-left: auto;
  color: #8ad0c0;
  letter-spacing: 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.agent-department-count[data-empty="true"] { color: #7b8a84; }

/* Garage picked in the SMS list: the depot pill is a filter button and the
   chip in the Alle/Ulest bar is the way back to every conversation. */
.et-meta-pill.sms-depot-pill {
  font-family: inherit;
  font-size: calc(11px * var(--ui-scale, 1));
  font-weight: 700;
  line-height: 1.35;
  cursor: pointer;
}
.et-meta-pill.sms-depot-pill:hover { background: #bae6fd; }
.et-meta-pill.sms-depot-pill.is-active {
  background: #0369a1;
  border-color: #075985;
  color: #fff;
}
.sms-depot-filter-clear {
  background: #e0f2fe;
  border-color: #7dd3fc;
  color: #0369a1;
}
.sms-depot-filter-clear:hover { background: #bae6fd; }
.sms-depot-filter-clear[hidden] { display: none !important; }

/* A laptop window is shorter than the rail's natural height. Tighten the rail
   on those screens instead of making the whole menu scroll: brand, navigation
   and the sentralbord card all stay visible at once. */
@media (min-width: 901px) and (max-height: 1100px) {
  .sidebar {
    padding-top: calc(16px * var(--ui-scale, 1));
    padding-bottom: calc(14px * var(--ui-scale, 1));
  }
  .brand { padding-bottom: calc(16px * var(--ui-scale, 1)); }
  .sidebar .workspace-switcher { margin-bottom: calc(4px * var(--ui-scale, 1)); }
  #primary-sidebar .sidebar-top-controls {
    padding-bottom: calc(8px * var(--ui-scale, 1));
    margin-bottom: calc(8px * var(--ui-scale, 1));
  }
  .primary-nav { gap: calc(3px * var(--ui-scale, 1)); }
  .nav-item {
    padding-top: calc(9px * var(--ui-scale, 1));
    padding-bottom: calc(9px * var(--ui-scale, 1));
  }
  .sidebar-agents-divider { margin: calc(9px * var(--ui-scale, 1)) 0; }
  #primary-sidebar .sidebar-sentralbord-footer { padding-top: 0 !important; }
}

/* Very short laptop screens: tighten the rail once more so it still fits. */
@media (min-width: 901px) and (max-height: 820px) {
  .sidebar {
    padding-top: calc(10px * var(--ui-scale, 1));
    padding-bottom: calc(10px * var(--ui-scale, 1));
  }
  .brand { padding-bottom: calc(10px * var(--ui-scale, 1)); }
  .nav-item {
    padding-top: calc(7px * var(--ui-scale, 1));
    padding-bottom: calc(7px * var(--ui-scale, 1));
  }
}

/* Left rail width: the user can drag the edge of the sidebar. --sidebar-width is
   a plain px number, scaled like every other size, so it follows --ui-scale. */
.app-shell {
  --sidebar-width: 268px;
}
@media (max-width: 1320px) {
  /* A narrow window keeps a slimmer rail; the drag handler still overrides it. */
  .app-shell {
    --sidebar-width: 230px;
  }
}
/* Fixed, not absolute: the sidebar scrolls its own content, and a handle inside
   that scroller would scroll away and be clipped by its overflow. */
.sidebar-resizer {
  position: fixed;
  top: 0;
  bottom: 0;
  left: calc(var(--sidebar-width, 310px) * var(--ui-scale, 1));
  width: calc(8px * var(--ui-scale, 1));
  margin-left: calc(-4px * var(--ui-scale, 1));
  z-index: 6;
  cursor: col-resize;
  touch-action: none;
  background: transparent;
}
.sidebar-resizer::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: calc(2px * var(--ui-scale, 1));
  transform: translateX(-50%);
  background: transparent;
  transition: background .15s ease;
}
.sidebar-resizer:hover::after,
.sidebar-resizer:focus-visible::after,
body.sidebar-resizing .sidebar-resizer::after { background: #8ad0c0; }
.sidebar-resizer:focus-visible { outline: none; }
body.sidebar-resizing { user-select: none; }
body.sidebar-resizing,
body.sidebar-resizing * { cursor: col-resize !important; }
@media (max-width: 900px) {
  .sidebar-resizer { display: none; }
}

/* ==========================================================================
   THE RAIL FITS THE WINDOW
   On a desktop window the whole menu must be visible without scrolling. The
   blocks above the menu are compact, and the agent list is the only part that
   gives way: it fills what is left and scrolls inside its own box when the
   department is long. Flex, not a fixed height, so a short window degrades
   into a scrolling rail again instead of clipping the menu.
   ========================================================================== */
@media (min-width: 901px) {
  #primary-sidebar {
    overflow-y: hidden;
    padding: calc(10px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1));
    gap: calc(3px * var(--ui-scale, 1));
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    box-sizing: border-box;
  }
  #primary-sidebar > * { flex: 0 0 auto; }
  #primary-sidebar > #agents-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    align-content: start;
    scrollbar-width: thin;
  }
  #primary-sidebar .brand { padding-bottom: calc(4px * var(--ui-scale, 1)); }
  #primary-sidebar > #btn-workspace-switcher {
    margin-bottom: 0;
    padding-top: calc(5px * var(--ui-scale, 1));
    padding-bottom: calc(5px * var(--ui-scale, 1));
  }
  #primary-sidebar > .sidebar-top-controls {
    margin: 0;
    padding-bottom: calc(4px * var(--ui-scale, 1));
    gap: calc(3px * var(--ui-scale, 1));
  }
  #primary-sidebar .nav-item {
    padding-top: calc(4px * var(--ui-scale, 1));
    padding-bottom: calc(4px * var(--ui-scale, 1));
    min-height: calc(28px * var(--ui-scale, 1));
  }
  #primary-sidebar > .sidebar-agents-divider { margin: calc(2px * var(--ui-scale, 1)) 0; }
  #primary-sidebar .agent-department-heading { margin: calc(2px * var(--ui-scale, 1)) 0 calc(2px * var(--ui-scale, 1)); }
  #primary-sidebar .agent-department-empty { padding: 0; }
}

/* A short window (a laptop with 950 px of usable height or less) gets a tighter
   rhythm still, so the whole rail stays visible instead of leaving the agent
   list as a sliver. Nothing is hidden or dropped: rows, icons and card padding
   step down one size. */
@media (min-width: 901px) and (max-height: 950px) {
  #primary-sidebar {
    padding-top: calc(10px * var(--ui-scale, 1));
    padding-bottom: 0;
    gap: calc(3px * var(--ui-scale, 1));
  }
  #primary-sidebar .brand { padding-bottom: 0; }
  #primary-sidebar > #btn-workspace-switcher {
    padding-top: calc(6px * var(--ui-scale, 1));
    padding-bottom: calc(6px * var(--ui-scale, 1));
  }
  #primary-sidebar .primary-nav { gap: calc(2px * var(--ui-scale, 1)); }
  #primary-sidebar > .sidebar-agents-divider { margin: calc(3px * var(--ui-scale, 1)) 0 calc(3px * var(--ui-scale, 1)); }
  #primary-sidebar .nav-item {
    padding-top: calc(3px * var(--ui-scale, 1));
    padding-bottom: calc(3px * var(--ui-scale, 1));
  }
  #primary-sidebar .nav-icon {
    width: calc(18px * var(--ui-scale, 1));
    height: calc(18px * var(--ui-scale, 1));
    flex: 0 0 calc(18px * var(--ui-scale, 1));
  }
  #primary-sidebar .nav-icon svg {
    width: calc(15px * var(--ui-scale, 1));
    height: calc(15px * var(--ui-scale, 1));
  }
  #primary-sidebar > .sidebar-top-controls {
    padding-bottom: calc(6px * var(--ui-scale, 1));
    gap: calc(3px * var(--ui-scale, 1));
  }
  #primary-sidebar .sidebar-top-controls .user-menu {
    min-height: calc(34px * var(--ui-scale, 1));
    padding-top: calc(4px * var(--ui-scale, 1));
    padding-bottom: calc(4px * var(--ui-scale, 1));
  }
  #primary-sidebar #queue-card-wrapper {
    padding-top: calc(8px * var(--ui-scale, 1));
    padding-bottom: calc(8px * var(--ui-scale, 1));
  }
  #primary-sidebar #sentralbord-card {
    padding-top: calc(4px * var(--ui-scale, 1)) !important;
    padding-bottom: calc(4px * var(--ui-scale, 1)) !important;
  }
}

/* ==========================================================================
   COMPACT BEMANNING AND OMRÅDE HEADERS
   The workspace switcher and the Område card sit above the menu, so every
   pixel of their padding is taken from the navigation. Both were taller than
   their content needed: the card paid for padding twice (wrapper and button),
   and an empty Zisson line kept a padded row plus a flex gap. Only the vertical
   axis is trimmed - names, phone, line summary and the select all stay.
   ========================================================================== */
@media (min-width: 901px) {
  #primary-sidebar > #btn-workspace-switcher {
    padding-top: calc(4px * var(--ui-scale, 1));
    padding-bottom: calc(4px * var(--ui-scale, 1));
    row-gap: calc(4px * var(--ui-scale, 1));
    column-gap: calc(8px * var(--ui-scale, 1));
  }
  #primary-sidebar > #btn-workspace-switcher .workspace-avatar {
    width: calc(24px * var(--ui-scale, 1));
    height: calc(24px * var(--ui-scale, 1));
    border-radius: calc(8px * var(--ui-scale, 1));
    font-size: calc(10.5px * var(--ui-scale, 1));
  }
  #primary-sidebar > #btn-workspace-switcher.has-department-switcher {
    grid-template-columns: calc(24px * var(--ui-scale, 1)) minmax(0, 1fr) auto;
  }
  #primary-sidebar > #btn-workspace-switcher .workspace-department-select {
    margin-top: calc(2px * var(--ui-scale, 1));
    padding: calc(4px * var(--ui-scale, 1)) calc(9px * var(--ui-scale, 1));
    line-height: 1.25;
  }
  #primary-sidebar .sidebar-top-controls #queue-card-wrapper {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }
  #primary-sidebar .sidebar-top-controls #btn-toggle-queue-panel {
    min-height: 0 !important;
    padding-top: calc(7px * var(--ui-scale, 1)) !important;
    padding-bottom: calc(7px * var(--ui-scale, 1)) !important;
  }
  #primary-sidebar .sidebar-top-controls .queue-btn-text {
    text-align: center !important;
    align-items: center !important;
  }
  #primary-sidebar .sidebar-top-controls .queue-btn-text strong,
  #primary-sidebar .sidebar-top-controls .queue-btn-text small {
    line-height: 1.2;
    text-align: center !important;
    width: 100% !important;
  }
  #primary-sidebar .sidebar-top-controls .queue-btn-icon {
    width: calc(20px * var(--ui-scale, 1)) !important;
    height: calc(20px * var(--ui-scale, 1)) !important;
    flex: 0 0 calc(20px * var(--ui-scale, 1)) !important;
  }
  #primary-sidebar .sidebar-top-controls .queue-chevron {
    width: calc(20px * var(--ui-scale, 1)) !important;
    flex: 0 0 calc(20px * var(--ui-scale, 1)) !important;
  }
  /* The Zisson line summary is hidden to prevent duplicate text on the Område card */
  #primary-sidebar .sidebar-top-controls .zisson-line-summary {
    display: none !important;
  }
}

/* Ansattnummer på navnelinjen i Samtaler (#30562), ikke i badgeraden. */
.thread-item-top strong { display: flex; align-items: center; gap: calc(5px * var(--ui-scale, 1)); min-width: 0; }
.thread-item-top .thread-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sms-ansatt-inline {
  flex: 0 0 auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: calc(11px * var(--ui-scale, 1));
  font-weight: 700;
  color: var(--blue);
  background: var(--blue-soft);
  border-radius: calc(8px * var(--ui-scale, 1));
  padding: calc(1px * var(--ui-scale, 1)) calc(5px * var(--ui-scale, 1));
}

/* Compact agent rows in sidebar for Bemanningsledere and Driftssentralen:
   Reduces vertical padding and avatar footprint so more agents fit on screen
   without scrolling, while keeping all functional details (state, timer, queues, transfer). */
#primary-sidebar #agents-list .agent-department-group {
  margin-bottom: calc(4px * var(--ui-scale, 1)) !important;
}
#primary-sidebar #agents-list .agent-department-group + .agent-department-group {
  margin-top: calc(4px * var(--ui-scale, 1)) !important;
  padding-top: calc(4px * var(--ui-scale, 1)) !important;
}
#primary-sidebar #agents-list .agent-department-toggle {
  padding: calc(3px * var(--ui-scale, 1)) calc(4px * var(--ui-scale, 1)) calc(4px * var(--ui-scale, 1)) !important;
  font-size: calc(11px * var(--ui-scale, 1)) !important;
}
#primary-sidebar #agents-list .agent-mini {
  padding: calc(4px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1)) !important;
  gap: calc(8px * var(--ui-scale, 1)) !important;
  border-radius: calc(8px * var(--ui-scale, 1)) !important;
  min-height: 0 !important;
}
#primary-sidebar #agents-list .agent-avatar {
  width: calc(26px * var(--ui-scale, 1)) !important;
  height: calc(26px * var(--ui-scale, 1)) !important;
  font-size: calc(10.5px * var(--ui-scale, 1)) !important;
  flex: 0 0 calc(26px * var(--ui-scale, 1)) !important;
}
#primary-sidebar #agents-list .agent-avatar:after {
  width: calc(7px * var(--ui-scale, 1)) !important;
  height: calc(7px * var(--ui-scale, 1)) !important;
  bottom: 0 !important;
  right: 0 !important;
}
#primary-sidebar #agents-list .agent-mini strong {
  font-size: calc(12.5px * var(--ui-scale, 1)) !important;
  line-height: 1.25 !important;
}
#primary-sidebar #agents-list .agent-mini small,
#primary-sidebar #agents-list .zisson-mini-state {
  font-size: calc(11px * var(--ui-scale, 1)) !important;
  line-height: 1.2 !important;
  margin-top: calc(1px * var(--ui-scale, 1)) !important;
}
#primary-sidebar #agents-list .transfer-agent-button {
  width: calc(24px * var(--ui-scale, 1)) !important;
  height: calc(24px * var(--ui-scale, 1)) !important;
  padding: calc(2px * var(--ui-scale, 1)) !important;
}
#primary-sidebar #agents-list .transfer-agent-button svg {
  width: calc(14px * var(--ui-scale, 1)) !important;
  height: calc(14px * var(--ui-scale, 1)) !important;
}
#primary-sidebar #agents-list .agent-department-empty {
  padding: calc(4px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1)) !important;
  font-size: calc(11px * var(--ui-scale, 1)) !important;
}


/* Agent status icons and the transfer / call-ended marks (Zisson). */
.zisson-state-icon {
  display: inline-block;
  width: 1.05em;
  height: 1.05em;
  margin-right: .3em;
  vertical-align: -0.16em;
}
.zisson-state-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.zisson-state-icon[data-state="in_call"] svg { fill: currentColor; stroke: none; }
.zisson-state-icon[data-state="ringing"],
.zisson-state-icon[data-state="transfer_ringing"] { animation: zisson-ring-shake 1s infinite; transform-origin: 50% 50%; }
@keyframes zisson-ring-shake {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-14deg); }
  40% { transform: rotate(12deg); }
  60% { transform: rotate(-8deg); }
  80% { transform: rotate(6deg); }
}
.zisson-mini-state[data-state="transfer_ringing"] { color: #fbbf24; font-weight: 600; }
.zisson-mini-state[data-state="transfer_answered"] { color: #4cd09b; font-weight: 600; }
.zisson-mini-state[data-state="transfer_failed"],
.zisson-mini-state[data-state="missed_ring"] { color: #f07a7a; font-weight: 600; }
.zisson-mini-state[data-state="call_ended"] { color: #a3b1ea; font-weight: 600; }
.global-call-answer-hint {
  display: inline-flex;
  align-items: center;
  padding: 0 .75em;
  font-weight: 700;
  color: #b5670f;
  white-space: nowrap;
}
@media (prefers-reduced-motion: reduce) {
  .zisson-state-icon[data-state="ringing"],
  .zisson-state-icon[data-state="transfer_ringing"] { animation: none; }
}

/* E-post: the whole conversation as one flow, and the "Ansvarlig" search box. */
.et-email-flow { display: flex; flex-direction: column; gap: calc(14px * var(--ui-scale, 1)); }
/* A long case shows its newest messages; this quiet pill loads the ones before. */
.et-load-older-wrap { display: flex; justify-content: center; flex: 0 0 auto; }
#email-tab #email-chat-history .et-load-older {
  min-height: calc(32px * var(--ui-scale, 1));
  padding: calc(6px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1));
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font: 600 calc(12px * var(--ui-scale, 1)) / 1.3 var(--font);
  box-shadow: none;
  cursor: pointer;
}
#email-tab #email-chat-history .et-load-older:hover:not(:disabled) { color: var(--ink); border-color: var(--muted); }
#email-tab #email-chat-history .et-load-older:disabled { cursor: progress; opacity: .75; }
@media (max-width: 900px) {
  #email-tab #email-chat-history .et-load-older { min-height: calc(40px * var(--ui-scale, 1)); }
}
.ticket-agent-combo { position: relative; min-width: calc(190px * var(--ui-scale, 1)); }
.ticket-agent-combo-input { width: 100%; box-sizing: border-box; }
.ticket-agent-suggest {
  position: absolute;
  z-index: 60;
  top: calc(100% + 4px);
  left: 0;
  width: max(100%, calc(320px * var(--ui-scale, 1)));
  max-height: calc(320px * var(--ui-scale, 1));
  overflow-y: auto;
  padding: calc(4px * var(--ui-scale, 1));
  background: #fff;
  border: 1px solid var(--line, #d9e0dc);
  border-radius: calc(10px * var(--ui-scale, 1));
  box-shadow: 0 12px 32px rgba(20, 40, 32, .18);
}
.ticket-agent-suggest.hidden { display: none; }
.ticket-agent-heading {
  padding: calc(6px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1)) calc(2px * var(--ui-scale, 1));
  font-size: calc(11px * var(--ui-scale, 1));
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted, #6b7d74);
}
.ticket-agent-option {
  display: flex;
  align-items: center;
  gap: calc(10px * var(--ui-scale, 1));
  width: 100%;
  padding: calc(7px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
  border: 0;
  border-radius: calc(8px * var(--ui-scale, 1));
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font: inherit;
}
.ticket-agent-option:hover, .ticket-agent-option:focus-visible { background: rgba(47, 166, 120, .12); outline: none; }
.ticket-agent-option.is-release { color: var(--muted, #6b7d74); font-weight: 600; }
.ticket-agent-avatar {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: calc(28px * var(--ui-scale, 1));
  height: calc(28px * var(--ui-scale, 1));
  border-radius: 50%;
  background: #6b7fd7;
  color: #fff;
  font-size: calc(11px * var(--ui-scale, 1));
  font-weight: 700;
}
.ticket-agent-name { font-weight: 600; white-space: nowrap; }
.ticket-agent-option small { color: var(--muted, #6b7d74); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ticket-agent-empty { padding: calc(10px * var(--ui-scale, 1)); color: var(--muted, #6b7d74); }
html[data-theme="dark"] .ticket-agent-suggest { background: #172438; border-color: #29384b; }

/* Agent row: name on the left; status, boxed timer and transfer button on the
   right. The colour of the status text and of the timer box follow the state. */
#primary-sidebar #agents-list .agent-mini { --agent-state-color: #8ad0c0; --agent-state-bg: rgba(138, 208, 192, .14); }
#primary-sidebar #agents-list .agent-mini-text { flex: 1 1 0; min-width: 0; }
#primary-sidebar #agents-list .agent-mini-right {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: calc(6px * var(--ui-scale, 1));
  margin-left: auto;
  min-width: 0;
}
#primary-sidebar #agents-list .agent-mini-right .zisson-mini-state {
  display: inline-flex;
  align-items: center;
  max-width: calc(104px * var(--ui-scale, 1));
  margin: 0 !important;
  color: var(--agent-state-color) !important;
  font-weight: 700;
  white-space: nowrap;
}
#primary-sidebar #agents-list .zisson-mini-state-label { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#primary-sidebar #agents-list .agent-mini-right .agent-status-timer {
  flex: 0 0 auto;
  min-width: calc(48px * var(--ui-scale, 1));
  text-align: center;
  padding: calc(2px * var(--ui-scale, 1)) calc(6px * var(--ui-scale, 1));
  border: calc(1.5px * var(--ui-scale, 1)) solid var(--agent-state-color);
  border-radius: calc(7px * var(--ui-scale, 1));
  color: var(--agent-state-color);
  background: var(--agent-state-bg);
  font-size: calc(11.5px * var(--ui-scale, 1));
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
  margin: 0;
}
#primary-sidebar #agents-list .agent-mini-right .agent-call-actions { margin: 0; min-width: 0; }
#primary-sidebar #agents-list .agent-mini[data-zisson-state="available"] { --agent-state-color: #4cd09b; --agent-state-bg: rgba(76, 208, 155, .16); }
#primary-sidebar #agents-list .agent-mini[data-zisson-state="in_call"],
#primary-sidebar #agents-list .agent-mini[data-zisson-state="transfer_answered"] { --agent-state-color: #ff8a4c; --agent-state-bg: rgba(255, 138, 76, .18); }
#primary-sidebar #agents-list .agent-mini[data-zisson-state="transfer_answered"] { --agent-state-color: #4cd09b; --agent-state-bg: rgba(76, 208, 155, .16); }
#primary-sidebar #agents-list .agent-mini[data-zisson-state="ringing"],
#primary-sidebar #agents-list .agent-mini[data-zisson-state="dialing"],
#primary-sidebar #agents-list .agent-mini[data-zisson-state="transfer_ringing"] { --agent-state-color: #fbbf24; --agent-state-bg: rgba(251, 191, 36, .2); }
#primary-sidebar #agents-list .agent-mini[data-zisson-state="busy"] { --agent-state-color: #e3a75e; --agent-state-bg: rgba(227, 167, 94, .16); }
#primary-sidebar #agents-list .agent-mini[data-zisson-state="paused"] { --agent-state-color: #d9b25f; --agent-state-bg: rgba(217, 178, 95, .16); }
#primary-sidebar #agents-list .agent-mini[data-zisson-state="wrapup"],
#primary-sidebar #agents-list .agent-mini[data-zisson-state="call_ended"] { --agent-state-color: #a3b1ea; --agent-state-bg: rgba(163, 177, 234, .16); }
#primary-sidebar #agents-list .agent-mini[data-zisson-state="transfer_failed"],
#primary-sidebar #agents-list .agent-mini[data-zisson-state="missed_ring"] { --agent-state-color: #f07a7a; --agent-state-bg: rgba(240, 122, 122, .18); }
#primary-sidebar #agents-list .agent-mini[data-zisson-state="offline"] { --agent-state-color: #85958c; --agent-state-bg: rgba(133, 149, 140, .12); }
#primary-sidebar #agents-list .agent-mini[data-zisson-state="ringing"] .agent-status-timer,
#primary-sidebar #agents-list .agent-mini[data-zisson-state="transfer_ringing"] .agent-status-timer { animation: pulse-ring 1.5s infinite; }

/* Signed in to Zisson or RelayHub, not on a line: grey (final colours at .agent-no-line). */
#primary-sidebar #agents-list .agent-mini[data-zisson-state="connected_idle"],
#primary-sidebar #agents-list .agent-mini[data-zisson-state="app_idle"] { --agent-state-color: #8b96a0; --agent-state-bg: rgba(139, 150, 160, .14); }
.zisson-mini-state[data-state="connected_idle"],
.zisson-mini-state[data-state="app_idle"] { color: #8b96a0; font-weight: 600; }
.agent-avatar.connected_idle:after,
.agent-avatar.app_idle:after { background: #8b96a0; }

/* The line the agent is logged on to sits under the name, not next to the status. */
#primary-sidebar #agents-list .agent-mini-text .agent-mini-lines {
  display: block;
  margin-top: calc(1px * var(--ui-scale, 1)) !important;
  color: #93aca5;
  font-size: calc(10.5px * var(--ui-scale, 1)) !important;
  line-height: 1.2 !important;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------------------------------------------------------------------------
   Område: a compact, centred status card. The area label is a small caps title,
   the chosen line is the headline, the state and its timer are one pill, and the
   Pause / Logg ut buttons share the width evenly.
   --------------------------------------------------------------------------- */
#agent-controls-rail-section #queue-card-wrapper {
  gap: calc(8px * var(--ui-scale, 1));
  padding: calc(10px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1));
  border-radius: calc(16px * var(--ui-scale, 1));
  align-items: stretch;
  text-align: center;
}
#agent-controls-rail-section #queue-card-wrapper .queue-accordion-btn {
  min-height: calc(48px * var(--ui-scale, 1));
  padding: 0 calc(34px * var(--ui-scale, 1)) !important;
  justify-content: center;
  align-items: center;
  text-align: center;
}
#agent-controls-rail-section #queue-card-wrapper .queue-btn-icon {
  left: 0;
  width: calc(32px * var(--ui-scale, 1));
  height: calc(32px * var(--ui-scale, 1));
  display: grid;
  place-items: center;
  border-radius: calc(10px * var(--ui-scale, 1));
  background: rgba(255, 255, 255, .14);
  color: #fff;
}
#agent-controls-rail-section #queue-card-wrapper .queue-btn-text {
  align-items: center;
  justify-content: center;
  gap: calc(2px * var(--ui-scale, 1));
  width: 100%;
}
#agent-controls-rail-section #queue-card-wrapper .queue-btn-text strong {
  font: 700 calc(10.5px * var(--ui-scale, 1)) var(--font) !important;
  letter-spacing: .14em;
  text-transform: uppercase;
  opacity: .72;
}
#agent-controls-rail-section #queue-card-wrapper .status-lines-sub {
  display: block;
  max-width: 100%;
  font: 700 calc(15px * var(--ui-scale, 1)) var(--font) !important;
  line-height: 1.25;
  text-align: center !important;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#agent-controls-rail-section #queue-card-wrapper .queue-chevron {
  right: 0;
  font-size: calc(14px * var(--ui-scale, 1));
  opacity: .8;
}
/* State + timer as one centred pill instead of a wide box. */
#agent-controls-rail-section #queue-timer-card {
  width: auto;
  align-self: center;
  min-height: 0;
  margin: 0;
  padding: calc(5px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1));
  border-radius: 999px;
  background: #1C1C1C !important;
  border: calc(1px * var(--ui-scale, 1)) solid rgba(255, 255, 255, .2) !important;
}
#agent-controls-rail-section #queue-card-wrapper .status-timer-sub,
#agent-controls-rail-section #queue-timer-card .status-timer-sub {
  margin: 0;
  padding: 0;
  font: 600 calc(13px * var(--ui-scale, 1)) var(--font) !important;
  line-height: 1.2;
  letter-spacing: .01em;
  white-space: nowrap;
}
#agent-controls-rail-section #status-timer-text {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
/* Pause / Logg ut: two equal, centred buttons. */
#agent-controls-rail-section #queue-agent-actions {
  gap: calc(8px * var(--ui-scale, 1));
  margin-top: calc(8px * var(--ui-scale, 1));
}
#agent-controls-rail-section #queue-agent-actions .btn-agent-action {
  height: calc(34px * var(--ui-scale, 1)) !important;
  min-height: calc(34px * var(--ui-scale, 1)) !important;
  border-radius: calc(11px * var(--ui-scale, 1)) !important;
  font: 700 calc(12.5px * var(--ui-scale, 1)) var(--font) !important;
  letter-spacing: .02em;
}

/* The simplified-menu button only exists on the phone layout. */
.mobile-simple-toggle { display: none; }
.mobile-simple-toggle svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mobile-simple-toggle.active { background: #17584c; color: #fff; border-color: #54c98f; }

@media (max-width: 900px) {
  .mobile-simple-toggle { display: inline-flex; align-items: center; justify-content: center; }

  /* The whole open menu scrolls, not only the agent list at the bottom. */
  .sidebar.mobile-open {
    overflow-y: auto !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    justify-content: flex-start !important;
  }
  .sidebar.mobile-open > * { flex-shrink: 0; }
  .sidebar.mobile-open #agents-list {
    flex: 0 0 auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    padding-bottom: calc(24px * var(--ui-scale, 1));
  }

  /* Simplified menu: Område, Oversikt, Meldinger, E-post and the agents. */
  .sidebar.sidebar-simple #mobile-sentralbord-slot,
  .sidebar.sidebar-simple .workspace-switcher,
  .sidebar.sidebar-simple #utility-agent-select,
  .sidebar.sidebar-simple #queue-agent-actions,
  .sidebar.sidebar-simple .nav-item[data-tab="customers-tab"],
  .sidebar.sidebar-simple .nav-item[data-tab="statistics-tab"],
  .sidebar.sidebar-simple #admin-agents-nav {
    display: none !important;
  }
}

/* Phone menu header: the logo gets its own row and the four tools sit below it
   as equal, labelled buttons, so nothing overlaps the logo. */
@media (max-width: 900px) {
  .sidebar .brand-row {
    flex-wrap: wrap;
    row-gap: calc(10px * var(--ui-scale, 1));
    padding-bottom: calc(12px * var(--ui-scale, 1));
  }
  .sidebar .brand-row .brand { flex: 1 0 100%; }
  .sidebar .sidebar-header-actions {
    flex: 1 0 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(calc(58px * var(--ui-scale, 1)), 1fr));
    gap: calc(8px * var(--ui-scale, 1));
  }
  .sidebar .sidebar-header-actions > button {
    width: 100% !important;
    height: calc(52px * var(--ui-scale, 1)) !important;
    flex: none !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: calc(3px * var(--ui-scale, 1));
    padding: 0 !important;
    border: calc(1px * var(--ui-scale, 1)) solid #1f4239 !important;
    border-radius: calc(14px * var(--ui-scale, 1)) !important;
    background: #17352e !important;
    color: #b7c8c0 !important;
    box-sizing: border-box;
  }
  .sidebar .sidebar-header-actions > button::after {
    content: attr(data-label);
    font: 600 calc(10.5px * var(--ui-scale, 1)) var(--font);
    letter-spacing: .02em;
    line-height: 1;
  }
  .sidebar .sidebar-header-actions > button svg {
    width: calc(20px * var(--ui-scale, 1));
    height: calc(20px * var(--ui-scale, 1));
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  .sidebar .sidebar-header-actions > .notification-toggle { font-size: calc(19px * var(--ui-scale, 1)) !important; line-height: 1 !important; }
  .sidebar .sidebar-header-actions > button.active,
  .sidebar .sidebar-header-actions > .mobile-simple-toggle.active {
    background: #15714e !important;
    border-color: #2fa678 !important;
    color: #fff !important;
  }
}

/* ===========================================================================
   E-post composer v2: one card. Top: Svar/Videresend + small tools. Then the
   Til/CC/BCC/Emne fields as quiet rows, the quick replies on one scrolling
   line, the editor, and a footer with the tools left and Lukk/Send right.
   =========================================================================== */
#email-tab .et-composer-v2 {
  --c-line: #e3e8e5;
  --c-soft: #f4f7f5;
  --c-text: #1f2a24;
  --c-muted: #667085;
  --c-accent: #0d6b5c;
  display: flex !important;
  flex-direction: column !important;
  gap: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 1px solid var(--c-line) !important;
  border-radius: 16px !important;
  background: #fff !important;
  box-shadow: 0 6px 20px rgba(16, 40, 32, .06) !important;
  overflow: visible !important;
}
#email-tab .et-composer-v2 .et-composer-mode-bar {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
  padding: 8px 10px !important;
  margin: 0 !important;
  border: 0 !important;
  border-bottom: 1px solid var(--c-line) !important;
  background: transparent !important;
  flex-wrap: nowrap !important;
}
#email-tab .et-composer-v2 .et-composer-modes {
  display: inline-flex !important;
  gap: 2px !important;
  padding: 3px !important;
  border-radius: 11px !important;
  background: var(--c-soft) !important;
  border: 0 !important;
  flex: 0 0 auto;
}
#email-tab .et-composer-v2 .et-mode-tab {
  border: 0 !important;
  background: transparent !important;
  color: var(--c-muted) !important;
  font: 600 13px var(--font) !important;
  padding: 6px 12px !important;
  border-radius: 8px !important;
  min-height: 0 !important;
  box-shadow: none !important;
  white-space: nowrap;
  cursor: pointer;
}
#email-tab .et-composer-v2 .et-mode-tab.active {
  background: #fff !important;
  color: var(--c-accent) !important;
  box-shadow: 0 1px 3px rgba(16, 40, 32, .14) !important;
}
#email-tab .et-composer-v2 .et-composer-head-tools {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  margin: 0 !important;
  flex-wrap: nowrap !important;
}
#email-tab .et-composer-v2 .et-head-tool {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 32px !important;
  min-height: 32px !important;
  padding: 0 10px !important;
  border: 1px solid var(--c-line) !important;
  border-radius: 9px !important;
  background: #fff !important;
  color: #475467 !important;
  font: 600 12px var(--font) !important;
  white-space: nowrap;
  box-shadow: none !important;
  cursor: pointer;
}
#email-tab .et-composer-v2 .et-head-tool.hidden { display: none !important; }
#email-tab .et-composer-v2 .et-head-tool.et-icon-only { width: 32px !important; padding: 0 !important; }
#email-tab .et-composer-v2 .et-head-tool svg,
#email-tab .et-composer-v2 .et-foot-tool svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#email-tab .et-composer-v2 .et-head-tool:hover,
#email-tab .et-composer-v2 .et-foot-tool:hover { background: #eef4f1 !important; color: var(--c-accent) !important; }
#email-tab .et-composer-v2 .et-head-tool.active,
#email-tab .et-composer-v2 .et-head-tool[aria-pressed="true"] {
  background: #e9f4f1 !important;
  border-color: #8fc9b9 !important;
  color: var(--c-accent) !important;
}

/* Til / CC / BCC / Emne */
#email-tab .et-composer-v2 .et-recipient-drawer {
  display: block !important;
  padding: 2px 14px !important;
  margin: 0 !important;
  border: 0 !important;
  background: transparent !important;
}
#email-tab .et-composer-v2 .et-recipient-drawer.hidden { display: none !important; }
#email-tab .et-composer-v2 .et-field-row {
  display: grid !important;
  grid-template-columns: 52px minmax(0, 1fr) !important;
  align-items: center !important;
  gap: 8px !important;
  min-height: 42px;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-bottom: 1px solid #eef2ef !important;
  background: transparent !important;
}
#email-tab .et-composer-v2 .et-field-row label {
  font: 600 12px var(--font) !important;
  color: var(--c-muted) !important;
  letter-spacing: .02em;
  margin: 0 !important;
}
#email-tab .et-composer-v2 .et-field-row input {
  width: 100% !important;
  min-width: 0 !important;
  height: 40px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  outline: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--c-text) !important;
  font: 500 14px var(--font) !important;
}
#email-tab .et-composer-v2 .et-subject-field-row input { font-weight: 600 !important; }
#email-tab .et-composer-v2 .email-copy-fields { display: none !important; margin: 0 !important; padding: 0 !important; border: 0 !important; }
#email-tab .et-composer-v2.show-copy .email-copy-fields { display: block !important; }

/* Quick replies on one line that scrolls sideways */
#email-tab .et-composer-v2 .et-quick-reply-bar {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 8px 14px !important;
  margin: 0 !important;
  border: 0 !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  flex-wrap: nowrap !important;
  scrollbar-width: none;
  background: transparent !important;
}
#email-tab .et-composer-v2 .et-quick-reply-bar::-webkit-scrollbar { display: none; }
#email-tab .et-composer-v2 .et-quick-reply-label {
  flex: 0 0 auto;
  font: 600 11px var(--font) !important;
  color: var(--c-muted) !important;
  text-transform: uppercase;
  letter-spacing: .06em;
}
#email-tab .et-composer-v2 .et-quick-chip {
  flex: 0 0 auto !important;
  padding: 5px 11px !important;
  border: 1px solid var(--c-line) !important;
  border-radius: 999px !important;
  background: var(--c-soft) !important;
  color: #344054 !important;
  font: 600 12.5px var(--font) !important;
  white-space: nowrap !important;
  min-height: 0 !important;
  cursor: pointer;
}
#email-tab .et-composer-v2 .et-quick-chip:hover { border-color: #8fc9b9 !important; color: var(--c-accent) !important; }

/* Editor */
#email-tab .et-composer-v2 .email-format-toolbar { margin: 0 14px !important; border-radius: 10px !important; }
#email-tab .et-composer-v2 .email-rich-editor {
  min-height: 64px !important;
  max-height: 170px !important;
  padding: 8px 14px 10px !important;
  margin: 0 !important;
  border: 0 !important;
  background: transparent !important;
  color: var(--c-text) !important;
  font-size: 14.5px !important;
  line-height: 1.55 !important;
}
#email-tab .et-composer-v2.composer-expanded .email-rich-editor { min-height: 320px !important; max-height: 60vh !important; }
#email-tab .et-composer-v2 .email-attachments { padding: 0 14px 10px !important; margin: 0 !important; }

/* Footer: tools left, Lukk sak + Send right */
#email-tab .et-composer-v2 .et-composer-footer {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
  padding: 8px 10px !important;
  margin: 0 !important;
  border: 0 !important;
  border-top: 1px solid var(--c-line) !important;
  border-radius: 0 0 16px 16px !important;
  background: #fafbfa !important;
  flex-wrap: nowrap !important;
}
#email-tab .et-composer-v2 .email-compose-tools {
  display: flex !important;
  align-items: center !important;
  gap: 2px !important;
  flex-wrap: nowrap !important;
  min-width: 0;
}
#email-tab .et-composer-v2 .et-foot-tool {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  height: 34px !important;
  min-height: 34px !important;
  padding: 0 10px !important;
  border: 0 !important;
  border-radius: 9px !important;
  background: transparent !important;
  color: #475467 !important;
  font: 600 12.5px var(--font) !important;
  white-space: nowrap;
  box-shadow: none !important;
  cursor: pointer;
}
#email-tab .et-composer-v2 .et-foot-tool[aria-expanded="true"] { background: #e9f4f1 !important; color: var(--c-accent) !important; }
#email-tab .et-composer-v2 .email-compose-submit {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  flex: 0 0 auto;
  margin: 0 !important;
}
#email-tab .et-composer-v2 .et-close-btn {
  height: 38px !important;
  padding: 0 14px !important;
  border: 1px solid var(--c-line) !important;
  border-radius: 10px !important;
  background: #fff !important;
  color: #344054 !important;
  font: 600 13px var(--font) !important;
  white-space: nowrap;
  cursor: pointer;
}
#email-tab .et-composer-v2 .et-close-btn:hover { border-color: #8fc9b9 !important; color: var(--c-accent) !important; }
#email-tab .et-composer-v2 .et-send-btn {
  height: 38px !important;
  min-height: 38px !important;
  padding: 0 20px !important;
  border-radius: 10px !important;
  font: 700 14px var(--font) !important;
  white-space: nowrap;
}
/* Lukk sak and Send (2026-11-24): the same size, on one line, and Lukk sak
   moves like Send: it lifts on hover and springs back after a press (the
   motion layer). Send's wrapper keeps 4 px under it for the progress line,
   so Lukk sak beside it keeps the same 4 px. */
#email-tab .et-composer-v2 :is(.et-close-btn, .et-send-btn) {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box !important;
  height: 38px !important;
  min-height: 38px !important;
  min-width: 104px !important;
  padding: 0 18px !important;
  border-radius: 10px !important;
  font-size: 14px !important;
}
#email-tab .et-composer-v2 .email-compose-submit > .et-close-btn { margin-bottom: 4px !important; }
/* In a flex button the space before " sak" would be dropped ("Lukksak"). */
#email-tab .et-composer-v2 .et-close-btn .et-hide-mobile { white-space: pre; }
@media (hover: hover) {
  #email-tab .et-composer-v2 .et-close-btn:not(:disabled):not([aria-disabled="true"]):not(.disabled):hover {
    translate: 0 calc(-1px * var(--ui-scale, 1));
    box-shadow: 0 calc(6px * var(--ui-scale, 1)) calc(20px * var(--ui-scale, 1)) rgba(0, 0, 0, .08);
  }
}

/* Phone: icon-only tools, the height toggle hidden, roomier editor. */
@media (max-width: 900px) {
  #email-tab .et-composer-v2 { border-radius: 14px !important; }
  #email-tab .et-composer-v2 .et-composer-mode-bar { padding: 7px 8px !important; }
  #email-tab .et-composer-v2 .et-mode-tab { padding: 6px 10px !important; font-size: 12.5px !important; }
  #email-tab .et-composer-v2 #btn-toggle-email-wide { display: none !important; }
  #email-tab .et-composer-v2 .et-head-tool { padding: 0 8px !important; }
  #email-tab .et-composer-v2 .et-field-row { grid-template-columns: 44px minmax(0, 1fr) !important; }
  #email-tab .et-composer-v2 .et-field-row input { font-size: 15px !important; }
  #email-tab .et-composer-v2 .et-tool-label { display: none !important; }
  #email-tab .et-composer-v2 .et-foot-tool { width: 38px !important; height: 38px !important; padding: 0 !important; justify-content: center !important; }
  #email-tab .et-composer-v2 .et-foot-tool svg { width: 19px; height: 19px; }
  #email-tab .et-composer-v2 .email-rich-editor { min-height: 150px !important; font-size: 15px !important; }
  #email-tab .et-composer-v2 .et-close-btn { padding: 0 12px !important; }
  #email-tab .et-composer-v2 .et-send-btn { padding: 0 16px !important; }
}
@media (max-width: 380px) {
  #email-tab .et-composer-v2 .et-close-btn { font-size: 12px !important; padding: 0 9px !important; }
  #email-tab .et-composer-v2 .et-foot-tool { width: 34px !important; }
}

/* Dark theme */
html[data-theme="dark"] #email-tab .et-composer-v2 {
  --c-line: #29384b;
  --c-soft: #1c2a3d;
  --c-text: #e6edf3;
  --c-muted: #93a3b8;
  --c-accent: #6ed3b0;
  background: #142033 !important;
}
html[data-theme="dark"] #email-tab .et-composer-v2 .et-mode-tab.active,
html[data-theme="dark"] #email-tab .et-composer-v2 .et-head-tool,
html[data-theme="dark"] #email-tab .et-composer-v2 .et-close-btn { background: #1a283b !important; color: var(--c-text) !important; }
html[data-theme="dark"] #email-tab .et-composer-v2 .et-field-row { border-bottom-color: #22324a !important; }
html[data-theme="dark"] #email-tab .et-composer-v2 .et-composer-footer { background: #111c2c !important; }
html[data-theme="dark"] #email-tab .et-composer-v2 .et-quick-chip { color: var(--c-text) !important; }
html[data-theme="dark"] #email-tab .et-composer-v2 .et-foot-tool { color: #b4c2d3 !important; }

.et-btn-label-short { display: none; }
@media (max-width: 900px) {
  /* E-post heading: the title keeps its place on the left, the actions are
     compact on the right instead of stretching over the title. */
  #email-tab .et-command-header {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 10px !important;
    flex-wrap: nowrap !important;
  }
  #email-tab .et-command-title-group { flex: 1 1 auto !important; min-width: 0 !important; }
  #email-tab .et-command-title-group .eyebrow { display: none !important; }
  #email-tab .et-title-row h1 { white-space: nowrap !important; font-size: 22px !important; margin: 0 !important; }
  #email-tab .et-command-actions {
    display: flex !important;
    flex: 0 0 auto !important;
    width: auto !important;
    gap: 8px !important;
    margin: 0 !important;
    flex-wrap: nowrap !important;
  }
  #email-tab .et-command-actions .et-action-btn {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 0 !important;
    height: 40px !important;
    min-height: 40px !important;
    padding: 0 14px !important;
    border-radius: 12px !important;
    font-size: 14px !important;
  }
  #email-tab #btn-new-email .et-btn-label { display: none !important; }
  #email-tab #btn-new-email .et-btn-label-short { display: inline !important; }

  /* Composer footer on one line: icon tools left, Lukk + Send right. */
  #email-tab .et-composer-v2 .email-composer-actions.et-composer-footer {
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
  }
  #email-tab .et-composer-v2 .et-composer-footer .email-compose-tools,
  #email-tab .et-composer-v2 .et-composer-footer .email-compose-submit {
    width: auto !important;
    flex: 0 1 auto !important;
    justify-content: flex-start !important;
  }
  #email-tab .et-composer-v2 .et-composer-footer .email-compose-submit { flex: 0 0 auto !important; justify-content: flex-end !important; }
  #email-tab .et-composer-v2 .et-composer-footer .template-picker { flex: 0 0 auto !important; }
  #email-tab .et-composer-v2 .et-foot-tool { width: 34px !important; height: 36px !important; }
  #email-tab .et-composer-v2 .et-close-btn { height: 36px !important; padding: 0 11px !important; }
  #email-tab .et-composer-v2 .et-send-btn { height: 36px !important; min-height: 36px !important; padding: 0 14px !important; }
  /* Phone: Lukk and Send the same size too, narrow enough for the five tools. */
  #email-tab .et-composer-v2 :is(.et-close-btn, .et-send-btn) { min-height: 36px !important; min-width: 80px !important; padding: 0 12px !important; }
  #email-tab .et-composer-v2 .et-hide-mobile { display: none; }
}

/* Område, final layout (desktop and phone): icon | centred text | chevron on
   one row, all vertically centred, the status pill centred under it. The
   selectors carry three ids so the older mobile rules cannot pull it apart. */
#primary-sidebar #agent-controls-rail-section #queue-card-wrapper {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 10px !important;
  padding: 10px 12px 12px !important;
  min-height: 0 !important;
}
#primary-sidebar #agent-controls-rail-section #queue-card-wrapper #btn-toggle-queue-panel {
  display: grid !important;
  grid-template-columns: 34px minmax(0, 1fr) 34px !important;
  align-items: center !important;
  justify-items: center !important;
  gap: 6px !important;
  width: 100% !important;
  min-height: 44px !important;
  padding: 0 !important;
  text-align: center !important;
}
#primary-sidebar #agent-controls-rail-section #queue-card-wrapper .queue-btn-icon {
  position: static !important;
  transform: none !important;
  width: 32px !important;
  height: 32px !important;
  border-radius: 10px !important;
  display: grid !important;
  place-items: center !important;
  justify-self: start !important;
  margin: 0 !important;
}
#primary-sidebar #agent-controls-rail-section #queue-card-wrapper .queue-btn-text {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 2px !important;
  width: 100% !important;
  min-width: 0 !important;
  text-align: center !important;
}
#primary-sidebar #agent-controls-rail-section #queue-card-wrapper .queue-btn-text strong {
  margin: 0 !important;
  font: 700 10.5px var(--font) !important;
  letter-spacing: .14em !important;
  text-transform: uppercase !important;
  opacity: .75;
}
#primary-sidebar #agent-controls-rail-section #queue-card-wrapper .status-lines-sub {
  margin: 0 !important;
  max-width: 100% !important;
  font: 700 15px var(--font) !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  text-align: center !important;
}
#primary-sidebar #agent-controls-rail-section #queue-card-wrapper .queue-chevron {
  position: static !important;
  transform: none !important;
  justify-self: end !important;
  margin: 0 !important;
  font-size: 14px !important;
  opacity: .8;
}
#primary-sidebar #agent-controls-rail-section .queue-profile-accordion.open #queue-card-wrapper .queue-chevron { transform: rotate(180deg) !important; }
#primary-sidebar #agent-controls-rail-section #queue-timer-card {
  align-self: center !important;
  width: auto !important;
  max-width: 100% !important;
  margin: 0 !important;
}

/* Phone: the theme picker lives only in the menu, not in the top bar. */
@media (max-width: 900px) {
  #btn-theme-picker-topbar { display: none !important; }
}

/* Meldinger heading: the same actions as E-post (refresh + Ny) + filter tabs on desktop. */
#sms-tab .sms-page-heading {
  display: flex !important;
  align-items: flex-end !important;
  justify-content: space-between !important;
  gap: 12px !important;
}
#sms-tab .sms-title-group { min-width: 0; }
#sms-tab .sms-header-actions-wrap {
  display: inline-flex !important;
  align-items: center !important;
  gap: calc(10px * var(--ui-scale, 1)) !important;
  align-self: flex-end !important;
  flex: 0 0 auto !important;
}
#sms-tab .sms-filter-bar {
  margin: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
}
#sms-tab .sms-header-divider {
  display: inline-block !important;
  width: calc(1px * var(--ui-scale, 1)) !important;
  height: calc(24px * var(--ui-scale, 1)) !important;
  background: var(--line) !important;
  margin: 0 calc(2px * var(--ui-scale, 1)) !important;
  flex-shrink: 0 !important;
  align-self: center !important;
}
#sms-tab .sms-command-actions { display: inline-flex !important; align-items: center !important; gap: 8px !important; flex: 0 0 auto !important; }
#sms-tab .sms-action-btn { white-space: nowrap; }
/* Gruppemelding beside Ny melding: a two-people icon, the label on desktop. */
#btn-new-sms-group { display: inline-flex; align-items: center; gap: calc(4px * var(--ui-scale, 1)); }
.sms-group-btn-icon {
  width: calc(17px * var(--ui-scale, 1)); height: calc(17px * var(--ui-scale, 1)); flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round;
}


@media (max-width: 900px) {
  #sms-tab .sms-page-heading {
    flex-direction: row !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
  }
  #sms-tab .sms-title-group {
    flex: 1 1 auto !important;
    min-width: 0 !important;
  }
  #sms-tab .sms-title-group .eyebrow,
  #sms-tab .sms-title-group p:not(.eyebrow) { display: none !important; }
  #sms-tab .sms-title-group h1 { white-space: nowrap !important; font-size: 22px !important; margin: 0 !important; }
  #sms-tab .sms-header-actions-wrap {
    display: contents !important;
  }
  #sms-tab .sms-command-actions {
    order: 2 !important;
    width: auto !important;
    margin: 0 !important;
    flex-wrap: nowrap !important;
  }
  #sms-tab .sms-header-divider {
    display: none !important;
  }
  #sms-tab .sms-filter-bar {
    order: 3 !important;
    flex: 0 0 100% !important;
    width: 100% !important;
    margin: calc(4px * var(--ui-scale, 1)) 0 calc(12px * var(--ui-scale, 1)) !important;
    display: flex !important;
    justify-content: flex-start !important;
  }
  #sms-tab .sms-action-btn {
    flex: 0 0 auto !important;
    width: auto !important;
    height: 40px !important;
    min-height: 40px !important;
    padding: 0 14px !important;
    border-radius: 12px !important;
    font-size: 14px !important;
  }
  #sms-tab .sms-action-btn .et-btn-label { display: none !important; }
  #sms-tab .sms-action-btn .et-btn-label-short { display: inline !important; }
}

/* Desktop: the Meldinger heading reads left to right like E-post. */
#sms-tab .sms-page-heading {
  flex-direction: row !important;
  text-align: left !important;
  margin-bottom: calc(14px * var(--ui-scale, 1)) !important;
}
#sms-tab .sms-title-group { flex: 1 1 auto !important; text-align: left !important; }
#sms-tab .sms-header-actions-wrap { align-self: flex-end !important; }

/* Meldinger: "Samtaler" can be dragged wider or narrower on desktop. */
@media (min-width: 901px) {
  #sms-tab .inbox-layout { grid-template-columns: var(--sms-list-width, calc(265px * var(--ui-scale, 1))) minmax(0, 1fr) !important; }
  #sms-tab .thread-panel { position: relative; min-width: 0; }
}
@media (max-width: 900px) {
  #sms-list-resizer { display: none !important; }
}

/* ---------------------------------------------------------------------------
   Klar / Etterarbeid / Pause / Logg ut: four equal tiles under Område. Each has
   its own colour as a soft tint; the current state is filled. The pause menu
   lists the account's own Zisson pause reasons with an icon each.
   --------------------------------------------------------------------------- */
#agent-controls-rail-section #queue-agent-actions.agent-state-actions {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px !important;
  margin-top: 8px !important;
  padding: 0 !important;
  border: 0 !important;
}
#agent-controls-rail-section #queue-agent-actions.agent-state-actions[hidden] { display: none !important; }
#agent-controls-rail-section #queue-agent-actions .pause-control-container { position: relative; min-width: 0; width: 100% !important; }
#agent-controls-rail-section #queue-agent-actions .state-btn {
  --tone: 47, 166, 120;
  width: 100% !important;
  height: 54px !important;
  min-height: 54px !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 3px !important;
  padding: 0 4px !important;
  border: 1px solid rgba(var(--tone), .42) !important;
  border-radius: 14px !important;
  background: rgba(var(--tone), .14) !important;
  color: rgb(var(--tone)) !important;
  font: 700 10.5px var(--font) !important;
  letter-spacing: .02em;
  box-shadow: none !important;
  cursor: pointer;
  transition: background .15s ease, transform .1s ease, box-shadow .15s ease;
}
#agent-controls-rail-section #queue-agent-actions .state-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#agent-controls-rail-section #queue-agent-actions .state-btn span { line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
#agent-controls-rail-section #queue-agent-actions .state-ready { --tone: 52, 199, 120; }
/* Etterarbeid indigo/purple (same as the colleague list), Pause yellow, Logg ut red. */
#agent-controls-rail-section #queue-agent-actions .state-acw { --tone: 99, 102, 241; }
#agent-controls-rail-section #queue-agent-actions .state-pause { --tone: 202, 138, 4; }
#agent-controls-rail-section #queue-agent-actions .state-logout { --tone: 220, 38, 38; }
#agent-controls-rail-section #queue-agent-actions :is(.state-acw, .state-pause, .state-logout):not(.is-current) { background: rgba(var(--tone), .2) !important; border-color: rgba(var(--tone), .6) !important; }
html[data-theme="dark"] #agent-controls-rail-section #queue-agent-actions .state-pause { --tone: 250, 204, 21; }
html[data-theme="dark"] #agent-controls-rail-section #queue-agent-actions .state-acw { --tone: 129, 140, 248; }
html[data-theme="dark"] #agent-controls-rail-section #queue-agent-actions .state-logout { --tone: 248, 113, 113; }
#agent-controls-rail-section #queue-agent-actions .state-btn:hover:not(:disabled) { background: rgba(var(--tone), .24) !important; transform: translateY(-1px); }
#agent-controls-rail-section #queue-agent-actions .state-btn:active:not(:disabled) { transform: translateY(0); }
#agent-controls-rail-section #queue-agent-actions .state-btn.is-current {
  background: rgb(var(--tone)) !important;
  border-color: rgb(var(--tone)) !important;
  color: #fff !important;
  box-shadow: 0 0 0 3px rgba(var(--tone), .28), 0 6px 16px rgba(var(--tone), .32) !important;
}
#agent-controls-rail-section #queue-agent-actions .state-btn:disabled,
#agent-controls-rail-section #queue-agent-actions .state-btn.disabled-gray {
  opacity: .45;
  cursor: not-allowed;
  transform: none;
}
#agent-controls-rail-section #queue-agent-actions .state-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* Pause reasons */
#agent-controls-rail-section #pause-dropdown-menu {
  left: 50% !important;
  right: auto !important;
  transform: translateX(-50%);
  min-width: 210px !important;
  padding: 6px !important;
  border-radius: 14px !important;
  background: #14251f !important;
  border: 1px solid #2b473c !important;
  box-shadow: 0 14px 36px rgba(0, 0, 0, .45) !important;
}
#agent-controls-rail-section #pause-dropdown-menu .pause-option-btn {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  width: 100% !important;
  padding: 9px 10px !important;
  border: 0 !important;
  border-radius: 9px !important;
  background: transparent !important;
  color: #e7f1ec !important;
  font: 600 13.5px var(--font) !important;
  text-align: left !important;
  cursor: pointer;
}
#agent-controls-rail-section #pause-dropdown-menu .pause-option-btn svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  fill: none;
  stroke: #f08030;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#agent-controls-rail-section #pause-dropdown-menu .pause-option-btn:hover,
#agent-controls-rail-section #pause-dropdown-menu .pause-option-btn:focus-visible { background: rgba(240, 128, 48, .16) !important; outline: none; }
#agent-controls-rail-section #queue-agent-actions.agent-state-actions { position: relative; }
#agent-controls-rail-section #queue-agent-actions .pause-control-container { position: static !important; }
#agent-controls-rail-section #pause-dropdown-menu {
  top: calc(100% + 6px) !important;
  left: 0 !important;
  right: 0 !important;
  transform: none !important;
  min-width: 0 !important;
  width: auto !important;
  z-index: 40;
}
#agent-controls-rail-section #queue-agent-actions .state-btn span { font-size: 10px; letter-spacing: 0; }

/* SMS Hurtigsvar: the Maler as one-tap chips above the SMS composer. */
.sms-quick-reply-bar {
  display: flex;
  flex-wrap: nowrap;
  gap: calc(6px * var(--ui-scale, 1));
  align-items: center;
  overflow-x: auto;
  padding: calc(6px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)) 0;
  scrollbar-width: thin;
}
.sms-quick-reply-bar:empty { display: none; }
.sms-quick-reply-bar .et-quick-chip { flex: 0 0 auto; }

/* Maler: edit (pencil) next to delete in both the SMS and the e-mail menu. */
.template-edit-button {
  width: calc(28px * var(--ui-scale, 1));
  border: 0;
  border-radius: calc(12px * var(--ui-scale, 1));
  background: transparent;
  color: #667085;
  cursor: pointer;
  font-size: calc(15px * var(--ui-scale, 1));
}
.template-edit-button:hover { color: var(--blue, #0d6b5c); background: var(--blue-soft, rgba(13, 107, 92, 0.08)); }

/* Header: logo on its own line, the round icon buttons (incl. the admin gear)
   under it, so nothing is drawn over the logo. */
.brand-row { flex-wrap: wrap; row-gap: calc(10px * var(--ui-scale, 1)); }
.brand-row .brand { flex: 1 0 100%; }
.sidebar-header-actions { flex: 1 0 100%; justify-content: flex-start; flex-wrap: wrap; }
.sidebar-header-actions .admin-settings-toggle {
  width: calc(34px * var(--ui-scale, 1)) !important;
  height: calc(34px * var(--ui-scale, 1)) !important;
  flex: 0 0 calc(34px * var(--ui-scale, 1)) !important;
  display: grid !important;
  place-items: center !important;
  padding: 0 !important;
  border: calc(1px * var(--ui-scale, 1)) solid #1f4239 !important;
  border-radius: 50% !important;
  background: #17352e !important;
  color: #9db0a8 !important;
  cursor: pointer;
  transition: all .2s ease;
}
.sidebar-header-actions .admin-settings-toggle.hidden,
.sidebar-header-actions .admin-settings-toggle[hidden] { display: none !important; }
.sidebar-header-actions .admin-settings-toggle:hover { background: #1e453c !important; border-color: #2b594d !important; color: #fff !important; }
.sidebar-header-actions .admin-settings-toggle svg { width: calc(17px * var(--ui-scale, 1)); height: calc(17px * var(--ui-scale, 1)); fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* The logged-in agent is a plain label now: no chevron, no picker. */
.agent-identity { cursor: default; pointer-events: none; }

/* Område, rounded: every piece of the card is a soft pill/circle instead of a
   box with sharp-ish corners. Same three-id selectors as the layout above. */
#primary-sidebar #agent-controls-rail-section #queue-card-wrapper {
  border-radius: 28px !important;
  padding: 14px 16px 16px !important;
}
#primary-sidebar #agent-controls-rail-section #queue-card-wrapper .queue-btn-icon {
  width: 38px !important;
  height: 38px !important;
  border-radius: 50% !important;
}
#primary-sidebar #agent-controls-rail-section #queue-card-wrapper #btn-toggle-queue-panel {
  grid-template-columns: 38px minmax(0, 1fr) 38px !important;
  border-radius: 999px !important;
}
#primary-sidebar #agent-controls-rail-section #queue-card-wrapper .queue-chevron {
  width: 30px;
  height: 30px;
  display: grid !important;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
}
#primary-sidebar #agent-controls-rail-section #queue-timer-card {
  border-radius: 999px !important;
  padding-left: 16px !important;
  padding-right: 16px !important;
}
#agent-controls-rail-section #queue-agent-actions .state-btn {
  border-radius: 999px !important;
  height: 58px !important;
  min-height: 58px !important;
}
#agent-controls-rail-section #queue-agent-actions.agent-state-actions { gap: 10px !important; }
#agent-controls-rail-section .queue-panel-content,
#primary-sidebar .queue-panel-content { border-radius: 24px !important; }
#agent-controls-rail-section .queue-toggle-item { border-radius: 18px !important; }
#agent-controls-rail-section .pause-dropdown-menu { border-radius: 22px !important; }
#utility-agent-select .active-agent-select-wrapper,
#utility-agent-select .agent-identity { border-radius: 999px !important; }
#utility-agent-select .user-avatar { border-radius: 50% !important; }

/* Header v2: the round buttons sit to the right of the logo; when the row is
   too narrow for both they drop under the logo (flex-wrap does the choosing). */
.brand-row { flex-wrap: wrap; row-gap: calc(8px * var(--ui-scale, 1)); column-gap: calc(8px * var(--ui-scale, 1)); }
.brand-row .brand { flex: 1 0 auto; }
.sidebar-header-actions { flex: 1 1 auto; justify-content: flex-end; flex-wrap: nowrap; }
@media (max-width: 900px) {
  .sidebar .sidebar-header-actions { flex: 1 0 100%; }
}

/* Område v2: compact, with the line choices as a dropdown laid over what is
   below instead of pushing it down. */
#primary-sidebar #agent-controls-rail-section #queue-card-wrapper {
  border-radius: 22px !important;
  padding: 8px 10px 9px !important;
  gap: 6px !important;
}
#primary-sidebar #agent-controls-rail-section #queue-card-wrapper #btn-toggle-queue-panel {
  grid-template-columns: 28px minmax(0, 1fr) 28px !important;
  min-height: 34px !important;
  gap: 4px !important;
}
#primary-sidebar #agent-controls-rail-section #queue-card-wrapper .queue-btn-icon {
  width: 28px !important;
  height: 28px !important;
}
#primary-sidebar #agent-controls-rail-section #queue-card-wrapper .queue-btn-icon svg { width: 14px; height: 14px; }
#primary-sidebar #agent-controls-rail-section #queue-card-wrapper .queue-btn-text { gap: 0 !important; }
#primary-sidebar #agent-controls-rail-section #queue-card-wrapper .queue-btn-text strong {
  font-size: 9px !important;
  letter-spacing: .16em !important;
}
#primary-sidebar #agent-controls-rail-section #queue-card-wrapper .status-lines-sub { font-size: 12.5px !important; }
#primary-sidebar #agent-controls-rail-section #queue-card-wrapper .queue-chevron {
  width: 26px !important;
  height: 26px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 0 !important;
  font-size: 0 !important;
  padding: 0 !important;
}
#primary-sidebar #agent-controls-rail-section #queue-card-wrapper .queue-chevron svg { display: block; margin: 0; }
#primary-sidebar #agent-controls-rail-section #queue-timer-card {
  padding: 2px 12px !important;
  min-height: 0 !important;
}
#primary-sidebar #agent-controls-rail-section #queue-timer-card .status-timer-sub { font-size: 11px !important; }
#primary-sidebar #agent-controls-rail-section #queue-timer-card #status-timer-text { font-size: 11px !important; }

#agent-controls-rail-section .queue-profile-accordion { position: relative; }
#agent-controls-rail-section .queue-panel-content {
  position: absolute !important;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 60;
  max-height: min(70vh, 520px);
  overflow-y: auto;
  margin-top: 0 !important;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .5) !important;
}
#agent-controls-rail-section #queue-agent-actions .state-btn {
  height: 46px !important;
  min-height: 46px !important;
}
#agent-controls-rail-section #queue-agent-actions.agent-state-actions { margin-top: 6px !important; gap: 8px !important; }

/* A toast never sits on top of what is underneath it (it covered the Send button). */
.toast-container, .toast { pointer-events: none; }

/* Agentadministrasjon scrolls as a page on every screen size. */
.ra-company-field[hidden] { display: none; }
.content-scroll.admin-page-scroll {
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
}
.content-scroll.admin-page-scroll .admin-agents-page.active,
.content-scroll.admin-page-scroll .admin-agents-workspace,
.content-scroll.admin-page-scroll .admin-agents-directory-panel,
.content-scroll.admin-page-scroll .admin-agent-editor-panel,
.content-scroll.admin-page-scroll .admin-agent-editor-body {
  height: auto;
  min-height: 0;
  max-height: none;
  overflow: visible;
}

/* Phone menu: tighter navigation rows so Oversikt..Statistikk take less height. */
@media (max-width: 900px) {
  #primary-sidebar .primary-nav { gap: calc(2px * var(--ui-scale, 1)) !important; }
  #primary-sidebar .nav-item {
    min-height: 0 !important;
    padding-top: calc(7px * var(--ui-scale, 1)) !important;
    padding-bottom: calc(7px * var(--ui-scale, 1)) !important;
    gap: calc(10px * var(--ui-scale, 1)) !important;
  }
  #primary-sidebar .nav-icon {
    width: calc(20px * var(--ui-scale, 1)) !important;
    height: calc(20px * var(--ui-scale, 1)) !important;
    flex: 0 0 calc(20px * var(--ui-scale, 1)) !important;
  }
  #primary-sidebar .nav-icon svg {
    width: calc(18px * var(--ui-scale, 1)) !important;
    height: calc(18px * var(--ui-scale, 1)) !important;
  }
}

/* Agentadministrasjon: two tabs (Agenter, Invitasjoner). */
.ra-tabs { display: flex; gap: calc(6px * var(--ui-scale, 1)); border-bottom: calc(1px * var(--ui-scale, 1)) solid var(--line); margin: 0 0 calc(16px * var(--ui-scale, 1)); }
.ra-tab { position: relative; display: inline-flex; align-items: center; gap: calc(8px * var(--ui-scale, 1)); padding: calc(10px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1)); border: 0; background: transparent; color: var(--muted); font: 700 calc(14px * var(--ui-scale, 1)) var(--font); cursor: pointer; border-radius: calc(10px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1)) 0 0; }
.ra-tab:hover { color: var(--ink); }
.ra-tab.is-active { color: var(--blue); }
.ra-tab.is-active::after { content: ''; position: absolute; left: calc(8px * var(--ui-scale, 1)); right: calc(8px * var(--ui-scale, 1)); bottom: calc(-1px * var(--ui-scale, 1)); height: calc(3px * var(--ui-scale, 1)); border-radius: calc(3px * var(--ui-scale, 1)); background: var(--blue); }
.ra-tab-count { min-width: calc(22px * var(--ui-scale, 1)); padding: calc(1px * var(--ui-scale, 1)) calc(7px * var(--ui-scale, 1)); border-radius: 999px; background: var(--canvas); color: var(--muted); font-size: calc(12px * var(--ui-scale, 1)); text-align: center; }
.ra-tab.is-active .ra-tab-count { background: var(--blue-soft); color: var(--blue); }
.ra-panel[hidden] { display: none; }
.ra-panel-toolbar { display: grid; grid-template-columns: auto minmax(calc(220px * var(--ui-scale, 1)), 1fr) auto; gap: calc(10px * var(--ui-scale, 1)); align-items: center; margin-bottom: calc(10px * var(--ui-scale, 1)); }
.ra-panel-toolbar .ra-search { position: relative; display: flex; align-items: center; min-width: 0; }
.ra-panel-toolbar .ra-search-icon { position: absolute; left: calc(12px * var(--ui-scale, 1)); color: var(--muted); pointer-events: none; z-index: 1; }
.ra-panel-toolbar .ra-search input { width: 100%; padding-left: calc(34px * var(--ui-scale, 1)); padding-right: calc(32px * var(--ui-scale, 1)); }
.ra-panel-toolbar .ra-search input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.ra-search-clear { position: absolute; right: calc(6px * var(--ui-scale, 1)); display: inline-flex; align-items: center; justify-content: center; width: calc(24px * var(--ui-scale, 1)); height: calc(24px * var(--ui-scale, 1)); padding: 0; border: 0; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; }
.ra-search-clear:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--ink); }
.ra-search-clear[hidden] { display: none; }
.ra-panel-hint-wrap { margin: 0 0 calc(12px * var(--ui-scale, 1)); }
.ra-hint-toggle { display: none; }
.ra-panel-hint { margin: 0; color: var(--muted); font-size: calc(12.5px * var(--ui-scale, 1)); line-height: 1.45; }
.ra-hint-badge { display: inline-flex; align-items: center; justify-content: center; width: calc(16px * var(--ui-scale, 1)); height: calc(16px * var(--ui-scale, 1)); border-radius: 999px; background: color-mix(in srgb, var(--muted) 15%, transparent); font-size: calc(10.5px * var(--ui-scale, 1)); font-weight: 700; color: var(--muted); }
.ra-agent-rows, .ra-invite-rows { display: grid; gap: calc(12px * var(--ui-scale, 1)); }
.ra-agent-row, .ra-invite-row { background: var(--surface); border: calc(1px * var(--ui-scale, 1)) solid var(--line); border-radius: calc(14px * var(--ui-scale, 1)); padding: calc(14px * var(--ui-scale, 1)); }
.ra-agent-row-head { display: flex; align-items: center; gap: calc(10px * var(--ui-scale, 1)); margin-bottom: calc(12px * var(--ui-scale, 1)); }
.ra-agent-row-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: calc(15px * var(--ui-scale, 1)); }
.ra-agent-row-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: calc(12px * var(--ui-scale, 1)); align-items: end; }
.ra-agent-row-depts { grid-column: 1 / -1; margin: 0; padding: 0; border: 0; }
.ra-agent-row-depts legend { padding: 0 0 calc(6px * var(--ui-scale, 1)); font-size: calc(12px * var(--ui-scale, 1)); font-weight: 700; color: var(--muted); }
.ra-invite-row { display: flex; align-items: center; gap: calc(12px * var(--ui-scale, 1)); }
.ra-invite-row-info { flex: 1 1 auto; min-width: 0; display: grid; gap: calc(2px * var(--ui-scale, 1)); }
.ra-invite-row-info small { color: var(--muted); font-size: calc(12px * var(--ui-scale, 1)); }
@media (max-width: 900px) {
  .ra-agent-row-fields { grid-template-columns: 1fr; }
  .ra-invite-row { flex-wrap: wrap; }
  .ra-invite-row .button { width: 100%; }
  .ra-tab { flex: 1 1 0; justify-content: center; }
}

/* Agent rows: invite button beside the phone number, Save only when changed. */
.ra-count { color: var(--muted); font-size: calc(13px * var(--ui-scale, 1)); font-weight: 700; white-space: nowrap; }
.ra-save[hidden], .ra-agent-row-foot [hidden] { display: none; }
.ra-phone-field > label { font-size: calc(12px * var(--ui-scale, 1)); font-weight: 700; }
.ra-phone-line { display: flex; gap: calc(8px * var(--ui-scale, 1)); align-items: stretch; }
.ra-phone-line input { flex: 1 1 auto; min-width: 0; }
.ra-phone-line .ra-phone-invite { flex: 0 0 auto; white-space: nowrap; }
.ra-phone-line .ra-invite-channel { flex: 0 0 auto; width: auto; min-width: 0; }
.ra-email-field > label { font-size: calc(12px * var(--ui-scale, 1)); font-weight: 700; }
.ra-email-line { display: flex; gap: calc(8px * var(--ui-scale, 1)); align-items: stretch; }
.ra-email-line input { flex: 1 1 auto; min-width: 0; }
.ra-email-line .ra-change-email { flex: 0 0 auto; white-space: nowrap; }
.ra-agent-row.is-dirty { border-color: var(--blue); box-shadow: 0 0 0 calc(3px * var(--ui-scale, 1)) var(--blue-soft); }
.ra-agent-row-foot { display: flex; justify-content: flex-end; margin-top: calc(10px * var(--ui-scale, 1)); }
.ra-agent-row-foot:has([hidden]) { display: none; }

/* Agentadministrasjon: compact tiles in a grid, so many agents fit on one screen.
   The name is the tile title and is edited in place; phone and e-mail carry an icon
   instead of a label line. Colours still come from the theme. */
.admin-agents-page.ra-page { max-width: calc(1680px * var(--ui-scale, 1)); }
#ra-panel-agents .ra-panel-hint { font-size: calc(12px * var(--ui-scale, 1)); margin-bottom: 0; }
#admin-agents-list-container.ra-agent-rows { grid-template-columns: repeat(auto-fill, minmax(min(100%, calc(375px * var(--ui-scale, 1))), 1fr)); gap: calc(12px * var(--ui-scale, 1)); align-items: start; }
#admin-agents-list-container > .ra-empty { grid-column: 1 / -1; }
#admin-agents-list-container .ra-agent-tile { position: relative; display: grid; gap: calc(10px * var(--ui-scale, 1)); min-width: 0; padding: calc(14px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1)) !important; border-radius: calc(16px * var(--ui-scale, 1)) !important; overflow: hidden; }
#admin-agents-list-container .ra-agent-tile::before { content: ""; position: absolute; inset: calc(10px * var(--ui-scale, 1)) auto calc(10px * var(--ui-scale, 1)) calc(5px * var(--ui-scale, 1)); width: calc(3px * var(--ui-scale, 1)); border-radius: 999px; background: var(--line); pointer-events: none; }
#admin-agents-list-container .ra-agent-tile[data-account-status="ACTIVE"]::before { background: #22c55e; }
#admin-agents-list-container .ra-agent-tile[data-account-status="INVITATION_SENT"]::before { background: #3b82f6; }
#admin-agents-list-container .ra-agent-tile[data-account-status="INVITATION_EXPIRED"]::before { background: #ef4444; }
#admin-agents-list-container .ra-agent-tile[data-account-status="NOT_INVITED"]::before { background: var(--rh-accent, #3cc85a); }
#admin-agents-list-container .ra-agent-tile .ra-agent-row-head { gap: calc(8px * var(--ui-scale, 1)); margin: 0; }
#admin-agents-list-container .ra-agent-tile .ra-avatar { width: calc(34px * var(--ui-scale, 1)); height: calc(34px * var(--ui-scale, 1)); font-size: calc(13px * var(--ui-scale, 1)); }
.ra-tile-identity { flex: 1 1 auto; min-width: 0; display: grid; justify-items: start; gap: calc(3px * var(--ui-scale, 1)); }
.ra-name-field { position: relative; display: flex; align-items: center; width: 100%; min-width: 0; }
.ra-tile-name { width: 100%; min-width: 0; height: calc(26px * var(--ui-scale, 1)); margin: 0 0 0 calc(-6px * var(--ui-scale, 1)); padding: 0 calc(22px * var(--ui-scale, 1)) 0 calc(6px * var(--ui-scale, 1)); border: calc(1px * var(--ui-scale, 1)) solid transparent; border-bottom: calc(1px * var(--ui-scale, 1)) dashed color-mix(in srgb, var(--muted) 35%, transparent); border-radius: calc(8px * var(--ui-scale, 1)); background: transparent; color: var(--ink); font: 800 calc(14px * var(--ui-scale, 1)) var(--display); letter-spacing: -.01em; text-overflow: ellipsis; }
.ra-tile-name:hover { border-color: var(--line); }
.ra-tile-name:focus { border-color: var(--blue); background: var(--surface); outline: calc(2px * var(--ui-scale, 1)) solid var(--blue-soft); outline-offset: 0; }
.ra-tile-name::placeholder { color: var(--muted); font-weight: 600; }
.ra-name-edit-cue { position: absolute; right: calc(5px * var(--ui-scale, 1)); display: inline-flex; color: var(--muted); opacity: .5; pointer-events: none; transition: opacity .14s ease, color .14s ease; }
.ra-name-field:hover .ra-name-edit-cue, .ra-name-field:focus-within .ra-name-edit-cue { opacity: .95; color: var(--ink); }
/* Theme input rules (Lime dark) must not frame the title until it is hovered or focused. */
#admin-agents-list-container .ra-tile-name { background: transparent !important; border-color: transparent !important; border-bottom-color: color-mix(in srgb, var(--muted) 32%, transparent) !important; border-bottom-style: dashed !important; box-shadow: none !important; border-radius: calc(8px * var(--ui-scale, 1)) !important; }
#admin-agents-list-container .ra-tile-name:hover { border-color: var(--line) !important; border-bottom-style: solid !important; }
#admin-agents-list-container .ra-tile-name:focus { border-color: var(--blue) !important; border-bottom-style: solid !important; background: var(--surface) !important; }
#admin-agents-list-container .ra-agent-tile .ra-status-chip { min-height: 0; height: calc(20px * var(--ui-scale, 1)); padding: 0 calc(8px * var(--ui-scale, 1)) !important; font-size: calc(11px * var(--ui-scale, 1)); line-height: 1; display: inline-flex; align-items: center; gap: calc(5px * var(--ui-scale, 1)); }
#admin-agents-list-container .ra-agent-tile .ra-status-chip::before { content: ""; width: calc(6px * var(--ui-scale, 1)); height: calc(6px * var(--ui-scale, 1)); border-radius: 50%; background: currentColor; flex-shrink: 0; }
#admin-agents-list-container .ra-agent-tile .ra-agent-toggle { flex: 0 0 auto; min-height: calc(28px * var(--ui-scale, 1)); height: calc(28px * var(--ui-scale, 1)); padding: 0 calc(10px * var(--ui-scale, 1)); font-size: calc(12px * var(--ui-scale, 1)); }
#admin-agents-list-container .ra-agent-tile .ra-agent-delete { width: calc(28px * var(--ui-scale, 1)); height: calc(28px * var(--ui-scale, 1)); margin: 0; border-radius: calc(8px * var(--ui-scale, 1)); }
#admin-agents-list-container .ra-agent-tile .ra-agent-row-fields { grid-template-columns: minmax(0, 1fr); gap: calc(7px * var(--ui-scale, 1)); }
#admin-agents-list-container .ra-agent-tile .ra-field { gap: 0; }
#admin-agents-list-container .ra-agent-tile :is(.ra-phone-line, .ra-email-line) { gap: calc(6px * var(--ui-scale, 1)); align-items: stretch; }
.ra-invite-cluster { display: inline-flex; align-items: center; gap: calc(6px * var(--ui-scale, 1)); flex: 0 0 auto; }
#admin-agents-list-container .ra-agent-tile .ra-invite-cluster select.ra-invite-channel { border: calc(1px * var(--ui-scale, 1)) solid var(--line) !important; border-radius: 999px !important; box-shadow: none !important; min-height: calc(34px * var(--ui-scale, 1)); height: calc(34px * var(--ui-scale, 1)); padding: 0 calc(10px * var(--ui-scale, 1)); font-size: calc(12px * var(--ui-scale, 1)); font-weight: 600; background: var(--surface); }
#admin-agents-list-container .ra-agent-tile .ra-invite-cluster .btn-send-agent-invitation { border-radius: 999px !important; box-shadow: none !important; min-height: calc(34px * var(--ui-scale, 1)); height: calc(34px * var(--ui-scale, 1)); padding: 0 calc(12px * var(--ui-scale, 1)); font-size: calc(12px * var(--ui-scale, 1)); }
.ra-input-icon { position: relative; flex: 1 1 auto; min-width: 0; display: flex; color: var(--muted); }
.ra-input-icon > svg { position: absolute; left: calc(9px * var(--ui-scale, 1)); top: 50%; translate: 0 -50%; pointer-events: none; z-index: 1; }
#admin-agents-list-container .ra-agent-tile .ra-input-icon input { flex: 1 1 auto; width: 100%; min-width: 0; min-height: calc(34px * var(--ui-scale, 1)); height: calc(34px * var(--ui-scale, 1)); padding: 0 calc(8px * var(--ui-scale, 1)) 0 calc(26px * var(--ui-scale, 1)); border-radius: calc(10px * var(--ui-scale, 1)) !important; font-size: calc(13px * var(--ui-scale, 1)); }
#admin-agents-list-container .ra-agent-tile .ra-email-line .button { min-height: calc(34px * var(--ui-scale, 1)); height: calc(34px * var(--ui-scale, 1)); padding: 0 calc(11px * var(--ui-scale, 1)); border-radius: calc(10px * var(--ui-scale, 1)) !important; font-size: calc(12px * var(--ui-scale, 1)); }
#admin-agents-list-container .ra-agent-tile .ra-agent-row-depts { margin: calc(2px * var(--ui-scale, 1)) 0 0; }
#admin-agents-list-container .ra-agent-tile .ra-chip-options { align-items: center; gap: calc(6px * var(--ui-scale, 1)); }
.ra-tile-label { margin-right: calc(2px * var(--ui-scale, 1)); color: var(--muted); font-size: calc(11px * var(--ui-scale, 1)); font-weight: 700; }
#admin-agents-list-container .ra-agent-tile .ra-chip-option { min-height: calc(28px * var(--ui-scale, 1)); gap: calc(5px * var(--ui-scale, 1)); padding: calc(2px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1)) calc(2px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1)); font-size: calc(12px * var(--ui-scale, 1)); }
#admin-agents-list-container .ra-agent-tile .ra-chip-option input { width: calc(13px * var(--ui-scale, 1)); height: calc(13px * var(--ui-scale, 1)); }
#admin-agents-list-container .ra-agent-tile .ra-agent-row-foot { margin: 0; }
#admin-agents-list-container .ra-agent-tile .ra-agent-row-foot .button { min-height: calc(32px * var(--ui-scale, 1)); padding: 0 calc(14px * var(--ui-scale, 1)); font-size: calc(12px * var(--ui-scale, 1)); }
/* An invitation that ran out: red, in every theme. */
#admin-agents-list-container .ra-status-chip.is-invitation_expired { background: rgba(220, 38, 38, .12) !important; color: #B91C1C !important; border: 0 !important; }
html[data-theme="dark"] #admin-agents-list-container .ra-status-chip.is-invitation_expired { background: rgba(248, 113, 113, .16) !important; color: #FCA5A5 !important; }
#admin-agents-list-container .ra-agent-tile.is-deactivated :is(.ra-avatar, .ra-tile-name, .ra-agent-row-fields) { opacity: .55; }
@media (max-width: 900px) {
  #admin-agents-tab .ra-header { align-items: stretch; gap: calc(10px * var(--ui-scale, 1)); }
  #admin-agents-tab .ra-header-actions { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: calc(8px * var(--ui-scale, 1)); }
  #admin-agents-tab .ra-header-actions:has(#admin-save-all[hidden]) { display: flex; flex-wrap: nowrap; }
  #admin-agents-tab .ra-header-actions:has(#admin-save-all[hidden]) > :is(.button, .ra-back):not([hidden]) { flex: 1 1 0; }
  #admin-agents-tab .ra-header-actions > :is(.button, .ra-back) { height: calc(40px * var(--ui-scale, 1)); min-height: calc(40px * var(--ui-scale, 1)); padding: 0 calc(10px * var(--ui-scale, 1)); font-size: calc(13px * var(--ui-scale, 1)); }
  #admin-agents-tab .ra-panel-toolbar { grid-template-columns: 1fr auto; grid-template-rows: auto auto; gap: calc(8px * var(--ui-scale, 1)); }
  #admin-agents-tab #admin-agent-count { grid-column: 1; grid-row: 1; justify-self: start; }
  #admin-agents-tab #btn-add-new-admin-agent { grid-column: 2; grid-row: 1; justify-self: end; min-height: calc(36px * var(--ui-scale, 1)); height: calc(36px * var(--ui-scale, 1)); padding: 0 calc(14px * var(--ui-scale, 1)); font-size: calc(13px * var(--ui-scale, 1)); }
  #admin-agents-tab .ra-panel-toolbar .ra-search { grid-column: 1 / -1; grid-row: 2; }
  #admin-agents-tab .ra-panel-toolbar .ra-search input { min-height: calc(42px * var(--ui-scale, 1)); font-size: calc(16px * var(--ui-scale, 1)); }
  #admin-agents-tab .ra-panel-hint-wrap { margin: 0 0 calc(10px * var(--ui-scale, 1)); }
  #admin-agents-tab .ra-hint-toggle { display: inline-flex; align-items: center; gap: calc(6px * var(--ui-scale, 1)); height: calc(30px * var(--ui-scale, 1)); padding: 0 calc(10px * var(--ui-scale, 1)) 0 calc(7px * var(--ui-scale, 1)); border-radius: 999px; border: calc(1px * var(--ui-scale, 1)) solid var(--line); background: var(--surface); color: var(--muted); font-size: calc(12px * var(--ui-scale, 1)); font-weight: 600; cursor: pointer; }
  #admin-agents-tab .ra-hint-chevron { transition: transform .16s ease; }
  #admin-agents-tab .ra-hint-toggle[aria-expanded="true"] .ra-hint-chevron { transform: rotate(180deg); }
  #admin-agents-tab #ra-panel-agents .ra-panel-hint { display: none; margin-top: calc(8px * var(--ui-scale, 1)); padding: calc(10px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)); border-radius: calc(12px * var(--ui-scale, 1)); border: calc(1px * var(--ui-scale, 1)) solid var(--line); background: var(--surface); }
  #admin-agents-tab .ra-panel-hint-wrap.is-open .ra-panel-hint { display: block; }
  #admin-agents-list-container .ra-agent-tile .ra-input-icon input,
  #admin-agents-list-container .ra-agent-tile .ra-email-line .button { min-height: calc(40px * var(--ui-scale, 1)); height: calc(40px * var(--ui-scale, 1)); font-size: calc(16px * var(--ui-scale, 1)); }
  #admin-agents-list-container .ra-agent-tile .ra-invite-cluster select.ra-invite-channel { min-height: calc(36px * var(--ui-scale, 1)); height: calc(36px * var(--ui-scale, 1)); padding: 0 calc(12px * var(--ui-scale, 1)); font-size: calc(16px * var(--ui-scale, 1)); }
  #admin-agents-list-container .ra-agent-tile .ra-invite-cluster .btn-send-agent-invitation { min-height: calc(36px * var(--ui-scale, 1)); height: calc(36px * var(--ui-scale, 1)); padding: 0 calc(16px * var(--ui-scale, 1)); font-size: calc(13px * var(--ui-scale, 1)); flex: 0 0 auto; width: auto; }
  #admin-agents-list-container .ra-agent-tile .ra-email-line .button { font-size: calc(13px * var(--ui-scale, 1)); }
  .ra-tile-name { height: calc(30px * var(--ui-scale, 1)); font-size: calc(16px * var(--ui-scale, 1)); }
  #admin-agents-list-container .ra-agent-tile .ra-chip-option { min-height: calc(34px * var(--ui-scale, 1)); }
  #ra-panel-agents.ra-panel { padding: calc(12px * var(--ui-scale, 1)) !important; }
  /* Channel and Send go under the number as separate compact pill controls. */
  #admin-agents-list-container .ra-agent-tile .ra-phone-line { flex-wrap: wrap; }
  #admin-agents-list-container .ra-agent-tile .ra-phone-line:has(.ra-invite-cluster) .ra-input-icon { flex-basis: 100%; }
  #admin-agents-list-container .ra-agent-tile .ra-invite-cluster { width: 100%; display: flex; justify-content: flex-start; gap: calc(8px * var(--ui-scale, 1)); }
  /* Name on its own line beside the avatar, status and Aktiver/Deaktiver below it. */
  #admin-agents-list-container .ra-agent-tile .ra-agent-row-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "av name del" "av chip toggle"; align-items: center; row-gap: calc(4px * var(--ui-scale, 1)); }
  #admin-agents-list-container .ra-agent-tile .ra-tile-identity { display: contents; }
  #admin-agents-list-container .ra-agent-tile .ra-avatar { grid-area: av; align-self: start; margin-top: calc(2px * var(--ui-scale, 1)); }
  #admin-agents-list-container .ra-agent-tile .ra-name-field { grid-area: name; width: calc(100% + 6px * var(--ui-scale, 1)); }
  #admin-agents-list-container .ra-agent-tile .ra-status-chip { grid-area: chip; justify-self: start; }
  #admin-agents-list-container .ra-agent-tile .ra-agent-toggle { grid-area: toggle; }
  #admin-agents-list-container .ra-agent-tile .ra-agent-delete { grid-area: del; justify-self: end; }
}

/* On a phone the open menu sits at z-index 1000; the theme picker has to be above it. */
@media (max-width: 900px) {
  .theme-picker { z-index: 1100; }
}

/* ---- Consistent themes (2026-10-29) --------------------------------------
   One accent per theme, neutrals for everything else, and only three signal
   colours left in the menu: amber (a call is going on), red (missed / failed)
   and the accent (free / current). The accent follows the chosen theme. */
html, html[data-theme-name="fjord"] { --rh-accent: #4cd09b; --rh-accent-rgb: 76, 208, 155; }
html[data-theme-name="havn"] { --rh-accent: #82aaff; --rh-accent-rgb: 130, 170, 255; }
html[data-theme-name="terrakotta"] { --rh-accent: #f2926a; --rh-accent-rgb: 242, 146, 106; }
html[data-theme-name="grafitt"] { --rh-accent: #ff62ab; --rh-accent-rgb: 255, 98, 171; }

/* Klar / Etterarbeid / Pause / Logg ut: same neutral look, accent when current. */
html #agent-controls-rail-section #queue-agent-actions .state-btn {
  background: rgba(255, 255, 255, .07) !important;
  border-color: rgba(255, 255, 255, .16) !important;
  color: rgba(255, 255, 255, .86) !important;
}
html #agent-controls-rail-section #queue-agent-actions .state-btn:hover:not(:disabled) {
  background: rgba(var(--rh-accent-rgb), .2) !important;
  border-color: rgba(var(--rh-accent-rgb), .55) !important;
  color: #fff !important;
}
html #agent-controls-rail-section #queue-agent-actions .state-btn.is-current {
  background: var(--rh-accent) !important;
  border-color: var(--rh-accent) !important;
  color: #0b1220 !important;
  box-shadow: 0 0 0 3px rgba(var(--rh-accent-rgb), .25) !important;
}

/* The Område / status card: accent when free, quiet neutral for every other state. */
html #queue-card-wrapper.status-btn-green {
  background: linear-gradient(135deg, rgba(var(--rh-accent-rgb), .30), rgba(var(--rh-accent-rgb), .16)) !important;
  border-color: rgba(var(--rh-accent-rgb), .6) !important;
}
html #queue-card-wrapper.status-btn-light-orange,
html #queue-card-wrapper.status-btn-purple,
html #queue-card-wrapper.status-btn-gray {
  background: rgba(255, 255, 255, .08) !important;
  border-color: rgba(255, 255, 255, .22) !important;
}

/* Colleagues in the menu: accent = free, amber = in a call, red = missed, grey = the rest. */
html #primary-sidebar #agents-list .agent-mini[data-zisson-state="available"],
html #primary-sidebar #agents-list .agent-mini[data-zisson-state="transfer_answered"] { --agent-state-color: var(--rh-accent); --agent-state-bg: rgba(var(--rh-accent-rgb), .16); }
html #primary-sidebar #agents-list .agent-mini[data-zisson-state="in_call"],
html #primary-sidebar #agents-list .agent-mini[data-zisson-state="ringing"],
html #primary-sidebar #agents-list .agent-mini[data-zisson-state="dialing"],
html #primary-sidebar #agents-list .agent-mini[data-zisson-state="transfer_ringing"] { --agent-state-color: #f5b04a; --agent-state-bg: rgba(245, 176, 74, .18); }
html #primary-sidebar #agents-list .agent-mini[data-zisson-state="paused"],
html #primary-sidebar #agents-list .agent-mini[data-zisson-state="busy"],
html #primary-sidebar #agents-list .agent-mini[data-zisson-state="wrapup"],
html #primary-sidebar #agents-list .agent-mini[data-zisson-state="call_ended"] { --agent-state-color: #b8c3cc; --agent-state-bg: rgba(255, 255, 255, .09); }
html #primary-sidebar #agents-list .agent-mini[data-zisson-state="offline"],
html #primary-sidebar #agents-list .agent-mini[data-zisson-state="connected_idle"],
html #primary-sidebar #agents-list .agent-mini[data-zisson-state="app_idle"] { --agent-state-color: #8b96a0; --agent-state-bg: rgba(139, 150, 160, .14); }
html #primary-sidebar #agents-list .agent-mini[data-zisson-state="transfer_failed"],
html #primary-sidebar #agents-list .agent-mini[data-zisson-state="missed_ring"] { --agent-state-color: #f08a85; --agent-state-bg: rgba(240, 138, 133, .16); }

/* Overview cards: one accent for every icon chip instead of four colours. */
html .metric-icon.blue, html .metric-icon.green, html .metric-icon.violet, html .metric-icon.orange,
html .quick-icon.blue, html .quick-icon.green, html .quick-icon.violet, html .quick-icon.orange {
  background: var(--blue-soft);
  color: var(--blue);
}

/* Text on the status card stays light in every state (the old orange state used dark text). */
html #queue-card-wrapper.status-btn-green .queue-btn-text,
html #queue-card-wrapper.status-btn-green .queue-btn-text small,
html #queue-card-wrapper.status-btn-green .queue-btn-icon,
html #queue-card-wrapper.status-btn-green .queue-chevron,
html #queue-card-wrapper.status-btn-light-orange .queue-btn-text,
html #queue-card-wrapper.status-btn-light-orange .queue-btn-text small,
html #queue-card-wrapper.status-btn-light-orange .queue-btn-icon,
html #queue-card-wrapper.status-btn-light-orange .queue-chevron,
html #queue-card-wrapper.status-btn-purple .queue-btn-text,
html #queue-card-wrapper.status-btn-purple .queue-btn-text small,
html #queue-card-wrapper.status-btn-purple .queue-btn-icon,
html #queue-card-wrapper.status-btn-purple .queue-chevron {
  color: #ffffff !important;
}
html #queue-card-wrapper.status-btn-light-orange .queue-btn-icon,
html #queue-card-wrapper.status-btn-purple .queue-btn-icon {
  background: rgba(255, 255, 255, .14) !important;
}
html #queue-timer-card.status-btn-green,
html #queue-timer-card.status-btn-light-orange,
html #queue-timer-card.status-btn-purple,
html #queue-timer-card.status-btn-gray {
  background: rgba(0, 0, 0, .22) !important;
  border-color: rgba(255, 255, 255, .16) !important;
  color: #ffffff !important;
}

/* The four menu buttons at the top (Enkel, Varsler, Admin, Tema): neutral, accent when on. */
html .sidebar .sidebar-header-actions > button,
html .sidebar-header-actions .admin-settings-toggle,
html .sidebar-header-actions .softphone-toggle,
html .sidebar-header-actions .theme-toggle,
html .sidebar-header-actions .notification-toggle.notification-disabled {
  background: rgba(255, 255, 255, .07) !important;
  border-color: rgba(255, 255, 255, .14) !important;
  color: rgba(255, 255, 255, .8) !important;
}
html .sidebar .sidebar-header-actions > button:hover,
html .sidebar-header-actions .admin-settings-toggle:hover,
html .sidebar-header-actions .softphone-toggle:hover:not(.active),
html .sidebar-header-actions .theme-toggle:hover {
  background: rgba(var(--rh-accent-rgb), .18) !important;
  border-color: rgba(var(--rh-accent-rgb), .5) !important;
  color: #fff !important;
}
html .sidebar .sidebar-header-actions > button.active,
html .sidebar .sidebar-header-actions > .mobile-simple-toggle.active,
html .sidebar-header-actions .notification-toggle.notification-enabled {
  background: rgba(var(--rh-accent-rgb), .2) !important;
  border-color: var(--rh-accent) !important;
  color: var(--rh-accent) !important;
}
html .sidebar-header-actions .notification-toggle.notification-blocked {
  background: rgba(240, 138, 133, .15) !important;
  border-color: #f08a85 !important;
  color: #f08a85 !important;
}
html #primary-sidebar .agent-department-count { color: var(--rh-accent); }
html #primary-sidebar .agent-department-count[data-empty="true"] { color: #7f8c96; }

/* Sentralbord card and the logged-in agent card: same height, rounding, glass and icon chip. */
html #primary-sidebar #sentralbord-card,
html #primary-sidebar #utility-agent-select .agent-identity {
  align-items: center !important;
  gap: calc(12px * var(--ui-scale, 1)) !important;
  width: 100% !important;
  min-height: calc(64px * var(--ui-scale, 1)) !important;
  margin: 0 !important;
  padding: calc(10px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1)) !important;
  border-radius: calc(22px * var(--ui-scale, 1)) !important;
  background: rgba(255, 255, 255, .07) !important;
  border: calc(1px * var(--ui-scale, 1)) solid rgba(255, 255, 255, .14) !important;
  box-shadow: none !important;
  box-sizing: border-box !important;
  color: #ffffff !important;
}
html #primary-sidebar #utility-agent-select .active-agent-select-wrapper { border-radius: calc(22px * var(--ui-scale, 1)) !important; }
html #primary-sidebar #sentralbord-card .service-card-heading {
  display: inline-flex !important;
  align-items: center !important;
  min-height: 0 !important;
  margin: 0 !important;
  flex: 0 0 auto;
}
html #primary-sidebar #sentralbord-card .service-card-heading h2 { display: none; }
html #primary-sidebar #sentralbord-card .service-icon,
html #primary-sidebar #utility-agent-select .user-avatar {
  flex: 0 0 auto;
  width: calc(40px * var(--ui-scale, 1)) !important;
  height: calc(40px * var(--ui-scale, 1)) !important;
  border-radius: 50% !important;
  display: grid !important;
  place-items: center !important;
  background: rgba(var(--rh-accent-rgb), .18) !important;
  color: var(--rh-accent) !important;
  font-size: calc(13px * var(--ui-scale, 1)) !important;
  font-weight: 800 !important;
}
/* Text: a bold first line and a quiet second line, in both cards. */
html #primary-sidebar #sentralbord-card .sentralbord-text,
html #primary-sidebar #sentralbord-card strong,
html #primary-sidebar #utility-agent-select .active-agent-label {
  display: block;
  color: #ffffff !important;
  font-size: calc(15px * var(--ui-scale, 1)) !important;
  font-weight: 700 !important;
  line-height: 1.25 !important;
  margin: 0 !important;
}
html #primary-sidebar #sentralbord-card p,
html #primary-sidebar #utility-agent-select .active-agent-phone {
  display: block;
  color: rgba(255, 255, 255, .62) !important;
  font-size: calc(13px * var(--ui-scale, 1)) !important;
  font-weight: 500 !important;
  line-height: 1.25 !important;
  margin: 0 !important;
}
html #primary-sidebar #utility-agent-select .active-agent-info-wrap { min-width: 0; display: grid; gap: calc(2px * var(--ui-scale, 1)); }
html #primary-sidebar #queue-card-wrapper { border-radius: calc(22px * var(--ui-scale, 1)) !important; }
html #primary-sidebar #utility-agent-select .agent-identity { display: flex !important; }
html #primary-sidebar #sentralbord-card {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) !important;
  grid-template-rows: auto auto !important;
  column-gap: calc(12px * var(--ui-scale, 1)) !important;
  row-gap: calc(2px * var(--ui-scale, 1)) !important;
  align-content: center !important;
}
html #primary-sidebar #sentralbord-card .service-card-heading { grid-column: 1; grid-row: 1 / span 2; }
html #primary-sidebar #sentralbord-card strong { grid-column: 2; grid-row: 1; align-self: end; }
html #primary-sidebar #sentralbord-card p { grid-column: 2; grid-row: 2; align-self: start; }

/* Hurtigsvar: the original small text, but tall enough that the bottom is not cut off. */
html .sms-quick-reply-bar,
html #email-tab .et-composer-v2 .et-quick-reply-bar {
  align-items: center !important;
  gap: calc(6px * var(--ui-scale, 1)) !important;
  padding-top: calc(6px * var(--ui-scale, 1)) !important;
  padding-bottom: calc(10px * var(--ui-scale, 1)) !important;
  overflow-y: hidden !important;
  scrollbar-width: none !important;
}
html .sms-quick-reply-bar::-webkit-scrollbar,
html #email-tab .et-composer-v2 .et-quick-reply-bar::-webkit-scrollbar { display: none; }
html .sms-quick-reply-bar .et-quick-chip,
html #email-tab .et-composer-v2 .et-quick-chip {
  min-height: calc(30px * var(--ui-scale, 1)) !important;
  padding: calc(6px * var(--ui-scale, 1)) calc(11px * var(--ui-scale, 1)) !important;
  line-height: 1.35 !important;
  overflow: visible !important;
}

/* Which way an SMS travelled (via MBN / Social / Zisson): quiet text in the
   meta line of every bubble, customer and agent alike. */
.sms-source-note { color: var(--muted); font-weight: 600; white-space: nowrap; }
.sms-source-note.is-social { color: var(--blue); }
.sms-source-note.is-zisson { color: #0e7490; }
html[data-theme="dark"] .sms-source-note.is-zisson { color: #67e8f9; }
/* "via MBN" is orange in every theme (Marius, 2026-11-26). */
.sms-source-note.is-mbn { color: #c2410c; }
html[data-theme="dark"] .sms-source-note.is-mbn { color: #fb923c; }

/* SMS conversation labels: one calm line instead of a row of pills.
   Status stays visible; everything else is plain muted text with dots between. */
html .sms-context-labels {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: calc(2px * var(--ui-scale, 1)) 0;
  margin-top: calc(6px * var(--ui-scale, 1));
  font-size: calc(12.5px * var(--ui-scale, 1));
  color: var(--muted);
}
html .sms-context-labels > span { display: inline-flex; align-items: center; }
html .sms-context-labels > span.hidden { display: none; }
html .sms-context-labels > span:not(.hidden) ~ span:not(.hidden)::before {
  content: '·';
  margin: 0 calc(7px * var(--ui-scale, 1));
  color: var(--muted);
  opacity: .55;
  font-weight: 800;
}
html .sms-context-labels .et-meta-pill,
html .sms-context-labels .location-pill,
html .sms-context-labels .ticket-badge,
html .sms-context-labels .waiting-timer-badge {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  min-height: 0 !important;
  border-radius: 0 !important;
  color: var(--muted) !important;
  font-size: inherit !important;
  font-weight: 600 !important;
  line-height: 1.4 !important;
}
html .sms-context-labels #current-sms-status { color: var(--blue) !important; font-weight: 800 !important; }
html .sms-context-labels #current-sms-status.pill-status-closed { color: var(--muted) !important; font-weight: 600 !important; }
html .sms-context-labels #current-sms-waiting-timer.waiting-warning { color: var(--orange) !important; }
html .sms-context-labels #current-sms-waiting-timer.waiting-critical { color: var(--red) !important; font-weight: 800 !important; }

/* SMS conversation header on a phone: back button and name on one line, the actions on one
   small row, the labels on one line. More of the room goes to the messages. */
@media (max-width: 900px) {
  html #sms-tab .sms-conversation-head {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    column-gap: calc(10px * var(--ui-scale, 1));
    row-gap: calc(6px * var(--ui-scale, 1));
    padding: calc(8px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1)) !important;
    text-align: left;
  }
  html #sms-tab .sms-conversation-head .sms-conversation-content,
  html #sms-tab .sms-conversation-head .sms-contact-meta-actions { display: contents; }
  html #sms-tab .sms-conversation-head .mobile-sms-list-button {
    grid-column: 1; grid-row: 1;
    margin: 0 !important;
    min-height: calc(34px * var(--ui-scale, 1));
    padding: calc(4px * var(--ui-scale, 1)) calc(11px * var(--ui-scale, 1)) !important;
    font-size: calc(12.5px * var(--ui-scale, 1)) !important;
  }
  html #sms-tab .sms-conversation-head .conversation-kicker { display: none; }
  html #sms-tab .sms-conversation-head #current-sms-thread-name {
    grid-column: 2; grid-row: 1;
    margin: 0 !important;
    min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-size: calc(16px * var(--ui-scale, 1)) !important;
    text-align: left;
  }
  html #sms-tab .sms-conversation-head #sms-contact-actions {
    grid-column: 1 / -1; grid-row: 2;
    display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start;
    gap: calc(6px * var(--ui-scale, 1));
    width: 100% !important;
  }
  html #sms-tab .sms-conversation-head #sms-contact-actions.hidden { display: none; }
  html #sms-tab .sms-conversation-head #sms-contact-actions .button-contact-action {
    flex: 0 0 auto;
    min-height: calc(30px * var(--ui-scale, 1)) !important;
    padding: calc(4px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1)) !important;
    font-size: calc(12px * var(--ui-scale, 1)) !important;
  }
  html #sms-tab .sms-conversation-head #sms-delegate-wrap { flex: 1 1 100%; min-width: 0; width: 100%; }
  html #sms-tab .sms-conversation-head #sms-delegate-wrap.hidden { display: none; }
  html #sms-tab .sms-conversation-head #sms-agent-combo {
    width: 100% !important;
    min-height: calc(30px * var(--ui-scale, 1)) !important;
    padding: calc(4px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1)) !important;
    font-size: calc(12px * var(--ui-scale, 1)) !important;
  }
  html #sms-tab .sms-conversation-head .sms-zisson-result:empty { display: none; }
  html #sms-tab .sms-conversation-head .sms-zisson-result { grid-column: 1 / -1; grid-row: 3; margin: 0; }
  html #sms-tab .sms-conversation-head .sms-context-labels {
    grid-column: 1 / -1; grid-row: 4;
    margin: 0 !important;
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow: hidden;
    white-space: nowrap;
    font-size: calc(12px * var(--ui-scale, 1));
  }
}

/* Dark mode: an unread SMS row must not keep the light green background (it made the text unreadable). */
html[data-theme="dark"] .thread-item.unread-thread {
  background-color: #172b47 !important;
  border-left-color: var(--blue) !important;
}
html[data-theme="dark"] .thread-item.unread-thread:hover { background-color: #1d3558 !important; }

/* Equal 8px gaps between the Sentralbord, agent and Område cards. */
/* the menu column already adds a 3px gap, so 5px more makes 8px */
html #primary-sidebar .sidebar-sentralbord-footer { margin: 0 0 5px !important; padding: 0 !important; }
html #primary-sidebar .sidebar-top-controls { display: flex !important; flex-direction: column !important; gap: 8px !important; margin: 0 0 5px !important; }
html #primary-sidebar .sidebar-top-controls > #utility-agent-select,
html #primary-sidebar .sidebar-top-controls > #agent-controls-rail-section { margin: 0 !important; }
html #primary-sidebar .sidebar-top-controls > #agent-controls-rail-section { padding: 0 !important; }

/* Text centred in the Sentralbord, agent and Område cards. The icon sits on the left, so the right
   side gets the same width and the text lands in the middle of the card. */
html #primary-sidebar #sentralbord-card,
html #primary-sidebar #utility-agent-select .agent-identity { padding-right: 66px !important; }
html #primary-sidebar #sentralbord-card #central-number-display,
html #primary-sidebar #sentralbord-card #central-email-display,
html #primary-sidebar #utility-agent-select .active-agent-label,
html #primary-sidebar #utility-agent-select .active-agent-phone { text-align: center !important; width: 100%; justify-self: stretch; }
html #primary-sidebar #utility-agent-select .active-agent-info-wrap { flex: 1 1 auto; justify-items: center; text-align: center; }

/* Phone: the whole open menu scrolls with a finger, with room at the bottom above the browser bar. */
@media (max-width: 900px) {
  html #primary-sidebar.mobile-open {
    overflow-y: scroll !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    overscroll-behavior-y: contain;
    padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)) !important;
  }
  html #primary-sidebar.mobile-open > * { flex-shrink: 0 !important; }
  html #primary-sidebar.mobile-open #agents-list {
    flex: 0 0 auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }
}
html #primary-sidebar #utility-agent-select .active-agent-info-wrap .active-agent-phone { display: block; width: 100% !important; text-align: center !important; }

/* Phone menu: no Sentralbord card. The number and the e-mail are plain centred text between the
   logo and the four buttons (the header row dissolves so the three can be put in that order). */
@media (max-width: 900px) {
  html #primary-sidebar .brand-row { display: contents !important; }
  html #primary-sidebar .brand-row > .brand { order: -3; flex: 0 0 auto !important; align-self: flex-start; padding: 0 0 0 6px !important; }
  html #primary-sidebar #mobile-sentralbord-slot { order: -2; margin: 4px 0 8px !important; padding: 0 !important; }
  html #primary-sidebar .brand-row > .sidebar-header-actions { order: -1; flex: 0 0 auto !important; width: 100% !important; margin: 0 0 4px !important; }
  html #primary-sidebar #sentralbord-card {
    display: block !important;
    min-height: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    text-align: center;
  }
  html #primary-sidebar #sentralbord-card .service-card-heading { display: none !important; }
  html #primary-sidebar #sentralbord-card #central-number-display { display: block; font-size: 17px !important; font-weight: 800 !important; line-height: 1.2 !important; }
  html #primary-sidebar #sentralbord-card #central-email-display { display: block; margin-top: 2px !important; font-size: 13px !important; }
}

/* Phone: the number and the e-mail sit on the left, centred under the logo (not in the middle of the menu). */
@media (max-width: 900px) {
  html #primary-sidebar #mobile-sentralbord-slot {
    align-self: flex-start !important;
    width: 155px !important;
    margin-left: 6px !important;
  }
}

/* Samtaler (SMS) og E-post: etikettene i listene er ren tekst skilt av en
   tynn strek, uten ovalt omriss, sa kortene tar mindre plass. */
.thread-item .et-colorful-meta-row,
.et-card-badges-line.et-colorful-meta-row {
  gap: 0;
  row-gap: calc(2px * var(--ui-scale, 1));
  margin-top: calc(4px * var(--ui-scale, 1));
}
.thread-item .et-colorful-meta-row .et-meta-pill,
.et-card-badges-line.et-colorful-meta-row .et-meta-pill {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0 calc(8px * var(--ui-scale, 1));
  font-size: calc(11.5px * var(--ui-scale, 1));
  font-weight: 600;
  line-height: 1.25;
  color: var(--muted);
}
.thread-item .et-colorful-meta-row .et-meta-pill:first-child,
.et-card-badges-line.et-colorful-meta-row .et-meta-pill:first-child { padding-left: 0; }
.thread-item .et-colorful-meta-row .et-meta-pill + .et-meta-pill,
.et-card-badges-line.et-colorful-meta-row .et-meta-pill + .et-meta-pill {
  border-left: calc(1px * var(--ui-scale, 1)) solid var(--line);
}
.thread-item .et-colorful-meta-row .et-meta-pill.pill-status-open,
.et-card-badges-line.et-colorful-meta-row .et-meta-pill.pill-status-open { color: #2563eb; font-weight: 700; }
.thread-item .et-colorful-meta-row .et-meta-pill.pill-waiting.waiting-warning,
.et-card-badges-line.et-colorful-meta-row .et-meta-pill.pill-waiting.waiting-warning { color: #b45309; }
.thread-item .et-colorful-meta-row .et-meta-pill.pill-waiting.waiting-critical,
.et-card-badges-line.et-colorful-meta-row .et-meta-pill.pill-waiting.waiting-critical { color: #b91c1c; }
/* Kilde: MBN gront, Social bla/indigo, begge gul, sa man ser hvor meldingen kom fra. */
.thread-item .et-colorful-meta-row .et-meta-pill.pill-source-mbn,
.et-card-badges-line.et-colorful-meta-row .et-meta-pill.pill-source-mbn { color: #15803d; font-weight: 700; }
.thread-item .et-colorful-meta-row .et-meta-pill.pill-source-socialboards,
.et-card-badges-line.et-colorful-meta-row .et-meta-pill.pill-source-socialboards { color: #4f46e5; font-weight: 700; }
.thread-item .et-colorful-meta-row .et-meta-pill.pill-source-mixed { color: #b45309; font-weight: 700; }
/* Zisson (svar fra servicenummeret): cyan, både i listen og under boblen. */
.thread-item .et-colorful-meta-row .et-meta-pill.pill-source-zisson { color: #0e7490; font-weight: 700; }
html[data-theme="dark"] .thread-item .et-colorful-meta-row .et-meta-pill.pill-source-zisson { color: #67e8f9; }
html[data-theme="dark"] .thread-item .et-colorful-meta-row .et-meta-pill.pill-source-mbn,
html[data-theme="dark"] .et-card-badges-line.et-colorful-meta-row .et-meta-pill.pill-source-mbn { color: #4ade80; }
html[data-theme="dark"] .thread-item .et-colorful-meta-row .et-meta-pill.pill-source-socialboards,
html[data-theme="dark"] .et-card-badges-line.et-colorful-meta-row .et-meta-pill.pill-source-socialboards { color: #a5b4fc; }
html[data-theme="dark"] .thread-item .et-colorful-meta-row .et-meta-pill.pill-source-mixed { color: #fbbf24; }
.thread-item .et-colorful-meta-row .et-meta-pill.sms-depot-pill:hover { background: transparent; text-decoration: underline; }
.thread-item .et-colorful-meta-row .et-meta-pill.sms-depot-pill.is-active { background: transparent; color: #0369a1; text-decoration: underline; }
html[data-theme="dark"] .thread-item .et-colorful-meta-row .et-meta-pill.pill-status-open,
html[data-theme="dark"] .et-card-badges-line.et-colorful-meta-row .et-meta-pill.pill-status-open { color: #7aa7ff; }
html[data-theme="dark"] .thread-item .et-colorful-meta-row .et-meta-pill.pill-waiting.waiting-warning,
html[data-theme="dark"] .et-card-badges-line.et-colorful-meta-row .et-meta-pill.pill-waiting.waiting-warning { color: #fbbf24; }
html[data-theme="dark"] .thread-item .et-colorful-meta-row .et-meta-pill.pill-waiting.waiting-critical,
html[data-theme="dark"] .et-card-badges-line.et-colorful-meta-row .et-meta-pill.pill-waiting.waiting-critical { color: #f87171; }

/* Etikettene i listene er klikkbare filtre. */
.thread-item .et-colorful-meta-row .et-meta-pill[data-tag-kind],
.et-card-badges-line.et-colorful-meta-row .et-meta-pill[data-tag-kind] { cursor: pointer; }
.thread-item .et-colorful-meta-row .et-meta-pill[data-tag-kind]:hover,
.et-card-badges-line.et-colorful-meta-row .et-meta-pill[data-tag-kind]:hover { text-decoration: underline; text-underline-offset: 2px; }
.list-tag-filter { padding: calc(6px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1)) 0; }
.list-tag-filter-chip {
  font: inherit;
  font-size: calc(12px * var(--ui-scale, 1));
  font-weight: 600;
  color: var(--ink);
  background: transparent;
  border: calc(1px * var(--ui-scale, 1)) solid var(--line);
  border-radius: calc(8px * var(--ui-scale, 1));
  padding: calc(3px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
  cursor: pointer;
}
.list-tag-filter-chip:hover { border-color: var(--muted); }

/* Sentralbord: nummeret like stort som agentnavnet under, e-posten like stor som agentens nummer. */
html #primary-sidebar #sentralbord-card strong#central-number-display:not(.channel-off) {
  font-size: calc(15px * var(--ui-scale, 1)) !important;
  font-weight: 700 !important;
  line-height: 1.25 !important;
  color: #ffffff !important;
}
html #primary-sidebar #sentralbord-card p#central-email-display:not(.channel-off) {
  font-size: calc(13px * var(--ui-scale, 1)) !important;
  font-weight: 500 !important;
  line-height: 1.25 !important;
  color: rgba(255, 255, 255, .62) !important;
}

/* Zisson-fanen: to lys ved siden av hverandre, tilkobling til Zisson og pa linje. */
.zisson-status-pills { display: flex; flex-wrap: wrap; gap: calc(8px * var(--ui-scale, 1)); align-items: center; }

/* Område-kortet og tidtakeren: egen farge per tilstand, uavhengig av temaets aksent.
   Gront = pa linje og ledig, oransje = i samtale, gult = pause, lilla = mote,
   bla/indigo = etterarbeid, rodt = valgt linje men ikke pa linjen i Zisson, gra = frakoblet. */
html #queue-card-wrapper[data-state="available"] { --state-rgb: 34, 197, 94; }
html #queue-card-wrapper[data-state="in_call"],
html #queue-card-wrapper[data-state="ringing"],
html #queue-card-wrapper[data-state="dialing"] { --state-rgb: 249, 115, 22; }
html #queue-card-wrapper[data-state="paused"] { --state-rgb: 234, 179, 8; }
html #queue-card-wrapper[data-state="meeting"] { --state-rgb: 168, 85, 247; }
html #queue-card-wrapper[data-state="wrapup"] { --state-rgb: 99, 102, 241; }
html #queue-card-wrapper[data-state="mismatch"] { --state-rgb: 239, 68, 68; }
html #queue-card-wrapper[data-state="available"],
html #queue-card-wrapper[data-state="in_call"],
html #queue-card-wrapper[data-state="ringing"],
html #queue-card-wrapper[data-state="dialing"],
html #queue-card-wrapper[data-state="paused"],
html #queue-card-wrapper[data-state="meeting"],
html #queue-card-wrapper[data-state="wrapup"],
html #queue-card-wrapper[data-state="mismatch"] {
  background: linear-gradient(135deg, rgba(var(--state-rgb), .38), rgba(var(--state-rgb), .18)) !important;
  border-color: rgba(var(--state-rgb), .75) !important;
}
/* Kanten far samme farge; selektoren er sa spesifikk at sidemenyens egne kantregler ikke vinner. */
html #primary-sidebar #agent-controls-rail-section #queue-card-wrapper#queue-card-wrapper[data-state]:not([data-state="offline"]) {
  border-color: rgba(var(--state-rgb), .8) !important;
  box-shadow: 0 0 0 1px rgba(var(--state-rgb), .25) !important;
}

/* Anropshistorikk under hvert anrop i Samtaleaktivitet. */
.call-log-main .call-log-history {
  display: block;
  margin-top: calc(2px * var(--ui-scale, 1));
  font-size: calc(11.5px * var(--ui-scale, 1));
  line-height: 1.3;
  color: var(--muted);
  white-space: normal;
}
/* The outcome leads the line: who answered and how long, or "Ikke besvart" in red. */
.call-log-main .call-log-history .call-outcome { font-weight: 700; color: var(--ink, #111); }
.call-log-main .call-log-history .call-outcome.is-missed { color: var(--red, #d92d20); }
.call-log-main .call-log-history .call-outcome.is-ringing { color: var(--orange, #b5670f); }
.call-log-main .call-log-history .call-outcome.is-unknown { color: var(--muted, #667085); }

.zisson-lookup-depot { font-size: calc(11px * var(--ui-scale, 1)); font-weight: 700; padding: calc(1px * var(--ui-scale, 1)) calc(6px * var(--ui-scale, 1)); border-radius: calc(6px * var(--ui-scale, 1)); background: rgba(255, 255, 255, .14); }

/* Kopier-ikon etter ansattnummer, garasje og telefonnummer. */
.copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: calc(20px * var(--ui-scale, 1));
  height: calc(20px * var(--ui-scale, 1));
  margin: 0 calc(2px * var(--ui-scale, 1));
  padding: 0;
  vertical-align: middle;
  background: transparent;
  border: 0;
  border-radius: calc(6px * var(--ui-scale, 1));
  color: currentColor;
  opacity: .5;
  cursor: pointer;
  flex: 0 0 auto;
}
.copy-btn svg { width: calc(13px * var(--ui-scale, 1)); height: calc(13px * var(--ui-scale, 1)); }
.copy-btn:hover, .copy-btn:focus-visible { opacity: 1; background: rgba(127, 127, 127, .18); }
.copy-btn.copied { opacity: 1; color: #16a34a; }
.thread-item-top .sms-ansatt-inline { margin-right: calc(1px * var(--ui-scale, 1)); font: inherit; color: inherit; }
#current-sms-thread-name .conv-ansatt, #current-sms-thread-name .conv-name, #current-sms-thread-name .conv-phone { font: inherit; }
.global-call-context-chip .copy-btn { width: calc(16px * var(--ui-scale, 1)); height: calc(16px * var(--ui-scale, 1)); margin-left: calc(3px * var(--ui-scale, 1)); }
.global-call-summary .copy-btn { opacity: .65; }
.call-log-main strong .log-lead { display: inline !important; font: inherit; white-space: nowrap; }
.call-log-main strong { display: flex; align-items: center; flex-wrap: nowrap; gap: calc(2px * var(--ui-scale, 1)); min-width: 0; }
.call-log-main strong .copy-btn { margin-right: calc(4px * var(--ui-scale, 1)); }

/* Morkt tema: Samtaleaktivitet (valgt/hover/«Apen»-lag) og MBN-, Zisson- og Social-sidene. */
html[data-theme="dark"] .clickable-log:hover { background: #16263b !important; }
html[data-theme="dark"] .clickable-log.selected-log { background: #1b3050 !important; border-left-color: var(--rh-accent, #4cd09b) !important; }
html[data-theme="dark"] .log-action-overlay { background: rgba(14, 24, 40, .92) !important; }
html[data-theme="dark"] .log-open-btn-centered { background: var(--rh-accent, #4cd09b) !important; color: #0b1220 !important; box-shadow: none !important; }
html[data-theme="dark"] .log-open-btn-centered:hover { background: var(--rh-accent, #4cd09b) !important; filter: brightness(1.08); box-shadow: none !important; }

html[data-theme="dark"] .mbn-line { background: #111c2c; border-color: #29384b; }
html[data-theme="dark"] .mbn-line:hover { background: #16263b; border-color: #3a4b66; }
html[data-theme="dark"] .mbn-line.is-on { background: rgba(var(--rh-accent-rgb, 76, 208, 155), .14); border-color: rgba(var(--rh-accent-rgb, 76, 208, 155), .55); box-shadow: none; }
html[data-theme="dark"] .mbn-line input { background: #0b1220; border-color: #4a5b75; }
html[data-theme="dark"] .mbn-line-number { color: var(--ink, #e7edf7); }
html[data-theme="dark"] .mbn-line-meta { color: var(--muted, #9aa9bc); }
html[data-theme="dark"] .mbn-line.is-on .mbn-line-meta { color: var(--rh-accent, #4cd09b); }
html[data-theme="dark"] .mbn-line-badge,
html[data-theme="dark"] .mbn-count { background: #1b2a3f; color: #c9d5e6; }
html[data-theme="dark"] .mbn-line-icon { background: #1b2a3f; }
html[data-theme="dark"] .zisson-agent-row { background: #111c2c; border-color: #29384b; }
html[data-theme="dark"] .mbn-card input,
html[data-theme="dark"] .mbn-card select,
html[data-theme="dark"] .mbn-card textarea { background: #0b1220; border-color: #29384b; color: var(--ink, #e7edf7); }
html[data-theme="dark"] .mbn-link-status:hover { background: #16263b; border-color: #3a4b66; }

/* Samtalelinjen: stort navn og telefonnummer, tittelen som liten overskrift,
   brikkene under. Pa mobil stables navn og nummer. */
.global-call-summary > div { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: calc(3px * var(--ui-scale, 1)); }
.global-call-summary > div > strong {
  font-size: calc(11.5px * var(--ui-scale, 1));
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #9fd9c9;
}
.global-call-summary .global-call-who {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: calc(2px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1));
  min-width: 0;
}
.global-call-summary .global-call-who .gc-name {
  color: #ffffff;
  font-size: calc(21px * var(--ui-scale, 1));
  font-weight: 800;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.global-call-summary .global-call-who .gc-ansatt {
  color: #9fd9c9;
  font-size: calc(21px * var(--ui-scale, 1));
  font-weight: 800;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  margin-right: calc(-6px * var(--ui-scale, 1));
}
.global-call-summary .global-call-who .gc-phone {
  color: #d6e6e0;
  font-size: calc(17px * var(--ui-scale, 1));
  font-weight: 600;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.global-call-summary .global-call-who .copy-btn { width: calc(22px * var(--ui-scale, 1)); height: calc(22px * var(--ui-scale, 1)); }
.global-call-summary .global-call-who .copy-btn svg { width: calc(15px * var(--ui-scale, 1)); height: calc(15px * var(--ui-scale, 1)); }
.global-call-summary .global-call-context-chip { font-size: calc(12.5px * var(--ui-scale, 1)); padding: calc(3px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1)); }
.global-call-timer { font-size: calc(15px * var(--ui-scale, 1)) !important; align-self: center; }
@media (max-width: 900px) {
  .global-call-summary { flex-wrap: nowrap !important; align-items: flex-start; }
  .global-call-summary .global-call-pulse { margin-top: calc(4px * var(--ui-scale, 1)); flex: 0 0 auto; }
  .global-call-timer { margin-left: auto; align-self: flex-start !important; }
  .global-call-summary .global-call-who { flex-direction: column; align-items: flex-start; gap: calc(1px * var(--ui-scale, 1)); }
  .global-call-summary .global-call-who .gc-name { font-size: calc(19px * var(--ui-scale, 1)); }
  .global-call-summary .global-call-who .gc-phone { font-size: calc(16px * var(--ui-scale, 1)); }
}

/* Kollegalisten: hele raden far en svak, gjennomsiktig farge etter status, slik at
   teksten fortsatt er lett a lese. Klar = ingen farge (vanlig rad), Etterarbeid = bla/indigo,
   Pause = gul, Lunsj = rosa. */
html #primary-sidebar #agents-list .agent-mini[data-row-state="wrapup"] { background: rgba(129, 140, 248, .15) !important; }
html #primary-sidebar #agents-list .agent-mini[data-row-state="paused"] { background: rgba(234, 179, 8, .14) !important; }
html #primary-sidebar #agents-list .agent-mini[data-row-state="lunch"] { background: rgba(236, 72, 153, .15) !important; }
html #primary-sidebar #agents-list .agent-mini[data-row-state="wrapup"] { --agent-state-color: #a5b4fc; }
html #primary-sidebar #agents-list .agent-mini[data-row-state="paused"] { --agent-state-color: #facc15; }
html #primary-sidebar #agents-list .agent-mini[data-row-state="lunch"] { --agent-state-color: #f472b6; }

/* Oversikt: dagens samtaler til venstre, dagens meldinger til høyre og et søylediagram
   for arbeidsdagen (07:00-15:30, 10 min per søyle) imellom. */
.overview-pulse {
  display: grid;
  grid-template-columns: minmax(calc(170px * var(--ui-scale, 1)), 1fr) minmax(0, 3.2fr) minmax(calc(170px * var(--ui-scale, 1)), 1fr);
  gap: calc(14px * var(--ui-scale, 1));
  margin-bottom: calc(22px * var(--ui-scale, 1));
}
.pulse-stat, .pulse-chart {
  position: relative;
  background: var(--surface, #fff);
  border: calc(1px * var(--ui-scale, 1)) solid var(--line, #e7eaf0);
  border-radius: calc(20px * var(--ui-scale, 1));
  padding: calc(18px * var(--ui-scale, 1)) calc(22px * var(--ui-scale, 1));
  min-width: 0;
  overflow: hidden;
  box-shadow: 0 calc(1px * var(--ui-scale, 1)) calc(2px * var(--ui-scale, 1)) rgba(16, 24, 40, .04), 0 calc(8px * var(--ui-scale, 1)) calc(24px * var(--ui-scale, 1)) calc(-12px * var(--ui-scale, 1)) rgba(16, 24, 40, .12);
}
.pulse-stat::before { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .9; }
.pulse-stat-calls::before { background: radial-gradient(120% 90% at 0% 0%, rgba(16, 185, 129, .16), transparent 60%); }
.pulse-stat-msgs::before { background: radial-gradient(120% 90% at 100% 0%, rgba(99, 102, 241, .16), transparent 60%); }
.pulse-stat { display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: calc(2px * var(--ui-scale, 1)); }
.pulse-stat > * { position: relative; }
.pulse-stat-icon { display: grid; place-items: center; width: calc(34px * var(--ui-scale, 1)); height: calc(34px * var(--ui-scale, 1)); border-radius: calc(11px * var(--ui-scale, 1)); margin-bottom: calc(8px * var(--ui-scale, 1)); }
.pulse-stat-calls .pulse-stat-icon { color: #059669; background: rgba(16, 185, 129, .14); }
.pulse-stat-msgs .pulse-stat-icon { color: #4f46e5; background: rgba(99, 102, 241, .14); }
.pulse-stat-label { font-size: calc(12px * var(--ui-scale, 1)); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted, #667085); }
.pulse-stat strong { font-size: calc(46px * var(--ui-scale, 1)); line-height: 1.02; font-weight: 800; letter-spacing: -.03em; color: var(--ink, #182230); font-variant-numeric: tabular-nums; }
.pulse-stat small { font-size: calc(12.5px * var(--ui-scale, 1)); color: var(--muted, #667085); }
.pulse-chart { display: flex; flex-direction: column; gap: calc(10px * var(--ui-scale, 1)); }
.pulse-chart-head { display: flex; justify-content: space-between; align-items: center; gap: calc(10px * var(--ui-scale, 1)); font-size: calc(12.5px * var(--ui-scale, 1)); color: var(--muted, #667085); font-weight: 600; }
.pulse-caption { color: var(--ink, #182230); font-weight: 700; }
.pulse-legend { display: inline-flex; align-items: center; gap: calc(6px * var(--ui-scale, 1)); }
.pulse-legend i { width: calc(9px * var(--ui-scale, 1)); height: calc(9px * var(--ui-scale, 1)); border-radius: 50%; display: inline-block; }
.pulse-legend .dot-calls { background: linear-gradient(180deg, #34d399, #059669); }
.pulse-legend .dot-msgs { background: linear-gradient(180deg, #a5b4fc, #6366f1); margin-left: calc(10px * var(--ui-scale, 1)); }
.pulse-plot { flex: 1; display: flex; flex-direction: column; gap: calc(6px * var(--ui-scale, 1)); min-height: 0; }
.pulse-bars {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(var(--pulse-count, 51), minmax(0, 1fr));
  align-items: end;
  gap: calc(3px * var(--ui-scale, 1));
  min-height: calc(96px * var(--ui-scale, 1));
  background-image: linear-gradient(to top, transparent calc(100% - 1px), var(--line, #e7eaf0) 0);
  background-size: 100% 33.333%;
  background-repeat: repeat-y;
  background-position: bottom;
}
.pulse-bar { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; position: relative; border-radius: calc(6px * var(--ui-scale, 1)); transition: background .15s; }
.pulse-bar::after { content: ''; position: absolute; left: 15%; right: 15%; bottom: 0; height: calc(3px * var(--ui-scale, 1)); border-radius: calc(3px * var(--ui-scale, 1)); background: var(--line, #e2e8f0); opacity: .9; }
.pulse-bar:not(.is-empty)::after { display: none; }
.pulse-bar i { display: block; width: 100%; transition: height .5s cubic-bezier(.22, 1, .36, 1); }
.pulse-seg-calls { background: linear-gradient(180deg, #34d399, #059669); border-radius: calc(5px * var(--ui-scale, 1)) calc(5px * var(--ui-scale, 1)) calc(2px * var(--ui-scale, 1)) calc(2px * var(--ui-scale, 1)); }
.pulse-seg-msgs { background: linear-gradient(180deg, #a5b4fc, #6366f1); border-radius: calc(5px * var(--ui-scale, 1)) calc(5px * var(--ui-scale, 1)) 0 0; margin-bottom: calc(1px * var(--ui-scale, 1)); }
.pulse-bar.is-future { opacity: .35; }
.pulse-bar.is-now::before { content: ''; position: absolute; top: 0; bottom: calc(-6px * var(--ui-scale, 1)); left: 50%; width: calc(2px * var(--ui-scale, 1)); transform: translateX(-50%); border-radius: 2px; background: #f43f5e; opacity: .85; }
.pulse-bar.is-peak .pulse-seg-calls, .pulse-bar.is-peak .pulse-seg-msgs { filter: saturate(1.25) brightness(1.04); }
.pulse-bar:hover { background: rgba(99, 102, 241, .1); }
.pulse-axis { position: relative; height: calc(14px * var(--ui-scale, 1)); font-size: calc(11px * var(--ui-scale, 1)); color: var(--muted, #667085); font-variant-numeric: tabular-nums; }
.pulse-axis span { position: absolute; top: 0; transform: translateX(-2px); }
html[data-theme="dark"] .pulse-stat, html[data-theme="dark"] .pulse-chart { background: #111c2c; border-color: #29384b; box-shadow: none; }
html[data-theme="dark"] .pulse-stat-calls .pulse-stat-icon { color: #4ade80; background: rgba(74, 222, 128, .14); }
html[data-theme="dark"] .pulse-stat-msgs .pulse-stat-icon { color: #a5b4fc; background: rgba(129, 140, 248, .16); }
html[data-theme="dark"] .pulse-bars { background-image: linear-gradient(to top, transparent calc(100% - 1px), #243349 0); }
html[data-theme="dark"] .pulse-bar::after { background: #243349; }
@media (max-width: 900px) {
  #dashboard-tab .overview-pulse { display: grid !important; grid-template-columns: 1fr 1fr; gap: calc(8px * var(--ui-scale, 1)); margin-bottom: calc(10px * var(--ui-scale, 1)); }
  .pulse-chart { grid-column: 1 / -1; grid-row: 2; padding: calc(12px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1)); }
  .pulse-bars { min-height: calc(64px * var(--ui-scale, 1)); gap: calc(1.5px * var(--ui-scale, 1)); }
  .pulse-stat { padding: calc(12px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1)); }
  .pulse-stat-icon { width: calc(28px * var(--ui-scale, 1)); height: calc(28px * var(--ui-scale, 1)); margin-bottom: calc(4px * var(--ui-scale, 1)); }
  .pulse-stat strong { font-size: calc(34px * var(--ui-scale, 1)); }
}

/* Mobil: bare diagrammet (tallene star i tegnforklaringen), og en smal topp pa Samtaleaktivitet. */
.pulse-legend-n { display: none; }
@media (max-width: 900px) {
  #dashboard-tab .overview-pulse { grid-template-columns: 1fr; margin-bottom: calc(8px * var(--ui-scale, 1)); }
  #dashboard-tab .overview-pulse .pulse-stat { display: none; }
  #dashboard-tab .overview-pulse .pulse-chart { grid-column: 1; grid-row: 1; }
  .pulse-legend-n { display: inline; margin: 0 calc(2px * var(--ui-scale, 1)) 0 calc(4px * var(--ui-scale, 1)); font-size: calc(15px * var(--ui-scale, 1)); font-weight: 800; color: var(--ink, #182230); font-variant-numeric: tabular-nums; }
  html[data-theme="dark"] .pulse-legend-n { color: #e7edf7; }
  .pulse-legend { font-size: calc(13px * var(--ui-scale, 1)); }
  #dashboard-tab .activity-heading { gap: calc(6px * var(--ui-scale, 1)) !important; padding: calc(10px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)) calc(6px * var(--ui-scale, 1)) !important; margin: 0 !important; align-items: center; }
  #dashboard-tab .activity-heading > div:first-child { flex: 1 1 auto; min-width: 0; }
  #dashboard-tab .activity-heading h2 { font-size: calc(16px * var(--ui-scale, 1)) !important; margin: 0 !important; }
  #dashboard-tab .activity-heading p { display: none !important; }
  #dashboard-tab .activity-heading .live-chip { padding: calc(2px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1)); font-size: calc(11px * var(--ui-scale, 1)); }
  #dashboard-tab .activity-filter-bar { flex: 1 1 100%; display: flex; flex-wrap: nowrap; gap: calc(6px * var(--ui-scale, 1)); margin: 0 !important; }
  #dashboard-tab .activity-filter-bar .activity-filter-btn { min-height: calc(30px * var(--ui-scale, 1)); padding: calc(4px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1)); font-size: calc(12px * var(--ui-scale, 1)); white-space: nowrap; }
  #dashboard-tab .activity-log-search { flex: 1 1 auto; min-width: 0; min-height: calc(30px * var(--ui-scale, 1)); }
  #dashboard-tab .activity-log-search input { min-height: 0; padding-top: calc(4px * var(--ui-scale, 1)); padding-bottom: calc(4px * var(--ui-scale, 1)); font-size: calc(12.5px * var(--ui-scale, 1)); }
}
@media (max-width: 900px) {
  #dashboard-tab .activity-heading { flex-wrap: wrap !important; row-gap: calc(6px * var(--ui-scale, 1)) !important; }
  #dashboard-tab .activity-heading > div:first-child { flex: 1 1 0 !important; }
  #dashboard-tab .activity-heading .activity-filter-bar { display: flex !important; flex: 1 1 100% !important; flex-wrap: nowrap !important; align-items: center; gap: calc(6px * var(--ui-scale, 1)) !important; width: 100%; }
  #dashboard-tab .activity-filter-bar .activity-filter-btn { flex: 0 0 auto; min-height: calc(30px * var(--ui-scale, 1)) !important; padding: calc(3px * var(--ui-scale, 1)) calc(9px * var(--ui-scale, 1)) !important; font-size: calc(12px * var(--ui-scale, 1)) !important; }
  #dashboard-tab .activity-filter-bar .activity-log-search { flex: 1 1 0 !important; min-width: calc(70px * var(--ui-scale, 1)); width: auto !important; margin: 0 !important; min-height: calc(30px * var(--ui-scale, 1)) !important; padding: 0 calc(8px * var(--ui-scale, 1)) !important; }
  #dashboard-tab .activity-filter-bar .activity-log-search input { min-width: 0; width: 100%; }
}
@media (max-width: 900px) {
  #dashboard-tab .activity-filter-bar .activity-filter-btn { width: auto !important; max-width: none !important; flex: 0 0 auto !important; }
}

.admin-agents-banner { margin: 0 0 calc(12px * var(--ui-scale, 1)); padding: calc(12px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1)); border-radius: calc(12px * var(--ui-scale, 1)); font-weight: 700; color: #065f46; background: #d1fae5; border: calc(1px * var(--ui-scale, 1)) solid #6ee7b7; }
.admin-agents-banner[hidden] { display: none; }
html[data-theme="dark"] .admin-agents-banner { color: #a7f3d0; background: rgba(16, 185, 129, .16); border-color: rgba(52, 211, 153, .5); }

/* Vis passord: oyeknapp inne i alle passordfelt. */
.pw-field { position: relative; display: inline-flex; align-items: center; max-width: 100%; }
.pw-field.pw-field-block { display: flex; width: 100%; }
.pw-field > input { flex: 1 1 auto; min-width: 0; padding-right: calc(40px * var(--ui-scale, 1)) !important; }
.pw-toggle {
  position: absolute; right: calc(6px * var(--ui-scale, 1)); top: 50%; transform: translateY(-50%);
  display: grid; place-items: center; width: calc(30px * var(--ui-scale, 1)); height: calc(30px * var(--ui-scale, 1));
  padding: 0; border: 0; border-radius: calc(8px * var(--ui-scale, 1)); background: transparent; color: #64748b; cursor: pointer;
}
.pw-toggle:hover, .pw-toggle:focus-visible { color: #0f172a; background: rgba(100, 116, 139, .16); }
.pw-toggle[aria-pressed="true"] { color: #0d9f6e; }
html[data-theme="dark"] .pw-toggle { color: #9aa9bc; }
html[data-theme="dark"] .pw-toggle:hover, html[data-theme="dark"] .pw-toggle:focus-visible { color: #e7edf7; background: rgba(148, 163, 184, .2); }

/* Mobil: Samtaleaktivitet og filterknappene pa samme rad, sokefeltet under over hele bredden. */
@media (max-width: 900px) {
  #dashboard-tab .activity-heading { display: flex !important; flex-wrap: wrap !important; align-items: center; gap: calc(6px * var(--ui-scale, 1)) calc(6px * var(--ui-scale, 1)) !important; }
  #dashboard-tab .activity-heading > div:first-child { flex: 0 0 auto !important; min-width: 0; margin-right: calc(2px * var(--ui-scale, 1)); }
  #dashboard-tab .activity-heading h2 { font-size: calc(15px * var(--ui-scale, 1)) !important; white-space: nowrap; }
  #dashboard-tab .activity-heading .live-chip { display: none !important; }
  #dashboard-tab .activity-heading .activity-filter-bar { display: contents !important; }
  #dashboard-tab .activity-heading .activity-filter-btn { order: 1; flex: 1 1 0 !important; min-width: 0; width: auto !important; padding: calc(3px * var(--ui-scale, 1)) calc(6px * var(--ui-scale, 1)) !important; font-size: calc(11.5px * var(--ui-scale, 1)) !important; white-space: nowrap; justify-content: center; }
  #dashboard-tab .activity-heading .activity-log-search { order: 2 !important; flex: 1 1 100% !important; width: 100% !important; min-width: 100% !important; }
}
@media (max-width: 900px) {
  #dashboard-tab .activity-heading > div:first-child { width: auto !important; max-width: none !important; flex: 0 0 auto !important; }
}

/* Type-filter (Alle aktiviteter / Anrop / SMS / E-post): bare pa mobil, i stedet for tittelen. */
.activity-type-bar { display: none; }
@media (max-width: 900px) {
  #dashboard-tab .activity-heading > div:first-child { display: none !important; }
  #dashboard-tab .activity-heading .activity-filter-btn:not(.activity-agent-btn) { display: none !important; }
  #dashboard-tab .activity-heading .activity-type-bar { display: flex; order: 0; flex: 1 1 100%; gap: calc(6px * var(--ui-scale, 1)); width: 100%; }
  #dashboard-tab .activity-heading .activity-filter-bar { display: flex !important; flex: 1 1 100% !important; order: 1 !important; flex-wrap: nowrap !important; align-items: center; gap: calc(6px * var(--ui-scale, 1)) !important; width: 100%; }
  #dashboard-tab .activity-heading .activity-agent-dropdown-wrap { flex: 0 0 auto !important; order: 1 !important; }
  #dashboard-tab .activity-heading .activity-log-search { flex: 1 1 0 !important; order: 2 !important; width: auto !important; min-width: calc(100px * var(--ui-scale, 1)) !important; }
  .activity-type-btn { flex: 1 1 0; min-width: 0; min-height: calc(32px * var(--ui-scale, 1)); padding: calc(3px * var(--ui-scale, 1)) calc(4px * var(--ui-scale, 1)); border-radius: calc(12px * var(--ui-scale, 1)); border: calc(1px * var(--ui-scale, 1)) solid var(--line, #e7eaf0); background: transparent; color: var(--ink, #182230); font: 700 calc(11.5px * var(--ui-scale, 1)) var(--font); white-space: nowrap; cursor: pointer; }
  .activity-type-btn.active { background: var(--blue-soft, #e8f3ef); border-color: var(--blue, #0d6b5c); color: var(--blue, #0d6b5c); }
  html[data-theme="dark"] .activity-type-btn { border-color: #29384b; color: #c9d5e6; }
  html[data-theme="dark"] .activity-type-btn.active { background: rgba(var(--rh-accent-rgb, 76, 208, 155), .16); border-color: var(--rh-accent, #4cd09b); color: var(--rh-accent, #4cd09b); }
}
@media (max-width: 900px) {
  .activity-type-btn[data-activity-type="all"] { flex: 0 0 auto; padding-left: calc(18px * var(--ui-scale, 1)); padding-right: calc(18px * var(--ui-scale, 1)); }
  .activity-type-btn:not([data-activity-type="all"]) { padding-left: calc(2px * var(--ui-scale, 1)); padding-right: calc(2px * var(--ui-scale, 1)); }
}

/* Pilene i diagrammet: forrige / neste dag. */
.pulse-nav { display: inline-flex; align-items: center; gap: calc(6px * var(--ui-scale, 1)); min-width: 0; }
.pulse-arrow { display: grid; place-items: center; flex: 0 0 auto; width: calc(28px * var(--ui-scale, 1)); height: calc(28px * var(--ui-scale, 1)); padding: 0; border-radius: calc(9px * var(--ui-scale, 1)); border: calc(1px * var(--ui-scale, 1)) solid var(--line, #e7eaf0); background: transparent; color: var(--ink, #182230); cursor: pointer; }
.pulse-arrow:hover:not(:disabled) { background: rgba(99, 102, 241, .12); border-color: rgba(99, 102, 241, .4); }
.pulse-arrow:disabled { opacity: .3; cursor: default; }
.pulse-caption { white-space: nowrap; }
html[data-theme="dark"] .pulse-arrow { border-color: #29384b; color: #c9d5e6; }
@media (max-width: 900px) {
  .pulse-chart-head { flex-wrap: wrap; row-gap: calc(4px * var(--ui-scale, 1)); }
  .pulse-nav { flex: 1 1 100%; justify-content: space-between; }
  .pulse-nav .pulse-caption { flex: 1 1 auto; text-align: center; }
  .pulse-legend { flex: 1 1 100%; justify-content: center; }
}

/* Mindre luft mellom diagrammet og Samtaleaktivitet. */
@media (min-width: 901px) {
  #dashboard-tab .overview-pulse { margin-bottom: 0; }
}

/* Desktop: samme fire typeknapper som pa mobil i stedet for tittelen; Agent-filter og sok ligger pa samme rad. */
@media (min-width: 901px) {
  #dashboard-tab .activity-heading { display: flex !important; flex-wrap: nowrap !important; align-items: center; gap: calc(10px * var(--ui-scale, 1)) !important; }
  #dashboard-tab .activity-heading > div:first-child { display: none !important; }
  #dashboard-tab .activity-heading .activity-type-bar { display: flex; flex: 0 0 auto; gap: calc(8px * var(--ui-scale, 1)); order: 0; }
  #dashboard-tab .activity-heading .activity-filter-bar { display: contents !important; }
  #dashboard-tab .activity-heading .activity-filter-btn[data-activity-call-filter] { display: none !important; }
  #dashboard-tab .activity-heading .activity-agent-dropdown-wrap { order: 1; flex: 0 0 auto; }
  #dashboard-tab .activity-heading .activity-log-search { order: 2; flex: 1 1 auto; min-width: 0; max-width: none; }
  #dashboard-tab .activity-heading .live-chip { order: 3; margin-left: auto; }
  .activity-type-btn { min-height: calc(36px * var(--ui-scale, 1)); padding: calc(4px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1)); border-radius: 999px; border: calc(1px * var(--ui-scale, 1)) solid var(--line, #e7eaf0); background: transparent; color: var(--ink, #182230); font: 700 calc(13px * var(--ui-scale, 1)) var(--font); white-space: nowrap; cursor: pointer; }
  .activity-type-btn:hover { background: rgba(99, 102, 241, .08); }
  .activity-type-btn.active { background: var(--blue-soft, #e8f3ef); border-color: var(--blue, #0d6b5c); color: var(--blue, #0d6b5c); }
  html[data-theme="dark"] .activity-type-btn { border-color: #29384b; color: #c9d5e6; }
  html[data-theme="dark"] .activity-type-btn.active { background: rgba(var(--rh-accent-rgb, 76, 208, 155), .16); border-color: var(--rh-accent, #4cd09b); color: var(--rh-accent, #4cd09b); }
}

/* Utvid-knappen oppe til hoyre i e-posten: bare e-posten og svarfeltet (kun desktop). */
.email-focus-button { display: none; }
@media (min-width: 901px) {
  #email-tab .et-case-header { position: relative; }
  .email-focus-button {
    display: grid; place-items: center; position: absolute; top: calc(10px * var(--ui-scale, 1)); right: calc(12px * var(--ui-scale, 1)); z-index: 3;
    width: calc(34px * var(--ui-scale, 1)); height: calc(34px * var(--ui-scale, 1)); padding: 0;
    border-radius: calc(10px * var(--ui-scale, 1)); border: calc(1px * var(--ui-scale, 1)) solid var(--line, #e7eaf0);
    background: var(--surface, #fff); color: var(--ink, #182230); cursor: pointer;
  }
  .email-focus-button:hover { background: rgba(99, 102, 241, .1); border-color: rgba(99, 102, 241, .4); }
  .email-focus-button .icon-collapse { display: none; }
  .email-focus-button.active .icon-expand { display: none; }
  .email-focus-button.active .icon-collapse { display: block; }
  #email-tab .et-case-header-main { padding-right: calc(46px * var(--ui-scale, 1)); }
  html[data-theme="dark"] .email-focus-button { background: #111c2c; border-color: #29384b; color: #c9d5e6; }

  #email-tab.email-focus-mode .email-page-heading,
  #email-tab.email-focus-mode .et-vertical-nav-rail,
  #email-tab.email-focus-mode .et-queue-panel,
  #email-tab.email-focus-mode #email-inspector-panel { display: none !important; }
  #email-tab.email-focus-mode .et-workspace-layout,
  #email-tab.email-focus-mode .et-workspace-layout:has(#email-inspector-panel.hidden) { grid-template-columns: minmax(0, 1fr) !important; }
  #email-tab.email-focus-mode { height: 100%; min-height: 0; }
}

/* Maler (og Signatur): bred meny som viser hele teksten i hver mal, med rulling ved behov. */
.template-menu,
#email-tab .template-menu,
#email-tab #email-template-menu,
#email-tab #email-signature-menu,
#sms-tab #sms-template-menu {
  width: min(calc(640px * var(--ui-scale, 1)), calc(100vw - calc(24px * var(--ui-scale, 1)))) !important;
  max-height: min(calc(560px * var(--ui-scale, 1)), 70vh) !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
}
.template-menu .template-insert-button small {
  overflow: visible;
  text-overflow: clip;
  white-space: pre-line;
  line-height: 1.45;
  margin-top: calc(4px * var(--ui-scale, 1));
}
.template-menu .template-insert-button strong { font-size: calc(13px * var(--ui-scale, 1)); }
.template-menu .template-menu-item { border-bottom: calc(1px * var(--ui-scale, 1)) solid var(--line, #eef0f3); }
.template-menu .template-menu-item:last-child { border-bottom: 0; }

/* Emoji-velger: rutenett med store knapper (minst 40 px), som ruller inne i menyen på telefon. */
.template-menu.emoji-picker {
  width: min(calc(340px * var(--ui-scale, 1)), calc(100vw - calc(24px * var(--ui-scale, 1)))) !important;
  max-height: min(calc(360px * var(--ui-scale, 1)), 60vh) !important;
  padding: calc(8px * var(--ui-scale, 1));
}
.emoji-picker-section + .emoji-picker-section { margin-top: calc(6px * var(--ui-scale, 1)); }
.emoji-picker-title {
  margin: 0 0 calc(4px * var(--ui-scale, 1));
  padding: 0 calc(4px * var(--ui-scale, 1));
  color: #667085;
  font: 700 calc(12px * var(--ui-scale, 1)) / 1.2 var(--font);
}
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(calc(40px * var(--ui-scale, 1)), 1fr));
  gap: calc(2px * var(--ui-scale, 1));
}
.emoji-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  border: 0;
  border-radius: calc(10px * var(--ui-scale, 1));
  background: transparent;
  font-size: calc(22px * var(--ui-scale, 1));
  line-height: 1;
  cursor: pointer;
}
.emoji-option:hover,
.emoji-option:focus-visible { background: #f2f4f7; outline: none; }
.emoji-trigger svg {
  width: calc(18px * var(--ui-scale, 1));
  height: calc(18px * var(--ui-scale, 1));
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Signatureditor: lim inn en signatur med logo. */
.signature-editor-field { display: grid; gap: calc(6px * var(--ui-scale, 1)); }
.signature-editor-label { font-weight: 700; font-size: calc(13px * var(--ui-scale, 1)); }
.signature-editor { min-height: calc(150px * var(--ui-scale, 1)); max-height: calc(320px * var(--ui-scale, 1)); overflow: auto; padding: calc(12px * var(--ui-scale, 1)); border: calc(1px * var(--ui-scale, 1)) solid var(--line, #e7eaf0); border-radius: calc(12px * var(--ui-scale, 1)); background: var(--surface, #fff); color: var(--ink, #182230); outline: none; }
.signature-editor:focus { border-color: var(--blue, #0d6b5c); box-shadow: 0 0 0 calc(3px * var(--ui-scale, 1)) rgba(13, 107, 92, .15); }
.signature-editor:empty::before { content: attr(data-placeholder); color: var(--muted, #667085); }
.signature-editor img, .sig-rich img { max-width: 100%; height: auto; }
.signature-editor-tools { display: flex; flex-wrap: wrap; align-items: center; gap: calc(10px * var(--ui-scale, 1)); }
.signature-editor-tools small { flex: 1 1 220px; color: var(--muted, #667085); line-height: 1.4; }
.signature-image-button { cursor: pointer; }
html[data-theme="dark"] .signature-editor { background: #0b1220; border-color: #29384b; }

/* Kontaktkort-knapp i SMS og E-post (vises bare nar avsenderen finnes i kontaktregisteret). */
.contactcard-btn { display: inline-flex; align-items: center; gap: calc(6px * var(--ui-scale, 1)); white-space: nowrap; }
.contactcard-btn.hidden { display: none !important; }
.contactcard-btn svg { flex: 0 0 auto; }
@media (max-width: 900px) {
  .contactcard-btn { padding-left: calc(10px * var(--ui-scale, 1)); padding-right: calc(10px * var(--ui-scale, 1)); }
}
@media (max-width: 900px) {
  /* E-post pa mobil: handlingsknappene i to kolonner i stedet for en knapp per rad. */
  #email-tab #ticket-controls:not(.hidden) { display: grid !important; grid-template-columns: 1fr 1fr; gap: calc(8px * var(--ui-scale, 1)); align-items: stretch; }
  #email-tab #ticket-controls > .ticket-control-group { grid-column: 1 / -1; min-width: 0; }
  #email-tab #ticket-controls > .et-case-quick-btn { width: 100%; margin: 0; justify-content: center; }
  #email-tab #ticket-controls > .email-more-wrap { grid-column: 1 / -1; }
  #email-tab #ticket-controls > .email-more-wrap .email-more-button { width: 100%; }
}
@media (max-width: 900px) {
  #email-tab #ticket-controls:not(.hidden) { grid-template-columns: 1fr 1fr !important; }
  #email-tab #ticket-controls:not(.hidden) > .et-case-quick-btn { grid-column: auto !important; width: 100% !important; }
  #email-tab #ticket-controls:not(.hidden) > .ticket-control-group,
  #email-tab #ticket-controls:not(.hidden) > .email-more-wrap { grid-column: 1 / -1 !important; }
}

/* E-post composer: the editor scrolls instead of pushing Send off screen. A long
   signature (logo) made the composer taller than the window on laptops. */
#email-tab .et-composer-v2 .email-rich-editor { max-height: min(170px, 22vh) !important; }
#email-tab .et-composer-v2.composer-expanded .email-rich-editor { max-height: min(60vh, calc(100vh - 380px)) !important; }
#email-tab .et-composer-v2 .email-rich-editor img { max-width: 100%; height: auto; }
#email-tab .et-composer-v2 .et-composer-footer { position: sticky; bottom: 0; z-index: 2; }

/* "Forkast": throw the draft away from the composer. */
#email-tab .et-composer-v2 .et-discard-btn {
  display: inline-flex !important; align-items: center !important; gap: 6px !important;
  height: 38px !important; padding: 0 12px !important;
  border: 1px solid var(--c-line) !important; border-radius: 10px !important;
  background: #fff !important; color: #b42318 !important;
  font: 600 13px var(--font) !important; white-space: nowrap; cursor: pointer;
}
#email-tab .et-composer-v2 .et-discard-btn[hidden] { display: none !important; }
#email-tab .et-composer-v2 .et-discard-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#email-tab .et-composer-v2 .et-discard-btn:hover { border-color: #f04438 !important; background: #fef3f2 !important; }
html[data-theme="dark"] #email-tab .et-composer-v2 .et-discard-btn { background: transparent !important; color: #f97066 !important; }

/* Signature editor: click an image to resize it. */
.signature-editor img.is-selected { outline: 2px solid var(--blue, #2563eb); outline-offset: 2px; cursor: pointer; }
.signature-editor img { cursor: pointer; }
.signature-image-size { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0; font-size: 13px; }
.signature-image-size[hidden] { display: none; }
.signature-image-size span { margin-right: 4px; }

/* Reply draft: which conversation it answers. */
.et-draft-source { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 4px 0 10px; padding: 8px 12px; border-radius: 10px; background: #f5f0ff; color: #5b3a9a; font-size: 13px; }
.et-draft-source strong { color: #2d1b55; }
.et-draft-source-open { margin-left: auto; border: 1px solid #d9ccf5; background: #fff; color: #5b3a9a; border-radius: 8px; padding: 4px 10px; font: 600 12px var(--font); cursor: pointer; }
html[data-theme="dark"] .et-draft-source { background: #272142; color: #c4b5fd; }
html[data-theme="dark"] .et-draft-source strong { color: #ede9fe; }

/* "Utvid" (email-focus-mode): a compact header so more of the e-mail shows.
   Ta sak / Ring / SMS / Kontaktkort move into the ••• menu; the editor is lower. */
.email-more-menu .email-more-focus-only { display: none !important; }
@media (min-width: 901px) {
  #email-tab.email-focus-mode .ticket-controls:not(.draft-controls) .email-more-menu .email-more-focus-only:not([hidden]) { display: flex !important; }
  #email-tab.email-focus-mode .ticket-controls:not(.draft-controls) .email-more-menu span.email-more-focus-only { display: block !important; }
  #email-tab.email-focus-mode .et-case-header { padding-top: 6px !important; padding-bottom: 6px !important; min-height: 0 !important; }
  #email-tab.email-focus-mode .et-case-subject-row { display: flex !important; flex-direction: row !important; flex-wrap: nowrap !important; align-items: center !important; gap: 12px !important; }
  #email-tab.email-focus-mode .et-case-title-block { flex: 1 1 auto !important; min-width: 0 !important; }
  #email-tab.email-focus-mode #current-email-thread-name { font-size: 16px !important; line-height: 1.3 !important; margin: 0 !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #email-tab.email-focus-mode .et-case-sender-sub { font-size: 12px !important; margin: 2px 0 0 !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #email-tab.email-focus-mode #current-email-colorful-badges { display: none !important; }
  #email-tab.email-focus-mode .et-case-controls-row { flex: 0 0 auto !important; width: auto !important; margin: 0 !important; }
  #email-tab.email-focus-mode .ticket-controls { flex-wrap: nowrap !important; gap: 6px !important; align-items: center !important; }
  #email-tab.email-focus-mode .ticket-control-label { display: none !important; }
  #email-tab.email-focus-mode .ticket-select { height: 32px !important; min-height: 32px !important; }
  #email-tab.email-focus-mode .ticket-agent-combo { width: 170px !important; }
  #email-tab.email-focus-mode .et-case-quick-btn { display: none !important; }
  #email-tab.email-focus-mode .et-composer-v2 .email-rich-editor { min-height: 64px !important; max-height: min(170px, 22vh) !important; }
  #email-tab.email-focus-mode .et-composer-v2 .et-composer-mode-bar { padding: 5px 10px !important; }
  #email-tab.email-focus-mode .et-composer-v2 .et-quick-reply-bar { padding-top: 4px !important; padding-bottom: 4px !important; }
}

/* Global search: "Søk i Zisson" under an unknown number. */
.live-search-zisson { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line, #e2e8f0); font-size: 12.5px; }
.direct-call-search-card { flex-wrap: wrap; }

/* Lokasjon (garasje) i SMS-listen: egen farge så den er lett å se. */
.thread-item .et-colorful-meta-row .et-meta-pill.sms-depot-pill { color: #7c3aed; font-weight: 700; }
.thread-item .et-colorful-meta-row .et-meta-pill.sms-depot-pill.is-active { color: #5b21b6; }
html[data-theme="dark"] .thread-item .et-colorful-meta-row .et-meta-pill.sms-depot-pill { color: #c4b5fd; }
html[data-theme="dark"] .thread-item .et-colorful-meta-row .et-meta-pill.sms-depot-pill.is-active { color: #ddd6fe; }

/* Lokasjon i åpen SMS-samtale: samme farge som i listen. */
#current-sms-garaj.pill-depot { color: #7c3aed !important; font-weight: 700; }
html[data-theme="dark"] #current-sms-garaj.pill-depot { color: #c4b5fd !important; }
/* Hurtigsvar kan dras for å endre rekkefølge. */
.et-quick-chip[draggable="true"] { cursor: grab; }
.et-quick-chip.is-dragging { opacity: .45; }
.et-quick-chip.drop-before { box-shadow: -3px 0 0 #7c3aed; }

/* Reaksjonsbilde fra Outlook (👍 osv.) i e-post: emoji-størrelse. */
.email-body-html img.email-emoji-image { width: 1.6em; height: 1.6em; vertical-align: middle; }

/* Ring en kollega direkte fra listen over tilkoblede agenter. */
.colleague-call-btn { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; margin-right: 5px; padding: 0; border: 0; border-radius: 50%; background: rgba(21, 128, 61, .12); color: #15803d; cursor: pointer; vertical-align: -4px; }
.colleague-call-btn svg { width: 12px; height: 12px; fill: currentColor; }
.colleague-call-btn:hover, .colleague-call-btn:focus-visible { background: #15803d; color: #fff; }
html[data-theme="dark"] .colleague-call-btn { background: rgba(74, 222, 128, .15); color: #4ade80; }
.live-search-more { padding: calc(8px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)); font-size: calc(12px * var(--ui-scale, 1)); color: var(--muted, #64748b); text-align: center; }

/* Ansattnummer foran navnet i e-post, som i Meldinger. */
.et-card-customer .sms-ansatt-inline, .et-sender-group-header .sms-ansatt-inline, .et-msg-header-inline .sms-ansatt-inline, .et-case-sender-sub .sms-ansatt-inline { margin-right: calc(3px * var(--ui-scale, 1)); vertical-align: baseline; }

/* Meldingshodet i E-post: én ryddig linje – [ansatt ⧉] Navn · <adresse ⧉> · [Mottatt e-post] – og tiden til høyre.
   Reglene over (.email-message-card-head span { display: block }) gjorde hvert element til en egen linje. */
.email-message-card.et-single-email-doc .email-message-card-head { align-items: center; }
.email-message-card-head .et-msg-header-inline { display: flex; flex-wrap: wrap; align-items: center; gap: calc(4px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1)); }
.email-message-card-head .et-msg-header-inline > span,
.email-message-card-head .et-msg-header-inline > strong { display: inline-flex; align-items: center; margin-top: 0; }
.email-message-card-head .et-msg-who { gap: calc(4px * var(--ui-scale, 1)); flex: 0 0 auto; }
.email-message-card-head .et-msg-who strong { font-size: calc(14px * var(--ui-scale, 1)); }
.email-message-card-head .et-msg-who .sms-ansatt-inline { display: inline-flex; margin: 0; }
.email-message-card-head .et-doc-sender-addr { gap: calc(3px * var(--ui-scale, 1)); color: var(--muted); }
.email-message-card-head .et-msg-role-tag { margin-left: auto; }
.email-message-card-head .copy-btn { display: inline-flex; margin: 0; }
@media (max-width: 700px) { .email-message-card-head .et-msg-role-tag { margin-left: 0; } }
.customer-form .form-grid .form-grid-full { grid-column: 1 / -1; }

/* SMS-skrivefeltet er en stor tekstboks på skrivebord (Enter sender, Skift+Enter ny linje). */
.sms-composer textarea {
  border: 0; outline: 0; background: transparent; font: inherit; color: var(--ink);
  width: 100%; resize: vertical; line-height: 1.45;
  font-size: calc(13.5px * var(--ui-scale, 1));
  min-height: calc(42px * var(--ui-scale, 1));
  padding: calc(8px * var(--ui-scale, 1)) calc(4px * var(--ui-scale, 1));
}
@media (min-width: 901px) {
  #sms-tab .sms-composer { flex-wrap: wrap; align-items: stretch; row-gap: calc(8px * var(--ui-scale, 1)); padding: calc(10px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)); }
  #sms-tab .sms-composer textarea {
    order: -1; flex: 1 1 100%;
    min-height: calc(110px * var(--ui-scale, 1)); max-height: calc(260px * var(--ui-scale, 1));
    font-size: calc(15px * var(--ui-scale, 1));
    padding: calc(4px * var(--ui-scale, 1));
  }
  #sms-tab .sms-composer .template-picker, #sms-tab .sms-composer .send-action-wrap, #sms-tab .sms-composer #btn-close-sms, #sms-tab .sms-composer #btn-sms-emoji { align-self: center; }
  #sms-tab .sms-composer .send-action-wrap { margin-left: auto; order: 3; }
  #sms-tab .sms-composer #btn-close-sms, #sms-tab .sms-composer #btn-sms-emoji { order: 2; }
  #sms-tab .sms-composer .template-picker { order: 1; }
}

/* "+" ved e-postfeltet i kontaktskjemaet: ekstra adresser som egne felt. */
.customer-form .email-add-row { display: flex; align-items: center; gap: calc(6px * var(--ui-scale, 1)); }
.customer-form .email-add-row input { flex: 1 1 auto; min-width: 0; }
.customer-form .email-add-btn, .customer-form .extra-email-remove { flex: 0 0 auto; width: calc(32px * var(--ui-scale, 1)); height: calc(32px * var(--ui-scale, 1)); border: calc(1px * var(--ui-scale, 1)) solid #d0d5dd; border-radius: calc(10px * var(--ui-scale, 1)); background: #fff; color: #475467; font: 700 calc(18px * var(--ui-scale, 1)) / 1 var(--font); cursor: pointer; }
.customer-form .email-add-btn:hover { background: var(--blue-soft); color: var(--blue); border-color: var(--blue); }
.customer-form .extra-email-remove:hover { background: #fee2e2; color: #b91c1c; border-color: #fca5a5; }
.customer-form .extra-emails-list { display: grid; gap: calc(8px * var(--ui-scale, 1)); }
.customer-form .extra-emails-list:empty { display: none; }
.customer-form .extra-email-row { display: flex; align-items: center; gap: calc(6px * var(--ui-scale, 1)); }
.customer-form .extra-email-row input { flex: 1 1 auto; min-width: 0; }

/* Besvarte anrop-målerne vises bare i temaer som ber om den (Krem). */
.pulse-gauge { display: none; }

/* Klar / Etterarb. / Pause / Logg ut: four equal tiles, icon above the word.
   The current status is the accent tile. */
html #agent-controls-rail-section #queue-agent-actions.agent-state-actions {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px !important;
  margin-top: 8px !important;
  padding: 0 !important;
}
html #agent-controls-rail-section #queue-agent-actions .pause-control-container { width: 100% !important; min-width: 0 !important; }
html #agent-controls-rail-section #queue-agent-actions .state-btn {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 5px !important;
  width: 100% !important;
  height: 56px !important;
  min-height: 56px !important;
  padding: 8px 2px !important;
  border-radius: 14px !important;
  border: 1px solid rgba(255, 255, 255, .09) !important;
  background: linear-gradient(180deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .03)) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06) !important;
  color: rgba(255, 255, 255, .72) !important;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .1s ease !important;
}
html #agent-controls-rail-section #queue-agent-actions .state-btn svg {
  width: 17px !important;
  height: 17px !important;
  stroke: currentColor !important;
  fill: none !important;
  opacity: .9;
}
html #agent-controls-rail-section #queue-agent-actions .state-btn span {
  font: 600 10.5px/1 var(--font) !important;
  letter-spacing: .01em !important;
  color: inherit !important;
  white-space: nowrap !important;
}
html #agent-controls-rail-section #queue-agent-actions .state-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, rgba(var(--rh-accent-rgb), .26), rgba(var(--rh-accent-rgb), .12)) !important;
  border-color: rgba(var(--rh-accent-rgb), .5) !important;
  color: #fff !important;
  transform: translateY(-1px) !important;
}
html #agent-controls-rail-section #queue-agent-actions .state-btn.is-current {
  background: var(--rh-accent) !important;
  border-color: var(--rh-accent) !important;
  color: #0b1220 !important;
  box-shadow: 0 6px 16px rgba(var(--rh-accent-rgb), .28) !important;
}
html #agent-controls-rail-section #queue-agent-actions .state-btn:disabled,
html #agent-controls-rail-section #queue-agent-actions .state-btn.disabled-gray {
  opacity: .45 !important;
}

/* Samtaler counter: grey like the counter in the menu, not the theme's accent. */
html #sms-thread-total.count-pill,
html[data-theme="dark"] #sms-thread-total.count-pill {
  background: rgba(255, 255, 255, .12) !important;
  color: #e5e7eb !important;
  border: 0 !important;
  border-radius: 999px !important;
  font-weight: 700 !important;
}
html:not([data-theme="dark"]) #sms-thread-total.count-pill {
  background: #ececea !important;
  color: #3f3f46 !important;
}

/* ---- Statistikk: calmer rings and a chart whose line sits on the bars ---- */
/* Rings: thinner so the text in the middle has room (radii 84/68/52 in app.js). */
.statistics-concentric-svg .concentric-track,
.statistics-concentric-svg .concentric-arc { stroke-width: 8; }
.statistics-main-concentric-banner { grid-template-columns: calc(136px * var(--ui-scale, 1)) minmax(0, 1fr); }
.statistics-main-concentric-banner .statistics-concentric-visual {
  width: calc(128px * var(--ui-scale, 1));
  height: calc(128px * var(--ui-scale, 1));
}
.statistics-main-concentric-banner .statistics-concentric-center strong { font-size: calc(16px * var(--ui-scale, 1)); }
.statistics-main-concentric-banner .statistics-concentric-center small {
  font-size: calc(8px * var(--ui-scale, 1));
  letter-spacing: 0.02em;
}

/* Volum over tid: the svg and the dot layer cover exactly the bar wells
   (18px value row + 4px gap on top, 20px label row + 4px gap below). */
#statistics-timeline .statistics-detail-plot-area { min-height: calc(300px * var(--ui-scale, 1)); }
#statistics-timeline .statistics-detail-bars-grid { min-height: calc(290px * var(--ui-scale, 1)); }
#statistics-timeline .statistics-detail-trend-svg {
  inset: calc(22px * var(--ui-scale, 1)) 0 calc(24px * var(--ui-scale, 1)) 0;
  height: calc(100% - calc(46px * var(--ui-scale, 1)));
}
#statistics-timeline .trend-dots {
  position: absolute;
  inset: calc(22px * var(--ui-scale, 1)) 0 calc(24px * var(--ui-scale, 1)) 0;
  pointer-events: none;
  z-index: 3;
}
#statistics-timeline .trend-dot-html {
  position: absolute;
  width: calc(9px * var(--ui-scale, 1));
  height: calc(9px * var(--ui-scale, 1));
  margin: calc(-4.5px * var(--ui-scale, 1)) 0 0 calc(-4.5px * var(--ui-scale, 1));
  border-radius: 50%;
  background: var(--surface, #fff);
  border: calc(2px * var(--ui-scale, 1)) solid var(--stats-calls);
  opacity: 0;
  transform: scale(0.2);
  transition:
    opacity 0.36s ease var(--dot-delay, 180ms),
    transform 0.42s cubic-bezier(0.34, 1.56, 0.64, 1) var(--dot-delay, 180ms);
}
.is-animated #statistics-timeline .trend-dot-html,
#statistics-timeline.is-animated .trend-dot-html,
.statistics-detail-page.is-animated #statistics-timeline .trend-dot-html { opacity: 1; transform: scale(1); }
#statistics-timeline .statistics-detail-y-axis { padding: calc(22px * var(--ui-scale, 1)) 0 calc(24px * var(--ui-scale, 1)); }
#statistics-timeline .statistics-detail-y-axis span { line-height: 0; }

/* Hour labels are wider than a bar column: centre them and let them overflow
   instead of cutting them off ("00:0"). */
#statistics-timeline .detail-bar-lbl {
  display: flex;
  justify-content: center;
  overflow: visible;
}
/* The tooltip opens inside the plot (it used to open above it and was cut off by
   the card), and leans away from the nearest edge. */
#statistics-timeline .detail-bar-tooltip { bottom: auto; top: calc(26px * var(--ui-scale, 1)); }
#statistics-timeline .statistics-detail-bar-col.tip-left .detail-bar-tooltip { left: 0; transform: translate(0, 6px) scale(0.95); }
#statistics-timeline .statistics-detail-bar-col.tip-right .detail-bar-tooltip { left: auto; right: 0; transform: translate(0, 6px) scale(0.95); }
#statistics-timeline .statistics-detail-bar-col.tip-left:hover .detail-bar-tooltip,
#statistics-timeline .statistics-detail-bar-col.tip-left:focus-visible .detail-bar-tooltip,
#statistics-timeline .statistics-detail-bar-col.tip-right:hover .detail-bar-tooltip,
#statistics-timeline .statistics-detail-bar-col.tip-right:focus-visible .detail-bar-tooltip { transform: translate(0, 0) scale(1); }

/* Theme picker: the Lavendel swatch lived only in lavendel.css, so with any other
   theme selected its icon came out white. It is defined here, with the others. */
.theme-swatch--lavendel i:nth-child(1) { background: #1c1c1c; }
.theme-swatch--lavendel i:nth-child(2) { background: #b05c84; }
.theme-swatch--lavendel i:nth-child(3) { background: #f4f4f6; box-shadow: inset 0 0 0 1px #e4e4e8; }
.theme-swatch--lime i:nth-child(1) { background: #141414; }
.theme-swatch--lime i:nth-child(2) { background: #5fd04a; }
.theme-swatch--lime i:nth-child(3) { background: #ffffff; box-shadow: inset 0 0 0 1px #e4e4e8; }

/* Search results (desktop): wide enough that a contact fits on one line (name,
   Ansatt badge, depot, phone and e-mail) next to the four action buttons. */
@media (min-width: 901px) {
  .live-search-overlay { width: min(calc(1040px * var(--ui-scale, 1)), 96vw); }
  .live-search-card-main strong,
  .live-search-card-main p { white-space: nowrap; }
  .live-search-card-main p { overflow: hidden; text-overflow: ellipsis; }
  .live-search-card .search-card-actions { flex: 0 0 auto; }
}

/* Back to the newest entry in the activity list: a small playful bubble in the
   theme's primary colour, centred at the top of the list, shown after scrolling. */
.activity-card { position: relative; }
.scroll-top-button {
  position: absolute;
  left: 50%;
  top: calc(120px * var(--ui-scale, 1));
  transform: translateX(-50%);
  width: calc(34px * var(--ui-scale, 1));
  height: calc(34px * var(--ui-scale, 1));
  border: calc(2px * var(--ui-scale, 1)) solid rgba(255, 255, 255, .9);
  border-radius: 50%;
  background: #111;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 calc(5px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1)) rgba(0, 0, 0, .22);
  z-index: 5;
  padding: 0;
  animation: scroll-top-pop .35s cubic-bezier(.34, 1.56, .64, 1) both;
  transition: transform .18s cubic-bezier(.34, 1.56, .64, 1), box-shadow .18s ease;
}
.scroll-top-button[hidden] { display: none; }
.scroll-top-button svg {
  width: 52%;
  height: 52%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  animation: scroll-top-bob 1.6s ease-in-out infinite;
}
.scroll-top-button:hover { transform: translateX(-50%) scale(1.14) rotate(-6deg); box-shadow: 0 calc(8px * var(--ui-scale, 1)) calc(18px * var(--ui-scale, 1)) rgba(0, 0, 0, .28); }
.scroll-top-button:active { transform: translateX(-50%) scale(.92); }
@keyframes scroll-top-pop { from { opacity: 0; transform: translateX(-50%) translateY(-10px) scale(.4); } to { opacity: 1; transform: translateX(-50%) scale(1); } }
@keyframes scroll-top-bob { 0%, 100% { transform: translateY(1px); } 50% { transform: translateY(-2px); } }
@media (prefers-reduced-motion: reduce) { .scroll-top-button, .scroll-top-button svg { animation: none; } }

/* MBN pill warning state and queue-left badge (SMS watch errors live in Systemstatus, not in Meldinger). */
.mbn-link-status[data-state="warning"] .mbn-link-dot { background: #d97706; box-shadow: 0 0 0 calc(3px * var(--ui-scale, 1)) rgba(217, 119, 6, 0.22); }
.pill-gone-queue { background: rgba(217, 119, 6, 0.14); color: var(--ink); border: calc(1px * var(--ui-scale, 1)) solid rgba(217, 119, 6, 0.45); }

/* Phone: the worker pills shrink so the search box between them is wide enough to tap. */
@media (max-width: 700px) {
  html .topbar .topbar-actions .mbn-link-status.mbn-link-status--compact {
    height: 26px !important;
    min-height: 26px !important;
    min-width: 0 !important;
    padding: 0 6px !important;
    gap: 3px !important;
  }
  html .topbar .topbar-actions .mbn-link-status--compact .mbn-link-label {
    font-size: 10.5px !important;
    letter-spacing: 0 !important;
  }
  html .topbar .topbar-actions .mbn-link-status--compact .mbn-link-dot {
    width: 7px !important;
    height: 7px !important;
    box-shadow: none !important;
  }
  html .topbar .topbar-actions { gap: 3px !important; }
  html .topbar .topbar-actions #btn-logout {
    width: 26px !important;
    min-width: 26px !important;
    height: 26px !important;
    min-height: 26px !important;
  }
  html .topbar .topbar-actions #btn-logout svg { width: 14px !important; height: 14px !important; }
}

/* Agentadministrasjon: deactivate, the history list, and the deactivated look. */
.ra-agent-toggle { min-height: calc(32px * var(--ui-scale, 1)); padding: 0 calc(12px * var(--ui-scale, 1)); font-size: calc(12.5px * var(--ui-scale, 1)); }
.ra-status-chip.is-deactivated { background: rgba(100, 116, 139, 0.16); color: #475467; }
.agent-history-card { max-width: calc(560px * var(--ui-scale, 1)); width: 100%; }
.agent-history-list { display: grid; gap: calc(8px * var(--ui-scale, 1)); max-height: 60vh; overflow-y: auto; }
.agent-history-row { display: grid; gap: calc(2px * var(--ui-scale, 1)); padding: calc(10px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)); border: calc(1px * var(--ui-scale, 1)) solid var(--line, #e7eaf0); border-radius: calc(12px * var(--ui-scale, 1)); }
.agent-history-row span { color: var(--muted, #667085); font-size: calc(12.5px * var(--ui-scale, 1)); }
.agent-history-row[data-action="DELETED"] strong { color: #b42318; }

/* A search field's own form adds no box: the layout stays as it was. */
form.search-isolation { display: contents; }

/* A caller who is not in the contact register. */
.unknown-number-card { max-width: calc(440px * var(--ui-scale, 1)); width: 100%; }
.unknown-number-phone { font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.unknown-number-actions { display: flex; flex-wrap: wrap; gap: calc(8px * var(--ui-scale, 1)); margin: calc(14px * var(--ui-scale, 1)) 0; }
.unknown-number-actions .button { flex: 1 1 calc(120px * var(--ui-scale, 1)); }
.unknown-number-history-title { margin: calc(6px * var(--ui-scale, 1)) 0; font-size: calc(12px * var(--ui-scale, 1)); font-weight: 700; color: var(--muted, #667085); }
.unknown-number-history { display: grid; gap: calc(6px * var(--ui-scale, 1)); font-size: calc(13px * var(--ui-scale, 1)); }
.unknown-number-history-row { padding: calc(8px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1)); border: calc(1px * var(--ui-scale, 1)) solid var(--line, #e7eaf0); border-radius: calc(10px * var(--ui-scale, 1)); }

/* Search box above the SMS conversations (Meldinger), and the matching text a
   search shows under a conversation or a case. */
.sms-search-bar { padding: calc(8px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)); border-bottom: 1px solid var(--line); }
.sms-search-bar .et-queue-search { width: 100%; }
.thread-item p.search-snippet, .live-search-card-main p.search-snippet { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* === Mobile conversation (phone, portrait) ===
   An open SMS or e-mail takes the whole screen: the top bar, the page title and
   the filters step aside, so only that conversation is read and answered. The
   live-call panel (#active-call-control-host) stays. Landscape keeps the page
   scroll it has (no .mobile-scroll-locked there), and desktop is not touched. */
@media (max-width: 900px) {
  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open),
  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) {
    --rh-convo-pad: 12px;
  }

  /* --- The frame steps aside --- */
  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) .topbar,
  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) .topbar,
  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) #sms-tab .sms-page-heading {
    display: none !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) .app-shell,
  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) .app-shell {
    padding: 0 !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) .main-content,
  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) .main-content {
    padding: env(safe-area-inset-top, 0px) 0 0 !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) .content-scroll,
  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) .content-scroll {
    padding: 0 !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) #sms-tab .inbox-layout,
  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #email-tab .email-inbox-layout {
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) #sms-tab .conversation-panel,
  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #email-tab .et-case-panel {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    overflow: hidden !important;
  }

  /* --- SMS: header. Back, name and labels on the left, actions under. --- */
  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) #sms-tab .sms-conversation-head {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) !important;
    align-items: center !important;
    column-gap: 6px !important;
    row-gap: 6px !important;
    flex: 0 0 auto !important;
    padding: 6px var(--rh-convo-pad) 8px 4px !important;
    margin: 0 !important;
    border-bottom: 1px solid var(--line) !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) #sms-tab :is(.sms-conversation-content, .sms-contact-meta-actions) {
    display: contents !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) #sms-tab .conversation-kicker {
    display: none !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) #btn-mobile-sms-list,
  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #btn-mobile-email-list {
    grid-column: 1 !important;
    grid-row: 1 / span 2 !important;
    align-self: center !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 40px !important;
    min-width: 40px !important;
    height: 40px !important;
    min-height: 40px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 999px !important;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--ink) !important;
    font-size: 0 !important;
    line-height: 1 !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) #btn-mobile-sms-list::before,
  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #btn-mobile-email-list::before {
    content: "";
    width: 11px;
    height: 11px;
    margin-left: 5px;
    border-left: 2.5px solid currentColor;
    border-bottom: 2.5px solid currentColor;
    border-radius: 1px;
    transform: rotate(45deg);
  }

  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) #current-sms-thread-name {
    grid-column: 2 !important;
    grid-row: 1 !important;
    align-self: end !important;
    margin: 0 !important;
    font-size: 17px !important;
    line-height: 1.25 !important;
    font-weight: 700 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) #sms-tab .sms-context-labels {
    grid-column: 2 !important;
    grid-row: 2 !important;
    align-self: start !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 0 !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    white-space: nowrap !important;
    font-size: 12.5px !important;
    line-height: 1.3 !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) #sms-tab .sms-context-labels > * {
    flex: 0 0 auto !important;
    font-size: 12.5px !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) #sms-contact-actions,
  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) #sms-zisson-result {
    grid-column: 1 / -1 !important;
    grid-row: 3 !important;
    margin: 0 !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) #sms-zisson-result {
    grid-row: 4 !important;
    padding-left: 8px !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) #sms-zisson-result:empty {
    display: none !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) #sms-contact-actions:not(.hidden) {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    padding-left: 8px !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) #sms-contact-actions > .button,
  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #ticket-controls > .button,
  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #ticket-controls .email-more-button {
    flex: 0 0 auto !important;
    width: auto !important;
    height: 34px !important;
    min-height: 34px !important;
    margin: 0 !important;
    padding: 0 12px !important;
    font-size: 13px !important;
    white-space: nowrap !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) #sms-contact-actions > .hidden,
  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #ticket-controls > .hidden {
    display: none !important;
  }

  /* --- Messages: all the height that is left --- */
  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) #sms-chat-history,
  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #email-chat-history {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    max-height: none !important;
    height: auto !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    padding: 12px var(--rh-convo-pad) !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) #sms-chat-history .message-row > div {
    max-width: 86% !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) #sms-chat-history .message-bubble {
    font-size: 15.5px !important;
    line-height: 1.45 !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) #sms-chat-history .message-meta {
    font-size: 11.5px !important;
  }

  /* --- Quick replies: one line that scrolls sideways --- */
  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) #sms-quick-reply-bar,
  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #et-quick-reply-bar {
    display: flex !important;
    flex: 0 0 auto !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 6px !important;
    margin: 0 !important;
    padding: 6px var(--rh-convo-pad) !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scrollbar-width: none !important;
    -webkit-overflow-scrolling: touch;
  }

  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) #sms-quick-reply-bar:empty {
    display: none !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) #sms-quick-reply-bar::-webkit-scrollbar,
  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #et-quick-reply-bar::-webkit-scrollbar {
    display: none;
  }

  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) #sms-quick-reply-bar .et-quick-reply-label,
  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #et-quick-reply-bar .et-quick-reply-label {
    display: none !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) #sms-quick-reply-bar .et-quick-chip,
  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #et-quick-reply-bar .et-quick-chip {
    flex: 0 0 auto !important;
    height: 32px !important;
    min-height: 32px !important;
    margin: 0 !important;
    padding: 0 12px !important;
    font-size: 13px !important;
    white-space: nowrap !important;
  }

  /* --- SMS composer: tools on one line, the text field and Send under --- */
  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) #sms-tab .sms-composer {
    display: grid !important;
    grid-template-columns: auto auto auto minmax(0, 1fr) auto !important;
    grid-template-rows: auto auto !important;
    align-items: center !important;
    gap: 8px 6px !important;
    flex: 0 0 auto !important;
    width: auto !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 8px var(--rh-convo-pad) calc(8px + env(safe-area-inset-bottom, 0px)) !important;
    border: 0 !important;
    border-top: 1px solid var(--line) !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) #sms-tab .sms-composer-actions {
    display: contents !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) #sms-tab .sms-composer .composer-height-resizer {
    display: none !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) #sms-tab .sms-composer .template-picker { grid-column: 1 !important; grid-row: 1 !important; margin: 0 !important; }
  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) #btn-sms-emoji { grid-column: 2 !important; grid-row: 1 !important; }
  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) #sms-channel-toggle { grid-column: 3 !important; grid-row: 1 !important; }
  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) #btn-close-sms { grid-column: 5 !important; grid-row: 1 !important; }
  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) #sms-text-input { grid-column: 1 / 5 !important; grid-row: 2 !important; }
  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) #sms-send-action { grid-column: 5 !important; grid-row: 2 !important; align-self: end !important; margin: 0 !important; }

  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) :is(#btn-sms-templates, #btn-sms-emoji, #btn-close-sms) {
    width: auto !important;
    min-width: 34px !important;
    height: 34px !important;
    min-height: 34px !important;
    margin: 0 !important;
    padding: 0 12px !important;
    font-size: 13px !important;
    white-space: nowrap !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) #btn-sms-emoji {
    width: 34px !important;
    padding: 0 !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) #sms-channel-toggle {
    display: inline-flex !important;
    width: auto !important;
    height: 34px !important;
    margin: 0 !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) #sms-channel-toggle .sms-channel-btn {
    flex: 0 0 auto !important;
    width: auto !important;
    height: 100% !important;
    padding: 0 11px !important;
    font-size: 12.5px !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) #sms-text-input {
    width: 100% !important;
    min-height: 44px !important;
    max-height: 30vh !important;
    height: auto;
    margin: 0 !important;
    padding: 11px 14px !important;
    border: 1px solid var(--line) !important;
    border-radius: 22px !important;
    font-size: 16px !important;
    line-height: 1.35 !important;
    resize: none !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) #btn-send-sms {
    width: auto !important;
    height: 44px !important;
    min-height: 44px !important;
    padding: 0 16px !important;
    border-radius: 22px !important;
    font-size: 14px !important;
  }

  /* While typing, the action buttons step aside so more of the conversation shows. */
  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open):has(#sms-text-input:focus) #sms-contact-actions {
    display: none !important;
  }

  /* --- E-post: header. Back, subject and sender, then the case controls. --- */
  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #email-tab .et-case-header {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) !important;
    align-items: center !important;
    column-gap: 6px !important;
    row-gap: 8px !important;
    flex: 0 0 auto !important;
    margin: 0 !important;
    padding: 6px var(--rh-convo-pad) 8px 4px !important;
    border: 0 !important;
    border-bottom: 1px solid var(--line) !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #email-tab :is(.et-mobile-case-bar, .email-heading-content, .et-case-subject-row) {
    display: contents !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #btn-email-focus,
  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #email-tab .et-case-top-meta {
    display: none !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #email-tab .et-case-title-block {
    grid-column: 2 !important;
    grid-row: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #current-email-thread-name {
    margin: 0 !important;
    font-size: 17px !important;
    line-height: 1.25 !important;
    font-weight: 700 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #current-email-sender-sub {
    margin: 0 !important;
    font-size: 13px !important;
    line-height: 1.3 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #current-email-colorful-badges:not(.hidden) {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 10px !important;
    margin: 2px 0 0 !important;
    overflow: hidden !important;
    white-space: nowrap !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #current-email-colorful-badges > * {
    flex: 0 0 auto !important;
    font-size: 12.5px !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #email-tab .et-case-controls-row {
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
    display: block !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 0 0 8px !important;
    border: 0 !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #ticket-controls:not(.hidden) {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 6px !important;
    width: 100% !important;
    margin: 0 !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #ticket-controls .ticket-control-group {
    display: flex !important;
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 0 !important;
    margin: 0 !important;
  }

  /* Status and Ansvarlig share the first line, the buttons go on the next. */
  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #ticket-controls .ticket-control-group:has(.ticket-agent-combo) {
    flex: 1 1 calc(100% - 140px) !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #ticket-controls :is(.ticket-agent-combo, #ticket-agent-combo, .search-isolation) {
    min-width: 0 !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #ticket-controls .ticket-control-label {
    display: none !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #ticket-controls .ticket-agent-combo {
    width: 100% !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #ticket-controls :is(#ticket-status-select, #ticket-agent-combo) {
    height: 36px !important;
    min-height: 36px !important;
    margin: 0 !important;
    font-size: 16px !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #ticket-controls #ticket-status-select {
    width: auto !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #ticket-controls #ticket-agent-combo {
    width: 100% !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #btn-mobile-email-list {
    grid-row: 1 !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #ticket-controls .email-more-wrap {
    flex: 0 0 auto !important;
    margin: 0 !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #ticket-controls .email-more-button {
    padding: 0 10px !important;
  }

  /* --- E-post: the messages read as plain mail, full width --- */
  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #email-chat-history {
    padding: 10px !important;
    gap: 10px !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #email-chat-history .email-message-card {
    flex: 0 0 auto !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #email-chat-history:not(.email-forward-selecting) .email-message-select {
    display: none !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #email-chat-history .email-message-card-head {
    gap: 8px !important;
    padding: 8px 12px !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #email-chat-history .email-message-card-head time {
    flex: 0 0 auto !important;
    font-size: 12px !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #email-chat-history .et-msg-header-inline {
    min-width: 0 !important;
    gap: 2px 8px !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #email-chat-history .email-body-html {
    font-size: 15.5px !important;
    line-height: 1.5 !important;
    overflow-wrap: anywhere;
  }

  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #email-chat-history .email-body-html :is(img, table) {
    max-width: 100% !important;
    height: auto !important;
  }

  /* --- E-post composer: a compact dock under the messages --- */
  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #email-tab .et-composer-dock {
    flex: 0 0 auto !important;
    max-height: 62% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-top: 1px solid var(--line) !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    overflow-y: auto !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #email-tab .et-composer-v2 {
    overflow: visible !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 8px var(--rh-convo-pad) calc(8px + env(safe-area-inset-bottom, 0px)) !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #email-tab .et-composer-v2 .composer-height-resizer,
  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) :is(#btn-toggle-email-composer, #btn-toggle-email-wide) {
    display: none !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #email-tab .et-composer-mode-bar {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 6px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #email-tab .et-composer-head-tools {
    display: flex !important;
    gap: 6px !important;
    margin: 0 !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #email-tab :is(.et-mode-tab, .et-head-tool) {
    height: 32px !important;
    min-height: 32px !important;
    padding: 0 11px !important;
    font-size: 13px !important;
    white-space: nowrap !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #email-tab .et-recipient-drawer:not(.hidden) {
    margin: 0 !important;
    padding: 0 !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #email-tab .et-recipient-drawer input {
    font-size: 16px !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #et-quick-reply-bar {
    width: auto !important;
    max-width: none !important;
    align-self: stretch !important;
    margin: 0 calc(-1 * var(--rh-convo-pad)) !important;
    padding: 0 var(--rh-convo-pad) !important;
  }

  /* Ctrl+Enter means nothing on a phone. */
  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #email-text-input:empty::before {
    content: "Skriv et svar til kunden…" !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #email-text-input {
    flex: 0 0 auto !important;
    height: auto !important;
    min-height: 44px !important;
    max-height: 28vh !important;
    margin: 0 !important;
    padding: 11px 14px !important;
    overflow-y: auto !important;
    border: 1px solid var(--line) !important;
    border-radius: 18px !important;
    font-size: 16px !important;
    line-height: 1.4 !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #email-tab .et-composer-footer {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 6px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #email-tab .et-composer-footer .email-compose-tools {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 0 !important;
    min-width: 0 !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #email-tab .et-composer-footer .et-foot-tool {
    width: 36px !important;
    min-width: 36px !important;
    height: 36px !important;
    padding: 0 !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #email-tab .et-composer-footer .email-compose-submit {
    display: flex !important;
    flex: 0 0 auto !important;
    gap: 6px !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #btn-close-email {
    height: 40px !important;
    min-height: 40px !important;
    min-width: 80px !important;
    padding: 0 12px !important;
    font-size: 14px !important;
  }

  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open) #btn-send-email {
    height: 40px !important;
    min-height: 40px !important;
    min-width: 80px !important;
    padding: 0 12px !important;
    border-radius: 20px !important;
    font-size: 14px !important;
  }

  /* While writing, the case controls step aside so the mail stays readable. */
  html:has(.content-scroll.mobile-scroll-locked #email-tab.active .email-inbox-layout.mobile-email-thread-open):has(#email-tab .et-composer-v2 :focus) #email-tab .et-case-controls-row {
    display: none !important;
  }
}

/* === RelayHub motion layer. Appended. Durations and easings live in the tokens below. === */
:root{
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --dur-press: 80ms; --dur-fast: 120ms; --dur-base: 220ms; --dur-slow: 320ms;
  --dur-roll: 250ms; --dur-shake: 300ms; --dur-draw: 350ms; --dur-highlight: 1s; --dur-spin: 700ms;
  --stagger: 35ms; --stagger-menu: 20ms;
  --rh-success: #22C55E; --rh-success-ink: #15803D; --rh-success-soft: rgba(34,197,94,.12);
  --rh-danger: #EF4444;
  --rh-radius-card: calc(22px * var(--ui-scale,1)); --rh-radius-inner: calc(12px * var(--ui-scale,1)); --rh-radius-pill: 9999px;
  --rh-border: #E7E7EC; --rh-shadow-float: 0 calc(4px * var(--ui-scale,1)) calc(20px * var(--ui-scale,1)) rgba(0,0,0,.05);
}
html[data-theme="dark"]{
  --rh-success-ink: #4ADE80;
  --rh-border: #26262B;
  --rh-shadow-float: 0 4px 20px rgba(0,0,0,.45);
}

/* Focus: buttons, links, rows and chips keep a 2px accent outline with a 2px offset. Text fields draw ONE ring:
   on the field itself when it is standalone, on the styled wrapper (:has) when the field is bare inside a pill. */
:where(button, a, summary, [tabindex], [role="button"]):focus-visible{
  outline: calc(2px * var(--ui-scale, 1)) solid var(--rh-accent, #B05C84) !important;
  outline-offset: calc(2px * var(--ui-scale, 1)) !important;
}
:is(input, select, textarea):focus-visible{
  outline: calc(2px * var(--ui-scale, 1)) solid var(--rh-accent, #B05C84) !important;
  outline-offset: calc(-1px * var(--ui-scale, 1)) !important;
}
input:is([type="checkbox"], [type="radio"], [type="range"], [type="file"], [type="color"]):focus-visible{
  outline-offset: calc(2px * var(--ui-scale, 1)) !important;
}
:is(.global-search, .activity-log-search, .email-list-search, .lookup-input-wrap, .sms-composer, .email-recipient-bar):has(:is(input, textarea, select):focus-visible){
  outline: calc(2px * var(--ui-scale, 1)) solid var(--rh-accent, #B05C84) !important;
  outline-offset: calc(-1px * var(--ui-scale, 1)) !important;
}
:is(.global-search, .activity-log-search, .email-list-search, .lookup-input-wrap, .sms-composer, .email-recipient-bar) :is(input, textarea, select):focus-visible{
  outline: none !important;
}

:where(button, .button, .et-quick-chip, .mbn-link-status, .nav-item, .activity-type-btn, .ticket-filter-btn, .email-folder-btn, .statistics-period-button, .chart-mode-btn, .theme-mode-btn, .et-mode-tab, .state-btn, .pulse-arrow, .call-log.clickable-log, .thread-item, .customer-row, .agent-mini){
  transition: scale var(--dur-slow) var(--ease-spring), translate var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out), background-color var(--dur-base) var(--ease-out), color var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out);
}
/* Press-down and release outrank each control's own transition list; release is a short-lived class set by motion.js. */
:is(html, #rh-p) .rh-pressed{ scale: .94; transition: scale var(--dur-press) var(--ease-out); }
:is(html, #rh-p) .rh-pressed.rh-pressed-row{ scale: .99; }
:is(html, #rh-r) .rh-release{
  transition: scale var(--dur-slow) var(--ease-spring), translate var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out), background-color var(--dur-base) var(--ease-out), color var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out), opacity var(--dur-base) var(--ease-out);
}
:where(button, .button, .nav-item, .mbn-link-status, .et-quick-chip, .state-btn, .pulse-arrow):is(:disabled, [aria-disabled="true"], .disabled),
:where(button, .button):is(:disabled, [aria-disabled="true"], .disabled):hover{
  scale: none;
  translate: none;
}
@media (hover: hover){
  :is(button.button, .et-quick-chip, .mbn-link-status, button.state-btn, button.pulse-arrow, button.modal-close, .small-action):not(:disabled):not([aria-disabled="true"]):not(.disabled):hover{
    translate: 0 calc(-1px * var(--ui-scale, 1));
    box-shadow: 0 calc(6px * var(--ui-scale, 1)) calc(20px * var(--ui-scale, 1)) rgba(0, 0, 0, .08);
  }
  :is(.rh-seg-ready, #primary-sidebar) :is(button, .nav-item):hover{
    translate: none;
  }
}

.activity-type-bar, .sms-filter-bar{ --rh-pill-bg: #1C1C1C; }
html[data-theme="dark"] .activity-type-bar{ --rh-pill-bg: var(--rh-accent, #B05C84); }
html[data-theme="dark"] .sms-filter-bar{ --rh-pill-bg: #FFFFFF; }
.et-segmented-folders, .et-segmented-statuses{ --rh-pill-bg: #ECECEE; }
html[data-theme="dark"] .et-segmented-folders,
html[data-theme="dark"] .et-segmented-statuses{ --rh-pill-bg: #FFFFFF; }
.et-composer-modes, .statistics-period-filter, .statistics-chart-mode-tabs{ --rh-pill-bg: #B05C84; }
.theme-mode-buttons{ --rh-pill-bg: var(--blue-soft, #B05C84); }
.theme-picker-list{ --rh-pill-bg: var(--canvas, #F4F4F6); }
.rh-seg-pill{
  position: absolute; left: 0; top: 0; z-index: 0; pointer-events: none;
  border-radius: var(--rh-radius-pill);
  background: var(--rh-pill-bg, #1C1C1C);
  will-change: transform;
  transition: width var(--dur-slow) var(--ease-spring), height var(--dur-slow) var(--ease-spring), transform var(--dur-slow) var(--ease-spring), opacity var(--dur-fast) var(--ease-out);
}
.theme-mode-buttons > .rh-seg-pill{ box-shadow: inset 0 0 0 calc(2px * var(--ui-scale, 1)) var(--blue, #1C1C1C); }
.rh-seg-ready > :not(.rh-seg-pill){ position: relative; z-index: 1; }
html .rh-seg-ready > :is(.active, .is-active, [aria-pressed="true"], [aria-selected="true"]){
  background: transparent !important;
  background-image: none !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

#pulse-calls-total, #pulse-msgs-total, .pulse-legend-n, #pulse-gauge-value, .filter-count, .count-pill, #mbn-queue-count, .detail-kpi-number, .statistics-concentric-center strong{
  font-variant-numeric: tabular-nums;
}
.rh-digit, .rh-char{ display: inline-block; font-variant-numeric: tabular-nums; vertical-align: bottom; }
/* The digit box stays still and clips; only the inner strip moves. The old digit sits
   one line above the new one (::before at top:-100%), so the two never overlap, even
   if the animation starts late (background tab, busy CPU). */
.rh-digit{ position: relative; overflow: hidden; height: 1.1em; line-height: 1.1; }
.rh-digit > .rh-digit-in{ display: inline-block; position: relative; }
.rh-digit.rh-roll > .rh-digit-in{ will-change: translate; animation: rh-digit-in var(--dur-roll) var(--ease-out) both; }
.rh-digit.rh-roll > .rh-digit-in::before{
  content: attr(data-prev);
  position: absolute; left: 0; right: 0; top: -100%; height: 100%;
}
@keyframes rh-digit-in{ from{ translate: 0 100%; } to{ translate: 0 0; } }

/* Async action button (RHMotion.busy). The :is(html, #id) prefix lifts specificity above per-button !important colour rules. */
[data-rh-state]{
  position: relative;
  clip-path: inset(0 0 round var(--rh-radius-pill));
  transition: clip-path var(--dur-base) var(--ease-out), background-color var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out), color var(--dur-fast) var(--ease-out), -webkit-text-fill-color var(--dur-fast) var(--ease-out);
}
[data-rh-state] > :not(.rh-btn-fx){ transition: opacity var(--dur-fast) var(--ease-out); }
[data-rh-state="loading"]{
  clip-path: inset(0 calc(50% - (var(--rh-h) / 2)) round var(--rh-radius-pill));
}
:is(html, #rh-fx):is(html, #rh-fx2) :is([data-rh-state="loading"], [data-rh-state="success"]){
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;
  text-shadow: none !important;
}
:is([data-rh-state="loading"], [data-rh-state="success"]) > :not(.rh-btn-fx),
:is([data-rh-state="loading"], [data-rh-state="success"]) > :not(.rh-btn-fx) svg{ opacity: 0 !important; }
.rh-btn-fx{
  position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none;
  color: var(--rh-fx-ink, #fff); -webkit-text-fill-color: currentColor;
}
.rh-btn-fx > *{ grid-area: 1 / 1; place-self: center; }
.rh-btn-fx::before{
  content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: var(--rh-h); translate: -50% 0;
  border: calc(1px * var(--ui-scale, 1)) solid var(--rh-fx-ring, transparent); border-radius: var(--rh-radius-pill);
  opacity: 0; transition: opacity var(--dur-fast) var(--ease-out);
}
[data-rh-state="loading"] > .rh-btn-fx::before{ opacity: 1; }
.rh-spinner{
  width: calc(16px * var(--ui-scale, 1)); height: calc(16px * var(--ui-scale, 1));
  border: calc(2px * var(--ui-scale, 1)) solid currentColor; border-right-color: transparent;
  border-radius: var(--rh-radius-pill); animation: rh-spin var(--dur-spin) linear infinite; opacity: 0;
}
.rh-check{ width: calc(18px * var(--ui-scale, 1)); height: calc(18px * var(--ui-scale, 1)); opacity: 0; transition: opacity var(--dur-fast) var(--ease-out); }
.rh-check path{ stroke-dasharray: 24; stroke-dashoffset: 24; }
[data-rh-state="loading"] .rh-spinner{ opacity: 1; }
:is(html, #rh-fx):is(html, #rh-fx2) [data-rh-state="success"]{
  clip-path: inset(0 round var(--rh-radius-pill));
  background: var(--rh-success) !important;
  background-image: none !important;
  border-color: var(--rh-success) !important;
}
[data-rh-state="success"] > .rh-btn-fx{ color: #fff; }
[data-rh-state="success"] .rh-check{ opacity: 1; }
[data-rh-state="success"] .rh-check path{ stroke-dashoffset: 0; transition: stroke-dashoffset var(--dur-draw) var(--ease-out); }
:is(html, #rh-fx):is(html, #rh-fx2) [data-rh-state="error"]{
  border-color: var(--rh-danger) !important;
  background: #FEE2E2 !important;
  background-image: none !important;
  color: #B91C1C !important;
  -webkit-text-fill-color: #B91C1C !important;
  animation: rh-shake var(--dur-shake) var(--ease-out);
}
:is(html[data-theme="dark"], #rh-fx):is(html[data-theme="dark"], #rh-fx2) [data-rh-state="error"]{
  background: #4A1519 !important;
  color: #FCA5A5 !important;
  -webkit-text-fill-color: #FCA5A5 !important;
}
[data-rh-state="error"] > .rh-btn-fx{ display: none; }
@keyframes rh-spin{ to{ rotate: 360deg; } }
@keyframes rh-shake{
  0%, 100%{ translate: 0 0; }
  8%{ translate: calc(-4px * var(--ui-scale, 1)) 0; }
  16%{ translate: calc(4px * var(--ui-scale, 1)) 0; }
  28%{ translate: 0 0; }
  40%{ translate: calc(-3px * var(--ui-scale, 1)) 0; }
  52%{ translate: calc(3px * var(--ui-scale, 1)) 0; }
  64%{ translate: 0 0; }
  76%{ translate: calc(-1px * var(--ui-scale, 1)) 0; }
  88%{ translate: calc(1px * var(--ui-scale, 1)) 0; }
}

@keyframes rh-enter{ from{ opacity: 0; translate: 0 calc(8px * var(--ui-scale, 1)); } to{ opacity: 1; translate: 0 0; } }
.rh-enter{ animation: rh-enter var(--dur-base) var(--ease-out) backwards; animation-delay: calc(var(--rh-i, 0) * var(--stagger)); }
@keyframes rh-new{
  0%{ opacity: 0; translate: 0 calc(-10px * var(--ui-scale, 1)); background-color: rgba(var(--rh-accent-rgb, 176, 92, 132), .14); }
  18%{ opacity: 1; translate: 0 0; background-color: rgba(var(--rh-accent-rgb, 176, 92, 132), .14); }
  100%{ opacity: 1; translate: 0 0; background-color: transparent; }
}
.rh-new{ animation: rh-new var(--dur-highlight) var(--ease-out); }
@keyframes rh-bubble{ from{ opacity: 0; translate: 0 calc(8px * var(--ui-scale, 1)); } to{ opacity: 1; translate: 0 0; } }
.rh-bubble{ animation: rh-bubble var(--dur-base) var(--ease-out) backwards; }
.rh-ghost{ overflow: hidden; pointer-events: none; transition: height var(--dur-base) var(--ease-in), opacity var(--dur-base) var(--ease-in); }

html.rh-loading:not(:has(#auth-login-screen:not(.hidden))) :is(#call-logs-list, #sms-threads-list, #email-threads-list, #agents-list, #customer-directory-list, #sms-chat-history, #email-chat-history, .pulse-stat, .statistics-detail-kpi-card):empty{
  position: relative; overflow: hidden; min-height: calc(88px * var(--ui-scale, 1));
}
html.rh-loading:not(:has(#auth-login-screen:not(.hidden))) :is(#call-logs-list, #sms-threads-list, #email-threads-list, #agents-list, #customer-directory-list, #sms-chat-history, #email-chat-history, .pulse-stat, .statistics-detail-kpi-card):empty::before{
  content: ""; display: block; height: calc(72px * var(--ui-scale, 1)); margin: calc(12px * var(--ui-scale, 1));
  border-radius: calc(8px * var(--ui-scale, 1));
  background:
    linear-gradient(var(--rh-border), var(--rh-border)) 0 0 / 46% calc(12px * var(--ui-scale, 1)) no-repeat,
    linear-gradient(var(--rh-border), var(--rh-border)) 0 calc(22px * var(--ui-scale, 1)) / 72% calc(12px * var(--ui-scale, 1)) no-repeat,
    linear-gradient(var(--rh-border), var(--rh-border)) 0 calc(44px * var(--ui-scale, 1)) / 58% calc(12px * var(--ui-scale, 1)) no-repeat;
}
html.rh-loading:not(:has(#auth-login-screen:not(.hidden))) :is(#call-logs-list, #sms-threads-list, #email-threads-list, #agents-list, #customer-directory-list, #sms-chat-history, #email-chat-history, .pulse-stat, .statistics-detail-kpi-card):empty::after{
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent);
  translate: -100% 0; animation: rh-shimmer 1.2s linear infinite;
}
@keyframes rh-shimmer{ to{ translate: 100% 0; } }

.toast{
  position: relative; overflow: hidden;
  background: #fff; color: var(--ink, #1C1C1C);
  border: calc(1px * var(--ui-scale, 1)) solid var(--rh-border);
  box-shadow: var(--rh-shadow-float);
  animation: rh-toast 3200ms linear forwards;
}
html[data-theme="dark"] .toast{ background: #18181C; }
@keyframes rh-toast{
  0%{ opacity: 0; translate: 0 calc(16px * var(--ui-scale, 1)); }
  6%{ opacity: 1; translate: 0 calc(-2px * var(--ui-scale, 1)); }
  9%{ opacity: 1; translate: 0 0; }
  96%{ opacity: 1; translate: 0 0; }
  100%{ opacity: 0; translate: 0 calc(8px * var(--ui-scale, 1)); }
}
.toast::after{
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: calc(2px * var(--ui-scale, 1));
  background: var(--rh-accent, #B05C84); transform-origin: left center;
  animation: rh-toast-bar 3200ms linear forwards;
}
.toast.success::after{ background: var(--rh-success); }
.toast.error::after, .toast.danger::after{ background: var(--rh-danger); }
@keyframes rh-toast-bar{ from{ scale: 1 1; } to{ scale: 0 1; } }
@media (max-width: 900px){
  .toast-container{ left: calc(16px * var(--ui-scale, 1)); right: calc(16px * var(--ui-scale, 1)); }
}

.modal-backdrop{
  backdrop-filter: none; -webkit-backdrop-filter: none;
  background: rgba(17, 17, 20, .38);
}
html[data-theme="dark"] .modal-backdrop{ background: rgba(0, 0, 0, .6); }
.modal-overlay{
  backdrop-filter: none !important; -webkit-backdrop-filter: none !important;
  background: rgba(17, 17, 20, .38) !important;
}
html[data-theme="dark"] .modal-overlay{ background: rgba(0, 0, 0, .6) !important; }
.statistics-detail-overlay{
  backdrop-filter: none; -webkit-backdrop-filter: none;
  background: rgba(17, 17, 20, .38);
}
html[data-theme="dark"] .statistics-detail-overlay,
:root[data-mode="dark"] .statistics-detail-overlay{ background: rgba(0, 0, 0, .6); }

@keyframes rh-pop{ from{ opacity: 0; scale: .96; translate: 0 calc(4px * var(--ui-scale, 1)); } to{ opacity: 1; scale: 1; translate: 0 0; } }
.statistics-detail-modal-shell{ animation: rh-pop var(--dur-slow) var(--ease-out) backwards; }
@keyframes rh-menu-item{ from{ opacity: 0; translate: 0 calc(6px * var(--ui-scale, 1)); } to{ opacity: 1; translate: 0 0; } }
:is(.template-menu, .email-more-menu, .activity-agent-menu, .pause-dropdown-menu, .global-call-dropdown, .ticket-agent-suggest) > :nth-child(-n+10),
.theme-picker-list > :nth-child(-n+10){
  animation: rh-menu-item var(--dur-base) var(--ease-out) backwards;
}
:is(.template-menu, .email-more-menu, .activity-agent-menu, .pause-dropdown-menu, .global-call-dropdown, .ticket-agent-suggest) > :nth-child(2),
.theme-picker-list > :nth-child(2){ animation-delay: calc(var(--stagger-menu) * 1); }
:is(.template-menu, .email-more-menu, .activity-agent-menu, .pause-dropdown-menu, .global-call-dropdown, .ticket-agent-suggest) > :nth-child(3),
.theme-picker-list > :nth-child(3){ animation-delay: calc(var(--stagger-menu) * 2); }
:is(.template-menu, .email-more-menu, .activity-agent-menu, .pause-dropdown-menu, .global-call-dropdown, .ticket-agent-suggest) > :nth-child(4),
.theme-picker-list > :nth-child(4){ animation-delay: calc(var(--stagger-menu) * 3); }
:is(.template-menu, .email-more-menu, .activity-agent-menu, .pause-dropdown-menu, .global-call-dropdown, .ticket-agent-suggest) > :nth-child(5),
.theme-picker-list > :nth-child(5){ animation-delay: calc(var(--stagger-menu) * 4); }
:is(.template-menu, .email-more-menu, .activity-agent-menu, .pause-dropdown-menu, .global-call-dropdown, .ticket-agent-suggest) > :nth-child(6),
.theme-picker-list > :nth-child(6){ animation-delay: calc(var(--stagger-menu) * 5); }
:is(.template-menu, .email-more-menu, .activity-agent-menu, .pause-dropdown-menu, .global-call-dropdown, .ticket-agent-suggest) > :nth-child(7),
.theme-picker-list > :nth-child(7){ animation-delay: calc(var(--stagger-menu) * 6); }
:is(.template-menu, .email-more-menu, .activity-agent-menu, .pause-dropdown-menu, .global-call-dropdown, .ticket-agent-suggest) > :nth-child(8),
.theme-picker-list > :nth-child(8){ animation-delay: calc(var(--stagger-menu) * 7); }
:is(.template-menu, .email-more-menu, .activity-agent-menu, .pause-dropdown-menu, .global-call-dropdown, .ticket-agent-suggest) > :nth-child(9),
.theme-picker-list > :nth-child(9){ animation-delay: calc(var(--stagger-menu) * 8); }
:is(.template-menu, .email-more-menu, .activity-agent-menu, .pause-dropdown-menu, .global-call-dropdown, .ticket-agent-suggest) > :nth-child(10),
.theme-picker-list > :nth-child(10){ animation-delay: calc(var(--stagger-menu) * 9); }
:is(.pause-dropdown-menu, .activity-agent-menu, .email-more-menu, .global-call-dropdown, .ticket-agent-suggest, .theme-picker){ transform-origin: top center; }
:is(.template-menu, #emoji-picker){ transform-origin: bottom right; }

@supports (transition-behavior: allow-discrete){
  .modal-backdrop, .modal-overlay{
    transition: display var(--dur-fast) var(--ease-in) allow-discrete, opacity var(--dur-fast) var(--ease-in);
    opacity: 0; pointer-events: none;
  }
  .modal-backdrop.active, .modal-overlay.active{
    opacity: 1; pointer-events: auto;
    transition-duration: var(--dur-base); transition-timing-function: var(--ease-spring);
  }
  @starting-style{
    .modal-backdrop.active, .modal-overlay.active{ opacity: 0; }
  }
  .modal-backdrop .modal-card, .modal-overlay .modal-card{
    animation: none;
    transition: opacity var(--dur-base) var(--ease-spring), scale var(--dur-base) var(--ease-spring), translate var(--dur-base) var(--ease-spring);
  }
  @starting-style{
    .modal-backdrop.active .modal-card, .modal-overlay.active .modal-card{
      opacity: 0; scale: .96; translate: 0 calc(4px * var(--ui-scale, 1));
    }
  }
  .modal-backdrop:not(.active) .modal-card, .modal-overlay:not(.active) .modal-card{
    opacity: 0; scale: .96; translate: 0 calc(4px * var(--ui-scale, 1));
    transition-duration: var(--dur-fast); transition-timing-function: var(--ease-in); pointer-events: none;
  }
  :is(.template-menu, .email-more-menu, .activity-agent-menu, .ticket-agent-suggest, .pause-dropdown-menu, .queue-panel-content, .global-call-dropdown, .theme-picker){
    transition: opacity var(--dur-fast) var(--ease-in), scale var(--dur-fast) var(--ease-in), translate var(--dur-fast) var(--ease-in), display var(--dur-fast) allow-discrete;
  }
  .live-search-overlay{ transition: opacity var(--dur-fast) var(--ease-in), display var(--dur-fast) allow-discrete; }
  :is(.template-menu, .email-more-menu, .activity-agent-menu, .ticket-agent-suggest):not(.hidden),
  .theme-picker:not([hidden]), .global-call-dropdown:not([hidden]),
  .pause-control-container.open .pause-dropdown-menu,
  .queue-profile-accordion.open .queue-panel-content{
    opacity: 1; scale: 1; translate: 0 0; pointer-events: auto; animation: none;
  }
  .live-search-overlay:not(.hidden){ opacity: 1; pointer-events: auto; }
  @starting-style{
    :is(.template-menu, .email-more-menu, .activity-agent-menu, .ticket-agent-suggest):not(.hidden),
    .theme-picker:not([hidden]), .global-call-dropdown:not([hidden]),
    .pause-control-container.open .pause-dropdown-menu,
    .queue-profile-accordion.open .queue-panel-content{
      opacity: 0; scale: .96; translate: 0 calc(4px * var(--ui-scale, 1));
    }
    .live-search-overlay:not(.hidden){ opacity: 0; }
  }
  :is(.template-menu, .email-more-menu, .activity-agent-menu, .ticket-agent-suggest).hidden,
  .theme-picker[hidden], .global-call-dropdown[hidden],
  .pause-dropdown-menu, .queue-panel-content{
    opacity: 0; scale: .96; translate: 0 calc(4px * var(--ui-scale, 1)); pointer-events: none;
  }
  .pause-control-container.open .pause-dropdown-menu,
  .queue-profile-accordion.open .queue-panel-content{ pointer-events: auto; }
  .live-search-overlay.hidden{ opacity: 0; pointer-events: none; }
}

@keyframes rh-view-in{ from{ opacity: 0; scale: .97; } to{ opacity: 1; scale: 1; } }
.tab-view.active > :not(.hidden):is(.page-heading, .overview-pulse, .dashboard-grid, .surface, .inbox-layout, .mbn-page, .ra-header, .ra-form, header),
.tab-view.active > .overview-pulse > :is(.pulse-stat, .pulse-chart, .pulse-gauge),
.tab-view.active > .mbn-page > :is(.mbn-head, .mbn-card, article, section){
  animation: rh-view-in var(--dur-slow) var(--ease-out) backwards;
}
.tab-view.active > :nth-child(2),
.tab-view.active > .overview-pulse > :nth-child(2),
.tab-view.active > .mbn-page > :nth-child(2){ animation-delay: calc(var(--stagger) * 1); }
.tab-view.active > :nth-child(3),
.tab-view.active > .overview-pulse > :nth-child(3),
.tab-view.active > .mbn-page > :nth-child(3){ animation-delay: calc(var(--stagger) * 2); }
.tab-view.active > :nth-child(4),
.tab-view.active > .overview-pulse > :nth-child(4),
.tab-view.active > .mbn-page > :nth-child(4){ animation-delay: calc(var(--stagger) * 3); }
.tab-view.active > :nth-child(5),
.tab-view.active > .mbn-page > :nth-child(5){ animation-delay: calc(var(--stagger) * 4); }
.tab-view.active > :nth-child(6){ animation-delay: calc(var(--stagger) * 5); }

@keyframes rh-cap-next{ from{ opacity: 0; translate: calc(8px * var(--ui-scale, 1)) 0; } to{ opacity: 1; translate: 0 0; } }
@keyframes rh-cap-prev{ from{ opacity: 0; translate: calc(-8px * var(--ui-scale, 1)) 0; } to{ opacity: 1; translate: 0 0; } }
#pulse-caption.rh-cap-next{ animation: rh-cap-next var(--dur-base) var(--ease-out); }
#pulse-caption.rh-cap-prev{ animation: rh-cap-prev var(--dur-base) var(--ease-out); }

.global-call-pulse{ position: relative; }
.global-call-pulse::after{
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  border: calc(2px * var(--ui-scale, 1)) solid #1f9a63;
  animation: rh-ring 1.6s var(--ease-out) infinite;
}
.global-active-call-panel:has(#btn-global-answer, .global-call-answer-hint) .global-call-pulse::after{
  border-color: var(--rh-accent, #B05C84);
}
/* The call dot pulses on the compositor. pulseGreen grew a box-shadow, which
   was repainted on the main thread on every frame for as long as a call
   lasted (about a third of a slow laptop's time in a 5 s sample). The halo is
   now a circle of the same green behind the dot that grows and fades (scale,
   opacity): 2.6 x the 10 px dot is the old 8 px spread. Same colour in every
   theme, as the shadow was. */
.global-call-pulse{
  box-shadow: none;
  animation-name: rh-call-dot;
}
.global-call-pulse::before{
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: rgb(31, 154, 99);
  animation: rh-call-halo 1.5s infinite;
}
@keyframes rh-call-dot{ 0%{ transform: scale(.95); } 70%{ transform: scale(1.1); } 100%{ transform: scale(.95); } }
@keyframes rh-call-halo{ 0%{ opacity: .65; scale: 1; } 70%{ opacity: 0; scale: 2.6; } 100%{ opacity: 0; scale: 2.6; } }
@keyframes rh-ring{ from{ opacity: .45; scale: 1; } to{ opacity: 0; scale: 1.6; } }
@keyframes rh-flip{ from{ opacity: 0; rotate: -35deg; scale: .8; } to{ opacity: 1; rotate: 0deg; scale: 1; } }
[data-rh-flip] svg{ animation: rh-flip var(--dur-base) var(--ease-spring); }

.toggle-slider{
  border-radius: var(--rh-radius-pill);
  transition: background-color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}
.toggle-slider:before{ transition: translate var(--dur-base) var(--ease-spring), transform var(--dur-base) var(--ease-spring); }
.toggle-switch input:checked + .toggle-slider{
  background-color: var(--rh-accent, #B05C84);
  box-shadow: none;
}
.toggle-switch input:checked + .toggle-slider:before{
  transform: none;
  translate: calc(16px * var(--ui-scale, 1)) 0;
}

:is(.statistics-response-ring, .statistics-concentric-ring, #pulse-gauge-svg path, #pulse-gauge-svg circle, .statistics-ring circle, .statistics-ring path){
  transition: stroke-dashoffset var(--dur-slow) var(--ease-out), stroke var(--dur-base) var(--ease-out);
}
.zisson-progress-bar, .detail-bar-stack{
  transition: width var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out), background-color var(--dur-base) var(--ease-out);
}

/* Exit animations. motion.js keeps a hidden menu, panel or dialog displayed for --dur-fast with .rh-closing,
   then removes the class and its inline display again. Shorter than the opening on purpose. */
@keyframes rh-close{ from{ opacity: 1; scale: 1; translate: 0 0; } to{ opacity: 0; scale: .96; translate: 0 calc(4px * var(--ui-scale, 1)); } }
@keyframes rh-close-fade{ from{ opacity: 1; } to{ opacity: 0; } }
.rh-closing{ pointer-events: none !important; animation: rh-close var(--dur-fast) var(--ease-in) forwards !important; }
.rh-closing:is(.modal-backdrop, .modal-overlay, .statistics-detail-overlay){ animation-name: rh-close-fade !important; }
.statistics-detail-overlay.rh-closing .statistics-detail-modal-shell{ animation: rh-close var(--dur-fast) var(--ease-in) forwards; }
@keyframes rh-drawer-out{ from{ opacity: 1; translate: 0 0; } to{ opacity: 0; translate: -100% 0; } }
.sidebar.rh-closing{ animation-name: rh-drawer-out !important; }
.rh-backdrop-ghost{ position: fixed; inset: 0; pointer-events: none; animation: rh-close-fade var(--dur-fast) var(--ease-in) forwards; }

@keyframes rh-fade{ from{ opacity: 0; } to{ opacity: 1; } }
@media (prefers-reduced-motion: reduce){
  :where(.rh-pressed, .rh-pressed-row, .rh-enter, .rh-new, .rh-bubble, .rh-ghost, .rh-seg-pill, .toast, .modal-card, .global-call-pulse, .global-call-pulse::after, [data-rh-state], [data-rh-flip], #pulse-caption, .toggle-slider:before){
    scale: none !important;
    translate: none !important;
    rotate: none !important;
    animation-delay: 0s !important;
  }
  :where(.rh-enter, .rh-new, .rh-bubble, .toast, .modal-card, #pulse-caption, .statistics-detail-modal-shell){
    animation-name: rh-fade !important;
    animation-duration: var(--dur-fast) !important;
  }
  .rh-seg-pill, .rh-ghost, .toggle-slider, .toggle-slider:before, .zisson-progress-bar, .detail-bar-stack,
  :is(.statistics-response-ring, #pulse-gauge-svg path, #pulse-gauge-svg circle){
    transition: none !important;
  }
  .global-call-pulse::after, .global-call-pulse::before, .rh-closing, .rh-backdrop-ghost,
  .statistics-detail-overlay.rh-closing .statistics-detail-modal-shell,
  .rh-digit.rh-roll > .rh-digit-in,
  html.rh-loading :is(#call-logs-list, #sms-threads-list, #email-threads-list):empty::after,
  .rh-spinner{
    animation: none !important;
  }
}

/* Touch: no double-tap-zoom wait on controls (pinch zoom and scrolling are untouched), and no grey tap flash; the press state is the feedback. */
:where(button, a[href], [role="button"], summary, label, select, input, .nav-item, .thread-item, .customer-row, .call-log){
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Kontakter: thousands of rows. Only the rows on screen get style and layout, so
   showing the tab costs the same with 50 or 5,000 contacts. The intrinsic size
   keeps the scrollbar right until a row has been laid out once. */
#customer-directory-list > .customer-row {
  content-visibility: auto;
  contain-intrinsic-size: auto calc(72px * var(--ui-scale, 1));
  flex-shrink: 0;
}

/* The activity feed and the SMS and e-mail lists (hundreds of rows) work the
   same way: rows off screen are skipped for style, layout and paint, so a
   click, a redraw or a scroll costs what the visible rows cost. Nothing in a
   row paints outside it (the action overlay is inset 0), so the paint
   containment this brings clips nothing. The sizes are the measured row
   heights, the same in all six themes; "auto" keeps a row's real height once
   it has been laid out. The lists are flex columns: a row off screen has no
   content size, so without flex-shrink: 0 it is squeezed to a sliver, the
   list gets shorter and a redraw throws the scroll back to the top. */
#call-logs-list > .call-log {
  content-visibility: auto;
  contain-intrinsic-size: auto calc(48px * var(--ui-scale, 1));
  flex-shrink: 0;
}
#sms-threads-list > .thread-item {
  content-visibility: auto;
  contain-intrinsic-size: auto calc(92px * var(--ui-scale, 1));
  flex-shrink: 0;
}
#email-threads-list > .et-ticket-card {
  content-visibility: auto;
  contain-intrinsic-size: auto calc(117px * var(--ui-scale, 1));
  flex-shrink: 0;
}

/* Theme switch (RHMotion.themeReveal): the new snapshot is revealed by a growing
   circle from the click (animated from JS); no default cross-fade under it. */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}
::view-transition-new(root) { z-index: 2; }
::view-transition-old(root) { z-index: 1; }

/* ---- Every theme: Område card and state buttons follow the agent's state ----
   Ledig (and on a call) keeps the theme's accent; Pause is yellow, Etterarbeid
   indigo/purple (matching the colleague list row), Møte purple and a line Zisson
   does not have the agent on red, the tones of the state buttons darkened like
   the accent card (58 % on #1C1C1C). The colour eases instead of jumping.
   `html:root` + the ids lift these above the theme sheets. */
html:root #primary-sidebar #agent-controls-rail-section #queue-card-wrapper#queue-card-wrapper {
  transition: background-color var(--dur-slow) var(--ease-out), border-color var(--dur-slow) var(--ease-out) !important;
}
html:root #primary-sidebar #agent-controls-rail-section #queue-card-wrapper#queue-card-wrapper[data-state="paused"] { --rh-state-rgb: 250, 204, 21; }
html:root #primary-sidebar #agent-controls-rail-section #queue-card-wrapper#queue-card-wrapper[data-state="wrapup"] { --rh-state-rgb: 129, 140, 248; }
html:root #primary-sidebar #agent-controls-rail-section #queue-card-wrapper#queue-card-wrapper[data-state="meeting"] { --rh-state-rgb: 168, 85, 247; }
html:root #primary-sidebar #agent-controls-rail-section #queue-card-wrapper#queue-card-wrapper[data-state="mismatch"] { --rh-state-rgb: 239, 68, 68; }
html:root #primary-sidebar #agent-controls-rail-section #queue-card-wrapper#queue-card-wrapper:is([data-state="paused"], [data-state="wrapup"], [data-state="meeting"], [data-state="mismatch"]) {
  background: color-mix(in srgb, rgb(var(--rh-state-rgb)) 58%, #1C1C1C) !important;
  background-image: none !important;
  border-color: rgba(var(--rh-state-rgb), .8) !important;
}

/* Klar / Etterarb. / Pause / Logg ut as one segmented control (bento style): a dark
   track with four small pill buttons; the current state is a pill that slides to it
   (motion.js segment) in the same colour as the Område card, and its icon pops.
   The icons keep the fixed state tones (--tone). */
html:root #primary-sidebar #agent-controls-rail-section #queue-agent-actions.agent-state-actions {
  display: flex !important;
  gap: calc(2px * var(--ui-scale, 1)) !important;
  margin-top: calc(8px * var(--ui-scale, 1)) !important;
  padding: calc(4px * var(--ui-scale, 1)) !important;
  background: rgba(255, 255, 255, .06) !important;
  border: calc(1px * var(--ui-scale, 1)) solid rgba(255, 255, 255, .08) !important;
  border-radius: 999px !important;
  --rh-state-pill: var(--sb-accent-muted, #B05C84);
}
html:root #primary-sidebar #agent-controls-rail-section #queue-agent-actions:has(.state-acw.is-current) { --rh-state-pill: color-mix(in srgb, rgb(129, 140, 248) 58%, #1C1C1C); }
html:root #primary-sidebar #agent-controls-rail-section #queue-agent-actions:has(.state-pause.is-current) { --rh-state-pill: color-mix(in srgb, rgb(250, 204, 21) 58%, #1C1C1C); }
html:root #primary-sidebar #agent-controls-rail-section #queue-agent-actions > :is(.state-btn, .pause-control-container) {
  flex: 1 1 0 !important;
  min-width: 0 !important;
  width: auto !important;
}
html:root #primary-sidebar #agent-controls-rail-section #queue-agent-actions .state-btn {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  height: calc(44px * var(--ui-scale, 1)) !important;
  min-height: calc(44px * var(--ui-scale, 1)) !important;
  padding: calc(4px * var(--ui-scale, 1)) calc(2px * var(--ui-scale, 1)) !important;
  gap: calc(3px * var(--ui-scale, 1)) !important;
  border-radius: 999px !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: rgb(var(--tone)) !important;
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-base) var(--ease-out) !important;
}
html:root #primary-sidebar #agent-controls-rail-section #queue-agent-actions .state-btn::before { display: none !important; }
html:root #primary-sidebar #agent-controls-rail-section #queue-agent-actions .state-btn svg {
  display: block !important;
  width: calc(15px * var(--ui-scale, 1)) !important;
  height: calc(15px * var(--ui-scale, 1)) !important;
  fill: none !important;
  stroke: currentColor !important;
  stroke-width: 1.8 !important;
  stroke-linecap: round !important;
  stroke-linejoin: round !important;
  opacity: 1 !important;
}
html:root #primary-sidebar #agent-controls-rail-section #queue-agent-actions .state-btn span {
  font-size: calc(10px * var(--ui-scale, 1)) !important;
  font-weight: 600 !important;
  color: rgba(245, 245, 242, .78) !important;
  overflow: visible !important;
  text-overflow: clip !important;
}
html:root #primary-sidebar #agent-controls-rail-section #queue-agent-actions .state-ready { --tone: 52, 211, 153; }
html:root #primary-sidebar #agent-controls-rail-section #queue-agent-actions .state-acw { --tone: 129, 140, 248; }
html:root #primary-sidebar #agent-controls-rail-section #queue-agent-actions .state-pause { --tone: 250, 204, 21; }
html:root #primary-sidebar #agent-controls-rail-section #queue-agent-actions .state-logout { --tone: 248, 113, 113; }
html:root #primary-sidebar #agent-controls-rail-section #queue-agent-actions .state-btn:hover:not(:disabled):not(.is-current) {
  background: rgba(255, 255, 255, .06) !important;
  transform: none !important;
}
html:root #primary-sidebar #agent-controls-rail-section #queue-agent-actions .state-btn.is-current {
  background: transparent !important;
  color: #FFFFFF !important;
}
html:root #primary-sidebar #agent-controls-rail-section #queue-agent-actions .state-btn.is-current span { color: #FFFFFF !important; }
html:root #primary-sidebar #agent-controls-rail-section #queue-agent-actions > .rh-seg-pill {
  border-radius: 999px;
  background: var(--rh-state-pill) !important;
  transition: width var(--dur-slow) var(--ease-spring), height var(--dur-slow) var(--ease-spring), transform var(--dur-slow) var(--ease-spring), opacity var(--dur-fast) var(--ease-out), background-color var(--dur-slow) var(--ease-out);
}
/* Without the pill (motion layer not running) the current button is filled itself. */
html:root #primary-sidebar #agent-controls-rail-section #queue-agent-actions:not(.rh-seg-ready) .state-btn.is-current {
  background: var(--rh-state-pill) !important;
}
@media (prefers-reduced-motion: no-preference) {
  html:root #primary-sidebar #agent-controls-rail-section #queue-agent-actions .state-btn.is-current svg {
    animation: rh-state-pop var(--dur-slow) var(--ease-spring);
  }
}
@keyframes rh-state-pop {
  0% { scale: .55; }
  60% { scale: 1.18; }
  100% { scale: 1; }
}

/* The agent card and the Område card are the same oval as the Klar / Etterarb. /
   Pause / Logg ut track above: same surface, same hairline, pill ends, in all six
   themes. The three ovals sit 8px apart. A line that is on still fills the Område
   card with the theme accent (that rule is untouched); its shape is the same.
   Desktop only: on the phone these cards have their own layout. */
@media (min-width: 901px) {
  html:root #primary-sidebar #mobile-operation-controls {
    gap: calc(8px * var(--ui-scale, 1)) !important;
  }
  html:root #primary-sidebar #mobile-operation-controls #utility-agent-select .active-agent-select-wrapper {
    background: transparent !important;
    border-radius: 999px !important;
  }
  html:root #primary-sidebar #utility-agent-select #user-menu-btn.agent-identity,
  html:root #primary-sidebar #agent-controls-rail-section #queue-card-wrapper#queue-card-wrapper:is(:not([data-state]), [data-state="offline"]):not(.status-btn-green, .status-btn-light-orange, .status-btn-purple) {
    background: rgba(255, 255, 255, .06) !important;
    background-image: none !important;
    border: calc(1px * var(--ui-scale, 1)) solid rgba(255, 255, 255, .08) !important;
    box-shadow: none !important;
  }
  html:root #primary-sidebar #utility-agent-select #user-menu-btn.agent-identity {
    border-radius: 999px !important;
  }
  /* A pill at its usual height (name row and timer); the cap keeps the corners
     round, and the headset inside them, when a line summary makes it taller. */
  html:root #primary-sidebar #agent-controls-rail-section #queue-card-wrapper#queue-card-wrapper {
    border-width: calc(1px * var(--ui-scale, 1)) !important;
    border-radius: calc(40px * var(--ui-scale, 1)) !important;
  }
  /* The row inside the Område card has no surface of its own: one oval, not two. */
  html:root #primary-sidebar #agent-controls-rail-section #queue-card-wrapper#queue-card-wrapper .queue-accordion-btn {
    background: transparent !important;
    border-color: transparent !important;
  }
  /* The headset and the chevron sit at the middle of the whole oval, not of the
     top row: they are placed from the card, whatever its height (timer shown or
     not, a Zisson summary under it). The text keeps the middle column. */
  html:root #primary-sidebar #agent-controls-rail-section #queue-card-wrapper#queue-card-wrapper {
    position: relative !important;
  }
  /* Nothing on the row may make it the box the icons are placed from: a scale,
     transform, filter or will-change on it would pull them to its middle (the
     press effect did that for a moment on every click). The press is shown on
     the whole card instead. */
  html:root #primary-sidebar #agent-controls-rail-section #queue-card-wrapper#queue-card-wrapper .queue-accordion-btn {
    position: static !important;
    scale: none !important;
    transform: none !important;
    filter: none !important;
    will-change: auto !important;
    contain: none !important;
  }
  html:root #primary-sidebar #agent-controls-rail-section #queue-card-wrapper#queue-card-wrapper:has(> .queue-accordion-btn.rh-pressed) {
    scale: .98;
    transition: scale var(--dur-press, 120ms) var(--ease-out, ease-out);
  }
  html:root #primary-sidebar #agent-controls-rail-section #queue-card-wrapper#queue-card-wrapper .queue-accordion-btn > .queue-btn-text {
    grid-column: 2 !important;
  }
  html:root #primary-sidebar #agent-controls-rail-section #queue-card-wrapper#queue-card-wrapper .queue-accordion-btn > :is(.queue-btn-icon, .queue-chevron) {
    position: absolute !important;
    top: 50% !important;
    translate: 0 -50%;
    margin: 0 !important;
  }
  html:root #primary-sidebar #agent-controls-rail-section #queue-card-wrapper#queue-card-wrapper .queue-accordion-btn > .queue-btn-icon {
    left: calc(12px * var(--ui-scale, 1)) !important;
  }
  html:root #primary-sidebar #agent-controls-rail-section #queue-card-wrapper#queue-card-wrapper .queue-accordion-btn > .queue-chevron {
    right: calc(12px * var(--ui-scale, 1)) !important;
  }
}

/* E-post, the folder and status rail (Innboks … Under arbeid), desktop:
   - it has no surface of its own: the page's rounded card shows through, so
     there is no lighter rectangle inside the oval;
   - in light mode the chosen folder and the chosen status are a grey pill,
     clearly darker than the card (the white pill was lost on near-white);
   - in dark mode the chosen item keeps the white pill with dark text (the
     accent text of some themes was pale on it). Same in all six themes. */
@media (min-width: 901px) {
  html:root #email-tab#email-tab .et-workspace-layout > .et-vertical-nav-rail {
    background: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
  }
  html:root:not([data-theme="dark"]) #email-tab#email-tab .et-vertical-nav-rail :is(.et-segmented-folders, .et-segmented-statuses) > .rh-seg-pill,
  html:root:not([data-theme="dark"]) #email-tab#email-tab .et-vertical-nav-rail :is(.et-segmented-folders, .et-segmented-statuses):not(.rh-seg-ready) > .active {
    background: rgba(0, 0, 0, .11) !important;
    background-image: none !important;
    box-shadow: none !important;
  }
  /* With the sliding pill the chosen button itself stays clear (Lime painted it white);
     the doubled id outranks the theme rules for the chosen item. */
  html:root:not([data-theme="dark"]) #email-tab#email-tab .et-vertical-nav-rail :is(.et-segmented-folders, .et-segmented-statuses).rh-seg-ready > .active {
    background: transparent !important;
    background-image: none !important;
  }
  /* Dark text on the grey pill: some themes turned the chosen label white, and
     Lime and Lavendel the plain folder count too (they were made for a dark
     pill). The coloured count badges of the other themes keep white digits. */
  html:root:not([data-theme="dark"]) #email-tab#email-tab .et-vertical-nav-rail :is(.et-segmented-folders, .et-segmented-statuses) > .active .et-folder-label,
  html:root:is([data-theme-name="lime"], [data-theme-name="lavendel"]):not([data-theme="dark"]) #email-tab#email-tab .et-vertical-nav-rail .et-segmented-folders > .active > span[id^="email-folder-count-"]:not(.et-inbox-ratio) {
    color: #1C1C1C !important;
    font-weight: 700 !important;
    opacity: 1 !important;
  }
  /* The sliding pill takes its colour once, from the theme the page loaded
     with (motion.js); here it is set for each mode, so switching light/dark
     without a reload keeps the chosen item visible. */
  html:root[data-theme="dark"] #email-tab#email-tab .et-vertical-nav-rail :is(.et-segmented-folders, .et-segmented-statuses) > .rh-seg-pill {
    background: #FFFFFF !important;
    background-image: none !important;
  }
  html:root[data-theme="dark"] #email-tab#email-tab .et-vertical-nav-rail :is(.et-segmented-folders, .et-segmented-statuses) > .active .et-folder-label {
    color: #1C1C1C !important;
  }
}

/* Hurtigsvar (SMS and e-mail): the bar is a scroll row inside a flex column, so
   without flex-shrink: 0 the column squeezed it below the height of its chips
   and the top of every chip was cut off. It keeps its own height now. */
html .sms-quick-reply-bar,
html #email-tab .et-quick-reply-bar {
  flex-shrink: 0 !important;
}

/* Meldinger and E-post: the "Lukket" label (on the list cards and in the
   conversation / case header) is black, not green, in every light theme; in dark mode it is white,
   on a neutral pill (black would vanish on the dark surface). Only the text
   colour changes: the borders stay as each place draws them (the header has
   none; the list separators follow the text). */
html:root:not([data-theme="dark"]) :is(#sms-tab#sms-tab, #email-tab#email-tab) .pill-status-closed {
  color: #1C1C1C !important;
}
html:root[data-theme="dark"] :is(#sms-tab#sms-tab, #email-tab#email-tab) .pill-status-closed {
  color: #FFFFFF !important;
}
/* Fjord, Havn, Terrakotta and Grafitt put the label in the open e-mail case on a
   green pill: a neutral one there, so it is not green either. */
html:root:not([data-theme="dark"]) #email-tab#email-tab .pill-status-closed:not(#email-threads-list *) {
  background-color: rgba(28, 28, 28, .06) !important;
  border-color: rgba(28, 28, 28, .16) !important;
}
html:root[data-theme="dark"] #email-tab#email-tab .pill-status-closed:not(#email-threads-list *) {
  background-color: rgba(255, 255, 255, .08) !important;
  border-color: rgba(255, 255, 255, .22) !important;
}
/* The dark themes gave the list label a green pill of its own. */
html:root[data-theme="dark"] :is(#sms-tab#sms-tab #sms-threads-list, #email-tab#email-tab #email-threads-list) .pill-status-closed {
  background-color: rgba(255, 255, 255, .08) !important;
  border-color: rgba(255, 255, 255, .22) !important;
}

/* E-post, fewer colours: the EPOST source label and the agent's name are black
   in light mode and white in dark mode (no indigo / purple), on a neutral pill
   in dark mode; the employee number is plain text in the name's own colour, no
   pill around it. On the case cards and in the open case. */
html:root:not([data-theme="dark"]) #email-tab#email-tab :is(.pill-source-socialboards[data-tag-kind="source"], .pill-agent) {
  color: #1C1C1C !important;
}
html:root[data-theme="dark"] #email-tab#email-tab :is(.pill-source-socialboards[data-tag-kind="source"], .pill-agent) {
  color: #FFFFFF !important;
  background-color: rgba(255, 255, 255, .08) !important;
  background-image: none !important;
  border-color: rgba(255, 255, 255, .22) !important;
}
/* Three ids: Lime and Lavendel paint the card's number white on black with
   (2,3,1); this has to outrank them. */
html:root #email-tab#email-tab#email-tab .sms-ansatt-inline {
  color: inherit !important;
  background: none !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  /* As large as the name beside it and bold, so the number is read first. */
  font-family: inherit !important;
  font-size: inherit !important;
  font-weight: 700 !important;
  font-variant-numeric: tabular-nums;
}
/* In a message's head the number sits in a small grey line: it takes the
   sender name's size and the text colour instead. */
html:root #email-tab#email-tab#email-tab .et-msg-who .sms-ansatt-inline {
  font-size: calc(14px * var(--ui-scale, 1)) !important;
  color: var(--ink) !important;
}

/* E-post case cards: the labels are split by the same thin vertical line as
   in Meldinger, in every theme. A later "border-color: transparent" for every
   e-mail pill (Lime, Lavendel) hid it, and the dark EPOST / agent pill above
   recoloured it; this is the Meldinger line again. */
html:root #email-tab#email-tab#email-tab #email-threads-list .et-card-badges-line.et-colorful-meta-row > .et-meta-pill + .et-meta-pill {
  border-left: calc(1px * var(--ui-scale, 1)) solid var(--line) !important;
}
html:root:is([data-theme-name="lime"], [data-theme-name="lavendel"]):not([data-theme="dark"]) #email-tab#email-tab#email-tab #email-threads-list .et-card-badges-line.et-colorful-meta-row > .et-meta-pill + .et-meta-pill {
  border-left-color: rgba(28, 28, 28, .28) !important;
}
html:root:is([data-theme-name="lime"], [data-theme-name="lavendel"])[data-theme="dark"] #email-tab#email-tab#email-tab #email-threads-list .et-card-badges-line.et-colorful-meta-row > .et-meta-pill + .et-meta-pill {
  border-left-color: rgba(255, 255, 255, .32) !important;
}

/* Sentralbord in the menu: a copy icon right after the number and the e-mail.
   The text keeps its own look; a long address still ends in "…". */
#sentralbord-card .sentralbord-line {
  display: flex;
  align-items: center;
  gap: calc(4px * var(--ui-scale, 1));
  min-width: 0;
}
#sentralbord-card .sentralbord-line > :first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
#sentralbord-card .sentralbord-copy {
  flex: 0 0 auto;
  color: inherit;
}
#sentralbord-card .sentralbord-copy[hidden],
#sentralbord-card .sentralbord-copy.channel-off {
  display: none !important;
}

/* Område: the line list is on screen only while its button opened it (.open);
   nothing else (a theme sheet, a re-render, an exit animation) can show it. */
.queue-profile-accordion:not(.open) > .queue-panel-content {
  display: none !important;
}

/* The Pause menu is a column also while it closes: its column layout used to sit
   only on `.open`, so during the exit animation (motion.js keeps the menu shown
   after `.open` is gone) the options flashed as a horizontal row. */
.pause-dropdown-menu {
  flex-direction: column;
  gap: calc(3px * var(--ui-scale, 1));
}

/* ---- Systemstatus (administrator) ----
   The settings gear in the menu (Agentadministrasjon) carries the overall
   worker state for the administrator: green all well, yellow an agent's worker
   is not connected or an SMS warning, red messages missing / no MBN session /
   a worker that does not answer. Shared by every theme (the themes style the
   gear with !important, hence the selector weight). */
html:root .sidebar-header-actions #btn-admin-settings[data-health] {
  transition: background-color var(--dur-slow) var(--ease-out), border-color var(--dur-slow) var(--ease-out), color var(--dur-slow) var(--ease-out) !important;
}
html:root .sidebar-header-actions #btn-admin-settings[data-health="ok"] {
  background: rgba(34, 197, 94, .2) !important;
  border-color: rgba(34, 197, 94, .7) !important;
  color: #4ADE80 !important;
}
html:root .sidebar-header-actions #btn-admin-settings[data-health="warning"] {
  background: rgba(234, 179, 8, .22) !important;
  border-color: rgba(234, 179, 8, .8) !important;
  color: #FACC15 !important;
}
html:root .sidebar-header-actions #btn-admin-settings[data-health="error"] {
  background: rgba(239, 68, 68, .24) !important;
  border-color: rgba(239, 68, 68, .85) !important;
  color: #F87171 !important;
  animation: ws-alert 1.6s var(--ease-out) infinite;
}
@keyframes ws-alert {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, .45); }
  50% { box-shadow: 0 0 0 calc(5px * var(--ui-scale, 1)) rgba(239, 68, 68, 0); }
}
.ws-open { display: inline-flex; align-items: center; gap: calc(7px * var(--ui-scale, 1)); }
.ws-open-dot {
  width: calc(8px * var(--ui-scale, 1)); height: calc(8px * var(--ui-scale, 1)); border-radius: 50%;
  background: var(--muted, #98a2b3);
  transition: background-color var(--dur-slow) var(--ease-out);
}
.ws-open[data-health="ok"] .ws-open-dot { background: #22C55E; }
.ws-open[data-health="warning"] .ws-open-dot { background: #EAB308; }
.ws-open[data-health="error"] .ws-open-dot { background: #EF4444; animation: ws-alert 1.6s var(--ease-out) infinite; }

/* Worker pills in the table: the same pill as the top bar, not clickable. */
.mbn-link-status[data-state="off"] .mbn-link-dot { background: #98a2b3; box-shadow: 0 0 0 calc(2px * var(--ui-scale, 1)) rgba(152, 162, 179, .2); }
.mbn-link-status[data-state="unknown"] .mbn-link-dot { background: #d97706; box-shadow: 0 0 0 calc(2px * var(--ui-scale, 1)) rgba(217, 119, 6, .22); }
.mbn-link-dot { transition: background-color var(--dur-slow) var(--ease-out), box-shadow var(--dur-slow) var(--ease-out); }

.worker-status-page .ws-summary { padding: calc(16px * var(--ui-scale, 1)) calc(18px * var(--ui-scale, 1)); margin-bottom: calc(14px * var(--ui-scale, 1)); }
.ws-summary-head { display: flex; align-items: center; gap: calc(12px * var(--ui-scale, 1)); }
.ws-summary-head strong { display: block; font-size: calc(15px * var(--ui-scale, 1)); color: var(--ink); }
.ws-summary-head small { display: block; margin-top: calc(2px * var(--ui-scale, 1)); color: var(--muted); font-size: calc(12px * var(--ui-scale, 1)); }
.ws-level {
  flex: 0 0 auto; width: calc(14px * var(--ui-scale, 1)); height: calc(14px * var(--ui-scale, 1)); border-radius: 50%;
  background: #22C55E; box-shadow: 0 0 0 calc(4px * var(--ui-scale, 1)) rgba(34, 197, 94, .2);
  transition: background-color var(--dur-slow) var(--ease-out), box-shadow var(--dur-slow) var(--ease-out);
}
.ws-level[data-level="warning"] { background: #EAB308; box-shadow: 0 0 0 calc(4px * var(--ui-scale, 1)) rgba(234, 179, 8, .22); }
.ws-level[data-level="error"] { background: #EF4444; box-shadow: 0 0 0 calc(4px * var(--ui-scale, 1)) rgba(239, 68, 68, .22); animation: ws-alert 1.6s var(--ease-out) infinite; }
.ws-issues { list-style: none; margin: calc(12px * var(--ui-scale, 1)) 0 0; padding: 0; display: grid; gap: calc(6px * var(--ui-scale, 1)); }
.ws-issues:empty { display: none; }
.ws-issue {
  display: flex; flex-wrap: wrap; gap: calc(4px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1)); align-items: baseline;
  padding: calc(9px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1));
  border-radius: calc(12px * var(--ui-scale, 1));
  border-left: calc(3px * var(--ui-scale, 1)) solid #EAB308;
  background: rgba(234, 179, 8, .1);
  font-size: calc(13px * var(--ui-scale, 1)); color: var(--ink);
}
.ws-issue[data-level="error"] { border-left-color: #EF4444; background: rgba(239, 68, 68, .1); }
.ws-issue strong { font-weight: 700; }
.ws-panel { padding: 0; overflow: hidden; }
.ws-table-wrap { overflow-x: auto; }
.ws-table { width: 100%; border-collapse: collapse; font-size: calc(13px * var(--ui-scale, 1)); }
.ws-table thead th {
  text-align: left; font-size: calc(11px * var(--ui-scale, 1)); letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; padding: calc(12px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1));
  border-bottom: calc(1px * var(--ui-scale, 1)) solid var(--line);
}
.ws-table tbody th, .ws-table tbody td {
  text-align: left; vertical-align: middle; font-weight: 400;
  padding: calc(12px * var(--ui-scale, 1)) calc(16px * var(--ui-scale, 1));
  border-bottom: calc(1px * var(--ui-scale, 1)) solid var(--line);
}
.ws-table tbody tr:last-child > * { border-bottom: 0; }
.ws-table tbody tr { transition: background-color var(--dur-base) var(--ease-out); }
.ws-table tbody tr:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
.ws-table tbody tr[data-level="warning"] { background: rgba(234, 179, 8, .07); }
.ws-agent { display: flex; align-items: center; gap: calc(10px * var(--ui-scale, 1)); }
.ws-agent strong { display: block; color: var(--ink); font-weight: 700; }
.ws-agent small { display: block; color: var(--muted); font-size: calc(11.5px * var(--ui-scale, 1)); margin-top: calc(1px * var(--ui-scale, 1)); }
.ws-table .ws-pill { pointer-events: none; cursor: default; }
.ws-pill-text { display: block; margin-top: calc(4px * var(--ui-scale, 1)); color: var(--muted); font-size: calc(11px * var(--ui-scale, 1)); max-width: calc(180px * var(--ui-scale, 1)); }
.ws-pill[data-state="up"] + .ws-pill-text { display: none; }
.ws-problem span { display: block; color: var(--ink); }
.ws-problem span + span { margin-top: calc(3px * var(--ui-scale, 1)); }
.ws-problem .ws-ok { color: var(--muted); }
.ws-login-limit { display: flex; align-items: center; flex-wrap: wrap; gap: calc(6px * var(--ui-scale, 1)); margin-top: calc(6px * var(--ui-scale, 1)); }
.ws-login-limit small { color: var(--muted); font-size: calc(11px * var(--ui-scale, 1)); font-weight: 700; }
.ws-login-limit.is-blocked small { color: var(--red); }
.ws-login-reset { min-height: calc(26px * var(--ui-scale, 1)); height: calc(26px * var(--ui-scale, 1)); padding: 0 calc(10px * var(--ui-scale, 1)); font-size: calc(12px * var(--ui-scale, 1)); }
.ws-empty td { text-align: center; color: var(--muted); padding: calc(28px * var(--ui-scale, 1)); }
@media (prefers-reduced-motion: reduce) {
  html:root .sidebar-header-actions #btn-admin-settings[data-health="error"], .ws-open[data-health="error"] .ws-open-dot, .ws-level[data-level="error"] { animation: none !important; }
}
.ws-agent.is-app-closed small { font-style: italic; }
/* In the app without a line: listed for the administrator, never a problem. */
#worker-status-rows tr[data-off-line] :is(.ws-agent strong, td) { opacity: .72; }
.ws-problem .ws-off-line { color: var(--muted); font-style: italic; }
/* Linje (administrators): Logg av / Logg på linje ▾ with the agent's lines. */
#worker-status-rows tr[data-off-line] td.ws-line-cell { opacity: 1; }
.ws-line-actions { display: flex; flex-wrap: wrap; gap: calc(6px * var(--ui-scale, 1)); align-items: center; }
.ws-line-btn { min-height: calc(28px * var(--ui-scale, 1)); height: calc(28px * var(--ui-scale, 1)); padding: 0 calc(10px * var(--ui-scale, 1)); font-size: calc(12px * var(--ui-scale, 1)); white-space: nowrap; }
/* Opens inside the row: the table scrolls sideways, so a floating menu was cut off. */
.ws-line-menu {
  flex: 1 0 100%;
  display: flex; flex-direction: column; min-width: calc(220px * var(--ui-scale, 1));
  padding: calc(6px * var(--ui-scale, 1)); border-radius: calc(14px * var(--ui-scale, 1));
  background: var(--surface, #FFFFFF); border: calc(1px * var(--ui-scale, 1)) solid var(--line);
}
.ws-line-menu[hidden] { display: none; }
.ws-line-option {
  text-align: left; border: 0; background: transparent; color: var(--ink); cursor: pointer;
  padding: calc(8px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1)); border-radius: calc(9px * var(--ui-scale, 1));
  font-size: calc(13px * var(--ui-scale, 1));
}
.ws-line-option:hover, .ws-line-option:focus-visible { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.ws-line-option.is-current { font-weight: 700; }

/* E-post composer footer: the emoji button is icon only. With its label it slid
   under "Lukk sak" at medium widths. The title and aria-label still say Emoji. */
#email-tab .et-composer-v2 #btn-email-emoji .et-tool-label { display: none !important; }
#email-tab .et-composer-v2 #btn-email-emoji {
  padding-left: calc(9px * var(--ui-scale, 1)) !important;
  padding-right: calc(9px * var(--ui-scale, 1)) !important;
  justify-content: center !important;
}
/* When the composer is narrow, the tools on the left of its footer show only
   their icons, so they never slide under Lukk sak / Send; when even that does not
   fit, the footer takes two rows. Each tool keeps its title. */
#email-tab .et-composer-v2 { container-type: inline-size; container-name: rh-email-composer; }
#email-tab .et-composer-v2 .email-compose-tools { min-width: 0; }
@container rh-email-composer (max-width: 700px) {
  #email-tab .et-composer-v2 .email-compose-tools .et-tool-label { display: none !important; }
  #email-tab .et-composer-v2 .email-compose-tools .et-foot-tool {
    padding-left: calc(9px * var(--ui-scale, 1)) !important;
    padding-right: calc(9px * var(--ui-scale, 1)) !important;
    justify-content: center !important;
  }
}
@container rh-email-composer (max-width: 400px) {
  #email-tab .et-composer-v2 .email-composer-actions { flex-wrap: wrap !important; row-gap: calc(8px * var(--ui-scale, 1)) !important; }
  #email-tab .et-composer-v2 .email-compose-submit { margin-left: auto !important; }
}

/* The newer menu drag handle (theme-boot.js) is shown only by the themes that use
   it (Lavendel, Lime); elsewhere it must not sit invisibly over the menu edge. */
.lav-resize-handle { display: none; }

/* Meldinger: SMS channel next to Send (Zisson / MBN). A small segmented pill;
   white when unselected (dark text) and black when selected (white text) in
   every theme. MBN greys out while it is paused on the server. */
html .sms-channel-toggle {
  --rh-pill-bg: #111 !important;
  display: inline-flex;
  align-items: center;
  gap: calc(2px * var(--ui-scale, 1));
  padding: calc(3px * var(--ui-scale, 1));
  border-radius: 999px;
  border: calc(1px * var(--ui-scale, 1)) solid #d4d4d8;
  background: #fff !important;
  align-self: center;
}
html .sms-channel-toggle > .rh-seg-pill {
  background: #111 !important;
  box-shadow: none !important;
}
html .sms-channel-btn {
  border: 0;
  background: transparent;
  color: #111 !important;
  font: 600 calc(12px * var(--ui-scale, 1))/1 var(--font);
  padding: calc(6px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1));
  border-radius: 999px;
  cursor: pointer;
  transition: color var(--dur-base) var(--ease-out);
}
html .sms-channel-btn.active { color: #fff !important; }
html .sms-channel-toggle:not(.rh-seg-ready) .sms-channel-btn.active { background: #111 !important; }
html .sms-channel-btn:disabled { color: #9ca3af !important; opacity: .75; cursor: not-allowed; }
.sms-channel-btn:focus-visible { outline: 2px solid var(--rh-accent, #B05C84); outline-offset: 2px; }
@media (min-width: 901px) {
  #sms-tab .sms-composer .sms-channel-toggle { order: 3; margin-left: auto; }
  #sms-tab .sms-composer .send-action-wrap { order: 4; margin-left: calc(8px * var(--ui-scale, 1)); }
}

/* MBN paused (MBN_PAUSED, set by mbn.js as html[data-mbn-paused]): the MBN pill
   is gone for everyone. The `hidden` attribute alone lost against the pill's
   display:flex in every theme. */
html[data-mbn-paused] #mbn-link-status,
html[data-mbn-paused] .mbn-link-status[data-tab="telefoni-tab"] { display: none !important; }

/* E-post on a laptop screen (2026-11-12, Tony at 1366x768): header + history +
   composer were 70-145 px taller than the case panel. The panel clips, so the
   writing field fell below its edge and the sticky footer (Lukk sak, Send) sat
   on top of it: a click hit the footer, the typing went to the search bar and
   paste had nowhere to go. The composer always fits now: the history gives way
   first (down to 56 px), then fitEmailComposer() (app.js) lowers the editor by
   exactly what is missing (--et-editor-fit). Shared by every theme. */
@media (min-width: 901px) {
  #email-tab .email-inbox-layout #email-chat-history { min-height: calc(56px * var(--ui-scale, 1)) !important; }
  #email-tab .et-composer-v2:not(.composer-expanded) .email-rich-editor.et-editor-fitted {
    min-height: min(64px, var(--et-editor-fit)) !important;
    max-height: min(170px, 22vh, var(--et-editor-fit)) !important;
  }
}

/* A plain-text e-mail (Yahoo and others) arrives as <pre> or with
   white-space: pre: it kept the sender's typewriter font and one line per
   paragraph, running out of the card to the right. It now wraps inside the
   card, keeps its line breaks and uses the same font as every other e-mail. */
.email-body-html pre,
.email-body-html [style*="white-space: pre"],
.email-body-html [style*="white-space:pre"] {
  white-space: pre-wrap !important;
  overflow-wrap: anywhere;
  max-width: 100%;
}
.email-body-html pre {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  margin: 0;
}

/* Meldinger: a conversation like on a phone, in every theme. Received SMS sit
   left in a soft bubble, ours sit right in the theme's colour; each bubble is
   a rounded cloud with a small tail at its bottom corner. The tail is the
   bubble's own colour (background: inherit) cut into a curve by a mask, so it
   follows every theme without a colour of its own. Lime and Lavendel light had
   a white received bubble on a white page, which showed as plain text. */
#sms-chat-history .message-row { gap: 0; }
#sms-chat-history .message-row .message-bubble {
  position: relative;
  padding: calc(9px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1));
  border-radius: calc(20px * var(--ui-scale, 1)) calc(20px * var(--ui-scale, 1)) calc(20px * var(--ui-scale, 1)) calc(4px * var(--ui-scale, 1));
  box-shadow: none;
  overflow-wrap: anywhere;
}
#sms-chat-history .message-row.agent .message-bubble {
  border-radius: calc(20px * var(--ui-scale, 1)) calc(20px * var(--ui-scale, 1)) calc(4px * var(--ui-scale, 1)) calc(20px * var(--ui-scale, 1));
}
#sms-chat-history .message-row .message-bubble::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: calc(-10px * var(--ui-scale, 1));
  width: calc(20px * var(--ui-scale, 1));
  height: calc(22px * var(--ui-scale, 1));
  background: inherit;
  border-radius: 0;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 22'%3E%3Cpath d='M10 3C10 12.5 6.5 18.6 0.6 21.3Q0 21.7 0.9 22H20V3Z'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 22'%3E%3Cpath d='M10 3C10 12.5 6.5 18.6 0.6 21.3Q0 21.7 0.9 22H20V3Z'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat;
  pointer-events: none;
}
#sms-chat-history .message-row.agent .message-bubble::after {
  left: auto;
  right: calc(-10px * var(--ui-scale, 1));
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 22'%3E%3Cpath d='M10 3C10 12.5 13.5 18.6 19.4 21.3Q20 21.7 19.1 22H0V3Z'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 22'%3E%3Cpath d='M10 3C10 12.5 13.5 18.6 19.4 21.3Q20 21.7 19.1 22H0V3Z'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat;
}
#sms-chat-history .message-row:not(.agent) > div { padding-left: calc(10px * var(--ui-scale, 1)); }
#sms-chat-history .message-row.agent > div { padding-right: calc(10px * var(--ui-scale, 1)); }
/* Received bubbles that were white on a white page. */
html[data-theme-name="lime"]:not([data-theme="dark"]) #sms-chat-history .message-row:not(.agent) .message-bubble { background: #ECECF0; color: #141414; }
html[data-theme-name="lavendel"]:not([data-theme="dark"]) #sms-chat-history .message-row:not(.agent) .message-bubble { background: #ECECF3; color: #1C1C1C; }
/* Lime dark sends in a gradient: the tail takes its end colour. */
html[data-theme-name="lime"][data-theme="dark"] #sms-chat-history .message-row.agent .message-bubble::after { background: #A6E034 !important; }

/* E-post Til/CC/BCC: the list that completes an address while it is typed. */
.email-address-suggest {
  position: fixed;
  z-index: 2147483000;
  max-height: calc(320px * var(--ui-scale, 1));
  overflow-y: auto;
  padding: calc(5px * var(--ui-scale, 1));
  border: 1px solid #e4e7ec;
  border-radius: calc(12px * var(--ui-scale, 1));
  background: #fff;
  color: #1c1c1c;
  box-shadow: 0 calc(14px * var(--ui-scale, 1)) calc(34px * var(--ui-scale, 1)) rgba(15, 23, 42, .18);
}
.email-address-suggest[hidden] { display: none; }
.email-address-option {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: calc(7px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
  border-radius: calc(9px * var(--ui-scale, 1));
  cursor: pointer;
  font-size: calc(12.5px * var(--ui-scale, 1));
  line-height: 1.3;
}
.email-address-option strong { font-weight: 650; }
.email-address-option span { color: #667085; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.email-address-option strong + span { font-size: calc(11.5px * var(--ui-scale, 1)); }
.email-address-option:hover,
.email-address-option.active { background: rgba(var(--rh-accent-rgb, 13, 107, 92), .12); }
html[data-theme="dark"] .email-address-suggest { background: #1f1f23; border-color: #34343c; color: #f2f2f4; box-shadow: 0 calc(14px * var(--ui-scale, 1)) calc(34px * var(--ui-scale, 1)) rgba(0, 0, 0, .5); }
html[data-theme="dark"] .email-address-option span { color: #a4a4ae; }
html[data-theme="dark"] .email-address-option:hover,
html[data-theme="dark"] .email-address-option.active { background: rgba(var(--rh-accent-rgb, 94, 234, 212), .18); }

/* E-post Videresend: the forwarded message(s), inside the composer under the
   comment, read-only, the way they reach the recipient. */
.email-forward-preview {
  box-sizing: border-box;
  width: auto !important;
  max-width: calc(100% - (28px * var(--ui-scale, 1)));
  margin: calc(4px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1));
  max-height: calc(240px * var(--ui-scale, 1));
  overflow-y: auto;
  border: 1px solid rgba(var(--rh-accent-rgb, 13, 107, 92), .35);
  border-left: calc(4px * var(--ui-scale, 1)) solid rgba(var(--rh-accent-rgb, 13, 107, 92), .85);
  border-radius: calc(12px * var(--ui-scale, 1));
  background: rgba(var(--rh-accent-rgb, 13, 107, 92), .05);
  font-size: calc(12.5px * var(--ui-scale, 1));
}
.email-forward-preview.hidden { display: none; }
.email-forward-preview .efp-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(8px * var(--ui-scale, 1));
  padding: calc(7px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1));
  background: inherit;
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(var(--rh-accent-rgb, 13, 107, 92), .2);
}
.email-forward-preview .efp-title { font-weight: 700; }
.email-forward-preview .efp-remove {
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: calc(2px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: calc(11.5px * var(--ui-scale, 1));
  opacity: .75;
  cursor: pointer;
}
.email-forward-preview .efp-remove:hover { opacity: 1; }
.email-forward-preview .efp-message { padding: calc(8px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)); }
.email-forward-preview .efp-message + .efp-message { border-top: 1px dashed rgba(var(--rh-accent-rgb, 13, 107, 92), .3); }
.email-forward-preview .efp-meta { display: grid; gap: 1px; opacity: .8; margin-bottom: calc(6px * var(--ui-scale, 1)); }
.email-forward-preview .efp-body { padding: 0 !important; font-size: inherit !important; }
.email-forward-preview .efp-files { margin-top: calc(6px * var(--ui-scale, 1)); font-weight: 600; opacity: .8; }
html[data-theme="dark"] .email-forward-preview { background: rgba(var(--rh-accent-rgb, 94, 234, 212), .08); }
html[data-theme="dark"] .email-forward-preview .efp-head { background: #1b1b20; }
html:not([data-theme="dark"]) .email-forward-preview .efp-head { background: #fff; }

/* A table in an e-mail (pasted from Excel or Outlook) keeps its own columns:
   words are not broken inside a cell, and a table wider than the card scrolls
   sideways inside the message instead of being squeezed. */
.email-body-html { overflow-x: auto; }
.email-body-html table { border-collapse: collapse; max-width: none; }
.email-body-html :is(td, th) {
  overflow-wrap: normal;
  word-break: normal;
}
.email-body-html :is(td, th) p { margin: 0; }

/* Composer height (E-post, Meldinger): a handle on the composer's top edge,
   same look as the column resizers. A chosen height wins over the standard
   limits; in E-post the fit still trims it when the window has no room. */
.email-composer,
#sms-tab .sms-composer { position: relative; }
.composer-height-resizer {
  position: absolute;
  top: 0;
  left: calc(16px * var(--ui-scale, 1));
  right: calc(16px * var(--ui-scale, 1));
  height: calc(10px * var(--ui-scale, 1));
  transform: translateY(-50%);
  cursor: row-resize;
  z-index: 25;
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
}
.composer-height-resizer::after {
  content: "";
  width: calc(40px * var(--ui-scale, 1));
  height: calc(4px * var(--ui-scale, 1));
  border-radius: 999px;
  background: var(--line, #d0d5dd);
  opacity: .8;
  transition: background-color .15s ease, width .15s ease, opacity .15s ease;
}
.composer-height-resizer:hover::after,
.composer-height-resizer:focus-visible::after,
.composer-height-resizer.is-dragging::after {
  width: calc(64px * var(--ui-scale, 1));
  background: var(--rh-accent, var(--blue, #0d6b5c));
  opacity: 1;
}
body.rh-resizing-composer,
body.rh-resizing-composer * { cursor: row-resize !important; user-select: none !important; }
html #email-tab .email-composer:not(.composer-expanded) #email-text-input.rh-editor-sized {
  height: min(var(--rh-editor-h), var(--et-editor-fit, 100000px)) !important;
  min-height: min(var(--rh-editor-h), var(--et-editor-fit, 100000px)) !important;
  max-height: min(var(--rh-editor-h), var(--et-editor-fit, 100000px)) !important;
  overflow-y: auto;
}
html #sms-tab .sms-composer #sms-text-input.rh-editor-sized {
  height: var(--rh-editor-h) !important;
  min-height: var(--rh-editor-h) !important;
  max-height: var(--rh-editor-h) !important;
}
html #sms-tab .sms-composer #sms-text-input { resize: none !important; }
@media (max-width: 900px) {
  .composer-height-resizer { display: none; }
}

/* Zisson list in the menu: a tick for colleagues who have RelayHub open. A
   colleague signed in without a line who is at RelayHub shows a ticked circle
   ("I RelayHub · ingen linje"); one signed in to Zisson only keeps the plain
   mark. Signed in, in the app or in Zisson, but not on a line: the row, the
   status pill and the timer are grey. The green tick stays only for those
   with RelayHub open. */
.agent-app-tick {
  position: absolute;
  top: calc(-4px * var(--ui-scale, 1));
  right: calc(-5px * var(--ui-scale, 1));
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: calc(12px * var(--ui-scale, 1));
  height: calc(12px * var(--ui-scale, 1));
  border-radius: 50%;
  background: #22a35a;
  color: #fff;
  box-shadow: 0 0 0 calc(2px * var(--ui-scale, 1)) var(--sidebar, #111);
}
.agent-app-tick svg { width: 72%; height: 72%; fill: none; stroke: currentColor; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
#primary-sidebar #agents-list .agent-mini.agent-no-line,
#primary-sidebar #agents-list .agent-mini[data-zisson-state="connected_idle"],
#primary-sidebar #agents-list .agent-mini[data-zisson-state="app_idle"] {
  --agent-state-color: #8b96a0;
  --agent-state-bg: rgba(139, 150, 160, .14);
}
#primary-sidebar #agents-list .agent-mini.agent-no-line strong,
#primary-sidebar #agents-list .agent-mini.agent-no-line .colleague-call-btn {
  color: #9aa3ab;
}
.zisson-mini-state[data-state="connected_idle"],
.zisson-mini-state[data-state="app_idle"] { color: #8b96a0; font-weight: 600; }
.agent-avatar.connected_idle:after,
.agent-avatar.app_idle:after { background: #8b96a0; }
#primary-sidebar #agents-list .agent-mini.agent-no-line .agent-app-tick {
  background: #22a35a;
  color: #fff;
}

/* Daily greeting: the heading keeps the size of every other page heading,
   with the positive line tucked right under it. */
#dashboard-tab .page-heading h1 {
  line-height: 1.15;
  margin-bottom: 0;
}
#dashboard-tab .page-heading h1 .greeting-daily-line {
  display: block;
  margin-top: calc(7px * var(--ui-scale, 1));
  font: 600 calc(14px * var(--ui-scale, 1)) var(--display);
  letter-spacing: 0;
  line-height: 1.3;
  color: var(--muted);
}
#dashboard-tab .page-heading h1 .greeting-daily-line::before {
  content: '\2726';
  margin-right: calc(9px * var(--ui-scale, 1));
  color: var(--blue);
  font-size: 0.85em;
}

/* Stavekontroll (public/spellcheck.js): a red wavy line under a misspelled
   word in the SMS and e-post composers; clicking it opens the suggestions.
   The SMS field is a textarea, so a transparent copy of its text lies on top
   of it and shows only the lines. Same in every theme. */
:root { --rh-spell-line: #e5484d; }
html[data-theme="dark"] { --rh-spell-line: #ff7a7f; }
::highlight(rh-spell) {
  text-decoration: underline wavy var(--rh-spell-line);
  text-decoration-skip-ink: none;
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
}
.rh-spell-mirror {
  position: absolute;
  z-index: 2;
  margin: 0;
  overflow: hidden;
  border-style: solid;
  border-color: transparent;
  background: transparent;
  color: transparent;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: normal;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
}
.rh-spell-mirror:empty { display: none; }
.rh-spell-bad {
  color: transparent;
  text-decoration: underline wavy var(--rh-spell-line);
  text-decoration-skip-ink: none;
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
}
.rh-spell-menu {
  position: fixed;
  z-index: 2147483000;
  min-width: calc(190px * var(--ui-scale, 1));
  max-width: min(calc(300px * var(--ui-scale, 1)), calc(100vw - 16px));
  padding: calc(5px * var(--ui-scale, 1));
  border: 1px solid #e4e7ec;
  border-radius: calc(12px * var(--ui-scale, 1));
  background: #fff;
  color: #1c1c1c;
  box-shadow: 0 calc(14px * var(--ui-scale, 1)) calc(34px * var(--ui-scale, 1)) rgba(15, 23, 42, .18);
  font-size: calc(12.5px * var(--ui-scale, 1));
  line-height: 1.3;
}
.rh-spell-menu[hidden] { display: none; }
.rh-spell-head {
  padding: calc(6px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1)) calc(5px * var(--ui-scale, 1));
  color: #667085;
  font-size: calc(11.5px * var(--ui-scale, 1));
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rh-spell-head strong { color: var(--rh-spell-line); font-weight: 650; }
.rh-spell-note {
  padding: calc(7px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
  color: #667085;
  font-style: italic;
}
.rh-spell-option {
  display: block;
  width: 100%;
  padding: calc(7px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
  border: 0;
  border-radius: calc(9px * var(--ui-scale, 1));
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.rh-spell-suggestion { font-weight: 650; }
.rh-spell-option:hover,
.rh-spell-option:focus-visible { background: rgba(var(--rh-accent-rgb, 13, 107, 92), .12); outline: 0; }
.rh-spell-divider { height: 1px; margin: calc(4px * var(--ui-scale, 1)) calc(6px * var(--ui-scale, 1)); background: #e4e7ec; }
html[data-theme="dark"] .rh-spell-menu { background: #1f1f23; border-color: #34343c; color: #f2f2f4; box-shadow: 0 calc(14px * var(--ui-scale, 1)) calc(34px * var(--ui-scale, 1)) rgba(0, 0, 0, .5); }
html[data-theme="dark"] .rh-spell-head,
html[data-theme="dark"] .rh-spell-note { color: #a4a4ae; }
html[data-theme="dark"] .rh-spell-divider { background: #34343c; }
html[data-theme="dark"] .rh-spell-option:hover,
html[data-theme="dark"] .rh-spell-option:focus-visible { background: rgba(var(--rh-accent-rgb, 94, 234, 212), .18); }

/* E-post: every sent message says where it went, on the right of its header
   ("Sendt svar til kunde@…"). A reply that went to our own inbox is red. */
html .email-message-card-head .et-msg-header-inline > .et-msg-role-tag.has-recipient,
html .email-message-card-head .et-msg-header-inline > .et-msg-role-tag.is-wrong-recipient,
html .email-message-card-head .et-msg-header-inline > .et-msg-role-tag.is-unknown-recipient {
  display: inline-block;
  max-width: min(100%, calc(440px * var(--ui-scale, 1)));
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
html .et-msg-role-tag .et-sent-to-addr { display: inline; font-weight: 800; color: inherit; }
/* A sent message with copies names every address: the tag wraps instead of
   cutting the copies off (2026-11-20). */
html .email-message-card-head .et-msg-header-inline > .et-msg-role-tag.has-recipient.has-copy,
html .email-message-card-head .et-msg-header-inline > .et-msg-role-tag.is-wrong-recipient:has(.et-sent-copy) {
  max-width: min(100%, calc(640px * var(--ui-scale, 1)));
  white-space: normal;
  overflow-wrap: anywhere;
  text-overflow: clip;
  line-height: 1.45;
  /* A full pill cuts the ends of a wrapped line. */
  border-radius: calc(10px * var(--ui-scale, 1));
}
/* The header rules give every span its own line and the muted colour; the
   copy stays inline, in the colour of the tag. */
html .email-message-card-head .et-msg-role-tag .et-sent-copy { display: inline; margin: 0; color: inherit; font-size: inherit; }
html .email-message-card-head .et-msg-role-tag.is-outbound.has-recipient { background: #d1fae5; color: #047857; }
html .email-message-card-head .et-msg-role-tag.is-outbound.is-wrong-recipient { background: #fee2e2; color: #b42318; }
html .email-message-card-head .et-msg-role-tag.is-outbound.is-unknown-recipient { background: #eef0f3; color: #5d6673; font-weight: 600; }
html[data-theme="dark"] .email-message-card-head .et-msg-role-tag.is-outbound.has-recipient { background: rgba(16, 185, 129, .16); color: #6ee7b7; }
html[data-theme="dark"] .email-message-card-head .et-msg-role-tag.is-outbound.is-wrong-recipient { background: rgba(248, 113, 113, .18); color: #fca5a5; }
html[data-theme="dark"] .email-message-card-head .et-msg-role-tag.is-outbound.is-unknown-recipient { background: rgba(255, 255, 255, .08); color: #b4b9c2; }
html[data-theme="dark"] .email-message-card-head .et-msg-role-tag.is-inbound { background: rgba(59, 130, 246, .18); color: #93c5fd; }

/* E-post with no case open: an empty start page. No case header, no composer
   (it would show the previous case's Til/Emne), only a centred "Ny e-post". */
#email-tab .et-case-panel.is-empty-case > .et-case-header,
#email-tab .et-case-panel.is-empty-case > .et-composer-dock { display: none !important; }
#email-tab .et-case-panel.is-empty-case > #email-chat-history {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  padding: calc(32px * var(--ui-scale, 1)) calc(20px * var(--ui-scale, 1));
}
.et-empty-start {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: calc(380px * var(--ui-scale, 1));
  text-align: center;
}
.et-empty-start-icon {
  display: grid;
  place-items: center;
  width: calc(76px * var(--ui-scale, 1));
  height: calc(76px * var(--ui-scale, 1));
  margin-bottom: calc(18px * var(--ui-scale, 1));
  border-radius: 50%;
  background: rgba(var(--rh-accent-rgb, 13, 107, 92), .1);
  color: rgb(var(--rh-accent-rgb, 13, 107, 92));
}
.et-empty-start-icon svg { width: calc(34px * var(--ui-scale, 1)); height: calc(34px * var(--ui-scale, 1)); }
.et-empty-start h3 {
  margin: 0 0 calc(6px * var(--ui-scale, 1));
  font-size: calc(20px * var(--ui-scale, 1));
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--ink);
}
.et-empty-start p {
  margin: 0 0 calc(24px * var(--ui-scale, 1));
  font-size: calc(14px * var(--ui-scale, 1));
  line-height: 1.5;
  color: var(--muted);
}
html .et-empty-start .et-empty-new-email {
  display: inline-flex;
  align-items: center;
  gap: calc(8px * var(--ui-scale, 1));
  min-height: calc(52px * var(--ui-scale, 1));
  padding: 0 calc(30px * var(--ui-scale, 1));
  border-radius: 999px;
  font-size: calc(16px * var(--ui-scale, 1));
  font-weight: 700;
  box-shadow: 0 calc(10px * var(--ui-scale, 1)) calc(26px * var(--ui-scale, 1)) rgba(15, 23, 42, .16);
}
.et-empty-start .et-empty-new-email span { font-size: 1.15em; line-height: 1; }
html[data-theme="dark"] .et-empty-start-icon { background: rgba(var(--rh-accent-rgb, 94, 234, 212), .16); color: rgb(var(--rh-accent-rgb, 94, 234, 212)); }
html[data-theme="dark"] .et-empty-start .et-empty-new-email { box-shadow: 0 calc(10px * var(--ui-scale, 1)) calc(26px * var(--ui-scale, 1)) rgba(0, 0, 0, .45); }

/* Meldinger with no conversation open: the same empty start page as E-post. */
#sms-tab .conversation-panel.is-empty-conversation > .sms-conversation-head,
#sms-tab .conversation-panel.is-empty-conversation > #sms-quick-reply-bar,
#sms-tab .conversation-panel.is-empty-conversation > .sms-composer { display: none !important; }
#sms-tab .conversation-panel.is-empty-conversation > #sms-chat-history {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  padding: calc(32px * var(--ui-scale, 1)) calc(20px * var(--ui-scale, 1));
}

/* Sign-in confirmation in the middle of the screen (login-progress.js), after
   the progress bar on the MBN, Zisson or Socialboards page reached 100 %: the
   drawn check of a sent SMS, large, with "Du er logget inn nå!". */
.rh-login-progress[data-state="done"] .zisson-progress-bar { background: var(--rh-success); }
.rh-login-progress[data-state="done"] .zisson-progress-spinner { animation: none; border-color: var(--rh-success); }
.rh-login-done {
  position: fixed; inset: 0; z-index: 2600; display: grid; place-items: center;
  pointer-events: none; opacity: 0; transition: opacity var(--dur-base) var(--ease-out);
}
.rh-login-done.is-shown { opacity: 1; }
.rh-login-done.is-leaving { opacity: 0; transition-duration: var(--dur-slow); }
.rh-login-done-card {
  display: grid; justify-items: center; gap: calc(14px * var(--ui-scale, 1));
  min-width: calc(240px * var(--ui-scale, 1)); max-width: calc(100vw - 32px);
  padding: calc(28px * var(--ui-scale, 1)) calc(36px * var(--ui-scale, 1));
  border-radius: calc(24px * var(--ui-scale, 1)); background: var(--surface); color: var(--ink);
  border: calc(1px * var(--ui-scale, 1)) solid var(--line);
  box-shadow: 0 24px 60px rgba(15, 23, 42, .22);
  scale: .94; transition: scale var(--dur-slow) var(--ease-spring);
}
.rh-login-done.is-shown .rh-login-done-card { scale: 1; }
.rh-login-done-mark {
  width: calc(72px * var(--ui-scale, 1)); height: calc(72px * var(--ui-scale, 1));
  display: grid; place-items: center; border-radius: 50%;
  background: var(--rh-success); color: #fff;
  box-shadow: 0 0 0 calc(8px * var(--ui-scale, 1)) var(--rh-success-soft);
}
.rh-login-done-mark svg { width: 58%; height: 58%; }
.rh-login-done-mark path { stroke-dasharray: 24; stroke-dashoffset: 24; }
.rh-login-done.is-shown .rh-login-done-mark path { stroke-dashoffset: 0; transition: stroke-dashoffset var(--dur-draw) var(--ease-out) 120ms; }
.rh-login-done-card strong { font: 800 calc(18px * var(--ui-scale, 1)) var(--display); letter-spacing: -.01em; text-align: center; }
html[data-theme="dark"] .rh-login-done-card { box-shadow: 0 24px 60px rgba(0, 0, 0, .55); }
html[data-theme-name="lime"] .rh-login-done-mark { background: var(--lm-grad); color: #141414; }
html[data-theme-name="lime"] .rh-login-progress[data-state="done"] .zisson-progress-bar { background: var(--lm-grad); }
@media (prefers-reduced-motion: reduce) {
  .rh-login-done-card { scale: 1; transition: none; }
  .rh-login-done-mark path { stroke-dashoffset: 0; }
}
/* The sign-in bar in dark mode: dark surface, readable text (it was light-only). */
html[data-theme="dark"] .zisson-progress-container { background: rgba(16, 185, 129, .08); border-color: rgba(16, 185, 129, .28); }
html[data-theme="dark"] .zisson-progress-title { color: #A7F3D0; }
html[data-theme="dark"] .zisson-progress-percent { color: #6EE7B7; }
html[data-theme="dark"] .zisson-progress-track { background: rgba(255, 255, 255, .08); }
html[data-theme="dark"] .zisson-progress-detail { color: #A3B8AE; }
html[data-theme="dark"] .zisson-progress-spinner { border-color: #34D399; border-top-color: transparent; }
html[data-theme="dark"] .zisson-progress-container[data-state="error"] { background: rgba(220, 38, 38, .1); border-color: rgba(248, 113, 113, .3); }
html[data-theme="dark"] .zisson-progress-container[data-state="error"] :is(.zisson-progress-title, .zisson-progress-percent) { color: #FCA5A5; }
html[data-theme="dark"] .zisson-progress-container[data-state="error"] .zisson-progress-track { background: rgba(248, 113, 113, .16); }

/* ---------------------------------------------------------------------------
   Kundekort 360° in E-post and Meldinger (2026-11-18): a close bar on every
   screen, the Meldinger panel as a third column, and the contact form inside
   the card. Colours come from the theme tokens, so all six themes and dark
   mode follow.
   --------------------------------------------------------------------------- */
@media (min-width: 901px) {
  .et-inspector-panel .et-inspector-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: calc(8px * var(--ui-scale, 1));
    padding: calc(8px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1));
    border-bottom: calc(1px * var(--ui-scale, 1)) solid var(--line);
    background: var(--canvas);
    position: sticky;
    top: 0;
    z-index: 2;
  }
  .et-inspector-panel .et-inspector-bar strong {
    font-size: calc(12px * var(--ui-scale, 1));
    font-weight: 800;
    color: var(--ink);
  }
  .et-inspector-panel .et-inspector-bar .et-mobile-inspector-close {
    min-height: calc(26px * var(--ui-scale, 1));
    padding: calc(2px * var(--ui-scale, 1)) calc(9px * var(--ui-scale, 1));
    font-size: calc(11px * var(--ui-scale, 1));
    font-weight: 700;
  }

  #sms-tab .inbox-layout:has(#sms-inspector-panel:not(.hidden)) {
    grid-template-columns: var(--sms-list-width, calc(265px * var(--ui-scale, 1))) minmax(0, 1fr) minmax(calc(265px * var(--ui-scale, 1)), calc(300px * var(--ui-scale, 1))) !important;
  }
  #sms-tab .sms-inspector-panel { min-width: 0; }
}

/* Medium desktop: like E-post, the Kundekort opens as a drawer on the right. */
@media (min-width: 901px) and (max-width: 1260px) {
  #sms-tab .inbox-layout { position: relative; }
  #sms-tab .inbox-layout:has(#sms-inspector-panel:not(.hidden)) {
    grid-template-columns: var(--sms-list-width, calc(265px * var(--ui-scale, 1))) minmax(0, 1fr) !important;
  }
  #sms-tab .sms-inspector-panel:not(.hidden) {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: calc(300px * var(--ui-scale, 1));
    z-index: 25;
    box-shadow: calc(-8px * var(--ui-scale, 1)) 0 calc(24px * var(--ui-scale, 1)) rgba(15, 23, 42, 0.14);
  }
}

/* Phones: a sheet over the open conversation, like E-post. */
@media (max-width: 900px) {
  #sms-tab .inbox-layout:not(.mobile-sms-thread-open) #sms-inspector-panel {
    display: none !important;
  }
  #sms-tab .inbox-layout.mobile-sms-thread-open #sms-inspector-panel:not(.hidden) {
    position: fixed;
    left: calc(8px * var(--ui-scale, 1));
    right: calc(8px * var(--ui-scale, 1));
    bottom: calc(8px * var(--ui-scale, 1));
    top: calc(64px * var(--ui-scale, 1));
    z-index: 60;
    display: flex;
    flex-direction: column;
    border: calc(1px * var(--ui-scale, 1)) solid var(--line);
    border-radius: calc(14px * var(--ui-scale, 1));
    background: var(--surface);
    box-shadow: 0 calc(18px * var(--ui-scale, 1)) calc(48px * var(--ui-scale, 1)) rgba(15, 23, 42, 0.28);
    overflow: hidden;
  }
  #sms-tab .inbox-layout.mobile-sms-thread-open #sms-inspector-panel:not(.hidden) .et-inspector-content {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

.kk-head-tools {
  display: inline-flex;
  align-items: center;
  gap: calc(6px * var(--ui-scale, 1));
  min-width: 0;
}
.kk-edit-btn {
  border: calc(1px * var(--ui-scale, 1)) solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: calc(6px * var(--ui-scale, 1));
  padding: calc(2px * var(--ui-scale, 1)) calc(7px * var(--ui-scale, 1));
  font: inherit;
  font-size: calc(10.5px * var(--ui-scale, 1));
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.kk-edit-btn:hover,
.kk-edit-btn:focus-visible {
  border-color: var(--blue, #0d6b5c);
  color: var(--blue, #0d6b5c);
}
.kk-edit-hint {
  margin: 0;
  font-size: calc(11px * var(--ui-scale, 1));
  color: var(--muted);
}
.kk-edit-form {
  display: flex;
  flex-direction: column;
  gap: calc(10px * var(--ui-scale, 1));
}
.kk-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: calc(8px * var(--ui-scale, 1));
}
.kk-field {
  display: flex;
  flex-direction: column;
  gap: calc(3px * var(--ui-scale, 1));
  min-width: 0;
}
.kk-field-wide { grid-column: 1 / -1; }
.kk-field span {
  font-size: calc(10px * var(--ui-scale, 1));
  font-weight: 700;
  color: var(--muted);
}
.kk-field input,
.kk-field select {
  width: 100%;
  min-width: 0;
  height: calc(30px * var(--ui-scale, 1));
  padding: 0 calc(8px * var(--ui-scale, 1));
  font: inherit;
  font-size: calc(12px * var(--ui-scale, 1));
  color: var(--ink);
  background: var(--canvas);
  border: calc(1px * var(--ui-scale, 1)) solid var(--line);
  border-radius: calc(7px * var(--ui-scale, 1));
  box-sizing: border-box;
}
.kk-field input:focus,
.kk-field select:focus {
  outline: none;
  border-color: var(--blue, #0d6b5c);
  box-shadow: 0 0 0 calc(2px * var(--ui-scale, 1)) var(--blue-soft, rgba(13, 107, 92, 0.14));
}
.kk-edit-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: calc(6px * var(--ui-scale, 1));
}

/* The Kundekort button next to Ring / E-post is for phones only; there the
   header button is hidden, as in E-post. */
.mobile-sms-inspector-button { display: none !important; }
@media (max-width: 900px) {
  #sms-tab .mobile-sms-inspector-button { display: inline-flex !important; }
  #sms-tab #btn-toggle-sms-inspector { display: none !important; }
}

/* Universal search: "Vis flere" under each section, the waiting line for SMS
   and e-mail, and the row marked with the arrow keys. Colours come from the
   theme's own tokens, so every theme and mode gets them. */
.live-search-toggle {
  display: block;
  width: 100%;
  margin: calc(2px * var(--ui-scale, 1)) 0 calc(4px * var(--ui-scale, 1));
  padding: calc(7px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1));
  border: 0;
  border-radius: calc(10px * var(--ui-scale, 1));
  background: transparent;
  color: var(--blue);
  font: 700 calc(12px * var(--ui-scale, 1)) var(--font);
  text-align: left;
  cursor: pointer;
}
.live-search-toggle:hover { background: color-mix(in srgb, var(--blue) 8%, transparent); }
.live-search-toggle:disabled { color: var(--muted); cursor: default; }
.live-search-pending {
  padding: calc(10px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1));
  font-size: calc(12px * var(--ui-scale, 1));
  color: var(--muted);
}
.search-section-title .live-search-window {
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
  margin-left: calc(4px * var(--ui-scale, 1));
}
#live-search-results .is-nav-active {
  background: color-mix(in srgb, var(--blue) 10%, transparent);
  box-shadow: inset calc(3px * var(--ui-scale, 1)) 0 0 var(--blue);
}

/* E-post cards: the sender's name and employee number filter the list on that
   person (2026-11-18). Same cue as the clickable labels, in every theme. */
#email-threads-list .et-person-filter[data-tag-kind] { cursor: pointer; }
#email-threads-list .et-person-filter[data-tag-kind]:hover {
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--blue) 70%, currentColor);
  text-underline-offset: 2px;
}

/* Gruppemelding (Ny melding → Gruppemelding), 2026-11-18. Theme tokens only, so
   every theme, light and dark, gets the same window; the tick is the green of
   the Send button's success state (--rh-success). */
.sms-new-modal.is-group { width: min(calc(620px * var(--ui-scale, 1)), 95vw); max-height: 92vh; overflow-y: auto; }
.sms-group-panel { display: grid; gap: calc(10px * var(--ui-scale, 1)); }
/* Only the part of the chosen tab shows; the form's own display rule outranked
   the hidden attribute. While a group is sending, the list takes the space of
   the input. */
#sms-new-modal [data-sms-new-only][hidden] { display: none !important; }
.sms-new-modal.is-sending :is(.sms-group-panel > .modal-description, label[for="sms-group-input"]) { display: none; }
.sms-group-panel .modal-description { margin: 0; }
.sms-group-panel textarea {
  width: 100%; min-height: calc(84px * var(--ui-scale, 1)); resize: vertical;
  font: inherit; color: var(--ink); background: transparent;
  border: calc(1px * var(--ui-scale, 1)) solid var(--line); border-radius: calc(10px * var(--ui-scale, 1));
  padding: calc(9px * var(--ui-scale, 1)) calc(11px * var(--ui-scale, 1)); margin-top: calc(6px * var(--ui-scale, 1));
}
.sms-group-panel textarea:focus { outline: 2px solid color-mix(in srgb, var(--blue) 45%, transparent); outline-offset: 1px; }
.sms-group-panel textarea[readonly] { opacity: .75; }
.sms-group-head { display: flex; align-items: baseline; gap: calc(10px * var(--ui-scale, 1)); font-size: calc(13px * var(--ui-scale, 1)); color: var(--ink); }
.sms-group-summary { color: var(--muted); font-weight: 600; }
.sms-group-link { margin-left: auto; border: 0; background: none; padding: 0; color: var(--muted); font: 600 calc(12px * var(--ui-scale, 1)) var(--font); cursor: pointer; }
.sms-group-link:hover { color: var(--ink); text-decoration: underline; }
.sms-group-link[hidden] { display: none; }
.sms-group-list {
  list-style: none; margin: 0; padding: 0; max-height: min(calc(320px * var(--ui-scale, 1)), 42vh); overflow-y: auto;
  border: calc(1px * var(--ui-scale, 1)) solid var(--line); border-radius: calc(10px * var(--ui-scale, 1));
}
.sms-group-list.is-empty { display: none; }
.sms-group-row {
  position: relative; display: grid; grid-template-columns: calc(58px * var(--ui-scale, 1)) minmax(0, 1fr) auto; align-items: center;
  gap: calc(10px * var(--ui-scale, 1)); padding: calc(8px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1));
  border-bottom: calc(1px * var(--ui-scale, 1)) solid var(--line); animation: smsGroupRowIn .22s var(--ease-out, ease-out);
}
.sms-group-row:last-child { border-bottom: 0; }
.sms-group-ansatt { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); }
.sms-group-who { display: grid; min-width: 0; }
.sms-group-name { font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.sms-group-open { border: 0; background: none; padding: 0; font: inherit; font-weight: 600; cursor: pointer; }
.sms-group-open:hover { text-decoration: underline; text-underline-offset: 2px; }
.sms-group-who small { color: var(--muted); font-size: calc(12px * var(--ui-scale, 1)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sms-group-state { display: inline-flex; align-items: center; gap: calc(8px * var(--ui-scale, 1)); font-size: calc(12px * var(--ui-scale, 1)); color: var(--muted); }
.sms-group-error { color: var(--red, #dc2626); font-weight: 600; }
.sms-group-row.is-invalid .sms-group-ansatt, .sms-group-row.is-failed .sms-group-ansatt { color: var(--red, #dc2626); }
.sms-group-remove {
  border: 0; background: none; color: var(--muted); cursor: pointer; font-size: calc(13px * var(--ui-scale, 1));
  width: calc(26px * var(--ui-scale, 1)); height: calc(26px * var(--ui-scale, 1)); border-radius: 999px; display: grid; place-items: center;
}
.sms-group-remove:hover { color: var(--ink); background: color-mix(in srgb, var(--line) 60%, transparent); }
.sms-group-row.is-flash { animation: smsGroupFlash .9s ease-out; }
.sms-group-tick {
  width: calc(22px * var(--ui-scale, 1)); height: calc(22px * var(--ui-scale, 1)); border-radius: 999px;
  display: grid; place-items: center; background: var(--rh-success, #22C55E); color: #fff;
  animation: smsGroupTickIn .28s var(--ease-out, ease-out);
}
.sms-group-tick svg { width: 70%; height: 70%; }
.sms-group-tick path { stroke-dasharray: 24; stroke-dashoffset: 24; animation: smsGroupTickDraw var(--dur-draw, .35s) var(--ease-out, ease-out) .08s forwards; }
/* The bar under each row: empty in the queue, filling while the SMS leaves,
   full and green when it is sent, red when it failed. */
.sms-group-bar {
  position: absolute; left: calc(12px * var(--ui-scale, 1)); right: calc(12px * var(--ui-scale, 1)); bottom: calc(3px * var(--ui-scale, 1));
  height: calc(3px * var(--ui-scale, 1)); border-radius: 999px; overflow: hidden; background: color-mix(in srgb, var(--line) 80%, transparent);
}
.sms-group-bar > span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--blue); }
.sms-group-row.is-sending .sms-group-bar > span { animation: smsGroupFill 1.6s cubic-bezier(.2,.7,.3,1) forwards; }
.sms-group-row.is-sent .sms-group-bar > span { width: 100%; background: var(--rh-success, #22C55E); animation: smsGroupDone .25s ease-out; }
.sms-group-row.is-failed .sms-group-bar > span { width: 100%; background: var(--red, #dc2626); }
.sms-group-row.is-stopped .sms-group-bar > span { width: 0; }
.sms-group-compose-meta { display: flex; align-items: center; justify-content: space-between; gap: calc(10px * var(--ui-scale, 1)); }
.sms-group-chars { color: var(--muted); font-size: calc(12px * var(--ui-scale, 1)); }
.sms-new-modal.is-sending .sms-group-compose-meta .sms-channel-toggle { opacity: .6; pointer-events: none; }
.sms-group-actions { grid-template-columns: repeat(auto-fit, minmax(calc(120px * var(--ui-scale, 1)), 1fr)); }
.sms-group-actions [hidden] { display: none !important; }
.sms-group-note { color: var(--muted); font-weight: 600; white-space: nowrap; }
@keyframes smsGroupRowIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes smsGroupFlash { 0% { background: color-mix(in srgb, var(--blue) 18%, transparent); } 100% { background: transparent; } }
@keyframes smsGroupFill { from { width: 0; } to { width: 88%; } }
@keyframes smsGroupDone { from { width: 88%; } to { width: 100%; } }
@keyframes smsGroupTickIn { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes smsGroupTickDraw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) {
  .sms-group-row, .sms-group-tick, .sms-group-row.is-flash, .sms-group-bar > span { animation: none !important; }
  .sms-group-tick path { animation: none; stroke-dashoffset: 0; }
  .sms-group-row.is-sending .sms-group-bar > span { width: 60%; }
}
/* On a phone the reason goes under a red row, so the wrong number stays
   readable instead of being cut to "900…". */
@media (max-width: 600px) {
  .sms-group-row:is(.is-invalid, .is-failed) { row-gap: 0; }
  .sms-group-row:is(.is-invalid, .is-failed) .sms-group-state { display: contents; }
  .sms-group-row:is(.is-invalid, .is-failed) .sms-group-ansatt { grid-area: 1 / 1 / 3 / 2; }
  .sms-group-row:is(.is-invalid, .is-failed) .sms-group-who { grid-area: 1 / 2; }
  .sms-group-row:is(.is-invalid, .is-failed) .sms-group-error { grid-area: 2 / 2; font-size: calc(12px * var(--ui-scale, 1)); }
  .sms-group-row:is(.is-invalid, .is-failed) .sms-group-remove { grid-area: 1 / 3 / 3 / 4; }
}

/* Ny melding: contact suggestions under the field (Enkeltmelding and
   Gruppemelding), replacing the browser's datalist. In the flow of the window,
   small, theme tokens only, so it matches every theme in light and dark. */
.contact-suggest {
  margin-top: calc(-4px * var(--ui-scale, 1));
  max-height: calc(232px * var(--ui-scale, 1)); overflow-y: auto; overscroll-behavior: contain;
  padding: calc(4px * var(--ui-scale, 1));
  border: calc(1px * var(--ui-scale, 1)) solid var(--line); border-radius: calc(10px * var(--ui-scale, 1));
  background: color-mix(in srgb, var(--ink) 3%, transparent);
  animation: smsGroupRowIn .16s var(--ease-out, ease-out);
}
.contact-suggest[hidden] { display: none; }
.contact-suggest-option {
  display: grid; grid-template-columns: calc(52px * var(--ui-scale, 1)) minmax(0, 1fr); align-items: center;
  gap: calc(8px * var(--ui-scale, 1)); padding: calc(6px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1));
  border-radius: calc(8px * var(--ui-scale, 1)); cursor: pointer; color: var(--ink);
  font-size: calc(13px * var(--ui-scale, 1)); line-height: 1.25;
}
.contact-suggest-option:hover, .contact-suggest-option.active { background: color-mix(in srgb, var(--blue) 12%, transparent); }
.contact-suggest-ansatt { font-weight: 700; font-variant-numeric: tabular-nums; }
.contact-suggest-who { display: grid; min-width: 0; }
.contact-suggest-who strong { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-suggest-who small { color: var(--muted); font-size: calc(11.5px * var(--ui-scale, 1)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (prefers-reduced-motion: reduce) { .contact-suggest { animation: none; } }

/* E-post on phones: Innboks and the four statuses in one compact row of equal
   tiles, the count above its label so "Under arbeid" fits whole. No surface
   behind the groups (the grey oval of some themes); the chosen tile is filled
   with the page's ink colour, the same in all six themes, light and dark.
   With Filtre open the folders get their own row of four above the statuses. */
@media (max-width: 900px) {
  html:root body #email-tab#email-tab .et-workspace-layout > .et-vertical-nav-rail {
    background: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
    border-right: 0 !important;
    padding: calc(6px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1)) !important;
  }
  html:root body #email-tab#email-tab .et-vertical-nav-rail .email-toolbar-tabs.et-folder-status-tabs {
    display: grid !important;
    /* Innboks is a little wider: it carries new/total. */
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 4fr);
    gap: calc(5px * var(--ui-scale, 1)) !important;
    padding: 0 !important;
    background: transparent !important;
  }
  html:root body #email-tab#email-tab.mobile-filters-open .et-vertical-nav-rail .email-toolbar-tabs.et-folder-status-tabs {
    grid-template-columns: minmax(0, 1fr);
  }
  html:root body #email-tab#email-tab .et-vertical-nav-rail :is(.et-segmented-folders, .et-segmented-statuses) {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: calc(5px * var(--ui-scale, 1)) !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
  }
  html:root body #email-tab#email-tab:not(.mobile-filters-open) .et-vertical-nav-rail .et-segmented-folders {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  html:root body #email-tab#email-tab .et-vertical-nav-rail :is(.et-segmented-folders, .et-segmented-statuses) > :is(.email-folder-btn, .ticket-filter-btn) {
    display: flex !important;
    flex-direction: column-reverse !important;
    align-items: center !important;
    /* column-reverse: flex-end is the top, so the counts line up across tiles. */
    justify-content: flex-end !important;
    gap: calc(1px * var(--ui-scale, 1)) !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: calc(44px * var(--ui-scale, 1)) !important;
    padding: calc(5px * var(--ui-scale, 1)) calc(2px * var(--ui-scale, 1)) !important;
    border: 0 !important;
    border-radius: calc(12px * var(--ui-scale, 1)) !important;
    background: color-mix(in srgb, var(--ink) 5%, transparent) !important;
    background-image: none !important;
    box-shadow: none !important;
    color: var(--muted) !important;
    text-align: center !important;
  }
  html:root body #email-tab#email-tab .et-vertical-nav-rail :is(.et-segmented-folders, .et-segmented-statuses) > :is(.email-folder-btn, .ticket-filter-btn) .et-folder-label {
    max-width: 100%;
    font-size: calc(10.5px * var(--ui-scale, 1)) !important;
    font-weight: 600 !important;
    line-height: 1.15 !important;
    color: inherit !important;
    /* "Mine saker" and "Under arbeid" break onto two lines instead of being cut. */
    white-space: normal !important;
    overflow-wrap: anywhere;
    overflow: visible !important;
    text-overflow: clip !important;
    opacity: 1 !important;
  }
  /* Only Innboks while Filtre is closed, as before. */
  html:root body #email-tab#email-tab:not(.mobile-filters-open) .et-vertical-nav-rail .et-segmented-folders > .email-folder-btn:not([data-email-folder="INBOX"]) {
    display: none !important;
  }
  /* The count: a plain number, not a badge. */
  html:root body #email-tab#email-tab .et-vertical-nav-rail :is(.et-segmented-folders, .et-segmented-statuses) > :is(.email-folder-btn, .ticket-filter-btn) > span:not(.et-folder-label),
  html:root body #email-tab#email-tab .et-vertical-nav-rail :is(.et-segmented-folders, .et-segmented-statuses) > :is(.email-folder-btn, .ticket-filter-btn) > span:not(.et-folder-label) span {
    min-width: 0 !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--ink) !important;
    font-size: calc(15px * var(--ui-scale, 1)) !important;
    font-weight: 750 !important;
    line-height: 1.1 !important;
    font-variant-numeric: tabular-nums;
    opacity: 1 !important;
  }
  html:root body #email-tab#email-tab .et-vertical-nav-rail :is(.et-segmented-folders, .et-segmented-statuses) > .email-folder-btn > span:not(.et-folder-label) :is(.inbox-count-sep, .inbox-total-count) {
    color: var(--muted) !important;
    font-size: calc(10.5px * var(--ui-scale, 1)) !important;
    font-weight: 600 !important;
  }
  /* The chosen tile: filled with the ink colour, its text in the card colour. */
  html:root body #email-tab#email-tab .et-vertical-nav-rail :is(.et-segmented-folders, .et-segmented-statuses) > .rh-seg-pill {
    background: var(--ink) !important;
    background-image: none !important;
    border-radius: calc(12px * var(--ui-scale, 1)) !important;
    box-shadow: none !important;
  }
  html:root body #email-tab#email-tab .et-vertical-nav-rail :is(.et-segmented-folders, .et-segmented-statuses).rh-seg-ready > .active {
    background: transparent !important;
  }
  html:root body #email-tab#email-tab .et-vertical-nav-rail :is(.et-segmented-folders, .et-segmented-statuses):not(.rh-seg-ready) > .active {
    background: var(--ink) !important;
  }
  html:root body #email-tab#email-tab .et-vertical-nav-rail .et-segmented-statuses > .active,
  html:root body #email-tab#email-tab .et-vertical-nav-rail .et-segmented-statuses > .active .et-folder-label,
  html:root body #email-tab#email-tab .et-vertical-nav-rail .et-segmented-statuses > .active > span:not(.et-folder-label),
  html:root body #email-tab#email-tab .et-vertical-nav-rail .et-segmented-statuses > .active > span:not(.et-folder-label) span {
    color: var(--surface) !important;
  }
  /* The chosen folder is a ring, not a fill: it is a place, the status is the
     filter, and two filled tiles side by side read as two filters. */
  html:root body #email-tab#email-tab .et-vertical-nav-rail .et-segmented-folders > .rh-seg-pill {
    background: transparent !important;
    box-shadow: inset 0 0 0 calc(1.5px * var(--ui-scale, 1)) var(--ink) !important;
  }
  html:root body #email-tab#email-tab .et-vertical-nav-rail .et-segmented-folders:not(.rh-seg-ready) > .active {
    background: transparent !important;
    box-shadow: inset 0 0 0 calc(1.5px * var(--ui-scale, 1)) var(--ink) !important;
  }
  html:root body #email-tab#email-tab .et-vertical-nav-rail .et-segmented-folders > .active {
    color: var(--ink) !important;
  }
  /* A long inbox total stays inside the tile. */
  html:root body #email-tab#email-tab .et-vertical-nav-rail .et-segmented-folders > .email-folder-btn > span:not(.et-folder-label) {
    display: flex !important;
    align-items: baseline !important;
    justify-content: center !important;
    max-width: 100%;
    min-width: 0 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
  }
  html:root body #email-tab#email-tab .et-vertical-nav-rail .et-segmented-folders > .email-folder-btn > span:not(.et-folder-label) > :is(.inbox-new-count, .inbox-count-sep) {
    flex: 0 0 auto !important;
  }
  /* The new count always shows; a total that does not fit ends in "…". */
  html:root body #email-tab#email-tab .et-vertical-nav-rail .et-segmented-folders > .email-folder-btn > span:not(.et-folder-label) > .inbox-total-count {
    display: block !important;
    flex: 0 1 auto !important;
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }
}

/* Systemstatus, Hendelser: the worker problems of the last seven days. An open
   one has the red dot of the page's error level, a solved one the green. */
.worker-status-page .ws-events { margin-top: calc(14px * var(--ui-scale, 1)); padding: calc(16px * var(--ui-scale, 1)) calc(18px * var(--ui-scale, 1)); }
.ws-events-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: calc(4px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1)); margin-bottom: calc(10px * var(--ui-scale, 1)); }
.ws-events-head h2 { margin: 0; font-size: calc(15px * var(--ui-scale, 1)); color: var(--ink); }
.ws-events-head small { color: var(--muted); font-size: calc(12px * var(--ui-scale, 1)); }
.ws-events-list { list-style: none; margin: 0; padding: 0; display: grid; gap: calc(2px * var(--ui-scale, 1)); }
.ws-event {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start;
  gap: calc(10px * var(--ui-scale, 1));
  padding: calc(9px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
  border-radius: calc(10px * var(--ui-scale, 1));
}
.ws-event + .ws-event { border-top: calc(1px * var(--ui-scale, 1)) solid var(--line); border-radius: 0; }
.ws-event[data-open="true"] { background: rgba(239, 68, 68, .08); border-radius: calc(10px * var(--ui-scale, 1)); }
.ws-event-dot {
  width: calc(8px * var(--ui-scale, 1)); height: calc(8px * var(--ui-scale, 1)); border-radius: 50%;
  margin-top: calc(6px * var(--ui-scale, 1)); background: #22C55E;
}
.ws-event[data-open="true"] .ws-event-dot { background: #EF4444; }
.ws-event-body { min-width: 0; font-size: calc(13px * var(--ui-scale, 1)); color: var(--ink); }
.ws-event-body strong { font-weight: 700; margin-right: calc(6px * var(--ui-scale, 1)); }
.ws-event-body small { display: block; margin-top: calc(2px * var(--ui-scale, 1)); color: var(--muted); font-size: calc(11.5px * var(--ui-scale, 1)); }
.ws-event-state { font-size: calc(11px * var(--ui-scale, 1)); font-weight: 700; color: var(--muted); white-space: nowrap; margin-top: calc(2px * var(--ui-scale, 1)); }
.ws-event[data-open="true"] .ws-event-state { color: var(--red); }
.ws-event-empty { color: var(--muted); font-size: calc(13px * var(--ui-scale, 1)); padding: calc(6px * var(--ui-scale, 1)) 0; }

/* E-post: an internal note stands in its case's flow, in amber with a dashed
   border in every theme, so it is never read as an e-mail that left. A
   forward's note has a button to the new case. */
html:root #email-tab#email-tab#email-tab .email-message-card.et-note-card {
  background: color-mix(in srgb, var(--orange-soft) 75%, var(--surface)) !important;
  border: calc(1px * var(--ui-scale, 1)) dashed color-mix(in srgb, var(--orange) 55%, transparent) !important;
  box-shadow: none !important;
}
html:root #email-tab#email-tab#email-tab .email-message-card.et-note-card .email-message-card-head {
  background: transparent !important;
  border-bottom: 0 !important;
}
html:root #email-tab#email-tab#email-tab .et-note-card .et-note-label {
  display: inline-flex;
  align-items: center;
  gap: calc(4px * var(--ui-scale, 1));
  margin-right: calc(6px * var(--ui-scale, 1));
  color: var(--orange) !important;
  font-size: calc(11px * var(--ui-scale, 1));
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
html:root #email-tab#email-tab#email-tab .et-note-card .et-note-label::before {
  content: "";
  width: calc(7px * var(--ui-scale, 1));
  height: calc(7px * var(--ui-scale, 1));
  border-radius: 50%;
  background: var(--orange);
}
html:root #email-tab#email-tab#email-tab .et-note-card .email-message-card-head strong {
  color: var(--ink) !important;
}
html:root #email-tab#email-tab#email-tab .et-note-card .et-note-links {
  display: flex;
  flex-wrap: wrap;
  gap: calc(6px * var(--ui-scale, 1));
  padding: 0 calc(16px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1));
}
html:root #email-tab#email-tab#email-tab .et-note-card .et-note-open {
  appearance: none;
  border: calc(1px * var(--ui-scale, 1)) solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 999px;
  padding: calc(4px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1));
  font: inherit;
  font-size: calc(12.5px * var(--ui-scale, 1));
  font-weight: 600;
  cursor: pointer;
}
html:root #email-tab#email-tab#email-tab .et-note-card .et-note-open:hover {
  border-color: var(--ink);
}

/* Meldinger: a reaction sent as text from an iPhone ("Likte «…»"). Its emoji
   sits on the corner of the message it reacts to, like on the phone, and the
   reaction itself is a small line instead of a bubble. Colours come from the
   theme tokens, so every theme and mode gets the same look. */
#sms-chat-history .message-row.has-reaction { margin-top: calc(10px * var(--ui-scale, 1)); }
#sms-chat-history .message-bubble .sms-reaction-badge {
  position: absolute;
  top: calc(-14px * var(--ui-scale, 1));
  right: calc(-8px * var(--ui-scale, 1));
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: calc(1px * var(--ui-scale, 1));
  min-width: calc(26px * var(--ui-scale, 1));
  height: calc(26px * var(--ui-scale, 1));
  padding: 0 calc(5px * var(--ui-scale, 1));
  justify-content: center;
  border-radius: 999px;
  background: var(--surface, #fff);
  border: calc(2px * var(--ui-scale, 1)) solid var(--surface, #fff);
  box-shadow: 0 0 0 calc(1px * var(--ui-scale, 1)) var(--line, rgba(0, 0, 0, .12)), 0 calc(2px * var(--ui-scale, 1)) calc(6px * var(--ui-scale, 1)) rgba(15, 23, 42, .14);
  font-size: calc(14px * var(--ui-scale, 1));
  line-height: 1;
  color: var(--ink, #1f2937);
  pointer-events: auto;
  cursor: default;
}
#sms-chat-history .message-row.agent .message-bubble .sms-reaction-badge { right: auto; left: calc(-8px * var(--ui-scale, 1)); }
#sms-chat-history .message-row.sms-reaction-row { max-width: 77%; }
#sms-chat-history .sms-reaction-line {
  display: inline-flex;
  align-items: center;
  gap: calc(7px * var(--ui-scale, 1));
  max-width: 100%;
  padding: calc(4px * var(--ui-scale, 1)) calc(11px * var(--ui-scale, 1)) calc(4px * var(--ui-scale, 1)) calc(5px * var(--ui-scale, 1));
  border-radius: 999px;
  border: calc(1px * var(--ui-scale, 1)) dashed var(--line, rgba(0, 0, 0, .14));
  color: var(--muted, #667085);
  font-size: calc(12.5px * var(--ui-scale, 1));
  line-height: 1.35;
}
#sms-chat-history .sms-reaction-emoji {
  display: inline-grid;
  place-items: center;
  width: calc(24px * var(--ui-scale, 1));
  height: calc(24px * var(--ui-scale, 1));
  border-radius: 999px;
  background: var(--surface, #fff);
  box-shadow: 0 0 0 calc(1px * var(--ui-scale, 1)) var(--line, rgba(0, 0, 0, .12));
  font-size: calc(14px * var(--ui-scale, 1));
  flex: none;
}
#sms-chat-history .sms-reaction-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-style: italic; }
#sms-chat-history .sms-reaction-row.is-removed .sms-reaction-emoji { opacity: .55; }
#sms-chat-history .sms-reaction-row .message-meta { margin-top: calc(3px * var(--ui-scale, 1)); }

/* The text of a reaction, shown on hover or focus of its emoji (see
   showSmsReactionTip). Inverted like other tooltips: ink background, surface
   text, so it reads in every theme and mode. */
#sms-chat-history .message-bubble .sms-reaction-badge { cursor: default; }
#sms-chat-history .message-bubble .sms-reaction-badge:focus-visible { outline: calc(2px * var(--ui-scale, 1)) solid var(--blue, #0d6b5c); outline-offset: calc(2px * var(--ui-scale, 1)); }
.sms-reaction-tip {
  position: fixed;
  z-index: 10000;
  max-width: min(calc(280px * var(--ui-scale, 1)), calc(100vw - 16px));
  padding: calc(7px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
  border-radius: calc(10px * var(--ui-scale, 1));
  background: var(--ink, #182230);
  color: var(--surface, #fff);
  font-size: calc(12.5px * var(--ui-scale, 1));
  line-height: 1.4;
  white-space: pre-line;
  overflow-wrap: anywhere;
  box-shadow: 0 calc(6px * var(--ui-scale, 1)) calc(18px * var(--ui-scale, 1)) rgba(15, 23, 42, .25);
  pointer-events: none;
}
.sms-reaction-tip[hidden] { display: none; }

/* Gruppemelding: saved lists, shared by the department (2026-11-19). A chip
   per list adds its people; ✕ deletes it. "Lagre som liste" opens a small
   form under the count. Theme tokens only, like the rest of the window. */
.sms-group-head .sms-group-link:not([hidden]) ~ .sms-group-link { margin-left: 0; }
.sms-group-saved { display: grid; gap: calc(6px * var(--ui-scale, 1)); }
.sms-group-saved[hidden] { display: none; }
.sms-group-saved-label { font-size: calc(12px * var(--ui-scale, 1)); font-weight: 700; color: var(--muted); }
.sms-group-saved-list { display: flex; flex-wrap: wrap; gap: calc(6px * var(--ui-scale, 1)); max-height: calc(120px * var(--ui-scale, 1)); overflow-y: auto; }
.sms-group-list-chip {
  display: inline-flex; align-items: center; max-width: 100%;
  border: calc(1px * var(--ui-scale, 1)) solid var(--line); border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 3%, transparent);
  transition: border-color .15s ease, background-color .15s ease;
}
.sms-group-list-chip:hover { border-color: color-mix(in srgb, var(--blue) 45%, var(--line)); }
.sms-group-list-chip.is-active { border-color: var(--blue); background: color-mix(in srgb, var(--blue) 10%, transparent); }
.sms-group-list-use {
  display: inline-flex; align-items: center; gap: calc(6px * var(--ui-scale, 1)); min-width: 0;
  border: 0; background: none; cursor: pointer; color: var(--ink);
  font: 600 calc(12.5px * var(--ui-scale, 1)) var(--font);
  padding: calc(5px * var(--ui-scale, 1)) calc(4px * var(--ui-scale, 1)) calc(5px * var(--ui-scale, 1)) calc(11px * var(--ui-scale, 1));
}
.sms-group-list-use > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: calc(220px * var(--ui-scale, 1)); }
.sms-group-list-use small {
  flex: none; min-width: calc(20px * var(--ui-scale, 1)); padding: 0 calc(6px * var(--ui-scale, 1)); border-radius: 999px;
  background: color-mix(in srgb, var(--line) 70%, transparent); color: var(--muted);
  font-size: calc(11px * var(--ui-scale, 1)); font-weight: 700; line-height: calc(18px * var(--ui-scale, 1)); text-align: center;
}
.sms-group-list-chip.is-active .sms-group-list-use small { background: var(--blue); color: var(--surface, #fff); }
.sms-group-list-delete {
  flex: none; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 999px;
  width: calc(24px * var(--ui-scale, 1)); height: calc(24px * var(--ui-scale, 1)); margin-right: calc(3px * var(--ui-scale, 1));
  display: grid; place-items: center; font-size: calc(11px * var(--ui-scale, 1));
}
.sms-group-list-delete:hover { color: var(--red, #dc2626); background: color-mix(in srgb, var(--red, #dc2626) 10%, transparent); }
/* Kopier: on every list. Only the maker's lists have ✕ after it. */
.sms-group-list-copy {
  flex: none; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 999px;
  width: calc(24px * var(--ui-scale, 1)); height: calc(24px * var(--ui-scale, 1));
  display: grid; place-items: center; padding: 0;
}
.sms-group-list-chip.is-shared .sms-group-list-copy { margin-right: calc(3px * var(--ui-scale, 1)); }
.sms-group-list-copy svg {
  width: calc(13px * var(--ui-scale, 1)); height: calc(13px * var(--ui-scale, 1));
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.sms-group-list-copy:hover { color: var(--blue); background: color-mix(in srgb, var(--blue) 10%, transparent); }
.sms-group-list-copy:focus-visible { outline: 2px solid color-mix(in srgb, var(--blue) 55%, transparent); outline-offset: 1px; }
.sms-group-list-use:focus-visible, .sms-group-list-delete:focus-visible { outline: 2px solid color-mix(in srgb, var(--blue) 55%, transparent); outline-offset: 1px; }
.sms-group-save {
  display: grid; gap: calc(6px * var(--ui-scale, 1));
  padding: calc(10px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1));
  border: calc(1px * var(--ui-scale, 1)) solid var(--line); border-radius: calc(10px * var(--ui-scale, 1));
  background: color-mix(in srgb, var(--ink) 3%, transparent);
  animation: smsGroupRowIn .18s var(--ease-out, ease-out);
}
.sms-group-save[hidden] { display: none; }
.sms-group-save label { font-size: calc(12px * var(--ui-scale, 1)); font-weight: 700; color: var(--muted); }
.sms-group-save-row { display: flex; gap: calc(8px * var(--ui-scale, 1)); align-items: center; }
.sms-group-save-row input {
  flex: 1; min-width: 0; font: inherit; color: var(--ink); background: var(--surface, transparent);
  border: calc(1px * var(--ui-scale, 1)) solid var(--line); border-radius: calc(10px * var(--ui-scale, 1));
  padding: calc(8px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
}
.sms-group-save-row input:focus { outline: 2px solid color-mix(in srgb, var(--blue) 45%, transparent); outline-offset: 1px; }
.sms-group-save-row .button { flex: none; padding: calc(8px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1)); }
.sms-group-save-hint { color: var(--muted); font-size: calc(12px * var(--ui-scale, 1)); min-height: 1em; }
.sms-new-modal.is-sending :is(.sms-group-saved, .sms-group-save) { display: none !important; }
@media (max-width: 600px) {
  .sms-group-save-row { flex-wrap: wrap; }
  .sms-group-save-row input { flex-basis: 100%; }
  .sms-group-save-row .button { flex: 1; }
}
@media (prefers-reduced-motion: reduce) { .sms-group-save { animation: none; } }

/* Zisson-konto: the two ways back in, numbered (2026-11-19, Marius). 1 «Koble
   til med Microsoft» renews with the Microsoft login saved in the worker, no
   password; 2 «Logg inn» is the live login, for when 1 does not work. The
   number sits in a small circle in the button's own text colour. */
.zisson-step-button { display: inline-flex; align-items: center; gap: calc(7px * var(--ui-scale, 1)); text-decoration: none !important; }
.zisson-step-button[hidden] { display: none; }
.zisson-step-num {
  display: inline-grid; place-items: center; flex: none;
  width: calc(18px * var(--ui-scale, 1)); height: calc(18px * var(--ui-scale, 1));
  border-radius: 999px; border: calc(1.5px * var(--ui-scale, 1)) solid currentColor;
  font-size: calc(11px * var(--ui-scale, 1)); font-weight: 800; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.zisson-login-steps { margin: 0; padding-left: calc(20px * var(--ui-scale, 1)); display: grid; gap: calc(6px * var(--ui-scale, 1)); }
.zisson-login-steps li::marker { font-weight: 800; color: var(--ink); }

/* E-post › Sendt is shared by the department: each card names who sent the
   latest message (2026-11-20). */
html .et-ticket-card .et-card-snippet .et-card-sent-by { font-weight: 700; color: var(--ink); }

/* Lime (light) gives the new-e-mail count a black badge. In the Innboks
   "3/4438" it had no size or padding and the row cut it: a squashed blot round
   the digit. It is a round badge now, like Ny and Åpne (2026-11-20). On a
   phone the count sits above the label without a badge, as before. */
@media (min-width: 901px) {
html[data-theme-name="lime"]:not([data-theme="dark"]) #email-tab#email-tab #email-folder-count-inbox {
  align-items: center !important;
  overflow: visible !important;
}
html[data-theme-name="lime"]:not([data-theme="dark"]) #email-tab#email-tab #email-folder-count-inbox .inbox-new-count {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-width: calc(18px * var(--ui-scale, 1));
  height: calc(18px * var(--ui-scale, 1));
  padding: 0 calc(5px * var(--ui-scale, 1)) !important;
  margin-right: calc(3px * var(--ui-scale, 1));
  border-radius: 999px;
  line-height: 1;
  font-size: calc(11px * var(--ui-scale, 1)) !important;
}
}

/* E-post on a desktop (2026-11-26, Marius): the composer starts open by default
   (no auto-fold to one line). The one-row case header without STATUS / ANSVARLIG
   labels stays shared by every theme. */
@media (min-width: 901px) {
  html #email-tab .et-composer-v2 .et-composer-mode-bar > #btn-close-email { margin: 0 0 0 auto !important; flex: 0 0 auto; }

  /* The case header on one row: Status and Ansvarlig keep their names as
     aria-label, title and placeholder, so the two labels above them go and
     the fields and buttons share one row while there is room. "Utvid"
     (email-focus-mode) keeps its own, even smaller header. */
  html #email-tab:not(.email-focus-mode) #ticket-controls .ticket-control-label { display: none !important; }
  html #email-tab:not(.email-focus-mode) #ticket-controls { flex-wrap: wrap !important; align-items: center !important; gap: calc(5px * var(--ui-scale, 1)) !important; }
  html #email-tab:not(.email-focus-mode) #ticket-controls .ticket-control-group { margin: 0 !important; gap: 0 !important; }
  html #email-tab:not(.email-focus-mode) #ticket-status-select { width: auto !important; min-width: 0 !important; }
  /* Ansvarlig takes what is left of the row (96-240 px), so ••• stays on it. */
  html #email-tab:not(.email-focus-mode) #ticket-controls .ticket-control-group:has(.ticket-agent-combo) { flex: 1 1 calc(96px * var(--ui-scale, 1)) !important; min-width: calc(90px * var(--ui-scale, 1)) !important; max-width: calc(240px * var(--ui-scale, 1)) !important; }
  html #email-tab:not(.email-focus-mode) #ticket-controls .ticket-agent-combo,
  html #email-tab:not(.email-focus-mode) #ticket-controls .ticket-agent-combo-input { width: 100% !important; min-width: 0 !important; }
  html #email-tab:not(.email-focus-mode) #ticket-controls .et-case-quick-btn { padding-left: calc(7px * var(--ui-scale, 1)) !important; padding-right: calc(7px * var(--ui-scale, 1)) !important; white-space: nowrap !important; }
  html #email-tab:not(.email-focus-mode) .et-case-title-block { gap: calc(2px * var(--ui-scale, 1)) !important; }
  html #email-tab:not(.email-focus-mode) .et-case-header { padding-top: calc(10px * var(--ui-scale, 1)) !important; padding-bottom: calc(8px * var(--ui-scale, 1)) !important; }
  html #email-tab:not(.email-focus-mode) .et-case-subject-row { gap: calc(8px * var(--ui-scale, 1)) !important; }
}

/* Oversikt, Alle aktiviteter (2026-11-23): a received or sent e-mail and a
   closed case are information, not a success, so they are not green. Green
   stays for answered calls where a theme gives them one, red for "tapt" and the
   theme accent for "ny". The base rule above colours every status green with
   !important, so closed-status and missed alone never took effect. */
html .call-log[data-log-type="EMAIL"] .call-status:not(.missed):not(.live-status),
html .call-log .call-status.closed-status {
  color: var(--muted) !important;
}
/* A missed call ("tapt") is red in every theme. Lime and Lavendel set it
   themselves; in Fjord, Havn, Terrakotta and Grafitt the green base rule won. */
html .call-log .call-status.missed {
  color: var(--red) !important;
}

/* E-post on a desktop (2026-11-23): the title "E-post" sits left of the search in
   the top bar and Kundekort and Ny e-post right of it (placeEmailHeading in
   app.js moves them there), so the inbox starts where the title row was. The
   search leaves the middle and takes the free space between them. One block for
   every theme. */
.topbar-page-slot { display: none; }
@media (min-width: 901px) {
  html .topbar.has-page-head .topbar-page-slot { display: flex; align-items: center; flex: 0 0 auto; min-width: 0; }
  html .topbar.has-page-head .topbar-page-title { margin-right: calc(16px * var(--ui-scale, 1)); }
  html .topbar.has-page-head .topbar-page-actions { margin-left: calc(12px * var(--ui-scale, 1)); margin-right: calc(12px * var(--ui-scale, 1)); }
  html .topbar.has-page-head .global-search-wrap {
    position: static !important;
    transform: none !important;
    left: auto !important;
    flex: 1 1 auto !important;
    min-width: calc(200px * var(--ui-scale, 1)) !important;
    max-width: calc(460px * var(--ui-scale, 1)) !important;
    margin: 0 auto !important;
  }
  html .topbar.has-page-head .global-search-wrap .global-search { width: 100% !important; }
  html .topbar.has-page-head .topbar-actions { margin-left: 0 !important; }
  html .topbar.has-page-head .et-command-title-group .eyebrow { display: none !important; }
  html .topbar.has-page-head .et-title-row { flex-wrap: nowrap; }
  /* Same size and spacing as the other page titles (.page-heading h1, e.g. Meldinger). */
  html .topbar.has-page-head .et-title-row h1 {
    margin: 0;
    font: 800 calc(28.6px * var(--ui-scale, 1)) / 1.1 var(--display, inherit);
    letter-spacing: calc(-.9px * var(--ui-scale, 1));
    color: var(--ink);
    white-space: nowrap;
  }
  /* Lime and Lavendel set their own page titles (28px in light mode, tighter spacing). */
  html[data-theme-name="lime"] .topbar.has-page-head .et-title-row h1 { letter-spacing: -0.03em; }
  html[data-theme-name="lavendel"] .topbar.has-page-head .et-title-row h1 { letter-spacing: -0.015em; }
  html:is([data-theme-name="lime"], [data-theme-name="lavendel"]):not([data-theme="dark"]) .topbar.has-page-head .et-title-row h1 {
    font-size: calc(28px * var(--ui-scale, 1));
  }
  html .topbar.has-page-head .et-command-actions { gap: calc(6px * var(--ui-scale, 1)); }
  html .topbar.has-page-head .et-command-actions .et-action-btn { min-height: calc(36px * var(--ui-scale, 1)); }
  html #email-tab.email-head-in-topbar .et-command-header { display: none !important; }
  /* "Utvid" shows only the e-mail and the reply: the title and buttons stay hidden. */
  html body:has(#email-tab.active.email-focus-mode) .topbar.has-page-head .topbar-page-slot { display: none !important; }
}

/* "Vil snakke med deg" (2026-11-24). Shared by every theme: the colours come
   from the theme tokens, the round arrow is the black-and-white bubble of
   "Tilbake til nyeste" turned to the right.
   - .talk-send-btn: end of a call row in Oversikt > Alle aktiviteter;
   - .global-call-note: "Send notat" in the call bar;
   - .talk-request-status: the message icon beside MBN / Zis / Social;
   - .talk-popover: the colleague picker and the notes window. */
/* The name keeps its own look inside the row's older rule, which makes every
   span in it a grey block (.call-log-main span). */
.call-log-main strong .log-name {
  display: block !important;
  min-width: 0;
  margin: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  color: inherit !important;
  font-size: inherit !important;
  line-height: inherit !important;
}
.call-log-main strong:has(.log-name) .log-lead { flex: 0 0 auto; }
/* On a clicked call the arrow stands beside "Åpen", a size up from the row one. */
.log-action-overlay:has(.talk-send-overlay) { gap: calc(10px * var(--ui-scale, 1)); }
.talk-send-btn.talk-send-overlay { width: calc(28px * var(--ui-scale, 1)); height: calc(28px * var(--ui-scale, 1)); animation: talk-overlay-in .3s cubic-bezier(.34, 1.56, .64, 1) both; }
.talk-send-btn.talk-send-overlay > svg { animation: talk-arrow-bob 1.1s ease-in-out infinite; }
@keyframes talk-overlay-in { from { opacity: 0; transform: translateX(-8px) scale(.6); } to { opacity: 1; transform: none; } }
/* A call's title line (lead and name) is one flex row. */
.call-log-main strong:has(.log-name) {
  display: flex !important;
  align-items: center !important;
  min-width: 0;
}
.talk-row-sent {
  flex: 0 1 auto;
  min-width: 0;
  max-width: calc(190px * var(--ui-scale, 1));
  display: inline-flex;
  align-items: center;
  gap: calc(6px * var(--ui-scale, 1));
  margin: 0 calc(4px * var(--ui-scale, 1)) 0 calc(6px * var(--ui-scale, 1));
  padding: calc(3px * var(--ui-scale, 1)) calc(9px * var(--ui-scale, 1)) calc(3px * var(--ui-scale, 1)) calc(3px * var(--ui-scale, 1));
  border-radius: 999px;
  border: calc(1px * var(--ui-scale, 1)) solid var(--line, #e2e8f0);
}
.talk-row-sent.is-fresh { animation: talk-sent-in .35s cubic-bezier(.34, 1.56, .64, 1) both; }
.talk-row-sent.is-read { border-color: rgba(22, 163, 74, .45); }
.talk-sent-to {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink, #111);
  font: 700 calc(12px * var(--ui-scale, 1)) var(--font);
}
@media (max-width: 600px) {
  .talk-row-sent { max-width: calc(110px * var(--ui-scale, 1)); margin-left: calc(4px * var(--ui-scale, 1)); }
  .talk-sent-rest { display: none; }
}
@keyframes talk-sent-in { from { opacity: 0; transform: translateX(-10px) scale(.9); } to { opacity: 1; transform: none; } }
/* The green tick on the arrow once the colleague ticked "Lest". */
.talk-send-btn { position: relative; }
.talk-read-badge {
  position: absolute;
  right: calc(-5px * var(--ui-scale, 1));
  top: calc(-5px * var(--ui-scale, 1));
  width: calc(13px * var(--ui-scale, 1));
  height: calc(13px * var(--ui-scale, 1));
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 0 0 calc(2px * var(--ui-scale, 1)) var(--surface, #fff);
}
.talk-read-badge.is-fresh { animation: talk-badge-pop .45s cubic-bezier(.34, 1.56, .64, 1) both; }
.talk-read-badge svg { width: 78%; height: 78%; fill: none; stroke: #fff; stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; animation: none !important; }
@keyframes talk-badge-pop { from { transform: scale(0); } to { transform: scale(1); } }
.talk-send-btn {
  width: calc(22px * var(--ui-scale, 1));
  height: calc(22px * var(--ui-scale, 1));
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: calc(2px * var(--ui-scale, 1)) solid rgba(255, 255, 255, .9);
  border-radius: 50%;
  background: #111;
  color: #fff;
  box-shadow: 0 calc(3px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1)) rgba(0, 0, 0, .2);
  cursor: pointer;
  transition: transform .18s cubic-bezier(.34, 1.56, .64, 1), box-shadow .18s ease;
}
.talk-send-btn > svg {
  width: 56%;
  height: 56%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* It bobs to the right while the row is under the pointer, like the "back to
   newest" bubble bobs up; every call row bobbing all the time would be noise. */
.call-log:hover .talk-send-btn > svg,
.talk-send-btn:focus-visible > svg,
.talk-send-btn[aria-expanded="true"] > svg { animation: talk-arrow-bob 1.1s ease-in-out infinite; }
.talk-send-btn:hover { transform: scale(1.14) rotate(-6deg); box-shadow: 0 calc(6px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1)) rgba(0, 0, 0, .28); }
.talk-send-btn:active { transform: scale(.9); }
@keyframes talk-arrow-bob { 0%, 100% { transform: translateX(-1px); } 50% { transform: translateX(2px); } }
html[data-theme="dark"] .talk-send-btn { border-color: rgba(255, 255, 255, .85); background: #000; }

/* Top bar: the same pill as MBN / Zis / Social, with a message icon and a count. */
.talk-request-status[hidden] { display: none !important; }
.talk-request-status { gap: calc(5px * var(--ui-scale, 1)); }
.talk-request-icon {
  width: calc(18px * var(--ui-scale, 1));
  height: calc(18px * var(--ui-scale, 1));
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.talk-request-count {
  min-width: calc(18px * var(--ui-scale, 1));
  height: calc(18px * var(--ui-scale, 1));
  padding: 0 calc(5px * var(--ui-scale, 1));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  /* A red dot with the count: a new note is waiting (2026-11-25, Marius). */
  background: #e5242b;
  color: #fff;
  font: 800 calc(10.5px * var(--ui-scale, 1)) / 1 var(--font);
  letter-spacing: 0;
}
html[data-theme="dark"] .talk-request-count { background: #ef4444; color: #fff; }
.talk-request-status.is-new { animation: talk-pop .7s cubic-bezier(.34, 1.56, .64, 1) both; }
.talk-request-status.is-new .talk-request-icon { animation: talk-wiggle .7s ease-in-out .15s 2; }
@keyframes talk-pop { 0% { opacity: 0; transform: scale(.4) translateY(-6px); } 60% { opacity: 1; transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes talk-wiggle { 0%, 100% { rotate: 0deg; } 25% { rotate: -12deg; } 75% { rotate: 10deg; } }

/* The picker and the notes window. */
.talk-popover {
  position: fixed;
  z-index: 60;
  width: min(calc(300px * var(--ui-scale, 1)), calc(100vw - 16px));
  max-height: min(calc(420px * var(--ui-scale, 1)), calc(100vh - 16px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: calc(1px * var(--ui-scale, 1)) solid var(--line, #e2e8f0);
  border-radius: calc(16px * var(--ui-scale, 1));
  background: var(--surface, #fff);
  color: var(--ink, #111);
  box-shadow: 0 calc(18px * var(--ui-scale, 1)) calc(44px * var(--ui-scale, 1)) rgba(15, 23, 42, .18);
  animation: talk-popover-in .22s cubic-bezier(.34, 1.56, .64, 1) both;
}
/* Wide enough for an older note's date without cutting the caller's name. */
.talk-popover.talk-inbox { width: min(calc(620px * var(--ui-scale, 1)), calc(100vw - 16px)); }
@keyframes talk-popover-in { from { opacity: 0; transform: translateY(-6px) scale(.96); } to { opacity: 1; transform: none; } }
.talk-popover-head {
  display: grid;
  gap: calc(2px * var(--ui-scale, 1));
  padding: calc(12px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
  border-bottom: calc(1px * var(--ui-scale, 1)) solid var(--line, #e2e8f0);
}
.talk-popover-head strong { font: 700 calc(13.5px * var(--ui-scale, 1)) var(--display, var(--font)); }
.talk-popover-head small { color: var(--muted, #667085); font-size: calc(12px * var(--ui-scale, 1)); }
.talk-pick-list, .talk-inbox-list { overflow-y: auto; padding: calc(6px * var(--ui-scale, 1)); }
.talk-pick-row {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: calc(10px * var(--ui-scale, 1));
  padding: calc(9px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
  border: 0;
  border-radius: calc(10px * var(--ui-scale, 1));
  background: transparent;
  color: inherit;
  font: 600 calc(13px * var(--ui-scale, 1)) var(--font);
  text-align: left;
  cursor: pointer;
}
.talk-pick-row:hover:not(:disabled) { background: rgba(var(--rh-accent-rgb, 76, 208, 155), .14); }
.talk-pick-row:disabled { cursor: default; opacity: .5; }
.talk-pick-row small { color: var(--muted, #667085); font-size: calc(11.5px * var(--ui-scale, 1)); font-weight: 500; white-space: nowrap; }
.talk-pick-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.talk-empty { margin: 0; padding: calc(12px * var(--ui-scale, 1)); color: var(--muted, #667085); font-size: calc(12.5px * var(--ui-scale, 1)); }
.talk-note {
  display: flex;
  align-items: center;
  gap: calc(8px * var(--ui-scale, 1));
  min-width: 0;
  margin: calc(4px * var(--ui-scale, 1));
  padding: calc(8px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1)) calc(12px * var(--ui-scale, 1));
  border-radius: calc(12px * var(--ui-scale, 1));
  background: rgba(var(--rh-accent-rgb, 76, 208, 155), .12);
  white-space: nowrap;
  transition: opacity .25s ease, transform .25s ease;
}
.talk-note.is-leaving { opacity: 0; transform: translateX(16px) scale(.97); }
/* Only the caller's name gives way when the row is short (a phone). */
.talk-note-who { min-width: 0; overflow: hidden; text-overflow: ellipsis; font: 700 calc(13.5px * var(--ui-scale, 1)) var(--font); }
.talk-note-depot {
  flex: 0 0 auto;
  padding: calc(1px * var(--ui-scale, 1)) calc(7px * var(--ui-scale, 1));
  border-radius: 999px;
  background: var(--surface, #fff);
  color: var(--muted, #667085);
  font: 700 calc(11px * var(--ui-scale, 1)) var(--font);
}
.talk-note-msg { flex: 0 0 auto; font: 700 calc(13.5px * var(--ui-scale, 1)) var(--font); }
.talk-note-from { flex: 0 0 auto; margin-left: auto; color: var(--muted, #667085); font-size: calc(11.5px * var(--ui-scale, 1)); }
/* A phone: two rows, the caller and the message above, the sender and Lest below. */
.talk-note-break { display: none; }
@media (max-width: 600px) {
  .talk-note { flex-wrap: wrap; row-gap: calc(6px * var(--ui-scale, 1)); }
  .talk-note-break { display: block; flex: 0 0 100%; height: 0; }
  .talk-note-from { margin-left: 0; }
  .talk-note-read { margin-left: auto; }
}
.talk-note-read {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: calc(6px * var(--ui-scale, 1));
  padding: calc(4px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
  border-radius: 999px;
  background: var(--surface, #fff);
  font: 700 calc(12px * var(--ui-scale, 1)) var(--font);
  cursor: pointer;
}
.talk-note-read input { width: calc(16px * var(--ui-scale, 1)); height: calc(16px * var(--ui-scale, 1)); margin: 0; accent-color: #111; cursor: pointer; }
html[data-theme="dark"] .talk-note-read input { accent-color: #fff; }
@media (prefers-reduced-motion: reduce) {
  .talk-send-btn > svg, .talk-send-overlay, .talk-row-sent, .talk-read-badge, .talk-request-status.is-new, .talk-request-status.is-new .talk-request-icon, .talk-popover { animation: none !important; }
}

/* Alle aktiviteter: plain line icons, no badge behind them, in every theme.
   A call's arrow points into the handset (rang us) or away from it (we rang). */
#call-logs-list .log-symbol {
  background: transparent !important;
  box-shadow: none !important;
  border: 0 !important;
  color: var(--ink, #182230) !important;
}
#call-logs-list .log-symbol .activity-icon {
  width: calc(18px * var(--ui-scale, 1));
  height: calc(18px * var(--ui-scale, 1));
  display: block;
}
#call-logs-list .log-symbol.missed { color: var(--red, #d92d20) !important; }
#call-logs-list .log-symbol.violet-icon { color: var(--green, #15714e) !important; }
#call-logs-list .log-symbol.orange-icon { color: var(--orange, #a3600e) !important; }
#call-logs-list .log-symbol .activity-icon-arrow { stroke-width: 2.2; }

/* Oversikt on a desktop: Fjord, Havn, Terrakotta and Grafitt give the chart and
   the Samtaler / Meldinger cards the same size as Lime and Lavendel
   (2026-11-25, Marius): the same columns, gap, padding and bar height. */
@media (min-width: 901px) {
  html:is([data-theme-name="fjord"], [data-theme-name="havn"], [data-theme-name="terrakotta"], [data-theme-name="grafitt"]) #dashboard-tab > .overview-pulse {
    grid-template-columns: minmax(calc(190px * var(--ui-scale, 1)), 1fr) minmax(0, 2.8fr) minmax(calc(190px * var(--ui-scale, 1)), 1fr) !important;
    gap: calc(15px * var(--ui-scale, 1)) !important;
  }
  html:is([data-theme-name="fjord"], [data-theme-name="havn"], [data-theme-name="terrakotta"], [data-theme-name="grafitt"]) #dashboard-tab > .overview-pulse > :is(.pulse-stat, .pulse-chart) {
    padding: calc(20px * var(--ui-scale, 1)) calc(18px * var(--ui-scale, 1)) !important;
  }
  html:is([data-theme-name="fjord"], [data-theme-name="havn"], [data-theme-name="terrakotta"], [data-theme-name="grafitt"]) #dashboard-tab .pulse-bars {
    min-height: calc(128px * var(--ui-scale, 1));
  }
}

/* Meldinger: "Nye meldinger ↓" when a message arrives below where the agent
   is reading. It floats at the bottom of the conversation, on the theme's surface. */
.sms-new-below[hidden] { display: none !important; }
.sms-new-below {
  position: sticky;
  bottom: calc(10px * var(--ui-scale, 1));
  z-index: 3;
  align-self: center;
  display: flex;
  align-items: center;
  gap: calc(6px * var(--ui-scale, 1));
  width: fit-content;
  margin: calc(4px * var(--ui-scale, 1)) auto 0;
  padding: calc(7px * var(--ui-scale, 1)) calc(14px * var(--ui-scale, 1));
  border: calc(1px * var(--ui-scale, 1)) solid var(--line, #e7eaf0);
  border-radius: 999px;
  /* Not the ink of a sent bubble nor the grey of a received one. */
  background: var(--surface, #fff);
  color: var(--ink, #182230);
  font: 700 calc(12.5px * var(--ui-scale, 1)) var(--font);
  box-shadow: 0 calc(6px * var(--ui-scale, 1)) calc(18px * var(--ui-scale, 1)) rgba(16, 24, 40, .22);
  cursor: pointer;
  animation: sms-new-below-in .25s ease-out both;
}
.sms-new-below:focus-visible { outline: 2px solid color-mix(in srgb, var(--blue) 55%, transparent); outline-offset: 2px; }
@keyframes sms-new-below-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .sms-new-below { animation: none; } }

/* Meldinger on a phone: a lower conversation head (2026-11-25, Marius, from
   the Chat audit). Ring, E-post, Kundekort and Ta samtale share one row that
   scrolls sideways if it must, and the Zisson line is one compact row. */
@media (max-width: 900px) {
  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) #sms-contact-actions:not(.hidden) {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    scrollbar-width: none;
    gap: 5px !important;
    padding-right: 8px !important;
  }
  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) #sms-contact-actions:not(.hidden)::-webkit-scrollbar { display: none; }
  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) #sms-contact-actions > .button {
    height: 32px !important;
    min-height: 32px !important;
    padding: 0 10px !important;
    font-size: 12.5px !important;
  }
  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) #sms-zisson-result:not(:empty) {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 8px !important;
    min-width: 0 !important;
    overflow-x: auto !important;
    scrollbar-width: none;
  }
  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) #sms-zisson-result .zisson-lookup-line {
    flex: 0 1 auto !important;
    min-width: 0 !important;
    font-size: 12px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  html:has(.content-scroll.mobile-scroll-locked #sms-tab.active .inbox-layout.mobile-sms-thread-open) #sms-zisson-result .zisson-lookup-button {
    flex: 0 0 auto !important;
    height: 28px !important;
    min-height: 28px !important;
    padding: 0 10px !important;
    font-size: 12px !important;
  }
}

/* Oversikt (2026-11-25, Marius, from the Dashboard and Feed audits). */
/* "2 tapt" filters the list to the missed calls of the day; pressed it turns red. */
#pulse-calls-note.is-clickable {
  cursor: pointer;
  /* A pill in every theme, as Lime and Lavendel draw it. */
  padding: calc(3px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
  border-radius: 999px;
  transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
}
#pulse-calls-note.is-clickable:hover { box-shadow: inset 0 0 0 calc(1px * var(--ui-scale, 1)) color-mix(in srgb, var(--red, #d92d20) 45%, transparent); }
#pulse-calls-note.is-clickable:focus-visible { outline: 2px solid color-mix(in srgb, var(--red, #d92d20) 55%, transparent); outline-offset: 2px; }
#dashboard-tab #pulse-calls-note.is-active {
  background: color-mix(in srgb, var(--red, #d92d20) 14%, transparent) !important;
  color: var(--red, #d92d20) !important;
  font-weight: 700;
}
/* The phone has no cards: the same chip sits after Samtaler in the legend. */
.pulse-legend-missed { display: none; }
@media (max-width: 900px) {
  .pulse-legend-missed:not([hidden]) {
    display: inline-flex;
    align-items: center;
    margin: 0 calc(4px * var(--ui-scale, 1)) 0 calc(2px * var(--ui-scale, 1));
    padding: calc(2px * var(--ui-scale, 1)) calc(8px * var(--ui-scale, 1));
    border: calc(1px * var(--ui-scale, 1)) solid color-mix(in srgb, var(--red, #d92d20) 35%, transparent);
    border-radius: 999px;
    background: transparent;
    color: var(--red, #d92d20);
    font: 700 calc(12px * var(--ui-scale, 1)) var(--font);
    cursor: pointer;
  }
  .pulse-legend-missed.is-active {
    background: color-mix(in srgb, var(--red, #d92d20) 14%, transparent);
    border-color: transparent;
  }
}
/* The arrow back to the newest row also says how many arrived: "↑ 3 nye". */
.scroll-top-button.has-count {
  width: auto;
  gap: calc(5px * var(--ui-scale, 1));
  padding: 0 calc(12px * var(--ui-scale, 1)) 0 calc(9px * var(--ui-scale, 1));
  border-radius: 999px;
}
.scroll-top-button.has-count svg { width: calc(16px * var(--ui-scale, 1)); height: calc(16px * var(--ui-scale, 1)); flex: none; }
.scroll-top-count[hidden] { display: none; }
.scroll-top-count { font: 700 calc(12.5px * var(--ui-scale, 1)) var(--font); white-space: nowrap; }

/* MBN page (2026-11-25): the common SMS line note and the administrator's
   sending test. Theme variables only. */
.mbn-central-line { margin: 0 0 calc(8px * var(--ui-scale, 1)); font-weight: 600; color: var(--ink, #182230); }
.mbn-sms-test[hidden] { display: none !important; }
.mbn-sms-test-form { display: flex; flex-wrap: wrap; gap: calc(10px * var(--ui-scale, 1)); }
.mbn-sms-test-form .mbn-field { flex: 1 1 calc(160px * var(--ui-scale, 1)); }
.mbn-sms-test-results { margin: calc(10px * var(--ui-scale, 1)) 0 0; padding-left: calc(22px * var(--ui-scale, 1)); display: grid; gap: calc(4px * var(--ui-scale, 1)); font-size: calc(13px * var(--ui-scale, 1)); color: var(--ink, #182230); }
.mbn-sms-test-results li.is-ok::marker { color: var(--green, #15714e); }
.mbn-sms-test-results li.is-failed { color: var(--red, #b03d3d); }

/* Confirmation before an SMS leaves through MBN (Marius, 2026-11-26). It is a
   .template-menu, so every theme and dark mode already style its surface; it
   sits on body with fixed position, placed above Send by app.js. */
html body #sms-mbn-confirm.template-menu.sms-mbn-confirm {
  position: fixed !important;
  right: auto !important;
  bottom: auto !important;
  width: min(calc(300px * var(--ui-scale, 1)), calc(100vw - 24px)) !important;
  max-height: none !important;
  overflow: visible !important;
  padding: calc(14px * var(--ui-scale, 1)) !important;
  z-index: 1200;
  border-left: calc(4px * var(--ui-scale, 1)) solid #ea580c !important;
}
.sms-mbn-confirm .sms-mbn-confirm-title {
  margin: 0 0 calc(4px * var(--ui-scale, 1));
  font-weight: 700;
  font-size: calc(14px * var(--ui-scale, 1));
  color: #c2410c;
}
html[data-theme="dark"] .sms-mbn-confirm .sms-mbn-confirm-title { color: #fb923c; }
.sms-mbn-confirm .sms-mbn-confirm-text {
  margin: 0 0 calc(12px * var(--ui-scale, 1));
  font-size: calc(13px * var(--ui-scale, 1));
  line-height: 1.4;
}
.sms-mbn-confirm .sms-mbn-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: calc(8px * var(--ui-scale, 1));
}
