/* ==========================================================================
   Icingo Web – design tokens
   Light is the default; dark applies with the system setting (unless the
   user picked "light") or when the user picked "dark".
   ========================================================================== */
:root {
  color-scheme: light;
  --bg: #f4f6f9;           /* app background behind cards */
  --panel: #ffffff;        /* columns, cards, dialogs */
  --panel-2: #f8fafc;      /* subtle fills: table heads, code, inputs */
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --border: #e5e9f0;
  --border-strong: #d3dae4;
  --row-hover: #f3f6fa;
  --row-active: #e6f3fb;

  --sidebar: #0d1424;
  --sidebar-2: #131c30;    /* search field, hover */
  --sidebar-text: #a3afc2;
  --sidebar-head: #6b7891;
  --sidebar-border: #1c263b;
  --sidebar-active: rgba(56, 170, 238, .14);

  --brand: #0ea5e9;        /* logo */
  --accent: #0277bd;       /* links, active marks, focus */
  --primary: #0277bd;      /* primary buttons (white text, 4.9:1) */
  --primary-hover: #01659f;
  --accent-soft: #e3f1fa;
  --focus-ring: 0 0 0 3px rgba(2, 119, 189, .22);

  /* status colors (Icinga semantics, reserved for state) */
  --ok: #44bb77;
  --warning: #ffaa44;
  --critical: #ff5566;
  --unknown: #aa44ff;
  --pending: #77aaff;
  --ok-handled: #8fd3ab;
  --warning-handled: #ffcc8e;
  --critical-handled: #ff99a4;
  --unknown-handled: #cc8fff;
  --critical-soft: #fff0f2;

  --series-1: #2a78d6; /* icingo (categorical slot 1, validated on #ffffff) */
  --series-2: #eb6834; /* whole system (slot 2) */

  --radius: 6px;
  --radius-lg: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 1px 3px rgba(15, 23, 42, .07), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-lg: 0 24px 60px rgba(15, 23, 42, .28);
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "Cascadia Code", Consolas, "JetBrains Mono", "DejaVu Sans Mono", monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0a0f1a; --panel: #111827; --panel-2: #172031; --text: #e6eaf0; --text-2: #c3cad6; --muted: #8b97ab;
    --border: #222d40; --border-strong: #2f3c52; --row-hover: #172133; --row-active: #10304a;
    --sidebar: #080c15; --sidebar-2: #111a2a; --sidebar-border: #162034;
    --accent: #4cb3ee; --accent-soft: #10304a; --focus-ring: 0 0 0 3px rgba(76, 179, 238, .3);
    --series-1: #3987e5; --series-2: #d95926; /* dark steps */
    --ok-handled: #2f6e4a; --warning-handled: #8a6230; --critical-handled: #8a3a44; --unknown-handled: #5f3a85;
    --critical-soft: #3a1820;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3); --shadow: 0 1px 3px rgba(0, 0, 0, .4); --shadow-lg: 0 24px 60px rgba(0, 0, 0, .6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0f1a; --panel: #111827; --panel-2: #172031; --text: #e6eaf0; --text-2: #c3cad6; --muted: #8b97ab;
  --border: #222d40; --border-strong: #2f3c52; --row-hover: #172133; --row-active: #10304a;
  --sidebar: #080c15; --sidebar-2: #111a2a; --sidebar-border: #162034;
  --accent: #4cb3ee; --accent-soft: #10304a; --focus-ring: 0 0 0 3px rgba(76, 179, 238, .3);
  --series-1: #3987e5; --series-2: #d95926;
  --ok-handled: #2f6e4a; --warning-handled: #8a6230; --critical-handled: #8a3a44; --unknown-handled: #5f3a85;
  --critical-soft: #3a1820;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3); --shadow: 0 1px 3px rgba(0, 0, 0, .4); --shadow-lg: 0 24px 60px rgba(0, 0, 0, .6);
}

/* ==========================================================================
   base
   ========================================================================== */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { display: flex; font: 14px/1.5 var(--font); color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent-soft); }
table { font-variant-numeric: tabular-nums; }
.ico { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* thin, quiet scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }
#sidebar * { scrollbar-color: var(--sidebar-border) transparent; }

/* ==========================================================================
   sidebar
   ========================================================================== */
