/* Salon Loyalty — design tokens */
:root {
    --font: "Pretendard Variable", "Pretendard", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    --bg: #f4f6fb;
    --bg-elevated: #ffffff;
    --text: #0f172a;
    --text-muted: #64748b;
    --border: #e8edf5;
    --border-strong: #d1dae8;
    --accent: #4f46e5;
    --accent-hover: #4338ca;
    --accent-soft: #eef2ff;
    --success: #059669;
    --success-hover: #047857;
    --success-soft: #ecfdf5;
    --danger: #e11d48;
    --danger-hover: #be123c;
    --danger-soft: #fff1f2;
    --warn-soft: #fffbeb;
    --warn-border: #fde68a;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow: 0 4px 24px -4px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 20px 40px -12px rgba(15, 23, 42, 0.15);
    --radius: 0.75rem;
    --radius-lg: 1rem;
    --nav-h: 3.5rem;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--text);
    background:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(79, 70, 229, 0.12), transparent),
        radial-gradient(ellipse 60% 40% at 100% 0%, rgba(16, 185, 129, 0.08), transparent),
        var(--bg);
}

a {
    color: inherit;
}

/* --- Admin shell --- */
.admin-header {
    position: sticky;
    top: 0;
    z-index: 40;
    height: var(--nav-h);
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.admin-header__inner {
    max-width: 72rem;
    margin: 0 auto;
    height: 100%;
    padding: 0 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.02em;
}

.admin-brand__name {
    line-height: 1.2;
}

.brand-logo {
    display: block;
    height: 2.25rem;
    width: auto;
    max-width: 7.5rem;
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 0.375rem;
}

.brand-logo--hero {
    height: 3.5rem;
    max-width: 11rem;
    margin: 0 auto 1rem;
}

.brand-logo--auth {
    height: 3rem;
    max-width: 9.5rem;
    margin: 0 auto 1.25rem;
}

.admin-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
}

.admin-nav__link {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 9999px;
    transition: color 0.15s, background 0.15s;
}

.admin-nav__link:hover {
    color: var(--text);
    background: var(--bg);
}

.admin-nav__link--active {
    color: var(--accent);
    background: var(--accent-soft);
}

.nav-link-btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-radius: 9999px;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}

.nav-link-btn:hover {
    color: var(--danger);
    background: var(--danger-soft);
}

.app-main {
    max-width: 72rem;
    margin: 0 auto;
    padding: 1.25rem 1.25rem 2rem;
}

.app-main--public {
    max-width: 28rem;
    padding-top: 2.5rem;
}

.app-main--wide {
    max-width: 40rem;
}

/* --- Page structure --- */
.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.page-title {
    margin: 0;
    font-size: 1.375rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.2;
    color: var(--text);
}

