/* Design tokens. Text and background pairs below meet at least 4.5:1 contrast. */
:root {
  --bg: #f8fafc; --surface: #ffffff; --hover: #f8fafc; --soft: #f1f5f9;
  --line: #e2e8f0; --line-strong: #cbd5e1;
  --text: #0f172a; --text-2: #334155; --muted: #475569; --faint: #64748b;
  --side: #ffffff; --side-2: #f1f5f9; --side-line: #e2e8f0; --side-text: #475569; --side-faint: #475569;
  --accent: #2563eb; --accent-strong: #1d4ed8; --on-accent: #ffffff; --accent-soft: #eff6ff;
  --ok: #166534; --ok-bg: #f0fdf4;
  --warn: #92400e; --warn-bg: #fffbeb;
  --bad: #b91c1c; --bad-bg: #fef2f2;
  --mute: #334155; --mute-bg: #f1f5f9;
  --scrim: rgba(15, 23, 42, .5);
  --radius: 12px; --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04);
  --control: 38px;
  --sidebar: 240px;
  --font: "IBM Plex Sans", "IBM Plex Sans JP", system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Yu Gothic UI", Meiryo, "Noto Sans JP", sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; padding: 0; }
ul, ol { list-style: none; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button, select, summary, a { touch-action: manipulation; }
summary { list-style: none; }
summary::-webkit-details-marker { display: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
main:focus { outline: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ico { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* App frame */
.side { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); background: var(--side); color: var(--side-text); border-right: 1px solid var(--side-line); display: flex; flex-direction: column; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; padding: 20px 24px; border-bottom: 1px solid var(--side-line); text-decoration: none; color: var(--text); min-width: 0; }
.logo { width: 36px; height: 36px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.logo .ico { width: 22px; height: 22px; stroke-width: 2; }
.brand b { display: block; font-size: 17px; font-weight: 600; line-height: 1.25; color: var(--text); }
.brand small { display: block; color: var(--side-faint); font-size: 12px; line-height: 1.3; overflow-wrap: anywhere; }
.nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.nav a { display: flex; align-items: center; gap: 12px; min-height: 38px; padding: 8px 12px; margin-bottom: 2px; border-radius: 8px; text-decoration: none; color: var(--side-text); transition: background-color .15s ease, color .15s ease; }
.nav a:hover { background: var(--side-2); color: var(--text); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-strong); font-weight: 500; }

.menu { position: relative; }
.user-menu { border-top: 1px solid var(--side-line); padding: 12px; }
.user-menu summary { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; cursor: pointer; min-height: 44px; }
.user-menu summary:hover { background: var(--side-2); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--soft); color: var(--text-2); font-size: 12px; font-weight: 600; display: grid; place-items: center; flex: none; }
.user-text { min-width: 0; flex: 1; line-height: 1.25; }
.user-text b { display: block; color: var(--text); font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-text small { display: block; color: var(--side-faint); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-tab { display: none; }
.menu-panel { position: absolute; left: 12px; right: 12px; bottom: calc(100% - 4px); background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px; box-shadow: 0 10px 28px rgba(15, 23, 42, .22); z-index: 30; }
.menu-panel button { display: block; width: 100%; text-align: left; min-height: 38px; padding: 0 10px; border: 0; border-radius: 6px; background: none; cursor: pointer; }
.menu-panel button:hover { background: var(--soft); }

.content { margin-left: var(--sidebar); min-height: 100dvh; display: flex; flex-direction: column; min-width: 0; }
.top { position: sticky; top: 0; z-index: 10; height: 56px; background: var(--surface); border-bottom: 1px solid var(--line); padding: 0 24px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.top-left { display: flex; align-items: center; gap: 4px; min-width: 0; }
.top h1 { font-size: 16px; font-weight: 600; line-height: 1.3; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-right { display: flex; align-items: center; gap: 12px; flex: none; }
.back { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; color: var(--muted); margin-left: -8px; }
.back:hover { background: var(--soft); color: var(--text); }
main { flex: 1; width: 100%; max-width: 1280px; padding: 24px; }

.lang-switch { display: inline-flex; gap: 4px; align-items: center; }
.lang-switch button { min-height: 28px; padding: 4px 10px; border: 0; border-radius: 6px; background: none; color: var(--faint); font-size: 12px; font-weight: 500; cursor: pointer; transition: background-color .15s ease, color .15s ease; }
.lang-switch button:hover { background: var(--soft); color: var(--text); }
.lang-switch button[aria-pressed="true"] { background: var(--accent); color: #fff; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--control); padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface); color: var(--text-2); font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background-color .15s ease, border-color .15s ease; }
.btn:hover { background: var(--soft); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.danger { border-color: #fecaca; color: var(--bad); }
.btn.danger:hover { background: var(--bad-bg); }
.btn.danger-solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn .label-short { display: none; }
.link { background: none; border: 0; padding: 0; min-height: 32px; color: var(--accent-strong); font-size: 13px; font-weight: 500; cursor: pointer; text-align: left; }
.link:hover { text-decoration: underline; }

/* Cards */
.card { background: var(--surface); border: 1px solid rgba(226, 232, 240, .8); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card + .card { margin-top: 16px; }
.card h2, .card-title { font-size: 15px; font-weight: 600; line-height: 1.5; color: var(--text); }
.card-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }

/* Chips */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; line-height: 1.5; white-space: nowrap; }
.pill .ico { width: 13px; height: 13px; stroke-width: 2; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.mute { background: var(--mute-bg); color: var(--mute); }
.pill.new { background: var(--accent-soft); color: var(--accent-strong); }

/* Stat tiles */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat { text-align: left; background: var(--surface); border: 1px solid rgba(226, 232, 240, .8); border-radius: var(--radius-sm); padding: 12px 14px; cursor: pointer; font: inherit; color: inherit; transition: border-color .15s ease; }
.stat:hover { border-color: var(--line-strong); }
.stat .l { display: block; color: var(--faint); font-size: 13px; }
.stat .n { display: block; font-size: 30px; line-height: 1.25; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat .v { display: block; color: var(--faint); font-size: 12px; }
.stat.alert .n { color: var(--bad); }

.chev { color: var(--faint); display: inline-flex; transition: transform .15s ease; }
details[open] > summary .chev { transform: rotate(90deg); }
.bar { display: block; height: 6px; border-radius: 3px; background: var(--soft); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }

/* List items with a date tile */
.items { display: grid; gap: 8px; }
.item { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid rgba(226, 232, 240, .8); border-radius: var(--radius-sm); background: var(--surface); text-decoration: none; color: inherit; transition: border-color .15s ease, background-color .15s ease; }
a.item:hover { border-color: var(--line-strong); background: var(--hover); }
.date { width: 48px; height: 52px; border-radius: 8px; background: var(--soft); color: var(--text-2); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.15; text-align: center; }
.date b { font-size: 18px; font-weight: 600; }
.date span { font-size: 12px; font-weight: 600; }
.date.bad { background: var(--bad-bg); color: var(--bad); }
.date.warn { background: var(--warn-bg); color: var(--warn); }
.date.ok { background: var(--ok-bg); color: var(--ok); }
.item-title { font-weight: 600; overflow-wrap: anywhere; }
.item-title a { text-decoration: none; }
.item-title a:hover { text-decoration: underline; }
.item-sub { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.item-where { font-size: 13px; color: var(--text-2); margin-top: 2px; overflow-wrap: anywhere; }
.item-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; min-width: 92px; }
.prog { display: flex; align-items: center; gap: 8px; width: 110px; font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.prog .bar { flex: 1; }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty-icon { width: 44px; height: 44px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: inline-grid; place-items: center; margin-bottom: 10px; }
.empty-icon .ico { width: 20px; height: 20px; }
.empty b { display: block; color: var(--text); font-size: 15px; font-weight: 600; }

/* Filters */
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.filter { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px; border: 0; border-radius: 999px; background: var(--soft); color: var(--text-2); font-size: 13px; font-weight: 500; cursor: pointer; transition: background-color .15s ease; }
.filter:hover { background: #e2e8f0; }
.filter span { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.filter[aria-pressed="true"] { background: var(--text); color: #fff; }
.filter[aria-pressed="true"] span { color: #cbd5e1; }
.toolbar { display: grid; grid-template-columns: 1fr 200px; gap: 8px; margin-bottom: 12px; }
.search { position: relative; display: block; }
.search .ico { position: absolute; left: 12px; top: 50%; margin-top: -8px; color: var(--faint); pointer-events: none; }
.search input { padding-left: 36px !important; }
.toolbar input, .toolbar select, .user select { width: 100%; min-height: var(--control); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); padding: 0 12px; font-size: 14px; }
.count { color: var(--faint); font-size: 13px; margin-bottom: 8px; }
.page-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; }
.center { justify-content: center; }

/* Orders board */
.board-head .stats { margin-top: 14px; }
.board-head h2 { font-size: 18px; }
.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: start; margin-top: 16px; }
.board-tabs { display: none; }
.col { background: var(--soft); border-radius: var(--radius); padding: 10px; min-width: 0; }
.col.mine { background: var(--accent-soft); box-shadow: inset 0 0 0 1px #bfdbfe; }
.col-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-height: 32px; padding: 0 4px 6px; font-size: 14px; font-weight: 600; color: var(--text); }
.col-n { margin-left: auto; font-size: 13px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.col-body { display: grid; gap: 8px; }
.col-empty { padding: 18px 8px; text-align: center; font-size: 13px; color: var(--muted); }
.order-card { display: block; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--line-strong); border-radius: var(--radius-sm); color: inherit; text-decoration: none; transition: border-color .15s ease, box-shadow .15s ease; }
.order-card:hover { box-shadow: 0 2px 8px rgba(15, 23, 42, .08); }
.order-card.bad { border-left-color: var(--bad); }
.order-card.warn, .order-card.hold { border-left-color: #d97706; }
.oc-customer { display: block; font-size: 15px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.oc-job { display: block; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.oc-task { display: block; margin-top: 6px; font-size: 13px; color: var(--text-2); }
.oc-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.oc-tags .pill, .detail-tags .pill { white-space: normal; }
.stat.attention .n { color: var(--warn); }
.stat.word .n { font-size: 20px; line-height: 45px; overflow-wrap: anywhere; }

/* Order page */
.detail-tags { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.panel-warn { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; background: var(--warn-bg); border-color: #fde68a; }
.panel-warn h2 { color: var(--warn); }
.order-grid { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 16px; align-items: start; }
.order-grid > .card { margin-top: 0; }
.order-grid > .journey { grid-column: 1; grid-row: 1 / span 2; }
.order-grid > .job-card { grid-column: 2; grid-row: 1; }
.order-more { grid-column: 2; grid-row: 2; min-width: 0; }
.jr { margin-top: 14px; }
.jr-div { position: relative; display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; padding-bottom: 16px; }
.jr-div:last-child { padding-bottom: 0; }
.jr-div:not(:last-child)::before { content: ""; position: absolute; left: 11px; top: 28px; bottom: 2px; width: 2px; background: var(--line); }
.jr-div.done:not(:last-child)::before { background: #86efac; }
.jr-mark { display: grid; place-items: center; width: 24px; height: 24px; border: 1.5px solid var(--line-strong); border-radius: 50%; background: var(--surface); }
.jr-mark .ico { width: 13px; height: 13px; stroke-width: 3; }
.jr-div.done .jr-mark { background: var(--ok); border-color: var(--ok); color: #fff; }
.jr-div.now .jr-mark { border: 6px solid var(--accent); }
.jr-div b { display: block; font-weight: 600; line-height: 24px; }
.jr-div.done b { color: var(--ok); }
.jr-div.now b { color: var(--accent-strong); }
.jr-div small { display: block; font-size: 12px; color: var(--muted); }
.jr-steps { display: grid; gap: 6px; margin-top: 8px; }
.jr-steps li { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 6px; align-items: start; font-size: 13px; line-height: 1.4; color: var(--muted); }
.jr-steps li .ico { width: 13px; height: 13px; margin-top: 2px; stroke-width: 2.6; }
.jr-pip { width: 6px; height: 6px; margin: 6px 0 0 3px; border-radius: 50%; background: var(--line-strong); }
.jr-steps li.done { color: var(--ok); }
.jr-steps li.now { color: var(--accent-strong); font-weight: 600; }
.jr-steps li.now .jr-pip { background: var(--accent); }

.job-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; }
.job-label { font-size: 13px; font-weight: 600; color: var(--accent-strong); }
.job-card.waiting .job-label { color: var(--muted); }
.job-clock { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--muted); }
.job-clock.bad { color: var(--bad); font-weight: 600; }
.job-card h2 { font-size: 20px; line-height: 1.35; margin-top: 4px; }
.job-how { font-size: 15px; line-height: 1.6; color: var(--text-2); margin-top: 6px; text-wrap: pretty; word-break: auto-phrase; line-break: strict; }
.job-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.job-note { margin-top: 12px; }
.job-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.btn.job-go { min-height: 44px; padding: 0 20px; font-size: 14px; white-space: normal; }
.job-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--soft); font-size: 13px; color: var(--muted); }
.job-foot > span { flex: 1 1 200px; }
.job-card.done-state { background: var(--ok-bg); border-color: #bbf7d0; }
.job-card.done-state h2 { color: var(--ok); }
.job-card.cancel-state { background: var(--soft); }
.job-card.hold-state { background: var(--warn-bg); border-color: #fde68a; }
.job-card.hold-state h2 { color: var(--warn); }
.job-card.done-state .ico, .job-card.hold-state h2 .ico { width: 20px; height: 20px; }
.job-card .state-title { margin-top: 0; }
.radio { display: flex; align-items: center; gap: 8px; min-height: 36px; cursor: pointer; }
.radio input { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--accent); }

/* Target times */
.target-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 7px 0; border-bottom: 1px solid var(--soft); }
.target-row label { min-width: 0; overflow-wrap: anywhere; }
.target-input { display: inline-flex; align-items: center; gap: 8px; flex: none; font-size: 13px; color: var(--muted); }
.target-input input { width: 72px; min-height: var(--control); padding: 0 8px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font-size: 14px; text-align: right; }
.target-input input[aria-invalid="true"] { border-color: var(--bad); }
.targets .form-err { margin-top: 12px; }

/* Order details */
.detail-line { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; color: var(--muted); }

.note-wait { display: flex; align-items: center; gap: 8px; margin-top: 10px; color: var(--muted); }
.undo-line { margin-top: 8px; }
.state-title { display: flex; align-items: center; gap: 8px; }

.meta { display: grid; gap: 10px; }
.meta div { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.meta dt { color: var(--faint); font-size: 13px; flex: none; }
.meta dd { font-weight: 500; text-align: right; overflow-wrap: anywhere; min-width: 0; }
.side-actions { display: grid; gap: 8px; }
.side-actions .divider { border-top: 1px solid var(--line); margin: 4px 0; }

.fold { padding: 0; }
.fold summary { display: flex; align-items: center; justify-content: space-between; min-height: 52px; padding: 8px 20px; font-size: 15px; font-weight: 600; cursor: pointer; }
.fold-body { padding: 0 20px 14px; }
.step-group { font-weight: 600; font-size: 13px; color: var(--muted); margin-top: 14px; }
.step-group:first-child { margin-top: 0; }
.step { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--soft); }
.step:last-child { border-bottom: 0; }
.tick { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line-strong); display: grid; place-items: center; font-size: 11px; color: var(--faint); font-weight: 600; }
.tick .ico { width: 12px; height: 12px; stroke-width: 3; }
.step.done .tick { background: var(--ok); border-color: var(--ok); color: #fff; }
.step.current .tick { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-soft); }
.step.todo .name { color: var(--muted); }
.step .info { font-size: 12px; color: var(--faint); }
.step .note { font-size: 13px; color: var(--text-2); margin-top: 2px; }

.log { display: grid; grid-template-columns: 10px minmax(0, 1fr); gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--soft); overflow-wrap: anywhere; }
.log:last-child { border-bottom: 0; }
.log .dot { width: 7px; height: 7px; margin-top: 7px; border-radius: 50%; background: var(--accent); }
.log .po { font-weight: 600; }
.log .po a { text-decoration: none; }
.log .po a:hover { text-decoration: underline; }
.log .chg { font-size: 13px; color: var(--muted); }
.log .when { font-size: 12px; color: var(--faint); margin-top: 1px; }

/* Users */
.user { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--soft); }
.user:last-child { border-bottom: 0; }
.user .avatar { width: 36px; height: 36px; background: var(--soft); color: var(--text-2); }
.user b { font-weight: 600; }
.user .email { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.user-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; align-items: center; }
.user select { width: auto; padding: 0 8px; }

/* Forms */
.field { display: block; }
.field > label { display: block; font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 4px; }
.req { color: var(--faint); font-weight: 400; font-size: 12px; }
.field input, .field textarea { display: block; width: 100%; min-height: var(--control); padding: 7px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font-size: 14px; }
.field input:focus, .field textarea:focus { border-color: var(--accent); outline: 2px solid rgba(37, 99, 235, .25); outline-offset: 0; }
.field input[aria-invalid="true"], .field textarea[aria-invalid="true"] { border-color: var(--bad); }
.help { font-size: 12px; color: var(--faint); margin-top: 3px; }
.field-err { font-size: 12px; color: var(--bad); margin-top: 3px; }
.form-err { color: var(--bad); font-size: 13px; font-weight: 500; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 76px; }
.pw-wrap button { position: absolute; right: 2px; top: 2px; bottom: 2px; padding: 0 10px; border: 0; background: none; color: var(--accent-strong); font-size: 13px; font-weight: 500; cursor: pointer; border-radius: 6px; }

.auth { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr; padding: 16px 16px 24px; }
.auth-top { display: flex; justify-content: flex-end; }
.auth-center { display: grid; place-items: center; padding: 16px 0; }
.auth-card { width: min(400px, 100%); padding: 28px; }
.auth-brand { display: flex; align-items: center; gap: 10px; }
.auth-brand b { display: block; font-size: 17px; font-weight: 600; line-height: 1.25; }
.auth-brand small { display: block; color: var(--faint); font-size: 12px; }
.auth-card h1 { margin: 20px 0 12px; font-size: 20px; font-weight: 600; }
.auth-card form { display: grid; gap: 12px; }
.auth-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 16px; margin-top: 10px; }
.notice { background: var(--accent-soft); color: var(--text-2); font-size: 13px; padding: 10px 12px; border-radius: var(--radius-sm); margin-bottom: 12px; }
.auth-links + .notice { margin: 8px 0 0; }

/* Dialogs and toast */
dialog { border: 0; border-radius: var(--radius); padding: 0; width: min(520px, calc(100% - 24px)); max-height: calc(100dvh - 24px); background: var(--surface); color: var(--text); box-shadow: 0 16px 48px rgba(15, 23, 42, .3); }
dialog::backdrop { background: var(--scrim); }
.dlg { padding: 20px; display: grid; gap: 12px; }
.dlg h2 { font-size: 16px; font-weight: 600; }
.dlg fieldset { border: 0; border-top: 1px solid var(--line); margin: 4px 0 0; padding: 12px 0 0; display: grid; gap: 12px; min-width: 0; }
.dlg legend { font-weight: 600; font-size: 13px; padding: 0 8px 0 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dlg-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.secret { font: 600 20px/1.4 ui-monospace, Consolas, monospace; letter-spacing: .04em; background: var(--soft); padding: 10px 12px; border-radius: var(--radius-sm); text-align: center; user-select: all; }

.toast { position: fixed; left: calc(50% + var(--sidebar) / 2); bottom: 24px; transform: translate(-50%, 16px); display: flex; align-items: center; gap: 12px; max-width: min(520px, calc(100% - 24px)); background: var(--text); color: #fff; font-size: 13px; padding: 10px 16px; border-radius: var(--radius-sm); z-index: 50; opacity: 0; pointer-events: none; transition: opacity .15s ease, transform .15s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { background: none; border: 0; color: #93c5fd; font-weight: 600; min-height: 32px; padding: 0 4px; cursor: pointer; white-space: nowrap; }

/* Help: tooltips and guided tour */
.btn.help-btn { border-color: transparent; background: none; color: var(--muted); font-weight: 500; padding: 0 8px; }
.btn.help-btn:hover { background: var(--soft); color: var(--text); }
.help-on .tip-i { display: inline-grid; }
.tip-i { display: none; place-items: center; width: 26px; height: 26px; margin: -6px -4px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--faint); cursor: help; vertical-align: middle; }
.tip-i:hover { color: var(--accent-strong); }
.tip-i .ico { width: 15px; height: 15px; }
.filters .tip-i { margin: 3px 0 0; }
.tip-bubble { position: fixed; z-index: 60; max-width: 280px; background: var(--surface); color: var(--text-2); border: 1px solid var(--line); font-size: 13px; font-weight: 400; line-height: 1.5; padding: 8px 12px; border-radius: 8px; pointer-events: none; box-shadow: 0 6px 20px rgba(15, 23, 42, .12); text-wrap: pretty; }
.tour-block { position: fixed; inset: 0; z-index: 70; }
.tour-spot { position: fixed; z-index: 71; border-radius: 10px; box-shadow: 0 0 0 9999px rgba(15, 23, 42, .28), 0 0 0 2px var(--accent); pointer-events: none; }
.tour-pop { position: fixed; z-index: 72; width: min(400px, calc(100vw - 24px)); background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px 14px; box-shadow: 0 18px 44px rgba(15, 23, 42, .18); }
.tour-pop h2 { font-size: 17px; font-weight: 600; line-height: 1.35; color: var(--text); }
.tour-pop p { font-size: 15px; line-height: 1.65; color: var(--text-2); margin-top: 8px; text-wrap: pretty; word-break: auto-phrase; line-break: strict; }
.tour-foot { display: flex; align-items: center; gap: 6px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--soft); }
.tour-count { font-size: 13px; margin-right: auto; color: var(--faint); }
.tour-btn { min-height: 36px; padding: 0 12px; border-radius: 8px; border: 0; background: none; color: var(--muted); font-size: 14px; font-weight: 500; cursor: pointer; transition: background-color .15s ease, color .15s ease; }
.tour-btn:hover { background: var(--soft); color: var(--text); }
.tour-btn.main { background: var(--accent); color: #fff; padding: 0 18px; font-weight: 600; }
.tour-btn.main:hover { background: var(--accent-strong); color: #fff; }
.tour-arrow { position: absolute; width: 12px; height: 12px; background: var(--surface); border: 1px solid var(--line); transform: rotate(45deg); }
.tour-pop.below .tour-arrow { top: -7px; border-right: 0; border-bottom: 0; }
.tour-pop.above .tour-arrow { bottom: -7px; border-left: 0; border-top: 0; }
.tour-pop.none .tour-arrow { display: none; }

/* Narrower screens */
@media (max-width: 1180px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .order-grid { grid-template-columns: minmax(0, 1fr); }
  .order-grid > .job-card, .order-grid > .journey, .order-more { grid-column: 1; grid-row: auto; }
  .order-grid > .job-card { order: -1; }
}

/* Phones: sidebar becomes a bottom bar, and every control is at least 44px tall */
@media (max-width: 760px) {
  :root { --control: 44px; }
  body { font-size: 15px; }
  .field input, .field textarea, .toolbar input, .toolbar select { font-size: 16px; }
  .side { inset: auto 0 0 0; width: auto; flex-direction: row; padding-bottom: env(safe-area-inset-bottom, 0); border-right: 0; border-top: 1px solid var(--side-line); }
  .brand { display: none; }
  .nav { flex: 1; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 0; overflow: visible; }
  .nav a, .menu-tab { flex-direction: column; justify-content: center; gap: 2px; min-height: 58px; padding: 4px 2px; margin: 0; font-size: 12px; border-radius: 0; text-align: center; }
  .nav a .ico { width: 20px; height: 20px; }
  .user-menu { border-top: 0; padding: 0; flex: 0 0 20%; max-width: 76px; }
  .user-menu summary { padding: 0; border-radius: 0; height: 100%; justify-content: center; }
  .user-menu .avatar, .user-text, .user-menu .chev { display: none; }
  .menu-tab { display: flex; align-items: center; }
  .menu-tab .ico { width: 20px; height: 20px; }
  .menu-panel { left: auto; right: 8px; bottom: calc(100% + 6px); min-width: 220px; }
  .menu-panel button { min-height: 44px; }

  .content { margin-left: 0; }
  .top { padding: 0 12px; height: 60px; }
  .top h1 { font-size: 15px; line-height: 1.2; white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
  .top-right { gap: 6px; }
  .lang-switch { gap: 2px; }
  .lang-switch button { min-height: 44px; padding: 0 7px; font-size: 13px; }
  .btn.new-po { padding: 0; width: 44px; }
  .btn.new-po .label { display: none; }
  .btn.new-po .ico { width: 20px; height: 20px; }
  main { padding: 12px 12px 96px; }
  .toast { left: 50%; bottom: calc(70px + env(safe-area-inset-bottom, 0)); }
  .card { padding: 16px; }
  .card + .card { margin-top: 12px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 8px; }
  .toolbar { grid-template-columns: 1fr; }
  .filter { min-height: 44px; }
  .item { grid-template-columns: 48px minmax(0, 1fr); }
  .item-side { grid-column: 1 / -1; }
  .item-side { flex-direction: row; align-items: center; justify-content: space-between; min-width: 0; }
  .item-title a, .log .po a { display: inline-flex; align-items: center; min-height: 44px; }
  .link { min-height: 44px; }
  .tip-i { width: 44px; height: 44px; margin: -14px -12px; }
  .tour-btn { min-height: 44px; }
  .btn.help-btn { padding: 0; width: 44px; }
  .btn.help-btn .label { display: none; }
  .btn.help-btn .ico { width: 20px; height: 20px; }
  .back { width: 44px; height: 44px; margin-left: -8px; }
  .fold summary { padding: 8px 16px; }
  .fold-body { padding: 0 16px 12px; }
  .user { grid-template-columns: 36px minmax(0, 1fr); }
  .user-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .auth-top .lang-switch button { padding: 0 10px; }
  .board-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; margin-top: 12px; }
  .board-tab { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 52px; padding: 4px 2px; border: 0; border-radius: 8px; background: var(--soft); color: var(--text-2); font-size: 12px; font-weight: 600; line-height: 1.2; cursor: pointer; overflow-wrap: anywhere; }
  .board-tab span { font-size: 12px; font-weight: 500; color: var(--muted); }
  .board-tab[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-strong); box-shadow: inset 0 0 0 1px var(--accent); }
  .board { grid-template-columns: minmax(0, 1fr); margin-top: 8px; }
  .col:not(.on) { display: none; }
  .order-card { padding: 12px; }
  .job-fields { grid-template-columns: minmax(0, 1fr); }
  .job-actions .btn { flex: 1 1 100%; }
  .job-foot .btn { width: 100%; }
  .radio { min-height: 44px; }
  .target-input input { font-size: 16px; }
  .pw-wrap button { min-width: 44px; }
}
@media (max-width: 380px) {
  .two { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
