/* === 똑돌이 — Toss-Inspired Design System v2 === */

@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.min.css');

:root {
    /* Primary — Toss Blue */
    --blue-500: #3182f6;
    --blue-600: #1b64da;
    --blue-50: #ebf5ff;
    --primary: var(--blue-500);
    --primary-hover: var(--blue-600);
    --primary-light: var(--blue-50);

    /* Semantic */
    --red-500: #f04452;
    --green-500: #00c471;
    --orange-500: #f59e0b;
    --yellow-500: #ffc342;
    --success: var(--green-500);
    --warning: var(--orange-500);
    --danger: var(--red-500);
    --success-light: #e8faf0;
    --warning-light: #fff9eb;
    --danger-light: #fff0f1;

    /* Neutral — Toss Cool Grey */
    --grey-50: #f9fafb;
    --grey-100: #f2f4f6;
    --grey-200: #e5e8eb;
    --grey-300: #d1d6db;
    --grey-400: #b0b8c1;
    --grey-500: #8b95a1;
    --grey-600: #6b7684;
    --grey-700: #4e5968;
    --grey-800: #333d4b;
    --grey-900: #191f28;

    /* Radius — larger, softer */
    --radius-sm: 6px;
    --radius: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-pill: 9999px;

    /* Shadow — layered, diffuse (Toss style) */
    --shadow-1: 0 1px 2px rgba(0,0,0,0.04), 0 1px 4px rgba(0,0,0,0.04);
    --shadow-2: 0 2px 6px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.06);
    --shadow-3: 0 4px 12px rgba(0,0,0,0.06), 0 8px 24px rgba(0,0,0,0.08);
    --shadow-4: 0 8px 24px rgba(0,0,0,0.08), 0 16px 48px rgba(0,0,0,0.12);

    /* Motion — spring-like */
    --ease-enter: cubic-bezier(0.33, 1, 0.68, 1);
    --ease-exit: cubic-bezier(0.32, 0, 0.67, 0);
    --ease-standard: cubic-bezier(0.25, 0.1, 0.25, 1);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --motion-fast: 180ms;
    --motion-standard: 280ms;
    --transition: all var(--motion-fast) var(--ease-standard);
}

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

html {
    scroll-behavior: smooth;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont,
                 'Apple SD Gothic Neo', Roboto, 'Noto Sans KR', sans-serif;
    background: var(--grey-50);
    color: var(--grey-900);
    line-height: 1.6;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    word-break: keep-all;
}

::selection {
    background: rgba(49, 130, 246, 0.15);
    color: var(--grey-900);
}

/* ===== Nav ===== */
.nav {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    padding: 0 24px;
    display: flex;
    align-items: center;
    height: 56px;
    gap: 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-logo {
    font-weight: 800;
    font-size: 18px;
    color: var(--grey-900);
    text-decoration: none;
    letter-spacing: -0.5px;
    flex-shrink: 0;
}

.nav-links {
    display: flex;
    gap: 2px;
}

.nav-links a {
    padding: 6px 12px;
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--grey-500);
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition);
    position: relative;
}

.nav-links a:hover {
    background: var(--grey-100);
    color: var(--grey-700);
}

.nav-links a.active {
    background: var(--grey-900);
    color: white;
}

/* ===== Layout ===== */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 28px 24px 60px;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 24px;
    letter-spacing: -0.4px;
    color: var(--grey-900);
}

.page-subtitle {
    font-size: 14px;
    color: var(--grey-600);
    margin-top: 4px;
    font-weight: 400;
}

/* Greeting */
.greeting {
    margin-bottom: 28px;
}

.greeting-name {
    font-size: 24px;
    font-weight: 700;
    color: var(--grey-900);
    letter-spacing: -0.4px;
}

.greeting-sub {
    font-size: 14px;
    color: var(--grey-500);
    margin-top: 4px;
    font-weight: 400;
}

