:root {
    --sidebar: #17182d;
    --sidebar-active: #203d63;
    --header: #263b4d;
    --bg: #eef2f6;
    --panel: #ffffff;
    --line: #dce4ec;
    --line-soft: #edf1f5;
    --text: #172335;
    --muted: #7b8a9c;
    --blue: #2f66b1;
    --blue-soft: #e7f0fb;
    --green: #0f8a5f;
    --green-soft: #e9f7f0;
    --purple: #6d4fd2;
    --purple-soft: #f1edff;
}

/* Dashboard */
.dashboard-page {
    position: relative;
    display: grid;
    gap: 18px;
}

.dashboard-page.is-loading::after {
    content: "";
    position: absolute;
    z-index: 5;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, transparent, #2f66b1, transparent);
    animation: dashboard-loading 1s linear infinite;
}

@keyframes dashboard-loading {
    from { transform: translateX(-50%); }
    to { transform: translateX(50%); }
}

.dashboard-filterbar,
.dashboard-filter-controls,
.dashboard-filter-controls label {
    display: flex;
    align-items: center;
}

.dashboard-filterbar {
    justify-content: space-between;
    gap: 16px;
    min-height: 42px;
}

.dashboard-period-label {
    color: #68798c;
    font-size: 12px;
}

.dashboard-period-label strong {
    margin-left: 6px;
    color: #263f68;
}

.dashboard-filter-controls {
    justify-content: flex-end;
    gap: 8px;
}

.dashboard-filter-controls label {
    gap: 7px;
    color: #68798c;
    font-size: 12px;
}

.dashboard-filter-controls select {
    height: 36px;
    padding: 0 30px 0 11px;
    border: 1px solid #d4dde7;
    border-radius: 6px;
    color: #25384d;
    background: #fff;
}

.is-hidden { display: none !important; }

.dashboard-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.dashboard-metric {
    position: relative;
    min-height: 112px;
    padding: 20px 22px;
    overflow: hidden;
    border: 1px solid #dce4ec;
    border-top: 3px solid #243f78;
    border-radius: 7px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(31, 52, 75, .06);
}

