/* 선상예약 레이더 — 바다 남색 + 청록 + 주황 포인트. 휴대폰에서도 쓰도록 반응형 */
:root {
    --ink: #0E2230;
    --ink-2: #3F5563;
    --mute: #5B7280;
    --line: #D5DEE2;
    --line-2: #E3E9EC;
    --bg: #F2F5F6;
    --card: #FFFFFF;
    --teal: #0B5F66;
    --teal-dark: #063F44;
    --teal-soft: #D9EEF0;
    --orange: #FFB86B;
    --orange-soft: #FFE9CC;
    --orange-ink: #7A3E00;
    --red: #B42318;
    --red-soft: #FDE7E5;
    --green: #146C2E;
    --green-soft: #DDF3E3;
    --radius: 10px;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
    color: var(--ink);
    background: var(--bg);
    font-size: 15px;
    line-height: 1.5;
}
a { color: var(--teal); }
a:hover { color: var(--teal-dark); }
h1 { font-size: 24px; margin: 0 0 14px; }
h2 { font-size: 18px; margin: 0 0 10px; }
h3 { font-size: 15px; margin: 16px 0 8px; }
code, .mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13px; }
.muted { color: var(--mute); }
.small { font-size: 13px; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- 상단 ---------- */
.topbar {
    background: var(--ink);
    color: #fff;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 20px;
    padding: 10px 20px;
}
.brand { color: #fff; font-weight: 700; font-size: 18px; text-decoration: none; }
.brand:hover { color: var(--orange); }
.nav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
.nav-link {
    color: #DCE6EB;
    text-decoration: none;
    padding: 10px 12px;
    border-radius: 6px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.nav-link:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.nav-link.active { background: #fff; color: var(--ink); font-weight: 600; }
.badge { background: var(--orange); color: var(--ink); border-radius: 999px; font-size: 12px; font-weight: 700; padding: 0 7px; }
.logout { margin: 0; }
.topbar .link-btn { color: #B9CAD3; }

.container { max-width: 1240px; margin: 0 auto; padding: 22px 20px 40px; }
.footer { text-align: center; color: var(--mute); font-size: 12px; padding: 20px; }

/* ---------- 카드·그리드 ---------- */
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 16px;
}
.card.narrow { max-width: 440px; margin: 30px auto; }
.card.narrow.wide { max-width: 720px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.card-head h1, .card-head h2 { margin: 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.grid2 > .card { margin-bottom: 0; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.page-head h1 { margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions form { margin: 0; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat-label { font-size: 13px; color: var(--mute); }
.stat-value { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-value.ok { color: var(--green); }
.stat-value.bad { color: var(--red); }

/* ---------- 폼 ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; min-width: 150px; flex: 1 1 160px; }
.filters .field { margin-bottom: 0; }
.field.small-field { flex: 0 1 120px; min-width: 100px; }
.field.check { flex-direction: row; align-items: center; min-height: 44px; }
.field.check label, .checks label, .radio { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; }
label { font-size: 14px; font-weight: 600; color: var(--ink-2); }
input[type=text], input:not([type]), input[type=number], input[type=date], input[type=datetime-local],
input[type=password], input[type=tel], select, textarea {
    font: inherit;
    min-height: 44px;
    padding: 8px 10px;
    border: 1px solid #A9B8C0;
    border-radius: 6px;
    background: #fff;
    color: var(--ink);
    width: 100%;
}
textarea { min-height: 80px; }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; accent-color: var(--teal); }
.checks { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.radio { margin: 4px 0; min-height: 36px; }
input.prio { width: 70px; min-height: 40px; }
.dates { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
form.inline { display: inline; margin: 0; }
.danger-zone { margin-top: 24px; padding-top: 12px; border-top: 1px dashed var(--line); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 16px;
    border: 1px solid #A9B8C0;
    border-radius: 6px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}
.btn:hover { border-color: var(--teal); color: var(--teal-dark); }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.primary:hover { background: var(--teal-dark); color: #fff; }
.btn.danger { color: var(--red); border-color: #E3A39C; }
.btn.small { min-height: 36px; padding: 0 10px; font-size: 13px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.link-btn { background: none; border: none; color: var(--teal); font: inherit; cursor: pointer; padding: 6px; min-height: 36px; }
.star { background: none; border: none; font-size: 20px; color: #C9D3D8; cursor: pointer; min-width: 36px; min-height: 36px; }
.star.on { color: #E8A23A; }

.error { background: var(--red-soft); color: var(--red); border-radius: 6px; padding: 10px 12px; margin: 8px 0 12px; }
.notice { background: var(--teal-soft); color: var(--teal-dark); border-radius: 6px; padding: 10px 12px; margin: 0 0 14px; }
.notice.warn { background: var(--orange-soft); color: var(--orange-ink); }

/* ---------- 표·목록 ---------- */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; }
.card .table-wrap { border: none; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 13px; color: var(--mute); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px 12px; border-top: 1px solid var(--line-2); vertical-align: top; }
.table tr.dim td { opacity: .55; }
.table tr.bad-row td { background: #FFF6F5; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 10px 0; border-top: 1px solid var(--line-2); display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; }
.list li:first-child { border-top: none; }
.list.card li { padding: 10px 4px; }
.list li.read { opacity: .6; }

.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.pill.ok { background: var(--green-soft); color: var(--green); }
.pill.off { background: #E3E9EC; color: var(--ink-2); }
.pill.warn { background: var(--orange-soft); color: var(--orange-ink); }
.pill.bad { background: var(--red-soft); color: var(--red); }
.pill.done { background: var(--teal-soft); color: var(--teal-dark); }
.pill.mute { background: #EEF2F4; color: var(--mute); }
.stars { color: #E8A23A; letter-spacing: 1px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff; text-decoration: none; color: var(--ink); font-size: 14px; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip.on .muted { color: #B9CAD3; }

.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; margin: 0 0 12px; }
.kv dt { color: var(--mute); font-size: 14px; }
.kv dd { margin: 0; }
.log { background: #F6F8F9; border-radius: 6px; padding: 10px; font-size: 12.5px; white-space: pre-wrap; margin: 8px 0; max-height: 180px; overflow: auto; }

.login-title { text-align: center; margin: 6px 0 18px; }
.qr-box { text-align: center; margin: 10px 0; }
.qr-box img { width: 220px; height: 220px; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 12px 0; }
.codes span { background: #F6F8F9; padding: 6px; text-align: center; border-radius: 4px; }

@media (max-width: 640px) {
    .container { padding: 14px 12px 30px; }
    .topbar { padding: 8px 12px; }
    .nav-link { padding: 8px 9px; }
    .kv { grid-template-columns: 90px 1fr; }
    h1 { font-size: 21px; }
}

/* ---------- 사용자 관리 ---------- */
.temp-pw { display: grid; gap: 6px; }
.temp-pw .big { font-size: 22px; font-weight: 700; letter-spacing: 1px; user-select: all; }
.inline-details { display: inline-block; }
.inline-details > summary { list-style: none; }
.inline-details > summary::-webkit-details-marker { display: none; }

/* ---------- 달력 (일요일·공휴일 빨강, 토요일 파랑) ---------- */
:root { --sun: #C62828; --sat: #1556B8; }
.sun, .holiday { color: var(--sun); }
.sat { color: var(--sat); }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.cal-head h2 { margin: 0; }
.cal-nav { display: flex; gap: 6px; align-items: center; }
.cal { width: 100%; border-collapse: collapse; table-layout: fixed; background: var(--card); }
.cal th { font-size: 13px; font-weight: 700; padding: 8px 4px; border-bottom: 1px solid var(--line); text-align: center; }
.cal td { vertical-align: top; height: 104px; padding: 4px; border: 1px solid var(--line-2); }
.cal td.empty { background: #F7F9FA; }
.cal td.today { box-shadow: inset 0 0 0 2px var(--teal); }
.cal td.past .day-items { opacity: .6; }
.cal .day-num { font-weight: 700; font-size: 14px; display: flex; justify-content: space-between; gap: 4px; }
.cal .day-num .hname { font-weight: 400; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal .day-items { display: flex; flex-direction: column; gap: 3px; margin-top: 3px; }
.cal .ev { display: block; font-size: 12px; line-height: 1.3; padding: 3px 5px; border-radius: 5px; text-decoration: none; color: var(--ink);
           background: var(--teal-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal .ev.ok { background: var(--green-soft); color: var(--green); }
.cal .ev.warn { background: var(--orange-soft); color: var(--orange-ink); }
.cal .ev.bad { background: var(--red-soft); color: var(--red); }
.cal .ev.off { background: #EEF2F4; color: var(--mute); }
.cal .ev.done { background: var(--teal-soft); color: var(--teal-dark); }
.cal .ev.rule { background: #fff; border: 1px dashed var(--teal); color: var(--teal-dark); }
.cal .ev small { color: inherit; opacity: .85; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--mute); margin: 8px 0 0; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
@media (max-width: 640px) {
    .cal td { height: 76px; padding: 2px; }
    .cal .ev { font-size: 10.5px; padding: 2px 3px; }
    .cal .day-num .hname { display: none; }
}

/* 휴대폰: 메뉴를 한 줄 가로 스크롤로 (메뉴가 10개라 여러 줄로 쌓이지 않게) */
@media (max-width: 640px) {
    .topbar { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; padding: 8px 12px 0; }
    .topbar .nav { grid-column: 1 / -1; grid-row: 2; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
                   scrollbar-width: none; margin: 0 -12px; padding: 0 12px 8px; }
    .topbar .nav::-webkit-scrollbar { display: none; }
    .nav-link { white-space: nowrap; min-height: 40px; padding: 8px 10px; flex: 0 0 auto; }
}
.cal .ev.sp { background: none; padding: 0 2px; }
.only-narrow { display: none; }
@media (max-width: 640px) {
    .only-wide { display: none; }
    .only-narrow { display: inline; }
    .cal .ev { text-overflow: clip; text-align: center; }
    .cal .ev.sp { text-align: left; }
}

/* ---------- 로고 ---------- */
.brand { display: inline-flex; align-items: center; gap: 9px; }
.brand img { width: 30px; height: 30px; flex: 0 0 auto; }
.login-logo { display: block; margin: 4px auto 2px; width: 112px; height: 112px; }
@media (max-width: 640px) { .brand img { width: 26px; height: 26px; } .brand { font-size: 17px; } }

/* ---------- 오픈 감시 ---------- */
.watch-box { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.watch-box > div { flex: 1 1 260px; }

/* 선사 */
a.company { color: var(--ink-2); text-decoration: none; font-weight: 600; }
a.company:hover { color: var(--teal); text-decoration: underline; }
.company-h { font-size: 15px; font-weight: 600; margin-right: 4px; }
