:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-strong: #eef4fa;
  --ink: #17212b;
  --muted: #667085;
  --line: #d7dee8;
  --line-strong: #b9c6d4;
  --accent: #1769aa;
  --accent-dark: #0f4c81;
  --accent-soft: #e8f2fb;
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --warn: #b54708;
  --warn-bg: #fffaeb;
  --ok: #067647;
  --ok-bg: #ecfdf3;
  --shadow: 0 14px 32px rgba(23, 33, 43, 0.11);
  --bottom-safe: max(20px, env(safe-area-inset-bottom));
  font-family: "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

html.modal-open,
body.modal-open {
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(232, 242, 251, 0.96) 0, rgba(244, 246, 248, 0.98) 210px),
    var(--bg);
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
  letter-spacing: -0.04em;
}

h2 {
  font-size: 17px;
  letter-spacing: -0.03em;
}

h3 {
  font-size: 18px;
  letter-spacing: -0.03em;
}

h4 {
  font-size: 14px;
}

main {
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 0 10px calc(20px + var(--bottom-safe));
}

.topbar,
.mobile-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) 12px 10px;
  background: rgba(244, 246, 248, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.eyebrow {
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.muted {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.hidden {
  display: none !important;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

#loginCard,
.toolbar,
.tab-panel > .card {
  padding: 12px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 10px 0;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.tabs,
.top-nav {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin: 10px 0;
  padding: 3px;
  background: #e9eef5;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.tabs::-webkit-scrollbar,
.top-nav::-webkit-scrollbar {
  display: none;
}

.tabs button,
.top-nav-btn {
  flex: 1 0 auto;
  min-width: 90px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: #344054;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 800;
}

.tabs button.active,
.top-nav-btn.active {
  background: var(--surface);
  color: var(--accent-dark);
  border-color: var(--line);
  box-shadow: 0 1px 4px rgba(23, 33, 43, 0.08);
}

label {
  display: block;
  margin-top: 10px;
  color: #344054;
  font-size: 12px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  margin-top: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  outline: none;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 105, 170, 0.13);
}

button {
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 7px 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
}

button.primary,
.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

button.ghost,
.ghost {
  background: var(--surface-soft);
  border-color: var(--line);
  color: #344054;
}

button.warn,
.warn-button {
  background: var(--warn);
  border-color: var(--warn);
  color: #fff;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.status {
  min-height: 20px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  white-space: pre-wrap;
}

.list {
  display: grid;
  gap: 7px;
  margin-top: 8px;
}

.item {
  display: grid;
  gap: 7px;
  padding: 9px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.item-title {
  font-size: 14px;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.item-meta {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.carzone-info-button {
  display: inline;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent-dark);
  font: inherit;
  font-weight: 800;
  text-align: left;
}

.carzone-info-button:hover {
  text-decoration: underline;
}

.tire-outbound-list {
  display: grid;
  gap: 8px;
}

.tire-outbound-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 9px;
  align-items: start;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
}

.tire-outbound-card input {
  grid-row: 1 / span 4;
  margin-top: 3px;
}

.tire-outbound-card span {
  display: grid;
  gap: 2px;
  font-size: 12px;
  line-height: 1.3;
}

.tire-outbound-card b {
  color: var(--muted);
  font-size: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  border: 1px solid #d0d5dd;
  border-radius: 999px;
  background: #f2f4f7;
  color: #344054;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
}

.badge.ok {
  background: var(--ok-bg);
  border-color: #abefc6;
  color: var(--ok);
}

.badge.warn {
  background: var(--warn-bg);
  border-color: #fedf89;
  color: var(--warn);
}

.badge.danger {
  background: var(--danger-bg);
  border-color: #fecdca;
  color: var(--danger);
}

.item-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}

.item-actions button {
  min-width: 0;
  padding: 6px 5px;
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
}

.item-actions button.active {
  background: var(--accent);
  border-color: var(--accent-dark);
  color: #fff;
}

.device-picker {
  display: grid;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
}

.device-picker select {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  padding: 6px 8px;
}

.device-picked {
  display: block;
  margin-top: 6px;
}

.device-notice {
  display: block;
  margin-top: 4px;
  color: var(--warn);
}

.item-actions button.is-done {
  background: var(--ok-bg);
  border-color: #abefc6;
  color: var(--ok);
  box-shadow: inset 0 0 0 1px rgba(6, 118, 71, 0.05);
}

.item-actions button.is-running {
  background: var(--warn-bg);
  border-color: #fedf89;
  color: var(--warn);
  opacity: 1;
}

.action-progress {
  display: block;
  margin-top: 1px;
  font-size: 9px;
  font-weight: 900;
}

.command-inline-status {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  border: 1px solid #fedf89;
  border-radius: 999px;
  background: var(--warn-bg);
  color: var(--warn);
  padding: 3px 7px;
  font-size: 10px;
  font-weight: 900;
}

.approval-result-inline {
  margin-top: 9px;
  padding: 8px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f9fafb;
}

.approval-result-entry + .approval-result-entry {
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid #e5e7eb;
}

.approval-result-meta {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.35;
}

.approval-result-reason {
  margin-top: 6px;
  color: var(--danger);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.35;
}

.approval-notice {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 72px);
  left: 10px;
  right: 10px;
  z-index: 1000;
  max-height: min(calc(100vh - 96px), 520px);
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.22);
}

.approval-notice-toggle {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 72px);
  right: 10px;
  z-index: 999;
  min-height: 0;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.18);
  font-size: 12px;
  font-weight: 900;
}

.approval-notice-toggle[hidden] {
  display: none;
}

.approval-notice[hidden] {
  display: none;
}

.approval-notice-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.approval-notice-head strong {
  font-size: 14px;
  letter-spacing: -0.02em;
}

.approval-notice-head button {
  min-height: 0;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f8fafc;
  color: var(--muted);
  font-size: 11px;
}

.approval-notice-list {
  display: grid;
  gap: 8px;
}

.approval-notice-item {
  padding: 10px;
  border: 1px solid #e5e7eb;
  border-radius: 13px;
  background: #f9fafb;
}

.approval-notice-meta {
  margin-top: 6px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.approval-notice-reason {
  margin-top: 6px;
  color: var(--danger);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.35;
}

.done-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.done-summary span,
.done-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid #abefc6;
  border-radius: 999px;
  background: var(--ok-bg);
  color: var(--ok);
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 900;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.pager button {
  min-height: 30px;
  padding: 5px 11px;
}

dialog {
  width: min(92vw, 560px);
  max-height: calc(100vh - 20px);
  max-height: calc(100dvh - 20px);
  border: 0;
  padding: 0;
  background: transparent;
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.38);
  backdrop-filter: blur(2px);
}

.order-dialog,
.mobile-dialog,
.dialog-card {
  width: min(720px, calc(100vw - 16px));
  max-height: calc(100vh - 20px);
  max-height: calc(100dvh - 20px);
  overflow: hidden;
  padding: 12px 12px calc(12px + var(--bottom-safe));
  scroll-padding-bottom: calc(84px + var(--bottom-safe));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  box-shadow: 0 22px 70px rgba(15, 23, 42, 0.24);
}

dialog[open].order-dialog,
dialog[open].mobile-dialog,
dialog[open] .order-dialog,
dialog[open] .mobile-dialog,
dialog[open] .dialog-card {
  display: flex;
  flex-direction: column;
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
}

.dialog-body {
  display: grid;
  flex: 1 1 auto;
  gap: 10px;
  min-height: 0;
  margin-top: 10px;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.dialog-actions {
  position: sticky;
  bottom: 0;
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: 12px -12px calc(-12px - var(--bottom-safe));
  padding: 10px 12px calc(12px + var(--bottom-safe));
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), var(--surface));
  border-top: 1px solid var(--line);
}