.dashboard-metric.tone-2 { border-top-color: #2d6cdf; }
.dashboard-metric.tone-3 { border-top-color: #16825d; }
.dashboard-metric.tone-4 { border-top-color: #bd5a19; }

.dashboard-metric span,
.dashboard-metric small,
.dashboard-metric strong { display: block; }
.dashboard-metric span { color: #7b899a; font-size: 12px; font-weight: 700; }
.dashboard-metric strong { margin: 9px 0 5px; color: #172335; font-size: 27px; }
.dashboard-metric small { color: #8a97a7; font-size: 11px; }

.dashboard-panel,
.dashboard-finance {
    min-width: 0;
    overflow: hidden;
    border: 1px solid #dce4ec;
    border-radius: 7px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(31, 52, 75, .05);
}

.dashboard-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 50px;
    padding: 0 20px;
    border-bottom: 1px solid #e4eaf0;
}

.dashboard-panel-head h2 {
    margin: 0;
    color: #24364c;
    font-size: 14px;
}

.dashboard-panel-head > span { color: #8492a3; font-size: 12px; }

.dashboard-finance {
    padding: 0 22px 22px;
    color: #dce7ff;
    background: #203b75;
    border-color: #203b75;
}

.dashboard-panel-head.is-dark {
    padding: 0;
    border-color: rgba(255,255,255,.12);
}

.dashboard-panel-head.is-dark h2 { color: #e9f0ff; }

.finance-cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 18px 0;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 6px;
}

.finance-cards > div { min-height: 98px; padding: 18px; border-right: 1px solid rgba(255,255,255,.12); }
.finance-cards > div:last-child { border-right: 0; }
.finance-cards span, .finance-cards strong, .finance-cards small { display: block; }
.finance-cards span { color: #aebcda; font-size: 11px; }
.finance-cards strong { margin: 8px 0; color: #50dfcf; font-size: 22px; }
.finance-cards > div:nth-child(3) strong { color: #ff9b9b; }
.finance-cards small { color: #8fa3cb; font-size: 10px; }

.finance-bars > div:first-child { display: flex; justify-content: space-between; font-size: 11px; }
.finance-progress { height: 8px; margin-top: 8px; overflow: hidden; border-radius: 4px; background: rgba(255,255,255,.12); }
.finance-progress i { display: block; height: 100%; border-radius: inherit; background: #4ad8c9; transition: width .35s ease; }

.dashboard-two-column { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.dashboard-table-wrap { width: 100%; overflow-x: auto; }
.dashboard-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.dashboard-table th { padding: 13px 14px; color: #56677d; background: #fafbfd; font-size: 11px; text-align: left; white-space: nowrap; }
.dashboard-table td { height: 46px; padding: 10px 14px; border-top: 1px solid #e8edf2; color: #34465a; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-table .is-strong { color: #203657; font-weight: 700; }

.dashboard-tag,
.stage-tag,
.unlinked-badge,
.document-status {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 0 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
}

.dashboard-tag.is-oem { color: #6846bd; background: #f0ebff; }
.dashboard-tag.is-ws { color: #1773a2; background: #e7f5fb; }
.stage-tag { color: #2f5ba6; background: #eaf1fc; }
.unlinked-badge { color: #7a8795; background: #eef1f4; }
.document-status.is-complete { color: #127251; background: #e7f6ef; }
.document-status.is-pending { color: #bd443d; background: #fff0ef; }

.dashboard-pipeline { padding: 8px 18px 14px; }
.dashboard-pipeline > div { display: grid; grid-template-columns: 1.3fr 1fr .8fr auto; align-items: center; gap: 12px; min-height: 44px; border-bottom: 1px solid #edf1f5; font-size: 11px; }
.dashboard-pipeline > div:last-child { border-bottom: 0; }
.dashboard-pipeline strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-pipeline span:not(.stage-tag) { color: #6e7d8e; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.stage-matrix { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; padding: 18px; }
.stage-matrix > div { min-height: 78px; padding: 13px; border: 1px solid #e0e7ef; border-radius: 5px; background: #f8fafc; }
.stage-matrix strong { display: block; margin-bottom: 12px; font-size: 11px; }
.stage-matrix span { display: block; color: #718196; font-size: 10px; line-height: 1.7; }

.manager-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 18px; }
.manager-grid article { padding: 15px; border: 1px solid #e0e7ef; border-top: 2px solid #294f90; border-radius: 5px; }
.manager-grid article > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.manager-grid article > small { display: block; margin: 10px 0; color: #7a8899; }
.manager-grid dl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 0; }
.manager-grid dl div { padding: 8px; text-align: center; background: #f6f8fb; }
.manager-grid dt { color: #8a97a6; font-size: 9px; }
.manager-grid dd { margin: 4px 0 0; color: #27487e; font-weight: 800; }

.dashboard-action-list { display: grid; gap: 8px; padding: 16px 20px; }
.dashboard-action-list article { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 52px; padding: 10px 14px; border: 1px solid #dbe5ef; border-radius: 5px; background: #f9fbfd; }
.dashboard-action-list article i { width: 9px; height: 9px; border-radius: 50%; background: #3774c8; }
.dashboard-action-list article.action-warning { border-color: #efd28b; background: #fffaf0; }
.dashboard-action-list article.action-warning i { background: #d9a02f; }
.dashboard-action-list article.action-danger { border-color: #efb5b5; background: #fff5f5; }
.dashboard-action-list article.action-danger i { background: #d94a52; }
.dashboard-action-list strong, .dashboard-action-list span { display: block; }
.dashboard-action-list strong { color: #27384b; font-size: 12px; }
.dashboard-action-list span, .dashboard-action-list small { margin-top: 3px; color: #7c8998; font-size: 10px; }
.dashboard-empty { padding: 28px !important; color: #8b98a7 !important; text-align: center !important; }

@media (max-width: 1180px) {
    .dashboard-metrics, .finance-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .finance-cards > div:nth-child(2) { border-right: 0; }
    .finance-cards > div:nth-child(-n+2) { border-bottom: 1px solid rgba(255,255,255,.12); }
    .manager-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    .dashboard-filterbar, .dashboard-filter-controls { align-items: stretch; flex-direction: column; }
    .dashboard-filter-controls label { justify-content: space-between; }
    .dashboard-two-column, .dashboard-metrics, .finance-cards, .manager-grid { grid-template-columns: 1fr; }
    .finance-cards > div { border-right: 0; border-bottom: 1px solid rgba(255,255,255,.12); }
    .stage-matrix { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

* {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    color: var(--text);
    background: var(--bg);
    font-family: Arial, "Noto Sans KR", "Malgun Gothic", sans-serif;
    font-size: 14px;
}

a {
    color: inherit;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    display: flex;
    flex-direction: column;
    width: 220px;
    min-height: 100vh;
    padding: 22px 16px 18px;
    color: #d9e2ef;
    background: var(--sidebar);
}

.brand {
    display: grid;
    justify-items: center;
    gap: 8px;
    padding: 0 0 24px;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
}

.brand img {
    width: 58px;
    height: 58px;
    object-fit: contain;
}

.brand strong {
    color: #c9d3e1;
    font-size: 11px;
    letter-spacing: .08em;
}

.nav {
    flex: 1;
    margin-top: 22px;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: thin;
}

.nav p {
    margin: 22px 0 8px;
    color: #717b8f;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
}

.nav a {
    display: flex;
    align-items: center;
    min-height: 42px;
    padding: 0 14px;
    color: #b9c4d4;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
}

.nav a:hover,
.nav a.active {
    color: #ffffff;
    background: var(--sidebar-active);
}

.sidebar-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, .12);
}

.signed-user {
    min-width: 0;
}

.sidebar-footer span {
    display: block;
    color: #8792a4;
    font-size: 12px;
}

.sidebar-footer strong {
    display: block;
    margin-top: 4px;
    color: #e7edf5;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.logout-button {
    flex: 0 0 auto;
    padding: 7px 9px;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 4px;
    color: #cbd5e1;
    background: transparent;
    font-size: 11px;
    cursor: pointer;
}

.logout-button:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, .08);
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    margin: 0;
    padding: 24px;
    background: #edf1f5;
}

.login-shell {
    display: grid;
    grid-template-columns: 250px minmax(340px, 430px);
    width: min(100%, 680px);
    min-height: 440px;
    border: 1px solid #d9e1e8;
    background: #ffffff;
    box-shadow: 0 18px 48px rgba(25, 42, 62, .12);
}

.login-brand-panel {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 42px 32px;
    color: #ffffff;
    background: #17283a;
}

.login-brand-panel img {
    width: 62px;
    height: 62px;
    object-fit: contain;
}

.login-brand-panel strong,
.login-brand-panel span {
    display: block;
}

.login-brand-panel strong {
    margin-bottom: 8px;
    font-size: 21px;
}

.login-brand-panel span {
    color: #9fb2c4;
    font-size: 12px;
}

.login-panel {
    padding: 52px 44px 44px;
}

.login-heading span {
    color: #64778a;
    font-size: 11px;
    font-weight: 700;
}

.login-heading h1 {
    margin: 10px 0 8px;
    color: #1c2f42;
    font-size: 26px;
}

.login-heading p {
    margin: 0 0 30px;
    color: #7a8997;
    font-size: 13px;
}

.login-message {
    margin-bottom: 16px;
    padding: 10px 12px;
    border: 1px solid;
    border-radius: 4px;
    font-size: 12px;
}

.login-message.error {
    color: #9f3a3a;
    border-color: #efd0d0;
    background: #fff7f7;
}

.login-message.success {
    color: #286947;
    border-color: #c9e5d7;
    background: #f4fbf7;
}

.login-form {
    display: grid;
    gap: 9px;
}

.login-form label {
    margin-top: 7px;
    color: #405365;
    font-size: 12px;
    font-weight: 700;
}

.login-form input {
    width: 100%;
    height: 43px;
    padding: 0 12px;
    border: 1px solid #cfd9e2;
    border-radius: 4px;
    color: #203448;
    background: #ffffff;
}

.login-form input:focus {
    border-color: #4e7193;
    outline: 2px solid rgba(78, 113, 147, .12);
}

.login-form button {
    height: 44px;
    margin-top: 18px;
    border: 0;
    border-radius: 4px;
    color: #ffffff;
    background: #23496d;
    font-weight: 700;
    cursor: pointer;
}

.login-form button:hover {
    background: #1b3c5b;
}

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

    .login-brand-panel {
        min-height: 140px;
        padding: 24px;
    }

    .login-panel {
        padding: 34px 26px;
    }
}

.main {
    min-height: 100vh;
    margin-left: 220px;
}

.topbar {
    display: flex;
    align-items: center;
    min-height: 86px;
    padding: 22px 30px;
    color: #ffffff;
    background: var(--header);
}

.topbar h1 {
    margin: 0 0 5px;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 0;
}

.topbar span {
    color: #b8c6d4;
    font-size: 13px;
}

.content {
    padding: 26px 30px 40px;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.toolbar-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #263b4d;
    font-size: 15px;
    font-weight: 800;
}

.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 14px;
    border: 1px solid #cfd9e3;
    border-radius: 6px;
    color: #263b4d;
    background: #ffffff;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

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

.btn.small {
    min-height: 30px;
    padding: 0 10px;
    font-size: 12px;
}

.btn.danger {
    color: #b42318;
    border-color: #f2c7c3;
    background: #fff5f4;
}

.search-input,
.filter-select {
    min-height: 38px;
    padding: 0 12px;
    border: 1px solid #cfd9e3;
    border-radius: 6px;
    color: var(--text);
    background: #ffffff;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.metric,
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .05);
}

.metric {
    min-height: 94px;
    padding: 18px;
    border-top: 3px solid var(--blue);
}

.metric span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.metric strong {
    display: block;
    margin-top: 8px;
    color: #0f1f35;
    font-size: 30px;
    line-height: 1;
}

.metric small {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-size: 12px;
}

.panel {
    overflow: hidden;
    margin-bottom: 18px;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--line);
}

.panel-head.stackable {
    align-items: stretch;
    flex-direction: column;
}

.filter-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.search-input.wide {
    min-width: 280px;
}

.search-input.narrow {
    width: 120px;
}

.selection-count {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 10px;
    color: #405166;
    background: #f4f7fa;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.panel-head h2 {
    margin: 0;
    font-size: 17px;
    font-weight: 800;
}

.panel-head span {
    color: var(--muted);
    font-size: 12px;
}

.table-wrap {
    overflow-x: auto;
}

.check-cell {
    width: 46px;
    text-align: center;
}

table {
    width: 100%;
    min-width: 980px;
    border-collapse: collapse;
    font-size: 13px;
}

th {
    background: #30475d;
    color: #ffffff;
    text-align: left;
    font-weight: 800;
}

th,
td {
    height: 52px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line-soft);
    vertical-align: middle;
}

tbody tr:hover td {
    background: #f8fafc;
}

.num,
.money {
    text-align: right;
    white-space: nowrap;
}

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

.strong {
    font-weight: 800;
}

.tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    color: #24528d;
    background: var(--blue-soft);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.tag.oem {
    color: var(--purple);
    background: var(--purple-soft);
}

.tag.ws {
    color: #1e78a8;
    background: #e6f5fc;
}

.tag.ok {
    color: var(--green);
    background: var(--green-soft);
}

.empty {
    padding: 34px;
    color: var(--muted);
    text-align: center;
}

.product-thumb {
    width: 46px;
    height: 46px;
    border: 1px solid var(--line);
    border-radius: 6px;
    object-fit: cover;
    background: #f3f6f9;
}

.action-btns {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, .56);
}

.modal-backdrop.open {
    display: flex;
}

.modal {
    width: min(920px, 100%);
    max-height: calc(100vh - 48px);
    overflow: hidden;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 24px 80px rgba(15, 23, 42, .28);
}

.modal.large {
    width: min(1120px, 100%);
}

.modal.xl {
    width: min(1360px, 100%);
}

.modal-head,
.modal-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
}

.modal-foot {
    justify-content: flex-end;
    border-top: 1px solid var(--line);
    border-bottom: 0;
}

.modal-head h2 {
    margin: 0;
    font-size: 18px;
}

.modal-close {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 6px;
    color: #6b7788;
    background: transparent;
    font-size: 24px;
    cursor: pointer;
}

.modal-close:hover {
    background: #f1f4f8;
}

.modal-body {
    max-height: calc(100vh - 176px);
    overflow-y: auto;
    padding: 20px;
}

.form-grid {
    display: grid;
    gap: 14px;
}

.form-section-title {
    margin: 20px 0 12px;
    padding-top: 16px;
    border-top: 1px solid var(--line-soft);
    color: #263b4d;
    font-size: 14px;
    font-weight: 900;
}

.form-section-title:first-of-type {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

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

.form-grid label {
    display: grid;
    gap: 7px;
}

.form-grid label.full {
    grid-column: 1 / -1;
}

.form-grid span {
    color: #405166;
    font-size: 12px;
    font-weight: 800;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
    width: 100%;
    min-height: 38px;
    padding: 9px 10px;
    border: 1px solid #cfd9e3;
    border-radius: 6px;
    color: var(--text);
    background: #ffffff;
    font: inherit;
}

.form-grid textarea {
    min-height: 78px;
    resize: vertical;
}

.inline-field {
    display: flex;
    gap: 8px;
}

.inline-field input {
    flex: 1;
}

.toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 40;
    display: none;
    max-width: 360px;
    padding: 12px 14px;
    border-radius: 8px;
    color: #ffffff;
    background: #263b4d;
    box-shadow: 0 12px 32px rgba(15, 23, 42, .22);
    font-weight: 700;
}

.toast.show {
    display: block;
}

.toast.success {
    background: #12805c;
}

.toast.error {
    background: #b42318;
}

.order-editor {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(360px, .85fr);
    gap: 16px;
}

.order-left,
.order-right {
    display: grid;
    align-content: start;
    gap: 16px;
}

.sub-panel {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

.sub-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px;
    border-bottom: 1px solid var(--line-soft);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 14px;
}

.info-grid label {
    display: grid;
    gap: 6px;
}

.info-grid span {
    color: #627084;
    font-size: 12px;
    font-weight: 800;
}

.info-grid input,
.search-input.full {
    width: 100%;
}

.tab-row {
    display: flex;
    gap: 8px;
    padding: 14px 14px 0;
}

.tab {
    min-height: 34px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: #405166;
    background: #ffffff;
    font-weight: 800;
    cursor: pointer;
}

.tab.active {
    color: #ffffff;
    border-color: var(--blue);
    background: var(--blue);
}

.product-card-list,
.buyer-card-list,
.selected-item-list {
    display: grid;
    gap: 8px;
    max-height: 360px;
    overflow-y: auto;
    padding: 14px;
}

.product-card,
.buyer-card,
.selected-item {
    display: grid;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f9fbfd;
}

.product-card {
    grid-template-columns: 52px 1fr auto;
}

.buyer-card {
    grid-template-columns: 1fr auto;
}

.selected-item {
    grid-template-columns: 52px 1fr 76px auto;
}

.product-card strong,
.buyer-card strong,
.selected-item strong {
    display: block;
    margin-bottom: 4px;
}

.product-card span,
.buyer-card span,
.selected-item span,
.product-card small,
.buyer-card small,
.selected-item small {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.selected-item input {
    width: 76px;
    min-height: 32px;
    padding: 0 8px;
    border: 1px solid #cfd9e3;
    border-radius: 6px;
    text-align: right;
}

.summary-box {
    display: grid;
    gap: 10px;
    padding: 14px;
    border-top: 1px solid var(--line-soft);
    background: #f7faff;
}

.summary-box div {
    display: flex;
    justify-content: space-between;
}

.summary-box small {
    color: var(--muted);
    text-align: right;
}

.empty.compact {
    padding: 16px;
}

.order-preview {
    padding: 20px;
}

.preview-head {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding-bottom: 18px;
    border-bottom: 2px solid #172335;
}

.preview-head h2 {
    margin: 0 0 8px;
    color: #374bd8;
    font-size: 32px;
}

.preview-head strong {
    align-self: center;
    font-size: 20px;
}

.preview-info {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin: 18px 0;
}

.preview-info > div {
    min-height: 120px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f4f8fc;
}

.preview-info span {
    display: block;
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
}

.preview-table {
    min-width: 760px;
}

.preview-total {
    width: min(360px, 100%);
    margin: 20px 0 0 auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.preview-total div {
    display: flex;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line-soft);
}

.preview-total div:last-child {
    border-bottom: 0;
}

.preview-total .accent {
    color: #ffffff;
    background: #3167e0;
}

.preview-foot {
    margin-top: 32px;
    padding-top: 18px;
    color: var(--muted);
    border-top: 1px solid var(--line);
    font-size: 12px;
}

.pi-editor-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(360px, .8fr);
    gap: 16px;
    margin-bottom: 18px;
}

.table-input {
    width: 100%;
    min-height: 34px;
    padding: 7px 9px;
    border: 1px solid #cfd9e3;
    border-radius: 6px;
    color: var(--text);
    background: #ffffff;
    font: inherit;
}

.narrow-input {
    width: 92px;
}

.pi-preview-doc {
    max-width: 980px;
    margin: 0 auto;
    background: #ffffff;
}

.pi-doc-head {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 24px;
    padding: 28px 32px;
    color: #ffffff;
    background: #213a7a;
}

.pi-doc-head h2 {
    margin: 0 0 12px;
    font-size: 24px;
}

.pi-doc-head p {
    margin: 0;
    color: #dbe7ff;
    line-height: 1.6;
}

.pi-doc-head strong {
    display: block;
    font-size: 34px;
    letter-spacing: .08em;
}

.pi-doc-head span {
    display: block;
    color: #42d5ee;
    font-size: 26px;
    letter-spacing: .22em;
    text-align: right;
}

.pi-doc-head small {
    display: block;
    margin-top: 8px;
    text-align: right;
}

.pi-doc-info {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border-left: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.pi-doc-info > div {
    min-height: 110px;
    padding: 18px;
    border-right: 1px solid var(--line);
}

.pi-doc-info span {
    display: block;
    margin-bottom: 10px;
    color: #38bfd1;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .08em;
}

.project-detail-head {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}

.project-detail-head > div {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fbfe;
}

.project-detail-head span {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.stage-line {
    display: grid;
    grid-template-columns: repeat(7, minmax(90px, 1fr));
    gap: 8px;
    margin: 0 0 18px;
    overflow-x: auto;
}

.stage-node {
    position: relative;
    min-height: 86px;
    padding: 14px 10px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    text-align: center;
}

.stage-node span {
    display: block;
    width: 18px;
    height: 18px;
    margin: 0 auto 8px;
    border: 3px solid #cfd9e3;
    border-radius: 50%;
    background: #ffffff;
}

.stage-node.in_progress {
    border-color: #8fb5ee;
    background: #f0f6ff;
}

.stage-node.in_progress span {
    border-color: var(--blue);
    background: var(--blue);
}

.stage-node.completed {
    border-color: #a9dfc6;
    background: #eefaf4;
}

.stage-node.completed span {
    border-color: var(--green);
    background: var(--green);
}

.stage-node strong,
.stage-node small {
    display: block;
}

.stage-node small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

.doc-chip {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 8px;
    margin-right: 4px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
}

.doc-chip.ok {
    background: #e9f7ef;
    color: #147a48;
}

.settings-grid {
    display: grid;
    grid-template-columns: minmax(360px, 0.75fr) minmax(520px, 1.25fr);
    gap: 16px;
}

.settings-panel {
    padding: 0;
    overflow: hidden;
}

.panel-title {
    padding: 20px 22px 14px;
    border-bottom: 1px solid var(--line);
}

.panel-title h2 {
    margin: 0 0 6px;
    font-size: 18px;
    color: var(--ink);
}

.panel-title p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.settings-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    padding: 20px 22px;
}

.settings-form label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.settings-form input {
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    font-size: 15px;
    font-weight: 800;
}

.settings-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 0 22px 20px;
}

.settings-meta div {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fbfe;
}

.settings-meta span,
.settings-meta strong {
    display: block;
}

.settings-meta span {
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.panel-actions {
    display: flex;
    justify-content: flex-end;
    padding: 16px 22px;
    border-top: 1px solid var(--line);
    background: #f8fbfe;
}

.table-wrap.compact {
    max-height: 420px;
    overflow: auto;
}

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

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

    .dash-grid {
        grid-template-columns: 1fr;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }
}
.account-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.account-summary-card {
    padding: 18px 20px;
    border: 1px solid var(--line);
    border-top: 3px solid #335c82;
    border-radius: 6px;
    background: #ffffff;
}

.account-summary-card span,
.account-summary-card strong {
    display: block;
}

.account-summary-card span {
    color: var(--muted);
    font-size: 12px;
}

.account-summary-card strong {
    margin-top: 7px;
    color: #1c3043;
    font-size: 24px;
}

.account-filter-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px;
    border-bottom: 1px solid var(--line);
}

.account-search {
    width: min(380px, 100%);
}

.account-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 9px;
    border: 1px solid #d8e0e8;
    border-radius: 4px;
    color: #405466;
    background: #f7f9fb;
    font-size: 11px;
    font-weight: 700;
}

.account-badge.role-master {
    color: #234f75;
    border-color: #cbdbe9;
    background: #eef5fa;
}

.account-badge.status-active {
    color: #246147;
    border-color: #cde2d6;
    background: #f1f8f4;
}

.account-badge.status-inactive {
    color: #7a4b4b;
    border-color: #ead7d7;
    background: #fbf5f5;
}

.account-modal {
    width: min(720px, 100%);
}

.account-modal small {
    display: block;
    margin-top: 7px;
    color: var(--muted);
    font-size: 11px;
}

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

    .account-filter-bar {
        align-items: stretch;
        flex-direction: column;
    }

    .account-search {
        width: 100%;
    }
}
.manager-assignment-panel {
    margin: 16px 0;
}

.manager-assignment-fields {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(260px, 1.4fr) auto;
    gap: 8px;
    padding: 14px;
}

.manager-assignment-fields select,
.manager-assignment-fields input {
    min-width: 0;
}

@media (max-width: 900px) {
    .manager-assignment-fields {
        grid-template-columns: 1fr;
    }
}
.log-count {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.log-filter-panel {
    margin-bottom: 16px;
}

.log-filter-row {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px;
}

.date-filter {
    display: grid;
    gap: 5px;
    min-width: 154px;
}

.date-filter span {
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
}

.date-filter input {
    width: 154px;
    height: 38px;
    padding: 0 10px;
    border: 1px solid #ccd7e0;
    border-radius: 5px;
    outline: none;
    color: #34495e;
    background: #ffffff;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: border-color .16s ease, box-shadow .16s ease;
}

.date-filter input:hover {
    border-color: #aebdca;
}

.date-filter input:focus {
    border-color: #4e7193;
    box-shadow: 0 0 0 3px rgba(78, 113, 147, .12);
}

.date-filter input::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: .62;
}

.log-timeline {
    display: grid;
    gap: 18px;
}

.log-date-group {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 16px;
}

.log-date-label {
    padding-top: 16px;
    color: #52687c;
    font-size: 12px;
    font-weight: 700;
    text-align: right;
}

.log-card-list {
    display: grid;
    gap: 8px;
    padding-left: 16px;
    border-left: 1px solid #ced8e2;
}

.system-log-card {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 118px;
    gap: 16px;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-left: 3px solid #416b91;
    border-radius: 5px;
    background: #ffffff;
    box-shadow: 0 3px 10px rgba(30, 49, 68, .04);
}

.system-log-card::before {
    position: absolute;
    top: 20px;
    left: -23px;
    width: 11px;
    height: 11px;
    border: 3px solid #eef2f6;
    border-radius: 50%;
    background: #416b91;
    content: '';
}

.system-log-card.tone-success {
    border-left-color: #3b8062;
}

.system-log-card.tone-success::before {
    background: #3b8062;
}

.system-log-card.tone-danger {
    border-left-color: #a55757;
}

.system-log-card.tone-danger::before {
    background: #a55757;
}

.log-card-main {
    min-width: 0;
}

.log-title-row {
    display: flex;
    align-items: center;
    gap: 9px;
}

.log-event-badge {
    padding: 3px 7px;
    border: 1px solid #d4dee7;
    border-radius: 3px;
    color: #3c566e;
    background: #f5f8fa;
    font-size: 10px;
    font-weight: 700;
}

.log-transition-wrap {
    display: flex;
    align-items: center;
    margin-top: 11px;
}

.log-state {
    padding: 4px 8px;
    border: 1px solid #d8e0e7;
    border-radius: 3px;
    color: #5e6f7e;
    background: #f8fafb;
    font-size: 11px;
}

.log-state.current {
    color: #244c70;
    border-color: #c8d9e7;
    background: #eef5fa;
    font-weight: 700;
}

.log-arrow {
    padding: 0 7px;
    color: #8393a1;
}

.log-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin-top: 11px;
    color: #6c7b89;
    font-size: 11px;
}

.log-card-meta b {
    margin-right: 5px;
    color: #455969;
}

.system-log-card time {
    display: flex;
    min-width: 0;
    align-self: stretch;
    flex-direction: column;
    justify-content: center;
    padding: 10px 12px;
    border-left: 1px solid #dce4eb;
    border-radius: 4px;
    color: #344c60;
    background: #f7f9fb;
    font-size: 12px;
    font-weight: 700;
    text-align: right;
}

.system-log-card time small {
    display: block;
    margin-top: 4px;
    color: #8a98a5;
    font-size: 10px;
    font-weight: 400;
}

.system-log-page,
.account-users-page,
.system-log-page .panel,
.account-users-page .panel {
    min-width: 0;
}

.system-log-page {
    width: 100%;
    max-width: none;
    margin: 0;
}

.system-log-page > .toolbar,
.system-log-page > .log-filter-panel,
.system-log-page > .log-timeline {
    width: min(1280px, 100%);
}

.account-filter-bar {
    flex-wrap: wrap;
}

.account-users-page .table-wrap {
    width: 100%;
    min-width: 0;
    overflow-x: auto;
}

.log-double-transition {
    display: grid;
    gap: 7px;
}

.log-double-transition > span {
    display: flex;
    align-items: center;
}

.log-double-transition b {
    width: 64px;
    color: #53687a;
    font-size: 10px;
}

@media (max-width: 980px) {
    .log-filter-row {
        align-items: stretch;
        flex-direction: column;
    }

    .log-date-group {
        grid-template-columns: 1fr;
    }

    .log-date-label {
        padding: 0;
        text-align: left;
    }

    .system-log-card {
        grid-template-columns: 1fr;
    }

    .system-log-card time {
        align-items: flex-start;
        padding: 10px 0 0;
        border-top: 1px solid #e2e8ee;
        border-left: 0;
        border-radius: 0;
        background: transparent;
        text-align: left;
    }
}
