/* Remote Techs Management Dashboard v2 - brand: blue #2B66B1, green #6FA013 (from remotetechs.com) */
:root {
  --brand: #2B66B1; --brand-dk: #1E4F8E; --brand-50: #EEF4FB; --brand-100: #D9E6F6;
  --green: #6FA013; --green-dk: #5A840D;
  --ink: #1C2433; --ink-2: #3B4558; --muted: #6B7587; --line: #E4E8EF; --line-2: #EEF1F5;
  --bg: #F5F7FA; --card: #FFFFFF;
  --ok: #2E7D32; --ok-bg: #E8F5E9; --warn: #A35A00; --warn-bg: #FFF3E0; --bad: #C62828; --bad-bg: #FDECEA;
  --info: #1E4F8E; --info-bg: #E8F0FA; --pur: #5B3FA8; --pur-bg: #F1ECFA; --gray: #4B5563; --gray-bg: #EFF1F4;
  --radius: 10px; --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14);
  --side: 248px; --side-mini: 72px;
  --font: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dk); text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .65rem; line-height: 1.3; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.2rem; }
h2 { font-size: 1.08rem; margin-top: .3rem; }
h3 { font-size: .95rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; color: var(--ink); }
h2 small, h3 small { font-weight: 400; color: var(--muted); font-size: .8rem; }
p { margin: 0 0 .6rem; }
.muted { color: var(--muted); } .small { font-size: .8rem; } .center { text-align: center; } .r { text-align: right; } .mt { margin-top: 1rem; }
.neg { color: var(--bad); }
code { background: var(--gray-bg); padding: 1px 6px; border-radius: 4px; font-size: .85em; }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.req { color: var(--bad); font-weight: 700; }
.nw { white-space: nowrap; }

/* ---------- Shell & sidebar ---------- */
.shell { display: flex; min-height: 100vh; }
.side { width: var(--side); background: #fff; border-right: 1px solid var(--line); flex: none; position: sticky; top: 0; height: 100vh;
        display: flex; flex-direction: column; transition: width .2s ease; z-index: 30; }
