:root {
    --app-bg: #f4f7fb;
    --app-bg-2: #ecf1f8;
    --app-bg-3: #e3eaf3;
    --app-surface: rgba(255, 255, 255, 0.88);
    --app-surface-strong: #ffffff;
    --app-surface-soft: rgba(246, 249, 253, 0.94);
    --app-line: rgba(21, 32, 51, 0.08);
    --app-line-strong: rgba(21, 32, 51, 0.14);
    --app-text: #152033;
    --app-text-body: #43536b;
    --app-text-soft: #71829a;
    --app-accent: #1e3a66;
    --app-accent-strong: #13294b;
    --app-shadow-lg: 0 24px 60px rgba(17, 33, 58, 0.08);
    --app-shadow-md: 0 16px 38px rgba(17, 33, 58, 0.06);
    --app-radius-xl: 2rem;
    --app-radius-2xl: 2.6rem;
}

html {
    scroll-behavior: smooth;
}

body.app-theme,
body.admin-theme {
    color: var(--app-text);
    font-family: 'Pretendard Variable', 'Pretendard', 'Inter', sans-serif;
}

body.app-theme {
    background:
        radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.96), transparent 36%),
        radial-gradient(circle at 15% 10%, rgba(78, 115, 179, 0.12), transparent 22%),
        radial-gradient(circle at 85% 12%, rgba(43, 79, 138, 0.08), transparent 18%),
        linear-gradient(180deg, #fafcff 0%, #f4f7fb 28%, #edf2f8 100%);
}

body.admin-theme {
    background:
        radial-gradient(circle at top, rgba(94, 125, 174, 0.08), transparent 28%),
        linear-gradient(180deg, #f6f9fd 0%, #eef3f9 100%);
}

.app-page-shell,
.admin-shell {
    max-width: 1200px;
    margin: 0 auto;
    padding: 7.5rem 1rem 5rem;
}

.app-page-shell-narrow {
    max-width: 960px;
}

.app-section-head,
.admin-page-head {
    margin-bottom: 2.5rem;
}

.app-kicker,
.admin-kicker {
    display: inline-flex;
    align-items: center;
    padding: 0.42rem 0.78rem;
    border-radius: 999px;
    background: rgba(30, 58, 102, 0.08);
    color: var(--app-accent-strong);
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.app-title,
.admin-title {
    margin-top: 1rem;
    color: var(--app-text);
    font-size: clamp(2.1rem, 4vw, 3.5rem);
    line-height: 1.08;
    letter-spacing: -0.05em;
    font-weight: 700;
}

.app-subtitle,
.admin-subtitle {
    margin-top: 1rem;
    max-width: 44rem;
    color: var(--app-text-body);
    font-size: 1rem;
    line-height: 1.85;
}

.ui-card,
.ui-panel,
.ui-table-wrap,
.ui-auth-card,
.admin-card,
.admin-panel {
    border-radius: var(--app-radius-xl);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(244, 248, 252, 0.98));
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.72),
        var(--app-shadow-md);
}

.ui-card,
.ui-panel,
.admin-card,
.admin-panel {
    padding: 1.6rem;
}

.ui-card-soft {
    border-radius: 1.5rem;
    background: rgba(255, 255, 255, 0.62);
    box-shadow: inset 0 0 0 1px var(--app-line);
}

.ui-button,
.ui-button-secondary,
.ui-button-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 3rem;
    padding: 0.82rem 1.2rem;
    border-radius: 999px;
    font-size: 0.94rem;
    font-weight: 600;
    transition: background-color 180ms ease, color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.ui-button {
    background: linear-gradient(135deg, #213f70 0%, #17315a 100%);
    color: #fff;
}

.ui-button:hover {
    background: linear-gradient(135deg, #17315a 0%, #112644 100%);
    transform: translateY(-1px);
}

.ui-button-secondary {
    background: rgba(255, 255, 255, 0.78);
    color: var(--app-text);
    box-shadow: inset 0 0 0 1px var(--app-line);
}

.ui-button-secondary:hover,
.ui-button-ghost:hover {
    background: rgba(255, 255, 255, 0.96);
}

.ui-button-ghost {
    color: var(--app-accent-strong);
    background: rgba(30, 58, 102, 0.06);
}

.ui-input,
.ui-select,
.ui-textarea {
    width: 100%;
    min-height: 3rem;
    padding: 0.82rem 1rem;
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.82);
    color: var(--app-text);
    box-shadow: inset 0 0 0 1px var(--app-line);
    outline: none;
    transition: box-shadow 180ms ease, background-color 180ms ease;
}

.ui-input::placeholder,
.ui-textarea::placeholder {
    color: var(--app-text-soft);
}

.ui-input:focus,
.ui-select:focus,
.ui-textarea:focus {
    box-shadow:
        inset 0 0 0 1px rgba(30, 58, 102, 0.2),
        0 0 0 4px rgba(30, 58, 102, 0.08);
    background: #fff;
}

.ui-chip,
.ui-chip-muted,
.ui-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.42rem 0.8rem;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 600;
    line-height: 1;
}

