﻿/* =========================
   NSL Global (single source)
   ========================= */

:root {
    /* NSL base */
    --bg: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --line: #e5e7eb;
    --chip: #0b1220;
    --primary: #2563eb;
    --radius: 14px;
    --container: 1240px;
    --pad-x: 28px;
    /* Squarespace-like system (sq-*) */
    --sq-bg: #f6f7f9;
    --sq-surface: #ffffff;
    --sq-border: #e6e8ee;
    --sq-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
    --sq-radius: 16px;
    --sq-primary: #0f172a;
    --sq-primaryText: #ffffff;
    --sq-ring: rgba(59, 130, 246, 0.25);
}

* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    margin: 0;
    color: var(--text);
    background: var(--bg);
    font-family: system-ui, -apple-system, Segoe UI, Roboto, "Noto Sans KR", Arial, sans-serif;
}

/* ✅ Topbar/Body 동일 여백을 보장하는 컨테이너 */
/* ✅ Topbar/Body 동일 여백을 보장하는 컨테이너 */
.nsl-app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.nsl-main {
    flex: 1; /* ✅ footer를 바닥으로 밀어냄 */
    min-height: 0;
}

/* footer는 흐름 안에 있으면서, 항상 아래. 우측 정렬 */
.nsl-footer {
    border-top: 1px solid var(--line);
    padding: 1em 0;
    color: var(--muted);
    font-size: 13px;
}

    .nsl-footer .nsl-container {
        display: flex;
        justify-content: flex-end;
    }

.nsl-container {
    max-width: 1440px;
    margin: 0 auto;
    padding-left: 4em;
    padding-right: 4em;
}

@media (max-width: 960px) {
    .nsl-container {
        padding-left: 1em;
        padding-right: 1em;
    }
}


/* =========================
   Topbar (Squarespace-ish)
   ========================= */

.nsl-topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: #fff;
    border-bottom: 1px solid var(--line);
}

.nsl-topbar-inner {
    height: 72px;
    display: flex;
    align-items: center;
    gap: 18px;
}

.nsl-logo {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text);
    font-weight: 800;
    letter-spacing: .2px;
}

.nsl-logo-mark {
    width: 22px;
    height: 22px;
    border-radius: 7px;
    background: #0b1220;
    display: inline-block;
}

.nsl-logo-text {
    font-size: 18px;
}

.nsl-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nsl-navitem {
    display: inline-flex;
    align-items: center;
    height: 40px;
    padding: 0 14px;
    border-radius: 12px;
    text-decoration: none;
    color: #111827;
    font-weight: 700;
    font-size: 14px;
}

    .nsl-navitem:hover {
        background: #f3f4f6;
    }

    .nsl-navitem.active {
        background: var(--chip);
        color: #fff;
    }

.nsl-actions {
    margin-left: auto;
    min-width: 420px;
}

.nsl-searchbar {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: flex-end;
}

.nsl-input {
    width: min(560px, 52vw);
    height: 42px;
    border-radius: 999px;
    border: 1px solid var(--line);
    padding: 0 16px;
    outline: none;
}

    .nsl-input:focus {
        border-color: #bcd0ff;
        box-shadow: 0 0 0 4px rgba(37,99,235,.12);
    }

.nsl-select {
    height: 42px;
    border-radius: 999px;
    border: 1px solid var(--line);
    padding: 0 14px;
    background: #fff;
    font-weight: 700;
}

.nsl-btn {
    height: 42px;
    border-radius: 999px;
    border: 1px solid transparent;
    padding: 0 16px;
    font-weight: 800;
    cursor: pointer;
}

.nsl-btn-primary {
    background: var(--primary);
    color: #fff;
}

    .nsl-btn-primary:hover {
        filter: brightness(.95);
    }

/* =========================
   Basic content defaults
   ========================= */

a {
    color: #2563eb;
}

h1, h2, h3 {
    margin: 0 0 12px;
}

table {
    border-collapse: collapse;
}

th, td {
    padding: 8px 10px;
    border-bottom: 1px solid #eef2f7;
    vertical-align: top;
}

/* =========================
   Responsive (TOPBAR only)
   ========================= */