.dialog-actions .primary {
  margin-top: 0;
}

.mobile-dialog .actions,
.mobile-dialog .smartkey-actions {
  position: sticky;
  bottom: 0;
  margin: 10px -12px calc(-12px - var(--bottom-safe));
  padding: 10px 12px calc(12px + var(--bottom-safe));
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), var(--surface));
  border-top: 1px solid var(--line);
}

.memo-dialog-card {
  padding: 0;
  overflow: hidden;
}

.memo-dialog-card .dialog-body {
  max-height: calc(100vh - 170px);
  overflow: auto;
  margin-top: 0;
  padding: 12px;
  background: var(--surface);
}

.memo-dialog-head {
  padding: 12px;
  background: var(--surface-soft);
}

.mobile-memo-history-wrap,
.mobile-memo-new {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  padding: 10px;
}

.mobile-memo-history {
  display: grid;
  gap: 8px;
}

.mobile-memo-entry {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 9px 10px;
}

.mobile-memo-entry p {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13px;
  line-height: 1.5;
}

.mobile-memo-entry span,
.mobile-memo-empty {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
}

.memo-template-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.memo-template-actions button {
  min-height: 28px;
  border-radius: 999px;
  background: var(--surface);
  font-size: 11px;
  font-weight: 900;
}

#memoText {
  min-height: 104px;
  resize: vertical;
}