.page-subtitle {
    margin: 0.125rem 0 0;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.5rem 0.625rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.search-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

/* --- Form controls --- */
.input,
select.input,
textarea.input {
    display: block;
    width: 100%;
    min-height: 2.5rem;
    padding: 0.4375rem 0.75rem;
    font-family: inherit;
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: var(--text);
    background-color: var(--bg);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.input::placeholder {
    color: #94a3b8;
}

.input:hover {
    border-color: #b8c5d9;
}

.input:focus,
select.input:focus,
textarea.input:focus {
    outline: none;
    background-color: var(--bg-elevated);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.input--narrow {
    max-width: 12rem;
}

.input--grow {
    flex: 1 1 0%;
    min-width: 12rem;
    width: auto;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    min-height: 2.5rem;
    padding: 0.4375rem 1rem;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.25rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: transform 0.12s, box-shadow 0.15s, background 0.15s, border-color 0.15s, color 0.15s;
}

.btn:active:not(:disabled) {
    transform: scale(0.98);
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn-primary {
    color: #fff;
    background: linear-gradient(180deg, var(--accent) 0%, var(--accent-hover) 100%);
    box-shadow: 0 1px 2px rgba(79, 70, 229, 0.35);
}

.btn-primary:hover {
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}

.btn-secondary {
    color: var(--text);
    background: var(--bg-elevated);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: var(--bg);
    border-color: #b8c5d9;
}

.btn-success {
    color: #fff;
    background: linear-gradient(180deg, var(--success) 0%, var(--success-hover) 100%);
    box-shadow: 0 1px 2px rgba(5, 150, 105, 0.3);
}

.btn-success:hover {
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

.btn-danger {
    color: #fff;
    background: linear-gradient(180deg, var(--danger) 0%, var(--danger-hover) 100%);
    box-shadow: 0 1px 2px rgba(225, 29, 72, 0.3);
}

.btn-danger:hover {
    box-shadow: 0 4px 12px rgba(225, 29, 72, 0.3);
}

.btn-danger-outline {
    color: var(--danger);
    background: var(--bg-elevated);
    border-color: #fecdd3;
}

.btn-danger-outline:hover {
    background: var(--danger-soft);
}

.btn-ghost {
    color: var(--text);
    background: var(--bg-elevated);
    border-color: var(--border-strong);
}

.btn-ghost:hover {
    background: var(--bg);
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-sm {
    min-height: 2rem;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
}

/* --- Surfaces --- */
.card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.125rem;
    box-shadow: var(--shadow-sm);
}

.card--highlight {
    background: #fff
}


.stat-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.875rem 1.125rem;
    box-shadow: var(--shadow-sm);
}

.stat-card__label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
}

.stat-card__value {
    margin-top: 0.125rem;
    font-size: 1.625rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.stat-card--action {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #fff;
    background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
    border: none;
    transition: transform 0.15s, box-shadow 0.15s;
}

.stat-card--action:hover {
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.35);
    transform: translateY(-1px);
}

.stat-card--action .stat-card__label,
.stat-card--action .stat-card__value {
    color: #fff;
}

.points-display {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: #b45309;
    line-height: 1.1;
}

.form-label {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.01em;
}

.field {
    display: flex;
    flex-direction: column;
}

.form-stack > .field + .field,
.form-stack > .field + .btn-block,
.form-stack > .btn-block + .field {
    margin-top: 0.75rem;
}

.section-title {
    margin: 0 0 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* --- Alerts --- */
.alert {
    margin-bottom: 1.25rem;
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
    border-radius: var(--radius);
    border: 1px solid;
}

.alert-success {
    color: #047857;
    background: var(--success-soft);
    border-color: #a7f3d0;
}

.alert-error {
    color: #be123c;
    background: var(--danger-soft);
    border-color: #fecdd3;
}

.alert-info {
    color: #1d4ed8;
    background: #eff6ff;
    border-color: #bfdbfe;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-soft);
    border-radius: 9999px;
    letter-spacing: 0.02em;
}

/* --- Tables --- */
.table-wrap {
    overflow-x: auto;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.table {
    width: 100%;
    font-size: 0.875rem;
    border-collapse: collapse;
}

.table thead {
    text-align: left;
    background: var(--bg);
}

.table th {
    padding: 0.5rem 0.875rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.table td {
    padding: 0.625rem 0.875rem;
}

.table tbody tr {
    border-top: 1px solid var(--border);
    transition: background 0.12s;
}

.table tbody tr:hover {
    background: rgba(79, 70, 229, 0.04);
}

.link-muted {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--accent);
    text-decoration: none;
}

.link-muted:hover {
    text-decoration: underline;
    color: var(--accent-hover);
}

/* --- Public / auth --- */
.hero {
    text-align: center;
    padding: 3rem 1rem 2rem;
}

.hero__title {
    margin: 0;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.15;
    background: linear-gradient(135deg, var(--text) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero__subtitle {
    margin: 0.75rem 0 2rem;
    font-size: 0.9375rem;
    color: var(--text-muted);
}

.hero__actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 16rem;
    margin: 0 auto;
}

.auth-shell {
    max-width: 24rem;
    margin: 0 auto;
}

.auth-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
}

.auth-card__title {
    margin: 0 0 1rem;
    font-size: 1.25rem;
    font-weight: 700;
    text-align: center;
    letter-spacing: -0.03em;
}

/* --- Modal --- */
.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
}

.modal-panel {
    position: relative;
    width: 100%;
    max-width: 28rem;
    padding: 1.75rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.modal-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

/* --- Misc --- */
.empty-state {
    font-size: 0.8125rem;
    color: var(--text-muted);
    padding: 1.25rem 0.75rem;
    text-align: center;
}

.preview-hint {
    font-size: 0.8125rem;
    color: var(--text-muted);
    padding: 0.5rem 0.625rem;
    background: var(--bg);
    border-radius: var(--radius);
    border: 1px dashed var(--border-strong);
    margin: 0.8125rem 0;
}

.preview-hint p + p {
    margin-top: 0.25rem;
}

.preview-hint strong.text-emerald {
    color: var(--success);
}

.preview-hint strong.text-amber {
    color: #b45309;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    opacity: 1;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --- Layout utilities --- */
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.items-baseline { align-items: baseline; }
.items-stretch { align-items: stretch; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-5 { margin-bottom: 1.25rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.ml-1 { margin-left: 0.25rem; }
.ml-2 { margin-left: 0.5rem; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.875rem; }
.text-xs { color: var(--text-muted); font-size: 0.75rem; margin-top: 0.25rem; }
.text-earn { color: var(--success); }
.text-redeem { color: var(--danger); }
.text-amber { color: #b45309; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.hidden { display: none !important; }
.max-w-lg { max-width: 32rem; }
.max-w-md { max-width: 28rem; margin-left: auto; margin-right: auto; }
.w-full { width: 100%; }
.self-end { align-self: flex-end; }
.pb-2 { padding-bottom: 0.5rem; }
.space-y-4 > * + * { margin-top: 1rem; }

.grid-2 {
    display: grid;
    gap: 0.875rem;
}

.grid-form-4 {
    display: grid;
    gap: 0.75rem;
    align-items: end;
}

.grid-form-5 {
    display: grid;
    gap: 0.75rem;
    align-items: end;
}

.member-summary {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem 1rem;
}

.member-summary__tier {
    margin: 0.375rem 0 0;
}

.member-summary__points {
    text-align: right;
}

.member-vip-form {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--warn-border);
}

.footer-bar {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.modal-root {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-root.is-open {
    display: flex;
}

.card-header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.375rem;
    margin-bottom: 0.625rem;
}

.card-header__title {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
}

.card-header__title--earn { color: var(--success); }
.card-header__title--redeem { color: var(--danger); }

.mono-box {
    margin-top: 1.5rem;
    padding: 0.75rem;
    font-family: ui-monospace, monospace;
    font-size: 0.8125rem;
    word-break: break-all;
    background: var(--bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.qr-img {
    display: block;
    margin: 0 auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

code.inline {
    padding: 0.125rem 0.375rem;
    font-size: 0.8125rem;
    background: var(--bg);
    border-radius: 0.25rem;
}

@media (min-width: 640px) {
    .hero__actions {
        flex-direction: row;
        max-width: none;
        justify-content: center;
    }

    .grid-2 {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

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

    .grid-form-5 {
        grid-template-columns: repeat(5, 1fr);
    }
}
