/* additions on top of the Traefik Control stylesheet */
.chart { width: 100%; height: 260px; display: block; }
.chart text { fill: var(--dim); font-size: 10px; font-family: inherit; }
.chart .gridl { stroke: var(--line); stroke-width: 1; }
.chart .bar-s { fill: var(--cyan); } .chart .bar-r { fill: var(--violet); }
.chart .bar-s, .chart .bar-r { transition: opacity .2s; } .chart g:hover .bar-s, .chart g:hover .bar-r { opacity: .7; }
.chart .line { fill: none; stroke: var(--pink); stroke-width: 2; stroke-linejoin: round; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-bottom: 8px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.err { color: var(--red); font-size: 13px; min-height: 20px; margin: -4px 0 10px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
th.num { text-align: right; }
.secret { word-break: break-all; padding: 12px; border-radius: 11px; background: rgba(4,6,14,.7); border: 1px dashed var(--line-hi); font-size: 12.5px; margin: 6px 0 14px; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; font-size: 13px; }
.kv dt { color: var(--dim); } .kv dd { margin: 0; word-break: break-all; }
.bubble { padding: 10px 14px; border-radius: 14px; background: rgba(148,163,255,.08); border: 1px solid var(--line); margin: 6px 0; max-width: 92%; white-space: pre-wrap; word-break: break-word; }
.bubble.out { margin-left: auto; background: rgba(56,189,248,.1); border-color: rgba(56,189,248,.25); }
.pager { display: flex; align-items: center; gap: 10px; justify-content: flex-end; margin-top: 18px; color: var(--muted); font-size: 12.5px; }
.table-wrap tbody tr.click { cursor: pointer; }
.card.span { grid-column: 1 / -1; }
.pill.info { color: var(--cyan); background: rgba(56,189,248,.1); border-color: rgba(56,189,248,.25); }

.status-line .pill:first-child { margin-left: 0; }
.checks .status-line { justify-content: flex-start; }
.kv .pill { text-transform: none; }

.grow { flex: 1; }
.toolbar .btn svg, .actions .btn svg { flex: none; }
td.actions .btn svg { width: 14px; height: 14px; }

/* notifications bell + panel */
.bell { position: relative; }
.bell svg { width: 19px; height: 19px; }
.bell-n { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--pink); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--bg); }
.bell-n[hidden] { display: none; }
.np { position: fixed; z-index: 60; top: 72px; right: 34px; width: min(400px, calc(100vw - 24px)); max-height: min(560px, calc(100vh - 96px)); display: flex; flex-direction: column; border-radius: 18px; background: var(--panel-solid); box-shadow: var(--shadow), 0 30px 70px -20px rgba(0, 0, 0, .8); animation: pop .3s var(--ease) both; overflow: hidden; }
.np-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.np-head b { font-size: 14px; }
.np-list { overflow-y: auto; }
.np-list .empty { padding: 36px 20px; }
.np-item { display: flex; gap: 12px; width: 100%; text-align: left; padding: 13px 16px; border: 0; border-bottom: 1px solid rgba(148, 163, 255, .06); background: transparent; cursor: pointer; transition: background .2s; }
.np-item:hover { background: rgba(148, 163, 255, .06); }
.np-item.unread { background: rgba(56, 189, 248, .06); }
.np-item:last-child { border-bottom: 0; }
.np-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; flex: none; background: var(--dim); }
.np-item.unread .np-dot.info { background: var(--cyan); } .np-item.unread .np-dot.busy { background: var(--amber); } .np-item.unread .np-dot.bad { background: var(--red); }
.np-item:not(.unread) .np-dot { opacity: .35; }
.np-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.np-t b { font-size: 13px; font-weight: 600; }
.np-item:not(.unread) .np-t b { font-weight: 500; color: var(--muted); }
.np-t span { color: var(--muted); font-size: 12.5px; }
.np-t small { color: var(--dim); font-size: 11.5px; }