#memoDialog {
  width: min(90vw, 440px);
}

#memoDialog .memo-dialog-card {
  width: 100%;
}

#memoDialog .memo-dialog-card .dialog-body {
  max-height: calc(100vh - 142px);
  gap: 8px;
  padding: 8px;
}

#memoDialog .memo-dialog-head {
  padding: 10px;
}

#memoDialog .mobile-memo-history-wrap,
#memoDialog .mobile-memo-new {
  gap: 6px;
  padding: 8px;
  border-radius: 8px;
}

#memoDialog .readonly-item {
  grid-template-columns: 78px minmax(0, 1fr);
  min-height: 28px;
  padding: 5px 7px;
}

#memoDialog #memoText {
  min-height: 82px;
}

.readonly-grid,
.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.comment-options {
  display: grid;
  gap: 7px;
  margin: 10px 0 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
}

.comment-options legend {
  padding: 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.comment-options label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

#ioDialog.io-dialog {
  width: min(400px, calc(100vw - 8px));
  max-height: calc(100vh - 8px);
  max-height: calc(100dvh - 8px);
  padding: 6px 6px calc(6px + var(--bottom-safe));
  border-radius: 8px;
}

#ioDialog .dialog-head {
  gap: 6px;
  padding-bottom: 6px;
}

#ioDialog .dialog-head h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
}

#ioDialog .dialog-head .muted {
  margin: 2px 0 0;
  font-size: 10px;
}

#ioDialog .dialog-body {
  gap: 4px;
  margin-top: 4px;
  max-height: calc(100vh - 82px);
  max-height: calc(100dvh - 82px);
  padding-bottom: calc(48px + var(--bottom-safe));
}

#ioDialog .readonly-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

#ioDialog .readonly-item {
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 4px;
  min-height: 24px;
  padding: 3px 5px;
  border-radius: 6px;
}

#ioDialog .readonly-item span {
  font-size: 10px;
}

#ioDialog .readonly-item strong {
  font-size: 11px;
}

#ioDialog .order-copy-section {
  padding: 5px;
  border-radius: 7px;
}

#ioDialog .order-copy-section h4 {
  margin: 0 0 4px;
  font-size: 11px;
}

#ioDialog .form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

#ioDialog label {
  gap: 1px;
  font-size: 10px;
}

#ioDialog input,
#ioDialog select {
  min-height: 28px;
  padding: 4px 6px;
  font-size: 11px;
  border-radius: 6px;
}

#ioDialog textarea {
  min-height: 34px;
  max-height: 44px;
  padding: 5px 6px;
  font-size: 11px;
  border-radius: 6px;
}

#ioDialog [data-io-repair-content-field],
#ioDialog [data-io-memo-field] {
  grid-column: 1 / -1;
}

#ioDialog .io-comment-options {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px 6px;
  margin-top: 4px;
  padding: 4px 6px;
  border-radius: 7px;
}

#ioDialog .io-comment-options legend {
  display: none;
}

#ioDialog .io-comment-options label {
  gap: 4px;
  font-size: 10px;
  line-height: 1.15;
  min-height: 20px;
  white-space: nowrap;
}

#ioDialog .io-comment-options input[type="checkbox"] {
  width: 14px;
  height: 14px;
  min-height: 14px;
  padding: 0;
}

#ioDialog .dialog-actions {
  align-items: center;
  justify-content: flex-end;
  margin: 6px -6px calc(-6px - var(--bottom-safe));
  padding: 6px 6px calc(7px + var(--bottom-safe));
}

#ioDialog #ioStatus {
  margin: 2px 0 0;
  padding: 4px 6px;
  font-size: 10px;
  line-height: 1.25;
  text-align: left;
  border-radius: 6px;
  background: rgba(248, 250, 252, 0.88);
}

#ioDialog #ioSubmitBtn {
  width: 100%;
  min-height: 40px;
}