#sidebar { width: var(--sidebar-w, 240px); flex: none; background: var(--sidebar); color: var(--sidebar-text); display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; padding: 16px 16px 14px; font-size: 18px; font-weight: 650; color: #fff; letter-spacing: .2px; }
.brand span { flex: 1; }
.logo { flex: none; display: block; }
#menu-toggle { display: none; background: none; border: 0; color: #fff; font-size: 20px; cursor: pointer; }
#global-search { position: relative; padding: 0 12px 12px; }
#global-search .search-ico { position: absolute; left: 22px; top: 9px; color: var(--sidebar-head); pointer-events: none; }
#global-search input { width: 100%; padding: 7px 10px 7px 32px; border-radius: var(--radius); border: 1px solid var(--sidebar-border); background: var(--sidebar-2); color: #fff; transition: border-color .15s, box-shadow .15s; }
#global-search input::placeholder { color: var(--sidebar-head); }
#global-search input:focus { outline: none; border-color: #2b88c8; box-shadow: 0 0 0 3px rgba(56, 170, 238, .2); }
#menu { flex: 1; overflow-y: auto; padding: 0 8px 12px; }
#menu a { position: relative; display: flex; align-items: center; gap: 10px; margin: 1px 0; padding: 6px 10px; border-radius: var(--radius); text-decoration: none; font-size: 13.5px; transition: background .12s, color .12s; }
#menu a i { font-style: normal; width: 18px; display: grid; place-items: center; opacity: .8; }
#menu a:hover { background: var(--sidebar-2); color: #fff; }
#menu a.active { background: var(--sidebar-active); color: #fff; font-weight: 600; }
#menu a.active::before { content: ""; position: absolute; left: -8px; top: 6px; bottom: 6px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
#menu a.active i { opacity: 1; color: #6cc6f5; }
#menu .section { padding: 16px 10px 6px; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .9px; color: var(--sidebar-head); display: flex; justify-content: space-between; align-items: center; }
.badge { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 10px; font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; color: #fff; }
.badge:empty { display: none; }
.badge.critical { background: var(--critical); }
.badge.warning { background: var(--warning); }
.sidebar-foot { display: flex; align-items: center; padding-right: 8px; }
.sidebar-foot .live { flex: 1; }
#nav-collapse .ico { transition: transform .15s; }
body.nav-rail #nav-collapse .ico { transform: rotate(180deg); }

/* collapsible sections */
#menu .section[data-key] { cursor: pointer; user-select: none; justify-content: flex-start; gap: 4px; border-radius: var(--radius); }
#menu .section[data-key]:hover { color: var(--sidebar-text); }
#menu .section .caret { width: 12px; height: 12px; margin-left: -2px; transition: transform .15s; }
#menu .section.closed .caret { transform: rotate(-90deg); }
#menu .section .badge { margin-left: auto; }

/* icon bar: the folded navigation */
@media (min-width: 761px) {
  body.nav-rail #sidebar { width: 60px; }
  body.nav-rail .brand { justify-content: center; padding: 16px 0 14px; }
  body.nav-rail .brand span, body.nav-rail #global-search, body.nav-rail #menu .section,
  body.nav-rail .userbox .who, body.nav-rail .live .txt, body.nav-rail #resize-sidebar { display: none; }
  body.nav-rail #menu { padding: 4px 8px 12px; }
  body.nav-rail #menu .menu-group[hidden] { display: block !important; }
  body.nav-rail #menu .menu-group + .section + .menu-group, body.nav-rail #menu-custom { border-top: 1px solid var(--sidebar-border); }
  body.nav-rail #menu a { justify-content: center; padding: 8px 0; font-size: 0; }
  body.nav-rail #menu a i { width: auto; }
  body.nav-rail #menu a .badge { position: absolute; top: 2px; right: 2px; min-width: 16px; padding: 0 4px; font-size: 10px; line-height: 15px; }
  body.nav-rail #menu a.active::before { left: -8px; }
  body.nav-rail .userbox { flex-direction: column; gap: 4px; margin: 0 6px; padding: 10px 0 6px; }
  body.nav-rail .sidebar-foot { flex-direction: column; padding: 0 0 8px; gap: 4px; }
  body.nav-rail .sidebar-foot .live { padding: 4px 0; justify-content: center; }
}
.live { padding: 8px 16px 10px; font-size: 11.5px; display: flex; align-items: center; gap: 8px; color: var(--sidebar-head); }
.live .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--sidebar-head); }
.live.on .dot { background: var(--ok); box-shadow: 0 0 0 3px rgba(68, 187, 119, .2); }
.live.off .dot { background: var(--critical); box-shadow: 0 0 0 3px rgba(255, 85, 102, .2); }

.userbox { display: flex; align-items: center; gap: 8px; margin: 0 8px; padding: 10px 6px 8px 8px; border-top: 1px solid var(--sidebar-border); }
.userbox .avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, #0ea5e9, #6366f1); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 13px; flex: none; }
.userbox .who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.userbox .who b { color: #fff; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.userbox .who small { color: var(--sidebar-head); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { background: none; border: 0; color: var(--sidebar-text); border-radius: var(--radius); width: 28px; height: 28px; cursor: pointer; display: grid; place-items: center; padding: 0; flex: none; transition: background .12s, color .12s; }
.icon-btn:hover { background: var(--sidebar-2); color: #fff; }
#btn-theme .ico { display: none; }
#btn-theme[data-mode="auto"] .th-auto, #btn-theme[data-mode="light"] .th-light, #btn-theme[data-mode="dark"] .th-dark { display: block; }
#btn-theme .th-auto path { stroke: none; }

/* ==========================================================================
   login
   ========================================================================== */
#login { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(1200px 600px at 20% 0%, rgba(14, 165, 233, .22), transparent 60%),
              radial-gradient(900px 500px at 100% 100%, rgba(99, 102, 241, .18), transparent 60%), var(--sidebar); }
#login.hidden { display: none; }
.login-box { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 32px 30px 26px; display: grid; gap: 16px; box-shadow: var(--shadow-lg); }
.login-brand { display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 26px; font-weight: 650; letter-spacing: .2px; margin-bottom: 8px; }
.login-error { color: var(--critical); font-size: 13px; min-height: 18px; }
.login-btn { padding: 10px; font-size: 14.5px; font-weight: 600; }
.perm-list { display: flex; flex-wrap: wrap; gap: 4px; }
.perm { font: 11px var(--mono); padding: 1px 7px; border-radius: 4px; background: var(--panel-2); border: 1px solid var(--border); color: var(--text-2); }

/* ==========================================================================
   columns
   ========================================================================== */
#main { flex: 1; display: flex; min-width: 0; height: 100vh; }
.col { flex: 1 1 50%; min-width: 0; overflow-y: auto; background: var(--panel); }
#main.has-detail #col-list { flex: 0 0 var(--list-w, 50%); }
#col-detail { background: var(--panel); }
/* card views (dashboard, groups, status) sit on the canvas color */
#col-list:has(.dash, .groups, .sys) { background: var(--bg); }

/* drag handles between the areas */
.resizer { flex: none; width: 6px; margin: 0 -3px; position: relative; z-index: 5; cursor: col-resize; touch-action: none; }
.resizer::after { content: ""; position: absolute; inset: 0 2px; background: transparent; transition: background .15s; }
.resizer:hover::after, .resizer:focus-visible::after, body.resizing .resizer.dragging::after { background: var(--accent); }
.resizer:focus-visible { outline: none; }
#resize-sidebar { background: var(--sidebar); }
#main:not(.has-detail) #resize-detail { display: none; }
#resize-detail { border-left: 1px solid var(--border); }
body.resizing { cursor: col-resize; user-select: none; }
body.resizing iframe, body.resizing .col { pointer-events: none; }
.col.hidden { display: none; }
.col-header { position: sticky; top: 0; z-index: 2; background: color-mix(in srgb, var(--panel) 92%, transparent); backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--border); padding: 16px 20px 12px; }
.col-header h1 { margin: 0 0 10px; font-size: 19px; font-weight: 650; letter-spacing: -.2px; display: flex; align-items: center; gap: 10px; }
.col-header h1 .count { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 0 8px; line-height: 20px; letter-spacing: 0; }
.col-header .close-detail { margin-left: auto; width: 30px; height: 30px; border-radius: var(--radius); background: none; border: 0; font-size: 20px; line-height: 1; cursor: pointer; color: var(--muted); }
.col-header .close-detail:hover { background: var(--row-hover); color: var(--text); }
.col-body { padding: 0 0 28px; }

