:root {
  --bg: #f5f6f7;
  --surface: #ffffff;
  --surface-strong: #f4f6f7;
  --ink: #1f2930;
  --muted: #66737a;
  --line: #e1e6e8;
  --line-strong: #cbd4d7;
  --accent: #0b7a75;
  --accent-dark: #075f5b;
  --accent-soft: #e2f5f3;
  --theme-tint: rgba(11, 122, 117, 0.08);
  --blue: #2563eb;
  --blue-soft: #e9f0ff;
  --rose: #be123c;
  --rose-soft: #ffe8ee;
  --amber: #a16207;
  --amber-soft: #fff2cc;
  --green: #15803d;
  --green-soft: #e6f6ec;
  --shadow: 0 14px 36px rgba(23, 34, 39, 0.07);
  --shadow-soft: 0 1px 2px rgba(23, 34, 39, 0.05), 0 12px 30px rgba(23, 34, 39, 0.06);
  --radius: 8px;
  --radius-sm: 6px;
  --sidebar: 252px;
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78) 0%, rgba(245, 246, 247, 0) 320px),
    var(--bg);
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.92), rgba(17, 24, 39, 0.92)),
    #152326;
}

.login-screen[hidden] {
  display: none;
}

.login-card {
  display: grid;
  gap: 15px;
  width: min(410px, 100%);
  padding: 28px;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.26);
}

.login-card h1 {
  margin: 4px 0 0;
  font-size: 24px;
}

.login-card p {
  margin: 0 0 6px;
  color: var(--muted);
}