/* conversations */
.chat { display: grid; grid-template-columns: 340px 1fr; gap: 18px; align-items: start; }
.chat .card { padding: 0; }
.chat-list .toolbar { padding: 14px 14px 0; margin-bottom: 10px; }
.chat-list .search { max-width: none; }
.cv-list { padding: 4px 8px 12px; max-height: calc(100vh - 230px); min-height: 200px; overflow-y: auto; }
.cv { display: flex; gap: 12px; width: 100%; text-align: left; padding: 10px; border: 1px solid transparent; border-radius: 13px; background: transparent; cursor: pointer; transition: background .2s, border-color .2s; }
.cv:hover { background: rgba(148, 163, 255, .06); }
.cv.on { background: linear-gradient(90deg, rgba(56, 189, 248, .14), rgba(168, 85, 247, .06)); border-color: var(--line-hi); }
.cv .avatar, .ct-head .avatar { flex: none; }
.cv-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cv-top { display: flex; align-items: baseline; gap: 8px; }
.cv-top b { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-top small { color: var(--dim); font-size: 11px; flex: none; }
.cv-pre { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-pre i { color: var(--dim); font-style: normal; }
.cv-opt .pill { padding: 1px 8px 1px 7px; font-size: 10.5px; margin-top: 3px; }
.chat-thread { display: flex; flex-direction: column; min-height: 420px; height: calc(100vh - 160px); max-height: 760px; }
.chat-thread > .empty { margin: auto; }
.chat-thread > .skeleton { margin: 14px; }
.ct-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.ct-who { display: flex; flex-direction: column; min-width: 0; }
.ct-who b { font-size: 14.5px; } .ct-who small { color: var(--dim); font-size: 12px; }
.ct-back { display: none; }
.thread { flex: 1; overflow-y: auto; padding: 16px 20px 22px; display: flex; flex-direction: column; }
.thread .bubble { width: fit-content; min-width: 90px; max-width: min(78%, 560px); margin: 3px 0; }
.thread .bubble.out { margin-left: auto; }
.bmeta { font-size: 10.5px; color: var(--dim); margin-top: 3px; text-align: right; }
.bad-t { color: var(--red); }
.day-sep { display: flex; justify-content: center; margin: 14px 0 8px; }
.day-sep span { font-size: 11px; color: var(--dim); padding: 3px 12px; border-radius: 99px; background: rgba(148, 163, 255, .07); border: 1px solid var(--line); }
.older { display: flex; justify-content: center; margin-bottom: 8px; }
@media (max-width: 960px) {
  .np { right: 12px; left: 12px; width: auto; top: 64px; }
  .chat { grid-template-columns: 1fr; }
  .chat.has-thread .chat-list { display: none; }
  .chat:not(.has-thread) .chat-thread { display: none; }
  .chat-thread { height: calc(100vh - 170px); }
  .ct-back { display: inline-flex; }
  .cv-list { max-height: none; }
  .thread .bubble { max-width: 86%; }
}
.pill.nocap { text-transform: none; }
@media (max-width: 960px) {
  .topbar { position: relative; }
  .topbar .actions .bell { position: absolute; top: 0; right: 0; }
  .topbar .actions:has(> .bell:only-child) { display: contents; }
}
@media (max-width: 640px) {
  .toolbar .search { flex-basis: 100%; max-width: none; }
  .toolbar .input { max-width: none; }
  .toolbar #xm, .toolbar .grow { flex: none; }
}

/* user chip: long emails truncate */
.user-chip .who b, .user-chip .who small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .btn { flex: none; }
.ro-note { margin-bottom: 18px; }
.btn:disabled[aria-disabled="true"], .input:disabled { cursor: not-allowed; }

/* tables: visible scroll affordance (edge shadows appear when content is clipped) */
.table-wrap {
  background:
    linear-gradient(to right, #0e1328 30%, rgba(14, 19, 40, 0)) 0 0 / 40px 100% no-repeat local,
    linear-gradient(to left, #0e1328 30%, rgba(14, 19, 40, 0)) 100% 0 / 40px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, rgba(168, 85, 247, .45), rgba(0, 0, 0, 0)) 0 0 / 14px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, rgba(168, 85, 247, .45), rgba(0, 0, 0, 0)) 100% 0 / 14px 100% no-repeat scroll;
}
@media (max-width: 640px) {
  th, td { padding-left: 12px; padding-right: 12px; }
  .table-wrap { margin-left: -20px; margin-right: -20px; }
  .hide-m { display: none; }
  td.actions { white-space: normal; }
}

/* ---- accessibility: custom checkboxes/switches stay focusable (visually hidden, never display:none) ---- */
.check, .switch { position: relative; }
.check input, .switch input { display: block; position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.switch input { inset: 0 auto auto 0; }
.check input:focus-visible + .box, .switch input:focus-visible + i { outline: 2px solid var(--cyan); outline-offset: 2px; }
.check input:disabled + .box, .switch input:disabled + i { opacity: .5; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.input:focus-visible { outline: none; }
tr.click:focus-visible { outline: 2px solid var(--cyan); outline-offset: -2px; background: rgba(148, 163, 255, .06); }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; padding: 10px 16px; border-radius: 10px; background: var(--panel-solid); color: var(--text); box-shadow: var(--shadow); transition: top .15s; }
.skip:focus { top: 12px; }
#view:focus { outline: none; }
.topbar h1 { margin: 0; font-size: 26px; letter-spacing: -0.025em; font-weight: 800; }
.topbar { min-width: 0; }
.topbar > div:first-child { min-width: 0; }
.topbar .actions { min-width: 0; max-width: 100%; }

/* ---- dialogs: scroll on short viewports, sticky footer ---- */
.backdrop { overflow-y: auto; overscroll-behavior: contain; }
.modal { max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); overflow-y: auto; }
.modal .foot { position: sticky; bottom: -26px; margin: 12px -26px -26px; padding: 14px 26px; background: var(--panel-solid); border-top: 1px solid var(--line); }
.drawer { max-width: 100vw; }

/* ---- toasts ---- */
.toast .toast-x { margin-left: auto; padding: 4px; flex: none; }
.toast .toast-x svg { margin: 0; width: 14px; height: 14px; }
.toast.err::after { display: none; }
.toast.err { border: 1px solid rgba(248, 113, 113, .35); }

/* ---- long content ---- */
td, th { overflow-wrap: break-word; }
td .primary, td .secondary { max-width: 340px; overflow-wrap: break-word; }
td.num, th.num, td.actions { overflow-wrap: normal; }
.topbar select.input, .toolbar select.input { max-width: 240px; text-overflow: ellipsis; }
.ct-who { flex: 0 1 auto; min-width: 0; }
.ct-who b, .ct-who small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-head .pill { flex: none; }
.np-t { min-width: 0; overflow-wrap: anywhere; }
.status-line { flex-wrap: wrap; }
.status-line code, .status-line span { overflow-wrap: anywhere; min-width: 0; }
.kv dd { overflow-wrap: anywhere; }
.nw { white-space: nowrap; }
.kpi .val.price { font-size: 24px; }
.kpi .val.price small { white-space: nowrap; }

/* ---- sidebar scrim (mobile) ---- */
.scrim { display: none; }
@media (max-width: 960px) {
  .scrim.show { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(3, 4, 10, .6); backdrop-filter: blur(3px); }
  .seg { flex-wrap: wrap; max-width: 100%; }
  .topbar .actions { width: 100%; }
}

/* configuration warnings */
.warn-card { margin-bottom: 18px; border: 1px solid rgba(251, 191, 36, .35); background: linear-gradient(135deg, rgba(251, 191, 36, .1), rgba(248, 113, 113, .06)); }
.warn-card h3 svg { color: var(--amber); }
.warn-card ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; color: var(--text); }

/* final round */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.kpi .val.price { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 6px; max-width: 100%; }
.kpi .val.price.lg { font-size: 20px; } .kpi .val.price.xl { font-size: 16px; }
td code.rule, code.rule { white-space: nowrap; }
.cv-num { font-size: 11.5px; color: var(--dim); }