/* ==========================================================================
   filters & chips
   ========================================================================== */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters input[type=search], .filters select { padding: 6px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s; }
.filters input[type=search]:focus, .filters select:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }
.filters input[type=search] { flex: 1; min-width: 160px; }
.chip { padding: 3px 11px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--panel); color: var(--text-2); cursor: pointer; font-size: 12px; font-weight: 500; user-select: none; transition: background .12s, border-color .12s, color .12s; }
.chip:hover { border-color: var(--accent); }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }

/* ==========================================================================
   state list
   ========================================================================== */
table.list { width: 100%; border-collapse: collapse; }
table.list td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.list tr.row { cursor: pointer; transition: background .1s; }
table.list tr.row:hover { background: var(--row-hover); }
table.list tr.row.active { background: var(--row-active); box-shadow: inset 3px 0 0 var(--accent); }
td.state { width: 100px; padding: 0 !important; }
.state-box { margin: 7px 0 7px 12px; padding: 4px 6px; border-radius: var(--radius); color: #fff; text-align: center; font-size: 11px; line-height: 1.3; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .04); }
.state-box b { display: block; font-size: 11.5px; font-weight: 700; letter-spacing: .5px; }
.state-box.ok, .state-box.up { background: var(--ok); }
.state-box.warning { background: var(--warning); }
.state-box.critical, .state-box.down { background: var(--critical); }
.state-box.unknown { background: var(--unknown); }
.state-box.pending { background: var(--pending); }
.state-box.handled.warning { background: var(--warning-handled); }
.state-box.handled.critical, .state-box.handled.down { background: var(--critical-handled); }
.state-box.handled.unknown { background: var(--unknown-handled); }
.state-box.disabled { background: var(--border-strong); color: var(--text-2); box-shadow: none; }
.state-box.disabled span { opacity: .8; }
table.list tr.row.is-disabled td.main { opacity: .6; }
.notice.error { border-color: color-mix(in srgb, var(--critical) 35%, transparent); border-left-color: var(--critical); background: var(--critical-soft); }
#modal-form .notice { margin: 0; }
th.pick, td.pick { width: 28px; padding-right: 0 !important; }
.import-list { max-height: 40vh; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.import-list table.grid td { padding: 5px 10px; }
.mail-test { display: flex; gap: 8px; align-items: flex-end; }
.mail-test .field { flex: 1; }
.notice.off { border-color: var(--border-strong); border-left-color: var(--muted); background: var(--panel-2); }
.onoff-tools { display: flex; gap: 6px; }
.onoff-list { display: grid; gap: 2px; max-height: 50vh; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius); padding: 6px; }
.onoff-row { display: flex; align-items: center; gap: 10px; padding: 5px 6px; border-radius: var(--radius); cursor: pointer; }
.onoff-row:hover { background: var(--row-hover); }
.onoff-row small { color: var(--muted); }
.state-box.soft { background-image: repeating-linear-gradient(135deg, transparent 0 6px, rgba(255,255,255,.18) 6px 12px); }
.obj-title { font-weight: 600; }
.obj-title .on { color: var(--muted); font-weight: normal; }
.obj-output { color: var(--muted); font-family: var(--mono); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; margin-top: 1px; }
td.main { max-width: 0; }
.icons { margin-left: 6px; font-weight: normal; color: var(--muted); }
.icons span { margin-right: 4px; }
.mini-states { display: flex; gap: 4px; margin-top: 5px; flex-wrap: wrap; }
.mini { font-size: 11px; font-weight: 600; padding: 0 7px; border-radius: 9px; color: #fff; line-height: 18px; }
.mini.ok, .mini.up { background: var(--ok); } .mini.warning { background: var(--warning); }
.mini.critical, .mini.down { background: var(--critical); } .mini.unknown { background: var(--unknown); }
.mini.pending { background: var(--pending); }
.empty { padding: 36px 16px; color: var(--muted); text-align: center; }

/* ==========================================================================
   dashboard
   ========================================================================== */
.dash { padding: 20px; display: grid; gap: 20px; }

/* own dashboards: 12-column grid, rows of 32 px (see internal/api/dashlayout.go) */
.board-grid { padding: 20px; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-auto-rows: 32px; gap: 16px; }
.board-grid > .dashlet { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.dashlet > h3 { flex: none; }
.dashlet > h3 > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dashlet > h3 > a { flex: none; margin-left: auto; }
.dl-body { flex: 1; min-height: 0; overflow: auto; }
.dl-resize { display: none; position: absolute; right: 0; bottom: 0; width: 18px; height: 18px; cursor: nwse-resize; touch-action: none;
  background: linear-gradient(135deg, transparent 0 50%, var(--border-strong) 50% 58%, transparent 58% 70%, var(--border-strong) 70% 78%, transparent 78%); }
.board-grid.editing > .dashlet { outline: 2px dashed var(--border-strong); outline-offset: -2px; }
.board-grid.editing > .dashlet:focus-visible { outline: 2px solid var(--accent); }
.board-grid.editing > .dashlet > h3 { cursor: grab; user-select: none; touch-action: none; background: var(--panel-2); }
.board-grid.editing .dl-body { pointer-events: none; opacity: .65; }
.board-grid.editing .dl-resize { display: block; }
.board-grid.editing > .dashlet.dragging { z-index: 5; box-shadow: var(--shadow-lg); outline-color: var(--accent); }
.board-grid.editing > .dashlet.dragging > h3 { cursor: grabbing; }
.layout-hint { color: var(--muted); }
.tab-menu { align-self: center; width: 22px; height: 26px; margin-left: -6px; border: 0; border-radius: var(--radius); background: none; color: var(--muted); font-size: 16px; line-height: 1; cursor: pointer; }
.tab-menu:hover, .tab-menu:focus-visible { background: var(--row-hover); color: var(--text); }

/* full screen (kiosk) dashboards: no menu, no detail, display only */
body.kiosk #sidebar, body.kiosk .resizer, body.kiosk #col-detail { display: none !important; }
body.kiosk #main { height: 100vh; }
body.kiosk .board-grid { padding: 16px 20px; }
body.kiosk .dashlet .dl-menu, body.kiosk .dashlet > h3 > a { display: none; }
body.kiosk table.list tr.row { cursor: default; }
body.kiosk table.list tr.row:hover { background: none; }
body.kiosk .sticky-pin { pointer-events: none; }
.kiosk-bar { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 14px; padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--border); }
.kiosk-bar b { font-size: 17px; font-weight: 650; }
.kiosk-clock { margin-left: auto; font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-2); }
.kiosk-live { font-size: 12px; color: var(--muted); }
.kiosk-live:empty { display: none; }
.kiosk-error { display: grid; gap: 6px; place-content: center; height: 100vh; text-align: center; color: var(--muted); }
.kiosk-error b { font-size: 20px; color: var(--text); }
.link-copy { display: flex; gap: 6px; }
.link-copy input { flex: 1; min-width: 0; padding: 6px 8px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--panel-2); font: 12px var(--mono); }