.readonly-item {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.readonly-item span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.readonly-item strong {
  min-width: 0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.new-intake-item {
  gap: 6px;
  padding: 7px;
}

.new-intake-item .item-head {
  align-items: center;
}

.new-intake-item .item-title {
  font-size: 13px;
  line-height: 1.2;
}

.new-intake-item .badge {
  min-height: 18px;
  padding: 1px 6px;
}

.new-intake-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 4px;
}

.new-intake-field {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  min-width: 0;
  min-height: 26px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
}

.new-intake-field.wide {
  grid-column: auto;
}

.new-intake-field span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.new-intake-field strong {
  min-width: 0;
  color: var(--ink);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.22;
  overflow-wrap: anywhere;
}

@media (max-width: 520px) {
  .new-intake-grid {
    grid-template-columns: 1fr;
  }

  .new-intake-field.wide {
    grid-column: 1 / -1;
  }
}

.assignment-admin-search {
  display: grid;
  gap: 9px;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
}

.assignment-admin-search form {
  display: grid;
  gap: 8px;
}

.assignment-admin-search .admin-search-actions {
  display: flex;
  gap: 8px;
}

.assignment-admin-search .admin-search-actions button {
  flex: 1;
}

.admin-search-title {
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.assignment-admin-result {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.assignment-admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.assignment-admin-field {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.assignment-admin-field span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
}

.assignment-admin-field strong {
  min-width: 0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.28;
  overflow-wrap: anywhere;
}

#resultDialog .result-dialog-card {
  width: min(560px, calc(100vw - 16px));
}

#resultDialog.result-dialog-compact {
  width: min(90vw, 440px);
}

#resultDialog.result-dialog-compact .result-dialog-card {
  width: 100%;
  padding: 10px;
}

#resultDialog.result-dialog-compact .dialog-body {
  gap: 8px;
  margin-top: 8px;
}

#resultDialog.result-dialog-compact .result-pre {
  min-height: 180px;
  max-height: 42vh;
  font-size: 12px;
  line-height: 1.45;
}

.tire-order-inline-status {
  margin: -2px 0 0;
}

.order-copy-dialog {
  display: none;
}

.order-copy-dialog[open] {
  display: block;
}

.order-copy-status,
.approval-panel,
.order-copy-panel {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
  padding: 9px 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.42;
}

.order-copy-status.ok,
.order-copy-panel.ok,
.approval-panel.ok {
  background: var(--ok-bg);
  border-color: #abefc6;
  color: var(--ok);
}

.order-copy-status.warn,
.order-copy-panel.warn,
.approval-panel.warn {
  background: var(--warn-bg);
  border-color: #fedf89;
  color: var(--warn);
}

.order-copy-status.danger,
.order-copy-panel.danger,
.approval-panel.danger {
  background: var(--danger-bg);
  border-color: #fecdca;
  color: var(--danger);
}

.order-copy-section,
.nearest-panel {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
}

.nearest-panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.candidate-list {
  display: grid;
  gap: 6px;
}

.candidate {
  display: grid;
  width: 100%;
  gap: 3px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 9px;
  background: var(--surface);
  color: var(--ink);
}

.candidate.selected,
.candidate:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 105, 170, 0.13);
}

.candidate small {
  color: var(--muted);
  font-size: 11px;
}

.car-model-auto-list,
.car-model-search-box,
.car-model-search-results {
  display: grid;
  gap: 6px;
}

.car-model-search-box {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}

.car-model-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
}

.car-model-search-row input {
  min-width: 0;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-row input {
  width: auto;
  min-height: 0;
  margin: 0;
}

.filter-details {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 10px;
}

.filter-details summary {
  cursor: pointer;
  font-weight: 900;
}

.filter-details summary span {
  color: var(--muted);
  font-weight: 700;
}

.check-list {
  display: grid;
  gap: 6px;
  max-height: 260px;
  margin-top: 8px;
  overflow: auto;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  padding: 7px 8px;
  font-size: 13px;
}

.check-row input {
  width: auto;
  min-height: 0;
  margin: 0;
}

.button-link {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  margin-top: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--accent);
  font-weight: 900;
  text-decoration: none;
}

.primary-link {
  color: var(--accent);
  font-weight: 800;
  word-break: break-all;
}

.smartkey-car-button {
  display: inline;
  min-height: 0;
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--accent);
  font: inherit;
  font-weight: 900;
  text-decoration: underline;
}

.smartkey-dialog .dialog-body {
  gap: 10px;
}

.smartkey-map-wrap {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
}

.smartkey-map {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: cover;
}

