:root {
    --color-brand: #6789CA;
    --color-brand-strong: #4F73BB;
    --color-primary: #4F73BB;
    --color-brand-soft: #EEF3FC;
    --color-text-strong: #1F2937;
    --color-text: #374151;
    --color-text-muted: #6B7280;
    --color-border: #E5E7EB;
    --color-border-strong: #D1D5DB;
    --color-page-bg: #F7F8FA;
    --color-surface: #FFFFFF;
    --color-surface-muted: #F9FAFB;
    --color-success: #16834A;
    --color-success-soft: #EAF7EF;
    --color-warning: #C56A00;
    --color-warning-soft: #FFF6E8;
    --color-danger: #C63C3C;
    --color-danger-soft: #FDEEEE;
    --color-info: #3C6FB6;
    --color-info-soft: #EEF4FC;

    --font-family-base: "Pretendard GOV", -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", "Malgun Gothic", sans-serif;

    --font-size-caption: 12px;
    --font-size-meta: 13px;
    --font-size-body: 14px;
    --font-size-body-lg: 16px;
    --font-size-section: 18px;
    --font-size-page-title: 28px;

    --radius-control: 6px;
    --radius-panel: 8px;
    --radius-modal: 12px;

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;

    --sidebar-width: 252px;
    --sidebar-collapsed-width: 72px;
    --header-height: 72px;
    --focus-ring: 0 0 0 3px rgba(103, 137, 202, 0.22);
    --floating-shadow: 0 12px 30px rgba(31, 41, 55, 0.14);
}

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

html {
    min-width: 320px;
    background: var(--color-page-bg);
}

body {
    margin: 0;
    font-family: var(--font-family-base);
    font-size: var(--font-size-body);
    line-height: 1.5;
    color: var(--color-text-strong);
    background: var(--color-page-bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
    font: inherit;
}

a {
    color: inherit;
}

button,
a,
input,
select,
textarea,
[tabindex]:not([tabindex="-1"]) {
    outline: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:not([tabindex="-1"]):focus-visible {
    box-shadow: var(--focus-ring);
}

.skip-link {
    position: fixed;
    top: 8px;
    left: 8px;
    z-index: 1000;
    transform: translateY(-160%);
    padding: 10px 14px;
    border-radius: var(--radius-control);
    background: var(--color-text-strong);
    color: #fff;
    text-decoration: none;
    font-weight: 700;
}

.skip-link:focus {
    transform: translateY(0);
}

.app-shell {
    min-height: 100vh;
}

.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    display: flex;
    width: var(--sidebar-width);
    flex-direction: column;
    border-right: 1px solid var(--color-border);
    background: var(--color-surface);
    transition: width 160ms ease, transform 160ms ease;
}

.app-brand {
    min-height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 22px;
    border-bottom: 1px solid var(--color-border);
}

.app-brand__link {
    display: inline-flex;
    min-width: 0;
    align-items: center;
    gap: 12px;
    color: var(--color-text-strong);
    text-decoration: none;
}

.app-brand__mark {
    display: inline-flex;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--color-brand);
    color: #fff;
}

.app-brand__mark svg {
    width: 26px;
    height: 26px;
    fill: currentColor;
}

.app-brand__mark .app-brand__mark-cut {
    fill: var(--color-brand);
}

.app-brand__text {
    display: grid;
    min-width: 0;
    gap: 1px;
    white-space: nowrap;
}

.app-brand__text strong {
    font-size: 20px;
    line-height: 1.25;
    letter-spacing: -0.02em;
}

.app-brand__text span {
    color: var(--color-text-muted);
    font-size: 12px;
    font-weight: 500;
}

.app-nav {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 18px 12px 28px;
}

.app-nav__group + .app-nav__group {
    margin-top: 28px;
}

.app-nav__group-title {
    margin: 0 12px 8px;
    color: var(--color-brand-strong);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.app-nav__item {
    display: flex;
    min-height: 42px;
    align-items: center;
    gap: 12px;
    padding: 0 12px;
    border-radius: var(--radius-control);
    color: #4B5563;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.app-nav__item + .app-nav__item {
    margin-top: 2px;
}

.app-nav__item:hover {
    background: var(--color-surface-muted);
    color: var(--color-text-strong);
}

.app-nav__item.is-active {
    background: var(--color-brand-soft);
    color: var(--color-brand-strong);
    font-weight: 700;
}

.app-nav__icon {
    display: inline-flex;
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    align-items: center;
    justify-content: center;
}

.app-nav__icon svg,
.app-header__menu-button svg,
.app-account__avatar svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}