/* dashlet menu button (⋮): on hover/focus, always on touch screens */
.dl-menu { flex: none; width: 26px; height: 24px; margin: -4px -8px -4px 0; border: 0; border-radius: var(--radius); background: none; color: var(--muted);
  font-size: 16px; line-height: 1; cursor: pointer; opacity: 0; transition: opacity .12s, background .12s; }
.dashlet:hover .dl-menu, .dl-menu:focus-visible, .dl-menu[aria-expanded="true"] { opacity: 1; }
.dl-menu:hover { background: var(--row-hover); color: var(--text); }
@media (hover: none) { .dl-menu { opacity: 1; } }
.board-grid.editing .dl-menu { display: none; }

/* context menu */
#ctxmenu { position: fixed; z-index: 80; min-width: 180px; padding: 4px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 8px; box-shadow: 0 10px 30px rgba(15, 23, 42, .2); display: grid; }
#ctxmenu[hidden] { display: none; }
#ctxmenu button { text-align: left; padding: 7px 12px; border: 0; border-radius: var(--radius); background: none; font: inherit; font-size: 13px; cursor: pointer; color: var(--text); }
#ctxmenu button:hover, #ctxmenu button:focus-visible { background: var(--row-hover); outline: none; }
#ctxmenu button.danger { color: var(--critical); }
#ctxmenu button.danger:hover, #ctxmenu button.danger:focus-visible { background: var(--critical-soft); }
#ctxmenu .ctx-sep { height: 1px; margin: 4px 6px; background: var(--border); }
/* counter tiles */
.count-tile { display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: 4px 16px; padding: 6px 12px; text-align: center; }
.count-tile .cnt { display: flex; flex-direction: column; text-decoration: none; min-width: 52px; }
.count-tile .cnt b { font-size: 26px; font-weight: 650; line-height: 1.1; letter-spacing: -.5px; }
.count-tile .cnt small { font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.count-tile .cnt.zero b { color: var(--border-strong); }
.count-tile .cnt-unhandled { flex-basis: 100%; font-size: 12px; font-weight: 600; color: var(--critical); text-decoration: none; }
@media (max-width: 760px) {
  .board-grid { grid-template-columns: 1fr; grid-auto-rows: auto; padding: 16px; }
  .board-grid > .dashlet { grid-column: 1 !important; grid-row: auto !important; max-height: 70vh; }
}
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.tile { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; background: var(--panel); box-shadow: var(--shadow); }
.tile h3 { margin: 0 0 12px; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); }
.tile .bar { display: flex; gap: 2px; height: 8px; border-radius: 4px; overflow: hidden; background: var(--border); margin-bottom: 14px; }
.tile .bar span { display: block; }
.tile .nums { display: flex; flex-wrap: wrap; gap: 10px 20px; }
.tile .nums a { text-decoration: none; display: flex; flex-direction: column; border-radius: var(--radius); }
.tile .nums a:hover small { color: var(--text); }
.tile .nums b { font-size: 26px; font-weight: 650; line-height: 1.1; letter-spacing: -.5px; }
.tile .nums small { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.panel { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--panel); box-shadow: var(--shadow); }
.panel > h3 { margin: 0; padding: 11px 16px; font-size: 13.5px; font-weight: 600; background: var(--panel); border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.panel > h3 a { font-weight: 500; font-size: 12.5px; color: var(--accent); text-decoration: none; }
.panel > h3 a:hover { text-decoration: underline; }
.panel table.list tr:last-child td { border-bottom: 0; }
.c-ok { color: var(--ok); } .c-warning { color: var(--warning); } .c-critical, .c-down { color: var(--critical); }
.c-unknown { color: var(--unknown); } .c-pending { color: var(--pending); } .c-up { color: var(--ok); }

/* ==========================================================================
   detail
   ========================================================================== */
.detail-head { display: flex; gap: 14px; align-items: stretch; }
.detail-head .state-box { margin: 0; min-width: 100px; display: flex; flex-direction: column; justify-content: center; border-radius: 8px; }
.detail-head .titles { min-width: 0; }
.detail-head .titles h1 { margin: 0; }
.detail-head .titles .sub { color: var(--muted); font-size: 12.5px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 5px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--panel); color: var(--text); box-shadow: var(--shadow-sm); cursor: pointer; font-size: 13px; font-weight: 500; white-space: nowrap; text-decoration: none; transition: background .12s, border-color .12s, color .12s, box-shadow .12s; }
.btn:hover { background: var(--row-hover); border-color: var(--muted); }
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); border-color: var(--accent); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.danger { color: var(--critical); }
.btn.danger:hover { background: var(--critical-soft); border-color: var(--critical); }
.btn.small { padding: 2px 9px; font-size: 12px; }
.btn[disabled] { opacity: .45; cursor: default; }

