@font-face {
  font-family: "Be Vietnam Pro";
  src: url("../fonts/be-vietnam-pro-regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Be Vietnam Pro";
  src: url("../fonts/be-vietnam-pro-bold.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Playfair Display";
  src: url("../fonts/playfair-display-regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Playfair Display";
  src: url("../fonts/playfair-display-bold.woff2") format("woff2");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Dancing Script";
  src: url("../fonts/dancing-script-semibold.ttf") format("truetype");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

:root {
  --green: #173d23;
  --green-2: #285c38;
  --gold: #b78c24;
  --cream: #f7f3e7;
  --page: #f3f1ea;
  --ink: #1e2a22;
  --line: #d9d3c3;
  --danger: #9f3434;
  --ui-font: "Be Vietnam Pro", "Segoe UI", Arial, sans-serif;
  --hand-font: "Dancing Script", "Segoe Print", cursive;
  /* Georgia và Times New Roman thiếu glyph tiếng Việt dựng sẵn (U+1EA0–U+1EF9)
     nên phải dùng font serif bundled, dự phòng là Noto/Times New Roman. */
  --display-font: "Playfair Display", "Noto Serif", "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  min-width: 320px;
  margin: 0;
  padding: 22px;
  background: var(--page);
  color: var(--ink);
  font-family: var(--ui-font);
}

button,
input,
select {
  font: inherit;
}

button,
select {
  min-height: 42px;
  border: 1px solid var(--green);
  border-radius: 8px;
}

button {
  padding: 9px 14px;
  cursor: pointer;
  background: var(--green);
  color: #fff;
  font-weight: 700;
}

button:hover {
  background: var(--green-2);
}

button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(183, 140, 36, .5);
  outline-offset: 2px;
}

.button-secondary {
  border-color: #a7b2a9;
  background: #fff;
  color: var(--green);
}

.button-secondary:hover {
  background: #edf2ed;
}

.button-gold {
  border-color: #9d7417;
  background: var(--gold);
}

.button-gold:hover {
  background: #9d7417;
}

.button-danger {
  border-color: #d8b7b7;
  background: #fff;
  color: var(--danger);
}

.button-danger:hover {
  background: #fff0f0;
}

.app-header,
.toolbar,
.card-viewport,
.session-help {
  width: min(100%, 1536px);
  margin-right: auto;
  margin-left: auto;
}

.app-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 15px;
}

.app-header h1,
.dialog-header h2 {
  margin: 0;
  color: var(--green);
  font-family: var(--display-font);
}

.app-header h1 {
  font-size: clamp(24px, 3vw, 34px);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.save-status {
  margin: 0 0 5px;
  color: #627066;
  font-size: 13px;
}

.account-area {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  justify-items: end;
  gap: 2px 10px;
}

.account-name {
  grid-column: 1 / -1;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
}

.account-area .save-status {
  margin: 0;
}

.account-area form {
  margin: 0;
}

.link-button {
  min-height: auto;
  padding: 2px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--green);
  font-size: 12px;
  text-decoration: underline;
}

.link-button:hover {
  background: transparent;
  color: var(--gold);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 18px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.toolbar-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.toolbar-group label {
  color: #4d5b50;
  font-size: 13px;
  font-weight: 700;
}

.toolbar select {
  padding: 7px 32px 7px 10px;
  background: #fff;
  color: var(--green);
  font-weight: 700;
}

.session-help {
  margin-top: 10px;
  margin-bottom: 10px;
  color: #657068;
  font-size: 13px;
  text-align: right;
}

.card-viewport {
  overflow: auto hidden;
}

/* The stage receives scaled dimensions from JS. Only this one scale factor changes. */
.card-stage {
  position: relative;
  margin: 0 auto;
}

.treatment-card {
  position: relative;
  width: 1536px;
  height: 1024px;
  overflow: hidden;
  transform-origin: top left;
  background: url("../images/treatment-card-dynamic.jpg") center / 100% 100% no-repeat;
  box-shadow: 0 4px 18px rgba(27, 48, 32, .12);
}

.card-field {
  position: absolute;
  z-index: 5;
  padding: 0 5px;
  overflow: hidden;
  border: 0;
  border-radius: 3px;
  outline: 0;
  background: transparent;
  color: #173d23;
  font-family: var(--hand-font);
  font-style: normal;
  font-weight: 600;
  line-height: 1.12;
  text-overflow: clip;
  white-space: nowrap;
}

.card-field:focus {
  background: rgba(255, 252, 231, .86);
  box-shadow: inset 0 0 0 3px rgba(183, 140, 36, .65);
}

.customer-name {
  top: 395px;
  left: 385px;
  width: 378px;
  height: 72px;
  font-size: 52px;
}

.phone {
  top: 464px;
  left: 270px;
  width: 455px;
  height: 55px;
  font-size: 35px;
}

.card-date {
  left: 1070px;
  width: 230px;
  height: 53px;
  padding: 0 4px;
  background: transparent;
  font-size: 30px;
  text-align: center;
}

.start-date {
  top: 407px;
}

.end-date {
  top: 466px;
}

.dynamic-session-count {
  position: absolute;
  z-index: 4;
  top: 70px;
  left: 1152px;
  display: flex;
  width: 148px;
  height: 125px;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: #c79312;
  /* Chỉ hiển thị chữ số nên không vướng dấu tiếng Việt. Giữ Georgia để khớp
     đúng với bản xuất PDF vẽ bằng canvas trong assets/js/app.js. */
  font-family: Georgia, "Times New Roman", serif;
  font-size: 110px;
  font-style: italic;
  line-height: 1;
}

.dynamic-session-count.is-visible {
  display: flex;
}

.session-target {
  position: absolute;
  border-radius: 50%;
}

.session-target {
  z-index: 6;
  width: 166px;
  height: 166px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--green);
}

.session-label,
.session-number {
  position: absolute;
  left: 0;
  display: block;
  width: 100%;
  color: #173d23;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  pointer-events: none;
}

.session-label {
  top: 24px;
  font-size: 23px;
}

.session-number {
  top: 51px;
  font-size: 48px;
}

.session-number.is-double {
  top: 54px;
  font-size: 42px;
  font-style: italic;
}

.session-static {
  position: absolute;
  z-index: 6;
  width: 166px;
  height: 166px;
  border-radius: 50%;
  pointer-events: none;
}

.session-target:hover {
  background: rgba(183, 140, 36, .07);
}

.session-target:focus-visible {
  outline: 5px solid rgba(183, 140, 36, .65);
  outline-offset: -4px;
}

.session-date-value {
  position: absolute;
  top: 94px;
  left: 5px;
  width: 156px;
  height: 42px;
  overflow: hidden;
  color: #173d23;
  font-family: var(--hand-font);
  font-size: 25px;
  font-style: normal;
  font-weight: 600;
  line-height: 42px;
  text-align: center;
  white-space: nowrap;
}

.session-target.has-date .session-date-value {
  background: transparent;
}

.session-clear {
  position: absolute;
  z-index: 2;
  top: 8px;
  right: 8px;
  display: none;
  width: 30px;
  min-height: 30px;
  padding: 0;
  border: 1px solid #ad7d77;
  border-radius: 50%;
  background: #fff;
  color: #8e332c;
  font-family: var(--ui-font);
  font-size: 20px;
  line-height: 26px;
}

.session-target.has-date:hover .session-clear,
.session-target.has-date:focus-within .session-clear {
  display: block;
}

/*
 * Lịch tự dựng thay cho input[type=date] ẩn: iOS Safari không có showPicker()
 * nên bản cũ không mở được gì trên điện thoại. Ô ngày để tối thiểu 44px cho
 * vừa đầu ngón tay.
 */
.date-dialog {
  width: min(360px, calc(100vw - 24px));
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  color: var(--ink);
}

.date-dialog::backdrop {
  background: rgba(16, 30, 20, .52);
}

.date-dialog__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 14px 6px;
}

.date-dialog__titles {
  flex: 1;
  text-align: center;
}

.date-dialog__titles .eyebrow {
  margin-bottom: 2px;
}

.date-dialog__title {
  margin: 0;
  color: var(--green);
  font-family: var(--display-font);
  font-size: 21px;
}

.date-nav {
  width: 44px;
  min-height: 44px;
  flex: none;
  padding: 0;
  border: 1px solid #c8cec9;
  border-radius: 50%;
  background: #fff;
  color: var(--green);
  font-size: 24px;
  line-height: 1;
}

.date-nav:hover {
  background: #edf2ed;
}

.date-weekdays,
.date-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  padding: 0 12px;
}