.login-error {
  min-height: 20px;
  color: var(--rose);
  font-size: 13px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  background: linear-gradient(180deg, #172325 0%, #111b1d 100%);
  color: #e9f4f2;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 24px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  color: #0d2b28;
  background: #9ae6dc;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-title {
  font-size: 15px;
  font-weight: 760;
  line-height: 1.25;
}

.brand-subtitle {
  margin-top: 2px;
  color: #a8b8b7;
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 4px;
}

.nav-item {
  display: grid;
  grid-template-columns: 24px 1fr;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 8px;
  color: #b8c8c6;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.nav-item[hidden] {
  display: none;
}

.nav-item:hover,
.nav-item:focus-visible {
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff;
  outline: 0;
}

.nav-item.is-active {
  background: rgba(255, 255, 255, 0.09);
  color: #ffffff;
  box-shadow: inset 3px 0 0 #7ddbd0;
}

.nav-icon {
  width: 24px;
  color: #8fb8b3;
  text-align: center;
  font-size: 15px;
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px 8px 0;
}

.main {
  min-width: 0;
  padding: 24px 32px 42px;
}

.site-footer {
  padding: 18px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.site-footer a {
  color: inherit;
  text-decoration: none;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  color: var(--accent-dark);
  text-decoration: underline;
  outline: 0;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  min-height: 58px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.18;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 14px;
  font-size: 18px;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 15px;
  letter-spacing: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.compact-button {
  height: 34px;
  padding: 0 12px;
}

.user-pill {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-pill {
  display: inline-flex;
  align-items: center;
  height: 42px;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.9);
  color: #26363b;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(23, 34, 39, 0.04);
}

.topbar-exit {
  cursor: pointer;
}

.topbar-exit:hover,
.topbar-exit:focus-visible {
  border-color: var(--accent);
  color: var(--accent-dark);
  outline: 0;
}

.store-pill,
.chip,
.status {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.store-pill {
  box-shadow: 0 1px 2px rgba(23, 34, 39, 0.04);
}

.store-switcher {
  gap: 8px;
  padding-right: 14px;
}

.store-switcher label {
  display: none;
  color: var(--muted);
  font-size: 12px;
}

.store-switcher .shell-smart-select {
  min-width: 168px;
  height: 100%;
  margin: 0;
}

.store-switcher .smart-select-input {
  min-width: 148px;
  height: 40px;
  border: 0;
  color: var(--ink);
  background: transparent;
  font-weight: 700;
  outline: 0;
}

.certificate-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

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

.certificate-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 6px;
  background: var(--surface-strong);
}

.certificate-card strong,
.certificate-card span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.certificate-card span {
  color: var(--muted);
  font-size: 12px;
}

.shell-smart-select .smart-select-input:disabled {
  cursor: default;
  opacity: 1;
  color: var(--ink);
  -webkit-text-fill-color: var(--ink);
}

.chip {
  background: var(--surface-strong);
  color: #334246;
}

.status.success {
  border-color: #b8e0c6;
  background: var(--green-soft);
  color: var(--green);
}

.status.warn {
  border-color: #eed48e;
  background: var(--amber-soft);
  color: var(--amber);
}

.status.danger {
  border-color: #f2b4c3;
  background: var(--rose-soft);
  color: var(--rose);
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
  white-space: nowrap;
}

.primary-button {
  padding: 0 15px;
  color: #ffffff;
  background: var(--accent);
  box-shadow: 0 8px 20px rgba(11, 122, 117, 0.16);
}

.primary-button:hover {
  background: var(--accent-dark);
}

.secondary-button,
.ghost-button {
  padding: 0 13px;
  border: 1px solid var(--line);
  color: #223034;
  background: var(--surface);
}

.ghost-button {
  background: transparent;
}

.danger-button {
  padding: 0 13px;
  color: #ffffff;
  background: var(--rose);
}

.icon-button {
  width: 38px;
  color: #263438;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 18px;
}

.primary-button:active,
.secondary-button:active,
.ghost-button:active,
.danger-button:active,
.icon-button:active {
  transform: translateY(1px);
}

.content {
  display: grid;
  gap: 18px;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

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

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff 0%, #fbfcfc 100%);
}

.panel-title {
  margin: 0;
  font-size: 16px;
  line-height: 1.25;
}

.panel-subtitle {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.panel-body {
  padding: 18px;
}

.metric-card {
  min-height: 116px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.metric-card:hover {
  border-color: #cdd9dc;
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.metric-label {
  color: var(--muted);
  font-size: 13px;
}

.metric-value {
  margin-top: 12px;
  font-size: 28px;
  line-height: 1;
  font-weight: 780;
}

.metric-foot {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.hero-briefing-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(224px, 260px);
  gap: 12px;
  align-items: stretch;
}

.hero-banner {
  position: relative;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  min-height: 188px;
  overflow: hidden;
  border-radius: 8px;
  background-color: #142225;
  box-shadow: var(--shadow-soft);
}

.hero-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(90deg, rgba(10, 20, 23, 0.76) 0%, rgba(10, 20, 23, 0.5) 46%, rgba(10, 20, 23, 0.14) 100%),
    linear-gradient(180deg, rgba(10, 20, 23, 0.02), rgba(10, 20, 23, 0.22));
}

.hero-backdrop {
  position: absolute;
  inset: -16px;
  z-index: 0;
  background-image: var(--hero-image);
  background-position: center;
  background-size: cover;
  filter: blur(8px) saturate(1.08);
  transform: scale(1.04);
}

.hero-image-probe {
  display: none;
}

.hero-copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: min(620px, 72%);
  padding: 23px 28px;
  color: #ffffff;
}

.hero-info-card {
  position: absolute;
  top: 26px;
  right: 26px;
  z-index: 2;
  display: grid;
  gap: 10px;
  width: 218px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  color: #ffffff;
  background: rgba(10, 18, 20, 0.34);
  backdrop-filter: blur(14px);
}

.hero-info-card > div {
  display: grid;
  gap: 3px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.hero-info-card > div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.hero-info-label {
  color: rgba(255, 255, 255, 0.64);
  font-size: 12px;
}

.hero-info-card strong {
  font-size: 22px;
  line-height: 1.1;
}

.hero-info-card p {
  margin: 0;
  color: rgba(255, 255, 255, 0.74);
  font-size: 12px;
}

.briefing-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  align-items: stretch;
  min-height: 188px;
  box-shadow: var(--shadow-soft);
}

.briefing-date,
.briefing-weather {
  display: grid;
  gap: 6px;
  min-height: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.briefing-date {
  grid-template-columns: minmax(0, 1fr);
  align-content: center;
}

.briefing-weather {
  align-content: space-between;
}

.moji-weather-plugin {
  border-color: #cfe4de;
}

.briefing-date span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.briefing-date strong,
.briefing-weather strong {
  font-size: 20px;
  line-height: 1.05;
}

.briefing-date p,
.briefing-weather p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.weather-city-field {
  display: grid;
  gap: 6px;
}

.weather-city-field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.weather-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.weather-card-head span {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.weather-plugin-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.weather-plugin-link:hover,
.weather-plugin-link:focus-visible {
  border-color: var(--accent);
  outline: 0;
}

.weather-city-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px;
  gap: 6px;
  align-items: center;
}

.weather-city-row input {
  min-width: 0;
}

.report-result-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.report-result-card {
  display: grid;
  gap: 8px;
  min-height: 112px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f7faf9 100%);
}

.report-result-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.report-result-card strong {
  font-size: 22px;
  line-height: 1.1;
}

.report-result-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.performance-trend {
  margin: 14px 0;
}

.trend-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-size: 22px;
  font-weight: 800;
}

.trend-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.6fr);
  gap: 16px;
  align-items: stretch;
}

.trend-chart-wrap {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f7faf9 100%);
}

