:root {
    --brand: #009CA6;
    --brand-hover: #00909A;
    --brand-pressed: #008892;
    --brand-soft: #E6F6F6;
    --brand-soft-hover: #EDFAFA;
    --brand-link-hover: #00858F;

    --bg-base: #FFFFFF;
    --bg-soft: #F9FAFB;
    --bg-screen: #F8FAFA;

    --text-strong: #111827;
    --text-heading: #1F2937;
    --text-secondary: #6B7280;
    --text-placeholder: #9CA3AF;
    --text-on-primary: #FFFFFF;

    --border: #E5E7EB;
    --border-soft: #F3F4F6;

    --required: #EF4444;
    --warn-bg: #FFFBEB;
    --warn-border: #FDE68A;
    --warn-text: #D97706;
    --dday: #F97316;
    --error: #E0524E;
    --error-bg: #FDF0EF;
    --error-border: #F7C9C7;

    --icon-check: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2016%2016%27%3E%3Cpath%20d%3D%27M8%201a7%207%200%20100%2014A7%207%200%20008%201zm3.44%205.23l-4.1%204.3a.78.78%200%2001-1.13%200L4.56%208.86a.78.78%200%20111.13-1.08l1.08%201.14%203.54-3.72a.78.78%200%20111.13%201.08z%27%2F%3E%3C%2Fsvg%3E");
    --icon-warn: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2016%2016%27%3E%3Cpath%20d%3D%27M8%201a7%207%200%20100%2014A7%207%200%20008%201zm0%203.1a.9.9%200%2001.9.96l-.21%203.4a.69.69%200%2001-1.38%200l-.21-3.4A.9.9%200%20018%204.1zm0%207.55a1%201%200%20110-2%201%201%200%20010%202z%27%2F%3E%3C%2Fsvg%3E");

    --radius: 8px;
    --radius-pill: 20px;
    --h-btn: 51px;
    --h-input: 48px;

    --card: 640px;
}

* {
    box-sizing: border-box;
    margin: 0;
}

body {
    font-family: "Pretendard Variable", Pretendard, "Noto Sans KR", sans-serif;
    background: var(--bg-base);
    color: var(--text-strong);
    -webkit-text-size-adjust: 100%;
}

body.app {
    display: flex;
    flex-direction: column;
    min-height: 100svh;
}

.app-header {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 56px;
    padding: 0 20px;
    background: var(--bg-base);
    border-bottom: 1px solid var(--border);
}

.app-header .back {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    margin: -10px 0 -10px -10px;
    padding: 10px;
    box-sizing: content-box;
}

.app-header .back img {
    width: 16px;
    height: 16px;
}

.app-header h1 {
    flex: 1;
    min-width: 0;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.4;
    color: var(--text-heading);
}

.app-header .home-link {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    margin: -10px -10px -10px 0;
    padding: 10px;
    box-sizing: content-box;
}

.app-header .home-link img {
    width: 24px;
    height: 24px;
}

.logout-btn {
    flex: 0 0 auto;
    padding: 10px 0 10px 10px;
    border: 0;
    background: none;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    cursor: pointer;
}

.logout-btn:active {
    color: var(--brand);
}

.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: var(--h-btn);
    border: 0;
    border-radius: var(--radius);
    background: var(--brand);
    color: var(--text-on-primary);
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    filter: drop-shadow(0 6px 8px rgba(0, 156, 166, .2));
}

.btn-primary {
    transition: background-color .15s ease;
}

@media (hover: hover) {
    .btn-primary:hover:not(:disabled) {
        background: var(--brand-hover);
    }
}

.btn-primary:active:not(:disabled) {
    background: var(--brand-pressed);
}

.btn-primary:disabled {
    background: var(--border);
    color: var(--text-placeholder);
    cursor: default;
    filter: none;
}

.btn-outline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: var(--h-btn);
    border: 1px solid var(--brand);
    border-radius: var(--radius);
    background: var(--bg-base);
    color: var(--brand);
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
}

.btn-outline {
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

@media (hover: hover) {
    .btn-outline:hover:not(:disabled) {
        background: var(--brand-soft-hover);
    }
}

.btn-outline:active:not(:disabled) {
    background: var(--bg-soft);
}

.btn-outline:disabled {
    border-color: var(--border);
    color: var(--text-placeholder);
    cursor: default;
}

.btn-outline img {
    width: 16px;
    height: 16px;
}

.btn-pill {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border: 1px solid var(--brand);
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--brand);
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.btn-pill {
    transition: background-color .15s ease;
}

.btn-pill.is-quiet {
    border-color: var(--border);
    color: var(--text-secondary);
}

@media (hover: hover) {
    .btn-pill:hover {
        background: var(--brand-soft-hover);
    }
}

.btn-pill:active {
    background: var(--bg-soft);
}

.text-link {
    color: var(--brand);
    border-bottom: 1px solid var(--brand);
    text-decoration: none;
    transition: color .15s ease, border-color .15s ease;
}

@media (hover: hover) {
    .text-link:hover {
        color: var(--brand-link-hover);
        border-bottom-color: var(--brand-link-hover);
    }
}

.chips {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
}

.chip {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--bg-soft);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}