.section-title { display: flex; align-items: center; margin: 24px 20px 8px; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); }
pre.output { margin: 0 20px; padding: 11px 14px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; font: 12px/1.6 var(--mono); white-space: pre-wrap; word-break: break-word; color: var(--text-2); }
/* sanitized HTML plugin output */
div.output.html { margin: 0 20px; padding: 11px 14px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; font-size: 13px; line-height: 1.55; overflow-x: auto; word-break: break-word; }
div.output.html > :first-child { margin-top: 0; }
div.output.html > :last-child { margin-bottom: 0; }
div.output.html p, div.output.html ul, div.output.html ol, div.output.html table, div.output.html pre, div.output.html blockquote { margin: 0 0 8px; }
div.output.html h1, div.output.html h2, div.output.html h3, div.output.html h4, div.output.html h5, div.output.html h6 { font-size: 14px; margin: 8px 0 4px; }
div.output.html a[href] { color: var(--accent); }
div.output.html code, div.output.html pre { font: 12px/1.5 var(--mono); }
div.output.html pre { white-space: pre-wrap; }
div.output.html table { border-collapse: collapse; }
div.output.html th, div.output.html td { border: 1px solid var(--border); padding: 3px 8px; text-align: left; vertical-align: top; }
div.output.html th { background: var(--panel); font-weight: 600; }
div.output.html blockquote { padding-left: 10px; border-left: 3px solid var(--border); color: var(--muted); }
div.output.html hr { border: 0; border-top: 1px solid var(--border); }
table.kv { margin: 0 20px; border-collapse: collapse; width: calc(100% - 40px); }
table.kv th, table.kv td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--border); vertical-align: top; font-weight: normal; }
table.kv tr:last-child th, table.kv tr:last-child td { border-bottom: 0; }
table.kv th { color: var(--muted); width: 40%; }
table.kv td.mono { font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }
table.grid { margin: 0 20px; border-collapse: collapse; width: calc(100% - 40px); font-size: 13px; }
table.grid th { text-align: left; color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; padding: 8px 10px; background: var(--panel-2); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
table.grid th:first-child { border-top-left-radius: var(--radius); }
table.grid th:last-child { border-top-right-radius: var(--radius); }
table.grid td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.grid tbody tr:hover > td { background: var(--row-hover); }
table.grid.full { margin: 0; width: 100%; }
table.grid.full th { border-top: 0; border-radius: 0; }
.perf-bar { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; min-width: 80px; margin-top: 7px; }
.perf-bar span { display: block; height: 100%; background: var(--ok); border-radius: 3px; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.switch input { width: 34px; height: 20px; appearance: none; background: var(--border-strong); border-radius: 10px; position: relative; cursor: pointer; transition: background .15s; margin: 0; flex: none; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: left .15s; }
.switch input:checked { background: var(--primary); }
.switch input:checked::after { left: 16px; }
.switch input:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.switch input:disabled { opacity: .45; cursor: not-allowed; }
.ev-icon { display: inline-block; width: 22px; text-align: center; color: var(--muted); }
.notice { margin: 12px 20px 0; padding: 10px 14px; border-radius: 8px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); border-left: 3px solid var(--accent); font-size: 13px; }
.notice.ack { border-color: color-mix(in srgb, var(--ok) 30%, transparent); border-left-color: var(--ok); background: color-mix(in srgb, var(--ok) 9%, var(--panel)); }
.notice.dt { border-color: color-mix(in srgb, var(--unknown) 30%, transparent); border-left-color: var(--unknown); background: color-mix(in srgb, var(--unknown) 8%, var(--panel)); }
.notice.sticky { border-color: color-mix(in srgb, var(--warning) 40%, transparent); border-left-color: var(--warning); background: color-mix(in srgb, var(--warning) 10%, var(--panel)); }
.notice.sticky .sticky-text { white-space: pre-wrap; }

/* sticky comments: pin in list rows, expandable box below the output */
.sticky-pin { margin-left: 4px; padding: 0 4px; border: 1px solid transparent; border-radius: var(--radius); background: none; cursor: pointer; font: inherit; font-weight: normal; line-height: 1.3; }
.sticky-pin:hover, .sticky-pin.open { border-color: var(--warning); background: color-mix(in srgb, var(--warning) 10%, transparent); }
.sticky-pin small { margin-left: 1px; color: var(--muted); }
.note-icon { display: inline-block; vertical-align: -2px; flex: none; }
.sticky-pin .note-icon { vertical-align: -3px; }
.sticky-box { margin-top: 6px; padding: 8px 10px; border: 1px solid color-mix(in srgb, var(--warning) 40%, transparent); border-left: 3px solid var(--warning); border-radius: var(--radius); background: color-mix(in srgb, var(--warning) 10%, var(--panel)); font-weight: normal; cursor: text; }
.sticky-comment + .sticky-comment { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); }
.sticky-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.sticky-comment small { color: var(--muted); }
.sticky-badge { font-size: 11px; color: var(--muted); white-space: nowrap; }
.comment-text { white-space: pre-wrap; }