.ui-chip {
    background: rgba(30, 58, 102, 0.08);
    color: var(--app-accent-strong);
}

.ui-chip-muted {
    background: rgba(21, 32, 51, 0.06);
    color: var(--app-text-body);
}

.ui-badge {
    background: rgba(255, 255, 255, 0.72);
    box-shadow: inset 0 0 0 1px var(--app-line);
    color: var(--app-text-body);
}

.ui-badge.success {
    background: rgba(31, 171, 84, 0.12);
    color: #0d7f45;
    box-shadow: none;
}

.ui-badge.warn {
    background: rgba(242, 165, 32, 0.16);
    color: #9a5f00;
    box-shadow: none;
}

.ui-badge.danger {
    background: rgba(229, 67, 67, 0.14);
    color: #b42318;
    box-shadow: none;
}

.ui-badge.info {
    background: rgba(30, 58, 102, 0.1);
    color: var(--app-accent-strong);
    box-shadow: none;
}

.ui-table-wrap {
    overflow: hidden;
}

.ui-table {
    width: 100%;
    border-collapse: collapse;
}

.ui-table thead th {
    padding: 1rem 1rem;
    color: var(--app-text-soft);
    font-size: 0.78rem;
    font-weight: 600;
    text-align: left;
    border-bottom: 1px solid rgba(21, 32, 51, 0.08);
}

.ui-table tbody td {
    padding: 1rem 1rem;
    border-bottom: 1px solid rgba(21, 32, 51, 0.06);
    color: var(--app-text-body);
    vertical-align: top;
}

.ui-table tbody tr:hover td {
    background: rgba(255, 255, 255, 0.36);
}

.ui-toolbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
}

.ui-toolbar-main {
    flex: 1 1 auto;
}

.ui-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.ui-data-grid {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ui-data-item {
    display: grid;
    gap: 0.4rem;
}

.ui-data-label {
    color: var(--app-text-soft);
    font-size: 0.82rem;
    font-weight: 500;
}

.ui-data-value {
    color: var(--app-text);
    font-size: 1rem;
    line-height: 1.6;
}

.ui-data-value.mono {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.92rem;
}

.ui-stat-tile {
    border-radius: 1.35rem;
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.64);
    box-shadow: inset 0 0 0 1px rgba(21, 32, 51, 0.06);
}

.ui-stat-tile-label {
    color: var(--app-text-soft);
    font-size: 0.78rem;
    line-height: 1.5;
}

.ui-stat-tile-value {
    margin-top: 0.45rem;
    color: var(--app-accent-strong);
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1.05;
}

.ui-stat-tile-meta {
    margin-top: 0.42rem;
    color: var(--app-text-soft);
    font-size: 0.78rem;
    line-height: 1.55;
}

.ui-list-card {
    border-radius: 1.35rem;
    padding: 1.2rem 1.25rem;
    background: rgba(255, 255, 255, 0.56);
    box-shadow: inset 0 0 0 1px rgba(21, 32, 51, 0.06);
}

.ui-list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid rgba(21, 32, 51, 0.08);
}

.ui-list-row:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.ui-list-row:first-child {
    padding-top: 0;
}

.ui-list-label {
    color: var(--app-text-body);
    font-size: 0.92rem;
}

.ui-list-value {
    color: var(--app-accent-strong);
    font-size: 0.92rem;
    font-weight: 600;
    text-align: right;
}

.ui-badge.neutral {
    background: rgba(21, 32, 51, 0.08);
    color: var(--app-text-body);
    box-shadow: none;
}

.ui-badge.admin {
    background: rgba(105, 65, 198, 0.14);
    color: #6941c6;
    box-shadow: none;
}

.ui-badge.user {
    background: rgba(30, 58, 102, 0.1);
    color: var(--app-accent-strong);
    box-shadow: none;
}

.ui-badge.active,
.ui-badge.paid,
.ui-badge.resolved {
    background: rgba(31, 171, 84, 0.12);
    color: #0d7f45;
    box-shadow: none;
}

