:root {
  color-scheme: light;
  --bg: #eef4f1;
  --app-bg: #eef4f1;
  --panel: rgba(255, 255, 255, .92);
  --panel-solid: #ffffff;
  --ink: #202225;
  --muted: #6b7471;
  --line: #dce6e1;
  --accent: #1f7a70;
  --accent-strong: #155b53;
  --gold: #b9852b;
  --rose: #b84c5a;
  --blue: #3b6ea8;
  --green: #2f7d4f;
  --sidebar-bg: linear-gradient(180deg, #123d39 0%, #0f302d 100%);
  --sidebar-ink: rgba(255, 255, 255, .8);
  --sidebar-active: rgba(255, 255, 255, .13);
  --brand-mark-bg: linear-gradient(145deg, #f6dd99, #f0bf59);
  --field-bg: rgba(255, 255, 255, .96);
  --shadow: 0 18px 45px rgba(31, 57, 51, 0.10);
  --soft-shadow: 0 8px 22px rgba(31, 57, 51, 0.08);
}

body[data-theme="clinic"] {
  --bg: #eef4f1;
  --app-bg:
    radial-gradient(circle at 24% 12%, rgba(31, 122, 112, .12), transparent 32%),
    radial-gradient(circle at 88% 8%, rgba(185, 133, 43, .10), transparent 28%),
    linear-gradient(135deg, #f6f5f0 0%, #eaf3f0 58%, #f5f0e8 100%);
  --panel: rgba(255, 255, 255, .9);
  --panel-solid: #ffffff;
  --ink: #1f2826;
  --muted: #65716d;
  --line: #dce6df;
  --accent: #1f7a70;
  --accent-strong: #155b53;
  --gold: #b9852b;
  --rose: #b84c5a;
  --blue: #3d6f99;
  --green: #2f7d4f;
  --sidebar-bg: linear-gradient(180deg, #123d39 0%, #0f302d 100%);
  --sidebar-active: rgba(255, 255, 255, .14);
  --brand-mark-bg: linear-gradient(145deg, #f8df9e, #e9b953);
  --field-bg: rgba(255, 255, 255, .96);
  --shadow: 0 18px 45px rgba(31, 57, 51, .10);
  --soft-shadow: 0 8px 22px rgba(31, 57, 51, .08);
}

body[data-theme="crm"] {
  --bg: #edf0f2;
  --app-bg:
    linear-gradient(135deg, rgba(38, 72, 91, .10), transparent 34%),
    linear-gradient(315deg, rgba(38, 122, 104, .09), transparent 32%),
    #eef1f3;
  --panel: rgba(255, 255, 255, .94);
  --panel-solid: #ffffff;
  --ink: #20252b;
  --muted: #68717b;
  --line: #d8dee4;
  --accent: #267a68;
  --accent-strong: #1b5d50;
  --gold: #b8862e;
  --rose: #b34d5e;
  --blue: #356f9e;
  --green: #2e7c58;
  --sidebar-bg: linear-gradient(180deg, #232b33 0%, #151b21 100%);
  --sidebar-active: rgba(71, 178, 154, .18);
  --brand-mark-bg: linear-gradient(145deg, #7dd7c2, #2b8e7a);
  --field-bg: #fbfcfd;
  --shadow: 0 18px 42px rgba(22, 29, 36, .12);
  --soft-shadow: 0 8px 20px rgba(22, 29, 36, .08);
}

body[data-theme="crystal"] {
  --bg: #edf6f8;
  --app-bg:
    radial-gradient(circle at 18% 10%, rgba(55, 138, 190, .16), transparent 30%),
    radial-gradient(circle at 82% 2%, rgba(47, 159, 136, .14), transparent 28%),
    linear-gradient(135deg, #f6fbfb 0%, #e9f5f7 52%, #f7f4ef 100%);
  --panel: rgba(255, 255, 255, .74);
  --panel-solid: rgba(255, 255, 255, .94);
  --ink: #17272d;
  --muted: #63757b;
  --line: rgba(172, 202, 207, .72);
  --accent: #2b8f86;
  --accent-strong: #176a63;
  --gold: #b98435;
  --rose: #bd5871;
  --blue: #397ea8;
  --green: #2d855d;
  --sidebar-bg: linear-gradient(180deg, rgba(19, 64, 75, .96) 0%, rgba(22, 83, 79, .96) 100%);
  --sidebar-active: rgba(255, 255, 255, .18);
  --brand-mark-bg: linear-gradient(145deg, #bfefff, #69d0c3 58%, #f4d589);
  --field-bg: rgba(255, 255, 255, .82);
  --shadow: 0 22px 55px rgba(43, 111, 126, .14);
  --soft-shadow: 0 10px 24px rgba(43, 111, 126, .10);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--app-bg);
  color: var(--ink);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

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

button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-solid);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  transition: 0.18s ease;
}

button:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
  box-shadow: var(--soft-shadow);
}

button.primary {
  background:
    linear-gradient(180deg, rgba(255,255,255,.18), rgba(255,255,255,0) 42%),
    var(--accent);
  border-color: var(--accent);
  color: white;
  box-shadow: 0 10px 22px color-mix(in srgb, var(--accent) 24%, transparent);
}

button.ghost {
  width: 36px;
  min-height: 36px;
  padding: 0;
  background: transparent;
}

button.crystal-action {
  flex: 0 0 auto;
  min-width: 112px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(31, 122, 112, .36);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.78), rgba(255,255,255,.1) 38%),
    linear-gradient(180deg, #2ca395, #176b61);
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.62),
    inset 0 -7px 12px rgba(13, 76, 68, .3),
    0 8px 18px rgba(31, 122, 112, .22);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

button.crystal-action:hover {
  border-color: rgba(21, 91, 83, .52);
  color: #fff;
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.7),
    inset 0 -7px 12px rgba(13, 76, 68, .28),
    0 11px 22px rgba(31, 122, 112, .28);
}

button.crystal-action .icon {
  background: rgba(255,255,255,.22);
  color: #fff;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field-bg);
  color: var(--ink);
  outline: none;
}

textarea:focus,
input:focus,
select:focus {
  border-color: color-mix(in srgb, var(--accent) 58%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}

textarea {
  min-height: 132px;
  resize: vertical;
  padding: 12px;
  line-height: 1.7;
}

#quickCustomer {
  min-height: 72px;
}

input,
select {
  height: 42px;
  padding: 0 11px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

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

.login-panel {
  width: min(430px, 100%);
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.login-brand strong {
  display: block;
}

.login-brand span,
.login-panel p,
.login-demo {
  color: var(--muted);
  line-height: 1.55;
}

.login-panel h1 {
  margin: 0 0 6px;
  font-size: 28px;
}

.login-button {
  width: 100%;
  margin-top: 14px;
}

.login-error {
  min-height: 22px;
  margin-top: 10px;
  color: var(--rose);
  font-size: 13px;
}

.login-demo {
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 7%, var(--panel-solid));
  font-size: 13px;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 14px;
  background: var(--sidebar-bg);
  color: white;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  margin-bottom: 14px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--brand-mark-bg);
  color: #103632;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6), 0 10px 22px rgba(0,0,0,.16);
  overflow: hidden;
  font-weight: 800;
}

.brand-mark img,
.user-chip img,
.profile-avatar img,
.account-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand strong {
  display: block;
  font-size: 15px;
  line-height: 1.35;
}

.brand span {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.72);
}

nav {
  display: grid;
  gap: 5px;
}

nav button {
  width: 100%;
  justify-content: flex-start;
  border-color: transparent;
  background: transparent;
  color: var(--sidebar-ink);
}

nav button.active,
nav button:hover {
  background: var(--sidebar-active);
  color: white;
  box-shadow: none;
}

main {
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.topbar p {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 14px;
}

.topbar h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0;
}

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

.user-chip {
  min-height: 44px;
  padding: 5px 10px 5px 6px;
  background: var(--panel-solid);
  box-shadow: var(--soft-shadow);
}

.user-chip img,
.user-chip span {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--brand-mark-bg);
  color: #103632;
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
}

.user-chip strong {
  font-size: 13px;
}

.top-logout {
  min-height: 40px;
  padding: 0 12px;
  border-color: #ead8d8;
  background: linear-gradient(180deg, #fffafa, #f7eeee);
  color: #9f3247;
  box-shadow: 0 8px 20px rgba(117, 55, 55, .08);
  font-weight: 800;
}

.top-logout:hover {
  border-color: #d99aa6;
  background: #fff4f6;
}

.top-action-alert {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  min-height: 44px;
  padding: 6px 13px;
  border-radius: 8px;
  border: 1px solid var(--line);
  box-shadow: 0 10px 22px rgba(57, 47, 35, 0.08);
}

.top-action-alert .icon {
  flex: 0 0 auto;
}

.top-action-alert span,
.top-action-alert strong {
  line-height: 1.2;
}

.top-action-alert strong {
  font-size: 13px;
}

.top-action-alert.unpaid {
  background: #fff1f2;
  border-color: rgba(184, 76, 90, 0.32);
  color: #8d2637;
}

.top-action-alert.hot {
  background: #fff8e8;
  border-color: rgba(185, 133, 43, 0.36);
  color: #7a5415;
}

.top-action-alert.reminder {
  background: linear-gradient(180deg, #fff4f5, #ffe9ed);
  border-color: rgba(184, 76, 90, 0.46);
  color: #8d2637;
  box-shadow: 0 12px 28px rgba(184, 76, 90, 0.18);
}

.top-action-alert.reminder .icon {
  background: #b84c5a;
  color: #fff;
}

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

.grid.two {
  align-items: start;
}

.wide,
.metrics {
  grid-column: 1 / -1;
}

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

.card,
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.card {
  padding: 18px;
}

.stat {
  padding: 17px;
}

.stat-button {
  width: 100%;
  min-height: auto;
  display: block;
  text-align: left;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 10px;
}

.stat strong {
  display: block;
  font-size: 25px;
}

.stat.warm strong {
  color: var(--gold);
}

.stat.green strong {
  color: var(--green);
}

.stat.red strong {
  color: var(--rose);
}

.work-textarea {
  min-height: 154px;
  background: #fff;
}

.section-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.section-title h2 {
  margin: 0;
  font-size: 18px;
}

.section-title p,
.muted {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

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

.advice-list p,
.split-list p {
  margin: 0;
  padding: 12px;
  background: #f7f4ef;
  border: 1px solid var(--line);
  border-radius: 8px;
  line-height: 1.65;
}

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

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

.list-row > div {
  min-width: 0;
}

.list-row strong,
.list-row span {
  display: block;
}

.list-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-row span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  color: white;
  background: var(--blue);
  font-size: 12px;
}

.pill.高 {
  background: var(--rose);
}

.pill.中 {
  background: var(--gold);
}

.pill.低 {
  background: var(--green);
}

.calendar-strip,
.calendar-board,
.asset-grid,
.knowledge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

.calendar-strip .calendar-item,
.calendar-board .calendar-item,
.knowledge-grid article {
  padding: 14px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
}

.calendar-item {
  position: relative;
  min-width: 0;
  border-top: 4px solid var(--line) !important;
}

.calendar-item.color-red {
  border-top-color: var(--rose) !important;
  background: #fff8f8;
}

.calendar-item.color-gold {
  border-top-color: var(--gold) !important;
  background: #fffaf0;
}

.calendar-item.color-green {
  border-top-color: var(--green) !important;
  background: #f6fbf7;
}

.calendar-item.color-blue {
  border-top-color: var(--blue) !important;
  background: #f5f9ff;
}

.calendar-item.color-rose {
  border-top-color: #d66b7a !important;
  background: #fff7fa;
}

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

.calendar-top select {
  width: 82px;
  height: 30px;
  padding: 0 7px;
  border-radius: 7px;
  font-size: 12px;
}

.calendar-strip span,
.calendar-board span,
.knowledge-grid span {
  display: block;
  color: var(--accent);
  font-size: 13px;
  margin-bottom: 0;
}

.knowledge-grid span {
  margin-bottom: 8px;
}

.calendar-strip strong,
.calendar-board strong {
  display: block;
  font-size: 16px;
  margin-bottom: 8px;
}

.calendar-strip p,
.calendar-board p,
.knowledge-grid p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

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

.target-grid,
.work-log-form,
.summary-grid {
  display: grid;
  gap: 10px;
}

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

.work-log-form {
  grid-template-columns: 150px 1fr 100px 100px;
  margin-bottom: 10px;
}

.work-log-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.work-log-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.work-log-row div {
  min-width: 0;
}

.work-log-row strong,
.work-log-row span,
.work-log-row small {
  display: block;
}

.work-log-row span,
.work-log-row small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 12px;
}

.summary-grid div {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.summary-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 7px;
}

.summary-grid strong {
  display: block;
  font-size: 20px;
  color: var(--accent-strong);
}

.weekly-report {
  min-height: 280px;
  background: #fff;
}

.report-history {
  display: grid;
  gap: 12px;
}

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

.report-history.expanded {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.history-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.history-toolbar > span {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.report-history article {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.report-history span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 7px;
}

.report-history strong {
  display: block;
  margin-bottom: 8px;
}

.report-history p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.field span {
  white-space: nowrap;
}

.button-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.ui-theme-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.ui-theme-card {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  justify-content: start;
  min-height: 104px;
  padding: 13px;
  text-align: left;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  box-shadow: var(--soft-shadow);
}

.ui-theme-card.active {
  border-color: color-mix(in srgb, var(--accent) 62%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent), var(--soft-shadow);
}

.theme-preview {
  grid-row: 1 / span 2;
  width: 64px;
  height: 72px;
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 6px;
  padding: 7px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.5);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.72), 0 10px 18px rgba(0,0,0,.08);
}

.theme-preview i {
  display: block;
  border-radius: 5px;
}

.theme-preview i:first-child {
  grid-row: 1 / span 3;
}

.theme-preview.clinic {
  background: linear-gradient(135deg, #f9f5eb, #dcefe9);
}

.theme-preview.clinic i:first-child { background: #123d39; }
.theme-preview.clinic i:nth-child(2) { background: #ffffff; }
.theme-preview.clinic i:nth-child(3) { background: #1f7a70; }

.theme-preview.crm {
  background: linear-gradient(135deg, #eef1f3, #cfd8df);
}

.theme-preview.crm i:first-child { background: #1b2229; }
.theme-preview.crm i:nth-child(2) { background: #ffffff; }
.theme-preview.crm i:nth-child(3) { background: #267a68; }

.theme-preview.crystal {
  background: linear-gradient(135deg, #f8fdff, #cfebf0);
}

.theme-preview.crystal i:first-child { background: #16534f; }
.theme-preview.crystal i:nth-child(2) { background: rgba(255,255,255,.86); }
.theme-preview.crystal i:nth-child(3) { background: #2b8f86; }

.ui-theme-card strong {
  align-self: end;
  font-size: 16px;
}

.ui-theme-card small {
  align-self: start;
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.45;
}

.profile-editor {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.profile-avatar,
.account-avatar {
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: var(--brand-mark-bg);
  color: #103632;
  font-weight: 800;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.62), var(--soft-shadow);
}

.profile-avatar {
  width: 72px;
  height: 72px;
  font-size: 22px;
}

.profile-editor strong,
.profile-editor span {
  display: block;
}

.profile-editor span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.profile-account-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: end;
  margin-top: 16px;
}

.profile-account-form button {
  min-width: 132px;
}

.user-account-form {
  display: grid;
  grid-template-columns: 1fr 1.15fr .9fr 96px 118px;
  gap: 10px;
  margin-bottom: 12px;
}

.user-account-list {
  display: grid;
  gap: 9px;
}

.user-account-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto 42px;
  gap: 11px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-solid);
  min-width: 0;
}

.account-avatar {
  width: 44px;
  height: 44px;
  font-size: 13px;
}

.user-account-main {
  min-width: 0;
}

.user-account-row strong,
.user-account-row span {
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-account-row span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.user-account-status {
  min-width: 48px;
  padding: 5px 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--green) 10%, transparent);
  color: var(--green);
  font-size: 12px;
  text-align: center;
}

.user-account-status.off {
  background: color-mix(in srgb, var(--rose) 10%, transparent);
  color: var(--rose);
}

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

.backup-copy {
  display: grid;
  gap: 5px;
}

.backup-copy strong {
  font-size: 16px;
}

.backup-copy span {
  color: var(--muted);
  line-height: 1.6;
}

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

.backup-metrics span {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 5%, var(--panel-solid));
}

.backup-metrics b,
.backup-metrics small {
  display: block;
}

.backup-metrics b {
  font-size: 22px;
}

.backup-metrics small {
  margin-top: 4px;
  color: var(--muted);
}

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

.inline-hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.mini-form {
  display: grid;
  grid-template-columns: 1.5fr 150px 90px auto;
  gap: 8px;
  margin-top: 12px;
}

.searchbox {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: min(320px, 100%);
  height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: white;
  border-radius: 8px;
}

.searchbox input {
  height: 38px;
  border: 0;
  padding: 0;
}

.table {
  overflow-x: auto;
}

.thead,
.trow {
  min-width: 860px;
  display: grid;
  grid-template-columns: 1.2fr 1fr 1.1fr 1fr 1fr 70px;
  gap: 10px;
  align-items: center;
}

.thead {
  padding: 0 12px 8px;
  color: var(--muted);
  font-size: 13px;
}

.trow {
  margin-top: 8px;
  padding: 11px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.trow small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.customer-table {
  overflow-x: auto;
}

.customer-head,
.customer-row {
  min-width: 980px;
  display: grid;
  grid-template-columns: 150px minmax(180px, 1.35fr) 88px 88px 110px minmax(150px, 1fr) 126px;
  gap: 10px;
  align-items: stretch;
}

.customer-head {
  padding: 0 12px 7px;
  color: var(--muted);
  font-size: 13px;
}

.customer-head span {
  display: flex;
  align-items: center;
}

.customer-row {
  margin-top: 8px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.customer-row.editing {
  border-color: var(--accent);
  background: #edf5f4;
}

.customer-row strong,
.customer-row small {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-row > span {
  min-width: 0;
  min-height: 58px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
}

.customer-row small {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-filter-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -2px 0 12px;
  padding: 10px 12px;
  border: 1px solid rgba(31, 122, 112, 0.22);
  border-radius: 8px;
  background: #edf5f4;
  color: var(--accent-strong);
}

.customer-filter-note span {
  font-size: 14px;
  font-weight: 700;
}

.bulk-customer-card {
  padding-bottom: 16px;
}

.bulk-customer-card.collapsed {
  padding-bottom: 10px;
}

.bulk-customer-card.collapsed .section-title {
  margin-bottom: 0;
}

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

.bulk-template-header {
  display: grid;
  grid-template-columns: 1.2fr 1.2fr .8fr;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(31, 122, 112, 0.18);
  border-radius: 8px;
  background: #edf5f4;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
}

.bulk-customer-text {
  min-height: 92px;
  margin-top: 8px;
  font-family: inherit;
  line-height: 1.65;
}

.bulk-customer-preview {
  margin-top: 12px;
}

.bulk-preview-table {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.bulk-preview-table > div {
  display: grid;
  grid-template-columns: 110px 150px minmax(180px, 1fr) 86px 86px;
  gap: 10px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  align-items: center;
}

.bulk-preview-table > div:first-child {
  border-top: 0;
  background: #f7f4ef;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.bulk-preview-table span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bulk-preview-table p {
  margin: 0;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 13px;
}

.progress-badge,
.pay-badge {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: #edf5f4;
  color: var(--accent-strong);
  font-size: 12px;
}

.pay-badge {
  background: #fff1f2;
  color: var(--rose);
}

.pay-badge.paid {
  background: #eaf6ef;
  color: var(--green);
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  justify-content: flex-end;
  align-self: center;
}

.customer-editor {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: #edf5f4;
}

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

.customer-editor textarea {
  min-height: 86px;
  margin-top: 10px;
  background: #fff;
}

.customer-reminder-editor {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(184, 76, 90, 0.24);
  border-radius: 8px;
  background: #fff7f8;
}

.customer-reminder-grid {
  display: grid;
  grid-template-columns: 150px 120px minmax(0, 1fr);
  gap: 10px;
  margin-top: 10px;
}

.customer-reminder-editor textarea {
  min-height: 68px;
}

.address-editor {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(31, 122, 112, 0.22);
  border-radius: 8px;
  background: #f7fbfa;
  overflow-x: auto;
}

.address-editor-hint {
  margin: -3px 0 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.address-head,
.address-row {
  min-width: 760px;
  display: grid;
  grid-template-columns: 54px 130px minmax(360px, 1fr) 42px;
  gap: 8px;
  align-items: start;
}

.address-head {
  color: var(--muted);
  font-size: 12px;
  padding-bottom: 6px;
}

.address-row {
  margin-top: 7px;
}

.address-row input {
  height: 38px;
  background: #fff;
}

.address-row textarea {
  min-height: 70px;
  background: #fff;
  line-height: 1.55;
}

.address-row input[type="radio"] {
  width: 18px;
  height: 18px;
  justify-self: center;
  margin-top: 10px;
  accent-color: var(--accent);
}

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

.dashboard-address-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.dashboard-address-item summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  cursor: pointer;
  list-style: none;
}

.dashboard-address-item summary::-webkit-details-marker {
  display: none;
}

.dashboard-address-item summary span,
.dashboard-address-row strong,
.dashboard-address-row p {
  min-width: 0;
}

.dashboard-address-item summary strong,
.dashboard-address-item summary small {
  display: block;
}

.dashboard-address-item summary small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.dashboard-address-content {
  display: grid;
  gap: 8px;
  padding: 0 12px 12px;
}

.dashboard-address-row {
  padding: 10px 12px;
  border-radius: 8px;
  background: #f7f4ef;
}

.dashboard-address-row strong {
  display: block;
  color: var(--accent-strong);
  font-size: 13px;
}

.dashboard-address-row p {
  margin: 6px 0 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.fee-editor {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.price-memory {
  margin: 10px 0 12px;
  padding: 10px;
  border: 1px solid rgba(31, 122, 112, 0.18);
  border-radius: 8px;
  background: #f4faf9;
}

.price-memory.empty {
  color: var(--muted);
  font-size: 13px;
}

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

.price-memory-head strong {
  color: var(--accent-strong);
}

.price-memory-head span {
  color: var(--muted);
  font-size: 12px;
}

.price-memory-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.price-memory-list button {
  display: grid;
  justify-items: start;
  min-height: 74px;
  padding: 9px 10px;
  border-color: rgba(31, 122, 112, 0.2);
  background: #fff;
  text-align: left;
}

.price-memory-list button span {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
}

.price-memory-list button strong {
  margin-top: 2px;
  color: var(--ink);
  font-size: 18px;
}

.price-memory-list button small,
.price-memory-list button em {
  max-width: 100%;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-line-editor {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.order-address-panel {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(31, 122, 112, 0.22);
  border-radius: 8px;
  background: linear-gradient(180deg, #f7fbfa 0%, #fff 100%);
}

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

.order-address-head strong {
  color: var(--accent-strong);
}

.order-address-panel select {
  background: #fff;
}

.order-address-preview {
  min-height: 42px;
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #edf5f4;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.6;
}

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

.fee-head,
.fee-row {
  display: grid;
  grid-template-columns: 1.3fr 90px 100px 100px 1.4fr 42px;
  gap: 8px;
  align-items: center;
}

.fee-head {
  color: var(--muted);
  font-size: 12px;
  padding: 0 0 6px;
}

.fee-row {
  margin-top: 7px;
}

.fee-row input,
.fee-row select {
  height: 38px;
}

.fee-row strong {
  display: block;
  padding: 0 8px;
  color: var(--accent-strong);
  font-size: 13px;
}

.order-line-head,
.order-line-row {
  display: grid;
  grid-template-columns: 110px minmax(160px, 1fr) 80px 90px 95px minmax(150px, 1fr) 42px;
  gap: 8px;
  align-items: center;
}

.order-line-head {
  color: var(--muted);
  font-size: 12px;
  padding: 0 0 6px;
}

.order-line-row {
  margin-top: 7px;
}

.order-line-row input,
.order-line-row select {
  height: 38px;
}

.order-line-row strong {
  display: block;
  padding: 0 8px;
  color: var(--accent-strong);
  font-size: 13px;
}

.order-total-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  margin-top: 12px;
  padding: 14px 16px;
  border: 1px solid rgba(31, 122, 112, 0.24);
  border-radius: 8px;
  background: #edf5f4;
}

.order-total-bar span {
  color: var(--muted);
  font-size: 14px;
}

.order-total-bar strong {
  color: var(--accent-strong);
  font-size: 26px;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
}

.inline-check input {
  width: auto;
  height: auto;
}

.order-table {
  overflow-x: auto;
}

.order-head,
.order-row,
.account-head,
.account-row {
  min-width: 1040px;
  display: grid;
  grid-template-columns: 180px minmax(260px, 1.4fr) 150px minmax(220px, 1fr) 110px 70px;
  gap: 10px;
  align-items: stretch;
}

.account-head,
.account-row {
  min-width: 760px;
  grid-template-columns: minmax(210px, 1.2fr) 140px 140px 140px 140px;
}

.order-head,
.account-head {
  padding: 0 12px 7px;
  color: var(--muted);
  font-size: 13px;
}

.order-row,
.account-row {
  margin-top: 8px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.order-row > span,
.account-row > span {
  min-width: 0;
  min-height: 54px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 4px;
  overflow: hidden;
}

.order-row strong,
.order-row small,
.account-row strong,
.account-row small {
  max-width: 100%;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-row small,
.account-row small {
  color: var(--muted);
  font-size: 12px;
}

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

.split-list h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

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

.knowledge-grid article h3 {
  margin: 0 0 9px;
  font-size: 17px;
}

.knowledge-grid article div {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.knowledge-grid article b {
  padding: 5px 8px;
  background: #edf5f4;
  border-radius: 999px;
  color: var(--accent-strong);
  font-size: 12px;
}

.knowledge-card {
  padding-bottom: 18px;
}

.knowledge-head {
  align-items: center;
}

.knowledge-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 14px;
}

.knowledge-toolbar button {
  height: 34px;
  padding: 0 13px;
}

.knowledge-toolbar button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.material-upload-panel {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(140px, .9fr) minmax(150px, .9fr) minmax(150px, .9fr) auto auto;
  gap: 10px;
  align-items: center;
  margin: 8px 0 14px;
  padding: 12px;
  border: 1px solid rgba(19, 121, 108, .22);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(244, 250, 249, .96), rgba(255, 255, 255, .92));
}

.material-upload-panel strong,
.material-upload-panel span {
  display: block;
}

.material-upload-panel strong {
  color: var(--ink);
  font-size: 15px;
}

.material-upload-panel span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.material-upload-panel input:not([type="file"]),
.file-picker {
  height: 38px;
}

.file-picker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 104px;
  padding: 0 12px;
  border: 1px solid #d8cec0;
  border-radius: 8px;
  background: linear-gradient(180deg, #fff, #f3eee7);
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

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

.knowledge-row {
  display: grid;
  grid-template-columns: 136px minmax(0, 1fr);
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  content-visibility: auto;
  contain-intrinsic-size: 168px;
}

.knowledge-row.text-item {
  grid-template-columns: minmax(160px, 230px) minmax(0, 1fr) 116px;
  align-items: center;
  gap: 12px;
  min-height: 74px;
  padding: 10px 12px;
}

.knowledge-text-head {
  min-width: 0;
}

.knowledge-text-head span {
  display: block;
  margin-bottom: 4px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
}

.knowledge-text-head h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
}

.knowledge-text-head small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.knowledge-row.text-item p {
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.55;
}

.knowledge-row.text-item .crystal-action {
  justify-self: end;
}

.knowledge-preview {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 104px;
  overflow: hidden;
  border: 1px solid #e5ddd2;
  border-radius: 8px;
  background: #f7f4ef;
  color: var(--accent-strong);
}

.knowledge-preview img,
.knowledge-preview video {
  width: 100%;
  height: 100%;
  min-height: 104px;
  object-fit: cover;
}

.video-poster-placeholder {
  width: 100%;
  min-height: 104px;
  display: grid;
  place-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #163d39, #0f2825);
  color: #fff;
  font-size: 12px;
}

.video-poster-placeholder .icon {
  background: rgba(255,255,255,.18);
  color: #fff;
}

.knowledge-preview .icon {
  width: 44px;
  height: 44px;
  font-size: 16px;
}

.doc-preview {
  display: grid;
  place-items: center;
  gap: 8px;
  color: var(--accent-strong);
  font-weight: 800;
}

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

.knowledge-preview b {
  position: absolute;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: rgba(18, 41, 39, .82);
  color: #fff;
}

.knowledge-title-line {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.knowledge-title-line span {
  display: block;
  margin-bottom: 5px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
}

.knowledge-title-line h3 {
  margin: 0;
  font-size: 20px;
  line-height: 1.35;
}

.knowledge-main p {
  margin: 10px 0 0;
  color: #344743;
  line-height: 1.7;
}

.knowledge-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 13px;
}

.knowledge-meta small {
  color: var(--muted);
}

.knowledge-meta div {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.knowledge-meta b {
  padding: 5px 8px;
  border-radius: 999px;
  background: #edf5f4;
  color: var(--accent-strong);
  font-size: 12px;
}

.knowledge-admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.knowledge-admin-actions button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
}

button.danger {
  border-color: rgba(184, 76, 90, .28);
  background: #fff1f2;
  color: var(--rose);
}

button.danger:hover {
  border-color: rgba(184, 76, 90, .58);
  color: var(--rose);
}

.source-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(18, 41, 39, .38);
}

.source-dialog {
  width: min(520px, 100%);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdfa;
  box-shadow: 0 22px 70px rgba(18, 41, 39, .22);
}

.source-file-line {
  display: grid;
  gap: 7px;
  margin: 12px 0 16px;
  padding: 14px;
  border: 1px solid #e5ddd2;
  border-radius: 8px;
  background: #f7f4ef;
}

.source-file-line span {
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
}

.source-file-line strong {
  font-size: 17px;
  overflow-wrap: anywhere;
}

.source-file-line small {
  color: var(--muted);
  line-height: 1.5;
}

.script-primary-card {
  padding: 16px;
}

.script-workbench {
  display: grid;
  grid-template-columns: minmax(300px, .78fr) minmax(0, 1fr);
  gap: 16px;
}

.script-compose,
.script-result {
  min-width: 0;
}

.script-compose textarea {
  min-height: 118px;
  resize: vertical;
}

.compact-segmented {
  margin-top: 10px;
}

.compact-segmented button {
  height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

.script-ai-button {
  width: 100%;
  margin-top: 12px;
}

.script-output {
  min-height: 232px;
  max-height: 360px;
}

.script-library-card {
  padding-top: 16px;
}

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

.quick-script-card {
  display: grid;
  grid-template-columns: minmax(146px, 180px) minmax(0, 1fr) 116px;
  align-items: center;
  gap: 12px;
  min-height: 74px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.quick-script-card span {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
}

.quick-script-card h3 {
  margin: 5px 0 0;
  font-size: 15px;
  line-height: 1.35;
}

.quick-script-card p {
  margin: 0;
  color: #344743;
  line-height: 1.5;
  font-size: 13px;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.quick-script-card button {
  justify-self: end;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.segmented button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.output {
  margin: 0;
  min-height: 240px;
  white-space: pre-wrap;
  line-height: 1.75;
  padding: 14px;
  border-radius: 8px;
  background: #122927;
  color: #f4fbf8;
  overflow: auto;
}

.output.tall {
  min-height: 430px;
}

.output.small {
  min-height: 120px;
}

.asset {
  position: relative;
  min-height: 250px;
  display: grid;
  grid-template-rows: 1fr auto;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.asset img,
.asset video,
.preview-panel img,
.preview-panel video {
  width: 100%;
  height: 100%;
  min-height: 190px;
  object-fit: cover;
  display: block;
}

.asset div {
  padding: 12px;
}

.asset strong,
.asset span {
  display: block;
}

.asset span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.asset .ghost {
  position: absolute;
  right: 8px;
  top: 8px;
  background: rgba(255, 255, 255, 0.88);
}

.preview-panel {
  min-height: 320px;
  margin-top: 14px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fff;
}

.studio-card {
  padding: 16px;
}

.studio-intake {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) 140px 90px;
  align-items: end;
  gap: 10px;
}

.studio-brief {
  min-height: 72px;
  margin-top: 12px;
}

.studio-picker {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  overflow-x: auto;
  padding-bottom: 3px;
}

.studio-thumb {
  flex: 0 0 130px;
  height: auto;
  min-height: 128px;
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 8px;
  text-align: left;
}

.studio-thumb.active {
  border-color: var(--accent);
  background: #edf5f4;
}

.studio-thumb img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
}

.studio-thumb span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
}

.studio-workspace {
  display: grid;
  grid-template-columns: minmax(300px, 0.42fr) minmax(0, 1fr);
  min-height: 560px;
}

.studio-preview {
  border-right: 1px solid var(--line);
  background: #f7f4ef;
}

.studio-preview-box {
  height: 470px;
  min-height: 470px;
  margin: 14px;
}

.studio-output {
  min-width: 0;
  padding: 16px;
}

.studio-output-box {
  height: 420px;
  min-height: 420px;
}

.studio-prompt-box {
  height: 360px;
  min-height: 360px;
  font-size: 14px;
  line-height: 1.75;
  background: #122927;
  color: #f4fbf8;
  border-color: #122927;
}

.studio-note {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f7f4ef;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.mock-visual {
  min-height: 320px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  color: var(--muted);
  background:
    linear-gradient(135deg, rgba(31, 122, 112, 0.14), transparent),
    linear-gradient(315deg, rgba(185, 133, 43, 0.12), transparent),
    #fff;
}

.client-bubble {
  margin-top: 14px;
  padding: 16px;
  border-radius: 8px;
  background: #edf5f4;
  line-height: 1.7;
}

.score {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0;
  padding: 12px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
}

.score strong {
  font-size: 34px;
  color: var(--accent);
}

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

.bars > div {
  display: grid;
  grid-template-columns: 120px 1fr 40px;
  align-items: center;
  gap: 10px;
}

.bars div div {
  height: 12px;
  background: #eee7dc;
  border-radius: 999px;
  overflow: hidden;
}

.bars i {
  display: block;
  height: 100%;
  background: var(--accent);
}

.intake-card {
  padding: 14px 16px;
}

.compact-title {
  margin-bottom: 10px;
}

.link-capture {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
}

.compact-form {
  display: grid;
  grid-template-columns: 120px 120px minmax(220px, 1fr) repeat(4, 90px) 142px 110px;
  gap: 8px;
  margin-top: 10px;
}

.compact-form .field {
  gap: 5px;
}

.compact-form input,
.compact-form select,
.link-capture input {
  height: 38px;
}

.compact-note {
  min-height: 64px;
  margin-top: 10px;
}

.workspace-card {
  padding: 0;
  overflow: hidden;
}

.inspo-workspace {
  min-height: 560px;
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
}

.inspo-list {
  min-width: 0;
  border-right: 1px solid var(--line);
  background: #f7f4ef;
}

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

.workspace-head h2 {
  margin: 0;
  font-size: 17px;
}

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

.inspo-items {
  max-height: 500px;
  overflow: auto;
  padding: 10px;
  display: grid;
  gap: 8px;
}

.inspo-item {
  width: 100%;
  height: auto;
  min-height: 88px;
  display: grid;
  justify-items: stretch;
  gap: 5px;
  padding: 11px;
  text-align: left;
  background: #fff;
}

.inspo-item.active {
  border-color: var(--accent);
  background: #edf5f4;
}

.inspo-item span,
.inspo-item i {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.inspo-item strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.inspo-detail {
  min-width: 0;
  padding: 16px;
  background: #fffdf9;
}

.detail-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.detail-top span,
.heat-score span {
  color: var(--muted);
  font-size: 12px;
}

.detail-top h2 {
  margin: 6px 0 0;
  font-size: 22px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.heat-score {
  text-align: right;
}

.heat-score strong {
  display: block;
  color: var(--rose);
  font-size: 24px;
}

.heat-score.big {
  min-width: 105px;
}

.heat-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.detail-metrics {
  margin-top: 14px;
}

.heat-metrics b {
  padding: 9px 8px;
  border-radius: 8px;
  background: #f7f4ef;
  text-align: center;
  font-size: 13px;
  color: var(--accent-strong);
  white-space: nowrap;
}

.detail-link {
  margin-top: 10px;
  padding: 10px;
  border-radius: 8px;
  background: #f7f4ef;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-actions {
  margin: 12px 0;
}

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

.result-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.result-panel > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
}

.result-panel strong {
  font-size: 15px;
}

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

.result-panel pre {
  height: 310px;
  margin: 0;
  padding: 13px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.7;
  color: var(--ink);
  background: #fff;
  font-family: inherit;
  font-size: 14px;
}

.empty {
  grid-column: 1 / -1;
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  text-align: center;
  color: var(--muted);
}

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

  .sidebar {
    position: relative;
    height: auto;
  }

  nav {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  }

  .grid,
  .grid.two,
  .split-list,
  .metrics {
    grid-template-columns: 1fr;
  }

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

  .target-grid,
  .work-log-form,
  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .history-toolbar,
  .report-history.collapsed {
    grid-template-columns: 1fr;
  }

  .inspo-workspace {
    grid-template-columns: 1fr;
  }

  .inspo-list {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .inspo-items {
    max-height: 260px;
  }

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

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

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

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

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

  .bulk-preview-table {
    overflow-x: auto;
  }

  .bulk-preview-table > div {
    min-width: 720px;
  }

  .fee-head,
  .fee-row {
    grid-template-columns: 1.2fr 80px 90px 90px 1fr 42px;
  }

  .order-line-editor {
    overflow-x: auto;
  }

  .order-line-head,
  .order-line-row {
    min-width: 760px;
  }

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

  .studio-workspace {
    grid-template-columns: 1fr;
  }

  .studio-preview {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .studio-preview-box {
    height: 320px;
    min-height: 320px;
  }

  .knowledge-row {
    grid-template-columns: 112px minmax(0, 1fr);
  }

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

  .material-upload-panel > div {
    grid-column: 1 / -1;
  }

  .knowledge-row.text-item {
    grid-template-columns: minmax(146px, 180px) minmax(0, 1fr) 116px;
  }

  .script-workbench {
    grid-template-columns: 1fr;
  }

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

  .ui-theme-grid {
    grid-template-columns: 1fr;
  }

  .profile-account-form,
  .user-account-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 620px) {
  main {
    padding: 14px;
  }

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

  .link-capture {
    grid-template-columns: 1fr;
  }

  .studio-intake {
    grid-template-columns: 1fr;
  }

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

  .target-grid,
  .work-log-form,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .history-toolbar,
  .report-history.collapsed {
    grid-template-columns: 1fr;
  }

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

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

  .price-memory-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .price-memory-list {
    grid-template-columns: 1fr;
  }

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

  .fee-editor {
    overflow-x: auto;
  }

  .fee-head,
  .fee-row {
    min-width: 720px;
  }

  .order-line-editor {
    overflow-x: auto;
  }

  .order-line-head,
  .order-line-row {
    min-width: 760px;
  }

  .detail-top {
    grid-template-columns: 1fr;
  }

  .heat-score {
    text-align: left;
  }

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

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

  .section-title {
    flex-direction: column;
  }

  .knowledge-head {
    align-items: stretch;
  }

  .material-upload-panel {
    grid-template-columns: 1fr;
  }

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

  .knowledge-preview {
    min-height: 160px;
  }

  .knowledge-title-line,
  .knowledge-meta {
    align-items: flex-start;
    flex-direction: column;
  }

  .knowledge-meta div {
    justify-content: flex-start;
  }

  .knowledge-row.text-item {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .knowledge-row.text-item .crystal-action {
    justify-self: start;
  }

  .quick-script-card {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .quick-script-card button {
    justify-self: start;
  }

  .profile-editor,
  .profile-account-form,
  .user-account-form,
  .backup-actions,
  .backup-metrics {
    grid-template-columns: 1fr;
  }

  .topbar h1 {
    font-size: 24px;
  }
}