.date-weekdays {
  padding-top: 10px;
  padding-bottom: 6px;
  color: #657068;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
  text-align: center;
}

.date-grid {
  padding-bottom: 12px;
}

.date-cell {
  min-height: 44px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
}

.date-cell:hover {
  background: #edf2ed;
}

.date-cell.is-outside {
  color: #a8b0aa;
  font-weight: 400;
}

.date-cell.is-today {
  color: var(--green);
  box-shadow: inset 0 0 0 2px var(--gold);
}

.date-cell.is-selected,
.date-cell.is-selected:hover {
  background: var(--green);
  color: #fff;
}

.date-dialog__actions {
  display: flex;
  gap: 8px;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--line);
}

.date-dialog__actions button {
  flex: 1;
  padding: 9px 6px;
}

.toast {
  position: fixed;
  z-index: 100;
  right: 22px;
  bottom: 22px;
  max-width: min(420px, calc(100vw - 44px));
  padding: 12px 16px;
  border-radius: 9px;
  background: var(--green);
  color: #fff;
  font-weight: 700;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast.is-error {
  background: var(--danger);
}

.customer-dialog {
  width: min(1060px, calc(100vw - 30px));
  max-height: min(780px, calc(100vh - 30px));
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
}

.customer-dialog::backdrop {
  background: rgba(16, 30, 20, .52);
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 19px 20px 13px;
}

.icon-button {
  width: 42px;
  padding: 0;
  border-color: #c8cec9;
  background: #fff;
  color: var(--green);
  font-size: 27px;
  line-height: 1;
}

.search-label {
  display: block;
  margin: 0 20px 6px;
  color: #58645b;
  font-size: 13px;
  font-weight: 700;
}

.search-input {
  width: calc(100% - 40px);
  margin: 0 20px 15px;
  padding: 10px 12px;
  border: 1px solid #abb5ad;
  border-radius: 8px;
}

.customer-table-wrap {
  max-height: min(570px, calc(100vh - 210px));
  overflow: auto;
  border-top: 1px solid var(--line);
}

.customer-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.customer-table th,
.customer-table td {
  padding: 11px 10px;
  border-bottom: 1px solid #e7e3d8;
  text-align: left;
  vertical-align: middle;
}

.customer-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f7f5ee;
  color: #4b574e;
  font-size: 12px;
  letter-spacing: .03em;
}

