:root {
  --ink: #14213d;
  --ink-soft: #41516c;
  --fog: #f5f7fb;
  --paper: #ffffff;
  --lime: #c8f169;
  --lavender: #e8e6ff;
  --coral: #d95d39;
  --line: #dfe5ef;
  --shadow: 0 24px 60px rgba(20, 33, 61, .12);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--fog);
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--fog); }
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--lime); outline-offset: 3px; }
.app-shell { width: min(1120px, calc(100% - 40px)); margin: 0 auto; min-height: 100vh; display: grid; align-items: center; padding: 32px 0; }
.brand-lockup { display: inline-flex; align-items: center; gap: 10px; font-weight: 760; letter-spacing: -.02em; }
.brand-logo { display: block; width: 100%; height: auto; object-fit: contain; }
.brand-mark { width: 25px; height: 25px; display: inline-grid; place-items: center; background: var(--lime); border: 2px solid var(--ink); transform: rotate(45deg); }
.brand-mark::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ink); }
.brand-mark + span { transform: translateY(-1px); }
.eyebrow { margin: 0 0 12px; color: var(--ink-soft); font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1, h2 { letter-spacing: -.045em; line-height: 1.03; }
h1 { font-size: clamp(2.3rem, 5vw, 4.4rem); margin-bottom: 18px; }
h2 { font-size: clamp(1.55rem, 3vw, 2.3rem); margin-bottom: 10px; }
p { line-height: 1.55; }
.lead { max-width: 55ch; color: var(--ink-soft); font-size: 1.02rem; }

.auth-layout { display: grid; grid-template-columns: .9fr 1.1fr; min-height: 620px; overflow: hidden; background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow); }
.intro-panel { position: relative; display: flex; flex-direction: column; padding: 42px; color: white; overflow: hidden; background: var(--ink); }
.intro-panel::before, .intro-panel::after { content: ""; position: absolute; border: 1px solid rgba(200, 241, 105, .3); transform: rotate(45deg); pointer-events: none; }
.intro-panel::before { width: 330px; height: 330px; right: -170px; bottom: -80px; }
.intro-panel::after { width: 210px; height: 210px; right: -110px; bottom: -20px; }
.intro-panel .brand-mark { border-color: white; }
.auth-logo-banner { width: calc(100% + 84px); height: clamp(132px, 17vw, 190px); margin: -42px -42px 28px; display: grid; place-items: center; overflow: hidden; background: #27152f; }
.auth-logo-banner .brand-logo { width: 100%; height: 100%; object-fit: contain; }
.intro-copy { position: relative; z-index: 1; max-width: 390px; margin: auto 0; }
.intro-copy .eyebrow { color: var(--lime); }
.intro-copy p:last-child { max-width: 30ch; color: #c3cee0; font-size: 1.05rem; }
.seal { display: grid; place-items: center; border-radius: 50%; color: var(--ink); background: var(--lime); border: 7px solid var(--ink); outline: 1px solid rgba(200, 241, 105, .6); box-shadow: 0 0 0 8px rgba(200, 241, 105, .14); transform: rotate(-9deg); }
.seal span { font-size: .58rem; font-weight: 850; letter-spacing: .16em; text-transform: uppercase; }
.seal strong { font-size: 2.3rem; line-height: .8; }
.seal-large { position: relative; z-index: 1; width: 116px; height: 116px; margin: 0 0 12px auto; grid-template-rows: auto auto; }
.form-panel { display: flex; flex-direction: column; justify-content: center; padding: 64px clamp(32px, 7vw, 92px); }
.form-heading { max-width: 440px; margin-bottom: 32px; }
.form-heading p:last-child { color: var(--ink-soft); max-width: 44ch; }
form { display: grid; gap: 18px; max-width: 440px; }
.field { display: grid; gap: 8px; color: var(--ink); font-size: .87rem; font-weight: 720; }
.field input { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 13px 14px; color: var(--ink); background: #fbfcfe; transition: border-color .18s ease, box-shadow .18s ease, background .18s ease; }
.field input:focus { border-color: var(--ink); background: white; box-shadow: 0 0 0 4px rgba(200, 241, 105, .34); outline: none; }
.field input:invalid:not(:placeholder-shown) { border-color: var(--coral); }
.field textarea { width: 100%; resize: vertical; min-height: 100px; border: 1px solid var(--line); border-radius: 8px; padding: 13px 14px; color: var(--ink); background: #fbfcfe; line-height: 1.5; transition: border-color .18s ease, box-shadow .18s ease, background .18s ease; }
.field textarea:focus { border-color: var(--ink); background: white; box-shadow: 0 0 0 4px rgba(200, 241, 105, .34); outline: none; }
.field small { color: var(--ink-soft); font-size: .75rem; font-weight: 500; }
.field-hint { display: block; margin-top: -3px; }
.button { border: 0; border-radius: 7px; padding: 12px 17px; font-weight: 760; transition: transform .18s ease, background .18s ease, opacity .18s ease; }
.button:hover:not(:disabled) { transform: translateY(-2px); }
.button:disabled { cursor: wait; opacity: .55; }
.button-primary { color: var(--ink); background: var(--lime); }
.button-primary:hover:not(:disabled) { background: #b5e54f; }
.button-quiet { color: var(--ink); background: var(--lavender); }
.button-danger { color: var(--coral); background: transparent; border: 1px solid #f0c6b9; padding: 7px 10px; font-size: .82rem; }
.button-danger:hover:not(:disabled) { background: #fff1ed; }
.avatar-icon { display: inline-grid; place-items: center; width: 34px; height: 34px; flex: 0 0 34px; color: var(--ink); background: var(--lime); border-radius: 10px; }
.avatar-icon svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.icon-gift { background: var(--coral); color: white; }
.icon-ornament { background: var(--lavender); }
.icon-snowflake { background: #d8f1f2; }
.icon-star { background: #f9d778; }
.icon-bell { background: #f3c4c4; }
.icon-candy-cane { background: #f8d9e2; color: #a83a4d; }
.icon-mitten { background: #f3c7b5; color: #9a3b2d; }
.icon-reindeer { background: #dcc4a8; color: #6f4936; }
.icon-wreath { background: #c8e6cf; color: #28634a; }
.profile-trigger { display: inline-flex; align-items: center; gap: 10px; min-width: 176px; padding: 6px 13px 6px 6px; color: var(--ink); background: var(--lavender); border: 1px solid #c9c6ec; border-radius: 10px; box-shadow: 0 3px 10px rgba(20, 33, 61, .07); text-align: left; }
.profile-trigger:hover { background: #dddbff; border-color: var(--ink); box-shadow: 0 5px 14px rgba(20, 33, 61, .12); }
.profile-trigger:active { transform: translateY(1px); }
.profile-trigger strong, .profile-trigger small { display: block; }
.profile-trigger strong { max-width: 18ch; overflow: hidden; color: var(--ink); font-size: .88rem; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.profile-trigger small { max-width: 21ch; margin-top: 3px; overflow: hidden; color: #46536e; font-size: .72rem; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.muted-copy { color: var(--ink-soft); font-size: .9rem; }
dialog { width: min(92vw, 500px); padding: 0; color: var(--ink); background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(20, 33, 61, .42); backdrop-filter: blur(3px); }
#profile-content { position: relative; padding: 34px; }
.dialog-close { position: absolute; top: 18px; right: 18px; width: 30px; height: 30px; color: var(--ink-soft); background: transparent; border: 0; font-size: 1.6rem; line-height: 1; }
.icon-picker { padding: 0; margin: 4px 0 0; border: 0; }
.icon-picker legend { margin-bottom: 12px; color: var(--ink); font-size: .87rem; font-weight: 720; }
.icon-options { display: flex; flex-wrap: wrap; gap: 9px; }
.icon-choice { display: grid; justify-items: center; gap: 5px; min-width: 65px; padding: 7px 6px; color: var(--ink-soft); background: transparent; border: 1px solid transparent; border-radius: 8px; font-size: .7rem; }
.icon-choice[aria-pressed="true"] { color: var(--ink); background: var(--lavender); border-color: var(--ink); }
.icon-choice:hover { background: var(--fog); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 4px; }
.form-message { min-height: 22px; margin: 0; font-size: .9rem; line-height: 1.4; }
.form-message.error { color: #a83a22; }
.form-message.success { padding: 12px 14px; color: #285b2f; background: #eef9da; border-left: 4px solid var(--lime); }

.dashboard-shell { min-height: calc(100vh - 64px); padding: 8px 0 40px; }
.dashboard-header { overflow: hidden; background: var(--paper); border: 1px solid var(--line); box-shadow: 0 12px 30px rgba(20, 33, 61, .07); }
.dashboard-logo { width: 100%; height: clamp(132px, 20vw, 230px); display: grid; place-items: center; background: #27152f; }
.dashboard-logo .brand-logo { width: 100%; height: 100%; object-fit: contain; }
.topbar { display: flex; align-items: center; justify-content: flex-end; gap: 20px; min-height: 72px; padding: 10px 22px; border-top: 1px solid rgba(20, 33, 61, .08); }
.user-menu { display: flex; align-items: center; gap: 16px; }
.user-name { color: var(--ink-soft); font-size: .9rem; font-weight: 650; }
.participant-view { max-width: 720px; margin: 90px auto 0; }
.participant-view h1 { max-width: 12ch; }
.result-card { display: flex; align-items: center; gap: 28px; margin: 42px 0 18px; padding: 34px; color: white; background: var(--ink); box-shadow: var(--shadow); }
.seal-result { flex: 0 0 104px; width: 104px; height: 104px; border-width: 5px; grid-template-rows: auto auto; }
.seal-result strong { font-size: 1.8rem; }
.result-label { margin-bottom: 6px; color: #abb9cf; font-size: .78rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.result-name { margin: 0; color: var(--lime); font-size: clamp(1.8rem, 5vw, 3.1rem); font-weight: 780; letter-spacing: -.05em; line-height: 1; }
.assigned-person { display: flex; align-items: center; gap: 22px; }
.assigned-avatar { flex: 0 0 auto; }
.avatar-icon-large { width: 50px; height: 50px; border: 3px solid var(--ink); border-radius: 14px; box-shadow: 0 0 0 4px rgba(200, 241, 105, .22); }
.avatar-icon-large svg { width: 30px; height: 30px; stroke-width: 1.45; }
.quiet-note { color: var(--ink-soft); font-size: .9rem; }
.preference-card { margin-top: 22px; padding: 20px 22px; background: var(--lavender); border-left: 4px solid var(--lime); }
.preference-card .result-label { margin-bottom: 9px; color: var(--ink-soft); }
.preference-copy { margin: 0; color: var(--ink); white-space: normal; line-height: 1.65; }
.preference-wanted { background: #eef9da; border-left-color: var(--lime); }
.preference-avoid { background: #fff1ed; border-left-color: var(--coral); }
.empty-state { max-width: 560px; margin: 110px auto 0; padding: 54px 0; }
.empty-icon { display: grid; place-items: center; width: 54px; height: 54px; margin-bottom: 28px; color: var(--ink); background: var(--lavender); border-radius: 50%; font-size: 1.5rem; }

.admin-header { display: flex; align-items: end; justify-content: space-between; gap: 30px; padding: 66px 0 38px; }
.admin-header h1 { margin-bottom: 12px; }
.admin-mark { display: grid; place-items: center; width: 82px; height: 82px; color: var(--ink); background: var(--lime); border-radius: 50%; font-size: 2.2rem; transform: rotate(9deg); }
.action-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.action-card { display: flex; align-items: start; gap: 12px; min-height: 132px; padding: 18px; color: var(--ink); text-align: left; background: white; border: 1px solid var(--line); border-radius: 9px; transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease; }
.action-card:hover { border-color: var(--ink); box-shadow: 0 12px 28px rgba(20, 33, 61, .08); transform: translateY(-3px); }
.action-card-accent { background: var(--lavender); border-color: var(--lavender); }
.action-icon { display: grid; flex: 0 0 31px; place-items: center; width: 31px; height: 31px; color: var(--ink); background: var(--lime); border-radius: 50%; font-size: 1.15rem; font-weight: 800; }
.action-card strong, .action-card small { display: block; }
.action-card strong { margin-top: 2px; font-size: .95rem; }
.action-card small { margin-top: 8px; color: var(--ink-soft); font-size: .78rem; line-height: 1.4; }
.admin-columns { display: grid; grid-template-columns: 1.1fr .9fr; gap: 18px; margin-top: 18px; }
.incompatibility-panel { margin-top: 18px; }
.inline-form { display: grid; grid-template-columns: 1fr 1fr auto; align-items: end; gap: 12px; max-width: none; }
.field select { width: 100%; padding: 13px 14px; color: var(--ink); background: #fbfcfe; border: 1px solid var(--line); border-radius: 8px; }
.field select:focus { border-color: var(--ink); box-shadow: 0 0 0 4px rgba(200, 241, 105, .34); outline: none; }
.panel { padding: 26px; background: white; border: 1px solid var(--line); }
.panel-heading { display: flex; align-items: start; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.panel-heading h2 { margin: 0; font-size: 1.45rem; }
.panel-heading .eyebrow { margin-bottom: 8px; }
.participant-list { display: grid; gap: 7px; padding: 0; margin: 0; list-style: none; }
.participant-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.participant-row:last-child { border-bottom: 0; }
.participant-actions { display: flex; align-items: center; gap: 7px; }
.participant-identity { display: inline-flex; align-items: center; gap: 10px; }
.participant-identity strong, .participant-identity small { display: block; }
.participant-identity strong { font-size: .9rem; }
.participant-identity small { margin-top: 2px; color: var(--ink-soft); font-size: .72rem; }
.list-empty { color: var(--ink-soft); font-size: .9rem; }
.notification-panel { background: var(--lavender); border-color: transparent; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 5px rgba(200, 241, 105, .4); }
.notification-summary { min-height: 52px; color: var(--ink-soft); font-size: .9rem; }
.results-panel { margin-top: 18px; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: 13px 10px; text-align: left; border-bottom: 1px solid var(--line); }
th { color: var(--ink-soft); font-size: .73rem; letter-spacing: .1em; text-transform: uppercase; }

@media (max-width: 820px) {
  .app-shell { width: min(100% - 24px, 640px); padding: 12px 0; }
  .auth-layout { display: block; min-height: auto; }
  .intro-panel { min-height: 300px; padding: 28px; }
  .auth-logo-banner { width: calc(100% + 56px); height: 132px; margin: -28px -28px 24px; }
  .intro-copy { margin: 42px 0 0; }
  .intro-copy h1 { max-width: 12ch; font-size: 2.7rem; }
  .seal-large { position: absolute; right: 34px; bottom: 28px; width: 82px; height: 82px; border-width: 5px; }
  .seal-large strong { font-size: 1.6rem; }
  .form-panel { padding: 42px 28px; }
  .action-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-columns { grid-template-columns: 1fr; }
  .inline-form { grid-template-columns: 1fr 1fr; }
  .inline-form .button { grid-column: 1 / -1; justify-self: start; }
  .participant-view { margin-top: 64px; }
}

@media (max-width: 520px) {
  .app-shell { width: min(100% - 20px, 440px); }
  .topbar { align-items: start; min-height: 68px; padding: 10px 14px 12px; }
  .user-menu { align-items: end; flex-direction: column; gap: 8px; }
  .admin-header { align-items: start; padding-top: 42px; }
  .admin-mark { display: none; }
  .action-grid { grid-template-columns: 1fr; }
  .action-card { min-height: 78px; }
  .inline-form { grid-template-columns: 1fr; }
  .inline-form .button { grid-column: auto; width: 100%; }
  .panel { padding: 20px; }
  .participant-row { align-items: start; flex-direction: column; }
  .participant-actions { width: 100%; flex-wrap: wrap; }
  .profile-trigger { min-width: 0; max-width: 190px; padding-right: 9px; }
  .result-card { align-items: start; flex-direction: column; gap: 20px; margin-top: 32px; padding: 25px; }
  .assigned-person { align-items: start; gap: 16px; }
  .avatar-icon-large { width: 50px; height: 50px; border-radius: 14px; }
  .avatar-icon-large svg { width: 30px; height: 30px; }
  .result-name { font-size: 2.4rem; }
  .seal-result { width: 82px; height: 82px; flex-basis: 82px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