/* ==========================================================================
   paging & history
   ========================================================================== */
.pager { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.pager .btn[disabled] { opacity: .4; cursor: default; }
.col-body > .pager { margin: 0 20px 10px; }
/* history: rows expand to the complete output */
table.hist { table-layout: fixed; }
table.hist td { overflow: hidden; }
table.hist th:first-child { width: 120px; }
table.hist th:nth-last-child(2) { width: 240px; }
table.hist.full th:nth-child(2) { width: 22%; }
tr.hist-row { cursor: pointer; }
tr.hist-row:hover > td { background: var(--row-hover); }
tr.hist-row.open > td { border-bottom-color: transparent; background: var(--row-hover); }
.hist-caret { display: inline-block; width: 14px; color: var(--muted); transition: transform .15s; }
tr.hist-row.open .hist-caret { transform: rotate(90deg); }
tr.hist-more > td { padding: 0 10px 12px 24px; background: var(--row-hover); }
tr.hist-more .output { margin: 0; max-height: 480px; overflow: auto; background: var(--panel); }
.obj-output .more { color: var(--muted); }

/* ==========================================================================
   service matrix
   ========================================================================== */
.grid-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 12px 20px; font-size: 11.5px; color: var(--muted); }
.grid-legend span { display: inline-flex; align-items: center; gap: 5px; }
.grid-legend .sq { width: 12px; height: 12px; }
.grid-wrap { overflow: auto; max-height: calc(100vh - 160px); margin: 0 20px; border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
table.svc-grid { border-collapse: separate; border-spacing: 0; }
.svc-grid th { background: var(--panel); font-weight: normal; }
/* the whole head is sticky (not each cell): a sticky cell would be a stacking
   context of its own and hide the slanted labels of the cells before it */
.svc-grid thead { position: sticky; top: 0; z-index: 2; }
.svc-grid thead th { border-bottom: 1px solid var(--border); vertical-align: bottom; }
.svc-grid th.corner { position: sticky; left: 0; z-index: 4; text-align: left; vertical-align: bottom; font-size: 11px; color: var(--muted); padding: 6px 10px; }
/* column labels slanted by 45° like Icinga Web 2; the labels reach over the
   following header cells, so they sit above them (z-index) and a spacer
   column makes room for the last ones */
.svc-grid th.col-label { height: 130px; min-width: 26px; padding: 0; }
.svc-grid th.col-label div { position: relative; width: 26px; height: 130px; }
.svc-grid th.col-label div > span { position: absolute; z-index: 3; left: 12px; bottom: 6px; width: max-content; transform-origin: 0 100%; transform: rotate(-45deg);
  max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; line-height: 16px; text-align: left; }
.svc-grid th.col-label a:hover { color: var(--accent); }
.svc-grid th.col-spacer { min-width: 120px; }
.svc-grid th.row-label { position: sticky; left: 0; z-index: 1; text-align: left; padding: 2px 12px 2px 10px; white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; border-right: 1px solid var(--border); font-size: 13px; }
.svc-grid a { text-decoration: none; }
.svc-grid .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--ok); }
.svc-grid .dot.down { background: var(--critical); }
.svc-grid tbody tr:hover th, .svc-grid tbody tr:hover td { background: var(--row-hover); }
td.cell { padding: 2px; text-align: center; }
td.cell.none::after { content: ""; display: block; width: 22px; height: 22px; margin: auto; border-radius: 4px; background: repeating-linear-gradient(45deg, transparent 0 3px, var(--border) 3px 4px); opacity: .6; }
.sq { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 4px; color: #fff; font-size: 11px; font-style: normal; vertical-align: middle; }
.sq.ok { background: var(--ok); } .sq.warning { background: var(--warning); } .sq.critical { background: var(--critical); }
.sq.unknown { background: var(--unknown); } .sq.pending { background: var(--pending); }
.sq.handled.warning { background: var(--warning-handled); } .sq.handled.critical { background: var(--critical-handled); }
.sq.handled.unknown { background: var(--unknown-handled); }
.sq.soft { background-image: repeating-linear-gradient(135deg, transparent 0 4px, rgba(255,255,255,.3) 4px 7px); }
a.sq:hover { outline: 2px solid var(--accent); outline-offset: 1px; }
a.sq.active { outline: 2px solid var(--text); outline-offset: 1px; }

/* ==========================================================================
   status page: system charts
   ========================================================================== */
.sys { padding: 0 20px; display: grid; gap: 16px; }
.sys-tiles .big { font-size: 26px; font-weight: 650; line-height: 1.2; letter-spacing: -.5px; }
.sys-tiles small { color: var(--muted); font-size: 12px; }
.meter { height: 8px; border-radius: 4px; background: var(--border); overflow: hidden; margin: 8px 0 6px; }
.meter span { display: block; height: 100%; background: var(--series-2); border-radius: 4px; }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(460px, 1fr)); gap: 16px; }
@media (max-width: 760px) { .chart-grid { grid-template-columns: 1fr; } }
.chart-wrap { position: relative; margin: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px 8px; background: var(--panel); box-shadow: var(--shadow); }
.chart-wrap figcaption { font-size: 13.5px; font-weight: 600; margin-bottom: 4px; }
.chart-legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.chart-legend i, .chart-tip i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
svg.chart { width: 100%; height: auto; display: block; overflow: visible; }
svg.chart .grid { stroke: var(--border); stroke-width: 1; }
svg.chart .tick { fill: var(--muted); font-size: 11px; }
svg.chart .direct { fill: var(--text); font-size: 12px; }
svg.chart .series-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
svg.chart .end-dot, svg.chart .crosshair circle { stroke: var(--panel); stroke-width: 2; }
svg.chart .cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
svg.chart .hit { fill: transparent; cursor: crosshair; }
.chart-tip { position: absolute; top: 34px; pointer-events: none; background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .16); padding: 7px 10px; font-size: 12px; white-space: nowrap; z-index: 3; }
.chart-tip .when { color: var(--muted); margin-bottom: 2px; }
.chart-tip div { display: flex; align-items: center; gap: 4px; }
.chart-tip b { margin-left: auto; padding-left: 12px; font-weight: 600; }
svg.chart .thr { stroke-width: 1.5; stroke-dasharray: 6 4; }
svg.chart .thr-warn { stroke: var(--warning); }
svg.chart .thr-crit { stroke: var(--critical); }