.customer-table tr.is-current {
  background: #f0f5ef;
}

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

.table-actions button {
  min-height: 34px;
  padding: 6px 9px;
  font-size: 12px;
}

.empty-state {
  margin: 0;
  padding: 36px 18px;
  color: #69736b;
  text-align: center;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.auth-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background: #eeece4;
}

.auth-card {
  width: min(100%, 460px);
  padding: 30px;
  border: 1px solid var(--line);
  border-top: 5px solid var(--green);
  border-radius: 14px;
  background: #fff;
}

.auth-card h1 {
  margin: 0 0 24px;
  color: var(--green);
  font-family: var(--display-font);
  font-size: 30px;
}

.auth-form {
  display: grid;
  gap: 8px;
}

.auth-form label {
  margin-top: 7px;
  color: #465349;
  font-size: 13px;
  font-weight: 800;
}

.auth-form input {
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid #aeb8b0;
  border-radius: 8px;
}

.auth-form button {
  margin-top: 14px;
}

.auth-message {
  display: grid;
  gap: 7px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid #d7c68d;
  border-radius: 8px;
  background: #fff9e8;
  color: #58491d;
  font-size: 14px;
  line-height: 1.45;
}

.auth-message--error {
  border-color: #deb6b6;
  background: #fff1f1;
  color: #7d2929;
}

.auth-message a {
  color: var(--green);
  font-weight: 800;
}

/* Admin pages */
.admin-page {
  padding: 0;
  background: #f4f3ee;
}