.app-sidebar__system-credit {
    flex: 0 0 auto;
    margin: 0 16px;
    padding: 12px 4px 11px;
    text-align: center;
}

.app-sidebar__system-credit p {
    margin: 0;
}

.app-sidebar__system-name {
    color: #667085;
    font-size: 10.5px;
    line-height: 1.4;
    font-weight: 600;
    letter-spacing: -0.015em;
}

.app-sidebar__developer {
    margin-top: 2px !important;
    color: #98A2B3;
    font-size: 9.5px;
    line-height: 1.4;
    font-weight: 400;
    letter-spacing: -0.02em;
    white-space: nowrap;
}

.app-sidebar__footer {
    flex: 0 0 auto;
    padding: 14px 12px;
    border-top: 1px solid var(--color-border);
}

.app-sidebar__collapse {
    display: flex;
    width: 100%;
    min-height: 42px;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    border: 0;
    border-radius: var(--radius-control);
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
}

.app-sidebar__collapse:hover {
    background: var(--color-surface-muted);
    color: var(--color-text-strong);
}

.app-sidebar__collapse-icon {
    font-size: 20px;
    line-height: 1;
}

.app-main {
    min-width: 0;
    min-height: 100vh;
    margin-left: var(--sidebar-width);
    transition: margin-left 160ms ease;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    min-height: var(--header-height);
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 0 30px;
    border-bottom: 1px solid var(--color-border);
    background: rgba(255, 255, 255, 0.98);
}

.app-header__left,
.app-header__right {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 16px;
}

.app-header__menu-button {
    display: none;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    padding: 9px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-control);
    background: #fff;
    color: var(--color-text);
    cursor: pointer;
}

.app-breadcrumb {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 10px;
    color: var(--color-text-muted);
    font-size: 13px;
    white-space: nowrap;
}

.app-breadcrumb strong {
    overflow: hidden;
    color: var(--color-text-strong);
    font-weight: 700;
    text-overflow: ellipsis;
}

.app-breadcrumb__separator {
    color: #9CA3AF;
    font-size: 18px;
}

.app-account {
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-account__avatar {
    display: inline-flex;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    padding: 7px;
    border-radius: 50%;
    background: #F3F4F6;
    color: var(--color-text);
}

.app-account__identity {
    display: grid;
    line-height: 1.3;
}

.app-account__identity strong {
    font-size: 13px;
    font-weight: 700;
}

.app-account__identity small {
    color: var(--color-text-muted);
    font-size: 11px;
}

.app-account__logout-form {
    margin: 0;
}

.app-account__logout {
    min-height: 34px;
    padding: 0 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-control);
    background: #fff;
    color: var(--color-text);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.app-account__logout:hover {
    background: var(--color-surface-muted);
}

.app-workspace {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 28px 30px 40px;
}

.message-stack {
    display: grid;
    gap: 8px;
    margin: 0 0 18px;
}

.app-alert {
    padding: 12px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-control);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 13px;
}

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

.app-alert--warning {
    border-color: #EACB9C;
    background: var(--color-warning-soft);
    color: #9B5400;
}

.app-alert--danger {
    border-color: #E7B9B9;
    background: var(--color-danger-soft);
    color: var(--color-danger);
}

.app-alert--info {
    border-color: #C5D6EE;
    background: var(--color-info-soft);
    color: var(--color-info);
}

.ui-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.ui-page-header__title {
    margin: 0;
    color: var(--color-text-strong);
    font-size: var(--font-size-page-title);
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.025em;
}

.ui-page-header__description {
    margin: 8px 0 0;
    color: var(--color-text-muted);
    font-size: 14px;
}

.ui-page-header__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.ui-panel {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    background: var(--color-surface);
}

.ui-panel__header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--color-border);
}

.ui-panel__body {
    padding: 20px;
}

.ui-section-title {
    margin: 0;
    font-size: var(--font-size-section);
    font-weight: 700;
    line-height: 1.4;
}

.ui-btn {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 14px;
    border: 1px solid transparent;
    border-radius: var(--radius-control);
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}

.ui-btn--primary {
    border-color: var(--color-brand-strong);
    background: var(--color-brand-strong);
    color: #fff;
}

.ui-btn--primary:hover {
    background: #4669AD;
}

