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

:root { color-scheme: dark; }

body {
    font-family: 'Segoe UI', 'Malgun Gothic', Tahoma, sans-serif;
    background: #0a0f1e;
    color: #e8edf7;
    -webkit-tap-highlight-color: transparent;
}

.app {
    max-width: 520px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 0 16px 40px;
}

.app-header {
    padding: 26px 0 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-header .logo { font-size: 30px; }

.app-header h1 {
    font-size: 20px;
    font-weight: 800;
    color: #f0f4ff;
    white-space: nowrap;
}

.app-header .sub {
    font-size: 11px;
    color: #4a6a9a;
    white-space: nowrap;
}

.header-right {
    margin-left: auto;
    flex-shrink: 0;
}

.card {
    background: #121a30;
    border: 1px solid #1e2a4a;
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 14px;
}

.card h2 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 12px;
    color: #f0f4ff;
}

.meta { font-size: 12px; color: #6a82ab; margin-bottom: 10px; }

.field { margin-bottom: 14px; }

.field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #8ba3c7;
    margin-bottom: 5px;
}

/* 체크박스는 네이티브 위젯 유지 (아래 공통 input 규칙에서 제외) */
.field input[type="checkbox"] {
    -webkit-appearance: auto;
    appearance: auto;
    width: 20px;
    height: 20px;
    min-height: 0;
    padding: 0;
    margin: 0;
    border: none;
    background: none;
    accent-color: #c0392b;
    flex-shrink: 0;
    cursor: pointer;
}

.field input:not([type="checkbox"]), .field select {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    min-height: 47px;
    background: #0d1426;
    border: 1px solid #24345c;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 15px;
    font-family: inherit;
    color: #e8edf7;
    outline: none;
}

.field input:focus, .field select:focus { border-color: #c0392b; }

.field input::placeholder { color: #3d5478; }

/* 자동완성이 강제하는 흰 배경 무력화 */
.field input:-webkit-autofill,
.field input:-webkit-autofill:hover,
.field input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px #0d1426 inset;
    -webkit-text-fill-color: #e8edf7;
    caret-color: #e8edf7;
    border: 1px solid #24345c;
    transition: background-color 99999s ease-in-out 0s;
}

/* select 커스텀 화살표 (appearance:none으로 사라진 것 복원) */
.field select {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238ba3c7' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

/* date 입력: 모바일 기본 스타일 무력화 후 통일 */
.field input[type="date"] {
    display: block;
    text-align: left;
    color: #e8edf7;
}

.field input[type="date"]::-webkit-date-and-time-value {
    text-align: left;
    line-height: normal;
}

.field input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.6);
    cursor: pointer;
}

.btn {
    display: block;
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 10px;
    background: #c0392b;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}

.btn:active { background: #a93226; }

.btn-outline {
    background: transparent;
    border: 1px solid #2a3a5a;
    color: #8ba3c7;
    margin-top: 10px;
}

.btn-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 14px;
    border: none;
    border-radius: 8px;
    background: #1e2a4a;
    color: #cfe0f5;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    font-family: inherit;
}

.btn-sm-danger { background: #5c1f1f; color: #ffb3ab; }
.btn-sm-green { background: #14532d; color: #a7e3bd; }

.alert-success {
    background: #12331f;
    border: 1px solid #1d5c36;
    color: #a7e3bd;
    border-radius: 10px;
    padding: 11px 14px;
    font-size: 13px;
    margin-bottom: 14px;
}

.alert-error {
    background: #3d1512;
    border: 1px solid #6e2a24;
    color: #ffb3ab;
    border-radius: 10px;
    padding: 11px 14px;
    font-size: 13px;
    margin-bottom: 14px;
}

.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: #121a30;
    border: 1px solid #1e2a4a;
    border-radius: 16px;
    padding: 30px 24px;
}

.auth-card .brand {
    text-align: center;
    margin-bottom: 22px;
}

.auth-card .brand .logo { font-size: 40px; }

.auth-card .brand h1 {
    font-size: 21px;
    font-weight: 800;
    color: #f0f4ff;
    margin-top: 6px;
}

.auth-card .brand p {
    font-size: 12px;
    color: #4a6a9a;
    margin-top: 3px;
}

.auth-link {
    display: block;
    text-align: center;
    margin-top: 16px;
    font-size: 13px;
    color: #8ba3c7;
    text-decoration: none;
}

.auth-link:hover { color: #cfe0f5; }

.otp-input {
    text-align: center !important;
    font-size: 26px !important;
    letter-spacing: 10px;
    font-weight: 800;
}

.otp-timer {
    text-align: center;
    font-size: 13px;
    color: #8ba3c7;
    margin-bottom: 14px;
}

.otp-timer .time { color: #e74c3c; font-weight: 700; }

.row-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-top: 1px solid #1a2440;
}

.row-item:first-of-type { border-top: none; }

.row-item .info { flex: 1; min-width: 0; }

.row-item .info .name { font-weight: 700; font-size: 14px; }

.row-item .info .desc { font-size: 12px; color: #6a82ab; margin-top: 2px; }

.inline-form { display: inline; }

/* 작업 상태 배지 */
.status-pill {
    display: inline-block;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    white-space: nowrap;
}

.status-pending { background: #1e2a4a; color: #8ba3c7; }
.status-running { background: #14345c; color: #7db8ff; }
.status-success { background: #12331f; color: #6fdb96; }
.status-failed  { background: #3d1512; color: #ff8a80; }
.status-stopped { background: #2a2a35; color: #9aa0b5; }
.status-expired { background: #3a2f14; color: #d9b84a; }

.job-link { text-decoration: none; color: inherit; display: block; }

.job-route {
    font-size: 15px;
    font-weight: 800;
    color: #f0f4ff;
}

.job-route .arrow { color: #c0392b; margin: 0 4px; }

/* 로그 박스 */
.log-box {
    background: #060a15;
    border: 1px solid #1a2440;
    border-radius: 10px;
    padding: 12px;
    height: 320px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.7;
}

.log-line { color: #8ba3c7; word-break: break-all; }
.log-line .t { color: #3d5478; margin-right: 6px; }
.log-line.success { color: #6fdb96; }
.log-line.error { color: #ff8a80; }

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 10px;
}

.btn-add {
    display: block;
    text-align: center;
    text-decoration: none;
    padding: 14px;
    border-radius: 10px;
    background: #c0392b;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 14px;
}

/* ── 열차 목록 선택 ── */
.train-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 10px 0 12px;
    max-height: 320px;
    overflow-y: auto;
}

.train-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid #1e2b47;
    border-radius: 10px;
    background: #0d142b;
    cursor: pointer;
    font-size: 13px;
}

.train-item:has(input:checked) {
    border-color: #c0392b;
    background: #1a1024;
}

.train-item input[type="checkbox"] {
    appearance: auto;
    -webkit-appearance: auto;
    width: 17px;
    height: 17px;
    accent-color: #c0392b;
    flex-shrink: 0;
    margin: 0;
}

.train-main {
    flex: 1;
    color: #e8ecf6;
    font-weight: 600;
    white-space: nowrap;
}

.train-seat {
    color: #8a97b8;
    font-size: 12px;
    text-align: right;
}