/* ===== Cards — borderless, shadow-based (Toss) ===== */
.card {
    background: #ffffff;
    border-radius: var(--radius-md);
    border: none;
    padding: 20px 24px;
    box-shadow: var(--shadow-1);
    transition: box-shadow var(--motion-fast) var(--ease-standard),
                transform var(--motion-fast) var(--ease-standard);
}

.card:hover {
    box-shadow: var(--shadow-2);
}

.card-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--grey-500);
    margin-bottom: 14px;
    letter-spacing: 0.2px;
    text-transform: uppercase;
}

/* ===== Stat Grid ===== */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.stat-card {
    background: #ffffff;
    border-radius: var(--radius-md);
    border: none;
    padding: 20px 22px;
    box-shadow: var(--shadow-1);
    transition: box-shadow var(--motion-fast) var(--ease-standard),
                transform var(--motion-fast) var(--ease-standard);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    box-shadow: var(--shadow-2);
    transform: translateY(-1px);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--grey-200);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    opacity: 0;
    transition: opacity var(--motion-fast) var(--ease-standard);
}

.stat-card.accent-primary::before { background: var(--primary); opacity: 1; }
.stat-card.accent-success::before { background: var(--success); opacity: 1; }
.stat-card.accent-warning::before { background: var(--warning); opacity: 1; }
.stat-card.accent-danger::before  { background: var(--danger); opacity: 1; }

.stat-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--grey-500);
    margin-bottom: 6px;
    letter-spacing: 0.1px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.8px;
    color: var(--grey-900);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.stat-value.primary { color: var(--primary); }
.stat-value.success { color: var(--success); }
.stat-value.warning { color: var(--warning); }
.stat-value.danger  { color: var(--danger); }

.stat-sub {
    font-size: 12px;
    color: var(--grey-500);
    margin-top: 6px;
    font-weight: 400;
}

/* ===== Tables — clean, generous spacing ===== */
.table-wrap {
    overflow-x: auto;
    margin-top: 8px;
    -webkit-overflow-scrolling: touch;
}

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

th {
    text-align: left;
    padding: 12px 16px;
    font-weight: 600;
    color: var(--grey-500);
    border-bottom: 1px solid var(--grey-200);
    font-size: 12px;
    white-space: nowrap;
    letter-spacing: 0.2px;
    background: var(--grey-50);
    position: sticky;
    top: 0;
}

th:first-child { border-radius: var(--radius) 0 0 0; }
th:last-child  { border-radius: 0 var(--radius) 0 0; }

td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--grey-100);
    font-size: 14px;
    color: var(--grey-800);
}

tr {
    transition: background var(--motion-fast) var(--ease-standard);
}

tr:hover td {
    background: var(--grey-50);
}

tr:last-child td {
    border-bottom: none;
}

/* ===== Badges — pill shape (Toss) ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: -0.1px;
}

.badge-blue   { background: var(--blue-50);        color: var(--primary); }
.badge-green  { background: var(--success-light);   color: #059b5c; }
.badge-yellow { background: var(--warning-light);   color: #b45309; }
.badge-red    { background: var(--danger-light);    color: var(--danger); }
.badge-gray   { background: var(--grey-100);        color: var(--grey-600); }

/* ===== Buttons — Toss rounded, bouncy ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all var(--motion-fast) var(--ease-standard);
    white-space: nowrap;
    min-height: 42px;
    letter-spacing: -0.2px;
    position: relative;
    user-select: none;
}

.btn:active:not(:disabled) {
    transform: scale(0.97);
}

.btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    box-shadow: 0 2px 8px rgba(49, 130, 246, 0.3);
}

.btn-success { background: var(--success); color: white; }
.btn-success:hover:not(:disabled) { background: #00a85e; box-shadow: 0 2px 8px rgba(0, 196, 113, 0.3); }

.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover:not(:disabled) { background: #e08e00; box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3); }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover:not(:disabled) { background: #d63340; box-shadow: 0 2px 8px rgba(240, 68, 82, 0.3); }

.btn-dark { background: var(--grey-900); color: white; }
.btn-dark:hover:not(:disabled) { background: var(--grey-800); }

.btn-secondary {
    background: var(--blue-50);
    color: var(--primary);
}
.btn-secondary:hover:not(:disabled) { background: #daeeff; }

.btn-outline {
    background: white;
    color: var(--grey-700);
    border: 1px solid var(--grey-200);
}
.btn-outline:hover:not(:disabled) {
    background: var(--grey-50);
    border-color: var(--grey-300);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
    min-height: 34px;
    border-radius: 8px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
    min-height: 52px;
    border-radius: var(--radius-md);
}

.btn-block {
    display: flex;
    width: 100%;
}

/* ===== Forms — generous, soft ===== */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--grey-600);
    margin-bottom: 8px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--grey-200);
    border-radius: var(--radius);
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: border-color var(--motion-fast) var(--ease-standard),
                box-shadow var(--motion-fast) var(--ease-standard);
    background: white;
    color: var(--grey-900);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--grey-400);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(49, 130, 246, 0.1);
}

