/* KTE Service — "Service Line" design trial: sign-in and office screens */

/* ============================ sign-in ============================ */
.login { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(380px, 1fr); background: var(--surface); overflow-x: clip; }
/* the whole page: the red chevron of the K, very large, on a light grey ground; the sign-in form on a white card over it.
   On opening the chevron slides in; then a soft light sweeps across it every few seconds. */
.login { background: #EBEFF4; position: relative; overflow: clip; }
.login-hero { position: relative; overflow: visible; }
.big-k { position: absolute; height: 128vh; height: 128dvh; left: 5vw; top: 50%; transform: translateY(-50%); overflow: visible; pointer-events: none; }
.big-k .k-chev { fill: #ED1C24; }
.big-k .k-sheen { opacity: 0; }
@media (prefers-reduced-motion: no-preference) {
  .big-k > * { transform-box: fill-box; }
  .big-k .k-chev { animation: k-slide 1s cubic-bezier(0.2, 0.8, 0.2, 1) 0.1s both; }
  .big-k .k-sheen { opacity: 1; animation: k-sheen 5s ease-in-out 1.4s infinite; }
  .login-panel { animation: k-fade-up 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) 0.5s both; }
  @keyframes k-slide { from { opacity: 0; transform: translateX(30%); } }
  @keyframes k-sheen { 0% { transform: translateX(0); } 40%, 100% { transform: translateX(460px); } }
  @keyframes k-fade-up { from { opacity: 0; transform: translateY(12px); } }
}
.login-panel { position: relative; z-index: 1; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: clamp(28px, 4vw, 48px);
  display: flex; flex-direction: column; justify-content: center; max-width: 460px; width: calc(100% - 48px); margin: auto; box-sizing: border-box; }
.login-logo { width: 150px; height: auto; margin: 0 0 36px; }
.login-panel h2 { font-size: 2rem; margin-bottom: 8px; }
.login-panel > .muted { margin-bottom: 22px; }
.login-form .form-error { padding: 0 0 12px; }
.login-form .muted.small { margin: 16px 0 0; }
.view-list { display: grid; gap: 10px; }
.view-pick { display: grid; gap: 2px; text-align: left; padding: 14px 16px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); cursor: pointer; font: inherit; color: var(--ink);
  position: relative; transition: border-color 0.12s, background-color 0.12s; }
