/* =========================================================
   Ehon — base
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 4%, #fff3b8 0 10%, transparent 28%),
    radial-gradient(circle at 96% 9%, #c9f0ff 0 13%, transparent 34%),
    linear-gradient(180deg, #effbff 0%, #fffdf8 38%, #fff6e4 100%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body.modal-open { overflow: hidden; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
fieldset { margin: 0; padding: 0; border: 0; }
legend { padding: 0; }
::selection { background: #f4c95d80; }

:root {
  --bg: #f4fcff;
  --bg-deep: #fff5cf;
  --surface: #ffffff;
  --surface-2: #eefaff;
  --surface-3: #fff2c7;
  --ink: #24343d;
  --ink-soft: #40545e;
  --muted: #647b84;
  --muted-2: #8aa0a7;
  --primary: #ff7566;
  --primary-dark: #e65345;
  --primary-soft: #ffe2dc;
  --teal: #2b9d8d;
  --teal-dark: #1d7569;
  --teal-soft: #ddf8f2;
  --yellow: #ffd166;
  --yellow-soft: #fff2bc;
  --blue: #5aaee8;
  --blue-soft: #e1f4ff;
  --green: #3f9d63;
  --green-soft: #e2f8e9;
  --warning: #a86612;
  --warning-soft: #fff0d2;
  --danger: #b83a2e;
  --danger-soft: #ffe4df;
  --border: #d9edf2;
  --border-strong: #b9dce6;
  --shadow-xs: 0 1px 2px rgba(36, 52, 61, .05);
  --shadow-sm: 0 4px 14px rgba(36, 52, 61, .07);
  --shadow: 0 14px 34px rgba(36, 52, 61, .1);
  --shadow-lg: 0 26px 70px rgba(36, 52, 61, .16);
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 26px;
  --radius-xl: 36px;
  --container: 1180px;
  --header-h: 72px;
  --font-ui: "Be Vietnam Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-display: "Baloo 2", "Be Vietnam Pro", "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --font-book: "Baloo 2", "Be Vietnam Pro", "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}

.skip-link {
  position: fixed;
  left: 12px;
  top: -100px;
  z-index: 1000;
  background: var(--ink);
  color: #fff;
  padding: .6rem 1rem;
  border-radius: 10px;
  transition: top .2s;
}
.skip-link:focus { top: 12px; }

.container { width: min(calc(100% - 40px), var(--container)); margin-inline: auto; }
.container-narrow { width: min(calc(100% - 40px), 820px); margin-inline: auto; }
.stack > * + * { margin-top: var(--gap, 1rem); }
.cluster { display: flex; align-items: center; gap: var(--gap, .75rem); flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.grid { display: grid; gap: var(--gap, 1.25rem); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.tiny { font-size: .78rem; }
.strong { font-weight: 700; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* Typography */
h1, h2, h3, .display { font-family: var(--font-display); letter-spacing: -.015em; line-height: 1.14; }
h1 { font-size: clamp(2.3rem, 5vw, 4.35rem); }
h2 { font-size: clamp(1.75rem, 3vw, 2.65rem); }
h3 { font-size: clamp(1.2rem, 2vw, 1.55rem); }
h4 { font-size: 1.05rem; }
.eyebrow {
  display: inline-flex; align-items: center; gap: .45rem;
  font-size: .78rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
  color: var(--teal);
}
.eyebrow.coral { color: var(--primary-dark); }
.lede { font-size: clamp(1.02rem, 1.7vw, 1.2rem); color: var(--muted); line-height: 1.65; }
.section { padding: clamp(3rem, 7vw, 6rem) 0; }
.section-tight { padding: clamp(2rem, 4vw, 3.5rem) 0; }
.section-head { max-width: 700px; margin: 0 auto 2.5rem; text-align: center; }
.section-head.left { margin-left: 0; text-align: left; }
.section-head p { margin-top: .8rem; }

