@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;600;700&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e9f2 100%);
    color: #1a1a2e;
    min-height: 100vh;
}

/* ── Header ─────────────────────────────────── */
header {
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0,0,0,0.06);
    padding: 14px 20px;
    display: flex; justify-content: space-between; align-items: center;
    position: sticky; top: 0; z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.header-title {
    font-size: 17px; font-weight: 700; color: #1a1a2e;
    letter-spacing: -0.3px;
}
.header-user {
    font-size: 13px; margin-right: 10px; color: #64748b; font-weight: 500;
}
.header-right { display: flex; align-items: center; }
.btn-logout {
    color: #fff; background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    padding: 6px 14px; border-radius: 20px;
    text-decoration: none; font-size: 12px; font-weight: 600;
    transition: all 0.2s; box-shadow: 0 2px 8px rgba(238,90,36,0.25);
    display: flex; align-items: center; justify-content: center; line-height: 1;
}
.btn-logout:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(238,90,36,0.35); }

/* ── Main ───────────────────────────────────── */
main { padding: 20px 16px; max-width: 640px; margin: 0 auto; }

/* ── Flash ──────────────────────────────────── */
.flash {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    border: none; border-radius: 14px; padding: 14px 18px; margin-bottom: 16px;
    box-shadow: 0 2px 12px rgba(255,234,167,0.4);
}
.flash p { font-size: 14px; font-weight: 500; color: #856404; }

/* ── Login ──────────────────────────────────── */
.login-wrap {
    display: flex; justify-content: center; align-items: center; min-height: 80vh;
}
.login-form {
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(24px);
    padding: 44px 32px 36px; border-radius: 28px; width: 100%; max-width: 380px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.1), 0 2px 6px rgba(0,0,0,0.04);
    border: 1px solid rgba(255,255,255,0.9);
    animation: fadeIn 0.4s ease;
}
.login-logo { text-align: center; margin-bottom: 32px; }
.logo-icon { margin-bottom: 14px; }
.login-form h2 {
    font-size: 24px; font-weight: 800; color: #1a1a2e;
    letter-spacing: -0.5px; margin-bottom: 4px;
}
.login-sub { font-size: 12px; color: #94a3b8; font-weight: 500; letter-spacing: 1.5px; text-transform: uppercase; }
.login-section { margin-bottom: 8px; }
.section-label {
    font-size: 12px; font-weight: 700; color: #94a3b8;
    text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 12px;
}
.driver-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.driver-card {
    display: flex; flex-direction: column; align-items: center;
    padding: 22px 12px 18px; border-radius: 18px;
    background: linear-gradient(145deg, #f8faff, #eef1f8);
    border: 2px solid transparent;
    text-decoration: none; color: inherit;
    transition: all 0.25s; cursor: pointer;
}
.driver-card:hover {
    border-color: #667eea;
    background: linear-gradient(145deg, #f0f3ff, #e8ecfc);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(102,126,234,0.2);
}
.driver-card:active { transform: translateY(0); }
.driver-icon {
    width: 52px; height: 52px; border-radius: 16px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex; align-items: center; justify-content: center;
    color: #fff; margin-bottom: 12px;
    box-shadow: 0 4px 12px rgba(102,126,234,0.3);
}
.driver-vehicle { font-size: 17px; font-weight: 800; color: #1a1a2e; letter-spacing: -0.3px; }
.driver-name { font-size: 13px; font-weight: 600; color: #667eea; margin-top: 2px; }
.login-divider {
    display: flex; align-items: center; gap: 14px;
    margin: 24px 0 18px; color: #cbd5e1; font-size: 12px; font-weight: 600;
}
.login-divider::before, .login-divider::after {
    content: ''; flex: 1; height: 1px; background: #e2e8f0;
}
.login-divider span { color: #94a3b8; text-transform: uppercase; letter-spacing: 1px; }
.office-btn {
    width: 100%; padding: 14px; border-radius: 14px;
    background: linear-gradient(145deg, #f1f5f9, #e2e8f0);
    border: 2px solid transparent; cursor: pointer;
    font-size: 15px; font-weight: 700; color: #475569;
    font-family: inherit; transition: all 0.25s;
    display: flex; align-items: center; justify-content: center; gap: 10px;
}
.office-btn:hover {
    border-color: #475569; background: #e2e8f0;
    transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.office-icon {
    width: 36px; height: 36px; border-radius: 10px;
    background: #475569; color: #fff;
    display: flex; align-items: center; justify-content: center;
}
.pw-form {
    display: flex; gap: 8px; margin-top: 10px;
    animation: fadeIn 0.3s ease;
}
.pw-form input {
    flex: 1; padding: 14px 18px;
    border: 2px solid #e2e8f0; border-radius: 14px; font-size: 16px;
    font-family: inherit; background: #f8fafc; transition: all 0.2s;
}
.pw-form input:focus {
    outline: none; border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102,126,234,0.1); background: #fff;
}
.pw-submit {
    width: 52px; border-radius: 14px; border: none; cursor: pointer;
    background: linear-gradient(135deg, #667eea, #764ba2); color: #fff;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(102,126,234,0.3);
}
.pw-submit:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(102,126,234,0.4); }
.pw-cancel {
    width: 40px; border-radius: 10px; border: 2px solid #e2e8f0; background: #fff;
    color: #94a3b8; font-size: 16px; cursor: pointer; display: flex;
    align-items: center; justify-content: center; transition: all 0.2s;
}
.pw-cancel:hover { border-color: #ef4444; color: #ef4444; }

/* ── Buttons ────────────────────────────────── */
.btn {
    display: inline-block; padding: 12px 24px; border-radius: 14px; font-size: 15px;
    font-weight: 600; text-decoration: none; border: none; cursor: pointer;
    text-align: center; transition: all 0.2s; font-family: inherit;
    letter-spacing: -0.2px;
}
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff; box-shadow: 0 4px 15px rgba(102,126,234,0.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(102,126,234,0.4); }
.btn-primary:active { transform: translateY(0); }
.btn-outline {
    background: rgba(255,255,255,0.8); color: #475569;
    border: 2px solid #e2e8f0; backdrop-filter: blur(10px);
}
.btn-outline:hover { border-color: #cbd5e1; background: #fff; }
.btn-reset { background: rgba(239,68,68,0.1); color: #ef4444; border: 2px solid #fecaca; }
.day-complete-form { margin-top: 20px; }
.btn-day-complete { padding: 16px; font-size: 17px; }
.day-closed-badge {
    margin-top: 20px; text-align: center; padding: 14px;
    background: linear-gradient(135deg, #d5f5e3, #a3e4bc);
    color: #00875a; font-size: 16px; font-weight: 700;
    border-radius: 14px;
}
.btn-reset:hover { background: #fef2f2; border-color: #ef4444; }
.btn-full { width: 100%; }
.btn-sm { padding: 8px 16px; font-size: 13px; border-radius: 10px; }

/* ── Page section ───────────────────────────── */
.page-section { }
.date-bar {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 16px; gap: 10px;
}
.today {
    font-size: 16px; font-weight: 700; color: #1a1a2e;
    letter-spacing: -0.3px;
}

/* ── Progress bar ───────────────────────────── */
.progress-wrap { margin-bottom: 20px; }
.progress-text { font-size: 14px; font-weight: 700; margin-bottom: 8px; color: #475569; }
.progress-bar {
    background: #e2e8f0; border-radius: 12px; height: 8px; overflow: hidden;
}
.progress-fill {
    background: linear-gradient(90deg, #00b894, #00cec9);
    height: 100%; border-radius: 12px; transition: width 0.5s ease;
}

/* ── Customer select (checkbox list) ────────── */
.customer-select-list { margin-bottom: 20px; }
h2 {
    font-size: 20px; font-weight: 700; color: #1a1a2e;
    margin-bottom: 16px; letter-spacing: -0.5px;
}
.check-card {
    display: flex; align-items: center;
    background: rgba(255,255,255,0.8); backdrop-filter: blur(10px);
    padding: 16px 18px; border-radius: 14px; margin-bottom: 8px;
    border: 2px solid transparent; cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.check-card:hover { border-color: #667eea; background: #fff; }
.check-card:has(input:checked) {
    border-color: #667eea; background: rgba(102,126,234,0.04);
}
.check-card input[type="checkbox"] {
    width: 22px; height: 22px; margin-right: 14px;
    accent-color: #667eea; border-radius: 6px;
}
.check-label { font-size: 16px; font-weight: 600; color: #334155; }
.order-num {
    width: 28px; height: 28px; border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff; font-size: 14px; font-weight: 800;
    display: none; align-items: center; justify-content: center;
    margin-right: 12px; flex-shrink: 0;
}
.check-card.selected {
    border-color: #667eea; background: rgba(102,126,234,0.06);
}
.check-card.locked {
    border-color: #e2e8f0; background: rgba(226,232,240,0.4); cursor: default;
}
.check-card.locked .check-label { color: #94a3b8; }
.lock-icon {
    font-size: 10px; font-weight: 700; color: #94a3b8;
    background: #e2e8f0; padding: 2px 8px; border-radius: 10px; margin-left: auto;
}

/* ── Customer list (driver main) ────────────── */
.customer-list { }
.customer-card {
    display: flex; justify-content: space-between; align-items: center;
    background: rgba(255,255,255,0.9); backdrop-filter: blur(10px);
    padding: 18px 20px; border-radius: 16px; margin-bottom: 10px;
    border: 1px solid rgba(0,0,0,0.04);
    text-decoration: none; color: inherit;
    transition: all 0.25s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.customer-card:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(0,0,0,0.08); }
.customer-card:active { transform: translateY(0); }
.customer-card.completed {
    background: rgba(226,232,240,0.6); border-color: transparent;
    box-shadow: none;
}
.customer-card.completed:hover { transform: none; }
.card-name { font-size: 16px; font-weight: 700; color: #1e293b; letter-spacing: -0.3px; }
.card-time { display: block; font-size: 12px; color: #94a3b8; margin-top: 3px; font-weight: 500; }
.card-summary { display: block; font-size: 11px; color: #667eea; margin-top: 3px; font-weight: 600; }
.badge {
    padding: 5px 12px; border-radius: 20px; font-size: 12px; font-weight: 700;
    letter-spacing: -0.2px;
}
.badge-done {
    background: linear-gradient(135deg, #d5f5e3, #a3e4bc);
    color: #00875a;
}
.badge-loaded {
    background: linear-gradient(135deg, #ffecd2, #fcb69f);
    color: #e17055;
}
.badge-pending {
    background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
    color: #667eea;
}

/* ── Input table ────────────────────────────── */
.delivery-form {
    background: rgba(255,255,255,0.9); backdrop-filter: blur(10px);
    border-radius: 20px; padding: 24px 20px;
    border: 1px solid rgba(0,0,0,0.04);
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}
.input-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.input-table th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff; padding: 12px 8px; font-size: 13px; text-align: center;
    font-weight: 600; letter-spacing: -0.2px;
}
.input-table th:first-child { border-radius: 12px 0 0 0; }
.input-table th:last-child { border-radius: 0 12px 0 0; }
.input-table td {
    padding: 8px 4px; text-align: center; border-bottom: 1px solid #f1f5f9;
}
.input-table input {
    width: 100%; padding: 14px 6px;
    border: 2px solid #e2e8f0; border-radius: 10px;
    font-size: 18px; text-align: center;
    background: #fefce8; font-family: inherit;
    transition: all 0.2s; font-weight: 600;
    min-height: 48px;
}
.input-table input:focus {
    outline: none; border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102,126,234,0.1); background: #fff;
}
.cell-label { font-weight: 700; font-size: 14px; white-space: nowrap; color: #475569; }

/* ── Action bar ─────────────────────────────── */
.action-bar { display: flex; gap: 10px; margin-top: 20px; justify-content: flex-end; }

/* ── Office dashboard ───────────────────────── */
.vehicle-grid { display: grid; gap: 16px; }
@media (min-width: 768px) {
    .vehicle-grid { grid-template-columns: 1fr 1fr; }
    main { max-width: 960px; }
}
.vehicle-panel {
    background: rgba(255,255,255,0.9); backdrop-filter: blur(10px);
    border-radius: 20px; padding: 20px;
    border: 1px solid rgba(0,0,0,0.04);
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}
.panel-header {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 16px; margin-bottom: 12px; font-weight: 700;
}
.panel-count {
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    font-weight: 800; font-size: 18px;
}
.panel-list { margin-top: 12px; }
.collapse-icon { font-size: 10px; transition: transform 0.2s; }
.collapsed .panel-list, .collapsed .progress-bar, .collapsed .km-info, .collapsed .delivery-detail { display: none; }
.collapsed .collapse-icon { transform: rotate(-90deg); }
.panel-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 0; border-bottom: 1px solid #f1f5f9;
}
.panel-row.completed { opacity: 0.5; }
.row-name { font-size: 14px; font-weight: 600; color: #334155; }
.row-right { display: flex; align-items: center; gap: 8px; }
.row-time { font-size: 12px; color: #94a3b8; font-weight: 500; }

/* ── Delivery detail table ──────────────────── */
.delivery-detail {
    padding: 6px 0 10px 8px;
}
.detail-table {
    width: 100%; border-collapse: collapse; margin: 4px 0 8px 0;
    background: #f8fafc; border-radius: 10px; overflow: hidden;
}
.detail-table th {
    font-size: 11px; font-weight: 700; color: #667eea;
    padding: 6px 6px; text-align: center; background: rgba(102,126,234,0.06);
}
.detail-table td {
    font-size: 12px; padding: 4px 6px; text-align: center; font-weight: 600; color: #475569;
}
.dt-label { font-weight: 700; color: #94a3b8; text-align: left !important; font-size: 11px; }
.detail-item { display: inline-block; margin-right: 10px; }

/* ── Date inputs ────────────────────────────── */
.date-input {
    padding: 10px 14px; border: 2px solid #e2e8f0; border-radius: 12px;
    font-size: 15px; font-family: inherit; font-weight: 600;
    background: rgba(255,255,255,0.8); transition: all 0.2s;
}
.date-input:focus { outline: none; border-color: #667eea; box-shadow: 0 0 0 4px rgba(102,126,234,0.1); }
.date-select {
    padding: 10px 14px; border: 2px solid #e2e8f0; border-radius: 12px;
    font-size: 14px; font-family: inherit; background: rgba(255,255,255,0.8);
    font-weight: 500; transition: all 0.2s;
}
.date-select:focus { outline: none; border-color: #667eea; }

.no-data {
    text-align: center; color: #94a3b8; padding: 24px; font-size: 14px;
    font-weight: 500;
}

/* ── Customer detail page ───────────────────── */
.form-title {
    font-size: 17px; font-weight: 700; margin-bottom: 14px;
    color: #1a1a2e; letter-spacing: -0.3px;
}
.loaded-summary {
    background: linear-gradient(135deg, #fff7ed, #ffecd2);
    border: none; border-radius: 16px;
    padding: 16px 18px; margin-bottom: 14px;
    box-shadow: 0 2px 12px rgba(252,182,159,0.2);
}
.summary-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    background: rgba(255,255,255,0.8); padding: 6px 14px; border-radius: 20px;
    font-size: 13px; font-weight: 700; color: #e17055;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.completed-summary {
    background: rgba(255,255,255,0.9); backdrop-filter: blur(10px);
    border-radius: 20px; padding: 24px 20px;
    border: 1px solid rgba(0,0,0,0.04);
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}
.completed-badge {
    background: linear-gradient(135deg, #d5f5e3, #a3e4bc);
    color: #00875a; padding: 10px 20px; border-radius: 14px;
    font-size: 16px; font-weight: 700; text-align: center; margin-bottom: 16px;
    letter-spacing: -0.3px;
}
.summary-table td { font-size: 15px; font-weight: 600; }

/* ── KM info ────────────────────────────────── */
.km-info {
    display: flex; justify-content: space-between; gap: 8px;
    background: linear-gradient(135deg, #f0f3ff, #e8ecfc);
    border-radius: 10px; padding: 8px 14px; margin-top: 10px;
    font-size: 12px; font-weight: 600; color: #667eea;
}

.section-title {
    font-size: 17px; font-weight: 700; color: #1a1a2e;
    margin: 24px 0 14px; letter-spacing: -0.3px;
}

/* ── Timeline ───────────────────────────────── */
.timeline-panel {
    background: rgba(255,255,255,0.9); backdrop-filter: blur(10px);
    border-radius: 20px; padding: 20px;
    border: 1px solid rgba(0,0,0,0.04);
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    margin-top: 16px;
}
.timeline-title {
    font-size: 17px; font-weight: 700; color: #1a1a2e;
    margin-bottom: 14px; letter-spacing: -0.3px;
}
.timeline-row {
    display: flex; align-items: center; gap: 12px; padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
}
.tl-time {
    font-size: 13px; font-weight: 700; min-width: 55px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.tl-vehicle {
    font-size: 12px; color: #94a3b8; min-width: 50px; font-weight: 600;
}
.tl-name { font-size: 14px; font-weight: 600; flex: 1; color: #334155; }

/* ── Tab navigation ─────────────────────────── */
.tab-nav {
    display: flex; gap: 6px; margin-bottom: 16px;
    background: rgba(255,255,255,0.6); border-radius: 14px; padding: 4px;
}
.tab-item {
    flex: 1; padding: 10px 16px; border-radius: 10px;
    text-align: center; font-size: 14px; font-weight: 700;
    text-decoration: none; color: #94a3b8;
    transition: all 0.2s;
}
.tab-item:hover { color: #475569; background: rgba(255,255,255,0.5); }
.tab-active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: #fff !important;
    box-shadow: 0 2px 8px rgba(102,126,234,0.3);
}

/* ── Verify (전산대조) ──────────────────────── */
.verify-desc { font-size: 14px; color: #64748b; margin-bottom: 16px; line-height: 1.6; }
.verify-actions { margin-bottom: 8px; }
.verify-guide { font-size: 13px; color: #64748b; line-height: 2; }
.verify-guide code {
    background: #f1f5f9; padding: 2px 8px; border-radius: 6px;
    font-family: monospace; font-size: 12px; color: #667eea;
}
.verify-summary {
    display: flex; gap: 12px; margin-top: 12px;
}
.summary-item {
    flex: 1; text-align: center; padding: 14px 8px; border-radius: 14px;
}
.summary-total { background: linear-gradient(135deg, #f0f3ff, #e8ecfc); }
.summary-ok { background: linear-gradient(135deg, #d5f5e3, #a3e4bc); }
.summary-fail { background: linear-gradient(135deg, #ffecd2, #fcb69f); }
.summary-num { display: block; font-size: 28px; font-weight: 800; color: #1a1a2e; }
.summary-label { font-size: 12px; font-weight: 600; color: #64748b; }
.verify-table { min-width: 700px; }
.row-mismatch { background: #fff5f5 !important; }
.row-mismatch td { color: #1a1a2e; }
.row-match { opacity: 0.6; }

/* ── Field card ─────────────────────────────── */
.field-card { width: 100%; }
.field-icon {
    background: linear-gradient(135deg, #00b894, #00cec9) !important;
    box-shadow: 0 4px 12px rgba(0,184,148,0.3) !important;
}

/* ── Inventory / Inspection tables ─────────── */
.inv-card {
    background: rgba(255,255,255,0.92); backdrop-filter: blur(10px);
    border-radius: 18px; padding: 18px 16px; margin-bottom: 14px;
    border: 1px solid rgba(0,0,0,0.04);
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}
.inv-card h3 { font-size: 16px; font-weight: 700; color: #1a1a2e; margin-bottom: 12px; }
.inv-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.inv-header h3 { margin-bottom: 0; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.inv-table {
    width: 100%; border-collapse: separate; border-spacing: 0;
    min-width: 600px; font-size: 13px;
}
.inv-table th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff; padding: 8px 6px; font-size: 11px; text-align: center;
    font-weight: 600; white-space: nowrap;
}
.inv-table th:first-child { border-radius: 10px 0 0 0; }
.inv-table th:last-child { border-radius: 0 10px 0 0; }
.inv-table thead th { position: sticky; top: 0; z-index: 2; }
.inv-table td { padding: 4px 3px; text-align: center; border-bottom: 1px solid #f1f5f9; }
.inv-table input {
    width: 100%; padding: 8px 2px; border: 2px solid #e2e8f0; border-radius: 8px;
    font-size: 14px; text-align: center; background: #fefce8;
    font-family: inherit; font-weight: 600; min-width: 50px;
}
.inv-table input:focus { outline: none; border-color: #667eea; box-shadow: 0 0 0 3px rgba(102,126,234,0.1); background: #fff; }
.cell-auto { font-weight: 700; color: #475569; background: #f8fafc; }
.cell-highlight { color: #667eea !important; font-weight: 800 !important; }
.cell-warn { color: #e17055 !important; }
.cell-name { text-align: left !important; white-space: nowrap; font-size: 12px; }
.row-total td { background: #f0f3ff !important; font-weight: 800 !important; }
.cust-table { min-width: 900px; }
.cust-table td { font-size: 12px; }
.cust-input { min-width: 30px !important; padding: 6px 1px !important; font-size: 12px !important; }
.cust-narrow { max-width: 40px !important; min-width: 28px !important; }
.cust-wide { min-width: 60px !important; }
.col-narrow { width: 38px; max-width: 42px; }
.col-wide { width: 75px; min-width: 65px; }
.cell-name { width: 60px; max-width: 70px; font-size: 11px !important; }

/* Inspection specific */
.th-blue { background: #1D4ED8 !important; }
.th-red { background: #B91C1C !important; }
.th-purple { background: #7C3AED !important; }
.insp-input-table { min-width: auto; }
.insp-date-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.insp-date-row label { font-size: 14px; font-weight: 600; }
.month-form { display: flex; align-items: center; gap: 10px; }
.month-form label { font-size: 14px; font-weight: 600; }
.month-input { width: 80px; padding: 8px 10px; border: 2px solid #e2e8f0; border-radius: 10px; font-size: 15px; font-family: inherit; font-weight: 600; text-align: center; }
.month-sm { width: 60px; }

/* ── KM setting ─────────────────────────────── */
.km-setting-card {
    background: rgba(255,255,255,0.9); backdrop-filter: blur(10px);
    border-radius: 16px; padding: 16px;
    border: 1px solid rgba(0,0,0,0.04);
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}
.km-set-form { display: flex; flex-direction: column; gap: 8px; }
.km-set-label { font-size: 14px; font-weight: 700; color: #1a1a2e; }
.km-set-row { display: flex; align-items: center; gap: 8px; }
.km-set-input {
    flex: 1; padding: 10px 12px; border: 2px solid #e2e8f0; border-radius: 10px;
    font-size: 16px; font-family: inherit; font-weight: 600; text-align: right;
}
.km-set-input:focus { outline: none; border-color: #667eea; box-shadow: 0 0 0 4px rgba(102,126,234,0.1); }
.km-set-unit { font-size: 14px; font-weight: 600; color: #94a3b8; }

/* ── Animations ─────────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.customer-card, .check-card, .vehicle-panel, .timeline-panel {
    animation: fadeIn 0.3s ease;
}
.customer-card:nth-child(1) { animation-delay: 0s; }
.customer-card:nth-child(2) { animation-delay: 0.05s; }
.customer-card:nth-child(3) { animation-delay: 0.1s; }
.customer-card:nth-child(4) { animation-delay: 0.15s; }
.customer-card:nth-child(5) { animation-delay: 0.2s; }

/* ── Scrollbar ──────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── Mobile optimization ────────────────────── */

/* 터치 타겟 최소 44px */
button, a.btn, .check-card, .customer-card { min-height: 44px; }

/* iOS 입력 확대 방지 */
input, select, textarea { font-size: 16px !important; }

/* 가로 스크롤 방지 */
html, body { overflow-x: hidden; max-width: 100vw; }

/* 풀다운 새로고침 배경 */
html { background: linear-gradient(135deg, #f5f7fa 0%, #e4e9f2 100%); }

/* safe-area (노치 대응) */
header { padding: 14px max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
main { padding: 16px max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }

/* 액션 바 - 항상 가로 배치, 넘침 방지 */
.action-bar { display: flex; gap: 8px; margin-top: 16px; justify-content: flex-end; flex-wrap: wrap; }
.action-bar .btn { white-space: nowrap; min-width: 0; flex-shrink: 1; }

/* 날짜 바 넘침 방지 */
.date-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 8px; flex-wrap: wrap; }

/* 뱃지 넘침 방지 */
.badge { white-space: nowrap; flex-shrink: 0; }

/* 카드 내부 넘침 방지 */
.customer-card { overflow: hidden; }
.card-left { overflow: hidden; min-width: 0; flex: 1; }
.card-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.card-summary { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.card-order {
    display: inline-flex; align-items: center; justify-content: center;
    width: 20px; height: 20px; border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff; font-size: 11px; font-weight: 800; margin-right: 6px;
    flex-shrink: 0;
}

/* 로그인 - 비밀번호 폼 넘침 */
.pw-form { width: 100%; }
.pw-form input { min-width: 0; }

/* 헤더 넘침 방지 */
.header-right { flex-shrink: 0; }
.header-left { overflow: hidden; min-width: 0; flex: 1; }
.header-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 배달 완료 버튼 */
/* ── Summary ────────────────────────────────── */
.summary-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 10px;
}
.summary-date {
    font-size: 16px; font-weight: 800; color: #1a1a2e;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.summary-vehicle { font-size: 14px; font-weight: 600; color: #64748b; }
.filter-form { display: flex; flex-direction: column; gap: 8px; }
.filter-row { display: flex; align-items: center; gap: 8px; }
.filter-row label { font-size: 13px; font-weight: 700; color: #475569; min-width: 40px; }
.filter-row span { color: #94a3b8; }
.summary-table { min-width: 400px; }
.th-in { font-size: 10px !important; }
.th-out { font-size: 10px !important; }
.cell-in { color: #334155; font-weight: 600; }
.cell-out { color: #334155; font-weight: 600; }
.cell-plus { color: #16a34a; font-weight: 700; }
.cell-minus { color: #dc2626; font-weight: 700; }

/* ── Map ───────────────────────────────────── */
.map-card {
    background: rgba(255,255,255,0.9); border-radius: 20px; padding: 8px;
    margin-bottom: 14px; box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    overflow: hidden;
}
.map-legend {
    background: rgba(255,255,255,0.9); border-radius: 16px; padding: 14px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}
.legend-item {
    display: flex; align-items: center; gap: 8px; padding: 6px 0;
    font-size: 14px; font-weight: 600;
}
.legend-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.legend-count { font-size: 12px; color: #94a3b8; margin-left: auto; }
.legend-detail {
    padding: 3px 0 3px 20px; font-size: 12px; color: #64748b;
    border-bottom: 1px solid #f1f5f9;
}
.legend-time { color: #667eea; font-weight: 700; margin-right: 8px; }
.map-number { background: none !important; border: none !important; }
.map-vehicle-card {
    background: rgba(255,255,255,0.92); border-radius: 20px; padding: 16px;
    margin-bottom: 14px; box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    overflow: hidden;
}
.map-vehicle-header {
    display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
    font-size: 15px;
}
.map-timeline { margin-top: 10px; }
.legend-order {
    display: inline-flex; align-items: center; justify-content: center;
    width: 20px; height: 20px; border-radius: 50%;
    background: #667eea; color: #fff; font-size: 10px; font-weight: 800;
    margin-right: 6px; flex-shrink: 0;
}

/* ── Modal ──────────────────────────────────── */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); backdrop-filter: blur(6px);
    display: flex; justify-content: center; align-items: center;
    z-index: 999; padding: 20px;
    animation: fadeIn 0.2s ease;
}
.modal-card {
    background: #fff; border-radius: 24px; padding: 32px 24px;
    max-width: 360px; width: 100%; text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    animation: fadeIn 0.3s ease;
}
.modal-icon { margin-bottom: 16px; }
.modal-title { font-size: 18px; font-weight: 800; color: #1a1a2e; margin-bottom: 8px; }
.modal-desc { font-size: 13px; color: #94a3b8; margin-bottom: 16px; }
.modal-summary {
    background: #f8fafc; border-radius: 14px; padding: 12px;
    margin-bottom: 20px; text-align: left; max-height: 200px; overflow-y: auto;
}
.modal-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 6px 4px; border-bottom: 1px solid #f1f5f9; font-size: 13px;
}
.modal-row:last-child { border-bottom: none; }
.modal-check { font-size: 11px; color: #667eea; font-weight: 600; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { flex: 1; padding: 12px; font-size: 15px; }

.day-complete-form { margin-top: 16px; }
.btn-day-complete { padding: 14px; font-size: 16px; }
.day-closed-badge { margin-top: 16px; }

/* 탭 넘침 방지 */
.tab-nav { flex-wrap: nowrap; overflow-x: auto; }
.tab-item { white-space: nowrap; min-width: 0; }

/* 전산대조 요약 */
.verify-summary { flex-wrap: wrap; }

/* 검사소 월 선택 */
.month-form { flex-wrap: wrap; }

@media (max-width: 480px) {
    header { padding: 10px 12px; }
    .header-title { font-size: 14px; }
    .header-user { font-size: 12px; margin-right: 6px; }
    .btn-logout { padding: 5px 10px; font-size: 11px; }
    main { padding: 12px 8px; }

    /* 로그인 */
    .login-wrap { min-height: 70vh; padding: 0 4px; }
    .login-form { padding: 24px 16px 20px; border-radius: 20px; max-width: 100%; }
    .login-form h2 { font-size: 20px; margin-bottom: 20px; }
    .login-sub { font-size: 10px; }
    .driver-grid { gap: 8px; }
    .driver-card { padding: 16px 8px 12px; border-radius: 12px; }
    .driver-icon { width: 40px; height: 40px; border-radius: 10px; }
    .driver-icon svg { width: 20px; height: 20px; }
    .driver-vehicle { font-size: 14px; }
    .driver-name { font-size: 11px; }
    .login-divider { margin: 18px 0 14px; }
    .office-btn { padding: 12px; font-size: 13px; }
    .office-icon { width: 32px; height: 32px; border-radius: 8px; }
    .pw-form input { padding: 12px 14px; }
    .pw-submit { width: 48px; min-height: 44px; }
    .field-card .driver-card { padding: 14px 12px; }

    /* 거래처 선택 */
    h2 { font-size: 16px; margin-bottom: 12px; }
    .check-card { padding: 12px; border-radius: 10px; margin-bottom: 6px; }
    .check-label { font-size: 14px; }
    .order-num { width: 24px; height: 24px; font-size: 12px; margin-right: 10px; }

    /* 기사 메인 */
    .customer-card { padding: 12px; border-radius: 12px; margin-bottom: 6px; }
    .card-name { font-size: 14px; max-width: calc(100vw - 120px); }
    .card-summary { font-size: 10px; max-width: calc(100vw - 120px); }
    .card-time { font-size: 11px; }
    .badge { padding: 4px 8px; font-size: 10px; }
    .progress-text { font-size: 12px; }
    .progress-bar { height: 6px; }

    /* 입력 폼 */
    .delivery-form { padding: 14px 8px; border-radius: 14px; }
    .input-table { width: 100%; table-layout: fixed; }
    .input-table th { padding: 8px 2px; font-size: 11px; }
    .input-table td { padding: 4px 2px; }
    .input-table input { padding: 10px 2px; border-radius: 6px; width: 100%; }
    .cell-label { font-size: 12px; width: 45px; }
    .form-title { font-size: 14px; margin-bottom: 10px; }

    /* 액션 바 */
    .action-bar { gap: 6px; margin-top: 12px; }
    .action-bar .btn { padding: 10px 6px; font-size: 12px; flex: 1; text-align: center; }

    /* 사무실 */
    .vehicle-grid { grid-template-columns: 1fr; }
    .vehicle-panel { padding: 12px 10px; border-radius: 14px; }
    .panel-header { font-size: 13px; flex-wrap: wrap; }
    .panel-count { font-size: 15px; }
    .panel-row { padding: 6px 0; flex-wrap: wrap; }
    .row-name { font-size: 12px; max-width: 50%; overflow: hidden; text-overflow: ellipsis; }
    .row-right { flex-shrink: 0; }
    .row-time { font-size: 10px; }
    .km-info { font-size: 10px; padding: 6px 8px; flex-wrap: wrap; }

    /* 타임라인 */
    .timeline-panel { padding: 12px 10px; border-radius: 14px; margin-top: 10px; }
    .timeline-row { gap: 6px; padding: 6px 0; flex-wrap: wrap; }
    .tl-time { font-size: 11px; min-width: 44px; }
    .tl-name { font-size: 12px; }
    .section-title { font-size: 14px; margin: 14px 0 8px; }

    /* 날짜 */
    .date-input { padding: 8px 6px; font-size: 14px !important; border-radius: 8px; flex: 1; min-width: 0; max-width: 50%; }
    .date-select { padding: 8px 6px; font-size: 12px !important; border-radius: 8px; min-width: 0; flex: 1; max-width: 50%; }

    /* 상세 테이블 */
    .detail-table { table-layout: fixed; width: 100%; }
    .detail-table th { font-size: 9px; padding: 3px 1px; }
    .detail-table td { font-size: 10px; padding: 2px 1px; }
    .dt-label { font-size: 9px; }

    /* 탭 */
    .tab-nav { gap: 3px; padding: 3px; -webkit-overflow-scrolling: touch; }
    .tab-item { padding: 8px 8px; font-size: 11px; flex-shrink: 0; }

    /* 전산대조 */
    .verify-summary { gap: 6px; }
    .summary-item { padding: 10px 4px; }
    .summary-num { font-size: 20px; }
    .summary-label { font-size: 9px; }
    .verify-desc { font-size: 12px; }

    /* 재고/검사 */
    .inv-card { padding: 12px 8px; border-radius: 14px; margin-bottom: 10px; }
    .inv-card h3 { font-size: 13px; margin-bottom: 8px; }
    .inv-table input { padding: 6px 1px; font-size: 13px !important; min-width: 36px; }
    .month-form { gap: 6px; flex-wrap: wrap; }
    .month-input { width: 60px; padding: 6px 6px; font-size: 14px; }
    .month-sm { width: 45px; }
    .insp-date-row { gap: 6px; flex-wrap: wrap; }

    /* 입출고 현황 필터 */
    .filter-row { flex-wrap: wrap; }
    .filter-row label { min-width: 35px; font-size: 12px; }

    /* 배달 완료 */
    .btn-day-complete { padding: 12px; font-size: 15px; }
    .day-closed-badge { font-size: 14px; padding: 12px; }

    /* 모달 */
    .modal-card { padding: 24px 16px; border-radius: 20px; }
    .modal-title { font-size: 16px; }
    .modal-actions .btn { padding: 10px; font-size: 14px; }

    /* 키로수 세팅 */
    .km-setting-card { padding: 10px; }
    .km-set-input { font-size: 14px; padding: 8px 8px; }

    /* 지도 */
    .map-vehicle-card { padding: 12px 10px; }
    .map-vehicle-header { font-size: 13px; }
}

/* 아주 작은 화면 (Galaxy S 등) */
@media (max-width: 360px) {
    main { padding: 10px 6px; }
    .login-form { padding: 20px 12px 16px; }
    .driver-grid { gap: 6px; }
    .driver-card { padding: 12px 6px 10px; }
    .driver-vehicle { font-size: 13px; }
    .customer-card { padding: 10px 8px; }
    .card-name { font-size: 13px; }
    .action-bar .btn { padding: 8px 4px; font-size: 11px; }
    .input-table input { padding: 8px 1px; font-size: 14px !important; }
    .cell-label { font-size: 11px; width: 38px; }
    .tab-item { padding: 7px 6px; font-size: 10px; }
    .badge { padding: 3px 6px; font-size: 9px; }
    .inv-card { padding: 10px 6px; }
    .modal-card { padding: 20px 12px; margin: 10px; }
}

/* 큰 폰 (iPhone Pro Max, Galaxy Ultra 등) */
@media (min-width: 481px) and (max-width: 768px) {
    main { max-width: 100%; padding: 16px 14px; }
    .login-form { max-width: 420px; }
    .customer-card { padding: 16px; }
    .delivery-form { padding: 20px 16px; }
}