.form-group input.error {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(240, 68, 82, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

/* ===== Section ===== */
.section {
    margin-bottom: 24px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--grey-900);
    letter-spacing: -0.2px;
}

/* ===== Flow Steps ===== */
.flow-steps {
    display: flex;
    gap: 6px;
    margin-bottom: 24px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
}

.flow-step {
    flex-shrink: 0;
    padding: 7px 16px;
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 600;
    background: var(--grey-100);
    color: var(--grey-500);
    transition: var(--transition);
}

.flow-step.active {
    background: var(--grey-900);
    color: white;
}

.flow-step.done {
    background: var(--success-light);
    color: var(--success);
}

/* ===== Money ===== */
.money {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}

/* ===== Alert — softer, rounded ===== */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: 14px;
    font-weight: 500;
    line-height: 1.5;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.alert a {
    font-weight: 700;
    text-decoration: none;
}

.alert a:hover {
    text-decoration: underline;
}

.alert-info    { background: var(--blue-50);        color: #1b64da; }
.alert-info a  { color: #1b64da; }
.alert-success { background: var(--success-light);  color: #059b5c; }
.alert-warning { background: var(--warning-light);  color: #92400e; }
.alert-danger  { background: var(--danger-light);   color: var(--danger); }

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--grey-500);
    font-size: 14px;
}

.empty-state .icon {
    font-size: 44px;
    margin-bottom: 14px;
    opacity: 0.4;
}

.empty-state a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}
.empty-state a:hover { text-decoration: underline; }

/* ===== Toast — dark, centered ===== */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 380px;
    width: calc(100% - 48px);
    pointer-events: none;
}

.toast-item {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    animation: toastSlide var(--motion-standard) var(--ease-bounce);
    box-shadow: var(--shadow-4);
    text-align: center;
    pointer-events: auto;
}

.toast-item.success { background: var(--grey-900); color: white; }
.toast-item.warning { background: var(--grey-900); color: white; }
.toast-item.info    { background: var(--grey-900); color: white; }
.toast-item.danger  { background: #1a1a2e; color: #ff6b6b; }

@keyframes toastSlide {
    from { transform: translateY(16px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

/* ===== Info Card ===== */
.info-card {
    background: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 18px 22px;
    margin-bottom: 10px;
    box-shadow: var(--shadow-1);
    transition: box-shadow var(--motion-fast) var(--ease-standard),
                transform var(--motion-fast) var(--ease-standard);
}

.info-card:hover {
    box-shadow: var(--shadow-2);
    transform: translateY(-1px);
}

.info-card .info-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 4px;
}

.info-card .info-card-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--grey-900);
}

.info-card .info-card-sub {
    font-size: 13px;
    color: var(--grey-500);
    margin-top: 3px;
}

.info-card .info-card-amount {
    font-size: 20px;
    font-weight: 700;
    color: var(--grey-900);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.5px;
}

/* ===== Tabs ===== */
.tab-bar {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--grey-200);
    margin-bottom: 24px;
}

.tab-bar button,
.tab-bar a {
    padding: 11px 18px;
    font-size: 14px;
    font-weight: 600;
    color: var(--grey-500);
    background: none;
    border: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
    margin-bottom: -1px;
    text-decoration: none;
    white-space: nowrap;
}

.tab-bar button:hover,
.tab-bar a:hover {
    color: var(--grey-700);
}

.tab-bar button.active,
.tab-bar a.active {
    color: var(--grey-900);
    border-bottom-color: var(--grey-900);
}

/* ===== Modal — spring animation ===== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    animation: backdropFade var(--motion-standard) var(--ease-enter);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

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

.modal {
    background: white;
    border-radius: var(--radius-lg);
    padding: 28px;
    max-width: 480px;
    width: calc(100% - 40px);
    box-shadow: var(--shadow-4);
    animation: modalSpring var(--motion-standard) var(--ease-bounce);
}

.modal-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--grey-900);
    margin-bottom: 16px;
    letter-spacing: -0.3px;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 20px;
    cursor: pointer;
    background: var(--grey-100);
    border: none;
    color: var(--grey-500);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    font-size: 15px;
}

.modal-close:hover {
    background: var(--grey-200);
    color: var(--grey-900);
}

@keyframes backdropFade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes modalSpring {
    from { transform: translateY(24px) scale(0.96); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes modalSlide {
    from { transform: translateY(40px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

/* ===== Divider ===== */
.divider {
    height: 1px;
    background: var(--grey-200);
    margin: 20px 0;
}

/* ===== Skeleton Loading ===== */
.skeleton {
    background: linear-gradient(90deg, var(--grey-100) 25%, var(--grey-50) 50%, var(--grey-100) 75%);
    background-size: 200% 100%;
    border-radius: var(--radius);
    animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===== Utility ===== */
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted   { color: var(--grey-500); }
.text-body    { color: var(--grey-600); }

.font-tabular { font-variant-numeric: tabular-nums; }

/* ===== Auth Info (nav) ===== */
.auth-info {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .form-row  { grid-template-columns: 1fr; }
    .container { padding: 20px 16px 48px; }
    .nav       { padding: 0 16px; gap: 12px; height: 52px; }
    .nav-links a { padding: 6px 10px; font-size: 13px; }

    .card { padding: 18px 20px; }
    .stat-card { padding: 16px 18px; }
    .stat-value { font-size: 24px; }
}

@media (max-width: 480px) {
    .stat-grid { grid-template-columns: 1fr; }
    .nav-links { display: none; }
    .container { padding: 16px 14px 40px; }
}

/* ===== Vehicle Cards ===== */
.vehicle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.vehicle-card {
    background: white;
    border-radius: var(--radius-md);
    border: 2px solid var(--grey-200);
    padding: 16px;
    transition: var(--transition);
}
.vehicle-card.purchase { border-color: #dbeafe; }
.vehicle-card.sale     { border-color: #bbf7d0; }
.vehicle-card.error    { border-color: var(--danger-light); }

/* Step Bar */
.step-labels {
    display: flex;
    justify-content: space-between;
    font-size: 9px;
    color: var(--grey-300);
    margin-bottom: 3px;
}
.step-bar {
    display: flex;
    gap: 2px;
    margin-bottom: 6px;
}
.step-seg {
    height: 5px;
    flex: 1;
    background: var(--grey-200);
    border-radius: 2px;
}

/* Section header row */
.section-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.section-toggle { cursor: pointer; user-select: none; }
.section-toggle:hover .badge-purchase,
.section-toggle:hover .badge-stock,
.section-toggle:hover .badge-sale { opacity: 0.8; }
.section-chevron { font-size: 16px; color: var(--grey-400); transition: var(--transition); }
.section-header-row .section-left {
    display: flex;
    align-items: center;
    gap: 8px;
}
.badge-purchase { background: var(--blue-50);      color: #1d4ed8; padding: 4px 12px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 700; }
.badge-stock    { background: var(--grey-100);     color: var(--grey-700); padding: 4px 12px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 700; }
.badge-sale     { background: var(--success-light);color: #15803d; padding: 4px 12px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 700; }
.section-count  { font-size: 12px; color: var(--grey-400); }