.ui-btn--secondary {
    border-color: var(--color-border-strong);
    background: #fff;
    color: var(--color-text-strong);
}

.ui-btn--secondary:hover {
    background: var(--color-surface-muted);
}

.ui-btn--danger {
    border-color: var(--color-danger);
    background: var(--color-danger);
    color: #fff;
}

.ui-btn--ghost-danger {
    border-color: #E7B9B9;
    background: #fff;
    color: var(--color-danger);
}

.ui-control {
    width: 100%;
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-control);
    background: #fff;
    color: var(--color-text-strong);
}

textarea.ui-control {
    min-height: 110px;
    padding-top: 10px;
    padding-bottom: 10px;
    resize: vertical;
}

.ui-control:focus {
    border-color: var(--color-brand);
    box-shadow: var(--focus-ring);
}

.ui-field {
    display: grid;
    gap: 7px;
}

.ui-field__label {
    color: var(--color-text-strong);
    font-size: 13px;
    font-weight: 700;
}

.ui-field__help,
.ui-field__error {
    margin: 0;
    font-size: 12px;
}

.ui-field__help {
    color: var(--color-text-muted);
}

.ui-field__error {
    color: var(--color-danger);
}

.ui-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    background: #fff;
}

.ui-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.ui-table th,
.ui-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--color-border);
    text-align: left;
    vertical-align: middle;
}

.ui-table th {
    background: var(--color-surface-muted);
    color: var(--color-text);
    font-weight: 700;
    white-space: nowrap;
}

.ui-table tbody tr:last-child td {
    border-bottom: 0;
}

.ui-table tbody tr:hover {
    background: #FBFCFE;
}

.ui-badge {
    display: inline-flex;
    min-height: 24px;
    align-items: center;
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.ui-badge--success {
    background: var(--color-success-soft);
    color: var(--color-success);
}

.ui-badge--warning {
    background: var(--color-warning-soft);
    color: var(--color-warning);
}

.ui-badge--danger {
    background: var(--color-danger-soft);
    color: var(--color-danger);
}

.ui-badge--neutral {
    background: #F3F4F6;
    color: #4B5563;
}

.ui-badge--brand {
    background: var(--color-brand-soft);
    color: var(--color-brand-strong);
}

.app-shell.is-sidebar-collapsed .app-sidebar {
    width: var(--sidebar-collapsed-width);
}

.app-shell.is-sidebar-collapsed .app-main {
    margin-left: var(--sidebar-collapsed-width);
}

.app-shell.is-sidebar-collapsed .app-brand {
    padding-right: 15px;
    padding-left: 15px;
}

.app-shell.is-sidebar-collapsed .app-brand__text,
.app-shell.is-sidebar-collapsed .app-nav__group-title,
.app-shell.is-sidebar-collapsed .app-nav__item > span:last-child,
.app-shell.is-sidebar-collapsed .app-sidebar__collapse > span:last-child,
.app-shell.is-sidebar-collapsed .app-sidebar__system-credit {
    display: none;
}

.app-shell.is-sidebar-collapsed .app-nav__item,
.app-shell.is-sidebar-collapsed .app-sidebar__collapse {
    justify-content: center;
    padding-right: 0;
    padding-left: 0;
}

.app-shell.is-sidebar-collapsed .app-sidebar__collapse-icon {
    transform: rotate(180deg);
}

.app-shell-backdrop {
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(17, 24, 39, 0.35);
}

@media (max-width: 1050px) {
    .app-sidebar {
        transform: translateX(-100%);
    }

    .app-shell.is-mobile-sidebar-open .app-sidebar {
        transform: translateX(0);
        width: min(var(--sidebar-width), 86vw);
    }

    .app-main,
    .app-shell.is-sidebar-collapsed .app-main {
        margin-left: 0;
    }

    .app-header__menu-button {
        display: inline-flex;
    }

    .app-sidebar__collapse {
        display: none;
    }

    .app-shell.is-mobile-sidebar-open + .app-shell-backdrop {
        display: block;
    }
}

@media (max-width: 720px) {
    .app-header {
        padding: 0 16px;
    }

    .app-workspace {
        padding: 22px 16px 32px;
    }

    .app-breadcrumb > span:first-child,
    .app-breadcrumb__separator,
    .app-account__identity {
        display: none;
    }

    .ui-page-header {
        flex-direction: column;
    }

    .ui-page-header__actions {
        width: 100%;
        justify-content: flex-start;
    }
}

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