:root {
  --bg: #f3f5f8;
  --card: #ffffff;
  --ink: #1b2430;
  --muted: #5b6775;
  --line: #dfe4ea;
  --soft: #f7f9fb;
  --blue: #1e66ba;
  --blue-ink: #ffffff;
  --blue-soft: #e8f0fa;
  --note: #fff8e6;
  --note-line: #f0dca8;
  --red: #c62828;
  --red-soft: #fdecec;
  --amber: #9a5b00;
  --amber-soft: #fff3dc;
  --green: #2e7d32;
  --green-soft: #e7f4e8;
  --gray-soft: #eceff3;
  --radius: 8px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --card: #1b2129;
    --ink: #e6eaf0;
    --muted: #9aa5b3;
    --line: #2d3540;
    --soft: #161b22;
    --blue: #5a9be6;
    --blue-ink: #0b1220;
    --blue-soft: #1c2a3d;
    --note: #2a2516;
    --note-line: #4d4223;
    --red: #ef7b7b;
    --red-soft: #3a1f22;
    --amber: #e8b45c;
    --amber-soft: #3a2e17;
    --green: #7ccf80;
    --green-soft: #1d3220;
    --gray-soft: #262e38;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; margin: 0; line-height: 1.25; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 16px 0 8px; }
p { margin: 0 0 10px; }

/* Header */
.top {
  display: flex; align-items: center; gap: 20px;
  padding: 0 20px; height: 56px;
  background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--ink); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand.big { font-size: 22px; margin-bottom: 18px; }
.top nav { display: flex; gap: 4px; }
.top nav a { padding: 6px 10px; border-radius: 6px; color: var(--muted); font-weight: 500; white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.top nav a:hover { background: var(--soft); text-decoration: none; color: var(--ink); }
.top nav a.on { color: var(--blue); background: var(--blue-soft); }
.search { margin-left: auto; }
.search input { width: 240px; }
.me { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; white-space: nowrap; }

/* Layout */
.page { max-width: 1240px; margin: 0 auto; padding: 24px 20px 60px; }
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.card .head { margin-bottom: 8px; align-items: center; }
.card .head h2 { margin: 0; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; font-size: 14px; }
.buttons { display: flex; gap: 8px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.split > * { min-width: 0; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-bottom: 20px;
}
.card.flush { padding: 0; overflow: hidden; }
.card.narrow { width: 100%; max-width: 400px; padding: 28px; }
.card.narrow h1 { font-size: 21px; margin-bottom: 8px; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; color: var(--muted); font-size: 13px;
}
.stat:hover { text-decoration: none; border-color: var(--blue); }
.stat span { display: block; font-size: 26px; font-weight: 700; color: var(--ink); line-height: 1.2; }
.stat.hot span { color: var(--red); }

/* Tables */
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
.list th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--soft); }
.list td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.list tr:last-child td { border-bottom: 0; }
.list .num { width: 1%; white-space: nowrap; text-align: right; }
.list td input, .list td select { min-width: 0; }
.sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.empty { color: var(--muted); padding: 14px 4px; margin: 0; }
.card.flush .empty { padding: 18px; }

/* Badges */
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--gray-soft); color: var(--muted); white-space: nowrap; }
.s-new { background: var(--blue-soft); color: var(--blue); }
.s-open { background: var(--amber-soft); color: var(--amber); }
.s-pending, .s-on_hold { background: var(--gray-soft); color: var(--muted); }
.s-solved, .s-closed { background: var(--green-soft); color: var(--green); }
.p-high { background: var(--amber-soft); color: var(--amber); }
.p-urgent, .badge.warn { background: var(--red-soft); color: var(--red); }
.p-low { background: var(--gray-soft); color: var(--muted); }