.view-pick b { font: 700 1.15rem var(--font-c); }
.view-pick small { color: var(--muted); font-size: 0.88rem; }
.view-pick::after { content: ""; position: absolute; right: 18px; top: 50%; width: 9px; height: 9px; border-top: 2px solid var(--muted); border-right: 2px solid var(--muted); transform: translateY(-50%) rotate(45deg); }
.view-pick:hover { border-color: var(--ink); background: var(--hover); }
@media (max-width: 820px) {
  .login { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .login-hero { min-height: 28vh; }
  .big-k { height: 46vh; height: 46dvh; left: 8vw; top: 50%; }
  .login-logo { width: 96px; margin-bottom: 18px; }
  .login-panel { padding: 24px 20px; width: calc(100% - 32px); margin: 0 auto calc(16px + var(--safe-b)); justify-content: flex-start; }
  .login-panel h2 { font-size: 1.6rem; }
}

/* ============================ the Service Line ============================ */
.sline { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px 12px; margin-bottom: 18px; }
.sline-bar { display: flex; gap: 3px; height: 44px; }
.sline-seg { position: relative; min-width: 34px; flex-basis: 0; justify-content: center; background: var(--c); border-radius: 8px; display: flex; align-items: center; padding: 0 10px; text-decoration: none; overflow: hidden;
  transition: transform 0.12s, filter 0.12s; }
.sline-seg:hover { filter: brightness(1.07) saturate(1.05); }
.sline-seg b { font: 700 1.2rem/1 var(--font-c); color: #fff; text-shadow: 0 1px 1px rgba(0, 0, 0, 0.12); position: relative; z-index: 1; }
/* the overdue share of a stage: a red strip along the bottom of its segment */
.sline-seg i { position: absolute; left: 0; bottom: 0; height: 5px; background: var(--alert); }
.sline-seg.is-on { outline: 3px solid var(--ink); outline-offset: 2px; }
.sline-empty { flex: 1; display: grid; place-items: center; border: 1px dashed var(--line-strong); border-radius: 8px; color: var(--muted); font-weight: 600; }
.sline-legend { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(235px, 1fr)); gap: 2px 18px; }
.sline-legend li, .counter, .who-list li { min-width: 0; }
.sline-legend a { display: flex; align-items: center; gap: 8px; min-height: 30px; padding: 2px 6px; margin: 0 -6px; border-radius: 6px; text-decoration: none; color: var(--ink); font-size: 0.9rem; }
.sline-legend a:hover { background: var(--hover); }
.sline-legend .is-on a { background: var(--sunken); }
.sl-dot { width: 10px; height: 10px; border-radius: 3px; background: var(--c); flex: none; }
.sl-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.sl-n { font: 700 0.98rem var(--font-c); margin-left: auto; }
.sl-late { font: 700 0.72rem/1 var(--font); color: #fff; background: var(--alert); border-radius: 5px; padding: 3px 5px; white-space: nowrap; flex: none; }
.sline-legend .is-zero a { color: var(--faint); }
.sline-legend .is-zero .sl-dot { opacity: 0.35; }
.sline-compact { padding: 12px 14px 8px; }
.sline-compact .sline-bar { height: 30px; }
.sline-compact .sline-seg b { font-size: 1rem; }

/* ============================ Home (office) ============================ */
.home-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; }
.home-date { margin: 0 0 4px; font-weight: 600; color: var(--muted); }
.home-head h1 { font-size: 1.7rem; }
.home-head p.muted { margin: 3px 0 0; font-size: 0.98rem; }
.late-link { color: var(--danger); font-weight: 700; }
.phone-only { display: none !important; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
.home-main > .panel:last-child { margin-bottom: 0; }
.home-side { display: grid; gap: 14px; position: sticky; top: calc(var(--top-h) + var(--safe-t) + 18px); }
.home-side .panel { margin: 0; }
.counters { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.counters-7 { grid-template-columns: repeat(7, minmax(0, 1fr)); margin-bottom: 18px; }
.counters-7 .counter { border-left: 0; box-shadow: 1px 0 0 var(--line), 0 1px 0 var(--line); }
.counter { display: grid; gap: 2px; padding: 14px 14px 12px; text-decoration: none; color: var(--ink); border-left: 1px solid var(--line); }
.counter:first-child { border-left: 0; }
.counter:hover { background: var(--hover); }
.counter b { font: 700 2rem/1 var(--font-c); letter-spacing: -0.02em; }
.counter span { font-size: 0.82rem; color: var(--muted); font-weight: 600; line-height: 1.25; }
.counter.is-alert b { color: var(--alert); }
.who h2 { margin-bottom: 12px; }
.who-bar { display: flex; gap: 2px; height: 12px; border-radius: 6px; overflow: hidden; background: var(--sunken); margin-bottom: 12px; }
.who-bar span { min-width: 4px; flex-basis: 0; }
.who-list { list-style: none; margin: 0 0 8px; padding: 0; }
.who-list a { display: flex; align-items: center; gap: 10px; min-height: 34px; text-decoration: none; color: var(--ink); border-radius: 6px; padding: 0 6px; margin: 0 -6px; }
.who-list a:hover { background: var(--hover); }
.who-list b { margin-left: auto; font: 700 1.02rem var(--font-c); }
.who .muted.small { margin: 0; }
.amc-home { display: flex; align-items: center; gap: 16px; text-decoration: none; color: var(--ink); }
.amc-home:hover { border-color: var(--line-strong); }
.ring { --p: 0; width: 68px; height: 68px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: radial-gradient(closest-side, var(--surface) 76%, transparent 78% 100%), conic-gradient(#0e8a7a calc(var(--p) * 1%), var(--sunken) 0); }
.ring b { font: 700 1.05rem var(--font-c); }
.amc-home-text { display: grid; gap: 1px; min-width: 0; }
.amc-kicker { font-size: 0.8rem; font-weight: 700; color: #0e6f63; }
.amc-home-text b { font: 700 1.12rem var(--font-c); }
/* work lists: a complaint per row */
.work .tabs { margin: -6px -4px 6px; }
.jobs { list-style: none; margin: 0; padding: 0; }
.job { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line); }
.jobs > .job:first-child { border-top: 0; }
.job-link { flex: 1; min-width: 0; display: grid; grid-template-columns: 78px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 8px; margin: 0 -8px; border-radius: 8px; text-decoration: none; color: var(--ink); }
.job-link:hover { background: var(--hover); }
.job-link .sr-tag { justify-self: start; }
.job-main { min-width: 0; }
.job-main b { display: block; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job-main small { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job .status { align-items: flex-end; text-align: right; }
.act-what { color: #7a4c00 !important; font-weight: 600; white-space: normal !important; }
.more-line { margin: 10px 0 0; font-weight: 600; }
.needs-action { border-color: #f3d38f; background: linear-gradient(var(--accent-soft), var(--accent-soft)) top / 100% 4px no-repeat, var(--surface); }

@media (max-width: 1100px) { .counters-7 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .home-grid { grid-template-columns: minmax(0, 1fr); } .home-side { position: static; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); } }
@media (max-width: 820px), (pointer: coarse) and (max-height: 500px) {
  .phone-only { display: inline-flex !important; }
  .home-head { flex-direction: column; align-items: stretch; gap: 12px; }
  .home-head h1 { font-size: 1.6rem; }
  .home-head .btn { min-height: 48px; }
  .sline { padding: 14px 14px 8px; }
  .sline-bar { height: 34px; gap: 2px; }
  .sline-seg { min-width: 22px; padding: 0 2px; border-radius: 6px; }
  .sline-seg b { font-size: 0.95rem; }
  .sline-legend { grid-template-columns: 1fr 1fr; gap: 0 12px; }
  .sline-legend .is-zero { display: none; }
  .counters-7 { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 14px; }
  .counters-7 > .counter:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .home-grid { gap: 14px; }
  .counter b { font-size: 1.7rem; }
  .job-link { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "sr st" "main main"; gap: 6px 10px; padding: 12px 6px; margin: 0 -6px; }
  .job-link .sr-tag { grid-area: sr; }
  .job-link .job-main { grid-area: main; }
  .job-link .status { grid-area: st; }
  .job-main small { white-space: normal; }
  .job { flex-wrap: wrap; }
  .job-claim { margin: -4px 0 10px auto; }
}

/* ============================ Complaints ============================ */
/* two-way switch (List | Board) */
.seg { display: inline-flex; background: var(--sunken); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { font: 600 0.9rem var(--font); border: 0; background: none; color: var(--muted); padding: 7px 14px; border-radius: 8px; cursor: pointer; min-height: 34px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(13, 27, 42, 0.12); }
.c-tools { display: grid; grid-template-columns: minmax(260px, 420px) minmax(0, 1fr); gap: 10px 12px; align-items: start; margin-bottom: 8px; }
.c-tools .search-box { margin: 0; }
.c-tools .filters { margin: 0; }
.c-tools .filters select { min-height: 42px; }
.filter-summary { margin: 4px 0 10px; }
/* list */
.rows { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.rows > li + li { border-top: 1px solid var(--line); }
.row { display: grid; gap: 16px; align-items: center; padding: 13px 16px; text-decoration: none; color: var(--ink); }
a.row:hover, button.row:hover { background: var(--hover); }
button.row { width: 100%; border: 0; background: none; font: inherit; text-align: left; cursor: pointer; }
.row small { display: block; color: var(--muted); }
.c-row { grid-template-columns: 96px minmax(0, 1fr) 220px 240px; }
.with-days .c-row { grid-template-columns: 96px minmax(0, 1fr) 220px 64px 240px; }
.c-row.is-late { box-shadow: inset 3px 0 0 var(--alert); }
.row-ref { display: grid; gap: 4px; justify-items: start; }
.row-ref small { font-size: 0.78rem; }
.row-main { min-width: 0; }
.row-main b { display: block; font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-main small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-eq { color: var(--ink-2); font-weight: 600; margin-right: 4px; }
.row-people.kv { grid-template-columns: 78px minmax(0, 1fr); gap: 3px 8px; font-size: 0.88rem; min-width: 0; align-items: baseline; }
.row-people.kv dt { font-size: 0.8rem; font-weight: 600; }
.row-people.kv dd { font-weight: 500; }
.who-line { display: flex; align-items: center; gap: 7px; min-width: 0; white-space: nowrap; }
.who-line > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.role-dot { font-size: 0.78rem; font-weight: 600; color: var(--muted); width: 74px; flex: none; }
.row-days { text-align: center; }
.row-days b { display: block; font: 700 1.3rem/1 var(--font-c); }
.row-days small { font-size: 0.7rem; }
.row-stage { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; }
.row-stage .status { align-items: flex-end; }
.row-flags { display: flex; justify-content: flex-end; }
/* board */
.board { display: flex; gap: 12px; overflow-x: auto; padding: 2px 2px 14px; margin: 0 -2px; align-items: flex-start; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
.b-col { flex: 0 0 280px; background: var(--sunken); border-radius: var(--r); padding: 0 8px 8px; scroll-snap-align: start; max-height: calc(100vh - var(--top-h) - 150px); display: flex; flex-direction: column; }
.b-col header { display: flex; align-items: center; gap: 8px; padding: 12px 6px 10px; border-top: 4px solid var(--c); margin: 0 -8px; padding-left: 14px; padding-right: 14px; border-radius: var(--r) var(--r) 0 0; }
.b-col h2 { font-size: 1rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-col header b { margin-left: auto; font: 700 1rem var(--font-c); color: var(--muted); }
.b-col .sl-dot { --c: inherit; }
.b-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; overflow-y: auto; }
.b-card { display: grid; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; text-decoration: none; color: var(--ink); }
.b-card:hover { border-color: var(--line-strong); box-shadow: 0 2px 6px rgba(13, 27, 42, 0.06); }
.b-card.is-late { border-left: 4px solid var(--alert); padding-left: 9px; }
.b-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.b-where { font-size: 0.98rem; line-height: 1.25; }
.b-eq { color: var(--muted); font-size: 0.84rem; }
.b-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; }
.b-tech { display: inline-flex; align-items: center; gap: 6px; font-size: 0.86rem; font-weight: 600; }
.b-due { color: var(--muted); font-size: 0.78rem; text-align: right; }
.b-card.is-late .b-due { color: var(--danger); font-weight: 600; }
.b-unclaimed { color: #9a4a00; font-weight: 700; font-size: 0.78rem; }

@media (max-width: 1100px) {
  .c-tools { grid-template-columns: 1fr; }
  .c-row { grid-template-columns: 90px minmax(0, 1fr) 190px 200px; gap: 12px; }
  .with-days .c-row { grid-template-columns: 90px minmax(0, 1fr) 190px 52px 200px; gap: 12px; }
}
@media (max-width: 820px), (pointer: coarse) and (max-height: 500px) {
  .page-head .seg { flex: 1 1 100%; }
  .page-head .seg button { flex: 1; }
  .c-tools .filters { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px 4px; scrollbar-width: none; }
  .c-tools .filters::-webkit-scrollbar { display: none; }
  .c-tools .filters > * { flex: none; }
  .c-tools .filters select { width: auto; }
  .rows { border-radius: 14px; }
  .c-row, .with-days .c-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "ref stage" "main main"; gap: 8px 10px; padding: 14px; }
  .c-row .row-ref { grid-area: ref; display: flex; align-items: center; gap: 8px; }
  .c-row .row-main { grid-area: main; }
  .c-row .row-main small { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .c-row .row-stage { grid-area: stage; }
  .c-row .row-people { grid-column: 1 / -1; max-width: 300px; }
  .c-row .row-days { grid-column: 1 / -1; display: flex; gap: 6px; align-items: baseline; text-align: left; }
  .c-row .row-days b { display: inline; font-size: 1rem; }
  .board { margin: 0 -16px; padding: 2px 16px 14px; }
  .b-col { flex-basis: 84vw; max-height: none; }
}

/* ============================ New Complaint (full page on phones) ============================ */
.nc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.nc-grid .field { margin-bottom: 12px; }
.nc-wide { grid-column: 1 / -1; }
.nc-row4 { display: grid; grid-template-columns: 0.8fr 1.3fr 1.2fr 1fr auto; gap: 0 14px; align-items: end; }
.nc-warranty { margin-bottom: 18px; white-space: nowrap; }
.nc-grid textarea { min-height: 64px; }
.nc-grid .picker-list { position: absolute; left: 0; right: 0; top: 100%; z-index: 30; max-height: 230px; }
.nc-from { margin: 0 0 12px; padding: 9px 12px; border-radius: var(--r-sm); background: var(--sunken); font-size: 0.92rem; }
.nc-free summary { cursor: pointer; font-weight: 700; color: var(--link); font-size: 0.92rem; min-height: 32px; display: flex; align-items: center; }
@media (max-width: 820px), (pointer: coarse) and (max-height: 500px) {
  .nc-grid, .nc-row4 { grid-template-columns: 1fr; }
  .dialog-page { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; }
  .dialog-page form { max-height: 100dvh; height: 100%; }
  .dialog-page .dialog-body { flex: 1; }
  .dialog-page footer { background: var(--surface); }
  .dialog-page .nc-grid .picker-list { position: static; box-shadow: none; }
}

/* ============================ AMC (its own teal identity; never mixed with complaints) ============================ */
.amc-summary-bar { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 18px; margin-bottom: 14px; }
.amc-month { display: flex; align-items: center; gap: 16px; }
.amc-ring { background: radial-gradient(closest-side, var(--surface) 76%, transparent 78% 100%), conic-gradient(#0b6e8a calc(var(--p) * 1%), var(--sunken) 0); }
.amc-summary { margin: 0; display: grid; gap: 1px; }
.amc-kicker { font-size: 0.82rem; font-weight: 700; color: #0b6e8a; }
.amc-big { font: 700 1.3rem var(--font-c); }
.amc-overdue-text, .amc-overdue { color: var(--danger); font-weight: 700; }
.fold-all { display: flex; gap: 4px; }
.amc-zone { padding: 0; overflow: hidden; }
.amc-zone h2 { display: flex; gap: 10px; align-items: center; margin: 0; padding: 12px 18px; font-size: 1.1rem; }
.zone-name { white-space: nowrap; }
.zone-count { font: 600 0.84rem var(--font); color: var(--muted); }
.zone-bar { margin-left: auto; width: 160px; height: 8px; border-radius: 4px; background: var(--sunken); overflow: hidden; flex: none; }
.zone-bar span { display: block; height: 100%; background: #2f8f3a; border-radius: 4px; }
.zone-pct { font: 700 1.05rem var(--font-c); width: 46px; text-align: right; flex: none; }
.fold-btn { width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--muted); cursor: pointer; font-size: 0.8rem; flex: none; }
.fold-btn:hover { border-color: var(--line-strong); color: var(--ink); }
.amc-rows { border: 0; border-radius: 0; border-top: 1px solid var(--line); }
.amc-row { display: grid; grid-template-columns: minmax(0, 1fr) 110px 210px auto; gap: 14px; align-items: center; padding: 11px 18px; }
.amc-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.amc-type { font-size: 0.88rem; color: var(--muted); font-weight: 600; }
.amc-state { display: grid; gap: 3px; justify-items: start; min-width: 0; }
.amc-state small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.amc-pill::before { display: none; }
.amc-pill { padding-left: 10px; }
.amc-tag-big { font-size: 0.86rem; padding: 4px 8px; border-radius: 7px; }
/* calendar: a year per branch, a coloured cell per visit */
.amc-legend { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 12px; }
.week-wrap, .cal-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); -webkit-overflow-scrolling: touch; }
.amc-cal { width: 100%; border-collapse: collapse; min-width: 880px; font-size: 0.86rem; }
.amc-cal th, .amc-cal td { border-bottom: 1px solid var(--line); padding: 4px; text-align: center; }
.amc-cal thead th { color: var(--muted); font-weight: 700; padding: 10px 4px; position: sticky; top: 0; background: var(--surface); z-index: 2; }
.amc-cal thead th.is-today { color: var(--ink); box-shadow: inset 0 -3px 0 var(--accent); }
.amc-cal tbody th { text-align: left; font-weight: 500; padding: 6px 12px; min-width: 230px; }
.amc-cal tbody th b { display: block; font-weight: 700; }
.amc-cal tbody th small { color: var(--muted); }
.amc-cal .zone-row th { background: var(--bg); font-weight: 700; padding: 8px 12px; }
.amc-cal tbody th, .amc-cal thead th:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); }
.amc-cal thead th:first-child { z-index: 3; }
.amc-cal .zone-row th { position: static; }
.amc-cal .zone-row .zone-label { position: sticky; left: 12px; display: inline-flex; align-items: center; gap: 8px; max-width: calc(100vw - 60px); white-space: normal; }
.cal-cell { width: 36px; height: 32px; border: 0; border-radius: 8px; font: 700 0.86rem var(--font-c); cursor: pointer; }
.cal-cell:hover, .cal-cell:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
/* one AMC visit */
.amc-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.amc-grid > * { min-width: 0; }
.amc-grid .panel { margin-bottom: 14px; }
.amc-hero .case-name h1 { font-size: 1.9rem; }
.amc-item { display: grid; grid-template-columns: 1.3fr 1fr 1fr 1fr 36px; gap: 0 10px; align-items: start; padding: 12px 0; border-top: 1px solid var(--line); }
.amc-item .it-wide { grid-column: 1 / 5; }
.amc-item .it-rm { grid-column: 5; grid-row: 1; margin-top: 28px; }
.amc-item .picker-list { position: absolute; left: 0; right: 0; top: 100%; z-index: 30; }
.amc-cases li, .branch-work li { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.said { background: var(--bg); border-radius: var(--r-sm); padding: 10px 14px; margin: 10px 0; }
.said p { margin: 2px 0 0; white-space: pre-wrap; }
.promise-form { margin-top: 12px; }
.pin-error:empty { display: none; }
.pin-error { padding: 0 0 8px !important; }
@media (max-width: 1100px) { .amc-grid { grid-template-columns: minmax(0, 1fr) 290px; } }
@media (max-width: 820px), (pointer: coarse) and (max-height: 500px) {
  .amc-summary-bar { padding: 14px; }
  .zone-bar { width: 70px; }
  .amc-zone h2 { flex-wrap: wrap; padding: 12px 14px; }
  .zone-count { flex-basis: 100%; order: 3; padding-left: 40px; }
  .amc-row { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; padding: 12px 14px; }
  .amc-row .amc-name { grid-column: 1 / -1; white-space: normal; }
  .amc-row .row-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .amc-grid { grid-template-columns: minmax(0, 1fr); }
  .amc-item { grid-template-columns: 1fr 36px; }
  .amc-item > * { grid-column: 1; }
  .amc-item .it-wide { grid-column: 1; }
  .amc-item .it-rm { grid-column: 2; grid-row: 1; }
}

/* ============================ Performance ============================ */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(330px, 100%), 1fr)); gap: 14px; margin-bottom: 12px; }
.kpi-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; cursor: pointer; min-width: 0; }
.kpi-card:hover, .kpi-card:focus-visible { border-color: var(--ink); }
.kpi-card.is-total { cursor: default; background: var(--ink); border-color: var(--ink); color: #fff; }
.kpi-card.is-total .kpi-l, .kpi-card.is-total .kpi-more dt { color: #b9c6d6; }
.kpi-card.is-total .kpi-more div { border-color: #26364a; }
.kpi-card h3 { font-size: 1.1rem; margin: 0 0 12px; }
.kpi-head { display: flex; gap: 10px; align-items: center; }
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.kpi { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kpi-v { font: 700 1.6rem/1.05 var(--font-c); }
.kpi-l { font-size: 0.78rem; color: var(--muted); display: flex; gap: 4px; align-items: center; font-weight: 600; }
.kpi-green .kpi-v { color: #2f8f3a; }
.kpi-amber .kpi-v { color: #c77a00; }
.kpi-red .kpi-v { color: var(--alert); }
.kpi-card.is-total .kpi-green .kpi-v { color: #8fd694; } .kpi-card.is-total .kpi-amber .kpi-v { color: #ffc861; } .kpi-card.is-total .kpi-red .kpi-v { color: #ff8a80; }
.kpi-more { margin: 14px 0 0; display: grid; gap: 7px; font-size: 0.88rem; }
.kpi-more div { display: flex; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); padding-top: 7px; }
.kpi-more dt { color: var(--muted); display: flex; gap: 4px; align-items: center; }
.kpi-more dd { margin: 0; font-weight: 700; text-align: right; }
.kpi-detail .kpi-card { cursor: default; }
.late-list { list-style: none; margin: 0; padding: 0; }
.late-list li + li { border-top: 1px solid var(--line); }
.late-list a { display: flex; flex-direction: column; padding: 9px 0; color: var(--ink); text-decoration: none; }
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.chart-grid > * { min-width: 0; }
.chart-card { margin: 0; }
.chart-card.wide { grid-column: 1 / -1; }
.chart-box { position: relative; height: 250px; }
.chart-box.tall { height: 310px; }
.chart-empty { color: var(--muted); text-align: center; padding: 40px 0; margin: 0; }
@media (max-width: 820px), (pointer: coarse) and (max-height: 500px) { .chart-grid { grid-template-columns: 1fr; } .kpi-row { grid-template-columns: repeat(2, 1fr); } }

/* developer settings, scroll recorder */
.dev-group h2 { margin-top: 0; }
.dev-group .dev-note { color: var(--muted); font-size: 0.88rem; margin: 0 0 12px; }
.dev-group .dev-red { color: var(--danger); font-weight: 600; }
.dev-group .dev-save-row { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.dev-group textarea { width: 100%; }
.dev-days { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 12px; }
.dev-days label { display: inline-flex; align-items: center; gap: 6px; }
.dev-rules input[type=text], .dev-rules input[type=number] { width: 90px; }
.dev-audit { color: var(--muted); font-size: 0.82rem; margin: 8px 0 0; }
.scroll-log { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.74rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px; }
.rec-kv { grid-template-columns: max-content minmax(0, 1fr); }
.rec-fields { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 12px 4px; margin: 10px 0 0; }
.rec-fields legend { font-size: 0.86rem; font-weight: 600; padding: 0 4px; }
.tile b .cur { font-size: 0.5em; font-weight: 700; color: var(--muted); vertical-align: 0.35em; }

/* ============================ Settings (hub, Customers, Equipment, Users, SLA, Teams, Free Plan Space) ============================ */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 12px; }
.settings-card { display: grid; gap: 4px; text-decoration: none; color: var(--ink); margin: 0; padding: 18px 20px 18px; position: relative; min-height: 104px; }
.settings-card b, .settings-card strong, .settings-card h2 { font: 700 1.2rem var(--font-c); color: var(--ink); margin: 0; }
.settings-card span, .settings-card small, .settings-card p { color: var(--muted); font-size: 0.9rem; margin: 0; }
.settings-card::after { content: ""; position: absolute; right: 18px; top: 22px; width: 9px; height: 9px; border-top: 2px solid var(--faint); border-right: 2px solid var(--faint); transform: rotate(45deg); }
.settings-card:hover, .settings-card:focus-visible { border-color: var(--ink); }
.settings-card:hover::after { border-color: var(--ink); }
/* list rows */
.rows.flat { border: 0; border-radius: 0; margin: 0 -20px -18px; border-top: 1px solid var(--line); }
.row-main.user-main { display: flex; gap: 12px; align-items: center; }
.row-main.user-main small { display: block; }
.item-row { grid-template-columns: minmax(180px, 1fr) minmax(0, 2fr); }
.cust-row { grid-template-columns: minmax(0, 1fr) 120px 240px; }
.branch-row { grid-template-columns: minmax(0, 1fr) 180px 150px; }
.item-name b { font-weight: 700; }
.flags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.flag-line { margin: 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: 0.92rem; }
.users .row { grid-template-columns: minmax(0, 1fr) 200px 110px minmax(0, 430px); }
.users .row .row-actions .btn { padding: 4px 10px; }
.users .row .row-actions { justify-content: flex-end; }
.uname-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-weight: 600; }
.note { margin: 4px 0 0; padding: 9px 13px; background: var(--link-soft); border-left: 3px solid var(--link); border-radius: var(--r-sm); font-size: 0.9rem; }
.warn-note { background: var(--accent-soft); color: #6b4300; border-radius: var(--r-sm); padding: 10px 12px; font-weight: 600; }
.ok-text { color: #0b5c40; font-weight: 700; }
.photo-edit { display: flex; gap: 16px; align-items: center; margin-bottom: 14px; }
.photo-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.photo-actions small { flex-basis: 100%; }
.inline-search { max-width: 360px; }
/* SLA thresholds */
.sla-table { width: 100%; border-collapse: collapse; }
.sla-table th, .sla-table td { text-align: left; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); }
.sla-table thead th { font-size: 0.8rem; color: var(--muted); font-weight: 700; }
.sla-table .status-pill { white-space: normal; }
.sla-days { max-width: 130px; }
/* AMC teams */
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 14px; }
.team-grid > * { min-width: 0; }
.team-card { margin: 0; }
.team-card .panel-head { flex-wrap: wrap; }
.person { display: inline-flex; align-items: center; gap: 8px; }
.member-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 14px; }
/* leave, transport (Users) */
.transport-box .grid-2 { margin-top: 8px; }
.leave-box { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.leave-box h3 { margin: 0; font-size: 1rem; }
.leave-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.leave-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--r-sm); }
.leave-list small { display: block; }
/* free plan space (developer) */
.usage h2 { font-size: 1.05rem; }
.usage-row + .usage-row { margin-top: 12px; }
.usage-label { display: flex; justify-content: space-between; gap: 10px; font-size: 0.88rem; font-weight: 600; margin-bottom: 5px; flex-wrap: wrap; }
.usage-bar { height: 8px; background: var(--sunken); border-radius: 4px; overflow: hidden; }
.usage-bar span { display: block; height: 100%; border-radius: 4px; }
.lvl-green { background: #2f8f3a; } .lvl-amber { background: var(--accent); } .lvl-red { background: var(--alert); }
.usage-warn { margin: 12px 0 0; padding: 10px 12px; border-radius: var(--r-sm); background: var(--alert-soft); color: #7a1510; font-size: 0.92rem; }
.usage-warn a { color: inherit; font-weight: 700; }
.steps { border: 0; padding: 0; margin: 14px 0 0; min-width: 0; }
.steps:disabled { opacity: 0.5; }
.step { border-top: 1px solid var(--line); padding: 14px 0 4px; }
.step h3 { font-size: 1rem; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.step-no { width: 24px; height: 24px; border-radius: 7px; background: var(--ink); color: #fff; display: grid; place-items: center; font: 700 0.82rem var(--font-c); }
.step .field { max-width: 320px; }
/* Admin KPI step hours */
.kpi-more .kpi-steps { display: block; }
.kpi-steps dd { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 6px; text-align: left; }
.kpi-steps dd span { display: flex; flex-direction: column; gap: 1px; }
.kpi-steps dd small { color: var(--muted); font-weight: 500; font-size: 0.78rem; }
.kpi-steps dd b { font-size: 1rem; white-space: nowrap; }
.cal-wrap { max-height: calc(100dvh - var(--top-h) - 90px); overflow: auto; }
@media (max-width: 1300px) { .users .row { grid-template-columns: minmax(0, 1fr) 200px 110px; } .users .row .row-actions { grid-column: 1 / -1; justify-content: flex-start; flex-wrap: wrap; } }
@media (max-width: 820px), (pointer: coarse) and (max-height: 500px) {
  .cust-row, .branch-row, .item-row { grid-template-columns: 1fr; gap: 6px; }
  .flags { justify-content: flex-start; }
  .rows.flat { margin: 0 -16px -16px; }
  .users .row { grid-template-columns: 1fr; gap: 6px; padding: 14px; }
  .users .row > :nth-child(2), .users .row > :nth-child(3) { padding-left: 52px; }
  .users .row > :nth-child(2) { display: flex; flex-wrap: wrap; gap: 6px; }
  .users .row .row-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }
  .users .row .row-actions .btn { min-height: 40px; white-space: nowrap; padding: 6px 8px; }
  .users .row .row-actions:empty { display: none; }
  .cal-wrap { max-height: calc(100dvh - 190px); }
}
.count { margin: 4px 0 10px; }