.admin-header {
  position: sticky;
  z-index: 50;
  top: 0;
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto minmax(160px, 1fr);
  align-items: center;
  gap: 28px;
  min-height: 76px;
  padding: 12px max(24px, calc((100vw - 1380px) / 2));
  border-bottom: 1px solid #e3dfd3;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 4px 18px rgba(29, 49, 34, .05);
}

.admin-brand {
  display: flex;
  flex-direction: column;
  width: max-content;
  color: var(--green);
  font-family: var(--display-font);
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
}

.admin-brand small {
  margin-top: 5px;
  color: var(--gold);
  font-family: var(--ui-font);
  font-size: 9px;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.admin-nav {
  display: flex;
  gap: 6px;
  padding: 5px;
  border-radius: 11px;
  background: #f3f2ec;
}

.admin-nav a {
  padding: 9px 14px;
  border-radius: 8px;
  color: #58645b;
  font-size: 14px;
  font-weight: 750;
  text-decoration: none;
}

.admin-nav a:hover,
.admin-nav a.is-active {
  background: #fff;
  color: var(--green);
  box-shadow: 0 2px 8px rgba(27, 48, 32, .09);
}

.admin-account {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  color: #576259;
  font-size: 13px;
  font-weight: 700;
}

.admin-account form {
  margin: 0;
}

.admin-main {
  width: min(100% - 40px, 1380px);
  margin: 0 auto;
  padding: 38px 0 60px;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 25px;
}

.page-heading h1 {
  margin: 0;
  color: var(--green);
  font-family: var(--display-font);
  font-size: clamp(30px, 4vw, 44px);
}

.page-heading p:not(.eyebrow):not(.save-status) {
  margin: 7px 0 0;
  color: #6c756e;
}

.page-heading__actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.button-link,
.small-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--green);
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-weight: 750;
  text-decoration: none;
}

.button-link {
  min-height: 44px;
  padding: 10px 16px;
}

.button-link:hover,
.small-button:hover {
  background: var(--green-2);
}

.text-link,
.panel-heading a {
  color: var(--green);
  font-weight: 750;
  text-decoration: none;
}

.text-link:hover,
.panel-heading a:hover {
  text-decoration: underline;
}

.panel {
  border: 1px solid #dfdcd1;
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 8px 28px rgba(29, 49, 34, .045);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  position: relative;
  min-height: 170px;
  padding: 24px;
  overflow: hidden;
  border: 1px solid #dfdcd1;
  border-radius: 15px;
  background: #fff;
}

.stat-card::after {
  position: absolute;
  right: -16px;
  bottom: -26px;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  background: rgba(183, 140, 36, .08);
  content: "";
}