.trend-sparkline {
  display: block;
  width: 100%;
  height: 210px;
}

.trend-area {
  fill: var(--theme-tint);
}

.trend-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.trend-dot {
  fill: #ffffff;
  stroke: var(--accent-dark);
  stroke-width: 2.5;
}

.trend-label {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.trend-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.trend-kpi {
  display: grid;
  align-content: center;
  gap: 8px;
  min-height: 92px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.trend-kpi span {
  color: #536267;
  font-size: 12px;
  font-weight: 750;
}

.trend-kpi strong {
  color: var(--ink);
  font-size: 20px;
  line-height: 1.1;
}

.nested-form {
  margin: 0;
}

.hero-copy h2 {
  margin: 0 0 8px;
  max-width: 620px;
  font-size: 25px;
  line-height: 1.14;
  letter-spacing: 0;
}

.hero-copy p {
  max-width: 620px;
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 14px;
  line-height: 1.65;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.hero-ghost,
.hero-icon,
.hero-dot {
  cursor: pointer;
}

.hero-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border-radius: 8px;
  padding: 0 14px;
}

.hero-ghost {
  border: 1px solid rgba(255, 255, 255, 0.32);
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.hero-image-credit {
  position: absolute;
  right: 22px;
  top: 18px;
  z-index: 2;
  padding: 5px 8px;
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.72);
  background: rgba(10, 18, 20, 0.22);
  font-size: 11px;
}

.hero-controls {
  position: absolute;
  right: 22px;
  bottom: 18px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 999px;
  background: rgba(10, 18, 20, 0.38);
  backdrop-filter: blur(10px);
}

.hero-icon {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.15);
  font-size: 24px;
  line-height: 1;
}

.hero-dots {
  display: flex;
  align-items: center;
  gap: 7px;
}

.hero-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.42);
}

.hero-dot.is-active {
  width: 24px;
  background: #9ae6dc;
}

.workbench-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 16px;
}

.quick-panel .panel-body {
  display: grid;
  gap: 14px;
}

