:root {
    --bg: #f4f7fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --text: #172033;
    --muted: #697386;
    --line: #dfe5ee;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --danger: #b42318;
    --success: #147d64;
    --warning: #b45309;
    --radius: 16px;
    --shadow: 0 12px 34px rgba(31, 46, 80, 0.08);
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif;
    line-height: 1.65;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea, select { font: inherit; }
button, .btn { -webkit-tap-highlight-color: transparent; }

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 68px;
    padding: 0 5vw;
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(10px);
    color: #fff;
}
.brand { color: #fff; font-size: 1.25rem; font-weight: 800; letter-spacing: .02em; }
.brand:hover { text-decoration: none; }
.main-nav { display: flex; align-items: center; gap: 18px; }
.main-nav a { color: #dbeafe; font-size: .94rem; }
.nav-user { padding-left: 18px; border-left: 1px solid rgba(255,255,255,.2); color: #fff; font-weight: 700; }

.container { width: min(1180px, calc(100% - 32px)); margin: 36px auto 72px; }
.site-footer { padding: 28px; text-align: center; color: var(--muted); font-size: .85rem; }

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(1.75rem, 4vw, 2.5rem); line-height: 1.2; }
h2 { font-size: 1.1rem; }
.muted { color: var(--muted); }
.eyebrow { margin-bottom: 8px; color: var(--primary); font-size: .78rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.required { color: var(--danger); font-size: .78rem; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.panel, .filter-panel, .auth-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.panel { padding: 24px; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
    text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: #fff; border-color: var(--line); color: var(--text); }
.btn-secondary:hover { background: var(--surface-soft); }

.alert { margin-bottom: 20px; padding: 13px 16px; border-radius: 10px; font-weight: 700; }
.alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

.auth-wrap { display: grid; place-items: center; min-height: calc(100vh - 180px); }
.auth-card { width: min(520px, 100%); padding: 34px; }
.form-stack { display: grid; gap: 16px; }
label { display: grid; gap: 7px; font-weight: 700; }
input, textarea, select {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    background: #fff;
    color: var(--text);
    outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
textarea { resize: vertical; }
label small { color: var(--muted); font-weight: 400; }
.demo-box { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.demo-account { display: grid; gap: 8px; padding: 14px 0; }
.demo-account + .demo-account { border-top: 1px dashed var(--line); }
.demo-account code { overflow-wrap: anywhere; color: var(--muted); }

.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.stats-five { grid-template-columns: repeat(5, 1fr); }
.stats-four { grid-template-columns: repeat(4, 1fr); }
.stat-card { padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.stat-card span { color: var(--muted); font-size: .9rem; }
.stat-card strong { display: block; margin-top: 4px; font-size: 2rem; }

.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.section-head h2 { margin: 0; }
.issue-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.issue-card { display: block; padding: 18px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); }
.issue-card:hover { border-color: #93c5fd; background: #f8fbff; text-decoration: none; }
.issue-card-top { display: flex; justify-content: space-between; gap: 10px; }
.issue-card h3 { margin: 12px 0 6px; font-size: 1rem; }
.issue-card p, .issue-card small { color: var(--muted); }

.badge { display: inline-flex; align-items: center; width: fit-content; padding: 3px 9px; border-radius: 999px; background: #eef2f7; color: #475569; font-size: .78rem; font-weight: 800; }
.badge.large { padding: 7px 13px; font-size: .9rem; }
.status-new { background: #f1f5f9; color: #475569; }
.status-investigating { background: #eff6ff; color: #1d4ed8; }
.status-working { background: #fff7ed; color: #c2410c; }
.status-verifying { background: #faf5ff; color: #7e22ce; }
.status-resolved { background: #ecfdf5; color: #047857; }

.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.field-span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; }
.filter-panel { display: grid; grid-template-columns: repeat(5, minmax(130px, 1fr)); gap: 10px; margin-bottom: 20px; padding: 16px; }
.filter-panel input:first-child { grid-column: span 2; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 13px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: var(--surface-soft); color: #475569; font-size: .82rem; white-space: nowrap; }
td { font-size: .92rem; }
.empty { padding: 24px; text-align: center; color: var(--muted); }

.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.meta-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 24px; }
.meta-grid > div { padding: 13px; background: var(--surface-soft); border-radius: 10px; }
.meta-grid span { display: block; color: var(--muted); font-size: .78rem; }
.meta-grid strong { display: block; margin-top: 3px; }
.detail-section { padding-top: 22px; margin-top: 22px; border-top: 1px solid var(--line); }

/* 一般社員向け：IT担当者の対応結果を問い合わせ本文と明確に区別 */
.resolution-card {
    margin-top: 28px;
    padding: 22px;
    border: 1px solid #bbf7d0;
    border-left: 5px solid #16a34a;
    border-radius: 14px;
    background: #f0fdf4;
}
.resolution-card-head { display: flex; align-items: flex-start; gap: 14px; }
.resolution-icon {
    display: grid;
    place-items: center;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #16a34a;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 900;
}
.resolution-eyebrow { margin: 0 0 2px; color: #15803d; font-size: .78rem; font-weight: 800; }
.resolution-card h2 { margin: 0; font-size: 1.2rem; }
.resolution-status { margin: 6px 0 0; color: #166534; font-size: .9rem; font-weight: 700; }
.resolution-body { display: grid; gap: 14px; margin-top: 18px; }
.resolution-block { padding: 16px; border: 1px solid #dcfce7; border-radius: 10px; background: #fff; }
.resolution-block h3 { margin: 0 0 8px; color: #166534; font-size: .95rem; }
.resolution-verification { background: #f7fff9; }
.pre-line { white-space: pre-wrap; overflow-wrap: anywhere; }
.attachments { display: flex; flex-wrap: wrap; gap: 12px; }
.attachments a { width: 180px; color: var(--text); }
.attachments img { display: block; width: 180px; height: 120px; object-fit: cover; margin-bottom: 6px; border: 1px solid var(--line); border-radius: 10px; }
.timeline { display: grid; gap: 12px; }
.timeline-item { padding: 14px; background: var(--surface-soft); border-radius: 10px; }
.timeline-item.internal { border-left: 4px solid #7e22ce; background: #faf5ff; }
.timeline-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.timeline-head small { margin-left: auto; color: var(--muted); }
.comment-form { display: grid; gap: 10px; margin-top: 16px; }
.check { display: flex; grid-template-columns: auto 1fr; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: auto; }
.staff-panel { position: sticky; top: 88px; }
.history { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.history-item { padding: 11px 0; border-bottom: 1px dashed var(--line); }
.history-item small { color: var(--muted); }
.history-item p { margin: 3px 0 0; font-size: .9rem; }

@media (max-width: 900px) {
    .site-header { position: static; align-items: flex-start; flex-direction: column; gap: 12px; padding-top: 16px; padding-bottom: 16px; }
    .main-nav { width: 100%; overflow-x: auto; padding-bottom: 3px; }
    .nav-user { display: none; }
    .stats-five { grid-template-columns: repeat(3, 1fr); }
    .stats-four { grid-template-columns: repeat(2, 1fr); }
    .issue-cards { grid-template-columns: repeat(2, 1fr); }
    .filter-panel { grid-template-columns: repeat(2, 1fr); }
    .filter-panel input:first-child { grid-column: 1 / -1; }
    .detail-grid { grid-template-columns: 1fr; }
    .staff-panel { position: static; }
}

@media (max-width: 640px) {
    .container { width: min(100% - 20px, 1180px); margin-top: 22px; }
    .page-head { flex-direction: column; }
    .page-head .btn { width: 100%; }
    .panel, .auth-card { padding: 18px; }
    .stats-grid, .stats-five, .stats-four { grid-template-columns: repeat(2, 1fr); }
    .issue-cards, .form-grid, .filter-panel, .meta-grid { grid-template-columns: 1fr; }
    .field-span-2, .filter-panel input:first-child { grid-column: 1; }
    .form-actions { flex-direction: column; }
    .main-nav { gap: 14px; }
    .timeline-head small { width: 100%; margin-left: 0; }

    /* スマートフォンでは一覧表をカード表示 */
    .table-wrap table, .table-wrap thead, .table-wrap tbody, .table-wrap tr, .table-wrap th, .table-wrap td { display: block; min-width: 0; }
    .table-wrap thead { display: none; }
    .table-wrap tr { margin-bottom: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
    .table-wrap td { padding: 6px 0; border: 0; }
}

/* Search form labels */
.filter-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.filter-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: #475569;
}
.filter-field input {
    width: 100%;
}

/* 問い合わせ編集 */
.page-head-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.edit-note {
    padding: 12px 14px;
    border-radius: 10px;
    background: #f8fafc;
    color: #64748b;
    font-size: 0.9rem;
}

@media (max-width: 640px) {
    .page-head-actions {
        width: 100%;
        justify-content: flex-start;
    }
}
