:root {
  --navy: #080943;
  --navy-2: #17195b;
  --blue: #2589b7;
  --sky: #e8f6fa;
  --coral: #f36f5f;
  --coral-soft: #fff0ed;
  --gold: #f2c75c;
  --gold-soft: #fff8df;
  --mint: #96d5c2;
  --mint-soft: #e9f8f3;
  --ink: #17192d;
  --muted: #6b7385;
  --line: #e3e7ea;
  --canvas: #f5f7f8;
  --surface: #ffffff;
  --success: #247b63;
  --danger: #cb4c41;
  --rail: 224px;
  --header: 72px;
  --shadow: 0 12px 30px rgba(18, 27, 49, 0.08);
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--canvas); }

body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", Arial, sans-serif;
  font-size: 14px;
}

body.no-scroll { overflow: hidden; }
[hidden] { display: none !important; }

button, input, select, textarea { color: inherit; font: inherit; }
button { border: 0; }
a { color: inherit; text-decoration: none; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(37, 137, 183, 0.22); outline-offset: 2px; }
svg { width: 19px; height: 19px; flex: 0 0 auto; stroke-width: 2; }

.offline-banner {
  position: fixed;
  inset: 0 0 auto;
  z-index: 250;
  display: none;
  padding: 8px 14px;
  color: #6d520a;
  background: var(--gold-soft);
  border-bottom: 1px solid #ead37b;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.offline-banner.is-visible { display: block; }

.brand-symbol {
  display: block;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  color: var(--navy);
  background: transparent;
  object-fit: contain;
  font-size: 20px;
  font-weight: 950;
}

.companion-auth {
  position: fixed;
  inset: 0;
  z-index: 220;
  display: grid;
  grid-template-columns: minmax(340px, 0.9fr) minmax(430px, 1.1fr);
  min-height: 100vh;
  background: #ffffff;
}

.auth-visual { min-height: 100vh; overflow: hidden; background: var(--navy); }
.auth-visual img { width: 100%; height: 100%; min-height: 100vh; object-fit: cover; }

.auth-panel {
  align-self: center;
  width: min(470px, calc(100% - 48px));
  padding: 36px;
  margin: 0 auto;
}

.auth-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 46px; }
.auth-brand > span:last-child { display: grid; gap: 2px; }
.auth-brand strong { color: var(--navy); font-size: 19px; }
.auth-brand small { color: var(--muted); font-size: 11px; }
.auth-copy p { margin: 0 0 7px; color: var(--blue); font-size: 12px; font-weight: 900; }
.auth-copy h1 { margin: 0; font-size: 34px; line-height: 1.2; letter-spacing: 0; }
.auth-copy > span { display: block; margin-top: 9px; color: var(--muted); line-height: 1.6; }

