:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  color: #152635;
  background: #f3f6f8;
  font-synthesis: none;
  --muted: #516777;
  --line: #dce5eb;
  --accent: #08665b;
  --accent-soft: #e2f3ef;
  --nav: #102638;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; display: grid; grid-template-columns: 224px minmax(0, 1fr); line-height: 1.5; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .6; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid #40aa9a; outline-offset: 2px; }
a { color: var(--accent); }
h1, h2, h3, p { margin: 0; }
small { font-size: .84rem; }

.sidebar { background: var(--nav); color: #f4f7fa; min-height: 100vh; display: flex; flex-direction: column; padding: 26px 15px 16px; }
.brand { display: flex; align-items: center; gap: 11px; margin: 0 5px 38px; }
.brand img { object-fit: contain; border-radius: 9px; padding: 5px; background: #e2f4f2; }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 1rem; letter-spacing: .055em; }
.brand span { color: #a2bac8; font-size: .85rem; margin-top: 1px; }
.project-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 8px 6px; }
.project-heading h2 { color: #b3c3d0; font-size: .85rem; font-weight: 600; letter-spacing: .09em; }
.icon-button { color: #d7e6ec; border: 1px solid #476072; background: transparent; border-radius: 7px; width: 32px; height: 32px; line-height: 1; }
.icon-button:hover { background: #254454; }
.projects { display: grid; gap: 6px; }
.project { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 9px; width: 100%; text-align: left; border: 1px solid transparent; border-radius: 8px; padding: 9px 8px; color: #c5d4dd; background: transparent; font-size: .92rem; }
.project:hover { background: #203f50; }
.project[aria-current="true"] { background: #1e4351; color: white; border-color: #396270; }
.project-mark { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; background: #294858; color: #d3ede9; font-size: .83rem; }
.project[aria-current="true"] .project-mark { background: #b8ece0; color: #13433f; }
.project-count { color: #c7d5de; font-size: .82rem; font-variant-numeric: tabular-nums; }
.environment { margin-top: auto; border-top: 1px solid #2b4658; padding: 16px 4px 3px; font-size: .8rem; color: #d9e9ed; display: flex; gap: 6px; align-items: center; }
.environment span:last-child { margin-left: auto; color: #a9beca; }
.status-dot { width: 7px; height: 7px; background: #6ed0ba; border-radius: 50%; flex: none; }

.workspace { min-width: 0; }
.topbar { min-height: 60px; display: flex; justify-content: space-between; align-items: center; padding: 8px 30px; background: #fff; border-bottom: 1px solid var(--line); gap: 14px; }
.breadcrumb { font-size: .9rem; color: var(--muted); }
.breadcrumb b { color: #223746; }
.timezone { font-size: .82rem; color: var(--muted); white-space: nowrap; }
.content { max-width: 1500px; margin: 0 auto; padding: 29px 29px 42px; }
.page-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin: 0 0 21px; }
h1 { font-size: clamp(1.65rem, 2.1vw, 2.18rem); letter-spacing: .025em; font-weight: 750; }
h2 { font-size: 1.11rem; }
.subtext { color: var(--muted); font-size: .94rem; margin-top: 3px; }
.primary, .secondary { border: 1px solid transparent; border-radius: 8px; padding: 9px 15px; min-height: 42px; white-space: nowrap; font-size: .92rem; font-weight: 650; }
.primary { background: var(--accent); color: white; }
.primary:hover { background: #09584f; }
.secondary { border-color: #c9d8e0; background: white; color: #253b48; }
.secondary:hover { background: #eff5f6; }

.summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 23px; }
.stat { min-height: 92px; display: grid; align-content: start; border-radius: 10px; border: 1px solid var(--line); background: white; padding: 11px 13px; text-align: left; color: inherit; }
.stat:hover, .stat[aria-pressed="true"] { border-color: #61ac9c; background: #f3fbf9; }
.stat span { color: #3c5664; font-weight: 600; font-size: .9rem; }
.stat strong { font-size: 1.84rem; font-weight: 720; line-height: 1.3; font-variant-numeric: tabular-nums; margin-top: 3px; }
.columns { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(305px, 1fr); gap: 17px; align-items: start; }
.panel { background: white; border: 1px solid var(--line); border-radius: 11px; min-width: 0; box-shadow: 0 2px 8px #173c5010; }
.queue-header { display: flex; align-items: center; gap: 9px; padding: 16px 15px 11px; }
.list-count { color: var(--muted); font-size: .84rem; }
.tools { padding: 0 13px 12px; display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.filters { display: flex; flex-wrap: wrap; gap: 3px; }
.filter { padding: 5px 7px; min-height: 36px; font-size: .85rem; color: #425a67; border: 1px solid transparent; border-radius: 7px; background: transparent; }
.filter:hover { background: #f0f6f6; }
.filter[aria-pressed="true"] { background: var(--accent-soft); color: #095b50; font-weight: 680; }
.search { display: flex; align-items: center; gap: 7px; flex: 1; min-width: 145px; padding: 0 9px; border: 1px solid #cfdae0; border-radius: 7px; background: #f8fafb; }
.search-icon { position: relative; width: 11px; height: 11px; flex: none; border: 1.5px solid #647f8e; border-radius: 50%; }
.search-icon::after { content: ""; position: absolute; background: #647f8e; width: 5px; height: 1.5px; transform: rotate(45deg); right: -4px; bottom: -2px; }
.search input { border: 0; background: transparent; outline: 0; min-height: 36px; width: 100%; min-width: 0; font-size: .86rem; color: inherit; }
.search:focus-within { outline: 2px solid #3e9a8a; }
.queue-labels, .lead-row { display: grid; grid-template-columns: 1.15fr .72fr .77fr; align-items: center; gap: 9px; }
.queue-labels { background: #f0f5f7; border-block: 1px solid #e1e9ee; color: #445e6e; padding: 8px 15px; font-size: .84rem; font-weight: 650; }
.lead-row { width: 100%; text-align: left; padding: 11px 14px; border: 0; border-bottom: 1px solid #e8eef1; background: white; color: inherit; font-size: .91rem; min-height: 63px; }
.lead-row:last-child { border-bottom: 0; border-radius: 0 0 11px 11px; }
.lead-row:hover, .lead-row[aria-pressed="true"] { background: #ecf7f4; }
.lead-row[aria-pressed="true"] { box-shadow: inset 3px 0 var(--accent); }
.lead-name { display: block; font-weight: 700; overflow-wrap: anywhere; }
.lead-source { display: block; color: var(--muted); font-size: .78rem; margin-top: 2px; }
.pill { display: inline-block; width: max-content; max-width: 100%; border-radius: 20px; padding: 3px 8px; font-weight: 650; font-size: .8rem; }
.pill.new { color: #204d75; background: #e6f0fa; }
.pill.retry { color: #714500; background: #fff1d6; }
.pill.done { color: #155b48; background: #e1f3e9; }
.empty { padding: 25px 16px; color: #4e6778; font-size: .93rem; }

.detail { padding: 15px; }
.detail-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.detail-title h2 { font-size: 1.32rem; overflow-wrap: anywhere; }
.contacts { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 9px 12px; padding: 10px 0 12px; margin: 0; }
.contacts dt { font-size: .84rem; color: var(--muted); font-weight: 600; }
.contacts dd { margin: 3px 0 0; font-size: .94rem; overflow-wrap: anywhere; }
.contacts .phone { font-variant-numeric: tabular-nums; font-weight: 650; }
.contact-actions { display: grid; gap: 6px; padding-bottom: 15px; }
.add-phone-contact { display: inline-flex; align-items: center; justify-content: center; justify-self: start; min-height: 44px; text-decoration: none; }
.contact-actions p { color: var(--muted); font-size: .84rem; }
.contact-help-link { justify-self: start; border: 0; padding: 4px 0; color: var(--accent); background: none; text-decoration: underline; font-size: .87rem; min-height: 36px; }
.contact-help ol { padding-left: 24px; margin: 12px 0; }
.contact-help li { margin: 8px 0; }
.contact-help-fallback { color: var(--muted); font-size: .87rem; }
.contact-help .dialog-actions { flex-wrap: wrap; }
.contact-help .primary { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; text-decoration: none; white-space: normal; text-align: center; }
.detail h3 { font-size: .99rem; }
.contact-form { border-top: 1px solid #e1e9ed; padding-top: 12px; display: grid; gap: 9px; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.field { display: grid; gap: 4px; margin-bottom: 7px; color: #314b59; font-size: .87rem; font-weight: 630; }
.field select, .field input, .field textarea { background: white; border: 1px solid #c8d7df; border-radius: 7px; width: 100%; padding: 7px 8px; min-height: 38px; color: #172d3b; font-weight: 400; font-size: .91rem; }
.field select { appearance: none; padding-right: 22px; background: linear-gradient(45deg, transparent 50%, #587582 50%) calc(100% - 12px) center / 5px 5px no-repeat, linear-gradient(135deg, #587582 50%, transparent 50%) calc(100% - 7px) center / 5px 5px no-repeat, white; }
.field textarea { min-height: 63px; resize: vertical; }
.save-contact { justify-self: end; }
.history { border-top: 1px solid #e1e9ed; margin-top: 16px; padding-top: 10px; }
.history h3 { margin-bottom: 6px; }
.history ul { padding: 0; list-style: none; margin: 0; }
.history li { border-top: 1px solid #eef2f4; padding: 7px 0; font-size: .88rem; overflow-wrap: anywhere; }
.history li:first-child { border-top: 0; }
.history time { color: var(--muted); margin-left: 7px; font-size: .78rem; }
.history p { margin-top: 2px; white-space: pre-wrap; }
.history .empty { padding: 2px 0; }
.message { border-radius: 7px; padding: 7px 11px; border: 1px solid #87c0b1; background: #e9f7f1; color: #164f43; margin: 0 0 12px; font-size: .9rem; }
.message.error { color: #842b24; border-color: #e1a9a1; background: #fff1ee; }
.editor { width: min(92vw, 460px); padding: 19px; border: 1px solid #b6cdd7; border-radius: 12px; color: inherit; }
.editor::backdrop { background: #1026387a; }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.close { border: 0; border-radius: 6px; padding: 0 6px; font-size: 1.55rem; background: #eff5f7; color: #273e4b; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 12px; }
.visually-hidden { position: absolute; overflow: hidden; width: 1px; height: 1px; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.login-layout { display: grid; grid-template-columns: 1fr; place-items: center; padding: 18px; }
.login-panel { width: min(100%, 400px); padding: 24px; }
.login-panel img { object-fit: contain; }
.login-panel form { margin-top: 18px; }
.login-panel input { font-size: 1rem; }
.login-panel .primary { width: 100%; }
.login-panel .message:empty { display: none; }
.topbar:has(form) .timezone { margin-left: auto; }

@media (max-width: 1050px) {
  body { grid-template-columns: 180px minmax(0, 1fr); }
  .content { padding-inline: 17px; }
  .topbar { padding-inline: 17px; }
  .columns { grid-template-columns: minmax(0, 1fr) minmax(270px, .9fr); gap: 10px; }
}
@media (max-width: 780px) {
  body { display: block; }
  .sidebar { min-height: 0; padding: 11px 14px; gap: 8px; }
  .brand { margin: 0; }
  .brand img { width: 31px; height: 31px; }
  .brand span { display: inline; margin-left: 8px; }
  .brand strong { display: inline; }
  .project-area { display: flex; align-items: flex-start; gap: 6px; }
  .project-heading { padding: 5px 3px 0 0; }
  .project-heading h2 { display: none; }
  .projects { display: flex; min-width: 0; overflow-x: auto; }
  .project { width: auto; min-width: max-content; }
  .environment { border: 0; position: absolute; top: 14px; right: 14px; margin: 0; padding: 0; }
  .environment span:last-child { display: none; }
  .topbar { min-height: 42px; }
  .content { padding: 15px 13px 30px; }
  .page-heading { margin-bottom: 11px; }
  .summary { gap: 5px; margin-bottom: 12px; }
  .stat { min-height: 70px; padding: 7px 5px; }
  .stat span { font-size: .82rem; }
  .stat strong { font-size: 1.45rem; }
  .columns { grid-template-columns: 1fr; gap: 13px; }
  .detail { scroll-margin-block-start: 12px; }
}

.policy-page { display: block; padding: clamp(16px, 5vw, 56px); }
.policy-content { width: min(100%, 680px); margin: 0 auto; padding: clamp(22px, 5vw, 46px); }
.policy-header { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; color: var(--muted); }
.policy-header img { object-fit: contain; }
.policy-content section { margin-top: 24px; }
.policy-content h2 { margin-bottom: 6px; }
.policy-content p + p, .policy-content li + li { margin-top: 10px; }
.policy-content ol { margin: 0; padding-inline-start: 1.45em; }