.next-appointment {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid #cde5e1;
  border-radius: 8px;
  background: linear-gradient(180deg, #f5fffd, #edf8f5);
}

.next-appointment span {
  color: var(--muted);
  font-size: 12px;
}

.next-appointment strong {
  font-size: 14px;
}

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

.quick-action {
  display: grid;
  grid-template-columns: 34px 1fr;
  grid-template-areas:
    "icon title"
    "icon desc";
  align-items: center;
  min-height: 88px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
  text-align: left;
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.quick-action:hover,
.quick-action:focus-visible {
  border-color: #b9d9d5;
  background: #ffffff;
  box-shadow: 0 14px 34px rgba(24, 36, 40, 0.08);
  outline: 0;
  transform: translateY(-1px);
}

.quick-action.primary {
  border-color: #8bd9cf;
  background: #effcf9;
}

.quick-icon {
  grid-area: icon;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: #0f5d56;
  background: var(--accent-soft);
  font-weight: 800;
}

.quick-action strong {
  grid-area: title;
  font-size: 14px;
}

.quick-action span:last-child {
  grid-area: desc;
  color: var(--muted);
  font-size: 12px;
}

.appointment-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}

.appointment-strip.is-empty {
  display: block;
}

.appointment-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.board-column {
  min-width: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fafa;
}

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

.board-column-head span {
  display: grid;
  place-items: center;
  min-width: 26px;
  height: 24px;
  border-radius: 999px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 750;
}

.board-list {
  display: grid;
  gap: 10px;
  min-height: 128px;
  padding: 10px;
}

.board-card {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid #dce6e5;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(24, 36, 40, 0.06);
}

.board-card-time,
.board-card p,
.board-card-foot {
  color: var(--muted);
  font-size: 12px;
}

.board-card p {
  margin: 0;
}

.board-card-foot,
.board-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.board-card-actions {
  justify-content: flex-end;
}

.board-empty {
  display: grid;
  place-items: center;
  min-height: 82px;
  border: 1px dashed #cbd8d6;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
}

.banner-editor {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.banner-editor + .banner-editor {
  margin-top: 14px;
}

.banner-editor-head,
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.banner-editor-head {
  margin-bottom: 14px;
}

.switch-row {
  justify-content: flex-start;
  color: var(--muted);
  font-size: 13px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.search {
  position: relative;
  flex: 1 1 280px;
}

.search input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 0 12px;
  color: var(--ink);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
  outline: 0;
}

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

.form-grid.one {
  grid-template-columns: 1fr;
}

.field {
  display: grid;
  gap: 7px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  color: #38474b;
  font-size: 13px;
  font-weight: 650;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 0 11px;
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.field input,
.field select {
  height: 40px;
}

.smart-select-field {
  position: relative;
}

.smart-select-input {
  padding-right: 34px !important;
  background:
    linear-gradient(45deg, transparent 50%, #6b7479 50%) right 17px center / 6px 6px no-repeat,
    linear-gradient(135deg, #6b7479 50%, transparent 50%) right 11px center / 6px 6px no-repeat,
    #ffffff;
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.smart-select-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
  outline: 0;
}

.smart-select-input.is-invalid {
  border-color: var(--rose);
  background-color: #fff8fa;
}

.smart-select-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 40;
  max-height: 240px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.smart-select-option {
  display: block;
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.smart-select-option:hover,
.smart-select-option:focus-visible {
  background: var(--accent-soft);
  outline: 0;
}

.smart-select-empty {
  padding: 10px;
  color: var(--muted);
  font-size: 13px;
}

.field textarea {
  min-height: 88px;
  padding-top: 10px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(11, 122, 117, 0.11);
  outline: 0;
}

#templateForm textarea {
  min-height: 138px;
  line-height: 1.55;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
}

th {
  color: #4f5f66;
  background: #f8fafb;
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 1;
}

tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: #f7fbfa;
}

.table-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.link-button {
  color: var(--accent);
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.link-button.danger {
  color: var(--rose);
}

.code-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border: 1px solid #d7e2e1;
  border-radius: 6px;
  color: #173b38;
  background: #f3fbf9;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
}

.code-pill.muted {
  color: #536267;
  background: #f7f9f9;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 16px;
}

.customer-profile {
  display: grid;
  gap: 16px;
  color: #172126;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

.customer-hero {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(135deg, var(--theme-tint), rgba(255, 255, 255, 0.86)),
    #ffffff;
}

.customer-avatar {
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  border-radius: 18px;
  color: #ffffff;
  background: var(--accent);
  font-size: 30px;
  font-weight: 800;
}

.customer-hero-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.customer-hero-title h2 {
  margin: 0;
  font-size: 24px;
}

.customer-hero p {
  margin: 6px 0 12px;
  color: #4f5d63;
}

.customer-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.customer-stat {
  display: grid;
  gap: 8px;
  min-height: 104px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.customer-stat span {
  color: #4f5d63;
  font-size: 12px;
  font-weight: 700;
}

.customer-stat strong {
  font-size: 22px;
  line-height: 1.1;
}

.customer-stat p {
  margin: 0;
  color: #536267;
  font-size: 12px;
}

.customer-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 14px;
}

.customer-detail-grid.lower {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.customer-section {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-heading h3 {
  margin: 0;
  font-size: 16px;
}

.section-heading p {
  margin: 0;
  color: #536267;
  font-size: 12px;
}

.subsection-title {
  margin: 16px 0 10px;
}

.summary-list.compact {
  gap: 0;
}

.treatment-timeline {
  position: relative;
  display: grid;
  gap: 12px;
}

.treatment-timeline::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 8px;
  width: 2px;
  background: var(--line);
}

.treatment-item {
  position: relative;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 12px;
}

.treatment-marker {
  position: relative;
  z-index: 1;
  width: 18px;
  height: 18px;
  margin-top: 12px;
  border: 4px solid var(--accent-soft);
  border-radius: 999px;
  background: var(--accent);
}

.treatment-card {
  display: grid;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfd;
}

.treatment-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.treatment-card-head div {
  display: grid;
  gap: 4px;
}

.treatment-card-head span,
.treatment-meta,
.treatment-card p {
  color: #536267;
  font-size: 12px;
}

.treatment-card-head strong {
  font-size: 15px;
}

.treatment-card-head em {
  color: var(--accent-dark);
  font-style: normal;
  font-weight: 800;
}

.treatment-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.treatment-meta span {
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--surface-strong);
}

.treatment-card p {
  margin: 0;
  line-height: 1.55;
}

.detail-table table {
  min-width: 640px;
}

.customer-mini-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.summary-list {
  display: grid;
  gap: 10px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  color: #536267;
  font-size: 13px;
}

.summary-row:last-child {
  border-bottom: 0;
}

.summary-row strong {
  color: var(--ink);
  font-weight: 700;
  text-align: right;
}

.timeline {
  display: grid;
  gap: 12px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 12px 1fr;
  gap: 12px;
}

.timeline-dot {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.timeline-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.timeline-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.relationship-board {
  min-height: 440px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 18% 20%, rgba(11, 122, 117, 0.08), transparent 28%),
    linear-gradient(180deg, #fbfdfd, #f5f8f8);
  padding: 30px;
}

.relation-summary-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.relation-summary-bar span {
  min-height: 34px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #ffffff;
  font-size: 12px;
}

.relation-summary-bar strong {
  color: var(--ink);
}

.tree {
  display: flex;
  justify-content: center;
  min-width: max-content;
}

.tree ul {
  position: relative;
  display: flex;
  justify-content: center;
  padding-top: 30px;
  margin: 0;
  list-style: none;
}

.tree li {
  position: relative;
  padding: 30px 12px 0;
  text-align: center;
}

.tree li::before,
.tree li::after {
  content: "";
  position: absolute;
  top: 0;
  width: 50%;
  height: 30px;
  border-top: 1px solid #bdd0ce;
}

.tree li::before {
  right: 50%;
}

.tree li::after {
  left: 50%;
  border-left: 1px solid #bdd0ce;
}

.tree li:only-child::before,
.tree li:only-child::after {
  display: none;
}

.tree li:first-child::before,
.tree li:last-child::after {
  border: 0;
}

.tree li:last-child::before {
  border-right: 1px solid #bdd0ce;
  border-radius: 0 6px 0 0;
}

.tree li:first-child::after {
  border-radius: 6px 0 0 0;
}

.tree ul ul::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 0;
  height: 30px;
  border-left: 1px solid #bdd0ce;
}

.person-node {
  display: inline-grid;
  min-width: 168px;
  gap: 5px;
  padding: 13px 14px;
  border: 1px solid #c7d6d4;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}

.person-node:hover,
.person-node:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 18px 42px rgba(22, 33, 35, 0.12);
  outline: 0;
  transform: translateY(-1px);
}

.person-node.is-root {
  border-color: var(--accent);
  background: linear-gradient(180deg, #f1fffc, #dff5f1);
}

.node-topline {
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 800;
}

.node-name {
  color: var(--ink);
  font-weight: 750;
}

.node-meta {
  color: var(--muted);
  font-size: 12px;
}

.badge-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.mini-card-list {
  display: grid;
  gap: 10px;
}

.mini-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfc;
}

.mini-card strong {
  display: block;
  margin-bottom: 3px;
}

.mini-card span {
  color: var(--muted);
  font-size: 12px;
}

.role-card,
.check-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.role-card {
  min-height: 132px;
  padding: 16px;
}

.role-card strong,
.check-item strong {
  display: block;
  margin-bottom: 6px;
}

.role-card p,
.check-item p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.settings-checklist {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.check-item {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  padding: 14px;
}

.check-item > span {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  color: #ffffff;
  background: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

.bar-chart {
  display: grid;
  gap: 12px;
}

.report-filter {
  margin-bottom: 14px;
}

.compact-form {
  align-items: end;
}

.report-range-actions {
  align-self: end;
}

.bar-row {
  display: grid;
  grid-template-columns: 120px 1fr 80px;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}

.bar-track {
  height: 12px;
  border-radius: 999px;
  background: #e9eeee;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 220px;
  padding: 32px;
  color: var(--muted);
  text-align: center;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--surface-strong);
  color: #536267;
  font-size: 20px;
}

.empty-state h3 {
  margin-bottom: 0;
  color: var(--ink);
}

.empty-state p {
  margin: 0;
  max-width: 440px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: block;
  padding: 24px;
  background: rgba(16, 26, 28, 0.46);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  position: fixed;
  left: max(24px, calc((100vw - min(900px, calc(100vw - 48px))) / 2));
  top: max(24px, calc((100vh - min(88vh, 920px)) / 2));
  width: min(900px, calc(100vw - 48px));
  max-height: min(88vh, 920px);
  overflow: auto;
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.24);
  transform: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

.modal.is-dragging {
  user-select: none;
}

.modal-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  cursor: move;
}

.modal-header h2 {
  margin: 0;
}

#modalBody {
  padding: 20px;
}

.print-document {
  display: grid;
  gap: 14px;
  color: #172023;
}

.print-document h2 {
  margin: 0;
  text-align: center;
}

.print-subtitle {
  margin: 0;
  color: var(--muted);
  text-align: center;
}

.print-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
}

.print-block {
  display: grid;
  gap: 8px;
}

.print-block h3 {
  margin: 0;
  font-size: 15px;
}

.receipt-share {
  display: grid;
  gap: 16px;
}

.receipt-share-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.receipt-page {
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(245, 246, 247, 0)),
    var(--bg);
}

.receipt-shell {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.receipt-card {
  display: grid;
  gap: 16px;
  width: min(560px, 100%);
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 24px 80px rgba(23, 34, 39, 0.12);
}

.receipt-card h1 {
  margin: 0;
  font-size: 26px;
}

.receipt-card p {
  margin: 0;
  color: var(--muted);
}

.receipt-status {
  width: fit-content;
  min-height: 28px;
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--amber);
  background: var(--amber-soft);
  font-size: 13px;
  font-weight: 800;
}

.receipt-status.success {
  color: var(--green);
  background: var(--green-soft);
}

.receipt-status.danger {
  color: var(--rose);
  background: var(--rose-soft);
}

.receipt-summary {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.receipt-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.receipt-row:last-child {
  border-bottom: 0;
}

.receipt-row strong {
  color: var(--ink);
  text-align: right;
}

.receipt-form {
  display: grid;
  gap: 10px;
}

.receipt-form label {
  color: #38474b;
  font-size: 13px;
  font-weight: 700;
}

.receipt-form input,
.receipt-form textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 10px 11px;
}

.receipt-form textarea {
  min-height: 88px;
  resize: vertical;
}

.receipt-done {
  padding: 13px;
  border-radius: 8px;
  color: var(--green);
  background: var(--green-soft);
  font-weight: 700;
}

.print-block p {
  min-height: 72px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  line-height: 1.7;
}

.signature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line-strong);
}