.auth-form { display: grid; gap: 16px; margin-top: 30px; }
.auth-form label, .modal-body label { display: grid; gap: 8px; color: #353b4d; font-size: 12px; font-weight: 800; }
.auth-form input, .modal-body input, .modal-body select, .modal-body textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  outline: 0;
}
.auth-form input, .modal-body input, .modal-body select { height: 46px; padding: 0 13px; }
.modal-body textarea { resize: vertical; padding: 11px 12px; line-height: 1.6; }
.auth-form input:focus, .modal-body input:focus, .modal-body select:focus, .modal-body textarea:focus { border-color: #75bddb; box-shadow: 0 0 0 3px rgba(37, 137, 183, 0.1); }
.auth-error { min-height: 18px; margin: -4px 0; color: var(--danger); font-size: 11px; }
.demo-account { display: block; margin-top: 18px; color: #969da9; font-size: 10px; text-align: center; }

.primary-button, .secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 17px;
  border-radius: 6px;
  font-weight: 800;
  cursor: pointer;
}
.primary-button { color: #ffffff; background: var(--coral); box-shadow: 0 7px 15px rgba(243, 111, 95, 0.18); }
.primary-button:hover { background: #e86253; }
.primary-button.danger { background: var(--danger); }
.secondary-button { color: var(--navy); background: #ffffff; border: 1px solid var(--line); }
.auth-form .primary-button { width: 100%; min-height: 46px; }

.companion-rail {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  width: var(--rail);
  color: #ffffff;
  background: var(--navy);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.rail-brand { display: flex; align-items: center; gap: 11px; height: var(--header); padding: 0 18px; border-bottom: 1px solid rgba(255, 255, 255, 0.09); }
.rail-brand > span:last-child { display: grid; gap: 2px; }
.rail-brand strong { font-size: 17px; }
.rail-brand small { color: rgba(255, 255, 255, 0.52); font-size: 11px; }
.companion-rail nav { display: grid; gap: 5px; padding: 20px 12px; }

.rail-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  min-height: 46px;
  padding: 0 12px;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.68);
  background: transparent;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.rail-item:hover, .rail-item.is-active { color: #ffffff; background: rgba(68, 198, 238, 0.16); }
.rail-item.is-active { box-shadow: inset 3px 0 0 #44c6ee; }
.rail-item b { display: grid; min-width: 20px; height: 20px; padding: 0 5px; place-items: center; border-radius: 10px; background: var(--coral); font-size: 10px; }

.rail-foot { display: grid; gap: 8px; margin: auto 12px 18px; }
.rail-foot span, .rail-foot button { display: flex; align-items: center; gap: 9px; min-height: 40px; padding: 0 12px; border-radius: 6px; }
.rail-foot span { color: rgba(255, 255, 255, 0.58); background: rgba(255, 255, 255, 0.06); font-size: 11px; }
.rail-foot span i { width: 7px; height: 7px; border-radius: 50%; background: #73ddb1; box-shadow: 0 0 0 4px rgba(115, 221, 177, 0.12); }
.rail-foot button { color: rgba(255, 255, 255, 0.68); background: transparent; font-weight: 700; cursor: pointer; }

.companion-workspace { min-width: 0; margin-left: var(--rail); }
.companion-header {
  position: sticky;
  top: 0;
  z-index: 35;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header);
  padding: 0 28px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}
.mobile-brand { display: none; }
.header-context h1 { margin: 0; font-size: 17px; letter-spacing: 0; }
.header-context p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.header-actions { display: flex; align-items: center; gap: 9px; }

.availability-button {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 6px;
  color: var(--success);
  background: var(--mint-soft);
  cursor: pointer;
}
.availability-button span { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.availability-button b { font-size: 12px; }
.availability-button.paused { color: var(--muted); background: #eef1f3; }

.icon-button { position: relative; display: inline-grid; width: 40px; height: 40px; padding: 0; place-items: center; border-radius: 6px; color: var(--ink); background: #f1f4f5; cursor: pointer; }
.icon-button:hover { background: #e8edef; }
.avatar-button, .large-avatar { display: inline-grid; place-items: center; border-radius: 50%; font-weight: 900; }
.avatar-button { width: 40px; height: 40px; color: #ffffff; background: var(--navy-2); cursor: pointer; }

.companion-content { width: 100%; max-width: 1320px; min-height: calc(100vh - var(--header)); padding: 28px; margin: 0 auto; }
.companion-view { display: none; }
.companion-view.is-active { display: block; animation: fade-in 180ms ease; }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.view-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.view-heading.compact { align-items: center; }
.view-heading p { margin: 0 0 5px; color: var(--blue); font-size: 12px; font-weight: 800; }
.view-heading h2 { margin: 0; font-size: 27px; line-height: 1.25; letter-spacing: 0; }
.view-heading small { display: block; margin-top: 6px; color: var(--muted); }
.view-heading select { min-height: 40px; padding: 0 32px 0 12px; border: 1px solid var(--line); border-radius: 6px; background: #ffffff; }

.metric-strip, .performance-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}
.metric-strip article, .performance-strip article { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; padding: 20px 22px; }
.metric-strip article:not(:last-child)::after, .performance-strip article:not(:last-child)::after { content: ""; position: absolute; top: 20%; right: 0; width: 1px; height: 60%; background: var(--line); }
.metric-strip span, .performance-strip span { grid-column: 1 / -1; color: var(--muted); font-size: 11px; font-weight: 700; }
.metric-strip strong, .performance-strip strong { font-size: 27px; line-height: 1; }
.metric-strip small, .performance-strip small { align-self: end; color: var(--muted); font-size: 10px; }

.active-service-panel { min-height: 220px; margin-bottom: 18px; overflow: hidden; border-radius: 8px; color: #ffffff; background: var(--navy); box-shadow: var(--shadow); }
.empty-active { display: grid; min-height: 220px; gap: 7px; place-items: center; align-content: center; color: rgba(255, 255, 255, 0.66); text-align: center; }
.empty-active svg { width: 36px; height: 36px; color: var(--mint); }
.empty-active strong { color: #ffffff; font-size: 16px; }
.empty-active span { font-size: 11px; }

.active-service {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(270px, 0.65fr);
  min-height: 220px;
}
.active-copy { position: relative; z-index: 1; align-self: center; padding: 26px 30px; }
.active-label { display: flex; align-items: center; gap: 8px; color: var(--gold); font-size: 11px; font-weight: 900; }
.active-label i { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 5px rgba(242, 199, 92, 0.13); }
.active-copy h3 { margin: 13px 0 7px; font-size: 25px; letter-spacing: 0; }
.active-copy p { margin: 0; color: rgba(255, 255, 255, 0.62); font-size: 12px; }
.active-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 22px; }
.active-meta span { display: grid; gap: 4px; padding-left: 12px; border-left: 1px solid rgba(255, 255, 255, 0.16); }
.active-meta small { color: rgba(255, 255, 255, 0.48); font-size: 9px; }
.active-meta strong { font-size: 12px; }
.active-actions { display: grid; align-content: center; gap: 10px; padding: 28px; background: rgba(255, 255, 255, 0.07); }
.active-actions button { min-height: 42px; border-radius: 6px; font-weight: 800; cursor: pointer; }
.active-actions .finish { color: var(--navy); background: var(--gold); }
.active-actions .note { color: #ffffff; background: rgba(255, 255, 255, 0.12); }

.today-grid, .performance-grid, .profile-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.75fr); gap: 18px; }
.performance-grid, .profile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.work-panel, .profile-section { min-width: 0; border: 1px solid var(--line); border-radius: 8px; background: #ffffff; }
.work-panel { padding: 20px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 17px; }
.section-heading h3 { margin: 0; font-size: 17px; letter-spacing: 0; }
.section-heading p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.section-heading button { display: inline-flex; align-items: center; gap: 5px; color: var(--blue); background: transparent; font-size: 11px; font-weight: 800; cursor: pointer; }
.section-heading button svg { width: 14px; }

.schedule-list { display: grid; }
.schedule-item { display: grid; grid-template-columns: 60px minmax(0, 1fr) auto; align-items: center; gap: 13px; min-height: 76px; border-bottom: 1px solid var(--line); cursor: pointer; }
.schedule-item:last-child { border-bottom: 0; }
.schedule-item:hover { background: #fafbfb; }
.schedule-time { display: grid; gap: 3px; color: var(--navy); font-weight: 900; }
.schedule-time small { color: var(--muted); font-size: 9px; font-weight: 500; }
.schedule-copy { display: grid; gap: 5px; min-width: 0; }
.schedule-copy p { margin: 0; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }

.status { display: inline-flex; align-items: center; gap: 6px; min-height: 25px; padding: 0 9px; border-radius: 13px; font-size: 10px; font-weight: 800; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.scheduled { color: #226d90; background: var(--sky); }
.status.active { color: var(--success); background: var(--mint-soft); }
.status.done { color: #526172; background: #eef1f3; }
.status.pending { color: #8a6711; background: var(--gold-soft); }

.safety-list { display: grid; }
.safety-list label { display: grid; grid-template-columns: 19px minmax(0, 1fr); gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.safety-list input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--navy-2); }
.safety-list span { display: grid; gap: 4px; }
.safety-list small { color: var(--muted); font-size: 10px; }
.safety-list input:checked + span { opacity: 0.48; }
.safety-action { display: flex; align-items: center; justify-content: center; gap: 7px; width: 100%; min-height: 40px; margin-top: 14px; border-radius: 6px; color: var(--danger); background: var(--coral-soft); font-weight: 800; cursor: pointer; }

.segments { display: inline-flex; gap: 3px; padding: 3px; margin-bottom: 16px; border-radius: 6px; background: #e9edef; }
.segments button { min-height: 34px; padding: 0 14px; border-radius: 4px; color: var(--muted); background: transparent; font-size: 12px; font-weight: 800; cursor: pointer; }
.segments button.is-active { color: var(--navy); background: #ffffff; box-shadow: 0 2px 7px rgba(18, 27, 49, 0.08); }

.order-list { display: grid; gap: 12px; }
.order-card { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; align-items: center; gap: 16px; min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: #ffffff; cursor: pointer; }
.order-card:hover { border-color: #cbd6db; transform: translateY(-1px); }
.order-date { display: grid; min-height: 68px; place-items: center; border-radius: 7px; color: var(--navy); background: var(--sky); text-align: center; }
.order-date strong { font-size: 22px; line-height: 1; }
.order-date small { color: var(--blue); font-size: 10px; }
.order-copy { display: grid; gap: 6px; min-width: 0; }
.order-copy h3 { margin: 0; font-size: 15px; }
.order-copy p, .order-copy small { margin: 0; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.order-side { display: grid; justify-items: end; gap: 11px; }
.order-side svg { width: 17px; color: #9ca4af; }
.empty-list { display: grid; min-height: 220px; place-items: center; padding: 24px; border: 1px dashed #ccd5da; border-radius: 8px; color: var(--muted); text-align: center; }

.incident-summary { display: grid; grid-template-columns: 120px 120px minmax(0, 1fr); gap: 12px; margin-bottom: 18px; }
.incident-summary > span, .incident-summary > p { min-height: 88px; margin: 0; border: 1px solid var(--line); border-radius: 8px; background: #ffffff; }
.incident-summary > span { display: grid; place-items: center; align-content: center; }
.incident-summary > span strong { font-size: 25px; }
.incident-summary > span small { color: var(--muted); font-size: 10px; }
.incident-summary > p { display: flex; align-items: center; gap: 13px; padding: 15px 18px; color: var(--danger); background: var(--coral-soft); border-color: #f1cec9; }
.incident-summary > p > span { display: grid; gap: 4px; }
.incident-summary p small { color: #8b5f5a; font-size: 10px; }
.incident-list { display: grid; gap: 11px; }
.incident-card { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 13px; align-items: start; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: #ffffff; }
.incident-icon { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 7px; color: var(--danger); background: var(--coral-soft); }
.incident-copy { display: grid; gap: 5px; }
.incident-copy p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.incident-copy small { color: #969daa; font-size: 10px; }
.severity { padding: 5px 7px; border-radius: 4px; font-size: 10px; font-weight: 800; }
.severity.low { color: var(--success); background: var(--mint-soft); }
.severity.medium { color: #85620e; background: var(--gold-soft); }
.severity.high { color: var(--danger); background: var(--coral-soft); }

.performance-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.service-chart { display: grid; grid-template-columns: repeat(7, minmax(24px, 1fr)); align-items: end; gap: 13px; height: 220px; padding: 22px 10px 0; background-image: repeating-linear-gradient(to top, transparent 0 48px, #edf0f2 48px 49px); }
.chart-day { display: grid; grid-template-rows: 1fr auto; align-items: end; justify-items: center; gap: 8px; height: 100%; }
.chart-day i { width: min(27px, 58%); min-height: 7px; border-radius: 4px 4px 1px 1px; background: var(--blue); }
.chart-day.today i { background: var(--coral); }
.chart-day span { color: var(--muted); font-size: 10px; }
.skill-list { display: flex; flex-wrap: wrap; gap: 8px; }
.skill-list span { padding: 8px 10px; border-radius: 5px; color: var(--blue); background: var(--sky); font-size: 11px; font-weight: 800; }
.certification { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 11px; align-items: center; margin-top: 22px; padding: 15px; border-radius: 7px; color: var(--success); background: var(--mint-soft); }
.certification > svg { width: 24px; height: 24px; }
.certification span { display: grid; gap: 4px; }
.certification small { color: #5f746e; font-size: 10px; }

.profile-hero { display: grid; grid-template-columns: 74px minmax(0, 1fr) 40px; align-items: center; gap: 18px; padding: 24px; margin-bottom: 18px; border-radius: 8px; color: #ffffff; background: var(--navy); }
.large-avatar { width: 72px; height: 72px; color: var(--navy); background: var(--gold); font-size: 25px; }
.profile-hero h2 { margin: 0; font-size: 24px; }
.profile-hero p { margin: 5px 0 8px; color: rgba(255, 255, 255, 0.55); font-size: 11px; }
.profile-hero div > span { display: inline-flex; align-items: center; min-height: 24px; padding: 0 9px; border-radius: 12px; color: var(--navy); background: var(--mint); font-size: 10px; font-weight: 800; }
.profile-hero .icon-button { color: #ffffff; background: rgba(255, 255, 255, 0.1); }
.profile-section { overflow: hidden; }
.profile-section h3 { margin: 0; padding: 17px 18px; border-bottom: 1px solid var(--line); font-size: 15px; }
.profile-section > button { display: grid; grid-template-columns: 42px minmax(0, 1fr) 18px; align-items: center; gap: 12px; width: 100%; min-height: 76px; padding: 11px 18px; border-bottom: 1px solid var(--line); background: #ffffff; text-align: left; cursor: pointer; }
.profile-section > button:last-child { border-bottom: 0; }
.profile-section > button:hover { background: #fafbfb; }
.profile-icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 7px; }
.profile-icon.mint { color: var(--success); background: var(--mint-soft); }
.profile-icon.blue { color: var(--blue); background: var(--sky); }
.profile-icon.gold { color: #86620d; background: var(--gold-soft); }
.profile-icon.coral { color: var(--danger); background: var(--coral-soft); }
.profile-section button > span:nth-child(2) { display: grid; gap: 5px; }
.profile-section small { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.profile-section button > svg { color: #a0a8b2; }

.bottom-nav { display: none; }
.sheet-backdrop { position: fixed; inset: 0; z-index: 80; visibility: hidden; opacity: 0; background: rgba(7, 8, 35, 0.36); transition: 180ms ease; }
.sheet-backdrop.is-open { visibility: visible; opacity: 1; }
.order-sheet { position: fixed; inset: 0 0 0 auto; z-index: 90; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; width: min(460px, 100vw); visibility: hidden; background: #ffffff; box-shadow: -22px 0 54px rgba(18, 27, 49, 0.2); transform: translateX(102%); transition: 220ms ease; }
.order-sheet.is-open { visibility: visible; transform: translateX(0); }
.sheet-handle { display: none; }
.order-sheet header, .action-modal header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.order-sheet header span, .action-modal header span { color: var(--blue); font-size: 11px; font-weight: 900; }
.order-sheet h2, .action-modal h2 { margin: 4px 0 0; font-size: 21px; letter-spacing: 0; }
.sheet-body { min-height: 0; padding: 20px 22px; overflow-y: auto; }
.sheet-summary { display: grid; gap: 8px; padding: 17px; border-radius: 8px; background: var(--sky); }
.sheet-summary strong { font-size: 17px; }
.sheet-summary p { margin: 0; color: var(--muted); font-size: 11px; }
.sheet-section { padding: 19px 0; border-bottom: 1px solid var(--line); }
.sheet-section h3 { margin: 0 0 13px; font-size: 14px; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.detail-grid div { display: grid; gap: 5px; }
.detail-grid span { color: var(--muted); font-size: 10px; }
.detail-grid strong { font-size: 12px; line-height: 1.55; }
.service-timeline { display: grid; }
.service-timeline > div { position: relative; display: grid; grid-template-columns: 12px minmax(0, 1fr); gap: 10px; padding-bottom: 17px; }
.service-timeline > div::before { content: ""; position: absolute; top: 11px; bottom: 0; left: 5px; width: 1px; background: #d8dfe3; }
.service-timeline > div:last-child::before { display: none; }
.service-timeline i { position: relative; z-index: 1; width: 11px; height: 11px; margin-top: 3px; border: 3px solid #ffffff; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
.service-timeline p { display: grid; gap: 4px; margin: 0; font-size: 12px; }
.service-timeline small, .service-timeline > span { color: var(--muted); font-size: 10px; }
.order-sheet footer { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; padding: 14px 22px; border-top: 1px solid var(--line); }
.order-sheet footer button { flex: 1; }

.action-modal { width: min(610px, calc(100vw - 28px)); max-height: calc(100vh - 32px); padding: 0; overflow: hidden; border: 0; border-radius: 8px; background: #ffffff; box-shadow: 0 26px 70px rgba(12, 18, 42, 0.24); }
.action-modal::backdrop { background: rgba(7, 8, 35, 0.4); backdrop-filter: blur(2px); }
.action-modal form { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; max-height: calc(100vh - 32px); }
.modal-body { display: grid; gap: 16px; padding: 22px; overflow-y: auto; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.action-modal footer { display: flex; justify-content: flex-end; gap: 10px; padding: 15px 22px; border-top: 1px solid var(--line); }

.companion-toast { position: fixed; right: 22px; bottom: 22px; z-index: 140; display: flex; align-items: center; gap: 9px; min-width: 230px; padding: 14px 16px; visibility: hidden; opacity: 0; transform: translateY(10px); border-radius: 7px; color: #ffffff; background: var(--navy-2); box-shadow: var(--shadow); font-weight: 800; transition: 180ms ease; }
.companion-toast.is-visible { visibility: visible; opacity: 1; transform: translateY(0); }
.companion-toast svg { color: var(--mint); }

.companion-activities-panel { margin-top: 20px; }
.activity-guide-mark { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 10px; color: #785a0d; border: 1px solid #f1df9f; background: var(--gold-soft); font-size: 10px; font-weight: 900; }
.activity-guide-mark svg { width: 14px; }
.companion-activity-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.companion-activity-card { display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; align-items: center; gap: 12px; min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: #ffffff; }
.activity-date { display: grid; place-items: center; min-height: 58px; border-radius: 7px; color: #785a0d; background: var(--gold-soft); }
.activity-date strong { font-size: 20px; }
.activity-date small { font-size: 9px; }
.companion-activity-card > div:nth-child(2) { display: grid; gap: 5px; min-width: 0; }
.companion-activity-card > div:nth-child(2) > span { color: var(--blue); font-size: 9px; font-weight: 900; }
.companion-activity-card h4 { margin: 0; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.companion-activity-card p { display: flex; align-items: center; gap: 5px; margin: 0; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.companion-activity-card p svg { flex: 0 0 auto; width: 12px; }
.companion-activity-card > div:nth-child(2) > small { color: var(--muted); font-size: 9px; }
.activity-roster { display: grid; justify-items: end; gap: 3px; }
.activity-roster strong { color: var(--navy); font-size: 17px; }
.activity-roster small { color: var(--muted); font-size: 8px; }
.activity-roster span { padding: 4px 6px; color: var(--success); border-radius: 4px; background: var(--mint-soft); font-size: 8px; font-weight: 900; }

@media (max-width: 1000px) {
  :root { --rail: 200px; }
  .companion-header, .companion-content { padding-left: 20px; padding-right: 20px; }
  .today-grid, .performance-grid { grid-template-columns: 1fr; }
  .companion-activity-list { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  :root { --header: 64px; }
  body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
  .companion-auth { grid-template-columns: 1fr; align-content: start; overflow-y: auto; background: var(--canvas); }
  .auth-visual { min-height: 230px; height: 32vh; }
  .auth-visual img { min-height: 230px; object-position: center 42%; }
  .auth-panel { width: min(520px, calc(100% - 28px)); padding: 24px 20px 32px; margin-top: -26px; border-radius: 8px; background: #ffffff; box-shadow: 0 16px 40px rgba(18, 27, 49, 0.12); }
  .auth-brand { margin-bottom: 26px; }
  .companion-rail { display: none; }
  .companion-workspace { margin-left: 0; }
  .companion-header { padding: 0 16px; }
  .header-context { display: none; }
  .mobile-brand { display: flex; align-items: center; gap: 8px; }
  .mobile-brand .brand-symbol { width: 36px; height: 36px; font-size: 19px; }
  .mobile-brand strong { font-size: 16px; }
  .companion-content { min-height: calc(100vh - 136px); padding: 20px 16px; }
  .profile-grid { grid-template-columns: 1fr; }
  .bottom-nav { position: fixed; right: 0; bottom: 0; left: 0; z-index: 50; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: end; min-height: calc(66px + env(safe-area-inset-bottom)); padding: 7px 8px calc(7px + env(safe-area-inset-bottom)); background: rgba(255, 255, 255, 0.97); border-top: 1px solid var(--line); box-shadow: 0 -10px 28px rgba(18, 27, 49, 0.08); backdrop-filter: blur(14px); }
  .bottom-nav > button:not(.incident-fab) { display: grid; gap: 3px; min-height: 51px; place-items: center; color: #7a8291; background: transparent; font-size: 10px; cursor: pointer; }
  .bottom-nav > button:not(.incident-fab).is-active { color: var(--navy); }
  .incident-fab { display: grid; align-self: start; width: 54px; height: 54px; margin: -22px auto 0; place-items: center; border: 5px solid #ffffff; border-radius: 50%; color: #ffffff; background: var(--coral); box-shadow: 0 8px 18px rgba(243, 111, 95, 0.28); cursor: pointer; }
  .incident-fab svg { width: 22px; height: 22px; }
  .companion-toast { right: 14px; bottom: calc(84px + env(safe-area-inset-bottom)); left: 14px; min-width: 0; }
}

@media (max-width: 560px) {
  .auth-visual { min-height: 205px; height: 28vh; }
  .auth-visual img { min-height: 205px; }
  .auth-copy h1 { font-size: 29px; }
  .companion-header { padding: 0 12px; }
  .header-actions { gap: 6px; }
  .availability-button { padding: 0 9px; }
  .availability-button b { font-size: 11px; }
  .companion-header .icon-button { display: none; }
  .companion-content { padding: 18px 14px 24px; }
  .view-heading { align-items: flex-start; gap: 12px; }
  .view-heading h2 { font-size: 23px; }
  .view-heading .secondary-button, .view-heading .primary-button { padding: 0 12px; font-size: 11px; }
  .metric-strip, .performance-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-strip article, .performance-strip article { padding: 16px 13px; }
  .metric-strip article:nth-child(2)::after, .performance-strip article:nth-child(2)::after { display: none; }
  .metric-strip article:nth-child(-n + 2), .performance-strip article:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }
  .metric-strip strong, .performance-strip strong { font-size: 22px; }
  .active-service { grid-template-columns: 1fr; }
  .active-copy { padding: 22px 18px; }
  .active-copy h3 { font-size: 21px; }
  .active-meta { gap: 7px; }
  .active-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 14px 18px 20px; }
  .work-panel { padding: 17px; }
  .schedule-item { grid-template-columns: 53px minmax(0, 1fr) auto; gap: 9px; }
  .segments { display: flex; overflow-x: auto; }
  .segments button { flex: 0 0 auto; }
  .order-card { grid-template-columns: 58px minmax(0, 1fr) auto; gap: 10px; padding: 13px; }
  .order-date { min-height: 60px; }
  .order-date strong { font-size: 19px; }
  .order-side .status { padding: 0 7px; }
  .incident-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .incident-summary > p { grid-column: 1 / -1; }
  .service-chart { gap: 6px; padding-left: 4px; padding-right: 4px; }
  .profile-hero { grid-template-columns: 58px minmax(0, 1fr) 38px; gap: 13px; padding: 20px 16px; }
  .large-avatar { width: 58px; height: 58px; font-size: 21px; }
  .profile-hero h2 { font-size: 21px; }
  .order-sheet { top: auto; width: 100%; max-height: calc(92vh - env(safe-area-inset-bottom)); border-radius: 8px 8px 0 0; transform: translateY(102%); }
  .order-sheet.is-open { transform: translateY(0); }
  .sheet-handle { display: block; width: 42px; height: 5px; margin: 8px auto 0; border-radius: 3px; background: #cfd5d9; }
  .order-sheet header { padding: 12px 16px 16px; }
  .sheet-body { padding: 18px 16px; }
  .order-sheet footer { padding: 13px 16px calc(15px + env(safe-area-inset-bottom)); }
  .action-modal { width: calc(100vw - 18px); max-height: calc(100vh - 18px); }
  .action-modal form { max-height: calc(100vh - 18px); }
  .action-modal header, .modal-body, .action-modal footer { padding-left: 16px; padding-right: 16px; }
  .form-row { grid-template-columns: 1fr; }
}

@media (display-mode: standalone) {
  .companion-header { padding-top: env(safe-area-inset-top); min-height: calc(var(--header) + env(safe-area-inset-top)); }
}
.privacy-call,
.privacy-pending {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid #bfe7d8;
  border-radius: 8px;
  color: #165f4d;
  background: #effaf6;
  text-decoration: none;
}

.privacy-pending {
  color: #667085;
  border-color: #dfe3ea;
  background: #f7f8fa;
}