.ui-badge.pending,
.ui-badge.progress {
    background: rgba(242, 165, 32, 0.16);
    color: #9a5f00;
    box-shadow: none;
}

.ui-badge.inactive,
.ui-badge.failed,
.ui-badge.danger {
    background: rgba(229, 67, 67, 0.14);
    color: #b42318;
    box-shadow: none;
}

.ui-badge.cancelled,
.ui-badge.ignored {
    background: rgba(108, 117, 134, 0.14);
    color: #546170;
    box-shadow: none;
}

.ui-badge.refunded,
.ui-badge.new {
    background: rgba(30, 58, 102, 0.1);
    color: var(--app-accent-strong);
    box-shadow: none;
}

.ui-button-sm,
.ui-link-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.45rem;
    padding: 0.65rem 1rem;
    border-radius: 999px;
    font-size: 0.84rem;
    font-weight: 600;
    transition: background-color 180ms ease, color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.ui-button-sm {
    background: rgba(30, 58, 102, 0.1);
    color: var(--app-accent-strong);
}

.ui-button-sm:hover,
.ui-link-button:hover {
    background: rgba(30, 58, 102, 0.16);
}

.ui-link-button {
    color: var(--app-accent-strong);
}

.ui-link-strong {
    color: var(--app-accent);
    font-weight: 600;
    transition: color 180ms ease;
}

.ui-link-strong:hover {
    color: var(--app-accent-strong);
}

.ui-code-card {
    border-radius: 1.35rem;
    padding: 1rem 1.05rem;
    background: rgba(232, 238, 247, 0.72);
    box-shadow: inset 0 0 0 1px rgba(21, 32, 51, 0.06);
}

.ui-code-title {
    margin-bottom: 0.45rem;
    color: var(--app-text-soft);
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.ui-code-block {
    margin: 0;
    max-height: 12rem;
    overflow: auto;
    color: var(--app-text-body);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
}

.ui-disclosure {
    border-radius: 1.35rem;
    background: rgba(255, 255, 255, 0.56);
    box-shadow: inset 0 0 0 1px rgba(21, 32, 51, 0.06);
}

.ui-disclosure-summary {
    cursor: pointer;
    padding: 1rem 1.15rem;
    color: var(--app-text-body);
    font-size: 0.92rem;
    font-weight: 600;
    list-style: none;
}

.ui-disclosure-summary::-webkit-details-marker {
    display: none;
}

.ui-disclosure-body {
    padding: 0 1.15rem 1.15rem;
}

.ui-note {
    color: var(--app-text-soft);
    font-size: 0.9rem;
    line-height: 1.7;
}

.ui-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.5rem;
}

.ui-pagination-meta {
    color: var(--app-text-soft);
    font-size: 0.9rem;
}

.ui-pagination-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.site-nav-link,
.site-nav-action {
    font-size: 0.92rem;
    font-weight: 500;
}

.site-footer-grid {
    display: grid;
    grid-template-columns: 1.4fr repeat(3, minmax(0, 1fr));
    gap: 2rem;
}

.site-footer-title {
    margin-bottom: 1rem;
    color: #fff;
    font-size: 0.84rem;
    font-weight: 600;
}

.site-footer-links {
    display: grid;
    gap: 0.6rem;
}

.site-footer-link {
    color: rgba(204, 216, 232, 0.74);
    font-size: 0.9rem;
    transition: color 180ms ease;
}

.site-footer-link:hover {
    color: #fff;
}

.site-navbar {
    z-index: 50;
}

.site-navbar .max-w-7xl {
    margin-top: 1rem;
    transition: margin-top 220ms ease;
}

.site-navbar .h-16 {
    height: 4.25rem;
    padding: 0 1rem;
    border-radius: 999px;
    background: rgba(250, 252, 255, 0.78);
    box-shadow: 0 12px 34px rgba(17, 33, 58, 0.06);
    backdrop-filter: blur(18px);
}

.site-navbar.bg-surface-0\/95,
.site-navbar.backdrop-blur-md,
.site-navbar.shadow-lg {
    background: rgba(242, 246, 252, 0.92) !important;
    border-bottom: 1px solid rgba(21, 32, 51, 0.06);
    box-shadow: none !important;
}

.site-navbar.bg-surface-0\/95 .max-w-7xl,
.site-navbar.backdrop-blur-md .max-w-7xl,
.site-navbar.shadow-lg .max-w-7xl {
    margin-top: 0;
}