.chip.is-active {
    background: var(--brand);
    border-color: var(--brand);
    color: var(--text-on-primary);
    font-weight: 700;
}

.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.badge.is-open {
    background: var(--brand-soft);
    color: var(--brand-pressed);
}

.badge.is-closed {
    background: var(--border-soft);
    color: var(--text-secondary);
}

.alert {
    padding: 12px 14px;
    border-radius: var(--radius);
    background: var(--error-bg);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.5;
    color: var(--error);
}

.info {
    padding: 12px 14px;
    border-radius: var(--radius);
    background: var(--brand-soft);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.5;
    color: var(--brand-pressed);
}

.info.readonly {
    background: var(--border-soft);
    color: var(--text-secondary);
}

.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 32px;
    padding: 48px 24px;
    text-align: center;
}

.empty-state .mascot {
    width: 180px;
    height: 180px;
    object-fit: contain;
}

.empty-state .texts {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.empty-state h2 {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.4;
    color: var(--text-strong);
}

.empty-state p {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-secondary);
}

.edit-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--warn-bg);
    border-bottom: 1px solid var(--warn-border);
    font-size: 13px;
    font-weight: 700;
    color: var(--warn-text);
}

.edit-banner img {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
}

dialog {
    margin: auto;
    width: min(340px, calc(100vw - 48px));
    border: 0;
    border-radius: 16px;
    padding: 28px 24px 24px;
    text-align: center;
}

dialog::backdrop {
    background: rgba(17, 24, 39, .45);
}

dialog h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-heading);
}

dialog p {
    margin-top: 12px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
}

dialog .btn-primary {
    filter: none;
}

dialog > .btn-primary {
    height: 46px;
    margin-top: 20px;
    font-size: 15px;
}

dialog.confirm {
    padding: 24px;
    text-align: center;
}

dialog.confirm h2 {
    font-size: 22px;
    line-height: 1.4;
    color: var(--text-strong);
}

dialog.confirm p {
    margin-top: 8px;
}

.modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 24px;
}

.modal-actions > * {
    width: auto;
    min-width: 0;
    height: 48px;
    margin-top: 0;
    font-size: 15px;
}

.btn-cancel {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-base);
    color: var(--text-secondary);
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: background-color .15s ease;
}

@media (hover: hover) {
    .btn-cancel:hover {
        background: var(--bg-soft);
    }
}

.btn-cancel:active {
    background: var(--border-soft);
}

@media (min-width: 768px) {
    html:has(body.app) {
        display: flex;
        justify-content: center;
        align-items: safe center;
        min-height: 100dvh;
        background: var(--bg-soft);
    }

    body.app {
        flex: none;
        width: var(--card);
        max-width: calc(100vw - 48px);
        min-height: 0;
        margin: 40px 0;
        padding: 0 23px;
        background: var(--bg-base);
        border: 1px solid var(--border);
        border-radius: 16px;
        box-shadow: 0 2px 16px rgba(17, 24, 32, .05);
    }

    .app-header {
        height: auto;
        padding: 46px 24px 20px;
        border-bottom: 0;
    }

    body.home {
        min-height: calc(100dvh - 80px);
    }
}

.btn-text {
    padding: 0;
    border: 0;
    background: none;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    color: var(--brand);
    cursor: pointer;
    white-space: nowrap;
}

.btn-text.is-danger {
    color: var(--error);
}

.toast-layer {
    position: fixed;
    top: 16px;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    justify-content: center;
    padding: 0 16px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    max-width: min(560px, 100%);
    padding: 0 8px 0 16px;
    border-radius: 24px;
    background: var(--bg-base);
    box-shadow: 0 6px 20px rgba(17, 24, 39, .12);
    pointer-events: auto;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity .2s ease, transform .2s ease;
}

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

.toast.is-leaving {
    opacity: 0;
    transform: translateY(-8px);
}

.toast-icon {
    flex: none;
}

.toast.is-ok .toast-icon {
    color: var(--brand);
}

.toast.is-error .toast-icon {
    color: var(--error);
}

.toast-text {
    font-size: 15px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--text-strong);
}

.toast-rule {
    flex: none;
    width: 1px;
    height: 18px;
    margin-left: 4px;
    background: var(--border);
}

.toast-close {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border: 0;
    background: none;
    color: var(--text-placeholder);
    cursor: pointer;
}

@media (hover: hover) {
    .toast-close:hover {
        color: var(--text-secondary);
    }
}

@media (prefers-reduced-motion: reduce) {
    .toast {
        transition: none;
        transform: none;
    }

    .toast.is-leaving {
        transform: none;
    }
}

.top-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 4px;
}

.admin-link {
    padding: 5px 12px;
    background: var(--brand-soft);
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 700;
    color: var(--brand);
    text-decoration: none;
}

.admin-link:active {
    background: var(--brand-soft-hover);
}