.side-head { height: 68px; display: flex; align-items: center; padding: 0 18px; border-bottom: 1px solid var(--line-2); flex: none; overflow: hidden; }
.side-head:hover { text-decoration: none; }
.logo-full { height: 30px; width: auto; max-width: 100%; display: block; }
.logo-mark { width: 36px; height: 36px; display: none; }
.side-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 10px 12px 16px; scrollbar-width: thin; scrollbar-color: #D5DAE2 transparent; }
.side-nav::-webkit-scrollbar { width: 6px; } .side-nav::-webkit-scrollbar-thumb { background: #D5DAE2; border-radius: 6px; }
.nav-grp { font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #98A1B2; padding: 14px 10px 6px; white-space: nowrap; }
.nav { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: var(--radius-sm); color: var(--ink-2); font-weight: 500; white-space: nowrap; position: relative; margin-bottom: 1px; }
.nav .ic { color: #7A8597; }
.nav:hover { background: var(--line-2); color: var(--ink); text-decoration: none; }
.nav.on { background: var(--brand-50); color: var(--brand); font-weight: 600; }
.nav.on .ic { color: var(--brand); }
.nav.on::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
.side-foot { padding: 12px 18px; border-top: 1px solid var(--line-2); font-size: .72rem; color: #98A1B2; white-space: nowrap; overflow: hidden; }

/* icons-only mode (desktop) */
html.side-mini .side { width: var(--side-mini); }
html.side-mini .side-head { padding: 0; justify-content: center; }
html.side-mini .logo-full { display: none; }
html.side-mini .logo-mark { display: block; }
html.side-mini .nav-grp { height: 1px; padding: 0; margin: 10px 8px; background: var(--line-2); font-size: 0; }
html.side-mini .nav { justify-content: center; padding: 10px 0; }
html.side-mini .nav span { display: none; }
html.side-mini .nav::after { content: attr(data-tip); position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%); background: var(--ink); color: #fff;
  font-size: .78rem; font-weight: 500; padding: 5px 9px; border-radius: 6px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 50; }
html.side-mini .nav:hover::after { opacity: 1; }
html.side-mini .side-nav { overflow: visible; }
html.side-mini .side-foot { text-align: center; padding: 12px 0; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { height: 68px; display: flex; align-items: center; gap: 14px; padding: 0 24px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(6px);
       border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.ttl { flex: 1; min-width: 0; }
.top h1 { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs { display: flex; align-items: center; gap: 4px; font-size: .78rem; color: var(--muted); }
.crumbs a { color: var(--muted); }
.crumbs .ic { width: 13px; height: 13px; }
.icon-btn { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line); background: #fff; border-radius: var(--radius-sm); color: var(--ink-2); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--line-2); }
.usermenu { position: relative; }
.user-btn { display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 4px 6px; border-radius: var(--radius-sm); cursor: pointer; font: inherit; color: var(--ink); }
.user-btn:hover { background: var(--line-2); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .85rem; }
.uname { display: flex; flex-direction: column; text-align: left; line-height: 1.2; font-weight: 600; font-size: .86rem; }
.uname small { color: var(--muted); font-weight: 400; font-size: .74rem; }
.dropdown { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); min-width: 230px; padding: 6px; display: none; }
.usermenu.open .dropdown { display: block; }
.dd-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line-2); margin-bottom: 6px; display: flex; flex-direction: column; }
.dd-head span { color: var(--muted); font-size: .8rem; }
.dd-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 6px; font: inherit; color: var(--ink); cursor: pointer; text-align: left; }
.dd-item:hover { background: var(--line-2); }
.side-backdrop { display: none; }
.content { padding: 22px 24px 48px; max-width: 1640px; width: 100%; margin: 0 auto; }

/* ---------- Page header, cards, grids ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head p { margin: 0; }
.ph-title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 16px; min-width: 0; }
.card.flush { padding: 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.grid2 > *, .grid3 > * { min-width: 0; }
.grid2 > .card, .grid3 > .card, .grid3 > div > .card:last-child { margin-bottom: 0; }
.span2 { grid-column: span 2; }
.sec { scroll-margin-top: 130px; margin-bottom: 26px; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar form { margin: 0; }
.inline { display: inline-flex; align-items: center; gap: 8px; margin: 0; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpis:has(> :nth-child(1):last-child) { grid-template-columns: minmax(0, 1fr); }
.kpis:has(> :nth-child(2):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kpis:has(> :nth-child(3):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis:has(> :nth-child(5):last-child) { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpis:has(> :nth-child(6):last-child) { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1440px) {
  html:not(.side-mini) .kpis:has(> :nth-child(6):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1250px) {
  .kpis:has(> :nth-child(6):last-child), .kpis:has(> :nth-child(5):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .kpis:has(> :nth-child(4):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; position: relative; overflow: hidden; min-width: 0; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--brand); }
.kpi.good::before { background: var(--green); } .kpi.warn::before { background: #E39B2D; } .kpi.bad::before { background: var(--bad); }
.kl { color: var(--muted); font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kv { font-size: 1.55rem; font-weight: 700; margin: 4px 0 2px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.02em; }
.kpi.bad .kv { color: var(--bad); }
.ks { color: var(--muted); font-size: .78rem; }

/* tabs / segmented */
.tabs { display: flex; gap: 2px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 3px; flex-wrap: wrap; position: sticky; top: 76px; z-index: 10; box-shadow: var(--shadow); }
.tabs a { padding: 6px 12px; border-radius: 5px; color: var(--muted); font-weight: 600; font-size: .84rem; }
.tabs a:hover { text-decoration: none; background: var(--line-2); color: var(--ink); }
.tabs a.on { background: var(--brand); color: #fff; }
.seg { display: inline-flex; background: var(--line-2); border-radius: var(--radius-sm); padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 5px; font: inherit; font-size: .84rem; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: #fff; color: var(--brand); box-shadow: var(--shadow); }

/* ---------- Buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: #fff; color: var(--ink);
       font: inherit; font-weight: 600; font-size: .87rem; cursor: pointer; white-space: nowrap; line-height: 1.2; transition: background .12s, border-color .12s, box-shadow .12s; }
.btn .ic { width: 16px; height: 16px; }
.btn:hover { background: var(--line-2); text-decoration: none; color: var(--ink); }
.btn:focus-visible, .icon-btn:focus-visible { outline: 3px solid rgba(43, 102, 177, .3); outline-offset: 1px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dk); border-color: var(--brand-dk); color: #fff; }
.btn.success { background: var(--green); border-color: var(--green); color: #fff; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger:hover { background: #A51F1F; color: #fff; }
.btn.danger-ghost { color: var(--bad); border-color: #F3C7C3; background: #fff; }
.btn.danger-ghost:hover { background: var(--bad-bg); color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--line-2); }
.btn.sm { padding: 5px 10px; font-size: .8rem; }
.btn.lg { padding: 11px 16px; font-size: .95rem; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn.busy { position: relative; color: transparent !important; }
.btn.busy::after { content: ""; position: absolute; width: 16px; height: 16px; border: 2px solid rgba(255, 255, 255, .6); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
input, select, textarea { font: inherit; color: var(--ink); background: #fff; border: 1px solid #D0D6E0; border-radius: var(--radius-sm); padding: 9px 11px; width: 100%; transition: border-color .12s, box-shadow .12s; }
input::placeholder, textarea::placeholder { color: #A0A8B6; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(43, 102, 177, .15); }
input[type=checkbox] { width: 16px; height: 16px; margin: 0; accent-color: var(--brand); flex: none; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7587' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
         background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }
.form .field, .field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; min-width: 0; }
.field > label, .form > label { font-weight: 600; font-size: .83rem; color: var(--ink-2); }
label.check { display: flex; flex-direction: row; align-items: center; gap: 9px; font-weight: 500; font-size: .87rem; color: var(--ink-2); cursor: pointer; margin-bottom: 14px; }
.field label.check { margin: 26px 0 0; }
.err-msg { color: var(--bad); font-style: normal; font-size: .78rem; font-weight: 500; min-height: 0; }
.err-msg:empty { display: none; }
.has-err input, .has-err select, .has-err textarea { border-color: var(--bad); }
.has-err input:focus, .has-err select:focus, .has-err textarea:focus { box-shadow: 0 0 0 3px rgba(198, 40, 40, .12); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(270px, 100%), 1fr)); gap: 0 18px; }
.grid-form .wide { grid-column: 1 / -1; }
.form-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; border-bottom: 1px solid var(--line-2); padding-bottom: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.form-head h3 { margin: 0; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; border-top: 1px solid var(--line-2); padding-top: 16px; margin-top: 4px; }
.actions { display: flex; align-items: center; gap: 10px; justify-content: space-between; flex-wrap: wrap; }
.input-prefix { display: flex; align-items: stretch; }
.input-prefix span { display: grid; place-items: center; padding: 0 11px; background: var(--line-2); border: 1px solid #D0D6E0; border-right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); color: var(--muted); font-weight: 600; }
.input-prefix input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.input-icon { position: relative; }
.input-icon > .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #98A1B2; }
.input-icon input { padding-left: 40px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--brand); font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer; padding: 6px 8px; border-radius: 5px; }
.pw-toggle:hover { background: var(--brand-50); }
.input-icon input[type=password], .input-icon input[data-rules*="required"][name=password] { padding-right: 64px; }

/* ---------- Tables ---------- */
.tablewrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { padding: 10px 10px; border-bottom: 1px solid var(--line-2); text-align: left; vertical-align: top; }
.tbl th { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; white-space: nowrap; }
.tbl th.r, .tbl td.r { text-align: right; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr[data-href] { cursor: pointer; }
.tbl tr[data-href]:hover td { background: #F8FAFD; }
.tbl.dl th { width: 42%; text-transform: none; font-size: .85rem; letter-spacing: 0; font-weight: 600; color: var(--ink-2); }
.tbl.small td { font-size: .82rem; padding: 6px 8px; }

/* DataTables */
.tbl-tools { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.tbl-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tbl-filters select { width: auto; min-width: 130px; padding: 7px 30px 7px 10px; font-size: .84rem; }
.tbl-filters select.set { border-color: var(--brand); background-color: var(--brand-50); color: var(--brand-dk); font-weight: 600; }
.card .dt-container { padding: 4px 18px 14px; }
div.dt-container .dt-layout-row { margin: 10px 0; }
div.dt-container .dt-search input { width: 260px; margin-left: 0; padding: 8px 11px; }
div.dt-container .dt-length select { width: auto; padding: 6px 28px 6px 10px; }
div.dt-container .dt-info { color: var(--muted); font-size: .84rem; }
table.dataTable.dtable { border-collapse: collapse; }
table.dataTable.dtable > thead > tr > th { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; border-bottom: 1px solid var(--line) !important; padding: 10px 10px; background: #FAFBFC; white-space: nowrap; }
table.dataTable.dtable > tbody > tr > td { padding: 11px 10px; border-top: 1px solid var(--line-2); vertical-align: middle; }
table.dataTable.dtable > tbody > tr { cursor: pointer; }
table.dataTable.dtable > tbody > tr:hover > td { background: #F7FAFE; }
table.dataTable.dtable > tfoot > tr > th { padding: 10px; border-top: 2px solid var(--line) !important; background: #FAFBFC; font-weight: 600; }
table.dataTable.dtable td.dt-right, table.dataTable.dtable th.dt-right { text-align: right; }
table.dataTable .col-id { color: var(--muted); }
table.dataTable td.dt-nowrap, table.dataTable td.col-id { white-space: nowrap; }
table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control { padding-left: 34px !important; position: relative; }
table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control::before { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); margin: 0 !important; }
table.dataTable > tbody > tr.child ul.dtr-details { width: 100%; }
table.dataTable > tbody > tr.child ul.dtr-details > li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line-2); }
table.dataTable > tbody > tr.child span.dtr-title { font-size: .74rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; min-width: 0; }
table.dataTable.display > tbody > tr > .sorting_1, table.dataTable.display > tbody > tr > .dt-ordering-asc, table.dataTable.display > tbody > tr > .dt-ordering-desc,
table.dataTable.dtable > tbody > tr > td { box-shadow: none !important; }
table.dataTable.dtable > tbody > tr.selected > * , table.dataTable.dtable.stripe > tbody > tr:nth-child(odd) > * { box-shadow: none !important; }
table.dataTable .col-id a.rid { color: var(--muted); }
a.rlink { font-weight: 600; color: var(--ink); }
a.rlink:hover { color: var(--brand); }
.row-acts { display: flex; gap: 2px; justify-content: flex-end; }
.act { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 6px; color: #7A8597; border: 0; background: none; cursor: pointer; }
.act .ic { width: 17px; height: 17px; }
.act:hover { background: var(--brand-50); color: var(--brand); }
.act.danger:hover { background: var(--bad-bg); color: var(--bad); }
table.dataTable .col-act { width: 110px; text-align: right; }
div.dt-container .dt-paging .dt-paging-button { border-radius: 6px !important; border: 1px solid transparent !important; padding: 5px 11px !important; color: var(--ink-2) !important; background: none !important; }
div.dt-container .dt-paging .dt-paging-button:hover { background: var(--line-2) !important; color: var(--ink) !important; }
div.dt-container .dt-paging .dt-paging-button.current, div.dt-container .dt-paging .dt-paging-button.current:hover { background: var(--brand) !important; color: #fff !important; border-color: var(--brand) !important; }
div.dt-container .dt-paging .dt-paging-button.disabled { opacity: .4; }
div.dt-processing { background: rgba(255, 255, 255, .85) !important; border: 1px solid var(--line) !important; border-radius: var(--radius) !important; box-shadow: var(--shadow-lg) !important; padding: 14px !important; }
div.dt-processing > div:last-child { display: none; }
.spinner { display: inline-block; width: 22px; height: 22px; border: 3px solid var(--brand-100); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; }
table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control::before { border-color: var(--brand) !important; }

/* ---------- Badges, bars ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .73rem; font-weight: 600; white-space: nowrap; line-height: 1.6; }
.badge.green { background: var(--ok-bg); color: var(--ok); } .badge.orange { background: var(--warn-bg); color: var(--warn); }
.badge.red { background: var(--bad-bg); color: var(--bad); } .badge.blue { background: var(--info-bg); color: var(--info); }
.badge.purple { background: var(--pur-bg); color: var(--pur); } .badge.gray { background: var(--gray-bg); color: var(--gray); }
.score { display: inline-grid; place-items: center; min-width: 38px; height: 26px; border-radius: 6px; font-weight: 700; font-size: .84rem; }
.score.green { background: var(--ok-bg); color: var(--ok); } .score.orange { background: var(--warn-bg); color: var(--warn); } .score.red { background: var(--bad-bg); color: var(--bad); }
.bar { height: 8px; background: var(--line-2); border-radius: 99px; overflow: hidden; min-width: 60px; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), #4C8AD6); border-radius: 99px; }
.meters > div { margin-bottom: 14px; display: grid; grid-template-columns: 1fr auto; gap: 6px; }
.meters .bar { grid-column: 1 / -1; height: 10px; }
.stages { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stage { background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: var(--radius); padding: 12px 14px; color: var(--ink); position: relative; }
.stage::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--brand); border-radius: var(--radius) var(--radius) 0 0; }
.stage:hover { text-decoration: none; border-color: var(--brand-100); color: var(--ink); }
.stage b { display: block; font-size: 1.35rem; } .stage span { display: block; font-size: .8rem; font-weight: 600; } .stage small { color: var(--muted); }

/* View screen */
.dgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); gap: 16px 22px; margin: 0; }
.dgrid > div { min-width: 0; }
.dgrid .wide { grid-column: 1 / -1; }
.dgrid dt { font-size: .74rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 3px; }
.dgrid dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.pre { background: var(--bg); border-radius: var(--radius-sm); padding: 10px 12px; font-weight: 400; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 8px 0 8px 16px; border-left: 2px solid var(--line); position: relative; font-size: .86rem; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 13px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.timeline li span { display: block; color: var(--muted); font-size: .76rem; }

/* tickets */
.meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.desc { background: var(--bg); border-radius: var(--radius-sm); padding: 12px 14px; }
.note { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 10px; }
.note.internal { background: #FFFBF2; border-color: #F2E3C3; }
.note.client { background: var(--brand-50); border-color: var(--brand-100); }
.nh { margin-bottom: 4px; }
.flash.info, .note-box { background: var(--info-bg); color: var(--info); padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: .88rem; }
.note-box { color: var(--ink-2); margin: 10px 0 0; line-height: 1.6; }

/* ---------- Toasts (top right) ---------- */
.toasts { position: fixed; top: 16px; right: 16px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; width: 340px; max-width: calc(100vw - 32px); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--ok); border-radius: 8px;
         box-shadow: var(--shadow-lg); padding: 11px 12px 13px; font-size: .87rem; color: var(--ink); position: relative; overflow: hidden;
         transform: translateX(24px); opacity: 0; transition: transform .22s ease, opacity .22s ease; }
.toast.in { transform: none; opacity: 1; }
.toast .ti { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; flex: none; margin-top: 1px; }
.toast.ok { border-left-color: var(--green); } .toast.ok .ti { color: var(--green); }
.toast.err { border-left-color: var(--bad); } .toast.err .ti { color: var(--bad); }
.toast.info { border-left-color: var(--brand); } .toast.info .ti { color: var(--brand); }
.toast.warn { border-left-color: #E39B2D; } .toast.warn .ti { color: #E39B2D; }
.toast .tm { flex: 1; line-height: 1.4; padding-top: 1px; }
.toast .tx { border: 0; background: none; font-size: 1.15rem; line-height: 1; color: #98A1B2; cursor: pointer; padding: 0 2px; }
.toast .tx:hover { color: var(--ink); }
.toast .tp { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: currentColor; opacity: .18; transform-origin: left; animation: tp linear forwards; }
.toast.ok .tp { color: var(--green); } .toast.err .tp { color: var(--bad); } .toast.info .tp { color: var(--brand); }
.toast.hold .tp { animation-play-state: paused; }
@keyframes tp { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* ---------- Dialog ---------- */
.modal-ov { position: fixed; inset: 0; background: rgba(16, 24, 40, .45); display: grid; place-items: center; z-index: 900; padding: 16px; opacity: 0; transition: opacity .18s; }
.modal-ov.in { opacity: 1; }
.modal { background: #fff; border-radius: 14px; box-shadow: 0 24px 60px rgba(16, 24, 40, .3); width: 100%; max-width: 420px; padding: 24px; text-align: center; transform: translateY(10px) scale(.98); transition: transform .18s; }
.modal-ov.in .modal { transform: none; }
.m-icon { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 12px; }
.m-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.m-icon.danger { background: var(--bad-bg); color: var(--bad); } .m-icon.primary { background: var(--brand-50); color: var(--brand); }
.m-title { justify-content: center; font-size: 1.05rem; margin-bottom: 6px; }
.m-text { color: var(--muted); margin-bottom: 16px; }
.m-extra label.check { justify-content: center; margin-bottom: 16px; }
.m-btns { display: flex; gap: 10px; }
.m-btns .btn { flex: 1; padding: 10px; }

/* ---------- Charts ---------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart text { font-size: 11px; fill: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .78rem; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: #fff; font-size: .78rem; padding: 5px 9px; border-radius: 6px; white-space: nowrap; transform: translate(-50%, -110%); z-index: 3; }
.donut-wrap { display: flex; align-items: center; gap: 18px; height: 100%; }
.donut-wrap svg { width: auto; height: 100%; flex: none; }
.donut-wrap .legend { flex-direction: column; margin: 0; }

/* ---------- Sign-in ---------- */
body.auth { background: #fff; min-height: 100vh; }
.auth-wrap { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; }
.auth-brand { position: relative; overflow: hidden; color: #fff; padding: 56px 64px; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(1200px 600px at -10% 110%, rgba(111, 160, 19, .35), transparent 60%), linear-gradient(150deg, #1B3F73 0%, #2B66B1 55%, #3E7BC8 100%); }
.auth-brand::after { content: ""; position: absolute; right: -140px; top: -140px; width: 520px; height: 520px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: 0 0 0 70px rgba(255, 255, 255, .03), 0 0 0 140px rgba(255, 255, 255, .025); }
.ab-inner { position: relative; z-index: 1; max-width: 480px; margin-top: auto; margin-bottom: auto; }
.ab-mark { width: 64px; height: 64px; background: #fff; border-radius: 16px; padding: 8px; box-shadow: 0 10px 30px rgba(0, 0, 0, .2); margin-bottom: 28px; }
.auth-brand h2 { font-size: 2rem; line-height: 1.2; font-weight: 700; margin: 0 0 12px; letter-spacing: -.02em; }
.auth-brand > .ab-inner > p { color: rgba(255, 255, 255, .85); font-size: 1rem; margin-bottom: 30px; }
.ab-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 18px; }
.ab-points li { display: flex; gap: 14px; align-items: flex-start; }
.ab-points .ic { width: 22px; height: 22px; padding: 7px; box-sizing: content-box; background: rgba(255, 255, 255, .14); border-radius: 10px; flex: none; }
.ab-points b { display: block; font-size: .95rem; }
.ab-points span { color: rgba(255, 255, 255, .8); font-size: .87rem; line-height: 1.45; }
.ab-foot { position: relative; z-index: 1; font-size: .82rem; color: rgba(255, 255, 255, .7); }
.auth-main { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 24px; background: #fff; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card.wide { max-width: 560px; }
.auth-logo { height: 40px; width: auto; max-width: 100%; display: block; margin-bottom: 36px; }
.auth-title { font-size: 1.6rem; margin-bottom: 6px; letter-spacing: -.02em; }
.auth-sub { color: var(--muted); margin-bottom: 26px; }
.auth-help { color: var(--muted); font-size: .84rem; margin-top: 20px; text-align: center; }
.auth-legal { color: #98A1B2; font-size: .76rem; margin-top: 36px; }
.auth .field input { padding-top: 11px; padding-bottom: 11px; }

/* report */
.report .rh { display: flex; justify-content: space-between; gap: 16px; border-bottom: 2px solid var(--brand); padding-bottom: 14px; margin-bottom: 18px; }
.report .rh img { height: 34px; width: auto; max-width: 100%; }
.report h3 { margin-top: 18px; }
.recs { border: 1px dashed #CDD5E0; border-radius: var(--radius-sm); padding: 4px 14px; }
.recs[contenteditable=true]:focus { outline: 2px solid rgba(43, 102, 177, .3); }
.rf { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 10px; }
.period select { width: auto; }

/* ---------- Responsive ---------- */
@media (max-width: 1150px) { .grid3 { grid-template-columns: 1fr 1fr; } .span2 { grid-column: 1 / -1; } }
@media (max-width: 960px) {
  .auth-wrap { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .auth-brand { padding: 26px 24px 28px; }
  .auth-brand::after { width: 300px; height: 300px; right: -120px; top: -160px; }
  .ab-inner { margin: 0; max-width: none; display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; align-items: center; }
  .ab-mark { width: 48px; height: 48px; border-radius: 12px; padding: 6px; margin: 0; grid-row: span 2; }
  .auth-brand h2 { font-size: 1.15rem; margin: 0; }
  .auth-brand > .ab-inner > p { font-size: .86rem; margin: 0; }
  .ab-points, .ab-foot { display: none; }
  .auth-main { justify-content: flex-start; padding: 32px 20px 40px; }
  .auth-logo { height: 32px; margin-bottom: 26px; }
  .auth-legal { margin-top: 28px; }
}
@media (max-width: 400px) { .ab-inner { grid-template-columns: 1fr; } .ab-mark { grid-row: auto; } }
@media (max-width: 900px) {
  .side { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .22s ease; width: var(--side) !important; box-shadow: var(--shadow-lg); }
  html.side-mini .logo-full { display: block; } html.side-mini .logo-mark { display: none; }
  html.side-mini .nav span { display: inline; } html.side-mini .nav { justify-content: flex-start; padding: 9px 10px; }
  html.side-mini .nav-grp { height: auto; padding: 14px 10px 6px; margin: 0; background: none; font-size: .68rem; }
  html.side-mini .nav::after { display: none; } html.side-mini .side-head { padding: 0 18px; justify-content: flex-start; }
  body.side-open .side { transform: none; }
  body.side-open .side-backdrop { display: block; position: fixed; inset: 0; background: rgba(16, 24, 40, .4); z-index: 25; }
  .grid2, .grid3, .row2 { grid-template-columns: 1fr; }
  .content { padding: 16px; }
  .top { padding: 0 14px; height: 60px; }
  .uname { display: none; }
  .tabs { top: 66px; }
  .kpis, .kpis:has(> :nth-child(3):last-child), .kpis:has(> :nth-child(5):last-child), .kpis:has(> :nth-child(6):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px; } .kv { font-size: 1.25rem; }
  div.dt-container .dt-search input { width: 100%; }
  .tbl-tools { flex-direction: column; align-items: stretch; }
  .seg { display: flex; } .seg button { flex: 1 1 auto; }
  .tbl-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tbl-filters select { width: 100%; min-width: 0; }
  .tbl-filters [data-filters-reset] { grid-column: 1 / -1; justify-self: start; }
  div.dt-container .dt-layout-row { flex-direction: column; align-items: stretch; gap: 8px; }
  div.dt-container .dt-layout-row .dt-layout-cell { justify-content: flex-start; text-align: left; }
  div.dt-container .dt-layout-cell.dt-end { justify-content: flex-start; }
  div.dt-container .dt-search, div.dt-container .dt-search label { width: 100%; }
  div.dt-container .dt-layout-row .dt-layout-cell { width: 100%; }
  div.dt-container .dt-layout-row .dt-search input { width: 100%; }
  div.dt-container .dt-paging { display: flex; flex-wrap: wrap; justify-content: center; }
  div.dt-container .dt-info { text-align: center; }
  .page-head > .btn.primary { width: 100%; }
  .page-head { align-items: stretch; }
  .page-head .btn-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; gap: 8px; }
  .page-head .btn-row > .btn, .page-head .btn-row > form, .page-head .btn-row > form > .btn { width: 100%; }
  .page-head .btn-row > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  .card .dt-container { padding: 4px 12px 12px; }
  .tbl-tools { padding: 12px; }
  .report .rh { flex-direction: column; }
  .form-actions .btn { flex: 1; }
  .card > table.tbl, .card > form > table.tbl { display: block; overflow-x: auto; }
  .card > table.tbl:not(.dl) th { white-space: nowrap; }
  .kpis > .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .card > table.tbl.dl { display: table; }
}
@media (max-width: 600px) { .hide-sm { display: none !important; } }
@media (max-width: 400px) {
  .content { padding: 12px; }
  .card { padding: 14px; }
  .card .dt-container { padding: 4px 8px 10px; }
  .tbl-tools { padding: 10px; }
  table.dataTable .col-act { width: auto; }
  .act { width: 28px; height: 28px; }
  a.rlink { word-break: break-word; }
  table.dataTable.dtable > tbody > tr > td, table.dataTable.dtable > thead > tr > th { padding-left: 6px; padding-right: 6px; }
}
@media print {
  .side, .top, .noprint, .toolbar, .toasts { display: none !important; }
  body { background: #fff; }
  .content { padding: 0; max-width: none; }
  .card, .kpi { box-shadow: none; break-inside: avoid; }
  .recs { border: 0; padding: 0; }
  .kpis { grid-template-columns: repeat(5, 1fr); }
  .grid2 { grid-template-columns: 1fr 1fr; }
}