/* Buttons */
.btn {
  --btn-bg: var(--primary);
  --btn-fg: #fff;
  --btn-border: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  min-height: 46px; padding: .72rem 1.2rem;
  border: 1.5px solid var(--btn-border);
  border-radius: 999px;
  background: var(--btn-bg); color: var(--btn-fg);
  font-weight: 750; font-size: .95rem; line-height: 1.2;
  text-align: center;
  transition: transform .15s, box-shadow .15s, background .15s, border-color .15s;
  box-shadow: 0 3px 0 rgba(36, 52, 61, .1), 0 8px 18px rgba(36, 52, 61, .08);
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 5px 0 rgba(36, 52, 61, .1), 0 14px 24px rgba(36, 52, 61, .13); }
.btn:active { transform: translateY(0); }
.btn:focus-visible, .icon-btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid #f4c95d99; outline-offset: 2px;
}
.btn:disabled, .btn[aria-disabled="true"] { opacity: .48; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-primary { --btn-bg: linear-gradient(180deg, #ff8c7e, var(--primary)); --btn-fg: #fff; }
.btn-primary:hover { --btn-bg: linear-gradient(180deg, #ff7d6e, var(--primary-dark)); }
.btn-teal { --btn-bg: linear-gradient(180deg, #43b6a4, var(--teal)); --btn-fg: #fff; }
.btn-teal:hover { --btn-bg: linear-gradient(180deg, #36a493, var(--teal-dark)); }
.btn-dark { --btn-bg: var(--ink); --btn-fg: #fff; }
.btn-ghost { --btn-bg: transparent; --btn-fg: var(--ink); --btn-border: var(--border-strong); box-shadow: none; }
.btn-ghost:hover { --btn-bg: var(--surface-2); }
.btn-soft { --btn-bg: var(--primary-soft); --btn-fg: var(--primary-dark); box-shadow: none; }
.btn-soft:hover { --btn-bg: #ffd4cb; }
.btn-teal-soft { --btn-bg: var(--teal-soft); --btn-fg: var(--teal-dark); box-shadow: none; }
.btn-sm { min-height: 36px; padding: .45rem .85rem; font-size: .84rem; }
.btn-lg { min-height: 54px; padding: .9rem 1.55rem; font-size: 1.03rem; }
.btn-block { width: 100%; }
.btn-icon { width: 46px; padding: 0; }
.btn-icon.btn-sm { width: 36px; }
.btn .spinner { border-color: currentColor transparent currentColor transparent; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: transparent; color: var(--ink);
  transition: background .15s;
}
.icon-btn:hover { background: var(--surface-2); }
.icon { width: 20px; height: 20px; flex: none; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 26px; height: 26px; }

/* Forms */
.field { display: grid; gap: .42rem; }
.field > label, .label { font-weight: 700; font-size: .92rem; }
.field .hint { font-size: .8rem; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; min-height: 48px;
  padding: .7rem .9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 110px; resize: vertical; line-height: 1.6; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px #f26b5b1f;
  outline: none;
}
.input::placeholder, .textarea::placeholder { color: #b2a79d; }
.input:disabled, .select:disabled, .textarea:disabled { background: #f4eee6; color: var(--muted); }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b6b6b' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 2.4rem;
}
.form-grid { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.check {
  display: flex; gap: .8rem; align-items: flex-start;
  padding: .9rem 1rem; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s;
}
.check:hover { border-color: var(--border-strong); }
.check:has(input:checked) { border-color: var(--primary); background: #fff5f2; }
.check input { width: 20px; height: 20px; margin: .1rem 0 0; accent-color: var(--primary); flex: none; }
.check span { font-size: .93rem; }
.radio-row { display: flex; flex-wrap: wrap; gap: .55rem; }
.radio-pill { position: relative; }
.radio-pill input { position: absolute; opacity: 0; pointer-events: none; }
.radio-pill span {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .55rem .85rem; border: 1.5px solid var(--border); border-radius: 999px;
  background: var(--surface); font-size: .9rem; font-weight: 650; cursor: pointer;
}
.radio-pill input:checked + span { border-color: var(--teal); background: var(--teal-soft); color: var(--teal-dark); }
.chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.chip {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .4rem .72rem; border: 1.5px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--ink-soft); font-size: .84rem; font-weight: 650;
  transition: all .15s;
}
button.chip:hover { border-color: var(--primary); color: var(--primary-dark); }
.chip.selected { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); }
.chip.teal.selected { border-color: var(--teal); background: var(--teal-soft); color: var(--teal-dark); }
.chip .icon { width: 14px; height: 14px; }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .3rem .58rem; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-soft);
  font-size: .74rem; font-weight: 750; letter-spacing: .01em;
}
.badge.coral { background: var(--primary-soft); color: var(--primary-dark); }
.badge.teal { background: var(--teal-soft); color: var(--teal-dark); }
.badge.yellow { background: var(--yellow-soft); color: #7a5a0a; }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.warning { background: var(--warning-soft); color: var(--warning); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* Surfaces */
.card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 5px 0 #eaf8fc, var(--shadow-xs);
}
.card-pad { padding: clamp(1.1rem, 2.5vw, 1.7rem); }
.panel { background: var(--surface); border: 2px solid #e4f3f7; border-radius: var(--radius-lg); padding: clamp(1.2rem, 3vw, 2rem); box-shadow: 0 6px 0 #eef9fc, var(--shadow-xs); }
.panel-soft { background: linear-gradient(180deg, #f4fcff, #fffdf8); border: 1.5px solid var(--border); border-radius: var(--radius-lg); padding: clamp(1.2rem, 3vw, 2rem); }
.divider { height: 1px; background: var(--border); border: 0; margin: 0; }
.notice {
  display: flex; gap: .8rem; align-items: flex-start;
  padding: .9rem 1rem; border-radius: var(--radius-sm);
  background: var(--blue-soft); color: #37527d; font-size: .88rem;
}
.notice.warning { background: var(--warning-soft); color: #7a4c0a; }
.notice.danger { background: var(--danger-soft); color: #7d271f; }
.notice.success { background: var(--green-soft); color: #255f3b; }
.notice .icon { flex: none; margin-top: .1rem; }
.notice a { text-decoration: underline; font-weight: 700; }

/* Progress */
.progress { height: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), var(--yellow)); transition: width .45s ease; }
.spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2.5px solid #ffffff55; border-top-color: #fff;
  animation: spin .75s linear infinite;
}
.spinner.dark { border-color: #2b2b2b22; border-top-color: var(--primary); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .45 } }
.skeleton {
  background: linear-gradient(100deg, #f3e8da 20%, #fbf4eb 40%, #f3e8da 60%);
  background-size: 220% 100%;
  animation: shimmer 1.3s linear infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { to { background-position-x: -220%; } }

/* Toast */
.toast-root {
  position: fixed; z-index: 1200; right: 18px; bottom: 18px;
  display: grid; gap: .6rem; width: min(380px, calc(100vw - 36px));
  pointer-events: none;
}
.toast {
  display: flex; gap: .65rem; align-items: flex-start;
  padding: .85rem 1rem; border-radius: 14px;
  background: var(--ink); color: #fff; box-shadow: var(--shadow-lg);
  font-size: .9rem; animation: toastIn .25s ease both; pointer-events: auto;
}
.toast.success { background: #275e3a; }
.toast.error { background: #7d271f; }
.toast.warning { background: #7a4c0a; }
.toast .icon { margin-top: .1rem; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(.98); } }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 1100;
  background: rgba(30, 22, 16, .48); backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 1rem;
  animation: fadeIn .18s ease both;
}
.modal {
  width: min(640px, 100%); max-height: min(88vh, 900px); overflow: auto;
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); animation: modalIn .22s ease both;
}
.modal.wide { width: min(920px, 100%); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1.3rem 1.4rem .8rem; }
.modal-body { padding: .4rem 1.4rem 1.4rem; }
.modal-foot { display: flex; justify-content: flex-end; gap: .6rem; padding: 1rem 1.4rem 1.4rem; border-top: 1px solid var(--border); }
@keyframes fadeIn { from { opacity: 0 } }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.98); } }

/* Avatars */
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--yellow-soft); color: #7a5a0a;
  font-weight: 800; font-size: .9rem; flex: none;
  border: 2px solid #fff; box-shadow: var(--shadow-xs);
}
.avatar.coral { background: var(--primary-soft); color: var(--primary-dark); }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .8rem 1rem; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--border); }
th { font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: #d8c8b8 transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #d8c8b8; border-radius: 99px; border: 3px solid var(--bg); }

@media (max-width: 700px) {
  .form-grid { grid-template-columns: 1fr; }
  .btn { min-height: 44px; }
  .container, .container-narrow { width: min(calc(100% - 28px), var(--container)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
