@font-face { font-family: 'Outfit'; src: url(fonts/outfit-latin-wght-normal.woff2) format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Oswald'; src: url(fonts/oswald-latin-wght-normal.woff2) format('woff2'); font-weight: 200 700; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url(fonts/jetbrains-mono-latin-wght-normal.woff2) format('woff2'); font-weight: 100 800; font-display: swap; }
:root {
    --ink: #16202A; --ink-2: #3B4651; --ink-3: #6A747E; --ink-4: #98A0A8;
    --paper: #F3F0E9; --paper-2: #EAE6DC; --card: #fff; --line: #E1DCD0; --line-2: #D2CCBE;
    --heat: #E2602A; --heat-s: #FCE6DA; --cool: #2C6E9B; --cool-s: #DDEAF4; --ok: #2E7A52; --ok-s: #DCEFE3; --warn: #B97C06; --warn-s: #FBEFCF; --bad: #BE3B2A; --bad-s: #F9DFDA;
    --sans: 'Outfit', system-ui, sans-serif; --cond: 'Oswald', 'Arial Narrow', sans-serif; --mono: 'JetBrains Mono', ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 400 14px/1.4 var(--sans); color: var(--ink); background: var(--paper); display: flex; flex-direction: column; -webkit-font-smoothing: antialiased; }
button, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
:focus-visible { outline: 2.5px solid #3B86BA; outline-offset: 2px; }
body.is-dragging, body.is-dragging * { cursor: grabbing !important; user-select: none; }

.bar { display: flex; align-items: center; gap: 28px; padding: 12px 22px; background: var(--ink); color: #fff; flex-wrap: wrap; position: relative; }
.brand { display: flex; align-items: center; gap: 10px; font: 500 19px/1 var(--cond); letter-spacing: .03em; text-transform: uppercase; }
.brand b { font-weight: 300; color: #9FB4C4; }
.logo { width: 32px; height: 32px; }
.day { display: flex; align-items: center; gap: 10px; }
.day div { display: flex; flex-direction: column; }
.day-k { font: 500 10.5px/1.2 var(--cond); letter-spacing: .1em; text-transform: uppercase; color: #F49A6E; }
.day b { font: 500 17px/1.2 var(--cond); }
.daynav { width: 30px; height: 30px; border-radius: 8px; border: 1px solid rgba(255,255,255,.18); display: grid; place-items: center; color: #9EABB6; }
.daynav svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.kpis { display: flex; gap: 26px; margin-left: auto; margin-right: 140px; }
.kpis div { display: flex; flex-direction: column; }
.kpis b { font: 500 20px/1 var(--cond); }
.kpis span { font-size: 11.5px; color: #9EABB6; margin-top: 2px; }
.kpis .warn b { color: #F6B25A; }
.ribbon { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); font: 500 11px/1 var(--sans); letter-spacing: .04em; color: rgba(233,237,240,.8); text-decoration: none; padding: 6px 10px; border: 1px solid rgba(233,237,240,.25); border-radius: 99px; }
.ribbon:hover { color: #fff; border-color: var(--heat); }

.layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 270px 1fr; }
.tray { border-right: 1px solid var(--line); padding: 18px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; background: var(--paper); }
.tray h2 { margin: 0; font: 500 13px/1.2 var(--cond); letter-spacing: .09em; text-transform: uppercase; color: var(--ink-2); display: flex; align-items: center; gap: 8px; }
#traycount:not(:empty) { background: var(--heat); color: #fff; font: 600 11px/18px var(--sans); min-width: 18px; text-align: center; border-radius: 99px; padding: 0 5px; letter-spacing: 0; }
.tray-p { margin: 0; font-size: 12.5px; color: var(--ink-3); }
.traylist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.tcard { width: 100%; text-align: left; display: flex; flex-direction: column; gap: 3px; padding: 11px 12px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--c); cursor: grab; touch-action: none; transition: box-shadow .15s; }
.tcard:hover { box-shadow: 0 4px 14px rgba(22,32,42,.08); }
.tcard.sel { box-shadow: 0 0 0 2px var(--ink); }
.tcard b { font-weight: 600; font-size: 14px; }
.tc-top { display: flex; justify-content: space-between; align-items: center; }
.tc-d { font: 500 11.5px var(--mono); color: var(--ink-3); }
.tc-c { font-size: 12.5px; color: var(--ink-2); }
.tc-u { font-size: 12px; font-weight: 600; color: var(--bad); }
.tc-n { font-size: 12px; color: var(--ink-3); }
.chip { display: inline-block; font: 500 10px/1 var(--cond); letter-spacing: .09em; text-transform: uppercase; padding: 4px 6px 3px; border-radius: 4px; background: var(--cs); color: var(--cd); }
.empty { color: var(--ink-3); font-size: 13px; list-style: none; }
.log { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); }
.log ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 7px; }
.log li { font-size: 12.5px; color: var(--ink-2); display: grid; grid-template-columns: 40px 1fr; gap: 6px; }
.log li span { font: 500 11.5px var(--mono); color: var(--ink-3); }
.log li:first-child { animation: in .3s ease; }

.t-service { --c: #2C6E9B; --cs: #DDEAF4; --cd: #1F557A; }
.t-repair { --c: #E2602A; --cs: #FCE6DA; --cd: #A3401A; }
.t-install { --c: #6B57A6; --cs: #E6E0F2; --cd: #4E3E7C; }
.t-inspection { --c: #6B7F3A; --cs: #E7EBDD; --cd: #4A5A2B; }
.t-survey { --c: #8A6A2E; --cs: #F2E8D3; --cd: #6B5020; }

.board { position: relative; min-width: 0; display: flex; flex-direction: column; padding: 16px 20px 20px; gap: 12px; overflow: hidden; }
.hint { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: 10px; background: var(--cool-s); color: #1F4E70; font-size: 13.5px; }
.hint svg { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; }
.hint.done { background: var(--ok-s); color: #1E5638; }
.hint.done span { text-decoration: line-through; text-decoration-color: rgba(30,86,56,.4); }
.scroller { flex: 1; min-height: 0; overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.grid { min-width: 980px; }
.axis { display: grid; grid-template-columns: 220px 1fr; position: sticky; top: 0; z-index: 3; background: var(--card); border-bottom: 1px solid var(--line); }
.ax-h { padding: 10px 16px; font: 500 11px var(--cond); letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); }
.ax-t { position: relative; height: 36px; margin: 0 22px 0 6px; }
.ax-t span { position: absolute; top: 11px; transform: translateX(-50%); font: 500 11px var(--mono); color: var(--ink-3); }
.lane { display: grid; grid-template-columns: 220px 1fr; border-bottom: 1px solid var(--line); min-height: max(104px, calc((100vh - 252px) / 4)); }
.lane:last-child { border-bottom: 0; }
.lane-h { display: flex; gap: 10px; padding: 14px 14px 14px 16px; border-right: 1px solid var(--line); background: #FCFBF8; }
.av { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; font-weight: 600; font-size: 13px; color: #fff; background: var(--ink-2); position: relative; }
.av::after { content: ''; position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid #FCFBF8; background: var(--ok); }
.av-offline::after { background: var(--ink-4); }
.av-driving::after { background: var(--cool); }
.lh-m { display: flex; flex-direction: column; min-width: 0; }
.lh-m b { font-weight: 600; }
.lh-v { font-size: 12px; color: var(--ink-3); }
.lh-s { font-size: 12px; margin-top: 5px; line-height: 1.3; }
.s-onsite { color: var(--heat); } .s-driving { color: var(--cool); } .s-offline { color: var(--warn); }
.lane-t { position: relative; margin: 0 22px 0 6px; background: repeating-linear-gradient(90deg, var(--line) 0 1px, transparent 1px 10%); background-size: 100% 100%; transition: background-color .15s; }
.lane-t.over { background-color: rgba(59, 134, 186, .08); box-shadow: inset 0 0 0 2px rgba(59,134,186,.5); border-radius: 6px; }
.now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--heat); opacity: .8; z-index: 0; pointer-events: none; }
.lane:first-child .now::before { content: '08:41'; position: absolute; top: 2px; left: 4px; font: 600 10px var(--mono); color: var(--heat); }
.job { position: absolute; top: 14px; bottom: 14px; min-width: 0; text-align: left; display: flex; flex-direction: column; justify-content: center; gap: 1px; padding: 6px 8px; border-radius: 8px; background: var(--cs); border: 1px solid color-mix(in srgb, var(--c) 30%, transparent); border-left: 4px solid var(--c); overflow: hidden; cursor: grab; touch-action: none; transition: box-shadow .15s, opacity .15s; z-index: 1; }
.job:hover { box-shadow: 0 4px 12px rgba(22,32,42,.14); z-index: 4; }
.job.sel { box-shadow: 0 0 0 2px var(--ink); z-index: 4; }
.jb-t { font: 600 11px var(--mono); color: var(--cd); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jb-c { font-size: 12.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job.st-done { opacity: .55; cursor: default; background: repeating-linear-gradient(135deg, var(--cs) 0 6px, #fff 6px 12px); }
.job.st-onsite::after { content: ''; position: absolute; right: 7px; top: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--heat); box-shadow: 0 0 0 3px rgba(226,96,42,.2); }
.job.clash { border-color: var(--bad); box-shadow: 0 0 0 2px var(--bad); }
.jb-w { font-size: 10.5px; font-weight: 700; color: var(--bad); text-transform: uppercase; letter-spacing: .05em; }
.job.dragging, .tcard.dragging { opacity: .35; }
.job.flash { animation: flash 1s ease; }
@keyframes flash { 0% { box-shadow: 0 0 0 6px rgba(46,122,82,.5); } 100% { box-shadow: 0 0 0 0 rgba(46,122,82,0); } }
.late { position: absolute; right: -18px; top: 4px; font-size: 10.5px; font-weight: 700; color: var(--bad); }
.ghost { position: fixed; left: 0; top: 0; z-index: 100; pointer-events: none; border-radius: 8px; background: var(--cs); border-left: 4px solid var(--c); box-shadow: 0 14px 30px rgba(22,32,42,.3); padding: 6px 8px; display: flex; flex-direction: column; justify-content: center; font-size: 12.5px; overflow: hidden; white-space: nowrap; min-width: 120px; }
.g-t { font: 600 11px var(--mono); color: var(--cd); }

.detail { position: absolute; right: 32px; bottom: 32px; width: 320px; background: var(--card); border-radius: 14px; box-shadow: 0 20px 50px rgba(22,32,42,.25), 0 0 0 1px var(--line); padding: 16px; z-index: 10; animation: in .2s ease; }
.detail[hidden] { display: none; }
.detail header { display: flex; align-items: center; gap: 8px; }
.d-id { font: 500 12px var(--mono); color: var(--ink-3); }
.x { margin-left: auto; width: 28px; height: 28px; border-radius: 8px; font-size: 20px; line-height: 1; color: var(--ink-3); }
.x:hover { background: var(--paper); }
.detail h3 { margin: 10px 0 2px; font: 500 19px/1.2 var(--cond); }
.detail p { margin: 0; color: var(--ink-2); }
.d-m { font: 500 12px var(--mono); color: var(--ink-3) !important; margin-top: 4px !important; }
.d-row { display: grid; grid-template-columns: 1.4fr 1fr; gap: 8px; margin-top: 14px; }
.d-row label { display: flex; flex-direction: column; gap: 4px; font: 500 10.5px var(--cond); letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); }
.d-row select { font: 400 14px var(--sans); color: var(--ink); text-transform: none; letter-spacing: 0; padding: 8px; border-radius: 8px; border: 1px solid var(--line-2); background: #fff; }
.apply { width: 100%; margin-top: 12px; padding: 11px; border-radius: 10px; background: var(--heat); color: #fff; font-weight: 600; }
.apply:disabled { background: var(--line-2); color: var(--ink-3); cursor: default; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 10px; font-size: 13.5px; transition: opacity .2s, transform .2s; z-index: 200; width: max-content; max-width: calc(100% - 32px); box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@keyframes in { from { opacity: 0; transform: translateY(6px); } }

@media (max-width: 900px) {
    body { height: auto; min-height: 100%; }
    .bar { gap: 14px 20px; padding: 12px 16px; }
    .kpis { margin: 0; width: 100%; justify-content: space-between; gap: 10px; }
    .ribbon { top: 18px; transform: none; right: 14px; }
    .layout { grid-template-columns: 1fr; }
    .tray { border-right: 0; border-bottom: 1px solid var(--line); order: 2; }
    .board { padding: 12px 16px 16px; overflow: visible; }
    .scroller { max-height: none; }
    .grid { min-width: 860px; }
    .lane { min-height: 104px; }
    .axis, .lane { grid-template-columns: 150px 1fr; }
    .lane-h { padding: 12px 10px; }
    .lh-s { display: none; }
    .detail { position: fixed; left: 12px; right: 12px; bottom: 12px; width: auto; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