.site-navbar.bg-surface-0\/95 .h-16,
.site-navbar.backdrop-blur-md .h-16,
.site-navbar.shadow-lg .h-16 {
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.site-brand-mark,
.site-navbar .nav-cta {
    background: linear-gradient(135deg, #213f70 0%, #17315a 100%) !important;
    color: #fff !important;
}

.site-brand-wordmark {
    color: var(--app-text) !important;
}

.site-navbar a:not(.nav-cta),
.site-navbar button {
    color: var(--app-text-body) !important;
}

.site-navbar a:not(.nav-cta):hover,
.site-navbar button:hover {
    color: var(--app-text) !important;
}

.site-navbar-panel {
    margin: 0 1rem;
    border-radius: 1.5rem;
    background: rgba(250, 252, 255, 0.96);
    box-shadow: 0 18px 40px rgba(17, 33, 58, 0.08);
}

.site-footer {
    background: linear-gradient(180deg, rgba(17, 33, 58, 0.96), rgba(13, 24, 41, 0.98));
    color: rgba(235, 241, 250, 0.92);
}

.site-footer .site-brand-wordmark,
.site-footer h4 {
    color: #fff !important;
}

.site-footer a,
.site-footer p {
    color: rgba(204, 216, 232, 0.74) !important;
}

.site-footer a:hover {
    color: #fff !important;
}

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-shell {
    width: 100%;
    max-width: 28rem;
}

.auth-brand {
    margin-bottom: 2rem;
    text-align: center;
}

.auth-brand a {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
}

.auth-wordmark {
    color: var(--app-text);
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.04em;
}

.ui-auth-card {
    padding: 2rem;
}

.ui-form-stack {
    display: grid;
    gap: 1rem;
}

.ui-label {
    display: block;
    margin-bottom: 0.45rem;
    color: var(--app-text-body);
    font-size: 0.86rem;
    font-weight: 500;
}

.ui-helper-text {
    color: var(--app-text-soft);
    font-size: 0.9rem;
}

.ui-empty {
    padding: 4rem 1rem;
    text-align: center;
    color: var(--app-text-soft);
}

.ui-link {
    color: var(--app-accent);
    transition: color 180ms ease;
}

.ui-link:hover {
    color: var(--app-accent-strong);
}

.app-card-grid {
    display: grid;
    gap: 1.5rem;
}

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

.app-card-grid.cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.admin-navbar {
    background: rgba(247, 250, 253, 0.92);
    border-bottom: 1px solid rgba(21, 32, 51, 0.08);
    backdrop-filter: blur(16px);
}

.admin-navbar a {
    color: var(--app-text-body);
}

.admin-navbar a:hover {
    color: var(--app-text);
}

.admin-navbar-shell {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.admin-brand {
    color: var(--app-accent-strong) !important;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.admin-nav-link {
    display: inline-flex;
    align-items: center;
    min-height: 2.5rem;
    padding: 0 0.9rem;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 500;
}

.admin-nav-link:hover {
    background: rgba(21, 32, 51, 0.05);
}

.admin-stat-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25rem;
}

.admin-stat {
    border-radius: 1.5rem;
    padding: 1.5rem;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(244, 248, 252, 0.98));
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.72),
        var(--app-shadow-md);
}

.admin-stat-label {
    color: var(--app-text-soft);
    font-size: 0.82rem;
}

.admin-stat-value {
    margin-top: 0.5rem;
    color: var(--app-accent-strong);
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.04em;
}

.ui-alert {
    padding: 0.95rem 1rem;
    border-radius: 1rem;
    font-size: 0.92rem;
}

.ui-alert.success {
    background: rgba(31, 171, 84, 0.1);
    color: #0d7f45;
}

.ui-alert.error {
    background: rgba(229, 67, 67, 0.12);
    color: #b42318;
}

@media (max-width: 1023px) {
    .app-card-grid.cols-3,
    .admin-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

    .app-page-shell,
    .admin-shell {
        padding-top: 7rem;
    }
}

@media (max-width: 767px) {
    .app-card-grid.cols-2,
    .app-card-grid.cols-3,
    .admin-stat-grid,
    .ui-data-grid,
    .site-footer-grid {
        grid-template-columns: 1fr;
    }

    .ui-toolbar,
    .ui-pagination {
        flex-direction: column;
        align-items: stretch;
    }

    .app-page-shell,
    .admin-shell {
        padding: 6.6rem 1rem 4rem;
    }

    .site-navbar .h-16 {
        height: 3.9rem;
        border-radius: 1rem;
    }

    .site-navbar-panel {
        margin: 0 0.9rem;
    }
}
