﻿:root {
    --erp-bg: #e8eef5;
    --erp-bg-gradient: radial-gradient(circle at 0% 0%, #f8fbff 0%, #e8eef5 38%, #dee7f1 100%);
    --erp-surface: #ffffff;
    --erp-surface-muted: #f2f6fb;
    --erp-surface-soft: #ecf2f9;
    --erp-line: #d3deea;
    --erp-line-strong: #bac9db;
    --erp-text: #11263f;
    --erp-text-muted: #627990;
    --erp-text-soft: #8fa1b6;

    --erp-sidebar: #112033;
    --erp-sidebar-deep: #0d1827;
    --erp-sidebar-hover: #1a2d45;
    --erp-sidebar-active: #244b77;
    --erp-sidebar-line: rgba(190, 209, 231, 0.18);

    --erp-primary: #1f6fd6;
    --erp-primary-hover: #155ab4;
    --erp-success: #1b9c62;
    --erp-warning: #c77d16;
    --erp-danger: #d14d4d;
    --erp-info: #1c7ad9;

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;

    --shadow-sm: 0 1px 2px rgba(17, 38, 63, 0.12);
    --shadow-md: 0 8px 22px rgba(17, 38, 63, 0.12);

    --bg: var(--erp-bg);
    --surface: var(--erp-surface);
    --surface-light: var(--erp-surface-muted);
    --text: var(--erp-text);
    --text-muted: var(--erp-text-muted);
    --text-primary: var(--erp-text);
    --text-secondary: var(--erp-text-muted);
    --border: var(--erp-line);
    --accent-primary: var(--erp-primary);
    --bg-secondary: var(--erp-surface-muted);
    --bg-tertiary: var(--erp-surface-soft);

    --primary: var(--erp-primary);
    --success: var(--erp-success);
    --warning: var(--erp-warning);
    --error: var(--erp-danger);
    --info: var(--erp-info);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    font-family: 'IBM Plex Sans KR', 'Segoe UI', sans-serif;
    font-size: 14px;
    line-height: 1.45;
    color: var(--erp-text);
    background: var(--erp-bg-gradient);
    background-attachment: fixed;
}

a {
    color: var(--erp-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

small {
    color: var(--erp-text-muted);
}

.erp-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 130;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, var(--erp-sidebar) 0%, var(--erp-sidebar-deep) 100%);
    border-right: 1px solid rgba(9, 15, 24, 0.75);
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 14px 12px;
    border-bottom: 1px solid var(--erp-sidebar-line);
}

.brand-mark {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, #2a5f97 0%, #4088d1 100%);
    color: #f1f7ff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    box-shadow: var(--shadow-sm);
}

.brand-meta {
    min-width: 0;
}

.brand-title {
    color: #f7fbff;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.05em;
    line-height: 1.1;
}

.brand-sub {
    margin-top: 2px;
    color: #9db3cc;
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.sidebar-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 10px 8px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.nav-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-group-title {
    color: #8fa7c0;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    padding: 0 10px;
    margin-bottom: 2px;
}

.nav-item {
    display: grid;
    grid-template-columns: 40px 1fr;
    align-items: center;
    gap: 8px;
    color: #c3d1e3;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    padding: 7px 8px;
    transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.nav-item:hover {
    color: #f2f7ff;
    text-decoration: none;
    background: var(--erp-sidebar-hover);
}

.nav-item.active {
    color: #f6fbff;
    border-color: rgba(172, 200, 231, 0.35);
    background: var(--erp-sidebar-active);
}

.nav-code {
    width: 32px;
    height: 24px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(183, 201, 221, 0.2);
    color: #d7e6f9;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.07em;
}

.nav-item.active .nav-code {
    background: rgba(60, 145, 237, 0.24);
    color: #e7f2ff;
}

.nav-label {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-overlay {
    display: none;
}

.main-panel {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 110;
    min-height: 62px;
    padding: 10px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--erp-line);
    backdrop-filter: blur(4px);
}

.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-icon {
    width: 33px;
    height: 33px;
    border: 1px solid var(--erp-line-strong);
    border-radius: var(--radius-sm);
    background: #ffffff;
    color: #1d3552;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.btn-icon:hover {
    background: #f4f8fc;
}

.page-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
}

.page-caption {
    margin-top: 1px;
    font-size: 11px;
    color: var(--erp-text-muted);
}

.page-meta-row {
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.meta-chip {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    padding: 0 7px;
    border-radius: 999px;
    border: 1px solid #d5e1ef;
    background: #f5f9ff;
    color: #3d5878;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.topbar-clock {
    min-width: 118px;
    padding: 5px 8px;
    border: 1px solid var(--erp-line);
    border-radius: var(--radius-sm);
    background: #f8fbff;
    color: #4a6381;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
}

.user-chip {
    display: flex;
    flex-direction: column;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--erp-line);
    background: #f7fbff;
}

.user-name {
    color: var(--erp-text);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.1;
}

.user-role {
    color: var(--erp-text-muted);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.logout-form {
    margin: 0;
}

.content-wrap {
    padding: 14px 18px 20px;
}

.content-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.alert {
    border-radius: var(--radius-sm);
    border: 1px solid;
    padding: 9px 11px;
    font-size: 12px;
    font-weight: 600;
}

.alert-success {
    border-color: #b7e5c8;
    background: #ebf9f1;
    color: #1e6e46;
}

.alert-error {
    border-color: #efc2c2;
    background: #fdf1f1;
    color: #a52c2c;
}

.alert-warning {
    border-color: #f3d09c;
    background: #fff7ea;
    color: #9a5b06;
}

.card {
    border-radius: var(--radius-md);
    border: 1px solid #c9d7e7;
    background: var(--erp-surface);
    box-shadow: 0 2px 6px rgba(22, 51, 82, 0.08);
    overflow: hidden;
}

.card-header {
    min-height: 46px;
    padding: 9px 13px;
    background: linear-gradient(180deg, #fafdff 0%, #edf4fb 100%);
    border-bottom: 1px solid #d2deec;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.card-title {
    color: var(--erp-text);
    font-size: 14px;
    font-weight: 700;
}

.card-body {
    padding: 12px;
}

.table-container {
    overflow: auto;
    max-width: 100%;
    border-top: 1px solid #d6e1ef;
}

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

th,
td {
    border-bottom: 1px solid #dce5f1;
    padding: 8px 10px;
    vertical-align: middle;
    white-space: nowrap;
}

th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #eaf2fc;
    color: #274362;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

thead tr:nth-child(2) th {
    top: 35px;
    z-index: 2;
}

tbody tr:nth-child(even) {
    background: #f9fcff;
}

tbody tr:hover {
    background: #eff6ff;
}

.action-col {
    white-space: nowrap;
}

.sortable {
    cursor: pointer;
}

.no-sort,
.no-drag {
    cursor: default;
}

.col-filter {
    min-width: 84px;
    min-height: 28px;
    font-size: 12px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 7px 11px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn:hover {
    text-decoration: none;
}

.btn-sm {
    min-height: 28px;
    padding: 4px 8px;
    font-size: 11px;
}

.btn-primary {
    color: #ffffff;
    background: var(--erp-primary);
    border-color: var(--erp-primary);
}

.btn-primary:hover {
    background: var(--erp-primary-hover);
    border-color: var(--erp-primary-hover);
}

.btn-secondary {
    color: #2f4867;
    background: #ffffff;
    border-color: var(--erp-line-strong);
}

.btn-secondary:hover {
    background: #f5f9fd;
}

.btn-success {
    color: #1b6e45;
    background: #ecf9f2;
    border-color: #bfe3cf;
}

.btn-success:hover {
    background: #dff4e9;
}

.btn-danger {
    color: #a22d2d;
    background: #fef2f2;
    border-color: #efc0c0;
}

.btn-danger:hover {
    background: #fce6e6;
}

.form-group {
    margin-bottom: 10px;
}

.form-label,
.filter-group label,
label {
    display: inline-block;
    margin-bottom: 4px;
    color: #4d6380;
    font-size: 12px;
    font-weight: 600;
}

.form-control,
.filter-group input,
.filter-group select,
input[type="text"],
input[type="number"],
input[type="date"],
input[type="password"],
select,
textarea {
    width: 100%;
    min-height: 34px;
    border: 1px solid var(--erp-line-strong);
    border-radius: var(--radius-sm);
    background: #ffffff;
    color: var(--erp-text);
    font-size: 13px;
    font-family: inherit;
    padding: 6px 9px;
}

textarea {
    min-height: 72px;
    resize: vertical;
}

.form-control:focus,
.filter-group input:focus,
.filter-group select:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #7aaee8;
    box-shadow: 0 0 0 3px rgba(57, 124, 209, 0.16);
}

.form-control-sm {
    min-height: 30px;
    font-size: 12px;
    padding: 4px 7px;
}

.form-check-input,
input[type="checkbox"] {
    width: 16px;
    height: 16px;
    min-height: 16px;
    accent-color: var(--erp-primary);
}

.form-check-label,
.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #4d6380;
    cursor: pointer;
}

.filter-bar {
    border: 1px solid #cddbeb;
    background: var(--erp-surface);
    border-radius: var(--radius-md);
    padding: 11px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.filter-group {
    min-width: 150px;
    flex: 1;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 20px;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 11px;
    font-weight: 700;
}

.badge-success {
    background: #ecf9f2;
    border-color: #b9e2ca;
    color: #1f7a4f;
}

.badge-warning {
    background: #fff8ea;
    border-color: #f0d09c;
    color: #96610f;
}

.badge-error {
    background: #fef1f1;
    border-color: #efc2c2;
    color: #9f3030;
}

.badge-info {
    background: #edf5ff;
    border-color: #bfd9f7;
    color: #215ea7;
}

.badge-secondary {
    background: #f0f4fa;
    border-color: #d3dce8;
    color: #5c738f;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 12px;
}

.page-link {
    min-width: 28px;
    min-height: 28px;
    border: 1px solid var(--erp-line-strong);
    border-radius: var(--radius-sm);
    color: #3c5677;
    background: #ffffff;
    padding: 4px 8px;
    font-size: 12px;
    text-align: center;
    text-decoration: none;
}

.page-link.active {
    color: #ffffff;
    border-color: var(--erp-primary);
    background: var(--erp-primary);
}

.grid {
    display: grid;
    gap: 12px;
}

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

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

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

.stat-card {
    border-radius: var(--radius-md);
    border: 1px solid var(--erp-line);
    background: #ffffff;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-sm);
}

.stat-icon {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    background: #eaf2fd;
    color: #1d5394;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
}

.stat-content {
    min-width: 0;
}

.stat-value {
    color: var(--erp-text);
    font-size: 20px;
    font-weight: 700;
    line-height: 1.1;
}

.stat-label {
    color: var(--erp-text-muted);
    font-size: 12px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.detail-item {
    border: 1px solid var(--erp-line);
    border-radius: var(--radius-sm);
    background: #f8fbff;
    padding: 8px;
}

.detail-label {
    margin-bottom: 2px;
    color: var(--erp-text-muted);
    font-size: 11px;
}

.detail-value {
    color: var(--erp-text);
    font-size: 13px;
    font-weight: 600;
}

.tabs {
    border-bottom: 1px solid var(--erp-line);
}

.tab-link {
    border: none;
    background: transparent;
    color: #5a6f8a;
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.tab-link.active {
    color: var(--erp-primary);
    border-bottom-color: var(--erp-primary);
}

.tab-content {
    animation: fade-in 0.25s ease;
}

@keyframes fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.display-4 {
    font-size: 2rem;
    font-weight: 700;
}

.text-center {
    text-align: center;
}

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

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

.text-success {
    color: var(--erp-success);
}

.text-error,
.text-danger {
    color: var(--erp-danger);
}

.mt-1 {
    margin-top: 4px;
}

.mt-2 {
    margin-top: 8px;
}

.mt-3 {
    margin-top: 12px;
}

.mb-1 {
    margin-bottom: 4px;
}

.mb-2 {
    margin-bottom: 8px;
}

.mb-3 {
    margin-bottom: 12px;
}

.gap-1 {
    gap: 6px;
}

.gap-2 {
    gap: 10px;
}

.flex {
    display: flex;
}

.flex-wrap {
    flex-wrap: wrap;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.justify-end {
    justify-content: flex-end;
}

/* login */
.login-page {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at 12% 14%, rgba(112, 161, 221, 0.25) 0%, rgba(112, 161, 221, 0) 34%),
        radial-gradient(circle at 86% 90%, rgba(81, 131, 193, 0.22) 0%, rgba(81, 131, 193, 0) 35%),
        linear-gradient(165deg, #dfe9f4 0%, #f2f7fd 48%, #e5eef8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-shell {
    width: min(1100px, 100%);
    min-height: min(700px, calc(100vh - 40px));
    display: grid;
    grid-template-columns: minmax(290px, 440px) minmax(320px, 1fr);
    border: 1px solid #b9cadf;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.74);
    box-shadow: 0 20px 50px rgba(17, 38, 63, 0.18);
    overflow: hidden;
}

.auth-shell-compact {
    width: min(470px, 100%);
    min-height: auto;
    display: block;
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
}

.auth-aside {
    background: linear-gradient(180deg, #112033 0%, #172c43 100%);
    color: #e7f0fd;
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    border-right: 1px solid rgba(188, 211, 239, 0.25);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.auth-brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: linear-gradient(135deg, #2a5f97 0%, #3f89d5 100%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #f0f7ff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
}

.auth-brand-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.auth-brand-sub {
    margin-top: 2px;
    color: #a2bad6;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.auth-headline {
    margin: 10px 0 0;
    font-size: 24px;
    line-height: 1.25;
}

.auth-subline {
    margin: 0;
    color: #b7c9dc;
    font-size: 13px;
    line-height: 1.6;
}

.auth-kpi-grid {
    margin-top: 4px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.auth-kpi {
    border: 1px solid rgba(178, 204, 234, 0.25);
    border-radius: 8px;
    background: rgba(37, 67, 100, 0.35);
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.auth-kpi-label {
    color: #a9bfd7;
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 600;
}

.auth-kpi strong {
    color: #f2f7ff;
    font-size: 13px;
    font-weight: 700;
}

.auth-panel {
    padding: 30px;
    display: grid;
    align-items: center;
    background:
        linear-gradient(140deg, rgba(252, 254, 255, 0.95) 0%, rgba(246, 251, 255, 0.95) 100%);
}

.auth-panel-compact {
    padding: 0;
    background: transparent;
}

.auth-card {
    width: min(460px, 100%);
    justify-self: center;
    border: 1px solid #ccdaea;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 8px 24px rgba(18, 42, 68, 0.12);
    padding: 24px;
}

.auth-card-head h2 {
    margin: 0;
    color: #1b3553;
    font-size: 24px;
    line-height: 1.2;
}

.auth-card-head p {
    margin: 6px 0 0;
    color: #637a93;
    font-size: 13px;
}

.auth-form {
    margin-top: 18px;
}

.auth-submit {
    width: 100%;
    min-height: 38px;
    margin-top: 2px;
    font-size: 13px;
    letter-spacing: 0.01em;
}

@media (min-width: 981px) {
    body.sidebar-collapsed .erp-shell {
        grid-template-columns: 92px minmax(0, 1fr);
    }

    body.sidebar-collapsed .sidebar-header {
        justify-content: center;
    }

    body.sidebar-collapsed .brand-meta,
    body.sidebar-collapsed .nav-group-title,
    body.sidebar-collapsed .nav-label {
        display: none;
    }

    body.sidebar-collapsed .nav-item {
        grid-template-columns: 1fr;
        justify-items: center;
        padding: 8px 0;
    }

    body.sidebar-collapsed .nav-code {
        width: 36px;
        height: 24px;
    }
}

@media (max-width: 1280px) {
    .grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 980px) {
    .erp-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        width: 280px;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .app-overlay {
        position: fixed;
        inset: 0;
        z-index: 120;
        background: rgba(9, 20, 34, 0.48);
        display: none;
    }

    body.sidebar-open .app-overlay {
        display: block;
    }

    .topbar {
        padding: 10px 12px;
    }

    .topbar-right {
        gap: 6px;
    }

    .topbar-clock {
        display: none;
    }

    .user-chip {
        display: none;
    }

    .content-wrap {
        padding: 10px 12px 14px;
    }

    .grid-2,
    .grid-3,
    .grid-4,
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .auth-shell {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .auth-aside {
        padding: 18px;
    }

    .auth-panel {
        padding: 18px;
    }
}

@media (max-width: 640px) {
    body {
        font-size: 13px;
    }

    .card-header {
        align-items: flex-start;
    }

    .btn {
        padding: 6px 9px;
    }

    th,
    td {
        padding: 7px 8px;
    }

    .filter-group {
        min-width: 100%;
    }
}