@media (max-width: 980px) {
    :root {
        --pad-x: 16px;
    }

    .nsl-topbar-inner {
        height: auto;
        padding: 12px 0;
        flex-wrap: wrap;
        gap: 12px;
    }

    .nsl-actions {
        margin-left: 0;
        width: 100%;
        min-width: 0;
    }

    .nsl-searchbar {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .nsl-input {
        width: 100%;
        min-width: 0;
    }
}

/* ======================================================================
   Squarespace-like UI system (sq-*)  ✅ 여기부터는 미디어쿼리 밖 (중요)
   ====================================================================== */

body {
    background: var(--sq-bg);
    color: var(--text);
}

/* 공통 레이아웃: 폭/패딩 */
.sq-page {
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px;
}

.sq-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 18px;
}

.sq-kicker {
    font-size: 12px;
    color: var(--muted);
    letter-spacing: .02em;
}

.sq-title {
    margin: 4px 0 0 0;
    font-size: 22px;
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: -0.01em;
}

/* 12-col grid */
.sq-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 18px;
}

.sq-col-main {
    grid-column: span 8 / span 8;
}

.sq-col-side {
    grid-column: span 4 / span 4;
}

@media (max-width: 1100px) {
    .sq-col-main {
        grid-column: span 12 / span 12;
    }

    .sq-col-side {
        grid-column: span 12 / span 12;
    }
}

/* 카드 */
.sq-card {
    background: var(--sq-surface);
    border: 1px solid var(--sq-border);
    border-radius: var(--sq-radius);
    box-shadow: var(--sq-shadow);
}

.sq-card-pad0 {
    overflow: hidden;
}

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

.sq-card-title {
    font-size: 16px;
    font-weight: 700;
    margin: 2px 0 0 0;
}

.sq-meta {
    font-size: 12px;
    color: var(--muted);
}

.sq-card-foot {
    padding: 12px 20px;
    border-top: 1px solid var(--sq-border);
    font-size: 12px;
    color: var(--muted);
    background: #fff;
}

/* Flash */
.sq-flash {
    padding: 14px 16px;
    margin-bottom: 18px;
}

.sq-flash-title {
    font-size: 12px;
    font-weight: 700;
}

.sq-flash-body {
    margin-top: 6px;
    font-size: 13px;
    color: var(--text);
}

/* 테이블 */
.sq-table-wrap {
    overflow: auto;
}

.sq-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}

    .sq-table thead th {
        position: sticky;
        top: 0;
        background: #f8fafc;
        color: #475569;
        text-align: left;
        font-weight: 700;
        padding: 12px 16px;
        border-bottom: 1px solid var(--sq-border);
        white-space: nowrap;
    }

    .sq-table tbody td {
        padding: 12px 16px;
        border-bottom: 1px solid var(--sq-border);
        white-space: nowrap;
    }

.sq-row {
    cursor: pointer;
}

    .sq-row:hover {
        background: #f8fafc;
    }

.sq-strong {
    font-weight: 700;
    color: var(--text);
}

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

/* 폼 */
.sq-form {
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.sq-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sq-label {
    font-size: 12px;
    color: var(--muted);
    font-weight: 700;
    letter-spacing: .02em;
}

.sq-input {
    height: 44px;
    width: 100%;
    border-radius: 14px;
    border: 1px solid var(--sq-border);
    padding: 0 14px;
    font-size: 14px;
    outline: none;
    background: #fff;
}

    .sq-input:focus {
        border-color: #93c5fd;
        box-shadow: 0 0 0 4px var(--sq-ring);
    }

/* 체크박스 */
.sq-check {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #334155;
    user-select: none;
}

.sq-checkbox {
    width: 16px;
    height: 16px;
}

/* 버튼 */
.sq-actions {
    display: flex;
    gap: 10px;
    padding-top: 6px;
}

.sq-btn {
    height: 44px;
    border-radius: 14px;
    font-weight: 800;
    font-size: 13px;
    letter-spacing: .02em;
    border: 1px solid var(--sq-border);
    background: #fff;
    padding: 0 16px;
}

    .sq-btn:hover {
        background: #f8fafc;
    }

.sq-btn-primary {
    flex: 1;
    background: var(--sq-primary);
    color: var(--sq-primaryText);
    border-color: var(--sq-primary);
}

    .sq-btn-primary:hover {
        opacity: .92;
    }

.sq-btn-ghost {
    background: #fff;
}

/* 힌트 */
.sq-hint {
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--sq-border);
    font-size: 12px;
    color: var(--muted);
}