/* performance data history: detail view and dashlets */
.seg { display: inline-flex; margin-left: auto; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; text-transform: none; letter-spacing: 0; }
.seg-btn { border: 0; background: var(--panel); color: var(--text-2); font: inherit; font-size: 12px; font-weight: 500; padding: 3px 9px; cursor: pointer; }
.seg-btn + .seg-btn { border-left: 1px solid var(--border); }
.seg-btn:hover { background: var(--panel-2); }
.seg-btn.on { background: var(--accent); color: #fff; }
.seg-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.sec-toggle { display: inline-flex; align-items: center; gap: 7px; padding: 0; border: 0; background: none; color: inherit; font: inherit;
  text-transform: inherit; letter-spacing: inherit; cursor: pointer; }
.sec-toggle:hover { color: var(--text); }
.sec-toggle:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: 4px; }
.chev { display: inline-block; flex: none; width: 6px; height: 6px; border: solid currentColor; border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg); margin: 0 3px 3px 1px; transition: transform .15s; }
.sec-toggle[aria-expanded="false"] .chev, .perf-row:not(.open) .chev { transform: rotate(-45deg); margin: 0 4px 1px 0; }
table.perf tr.perf-row { cursor: pointer; }
table.perf tr.perf-row td:first-child { white-space: nowrap; }
table.perf tr.perf-row .chev { color: var(--muted); margin-right: 8px; }
table.perf tr.perf-row:hover td, table.perf tr.perf-row.open td { background: var(--row-hover); }
table.perf tr.perf-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
table.perf tr.perf-chart-row > td { padding: 6px 4px 10px; background: var(--panel); }
table.perf tr.perf-chart-row .chart-wrap { box-shadow: none; }
.perf-chart { position: relative; min-width: 0; }
.perf-chart .perf-add { position: absolute; top: 10px; right: 10px; opacity: 0; transition: opacity .15s; }
.perf-chart:hover .perf-add, .perf-chart .perf-add:focus-visible { opacity: 1; }
@media (hover: none) { .perf-chart .perf-add { opacity: 1; } }
.dl-chart { display: flex; align-items: center; padding: 4px 8px; overflow: hidden; }
.dl-chart .chart-wrap { flex: 1; min-width: 0; border: 0; box-shadow: none; padding: 0; background: none; }
.dl-chart svg.chart { max-height: 100%; }
.dl-grid .grid-wrap { margin: 0; border: 0; border-radius: 0; box-shadow: none; max-height: none; overflow: visible; }
.dl-grid .svc-grid th.col-label, .dl-grid .svc-grid th.col-label div { height: 110px; }

/* ==========================================================================
   groups
   ========================================================================== */