/* Forms */
input, select, textarea, button, .button { font: inherit; color: inherit; }
input, select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--card);
}
input[type=checkbox], input[type=radio] { width: auto; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); }
label > input, label > select, label > textarea { margin-top: 4px; font-weight: 400; color: var(--ink); }
label.check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 400; font-size: 14px; }
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 6px; border: 1px solid var(--line); background: var(--card);
  font-weight: 600; cursor: pointer; white-space: nowrap; color: var(--ink);
}
button:hover, .button:hover { background: var(--soft); text-decoration: none; }
.primary, button.primary { background: var(--blue); border-color: var(--blue); color: var(--blue-ink); }
.primary:hover, button.primary:hover { background: var(--blue); filter: brightness(1.08); }
button.link { border: 0; background: none; padding: 0; color: var(--blue); font-weight: 500; }
button.link:hover { text-decoration: underline; background: none; }
button.danger { color: var(--red); }
.stack { display: grid; gap: 12px; }
.stack h2 { margin: 0; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 16px; }
.form-grid .wide { grid-column: 1 / -1; }
.actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.form-grid .actions { justify-content: flex-start; }
.actions label { display: flex; align-items: center; gap: 8px; }
.actions label select { margin: 0; width: auto; }
.filters, .inline-form { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filters input[type=search] { flex: 1 1 260px; width: auto; }
.filters select { width: auto; }
.inline-form > * { width: auto; flex: 1 1 140px; }
.inline-form > textarea { flex: 3 1 260px; }
.inline-form > button, .inline-form > select { flex: 0 0 auto; }
details { margin-top: 12px; }
summary { cursor: pointer; color: var(--blue); font-weight: 600; font-size: 14px; margin-bottom: 10px; }

.notice { background: var(--blue-soft); color: var(--ink); border: 1px solid var(--line); border-left: 4px solid var(--blue); padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; }
.error { background: var(--red-soft); color: var(--red); padding: 10px 12px; border-radius: 6px; margin-bottom: 14px; font-size: 14px; }
.warn-box { border-left: 4px solid var(--amber); }
.warn-box input { margin-top: 10px; }

/* Ticket thread */
.thread { display: grid; gap: 12px; margin-bottom: 20px; }
.msg { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.card .msg { margin-top: 12px; }
.msg header { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; font-size: 14px; }
.msg time { margin-left: auto; color: var(--muted); font-size: 13px; }
.msg .body, .card .body { white-space: pre-wrap; overflow-wrap: anywhere; }
.k-reply { border-left: 4px solid var(--blue); }
.k-note { background: var(--note); border-color: var(--note-line); }
.tag { font-size: 12px; color: var(--muted); }
.tag.warn { color: var(--red); font-weight: 600; }
.reply .tabs { display: flex; gap: 18px; margin-bottom: 8px; }
.reply .tabs label { display: flex; align-items: center; gap: 6px; color: var(--ink); font-size: 14px; }
.reply textarea { margin-bottom: 12px; }
ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li { padding: 6px 0; border-bottom: 1px solid var(--line); }
ul.plain li:last-child { border-bottom: 0; }
.links p { margin-bottom: 12px; }

@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .search { display: none; }
  .stats { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .top { flex-wrap: wrap; height: auto; padding: 10px 16px; gap: 8px 16px; }
  .top nav { order: 3; width: 100%; overflow-x: auto; }
  .me { margin-left: auto; }
  .me span { display: none; }
  .page { padding: 16px 16px 48px; }
  .page > .head { flex-direction: column; }
  .card .head { align-items: baseline; }
  .form-grid, .pair { grid-template-columns: 1fr; }
}

/* Tabs above lists */
.pills { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.pills a { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--muted); font-weight: 600; font-size: 14px; }
.pills a:hover { text-decoration: none; color: var(--ink); }
.pills a.on { background: var(--blue-soft); color: var(--blue); border-color: var(--blue); }
.pills span { font-weight: 400; margin-left: 4px; }
.narrow-form { max-width: 640px; }

/* Tasks */
.top nav .count { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 2px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.task-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.task-bar .who select { width: auto; }
.quick-add { display: flex; gap: 8px; margin: 8px 0 6px; }
.quick-add input[name=text] { flex: 1; }
.hint { margin-bottom: 16px; }
.task-group h2 { display: flex; gap: 8px; align-items: baseline; }
.task-group h2.late { color: var(--red); }
ul.tasks { list-style: none; margin: 0; padding: 0; }
.task { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: 0; }
.tick { margin: 0; }
.tick-btn { width: 22px; height: 22px; padding: 0; border-radius: 50%; border: 2px solid var(--muted); background: transparent; margin-top: 1px; }
.tick-btn:hover { background: var(--soft); }
.tick-btn span { display: block; width: 6px; height: 11px; margin: 0 auto 3px; border: solid transparent; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.tick-btn:hover span, .is-done .tick-btn span { border-color: var(--muted); }
.p1 .tick-btn { border-color: var(--red); background: var(--red-soft); }
.p2 .tick-btn { border-color: var(--amber); background: var(--amber-soft); }
.p3 .tick-btn { border-color: var(--blue); background: var(--blue-soft); }
.is-done .task-title { text-decoration: line-through; color: var(--muted); }
.task-body { min-width: 0; flex: 1; }
.task-title { color: var(--ink); overflow-wrap: anywhere; }
.task-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--muted); margin-top: 2px; }
.task-meta a { color: var(--muted); }
.task-meta .when.now { color: var(--green); font-weight: 600; }
.task-meta .when.late { color: var(--red); font-weight: 600; }
.card .head.pad { padding: 16px 18px 4px; margin: 0; }

/* Calendar */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.day { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); min-height: 220px; display: flex; flex-direction: column; min-width: 0; }
.day header { padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 13px; }
.day header a { color: var(--muted); }
.day header strong { font-size: 18px; color: var(--ink); margin-left: 4px; }
.day.is-today { border-color: var(--blue); }
.day.is-today header { background: var(--blue-soft); }
.day.is-today header strong { color: var(--blue); }
.items { padding: 6px; display: grid; gap: 4px; align-content: start; }
.free { color: var(--muted); font-size: 12px; padding: 4px; }
.cal-item { display: block; padding: 5px 7px; border-radius: 5px; background: var(--soft); border-left: 3px solid var(--muted); font-size: 13px; color: var(--ink); line-height: 1.3; overflow: hidden; }
.cal-item:hover { text-decoration: none; background: var(--blue-soft); }
.cal-item.linked { border-left-color: var(--blue); }
.cal-item .t { display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
.cal-item .s { display: block; overflow-wrap: anywhere; }
.cal-item .a { display: block; font-size: 11px; color: var(--blue); }
.cal-task { display: block; font-size: 12px; color: var(--muted); padding: 2px 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-task.p1 { color: var(--red); }
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-top: 8px; }
.dow { font-size: 12px; font-weight: 600; color: var(--muted); padding: 2px 6px; }
.mday { background: var(--card); border: 1px solid var(--line); border-radius: 6px; min-height: 104px; padding: 4px; display: grid; gap: 3px; align-content: start; min-width: 0; }
.mday.other { opacity: .55; }
.mday.is-today { border-color: var(--blue); }
.mday .num { font-size: 13px; font-weight: 600; color: var(--ink); padding: 0 3px; }
.mday.is-today .num { color: var(--blue); }
.mday .cal-item { padding: 2px 5px; font-size: 12px; white-space: nowrap; text-overflow: ellipsis; }
.mday .cal-item .t { display: inline; margin-right: 4px; }
.mday .cal-item .s { display: inline; }
.more { font-size: 11px; color: var(--muted); padding: 0 4px; }
fieldset.attendees { border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; margin: 0; display: grid; gap: 8px; }
fieldset.attendees legend { font-size: 13px; font-weight: 600; color: var(--muted); padding: 0 4px; }
[data-contact-boxes] { display: grid; gap: 6px; max-height: 220px; overflow-y: auto; }
@media (max-width: 900px) {
  .week { grid-template-columns: 1fr; }
  .day { min-height: 0; }
  .month { gap: 2px; }
  .mday { min-height: 64px; }
  .mday .cal-item .t { display: none; }
}
[data-new-day] { cursor: pointer; position: relative; }
[data-new-day]:hover { border-color: var(--blue); }
.day[data-new-day]::after, .mday[data-new-day]::after { content: "+"; position: absolute; right: 8px; bottom: 4px; font-size: 18px; color: var(--blue); opacity: 0; }
.day[data-new-day]:hover::after, .mday[data-new-day]:hover::after { opacity: 1; }
.places { position: relative; }
.place-list { position: absolute; left: 0; right: 0; top: 100%; z-index: 10; list-style: none; margin: 4px 0 0; padding: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 6px 20px rgba(0,0,0,.18); font-weight: 400; }
.place-list li { padding: 7px 9px; border-radius: 4px; cursor: pointer; display: grid; color: var(--ink); }
.place-list li span { font-size: 12px; color: var(--muted); }
.place-list li:hover, .place-list li.on { background: var(--blue-soft); }
.place-list li.src-site strong::before, .place-list li.src-account strong::before { content: "★ "; color: var(--blue); }

/* Calendar colors (classes, since the page doesn't allow inline styles) */
.c0 { --cal: #3b82f6; } .c1 { --cal: #16a34a; } .c2 { --cal: #ea580c; } .c3 { --cal: #9333ea; }
.c4 { --cal: #0d9488; } .c5 { --cal: #db2777; } .c6 { --cal: #ca8a04; } .c7 { --cal: #6b7280; }
.cal-item[class*=" c"], .cal-item[class^="c"] { border-left-color: var(--cal); }
.cal-item.linked { border-left-width: 4px; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: var(--cal); vertical-align: -1px; margin-right: 6px; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; margin: -4px 0 12px; align-items: center; }
.cal-rows li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 10px 0; }
.cal-rows li > label { flex: 1 1 260px; }
.cal-rows select { width: auto; }
.inline-name { width: auto; min-width: 180px; padding: 4px 8px; }
.howto { padding-left: 18px; display: grid; gap: 8px; font-size: 14px; }

/* Home */
.home-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; align-items: start; }
.home-grid h3 { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; margin: 16px 0 6px; }
.weather-form { display: flex; gap: 8px; margin-bottom: 12px; position: relative; }
.weather-form input { flex: 1; }
.wx-now { display: flex; align-items: center; gap: 14px; margin: 4px 0 12px; }
.wx-icon { font-size: 40px; line-height: 1; }
.wx-temp { font-size: 42px; font-weight: 700; line-height: 1; }
.wx-desc { display: grid; gap: 2px; }
.wx-hours { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(52px, 1fr); gap: 4px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 10px; }
.wx-hour { display: grid; justify-items: center; gap: 2px; padding: 6px 2px; border-radius: 6px; background: var(--soft); font-size: 13px; }
.wx-rain { color: var(--blue); font-size: 12px; }
.wx-days { display: grid; gap: 2px; margin-bottom: 6px; }
.wx-day { display: grid; grid-template-columns: 54px 26px 1fr 42px 40px 36px; align-items: center; gap: 6px; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.wx-day:last-child { border-bottom: 0; }
.wx-dname { font-weight: 600; }
.wx-dtext { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wx-hi { font-weight: 700; text-align: right; }
.wx-lo { text-align: right; }
.wx-alert { background: var(--red-soft); color: var(--ink); border-left: 4px solid var(--red); border-radius: 6px; padding: 8px 12px; margin-bottom: 10px; }
.wx-alert summary { color: var(--red); font-weight: 700; margin: 0; }
.wx-alert p { margin: 6px 0 0; }
ul.agenda { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
ul.agenda li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 7px 10px; border-left: 3px solid var(--cal, var(--blue)); background: var(--soft); border-radius: 4px; }
ul.agenda .when { font-size: 13px; font-weight: 600; color: var(--muted); min-width: 64px; }
ul.agenda .join { margin-left: auto; font-weight: 600; }
ul.agenda.soon li { padding: 5px 10px; font-size: 14px; }
.mini-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.mini-stats a { background: var(--soft); border-radius: 6px; padding: 8px 10px; color: var(--muted); font-size: 12px; }
.mini-stats a:hover { text-decoration: none; background: var(--blue-soft); }
.mini-stats span { display: block; font-size: 22px; font-weight: 700; color: var(--ink); }
.mini-stats a.hot span { color: var(--red); }
ul.plain.compact li { padding: 6px 0; }
@media (max-width: 900px) { .home-grid { grid-template-columns: 1fr; } }
[hidden] { display: none !important; }
.top nav { min-width: 0; overflow-x: auto; scrollbar-width: none; }
.search input { width: 220px; }
@media (max-width: 1150px) {
  .top { gap: 12px; }
  .me span { display: none; }
  .search input { width: 160px; }
  .top nav a { padding: 6px 8px; }
}

/* Jobs, photos, maps */
.st-survey { --st: #8b5cf6; } .st-quoted { --st: #0ea5e9; } .st-scheduled { --st: #f59e0b; } .st-in_progress { --st: #f97316; }
.st-done { --st: #16a34a; } .st-invoiced { --st: #64748b; } .st-lost { --st: #94a3b8; }
.badge[class*="st-"] { background: color-mix(in srgb, var(--st) 18%, transparent); color: var(--st); }
.stage-move label { display: flex; align-items: center; gap: 8px; }
.stage-move select { width: auto; margin: 0; }
.map { height: 280px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: var(--soft); }
.map.big { height: min(70vh, 640px); margin-bottom: 10px; }
.map.is-empty { height: 120px; }
.pin { width: 22px; height: 30px; background: var(--st, var(--blue)); clip-path: path("M11 0C4.9 0 0 4.9 0 11c0 8.3 11 19 11 19s11-10.7 11-19C22 4.9 17.1 0 11 0z"); cursor: pointer; }
.pin.main { --st: #e11d48; width: 26px; height: 36px; clip-path: path("M13 0C5.8 0 0 5.8 0 13c0 9.8 13 23 13 23s13-13.2 13-23C26 5.8 20.2 0 13 0z"); }
.photo-pin { display: block; width: 36px; height: 36px; border-radius: 50%; overflow: hidden; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.photo-pin img { width: 100%; height: 100%; object-fit: cover; display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--muted); }
.legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--st); margin-right: 6px; }
.loc-buttons { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-top: 10px; }
.form-grid.one { grid-template-columns: 1fr; }
.upload { margin-bottom: 14px; }
.upload.busy { opacity: .6; pointer-events: none; }
.upload-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.upload-buttons .button { cursor: pointer; }
.upload-extra { margin-top: 10px; }
.upload-extra input[name=caption] { margin-top: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips label { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; font-weight: 500; color: var(--ink); font-size: 13px; cursor: pointer; }
.chips label:has(input:checked) { background: var(--blue-soft); border-color: var(--blue); color: var(--blue); }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.gallery a { position: relative; display: block; border-radius: 6px; overflow: hidden; background: var(--soft); aspect-ratio: 4 / 3; }
.gallery img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery .tagline { position: absolute; left: 0; right: 0; bottom: 0; padding: 3px 6px; font-size: 11px; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.7)); }
.gallery .nopin { position: absolute; top: 4px; right: 6px; color: #fff; text-shadow: 0 0 3px #000; font-size: 13px; }
.photo-big { display: block; background: #000; border-radius: 8px; overflow: hidden; }
.photo-big img { display: block; width: 100%; max-height: 78vh; object-fit: contain; }
@media (max-width: 640px) {
  .gallery { grid-template-columns: repeat(3, 1fr); gap: 4px; }
  .upload-buttons .button { flex: 1; padding: 14px; font-size: 16px; }
}
.combo { position: relative; margin-top: 4px; }
.combo input { margin: 0; font-weight: 400; color: var(--ink); }
.combo-list { max-height: 280px; overflow-y: auto; }
main.page.wide { max-width: none; }
.map-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
.map-panel { position: sticky; top: 72px; max-height: calc(100vh - 92px); overflow-y: auto; margin: 0; display: grid; gap: 14px; }
.map-panel h1 { font-size: 20px; }
.map-panel fieldset.checks { border: 0; padding: 0; margin: 0; display: grid; gap: 4px; }
.map-panel legend { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 4px; padding: 0; }
.map-panel .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--st); }
.map.full { height: calc(100vh - 110px); min-height: 420px; }
.add-site { border-top: 1px solid var(--line); padding-top: 12px; }
.add-site h2 { margin: 0; }
.map-pop { display: grid; gap: 6px; min-width: 200px; color: #1b2430; }
.map-pop strong a { color: #1e66ba; }
.map-pop .sub { font-size: 12px; color: #5b6775; }
.map-pop .thumbs { display: grid; grid-template-columns: repeat(3, 60px); gap: 3px; }
.map-pop .thumbs img { width: 60px; height: 45px; object-fit: cover; border-radius: 3px; display: block; }
.map-pop ul { margin: 0; padding-left: 16px; font-size: 13px; }
.pin.site { --st: #1e66ba; }
.pin.ghost { --st: #e11d48; opacity: .85; }
.maplibregl-canvas-container.adding canvas { cursor: crosshair; }
@media (max-width: 900px) {
  .map-layout { grid-template-columns: 1fr; }
  .map-panel { position: static; max-height: none; }
  .map.full { height: 70vh; }
}

/* Site survey */
.survey-nav { position: sticky; top: 56px; z-index: 4; background: var(--bg); padding: 8px 0; margin: 0 0 8px; }
.survey .card { scroll-margin-top: 120px; }
.survey-sec h2 { font-size: 18px; }
.sq { padding: 12px 0; border-bottom: 1px solid var(--line); display: grid; gap: 8px; }
.sq:last-child { border-bottom: 0; }
.sq[hidden] { display: none; }
.sq-label { font-weight: 600; }
.yn { display: flex; gap: 8px; }
.yn label { flex: 0 0 auto; }
.yn input { position: absolute; opacity: 0; pointer-events: none; }
.yn span { display: inline-block; min-width: 84px; text-align: center; padding: 10px 18px; border: 1px solid var(--line); border-radius: 8px; font-weight: 600; cursor: pointer; background: var(--card); }
.yn input:checked + span { background: var(--blue); border-color: var(--blue); color: var(--blue-ink); }
.yn input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }
input.short { max-width: 140px; }
.areas { display: grid; gap: 10px; }
.area { display: grid; grid-template-columns: 1.4fr 110px 2fr auto; gap: 8px 12px; align-items: end; padding: 10px; background: var(--soft); border-radius: 8px; }
.area-name { font-weight: 600; align-self: center; }
.area .slot { grid-column: 1 / -1; }
.slot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.slot-thumbs { display: flex; flex-wrap: wrap; gap: 4px; }
.slot-thumbs img { width: 64px; height: 48px; object-fit: cover; border-radius: 4px; display: block; }
.small-btn { padding: 6px 10px; font-size: 13px; cursor: pointer; }
.photo-slots { display: grid; gap: 12px; }
.pslot { padding: 10px; background: var(--soft); border-radius: 8px; display: grid; gap: 8px; }
.pslot-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.tick-mark { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 4px; border: 2px solid var(--muted); color: transparent; font-size: 13px; font-weight: 700; }
.tick-mark.on { background: var(--green); border-color: var(--green); color: #fff; }
.sketch canvas { width: 100%; aspect-ratio: 3 / 2; background: #fff; border: 1px solid var(--line); border-radius: 8px; touch-action: none; display: block; }
.sketch .actions { margin: 8px 0; }
.survey-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0 40px; }
@media (max-width: 640px) {
  .area { grid-template-columns: 1fr 1fr; }
  .area-name, .area-notes { grid-column: 1 / -1; }
  .yn span { min-width: 0; flex: 1; }
  .yn label { flex: 1; display: flex; }
  .yn label span { width: 100%; }
}

/* Survey report (also what prints) */
.report { background: #fff; color: #111827; border-radius: 10px; padding: 28px 32px; max-width: 900px; margin: 0 auto; }
.report h2 { font-size: 17px; margin: 22px 0 8px; padding-bottom: 4px; border-bottom: 2px solid #1e66ba; color: #1e66ba; }
.report h3 { font-size: 14px; margin: 14px 0 6px; color: #111827; }
.report-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #dfe4ea; padding-bottom: 12px; }
.report-head > div { display: flex; gap: 10px; align-items: center; }
.report-head strong { display: block; font-size: 16px; }
.report-head span { color: #5b6775; font-size: 14px; }
.report-info { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 24px; margin: 14px 0; }
.report-info dt { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #5b6775; }
.report-info dd { margin: 0; font-weight: 600; }
.report-summary { background: #eef4fb; border-radius: 8px; padding: 4px 18px 12px; }
.report-summary h2 { border: 0; margin-top: 12px; }
.report-summary li { margin: 3px 0; }
table.qa { width: 100%; border-collapse: collapse; font-size: 14px; }
table.qa th, table.qa td { text-align: left; padding: 6px 8px; border-bottom: 1px solid #e5e7eb; vertical-align: top; }
table.qa th { font-weight: 500; color: #374151; width: 60%; }
table.qa .num { text-align: right; width: 80px; }
.areas-table thead th { font-size: 12px; text-transform: uppercase; color: #5b6775; width: auto; }
.areas-table .total td { font-weight: 700; border-top: 2px solid #111827; }
.yn-yes { color: #15803d; font-weight: 700; } .yn-no { color: #b91c1c; font-weight: 700; }
.report-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0; }
.report-photos figure { margin: 0; }
.report-photos img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 4px; display: block; }
.report-photos figcaption { font-size: 11px; color: #5b6775; margin-top: 2px; }
.sketch-print { margin: 8px 0; } .sketch-print img { width: 100%; border: 1px solid #e5e7eb; border-radius: 6px; }
.report-foot { margin-top: 20px; border-top: 1px solid #dfe4ea; padding-top: 8px; color: #5b6775; }
@media (max-width: 640px) { .report { padding: 18px; } .report-info { grid-template-columns: 1fr; } .report-photos { grid-template-columns: 1fr 1fr; } }
@media print {
  body { background: #fff; }
  .top, .no-print, .notice { display: none !important; }
  main.page { padding: 0; max-width: none; }
  .report { padding: 0; border-radius: 0; }
  .report-sec, .report-photos figure { break-inside: avoid; }
}
.survey-nav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.survey-nav a { flex: 0 0 auto; }
@media (max-width: 640px) { .survey-nav { position: static; } }

/* Tasks, Todoist style */
.tasks-app { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 28px; align-items: start; }
.tside { position: sticky; top: 72px; display: grid; gap: 4px; max-height: calc(100vh - 90px); overflow-y: auto; padding-right: 4px; }
.tside h3 { font-size: 13px; color: var(--muted); margin: 14px 8px 4px; }
.tside-add { justify-content: flex-start; background: none; border: 0; color: var(--blue); font-size: 15px; padding: 8px; }
.tside-add:hover { background: var(--soft); }
.tside-search input { padding: 7px 10px; margin: 2px 0 6px; }
.tside-nav { display: grid; gap: 1px; }
.tside-nav a { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 6px; color: var(--ink); font-size: 15px; }
.tside-nav a:hover { background: var(--soft); text-decoration: none; }
.tside-nav a.on { background: var(--blue-soft); color: var(--blue); font-weight: 600; }
.tside-nav a span:last-child { margin-left: auto; color: var(--muted); font-size: 13px; font-weight: 400; }
.tside-nav a span.hot { color: var(--red); }
.tside-nav .lbl { color: var(--muted); }
.tside select { margin: 0 8px; width: calc(100% - 16px); }
.tmain { min-width: 0; }
.thead { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.thead h1 { font-size: 30px; }
.display-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.display-toggle a { padding: 6px 12px; color: var(--muted); font-size: 14px; }
.display-toggle a.on { background: var(--blue-soft); color: var(--blue); font-weight: 600; }
.display-toggle a:hover { text-decoration: none; }
.top-add { max-width: 720px; }
.tboard { display: flex; gap: 20px; overflow-x: auto; align-items: flex-start; padding-bottom: 12px; }
.tboard .tcol { flex: 0 0 300px; }
.tlist { display: grid; gap: 8px; max-width: 820px; }
.tcol { border-radius: 10px; padding: 4px; }
.tcol.drop-here { background: var(--blue-soft); outline: 2px dashed var(--blue); }
.tcol-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 4px 4px 10px; }
.tcol-head h2 { font-size: 15px; margin: 0; }
.tcol-head h2 span { color: var(--muted); font-weight: 400; margin-left: 4px; }
.tcol-head h2.late { color: var(--ink); }

.tcol-cards { display: grid; gap: 10px; min-height: 8px; }
.tlist .tcol-cards { gap: 0; }
.tcard { display: flex; gap: 10px; align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.tlist .tcard { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; box-shadow: none; padding: 10px 4px; }
.tcard:hover { border-color: color-mix(in srgb, var(--blue) 40%, var(--line)); }
.tcard.dragging { opacity: .4; }
.tcard[draggable=true] { cursor: grab; }
.tcard .tick-btn { margin-top: 2px; }
.tcard .p4 .tick-btn, .tcard.p4 .tick-btn { background: transparent; }
.tcard-body { display: grid; gap: 3px; min-width: 0; color: var(--ink); flex: 1; }
.tcard-body:hover { text-decoration: none; }
.tcard-title { font-size: 15px; line-height: 1.35; overflow-wrap: anywhere; }
.tcard-notes { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tcard-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 3px; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); }
.chip svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.4; }
.chip.when.late { color: #e5534b; }
.chip.when.now { color: #3fb950; }
.chip.when.soon { color: #d29922; }
.chip.when.week { color: #a371f7; }
.tcard.is-done .tcard-title { text-decoration: line-through; color: var(--muted); }
.col-add summary { color: var(--muted); font-weight: 500; padding: 8px 6px; list-style: none; margin: 0; }
.col-add summary::-webkit-details-marker { display: none; }
.col-add summary:hover { color: var(--blue); }
.col-add[open] summary { display: none; }
.col-add form { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-top: 4px; }
.col-add input, .col-add textarea { border: 0; padding: 4px 2px; background: transparent; }
.col-add input[name=text] { font-weight: 600; }
@media (max-width: 900px) {
  .tasks-app { grid-template-columns: 1fr; }
  .tside { position: static; max-height: none; grid-template-columns: 1fr; }
  .tside h3, .tside-nav:not(:first-of-type), .tside form:last-child { display: none; }
  .tside-nav { grid-auto-flow: column; overflow-x: auto; }
  .tboard { flex-direction: column; }
  .tboard .tcol { flex-basis: auto; width: 100%; }
}
.tboard .tcol { flex-basis: 340px; }
.reschedule { position: relative; }
.reschedule summary { color: var(--blue); font-weight: 600; font-size: 14px; list-style: none; cursor: pointer; margin: 0; }
.reschedule summary::-webkit-details-marker { display: none; }
.resched-pop { position: absolute; right: 0; top: 26px; z-index: 6; width: 230px; display: grid; gap: 8px; padding: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.resched-quick { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.resched-pick { display: flex; gap: 6px; }
.resched-pick input { padding: 5px 8px; }

/* Quick add, Todoist style */
.qa { display: grid; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 8px 0 12px; }
.qa:focus-within { border-color: color-mix(in srgb, var(--blue) 60%, var(--line)); }
.qa-field { position: relative; }
.qa-field input, .qa-mirror { font: 600 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; padding: 4px 2px; border: 0; letter-spacing: normal; }
.qa-field input { position: relative; z-index: 1; width: 100%; background: transparent; color: var(--ink); margin: 0; }
.qa-field input:focus { outline: none; }
.qa-mirror { position: absolute; inset: 0; white-space: pre; overflow: hidden; color: transparent; pointer-events: none; }
.qa-mirror mark { color: transparent; border-radius: 3px; padding: 0; }
.qa-mirror .hl-date { background: color-mix(in srgb, #3fb950 32%, transparent); }
.qa-mirror .hl-repeat { background: color-mix(in srgb, #3fb950 32%, transparent); }
.qa-mirror .hl-priority { background: color-mix(in srgb, #e5534b 32%, transparent); }
.qa-mirror .hl-label { background: color-mix(in srgb, #a371f7 32%, transparent); }
.qa-notes { border: 0; padding: 2px; font-size: 13px; background: transparent; }
.qa-notes:focus { outline: none; }
.qa-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 8px; }
.qa-chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 26px; align-items: center; }
.qa-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; padding: 2px 8px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); }
.qa-chip button { border: 0; background: none; padding: 0 0 0 2px; color: inherit; font-size: 15px; line-height: 1; }
.qa-chip.when.now, .qa-chip.repeat { color: #3fb950; border-color: color-mix(in srgb, #3fb950 50%, var(--line)); }
.qa-chip.when.soon { color: #d29922; border-color: color-mix(in srgb, #d29922 50%, var(--line)); }
.qa-chip.when.week { color: #a371f7; border-color: color-mix(in srgb, #a371f7 50%, var(--line)); }
.qa-chip.when.late, .qa-chip.prio.f1 { color: #e5534b; border-color: color-mix(in srgb, #e5534b 50%, var(--line)); }
.qa-chip.prio.f2 { color: #d29922; } .qa-chip.prio.f3 { color: var(--blue); }
.qa-chip.label { color: #a371f7; }
.qa-chip.link { color: var(--blue); }
.qa-tools { display: flex; gap: 6px; align-items: center; margin-left: auto; }
.qa-tool, .qa-menu summary { padding: 4px 9px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; color: var(--muted); background: var(--card); cursor: pointer; list-style: none; margin: 0; font-weight: 600; }
.qa-menu summary::-webkit-details-marker { display: none; }
.qa-menu { position: relative; }
.qa-pop { position: absolute; right: 0; bottom: 34px; z-index: 20; display: grid; gap: 2px; min-width: 190px; padding: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.qa-pop button { justify-content: flex-start; border: 0; background: none; font-weight: 500; padding: 7px 8px; }
.qa-pop button:hover { background: var(--soft); }
.qa-pop input { margin-top: 4px; padding: 5px 8px; }
.flag { font-style: normal; } .flag.f1 { color: #e5534b; } .flag.f2 { color: #d29922; } .flag.f3 { color: var(--blue); } .flag.f4 { color: var(--muted); }
.qa-suggest { position: absolute; left: 0; top: 100%; z-index: 20; list-style: none; margin: 4px 0 0; padding: 4px; min-width: 260px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.qa-suggest li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 8px; border-radius: 5px; cursor: pointer; font-size: 14px; }
.qa-suggest li span { color: var(--muted); font-size: 12px; }
.qa-suggest li.on, .qa-suggest li:hover { background: var(--blue-soft); }
.qa.compact .qa-tools .qa-menu summary span { display: none; }
.qa-dialog { width: min(640px, calc(100vw - 32px)); border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--card); color: var(--ink); margin-top: 12vh; }
.qa-dialog::backdrop { background: rgba(0,0,0,.45); }
.qa-dialog .qa { margin: 8px 0 0; border: 0; padding: 0; }
.qa-dialog-head { display: flex; justify-content: space-between; align-items: baseline; }
.col-add .qa { margin-top: 4px; }
.top-add .qa { max-width: 760px; }
.tcard { position: relative; }
.tmenu { position: absolute; top: 6px; right: 6px; }
.tmenu summary { list-style: none; cursor: pointer; padding: 0 6px; border-radius: 5px; color: var(--muted); font-size: 18px; line-height: 22px; opacity: 0; margin: 0; }
.tmenu summary::-webkit-details-marker { display: none; }
.tcard:hover .tmenu summary, .tmenu[open] summary, .tmenu summary:focus-visible { opacity: 1; }
@media (hover: none) { .tmenu summary { opacity: .7; } }
.tmenu summary:hover { background: var(--soft); }
.tmenu-pop { position: absolute; right: 0; top: 26px; z-index: 15; width: 220px; display: grid; gap: 4px; padding: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.3); }
.tmenu-label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-top: 2px; }
.tmenu-row { display: flex; gap: 4px; }
.tmenu-row button { flex: 1; padding: 6px 0; border: 1px solid var(--line); background: var(--card); }
.tmenu-row button.on { border-color: var(--blue); background: var(--blue-soft); }
.tmenu-pop > a, .tmenu-pop > button { display: block; text-align: left; padding: 7px 6px; border-radius: 6px; border: 0; background: none; color: var(--ink); font-weight: 500; font-size: 14px; }
.tmenu-pop > a:hover, .tmenu-pop > button:hover { background: var(--soft); text-decoration: none; }
.tmenu-pop > button.danger { color: var(--red); }
.tcard-body { padding-right: 18px; }
.chip.subs { color: var(--muted); }
.sub-list { margin-bottom: 10px; }
.filter-help summary { font-size: 13px; color: var(--muted); padding: 6px 10px; margin: 0; }
.filter-help ul { padding-left: 26px; margin: 4px 0; display: grid; gap: 3px; }
.filter-help p { margin: 4px 10px; }
.filter-help code, .save-filter code { font-size: 12px; background: var(--soft); padding: 1px 4px; border-radius: 4px; }
.save-filter { margin: 8px 0; align-items: center; display: flex; gap: 8px; }
.prod { margin: 14px 4px 0; padding: 10px; border: 1px solid var(--line); border-radius: 10px; display: grid; gap: 6px; }
.prod h3 { margin: 0; }
.prod-today { font-size: 14px; }
.prod .bar { height: 6px; border-radius: 3px; background: var(--soft); margin-top: 4px; overflow: hidden; }
.prod .bar i { display: block; height: 100%; background: #3fb950; }
.bar .w0 { width: 0 } .bar .w1 { width: 10% } .bar .w2 { width: 20% } .bar .w3 { width: 30% } .bar .w4 { width: 40% } .bar .w5 { width: 50% }
.bar .w6 { width: 60% } .bar .w7 { width: 70% } .bar .w8 { width: 80% } .bar .w9 { width: 90% } .bar .w10 { width: 100% }
.prod-week { display: flex; gap: 4px; }
.prod-week span { flex: 1; text-align: center; font-size: 11px; padding: 3px 0; border-radius: 4px; background: var(--soft); color: var(--muted); }
.prod-week span.some { background: color-mix(in srgb, #3fb950 25%, var(--soft)); color: var(--ink); }
.prod-week span.hit { background: #3fb950; color: #fff; }
.prod-week span.today { outline: 1px solid var(--blue); }
.prod details summary { margin: 0; font-size: 12px; }
.prod .inline-form { margin: 6px 0 0; }
.prod .inline-form input { flex: 1 1 60px; padding: 4px 6px; }
.zero { text-align: center; padding: 40px 16px; }
.zero-art { font-size: 56px; }
.zero h2 { font-size: 20px; margin: 10px 0 4px; }

/* Tickets, Zoho Desk style */
main.page.wide.desk { padding: 12px 12px 0; }
.desk-app { display: grid; grid-template-columns: 320px 300px minmax(0, 1fr); gap: 0; height: calc(100vh - 70px); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--card); }
.desk-app:not(.has-ticket) { grid-template-columns: 320px minmax(0, 1fr); }
.dlist { display: flex; flex-direction: column; border-right: 1px solid var(--line); min-height: 0; background: var(--bg); }
.dlist-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); gap: 8px; }
.view-pick { position: relative; }
.view-pick summary { list-style: none; cursor: pointer; font-size: 16px; margin: 0; }
.view-pick summary::-webkit-details-marker { display: none; }
.view-pop { position: absolute; left: 0; top: 30px; z-index: 20; width: 240px; display: grid; padding: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.3); }
.view-pop a { display: flex; justify-content: space-between; padding: 8px 10px; border-radius: 6px; color: var(--ink); }
.view-pop a:hover { background: var(--soft); text-decoration: none; }
.view-pop a.on { background: var(--blue-soft); color: var(--blue); font-weight: 600; }
.view-pop a span { color: var(--muted); }
.dlist-search { padding: 8px 12px; border-bottom: 1px solid var(--line); }
.dlist-search input { padding: 7px 10px; }
.dlist-items { overflow-y: auto; padding: 8px; display: grid; gap: 8px; align-content: start; flex: 1; }
.dcard { display: grid; gap: 4px; padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-left: 3px solid transparent; border-radius: 8px; color: var(--ink); }
.dcard:hover { text-decoration: none; border-color: color-mix(in srgb, var(--blue) 40%, var(--line)); }
.dcard.on { border-left-color: var(--blue); background: var(--blue-soft); }
.dcard.unread .dcard-subject { font-weight: 700; }
.dcard-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.dcard-subject { font-size: 15px; line-height: 1.3; overflow-wrap: anywhere; }
.dcard-meta { font-size: 13px; color: var(--muted); }
.dcard-foot { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.dcard-foot .small { margin-left: auto; }
.avatar { flex: 0 0 auto; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--blue-soft); color: var(--blue); font-size: 12px; font-weight: 700; }
.avatar.big { width: 38px; height: 38px; font-size: 14px; }
.avatar.cust { background: var(--soft); color: var(--muted); }
.dempty { display: grid; place-items: center; text-align: center; padding: 30px; }
.dprops { overflow-y: auto; border-right: 1px solid var(--line); padding: 10px; display: grid; gap: 10px; align-content: start; background: var(--bg); }
.dprops .stack { gap: 10px; }
.pcard { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; display: grid; gap: 8px; }
.pcard h3 { margin: 0 0 2px; font-size: 15px; }
.pname { font-weight: 700; color: var(--ink); }
.pdl { margin: 0; display: grid; gap: 8px; }
.pdl dt { font-size: 12px; color: var(--muted); }
.pdl dd { margin: 0; font-size: 14px; }
.pactions { display: grid; gap: 6px; }
.dmain { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.dhead { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; padding: 16px 20px 8px; }
.dhead h1 { font-size: 22px; overflow-wrap: anywhere; }
.idpill { font-size: 13px; padding: 1px 8px; border: 1px solid var(--line); border-radius: 6px; }
.dtabs { display: flex; gap: 22px; padding: 0 20px; border-bottom: 1px solid var(--line); }
.dtabs button { border: 0; background: none; border-radius: 0; padding: 10px 0; font-size: 13px; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); border-bottom: 2px solid transparent; }
.dtabs button.on { color: var(--ink); border-bottom-color: var(--blue); }
.dtabs button span { margin-left: 4px; color: var(--muted); }
.dpanel { overflow-y: auto; flex: 1; padding: 12px 20px; display: grid; gap: 10px; align-content: start; }
.conv { display: flex; gap: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.conv.k-note { background: var(--note); border-color: var(--note-line); }
.conv.k-reply { border-left: 3px solid var(--blue); }
.conv-body { min-width: 0; flex: 1; }
.conv-body header { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; margin-bottom: 6px; }
.conv-body .body { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
.composer { display: grid; gap: 8px; padding: 12px 14px; border: 1px solid var(--blue); border-radius: 8px; background: var(--card); }
.composer-to { display: flex; gap: 18px; flex-wrap: wrap; }
.composer-to label { display: flex; gap: 6px; align-items: center; color: var(--ink); font-weight: 500; }
.dfoot { display: flex; justify-content: flex-end; padding: 10px 20px; border-top: 1px solid var(--line); }
.close-btn { border-color: var(--blue); color: var(--blue); }
@media (max-width: 1100px) {
  .desk-app.has-ticket { grid-template-columns: 280px minmax(0, 1fr); }
  .desk-app.has-ticket .dprops { grid-column: 2; grid-row: 2; border-top: 1px solid var(--line); }
  .desk-app.has-ticket .dmain { grid-column: 2; grid-row: 1; }
  .desk-app.has-ticket { height: auto; }
  .desk-app.has-ticket .dlist { grid-row: 1 / span 2; max-height: calc(100vh - 80px); }
}
@media (max-width: 760px) {
  .desk-app, .desk-app.has-ticket { grid-template-columns: 1fr; height: auto; }
  .desk-app.has-ticket .dlist { display: none; }
  .desk-app.has-ticket .dprops, .desk-app.has-ticket .dmain { grid-column: 1; grid-row: auto; }
  .desk-app.has-ticket .dmain { order: -1; }
  .dlist { max-height: none; }
}
.jlink { display: grid; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.jlink-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.jlink-head form { margin-left: auto; }
.drive-frame { width: 100%; height: 420px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
ul.files li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
ul.files li form { margin-left: auto; }
.files-add { display: grid; gap: 10px; margin-top: 12px; }
.files-add .button { cursor: pointer; }
.link-form { margin: 0; }
form.busy { opacity: .6; pointer-events: none; }

/* Line icons */
.i { width: 1.05em; height: 1.05em; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.16em; }
.i.lg { width: 1.3em; height: 1.3em; }
.i.xl { width: 44px; height: 44px; stroke-width: 1.4; color: var(--muted); }
button .i, .button .i { margin-right: 2px; }
.flag.f1 .i, .i.f1 { color: #e5534b; } .flag.f2 .i, .i.f2 { color: #d29922; } .flag.f3 .i, .i.f3 { color: var(--blue); } .flag.f4 .i, .i.f4 { color: var(--muted); }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.i.f-green { color: #3fb950; } .i.f-amber { color: #d29922; } .i.f-blue { color: var(--blue); } .i.f-purple { color: #a371f7; }
.chip .i { width: 13px; height: 13px; }
.tside-nav .i { color: var(--muted); }
.tside-nav a.on .i { color: var(--blue); }
.qa-chip .i { width: 13px; height: 13px; }
.dcard-meta .i, .dcard-foot .i { width: 13px; height: 13px; }
.combo-list li.add-new { color: var(--blue); font-weight: 600; border-top: 1px solid var(--line); }
.addr-form { display: flex; gap: 6px; margin-top: 10px; position: relative; }
.addr-form input { flex: 1; }
.job-address { margin: 8px 0 0; font-size: 14px; }
.new-contact summary { color: var(--blue); font-weight: 600; font-size: 14px; }
.form-grid.inner { grid-template-columns: 1fr; gap: 10px; margin-top: 8px; }
.drop-row { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: stretch; }
.dropzone { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 2px dashed var(--line); border-radius: 10px; color: var(--ink); font-weight: 500; cursor: pointer; background: var(--soft); }
.dropzone:hover, .dropzone:focus-visible, .dropzone.over { border-color: var(--blue); background: var(--blue-soft); outline: none; }
.dropzone .i.lg { color: var(--blue); width: 26px; height: 26px; }
.dropzone.busy { opacity: .7; pointer-events: none; }
@media (max-width: 640px) { .drop-row { grid-template-columns: 1fr; } }
fieldset.kinds { border: 0; padding: 0; margin: 0; }
fieldset.kinds legend { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; padding: 0; }