.smartkey-address {
  padding: 8px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.smartkey-info {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.smartkey-info span {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 7px 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.smartkey-info b {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: 13px;
}

.smartkey-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  padding: 0 14px 14px;
}

.smartkey-actions button {
  min-height: 40px;
}

.result-pre {
  width: 100%;
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f172a;
  color: #e5e7eb;
  padding: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.45;
}

iframe {
  max-width: 100%;
}

.schedule-mobile-head {
  align-items: flex-start;
}

.mobile-schedule-calendar-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  margin: 10px 0;
}

.mobile-schedule-calendar-head strong {
  display: block;
  font-size: 16px;
  text-align: right;
}

.schedule-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(78px, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-x: auto;
  background: var(--surface);
}

.schedule-weekday {
  padding: 6px 4px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-align: center;
}

.schedule-weekday:nth-child(7) {
  border-right: 0;
}

.schedule-day {
  min-height: 94px;
  padding: 5px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  display: grid;
  align-content: start;
  gap: 4px;
}

.schedule-day:nth-child(7n) {
  border-right: 0;
}

.schedule-day.outside {
  background: var(--surface-soft);
  color: var(--muted);
}

.schedule-day.today {
  box-shadow: inset 0 0 0 2px #b9d7ef;
}

.schedule-day.selected {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  background: var(--accent-soft);
}

.schedule-day-number {
  font-size: 11px;
  font-weight: 900;
}

.schedule-event {
  border: 1px solid #fedf89;
  border-radius: 6px;
  background: var(--warn-bg);
  padding: 4px 5px;
  color: var(--ink);
  font-size: 10px;
  line-height: 1.25;
  text-align: left;
}

.schedule-event.done {
  opacity: 0.65;
  background: var(--ok-bg);
  border-color: #bbf7d0;
}

.schedule-event.canceled {
  opacity: 0.5;
  background: #f1f5f9;
  text-decoration: line-through;
}

.schedule-event-time {
  color: var(--warn);
  font-weight: 900;
  margin-right: 3px;
}

.schedule-event-title {
  font-weight: 900;
  word-break: break-word;
}

.schedule-event-meta {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  word-break: break-word;
}

.schedule-panel {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 9px;
}

.schedule-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.schedule-list {
  display: grid;
  gap: 7px;
}

.schedule-list-empty {
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.schedule-card {
  display: grid;
  gap: 4px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.schedule-card.overdue {
  border-color: #fca5a5;
  background: var(--danger-bg);
}

.schedule-card.soon {
  border-color: #fdba74;
  background: var(--warn-bg);
}

.schedule-card.done {
  opacity: 0.72;
  background: var(--surface-soft);
}

.schedule-card.canceled {
  opacity: 0.58;
  background: #f1f5f9;
  text-decoration: line-through;
}

.schedule-card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 900;
}

.schedule-card-meta,
.schedule-card-memo {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.schedule-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 3px;
}

.schedule-type-badge,
.schedule-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
  line-height: 1.2;
  white-space: nowrap;
}

.schedule-type-badge.general { background: #e0f2fe; color: #0369a1; }
.schedule-type-badge.inbound { background: var(--ok-bg); color: var(--ok); }
.schedule-type-badge.outbound { background: var(--warn-bg); color: var(--warn); }
.schedule-status-badge.scheduled { background: #eef2ff; color: #3730a3; }
.schedule-status-badge.done { background: var(--ok-bg); color: var(--ok); }
.schedule-status-badge.canceled { background: #e5e7eb; color: #475569; }

.schedule-source-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 560px) {
  .topbar,
  .mobile-header {
    align-items: flex-start;
  }

  h1 {
    font-size: 20px;
  }

  .toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar button {
    width: 100%;
  }

  .item-actions {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .dialog-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .dialog-actions button {
    width: 100%;
  }

  .mobile-schedule-calendar-head {
    grid-template-columns: 1fr;
  }

  .mobile-schedule-calendar-head strong {
    text-align: left;
  }

  .schedule-calendar-grid {
    grid-template-columns: repeat(7, minmax(68px, 1fr));
  }

  .schedule-day {
    min-height: 86px;
  }
}
.approval-notice-delete {
  margin-left: 8px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--muted);
  font-size: 11px;
}

.approval-notice-delete:disabled {
  opacity: 0.55;
}
/* PWA install/update UI */
.app-version-badge {
  align-self: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.update-banner {
  position: fixed;
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  bottom: calc(env(safe-area-inset-bottom) + 12px);
  z-index: 10000;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.update-banner p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.update-banner-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.update-banner.hidden {
  display: none;
}

@media (max-width: 560px) {
  .update-banner {
    align-items: stretch;
    flex-direction: column;
  }

  .update-banner-actions {
    justify-content: flex-end;
  }
}