.stat-card--total {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.stat-card--total::after {
  background: rgba(255, 255, 255, .08);
}

.stat-card span {
  display: block;
  min-height: 38px;
  color: #5f6b61;
  font-size: 14px;
  font-weight: 750;
}

.stat-card--total span,
.stat-card--total small {
  color: rgba(255, 255, 255, .78);
}

.stat-card strong {
  display: block;
  margin: 8px 0 5px;
  color: var(--green);
  font-family: var(--display-font);
  font-size: 48px;
}

.stat-card--total strong {
  color: #fff;
}

.stat-card small {
  color: #879088;
}

.dashboard-columns {
  display: grid;
  grid-template-columns: minmax(260px, .75fr) minmax(0, 1.6fr);
  gap: 20px;
}

.dashboard-columns .panel {
  padding: 24px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 17px;
}

.panel-heading h2,
.create-form h2,
.create-help h2,
.preview-dialog h2 {
  margin: 0;
  color: var(--green);
  font-family: var(--display-font);
  font-size: 22px;
}

.status-stats {
  display: grid;
}

.status-stats > div {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 16px 0;
  border-top: 1px solid #ece9df;
}

.status-stats strong {
  color: var(--green);
  font-size: 21px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #aeb4af;
}

.status-dot--active {
  background: var(--gold);
}

.status-dot--done {
  background: #2e7a46;
}

.recent-list {
  display: grid;
}

.recent-card {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto 80px;
  align-items: center;
  gap: 16px;
  min-height: 66px;
  padding: 10px 4px;
  border-top: 1px solid #ece9df;
  color: var(--ink);
  text-decoration: none;
}

.recent-card:hover {
  background: #fafaf7;
}

.recent-card__main {
  display: grid;
  gap: 4px;
}

.recent-card__main small {
  color: #7b847d;
}

.recent-card__progress {
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
  text-align: right;
}

.service-badge,
.status-badge {
  display: inline-flex;
  align-items: center;
  width: max-content;
  padding: 6px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
}

.service-badge {
  background: #eef4ee;
  color: #285c38;
}

.service-badge--neck_shoulder {
  background: #fff5d9;
  color: #795c13;
}

.service-badge--body_massage {
  background: #f4ecf7;
  color: #704879;
}

.status-badge--not_started {
  background: #f0f1ef;
  color: #606861;
}

.status-badge--in_progress {
  background: #fff3cf;
  color: #765913;
}

.status-badge--completed {
  background: #e6f4e9;
  color: #27643a;
}

.list-panel {
  padding: 22px;
}

.list-filters {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 220px 220px;
  gap: 14px;
}

.list-filters label,
.field {
  display: grid;
  gap: 7px;
  color: #4f5b52;
  font-size: 13px;
  font-weight: 750;
}

.list-filters input,
.list-filters select,
.field input,
.field select {
  width: 100%;
  min-height: 45px;
  padding: 9px 12px;
  border: 1px solid #bdc5be;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.list-summary {
  padding: 18px 2px 10px;
  color: #737c75;
  font-size: 13px;
}

.cards-table-wrap {
  overflow-x: auto;
}

.cards-table {
  width: 100%;
  min-width: 850px;
  border-collapse: collapse;
}

.cards-table th,
.cards-table td {
  padding: 15px 12px;
  border-top: 1px solid #ece9df;
  text-align: left;
  vertical-align: middle;
}

.cards-table th {
  color: #667068;
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.cards-table td:first-child strong,
.cards-table td:first-child small {
  display: block;
}

.cards-table td:first-child small {
  margin-top: 5px;
  color: #7c857e;
}

.progress-bar {
  width: 100px;
  height: 6px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #eceeea;
}

.progress-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--gold);
}

.row-actions {
  display: flex;
  gap: 7px;
}

.small-button {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 12px;
}

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

.loading-state {
  padding: 26px 0;
  color: #7a837c;
  text-align: center;
}

.create-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  align-items: start;
  gap: 20px;
}

.create-form {
  padding: 8px 30px 28px;
}

.form-section {
  padding: 26px 0;
  border-bottom: 1px solid #ece9df;
}

.form-section__heading {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.form-section__heading > span {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  background: #eef3ed;
  color: var(--green);
  font-weight: 850;
}

.form-section__heading p {
  margin: 4px 0 0;
  color: #7b847d;
  font-size: 13px;
}

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

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

.field--compact {
  width: 180px;
  margin-left: 52px;
}

.field b {
  color: var(--danger);
}

.service-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding-left: 52px;
}

.service-option {
  position: relative;
  display: grid;
  grid-template-columns: 38px 1fr;
  align-items: center;
  gap: 10px;
  min-height: 92px;
  padding: 14px;
  border: 1px solid #d5dbd5;
  border-radius: 11px;
  cursor: pointer;
}

.service-option:has(input:checked) {
  border-color: var(--green);
  background: #f2f7f1;
  box-shadow: inset 0 0 0 1px var(--green);
}

.service-option input {
  position: absolute;
  opacity: 0;
}

.service-option__icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  background: #edf1eb;
  color: var(--green);
  font-size: 20px;
}

.service-option strong,
.service-option small {
  display: block;
}

.service-option strong {
  color: var(--green);
  font-size: 13px;
}

.service-option small {
  margin-top: 4px;
  color: #7e8780;
  font-size: 11px;
  line-height: 1.35;
}

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

.create-help {
  position: sticky;
  top: 100px;
  padding: 25px;
}

.create-help__number {
  display: grid;
  width: 38px;
  height: 38px;
  margin-bottom: 14px;
  place-items: center;
  border-radius: 50%;
  background: var(--gold);
  color: #fff;
  font-weight: 850;
}

.create-help ol {
  margin: 17px 0 0;
  padding-left: 20px;
  color: #657068;
  font-size: 13px;
  line-height: 1.65;
}