@media print {
  body * {
    visibility: hidden;
  }

  .modal,
  .modal * {
    visibility: visible;
  }

  .modal {
    position: absolute;
    inset: 0;
    width: auto;
    max-height: none;
    box-shadow: none;
    border-radius: 0;
  }

  .modal-header,
  .form-actions {
    display: none !important;
  }
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  min-width: 260px;
  max-width: 420px;
  padding: 13px 15px;
  border-radius: 8px;
  color: #ffffff;
  background: #1b2b2d;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.18);
}

.json-box {
  width: 100%;
  min-height: 220px;
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #111819;
  color: #d8fffb;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
}

.hidden {
  display: none !important;
}

@media (max-width: 1120px) {
  .hero-briefing-layout {
    grid-template-columns: 1fr;
  }

  .workbench-grid,
  .settings-checklist {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .briefing-panel,
  .report-result-grid,
  .trend-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .grid.cols-3,
  .detail-layout,
  .customer-detail-grid,
  .customer-detail-grid.lower,
  .customer-mini-grid {
    grid-template-columns: 1fr;
  }

  .customer-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 14px;
  }

  .brand {
    padding-bottom: 12px;
  }

  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sidebar-footer {
    padding: 12px 0 0;
  }

  .main {
    padding: 20px 16px 32px;
  }

  .topbar {
    display: grid;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .grid.cols-2,
  .grid.cols-4 {
    grid-template-columns: 1fr;
  }

  .workbench-grid,
  .settings-checklist,
  .report-result-grid,
  .trend-layout,
  .trend-kpi-grid {
    grid-template-columns: 1fr;
  }

  .quick-grid {
    grid-template-columns: 1fr;
  }

  .customer-hero {
    grid-template-columns: 1fr;
  }

  .customer-stat-grid {
    grid-template-columns: 1fr;
  }

  .appointment-board {
    grid-template-columns: repeat(4, minmax(240px, 1fr));
  }

  .hero-banner {
    min-height: 300px;
  }

  .hero-copy {
    width: 100%;
    padding: 28px 22px 82px;
  }

  .hero-copy h2 {
    font-size: 27px;
  }

  .hero-controls {
    right: 16px;
    bottom: 16px;
    left: 16px;
    justify-content: space-between;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .bar-row {
    grid-template-columns: 1fr;
  }
}

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

  .panel-header,
  .toolbar,
  .mini-card,
  .next-appointment {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-button,
  .secondary-button,
  .ghost-button,
  .danger-button {
    width: 100%;
  }

  .modal-backdrop {
    padding: 8px;
  }

  .modal {
    left: 8px;
    top: 8px;
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
  }
}