/* Sticky */
.sq-sticky {
    position: sticky;
    top: 18px;
}

/* =========================
   sq-extensions (Customer Detail 등 공통)
   ========================= */

.sq-top-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.sq-h2 {
    margin-top: 4px;
    font-size: 22px;
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.sq-card-body {
    padding: 18px 20px;
}

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

.sq-info {
    border: 1px solid var(--sq-border);
    background: #fff;
    border-radius: 16px;
    padding: 14px 14px;
}

.sq-span-2 {
    grid-column: span 2 / span 2;
}

@media (max-width: 900px) {
    .sq-info-grid {
        grid-template-columns: 1fr;
    }

    .sq-span-2 {
        grid-column: auto;
    }

    .sq-top-actions {
        flex-wrap: wrap;
        justify-content: flex-start;
    }
}

.sq-info-k {
    font-size: 12px;
    color: var(--muted);
    font-weight: 700;
}

.sq-info-v {
    margin-top: 6px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}

.sq-notes {
    margin-top: 8px;
    font-size: 13px;
    color: #334155;
    white-space: pre-wrap;
}

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

.sq-metric {
    border: 1px solid var(--sq-border);
    background: #fff;
    border-radius: 16px;
    padding: 14px 14px;
    position: relative;
}

.sq-metric-k {
    font-size: 12px;
    color: var(--muted);
    font-weight: 700;
}

.sq-metric-v {
    margin-top: 6px;
    font-size: 16px;
    font-weight: 800;
    color: var(--text);
}

    .sq-metric-v.big {
        font-size: 22px;
    }

.sq-metric-side {
    position: absolute;
    right: 14px;
    top: 14px;
    text-align: right;
}

@media (max-width: 900px) {
    .sq-metric-grid {
        grid-template-columns: 1fr;
    }
}

.sq-pad {
    padding: 18px 20px;
    font-size: 13px;
    color: var(--muted);
}

    .sq-pad.ok {
        color: #059669;
        font-weight: 800;
    }

.sq-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sq-btn.wide {
    width: 100%;
    justify-content: center;
    display: inline-flex;
    align-items: center;
}

.sq-link {
    color: #2563eb;
    text-decoration: none;
    font-weight: 800;
}

    .sq-link:hover {
        text-decoration: underline;
    }

.right {
    text-align: right;
}

.sq-empty {
    padding: 28px 20px;
    text-align: center;
}

.sq-empty-title {
    font-size: 16px;
    font-weight: 900;
    color: var(--text);
}

.sq-empty-body {
    margin-top: 8px;
    font-size: 13px;
    color: var(--muted);
}

.sq-empty-actions {
    margin-top: 16px;
    display: flex;
    justify-content: center;
}

/* =========================
   sq-search additions
   ========================= */

.sq-subhead {
    margin-top: 10px;
    font-size: 13px;
    color: var(--muted);
}

.sq-btn-sm {
    height: 34px;
    border-radius: 12px;
    padding: 0 12px;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .02em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* =========================
   sq-extensions for Settings/Items
   ========================= */

:root {
    /* site.css가 이미 var(--border)를 쓰고 있다면 이 줄은 생략 가능 */
    --sq-border: var(--border, #e6e8ee);
}

.sq-filterbar {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.sq-grow {
    flex: 1;
    min-width: 260px;
}

.sq-select {
    height: 44px;
    width: 100%;
    border-radius: 14px;
    border: 1px solid var(--sq-border);
    padding: 0 14px;
    font-size: 14px;
    outline: none;
    background: #fff;
}

    .sq-select:focus {
        border-color: #93c5fd;
        box-shadow: 0 0 0 4px var(--ring);
    }

.sq-table-compact tbody td {
    padding-top: 10px;
    padding-bottom: 10px;
}

.sq-titlecell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.sq-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.sq-badge {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid var(--sq-border);
    font-size: 12px;
    font-weight: 800;
    color: #334155;
    background: #fff;
}

.sq-badge-warn {
    border-color: #f59e0b;
    color: #b45309;
    background: #fffbeb;
}

.sq-badge-info {
    border-color: #60a5fa;
    color: #1d4ed8;
    background: #eff6ff;
}

.sq-row-selected {
    background: #f8fafc;
}

    .sq-row-selected td:first-child {
        box-shadow: inset 3px 0 0 #0b1220;
    }

.sq-row-warn {
    background: #fffbeb;
}

    .sq-row-warn td:first-child {
        box-shadow: inset 3px 0 0 #f59e0b;
    }

.sq-pill {
    display: block;
    border: 1px solid var(--sq-border);
    background: #fff;
    border-radius: 14px;
    padding: 10px 12px;
    font-size: 12px;
    color: #475569;
    margin-bottom: 12px;
}

.sq-divider {
    height: 1px;
    background: var(--sq-border);
    margin: 16px 0;
}

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

@media (max-width: 1100px) {
    .sq-two {
        grid-template-columns: 1fr;
    }
}

/* =========================
   sq-extensions for Orders/Detail
   ========================= */

.sq-head-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.sq-card-body {
    padding: 18px 20px;
}

.sq-order-top {
    display: flex;
    gap: 18px;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
}

.sq-order-left {
    min-width: 240px;
}

.sq-order-no {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-top: 2px;
}

.sq-meta-line {
    margin-top: 8px;
    font-size: 13px;
    color: #334155;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.sq-order-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    min-width: 360px;
}

@media (max-width: 1100px) {
    .sq-order-metrics {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        min-width: 0;
        width: 100%;
    }
}

.sq-metric {
    border: 1px solid var(--border, #e6e8ee);
    background: #fff;
    border-radius: 16px;
    padding: 12px 14px;
}

.sq-metric-val {
    font-size: 18px;
    font-weight: 800;
    margin-top: 6px;
}

.sq-balance {
    font-size: 20px;
}

.sq-badge-ok {
    border-color: #34d399;
    color: #047857;
    background: #ecfdf5;
}

.sq-inline-form {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.sq-input-sm {
    height: 38px;
    border-radius: 12px;
    padding: 0 12px;
    font-size: 13px;
}

.sq-select-sm {
    height: 38px;
    border-radius: 12px;
    padding: 0 12px;
    font-size: 13px;
}

.sq-btn-sm {
    height: 38px;
    border-radius: 12px;
    padding: 0 14px;
    font-size: 13px;
    font-weight: 800;
}

.sq-quick {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.sq-pay-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 14px;
    flex-wrap: wrap;
}

.sq-due {
    font-size: 28px;
    font-weight: 900;
    letter-spacing: -0.02em;
    margin-top: 4px;
}

.sq-pay-methods {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.sq-alert {
    border: 1px solid var(--border, #e6e8ee);
    border-radius: 16px;
    padding: 12px 14px;
    font-size: 13px;
    font-weight: 700;
}

.sq-alert-danger {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
}

.sq-alert-ok {
    background: #ecfdf5;
    border-color: #bbf7d0;
    color: #047857;
}

.sq-paybox {
    margin-top: 12px;
    border: 1px solid var(--border, #e6e8ee);
    border-radius: 16px;
    padding: 14px;
    background: #fff;
}

.sq-pay-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
    align-items: end;
}

.sq-span-2 {
    grid-column: span 2 / span 2;
}

@media (max-width: 1100px) {
    .sq-pay-grid {
        grid-template-columns: 1fr;
    }

    .sq-span-2 {
        grid-column: auto;
    }
}

.sq-readonly {
    background: #f8fafc;
}

/* === Shared container: Header + Body + Footer alignment === */
.app-container {
    max-width: 1440px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 4em;
    padding-right: 4em;
}

@media (max-width: 960px) {
    .app-container {
        padding-left: 1em;
        padding-right: 1em;
    }
}

/* footer right align */
.app-footer .app-container {
    display: flex;
    justify-content: flex-end;
}
