:root {
  --navy: #0f2340; --navy-2: #1b3560; --gold: #b8955a; --gold-soft: #f3ece0;
  --bg: #f5f6f8; --card: #fff; --line: #e2e5ea; --text: #1d2430; --muted: #6b7380;
  --ok: #1f7a4d; --warn: #b36b00; --bad: #b42318; --info: #1d5fbf;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 Pretendard, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif; }
a { color: var(--navy-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 0 0 8px; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); }
.center { text-align: center; }
.small { font-size: 12px; }

header { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 10; }
header .bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 20px; max-width: 1280px; margin: 0 auto; }
.brand { color: #fff; font-weight: 700; font-size: 16px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand .logo { color: var(--gold); }
.brand small { font-weight: 400; opacity: .7; margin-left: 4px; font-size: 12px; }
.who { font-size: 12px; opacity: .9; white-space: nowrap; }
.who a, .who .link { color: #fff; }
nav { display: flex; gap: 4px; padding: 0 16px; max-width: 1280px; margin: 0 auto; overflow-x: auto; }
nav a { color: #c9d2e0; padding: 10px 12px; border-bottom: 3px solid transparent; white-space: nowrap; font-weight: 600; }
nav a:hover { color: #fff; text-decoration: none; }
nav a.on { color: #fff; border-bottom-color: var(--gold); }

main { max-width: 1280px; margin: 0 auto; padding: 20px; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 860px) { .g2, .g3 { grid-template-columns: minmax(0, 1fr); } main { padding: 14px 12px; } header .bar { padding: 10px 12px; } .brand small { display: none; } }

.btn, button.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; color: var(--text); padding: 8px 14px; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #f0f2f5; text-decoration: none; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy-2); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 4px 10px; font-size: 12px; }
button.link { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; color: var(--navy-2); }
button:disabled { opacity: .5; cursor: default; }

input, select, textarea { font: inherit; color: inherit; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: -1px; border-color: var(--gold); }
textarea { min-height: 80px; resize: vertical; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
label.f .req { color: var(--bad); }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.form-grid .w2 { grid-column: span 2; }
.form-grid .w4 { grid-column: 1 / -1; }
@media (max-width: 860px) { .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .form-grid .w2 { grid-column: 1 / -1; } }
.inline { display: flex; gap: 6px; align-items: center; }
.inline > select { flex: 1; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filters input[type=search] { flex: 1 1 220px; }
.filters select { width: auto; flex: 0 0 auto; }

.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; vertical-align: top; }
th { background: #f8f9fb; font-size: 12px; color: var(--muted); font-weight: 600; position: sticky; top: 0; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover { background: var(--gold-soft); }
td.wrap { white-space: normal; min-width: 160px; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eef0f3; color: var(--muted); white-space: nowrap; }
.s-접수 { background: #eef0f3; color: #4a5260; }
.s-부킹완료 { background: #e6efff; color: var(--info); }
.s-선적완료 { background: #e8f0fb; color: var(--navy-2); }
.s-도착·통관중 { background: #fff3e0; color: var(--warn); }
.s-청구·지급중 { background: #f6ecff; color: #6b3fa0; }
.s-완료 { background: #e5f4ec; color: var(--ok); }
.s-취소 { background: #fbe9e7; color: var(--bad); text-decoration: line-through; }
.mode { font-size: 12px; color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: block; color: inherit; }
.stat:hover { border-color: var(--gold); text-decoration: none; }
.stat .n { font-size: 24px; font-weight: 700; color: var(--navy); }
.stat .l { font-size: 12px; color: var(--muted); }

.kv { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 6px 12px; margin: 0; }
.kv dt { color: var(--muted); font-size: 12px; padding-top: 2px; }
.kv dd { margin: 0; word-break: break-word; white-space: pre-wrap; }

.job-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.route { font-size: 18px; font-weight: 700; color: var(--navy); margin: 4px 0 0; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 0; }
.timeline .meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.timeline .body { white-space: pre-wrap; word-break: break-word; margin-top: 2px; }
.timeline .k-status .body { font-weight: 600; color: var(--navy-2); }
.timeline .k-update .body, .timeline .k-file .body, .timeline .k-create .body { color: var(--muted); font-size: 13px; }

.login { max-width: 380px; margin: 8vh auto; }
.login .card { padding: 28px; }
.login h1 { margin-bottom: 4px; }
.login .brand-big { font-size: 22px; font-weight: 800; color: var(--navy); margin-bottom: 18px; }
.login .brand-big span { color: var(--gold); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.error { color: var(--bad); font-size: 13px; min-height: 1em; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 8px; opacity: 0; pointer-events: none; transition: .2s; z-index: 50; max-width: calc(100vw - 32px); }
#toast.on { opacity: 1; transform: translateX(-50%); }
#toast.bad { background: var(--bad); }

dialog { border: 0; border-radius: 12px; padding: 0; width: min(520px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(15,35,64,.4); }
dialog form { padding: 20px; }
dialog .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.files { list-style: none; padding: 0; margin: 0; }
.files li { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }
.files li:last-child { border-bottom: 0; }
.files .name { word-break: break-all; }
.grid { margin-bottom: 16px; }
.grid > .card { margin-bottom: 0; }
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand img { height: 36px; width: auto; display: block; }
.brand small { margin-left: 0; padding-left: 10px; border-left: 1px solid rgba(255,255,255,.3); }
.login .brand-big { text-align: center; margin: -4px 0 20px; }
.login .brand-big img { width: 240px; max-width: 100%; height: auto; }
.login h1 { text-align: center; }
.login > .card > p.muted { text-align: center; }
@media (max-width: 860px) { .brand img { height: 28px; } }
.brand img { height: 46px; margin: -6px 0 -6px -8px; }
@media (max-width: 860px) { .brand img { height: 36px; margin-left: -6px; } }
.stack > .btn { justify-content: center; }
@media (max-width: 560px) { .who-n { display: none; } }
.filters .more { display: contents; }
.filters .more-toggle { display: none; }
@media (max-width: 860px) {
  .filters .more-toggle { display: inline-flex; }
  .filters .more { display: none; width: 100%; gap: 8px; flex-wrap: wrap; }
  .filters .more.open { display: flex; }
  .filters .more > select, .filters .more > input { flex: 1 1 40%; }
}
