:root {
    color-scheme: light;
    --bg: #f4f7fb;
    --surface: #ffffff;
    --surface-2: #eef3f9;
    --text: #162033;
    --muted: #667085;
    --line: #dce3ed;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --danger: #b42318;
    --warning: #b54708;
    --success: #067647;
    --shadow: 0 8px 28px rgba(22, 32, 51, .08);
    font-family: "Noto Sans JP", "Yu Gothic UI", "Yu Gothic", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 15px; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }

.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 24px;
    min-height: 64px; padding: 10px max(18px, calc((100vw - 1240px) / 2));
    background: #12213a; color: #fff; box-shadow: var(--shadow);
}
.brand { font-size: 18px; font-weight: 800; color: #fff; white-space: nowrap; }
.topbar nav { display: flex; flex: 1; gap: 8px; }
.topbar nav a { color: #dbe7ff; padding: 8px 10px; border-radius: 8px; }
.topbar nav a:hover { background: rgba(255,255,255,.1); text-decoration: none; }
.account { display: flex; align-items: center; gap: 10px; font-size: 13px; }

.container { max-width: 1240px; margin: 0 auto; padding: 28px 20px 60px; }
.page-title { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-title h1 { margin: 0; font-size: 26px; }
.page-title p { margin: 5px 0 0; color: var(--muted); }

.cards { display: grid; grid-template-columns: repeat(6, minmax(130px, 1fr)); gap: 12px; margin-bottom: 22px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; box-shadow: var(--shadow); }
.metric-label { color: var(--muted); font-size: 13px; }
.metric-value { margin-top: 6px; font-size: 28px; font-weight: 800; }
.metric-value.danger { color: var(--danger); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); margin-bottom: 20px; overflow: hidden; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.panel-header h2 { margin: 0; font-size: 17px; }
.panel-body { padding: 18px; }

.filters, .form-grid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 14px; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-4 { grid-column: 1 / -1; }
label { display: block; color: #344054; font-weight: 700; font-size: 13px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=datetime-local], input[type=number], select, textarea {
    width: 100%; margin-top: 6px; border: 1px solid #cdd6e3; border-radius: 9px; background: #fff; color: var(--text); padding: 10px 11px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
textarea { min-height: 120px; resize: vertical; }
.check-list { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 9px; }
.check-list label { display: flex; align-items: center; gap: 6px; font-weight: 500; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent; border-radius: 9px; padding: 9px 14px; 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; color: #344054; border-color: var(--line); }
.btn-danger { background: #fff4f2; color: var(--danger); border-color: #fecdca; }
.btn-small { padding: 6px 10px; font-size: 13px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 13px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: #475467; font-size: 12px; background: #f8fafc; white-space: nowrap; }
tbody tr:hover { background: #f8fbff; }
.task-title { color: var(--text); font-weight: 700; }
.subtext { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }

.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 9px; font-size: 12px; font-weight: 700; background: #eef2f6; color: #344054; white-space: nowrap; }
.status-in_progress { background: #eff8ff; color: #175cd3; }
.status-waiting_review { background: #fffaeb; color: #b54708; }
.status-completed { background: #ecfdf3; color: #067647; }
.status-on_hold { background: #f2f4f7; color: #475467; }
.priority-urgent { background: #fef3f2; color: #b42318; }
.priority-high { background: #fff6ed; color: #c4320a; }
.overdue { color: var(--danger); font-weight: 800; }
.progress { width: 120px; height: 8px; border-radius: 999px; overflow: hidden; background: #e5eaf1; margin-top: 6px; }
.progress > span { display: block; height: 100%; background: var(--primary); }

.flash { margin-bottom: 18px; padding: 13px 15px; border-radius: 10px; border: 1px solid; }
.flash-success { background: #ecfdf3; border-color: #abefc6; color: #067647; }
.flash-error { background: #fef3f2; border-color: #fecdca; color: #b42318; }

.detail-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 20px; }
.definition { display: grid; grid-template-columns: 130px 1fr; gap: 10px 18px; margin: 0; }
.definition dt { color: var(--muted); font-weight: 700; }
.definition dd { margin: 0; }
.comment { padding: 14px 0; border-bottom: 1px solid var(--line); }
.comment:last-child { border-bottom: 0; }
.comment-head { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-bottom: 7px; }
.comment-body { white-space: pre-wrap; line-height: 1.7; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 10px 0; border-bottom: 1px solid var(--line); }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(135deg, #eff6ff, #f8fafc 55%, #eef2ff); }
.login-card { width: min(420px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 34px; box-shadow: var(--shadow); }
.login-card h1 { margin: 0 0 8px; }
.login-card p { margin: 0 0 24px; color: var(--muted); }
.login-card label { margin-bottom: 16px; }
.empty { padding: 36px; text-align: center; color: var(--muted); }

@media (max-width: 900px) {
    .cards { grid-template-columns: repeat(3, 1fr); }
    .filters, .form-grid { grid-template-columns: repeat(2, 1fr); }
    .form-grid .span-4 { grid-column: 1 / -1; }
    .detail-grid { grid-template-columns: 1fr; }
    .topbar { flex-wrap: wrap; gap: 8px; }
    .topbar nav { order: 3; flex-basis: 100%; overflow-x: auto; }
}

@media (max-width: 560px) {
    .container { padding: 20px 12px 50px; }
    .cards { grid-template-columns: repeat(2, 1fr); }
    .filters, .form-grid { grid-template-columns: 1fr; }
    .form-grid .span-2, .form-grid .span-4 { grid-column: auto; }
    .page-title { align-items: flex-start; flex-direction: column; }
    .account span { display: none; }
    .definition { grid-template-columns: 1fr; gap: 4px; }
}

