/* ===== PIJ Customer Portal CSS ===== */
/* Design: Navy #0F1F3D / Gold #C9A84C / Cream #F8F6F1 */

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

:root {
    --navy:       #0F1F3D;
    --navy-mid:   #1A3260;
    --navy-light: #2A4A8C;
    --gold:       #C9A84C;
    --gold-light: #E8D099;
    --cream:      #F8F6F1;
    --warm-gray:  #E8E4DC;
    --border:     #DDD9D0;
    --text:       #1A1A1A;
    --text-muted: #6B6860;
    --text-light: #9B978F;
    --red:        #C0392B;
    --green:      #2E7D32;
    --blue:       #1565C0;
}

body {
    font-family: 'DM Sans', 'Noto Sans JP', sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--cream);
    line-height: 1.6;
    overflow-x: hidden;
}

a { color: var(--navy); text-decoration: none; }
a:hover { color: var(--gold); }

/* ===== LOGIN ===== */
body.login-body {
    background: var(--navy);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-wrap {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    max-width: 860px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 40px 80px rgba(0,0,0,0.4);
}

.login-left {
    background: var(--navy-mid);
    padding: 48px 40px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 32px;
}

.login-logo {
    font-size: 36px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.08em;
}
.login-logo span { color: var(--gold); }
.login-tagline {
    font-size: 11px;
    color: rgba(255,255,255,0.35);
    letter-spacing: 0.15em;
    margin-top: 6px;
}

.login-stats { display: flex; flex-direction: column; gap: 10px; }
.stat-chip {
    padding: 14px 18px;
    background: rgba(255,255,255,0.05);
    border: 0.5px solid rgba(255,255,255,0.1);
    border-radius: 10px;
}
.stat-chip-inner { display: flex; align-items: baseline; gap: 10px; }
.stat-num { font-size: 28px; font-weight: 600; color: var(--gold); line-height: 1; }
.stat-num small { font-size: 14px; font-weight: 400; }
.stat-label { font-size: 12px; color: rgba(255,255,255,0.4); }
.login-copy { font-size: 11px; color: rgba(255,255,255,0.2); }

.login-right {
    background: #fff;
    padding: 48px 44px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-form-wrap { display: flex; flex-direction: column; gap: 24px; }
.login-heading { font-size: 22px; font-weight: 600; color: var(--navy); letter-spacing: -0.02em; }
.login-sub { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.login-error {
    background: #fdf0ef;
    color: var(--red);
    border: 0.5px solid #f5c6c2;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
}

.login-form { display: flex; flex-direction: column; gap: 16px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 11px; font-weight: 500; color: var(--text-muted); letter-spacing: 0.06em; text-transform: uppercase; }
.field input {
    padding: 12px 14px;
    border: 0.5px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: var(--cream);
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}
.field input:focus {
    border-color: var(--navy);
    box-shadow: 0 0 0 3px rgba(15,31,61,0.08);
    background: #fff;
}

.login-submit {
    padding: 14px;
    background: var(--navy);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    letter-spacing: 0.06em;
    transition: background 0.2s;
    margin-top: 4px;
}
.login-submit:hover { background: var(--navy-mid); }

.login-contact { font-size: 12px; color: var(--text-light); text-align: center; }

/* ===== HEADER ===== */
.portal-header {
    background: var(--navy);
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 0 rgba(255,255,255,0.06);
}
.header-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 32px;
}

.header-logo {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.05em;
    white-space: nowrap;
    text-decoration: none;
}
.header-logo span { color: var(--gold); }
.header-logo em {
    font-style: normal;
    font-size: 12px;
    font-weight: 400;
    color: rgba(255,255,255,0.4);
    margin-left: 12px;
    letter-spacing: 0;
}

.header-nav {
    display: flex;
    gap: 2px;
    flex: 1;
    align-items: center;
}
.nav-link {
    padding: 6px 14px;
    font-size: 13px;
    color: rgba(255,255,255,0.55);
    border-radius: 6px;
    transition: all 0.15s;
    white-space: nowrap;
}
.nav-link:hover { color: #fff; background: rgba(255,255,255,0.08); }
.nav-link.active { color: #fff; background: rgba(255,255,255,0.12); }
.nav-link-stats {
    color: #C9A84C;
}
.nav-link-stats:hover { color: #C9A84C; opacity: 0.75; background: none; }
.nav-link-stats.active { color: #C9A84C; border-bottom: 2px solid #C9A84C; background: none; }

.header-user {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}
.user-name { font-size: 12px; color: rgba(255,255,255,0.6); }
.user-name small { color: rgba(255,255,255,0.4); }
.support-btn {
    padding: 4px 10px;
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    border: 0.5px solid rgba(255,255,255,0.2);
    border-radius: 4px;
    white-space: nowrap;
    transition: all 0.15s;
}
.support-btn:hover { color: rgba(255,255,255,0.85); border-color: rgba(255,255,255,0.4); }
.logout-btn {
    font-size: 11px;
    color: rgba(255,255,255,0.35);
    padding: 4px 10px;
    border: 0.5px solid rgba(255,255,255,0.15);
    border-radius: 4px;
    transition: all 0.15s;
}
.logout-btn:hover { color: #fff; border-color: rgba(255,255,255,0.4); }

/* ===== MAIN ===== */
.portal-main { padding: 28px 0 48px; min-height: calc(100vh - 56px - 48px); }
.portal-container { max-width: 1280px; margin: 0 auto; padding: 0 24px; }

/* ===== PAGE HEADER ===== */
.page-header { margin-bottom: 20px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.page-header-left { flex: 1; }
.back-link { font-size: 12px; color: var(--text-muted); display: inline-block; margin-bottom: 8px; }
.back-link:hover { color: var(--gold); }
.page-title { font-size: 22px; font-weight: 600; color: var(--navy); letter-spacing: -0.02em; }
.page-title .mono { font-size: 18px; color: var(--text-muted); font-weight: 400; }
.page-sub { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.btn-export {
    display: inline-block;
    padding: 7px 16px;
    background: #1a6b2a;
    color: #fff;
    border-radius: 6px;
    font-size: 13px;
    text-decoration: none;
    white-space: nowrap;
    margin-left: auto;
}
.btn-export:hover { background: #155722; color: #fff; }

/* ===== KPI GRID ===== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}
.kpi-card {
    background: #fff;
    border: 0.5px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    text-decoration: none;
    transition: box-shadow 0.15s, border-color 0.15s;
    display: block;
}
.kpi-card:hover { border-color: var(--navy); box-shadow: 0 2px 12px rgba(15,31,61,0.08); }
.kpi-card.kpi-alert { border-color: var(--gold); background: #FFFBF0; }
.kpi-label { font-size: 10px; color: var(--text-light); letter-spacing: 0.04em; margin-bottom: 6px; }
.kpi-num { font-size: 26px; font-weight: 600; color: var(--navy); line-height: 1; }
.kpi-card.kpi-alert .kpi-num { color: var(--gold); }
.kpi-unit { font-size: 11px; color: var(--text-light); margin-top: 2px; }

/* ===== ALERT BANNER ===== */
.alert-banner {
    background: #FFFBF0;
    border: 0.5px solid var(--gold-light);
    border-radius: 8px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.alert-icon {
    width: 22px; height: 22px;
    border-radius: 50%;
    background: var(--gold);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.alert-body { flex: 1; font-size: 13px; color: var(--text-muted); }
.alert-body strong { color: var(--gold); font-size: 18px; font-weight: 600; }
.alert-link { color: var(--navy); font-weight: 500; margin-left: 8px; }
.confirm-all-btn {
    padding: 6px 14px;
    background: var(--navy);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
}

/* ===== CARDS ===== */
.dash-card {
    background: #fff;
    border: 0.5px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}
.dash-card.mt-16 { margin-top: 16px; }
.dash-card-head {
    padding: 12px 16px;
    border-bottom: 0.5px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.dash-card-title { font-size: 13px; font-weight: 500; color: var(--navy); }
.dash-card-more { font-size: 12px; color: var(--gold); }
.dash-card-more:hover { color: var(--navy); }
.dash-card-body { padding: 0; }
.dash-card-body.p-0 { padding: 0; }

.dash-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 0;
}

/* ===== NOTICES ===== */
.notice-item {
    padding: 10px 16px;
    border-bottom: 0.5px solid #F5F2EC;
}
.notice-item:last-child { border-bottom: none; }
.notice-meta { font-size: 11px; color: var(--text-light); margin-bottom: 3px; display: flex; align-items: center; gap: 8px; }
.badge-new { background: var(--gold); color: #fff; font-size: 9px; font-weight: 600; padding: 1px 6px; border-radius: 3px; }
.notice-body { font-size: 13px; color: var(--text); }
.empty-state { padding: 24px; text-align: center; color: var(--text-light); font-size: 13px; }

/* ===== TABLES ===== */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.record-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 13px;
}
.record-table th {
    padding: 8px 10px;
    background: var(--cream);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.04em;
    border-bottom: 0.5px solid var(--border);
    white-space: nowrap;
    text-align: center;
}
.record-table td {
    padding: 8px 10px;
    border-bottom: 0.5px solid #F5F2EC;
    color: var(--text);
    vertical-align: middle;
    overflow: visible;
    position: relative;
}
/* クリップが必要な列はtd内にこのdivを使う */
.clip-cell {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    cursor: help;
    position: relative;
}
.record-table tr:last-child td { border-bottom: none; }
.record-table tr.row-unconfirmed td { background: #FFFBF0; }
.record-table tr:hover td { background: #FAFAF8; }
.record-table tr.row-unconfirmed:hover td { background: #FFF7E0; }

.mini-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mini-table th { padding: 8px 12px; background: var(--cream); color: var(--text-muted); font-size: 11px; font-weight: 500; border-bottom: 0.5px solid var(--border); text-align: center; }
.mini-table td { padding: 8px 12px; border-bottom: 0.5px solid #F5F2EC; }
.mini-table tr:last-child td { border-bottom: none; }

/* ===== TABLE COLUMNS ===== */
.col-check { width: 32px; }
.col-no    { width: 64px; }
.col-date  { width: 100px; white-space: nowrap; }
.col-date-full { width: 80px; white-space: nowrap; }
.col-type  { width: 55px; }
.col-kasho { width: 90px; }
.col-img   { width: 38px; }
.record-table th.col-img,
.record-table td.col-img { font-size: 18px; }
.col-action{ width: 52px; padding-right: 10px; text-align: right; }
.col-park  { word-break: break-all; }
.cam-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px !important;
    padding: 2px;
    line-height: 1;
}
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--text-muted); }

/* ===== BADGES ===== */
.badge-type {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}
.badge-dispatch { background: #E3F0FF; color: #1565C0; }
.badge-tel      { background: #F0F0F0; color: #555; }
.badge-gray     { background: #F0F0F0; color: #777; }

.kasho-tag {
    display: inline-block;
    padding: 2px 7px;
    background: #F5F0E8;
    color: var(--navy);
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
}

/* ===== CHECK BUTTONS ===== */
.check-btn {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    border: 0.5px solid;
    font-family: inherit;
    transition: all 0.15s;
}
.check-btn.checked   { background: #E3F0FF; color: var(--blue); border-color: #90C0F0; }
.check-btn.unchecked { background: #FFF0EE; color: var(--red); border-color: #F5B8B3; }
.check-static { font-size: 11px; color: var(--text-light); }

/* ===== LINKS & BUTTONS ===== */
.park-link { color: var(--navy); font-weight: 500; }
.park-link:hover { color: var(--gold); }

.btn-detail {
    display: inline-block;
    padding: 4px 10px;
    background: var(--navy);
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 11px;
    white-space: nowrap;
    cursor: pointer;
    font-family: inherit;
    text-decoration: none;
}
.btn-detail:hover { background: var(--navy-mid); color: #fff; }

.btn-pdf {
    display: inline-block;
    padding: 4px 10px;
    background: #f0f0f0;
    color: var(--text);
    border-radius: 5px;
    font-size: 11px;
}
.btn-outline {
    display: inline-block;
    padding: 7px 16px;
    border: 0.5px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-muted);
}
.btn-outline:hover { border-color: var(--navy); color: var(--navy); }

/* ===== FILTER ===== */
.filter-bar { margin-bottom: 16px; }
.filter-form { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-group label { font-size: 11px; color: var(--text-muted); }
.filter-group input[type=date],
.filter-group input[type=text],
.filter-group select {
    padding: 7px 10px;
    border: 0.5px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text);
    background: #fff;
    height: 34px;
    box-sizing: border-box;
}
.filter-group input[type=text] { min-width: 140px; }
.filter-group input[type=text]:focus,
.filter-group input[type=date]:focus,
.filter-group select:focus {
    outline: none;
    border-color: var(--navy);
}
.filter-checks {
    display: flex;
    align-items: center;
    gap: 14px;
    height: 34px;
    padding: 0 4px;
}
.filter-check {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    user-select: none;
}
.filter-check input[type=checkbox] {
    margin: 0;
    cursor: pointer;
}
.filter-check-red span { color: #c00; font-weight: 600; }
.btn-filter {
    padding: 8px 18px;
    background: var(--navy);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
}
.btn-reset {
    padding: 8px 14px;
    color: var(--text-muted);
    font-size: 13px;
    border: 0.5px solid var(--border);
    border-radius: 6px;
}

.filter-tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.filter-tab {
    padding: 6px 16px;
    border-radius: 20px;
    border: 0.5px solid var(--border);
    font-size: 12px;
    color: var(--text-muted);
    background: #fff;
}
.filter-tab:hover { border-color: var(--navy); color: var(--navy); }
.filter-tab.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ===== PAGER ===== */
.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 20px;
}
.pager-btn {
    padding: 7px 18px;
    border: 0.5px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    color: var(--navy);
    background: #fff;
}
.pager-btn:hover { border-color: var(--navy); }
.pager-info { font-size: 12px; color: var(--text-muted); }

/* ===== DETAIL LAYOUT ===== */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 16px;
    align-items: start;
}
.detail-col-main { display: flex; flex-direction: column; gap: 12px; }
.detail-col-side  { display: flex; flex-direction: column; gap: 12px; }

.detail-section {
    background: #fff;
    border: 0.5px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    padding: 16px;
}
.detail-section-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 0.5px solid var(--border);
}

.detail-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.detail-table th {
    width: 120px;
    padding: 6px 0;
    color: var(--text-muted);
    font-weight: 400;
    vertical-align: top;
    padding-right: 12px;
    white-space: nowrap;
}
.detail-table td { padding: 6px 0; color: var(--text); border-bottom: 0.5px solid #F5F2EC; }
.detail-table tr:last-child td { border-bottom: none; }
.detail-table.mt-8 { margin-top: 8px; }

.park-name-badge {
    display: inline-block;
    padding: 6px 14px;
    background: var(--cream);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--navy);
}

.image-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.image-thumb-wrap { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.image-thumb img { width: 140px; height: 105px; object-fit: cover; border-radius: 6px; border: 0.5px solid var(--border); transition: opacity 0.15s; }
.image-thumb img:hover { opacity: 0.85; }
.image-caption { font-size: 11px; color: var(--text-muted); text-align: center; max-width: 140px; word-break: break-all; }

.pre-wrap { white-space: pre-wrap; line-height: 1.7; }
.alert-text-block {
    background: #FFF8ED;
    border-left: 3px solid var(--gold);
    padding: 10px 14px;
    border-radius: 0 6px 6px 0;
    font-size: 13px;
    line-height: 1.7;
}
.mb-8 { margin-bottom: 8px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mono { font-family: 'DM Mono', 'SF Mono', monospace; font-size: 12px; }

/* ===== FOOTER ===== */
.portal-footer { background: var(--navy); padding: 14px 24px; }
.footer-inner { max-width: 1280px; margin: 0 auto; text-align: center; }
.footer-inner span { font-size: 11px; color: rgba(255,255,255,0.25); }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .kpi-grid { grid-template-columns: repeat(3, 1fr); }
    .dash-cols { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .login-wrap { grid-template-columns: 1fr; }
    .login-left { display: none; }
}
@media (max-width: 640px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .header-nav { display: none; }
    .portal-container { padding: 0 16px; }
}

/* --- 済/未チェックボタン --- */
.check-btn {
    display: inline-block;
    width: 36px;
    padding: 3px 0;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, color 0.15s;
}
.check-btn.checked  { background: #1B5E20; color: #fff; }
.check-btn.unchecked { background: #f0f0f0; color: #999; }
.check-btn:disabled { opacity: 0.6; cursor: default; }

.check-static {
    display: inline-block;
    width: 36px;
    padding: 3px 0;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    text-align: center;
}
.check-static.checked  { background: #E8F5E9; color: #2E7D32; }
.check-static.unchecked { background: #f5f5f5; color: #bbb; }

.col-check { width: 44px; text-align: center; }

/* アラートバナー */
.alert-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid;
    margin-bottom: 16px;
}
.alert-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: bold;
    flex-shrink: 0;
}
.alert-body { font-size: 13px; }