.groups { padding: 20px; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.group { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px; cursor: pointer; background: var(--panel); box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s, transform .15s; }
.group:hover { border-color: var(--accent); box-shadow: 0 6px 18px rgba(15, 23, 42, .1); transform: translateY(-1px); }
.group h4 { margin: 0 0 8px; font-size: 14px; }
.group .lbl { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-top: 8px; }

/* ==========================================================================
   forms / modal
   ========================================================================== */
#modal { position: fixed; inset: 0; background: rgba(8, 12, 21, .55); backdrop-filter: blur(3px); display: flex; align-items: flex-start; justify-content: center; padding: 64px 16px; z-index: 50; overflow-y: auto; animation: fade .15s ease-out; }
#modal.hidden { display: none; }
.modal-box { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; width: 100%; max-width: 540px; box-shadow: var(--shadow-lg); animation: pop .18s ease-out; }
.modal-box header { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-box h2 { margin: 0; font-size: 16px; font-weight: 650; flex: 1; }
.modal-box .close { width: 30px; height: 30px; border-radius: var(--radius); background: none; border: 0; font-size: 20px; line-height: 1; cursor: pointer; color: var(--muted); }
.modal-box .close:hover { background: var(--row-hover); color: var(--text); }
form.form, #modal-form { padding: 16px 20px 20px; display: grid; gap: 14px; }
.field { display: grid; gap: 5px; }
.field > span { font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.field small { color: var(--muted); font-size: 11.5px; }
.field input:not([type=checkbox]), .field select, .field textarea { padding: 7px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--panel); width: 100%; box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s; }
.field input:not([type=checkbox]):focus, .field select:focus, .field textarea:focus,
.ts-row input:focus, .ts-row select:focus, .dl-row input:focus, .dl-row select:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }
.field textarea { min-height: 76px; font-family: var(--mono); font-size: 12px; }
input[type=checkbox], input[type=radio] { accent-color: var(--primary); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.cfg-fields { display: grid; gap: 14px; }
.cfg-fields input::placeholder, .cfg-fields textarea::placeholder { color: var(--muted); font-style: italic; opacity: .85; }
.cfg-hint { color: var(--muted); }
.tpl-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.ts-list { display: grid; gap: 6px; margin: 4px 0 8px; }
.ts-row { display: grid; grid-template-columns: minmax(80px, 1fr) minmax(90px, 1fr) minmax(100px, 1fr) minmax(110px, 1.3fr) auto; gap: 4px; align-items: center; }
.ts-row input, .ts-row select { min-width: 0; padding: 6px 8px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--panel); }
.tpl-services { margin-top: 4px; font-size: 12px; color: var(--muted); }
@media (max-width: 600px) { .ts-row { grid-template-columns: 1fr 1fr; } }
.section-title .btn { margin-left: 8px; text-transform: none; letter-spacing: 0; }
@media (max-width: 600px) { .row3 { grid-template-columns: 1fr; } }
.check { display: flex; gap: 8px; align-items: center; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; padding-top: 14px; border-top: 1px solid var(--border); }
.form-page { max-width: 680px; }

#toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 60; }
.toast { padding: 11px 16px; border-radius: 10px; background: #111827; color: #fff; border: 1px solid rgba(255, 255, 255, .08); box-shadow: 0 10px 30px rgba(0, 0, 0, .3); max-width: 400px; font-size: 13px; animation: in .2s ease-out; }
.toast.error { background: #b4232f; }
@keyframes in { from { transform: translateY(10px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ==========================================================================
   responsive
   ========================================================================== */
@media (max-width: 1100px) {
  #main.has-detail #col-list, #resize-detail { display: none; }
}
@media (max-width: 760px) {
  body { flex-direction: column; }
  #sidebar { width: 100%; }
  .resizer { display: none; }
  #menu-toggle { display: block; }
  #sidebar:not(.open) #menu, #sidebar:not(.open) .sidebar-foot, #sidebar:not(.open) .userbox { display: none; }
  #nav-collapse { display: none; }
  #main { height: auto; min-height: 0; flex: 1; }
  .col { overflow: visible; }
  .row2 { grid-template-columns: 1fr; }
  td.state { width: 84px; }
  .col-header { padding: 12px 16px 10px; }
  .dash, .groups { padding: 16px; }
  .section-title { margin-left: 16px; margin-right: 16px; }
  pre.output, div.output.html, .notice { margin-left: 16px; margin-right: 16px; }
  table.kv, table.grid { margin: 0 16px; width: calc(100% - 32px); }
}

/* ==========================================================================
   custom dashboards (tabs), dashlet editor, more filters, own menu items
   ========================================================================== */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 -20px -12px; padding: 0 16px; }
.tabs .tab { padding: 8px 12px 9px; border: 0; text-decoration: none; color: var(--muted); background: none; font: inherit; font-weight: 500; cursor: pointer; border-radius: var(--radius) var(--radius) 0 0; box-shadow: inset 0 -2px 0 transparent; transition: color .12s, box-shadow .12s, background .12s; }
.tabs .tab:hover { color: var(--text); background: var(--row-hover); }
.tabs .tab.active { color: var(--text); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }
.tabs .tab small { color: var(--muted); font-weight: normal; }
.tabs .tab.add { font-weight: 600; }
.board-tools { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.board-tools .toolbar { margin-top: 0; }
.board-owner { color: var(--muted); }
.panel > h3 .count { font-weight: 600; font-size: 11.5px; color: var(--muted); margin-left: 6px; }
.filters-more { margin-top: 8px; }
.filters-more select { font-size: 12px; }
.filters .save-view { margin-left: auto; display: flex; gap: 6px; }
.dl-list { display: grid; gap: 6px; margin: 4px 0 8px; }
.dl-row { display: grid; grid-template-columns: minmax(90px, 1fr) minmax(140px, 2fr) 92px 64px auto; gap: 4px; align-items: center; }
.dl-row input, .dl-row select { min-width: 0; padding: 6px 8px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--panel); }
.nav-icon { width: 18px; text-align: center; }
#menu a.nav-manage { font-size: 12.5px; opacity: .75; }
#menu a.nav-manage:hover { opacity: 1; }
@media (max-width: 760px) {
  .tabs { margin: 0 -16px -10px; }
}
@media (max-width: 600px) {
  .dl-row { grid-template-columns: 1fr 1fr; }
  .filters .save-view { margin-left: 0; }
}
.notice > .ico { vertical-align: -3px; margin-right: 2px; }