.preview-dialog {
  width: min(1280px, calc(100vw - 30px));
  max-height: calc(100vh - 30px);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 15px;
}

.preview-dialog::backdrop {
  background: rgba(15, 27, 18, .72);
}

.preview-dialog__header,
.preview-dialog__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 17px 20px;
  border-bottom: 1px solid #e6e2d7;
}

.preview-dialog__actions {
  justify-content: flex-end;
  border-top: 1px solid #e6e2d7;
  border-bottom: 0;
}

.preview-viewport {
  max-height: calc(100vh - 190px);
  padding: 15px;
  overflow: auto;
  background: #efeee8;
}

.preview-value {
  display: flex;
  align-items: center;
  pointer-events: none;
}

.card-date.preview-value {
  justify-content: center;
}

.service-selection-mark {
  position: absolute;
  z-index: 8;
  display: block;
  width: 34px;
  height: 44px;
  color: var(--green);
  font-family: Arial, sans-serif;
  font-size: 42px;
  font-weight: 900;
  line-height: 44px;
  text-align: center;
  transform: rotate(-8deg);
  pointer-events: none;
}

.detail-heading {
  margin-bottom: 16px;
}

.detail-heading .save-status {
  margin-top: 7px;
}

.admin-main > .toolbar,
.admin-main > .card-viewport,
.admin-main > .session-help {
  width: 100%;
}

.detail-card-viewport {
  max-width: 1220px;
  margin-right: auto;
  margin-left: auto;
}

@media (max-width: 850px) {
  body {
    padding: 12px;
  }

  .app-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .account-area {
    justify-items: start;
  }

  .toolbar,
  .toolbar-group {
    align-items: stretch;
  }

  .toolbar {
    flex-direction: column;
  }

  .toolbar-group {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toolbar-group label {
    align-self: center;
  }

  .toolbar-group--primary button:last-child {
    grid-column: 1 / -1;
  }

  .session-help {
    text-align: left;
  }

  .customer-table {
    min-width: 900px;
  }

  .admin-header {
    position: static;
    grid-template-columns: 1fr auto;
    gap: 10px;
    padding: 14px 16px;
  }

  .admin-nav {
    grid-row: 2;
    grid-column: 1 / -1;
    width: 100%;
    overflow-x: auto;
  }

  .admin-nav a {
    flex: 1 0 max-content;
    text-align: center;
  }

  .admin-account > span {
    display: none;
  }

  .admin-main {
    width: min(100% - 24px, 1380px);
    padding: 25px 0 45px;
  }

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

  .stats-grid,
  .dashboard-columns,
  .create-layout {
    grid-template-columns: 1fr;
  }

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

  .stat-card {
    min-height: 145px;
  }

  .recent-card {
    grid-template-columns: minmax(130px, 1fr) auto;
  }

  .recent-card__progress {
    display: none;
  }

  .list-filters,
  .form-grid,
  .service-options {
    grid-template-columns: 1fr;
  }

  .form-grid,
  .service-options {
    padding-left: 0;
  }

  .field--compact {
    margin-left: 0;
  }

  .create-form {
    padding: 5px 20px 22px;
  }

  .create-help {
    position: static;
  }

  .form-actions {
    flex-direction: column-reverse;
  }

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

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

  .stat-card {
    min-height: 130px;
  }

  .page-heading__actions,
  .page-heading__actions a {
    width: 100%;
  }

  .page-heading__actions {
    align-items: stretch;
    flex-direction: column;
  }

  .recent-card {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

@media print {
  @page {
    size: A4 landscape;
    margin: 0;
  }

  html,
  body {
    width: 297mm;
    height: 210mm;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: #fff;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .no-print,
  .session-clear {
    display: none !important;
  }

  main,
  .card-viewport {
    width: 297mm;
    height: 210mm;
    margin: 0;
    overflow: hidden;
  }

  .card-stage {
    position: relative;
    width: 297mm !important;
    height: 210mm !important;
    margin: 0;
  }

  .treatment-card {
    position: absolute;
    top: 7.7mm;
    left: 0;
    transform: scale(.73047) !important;
    box-shadow: none;
  }

  .card-field {
    caret-color: transparent;
  }

  .card-field:focus,
  .session-target:focus-visible {
    outline: 0;
    box-shadow: none;
  }
}
