:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #162033;
  --muted: #64748b;
  --line: #d9e2ef;
  --navy: #0f172a;
  --blue: #2563eb;
  --teal: #0f766e;
  --red: #dc2626;
  --amber: #d97706;
  --soft-blue: #eff6ff;
  --soft-teal: #ecfdf5;
  --soft-red: #fef2f2;
  --soft-amber: #fffbeb;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Noto Sans JP", Arial, sans-serif;
  line-height: 1.55;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  background: var(--navy);
}

.login-visual {
  position: relative;
  overflow: hidden;
  padding: 56px;
  color: white;
  background:
    linear-gradient(rgba(15, 23, 42, .35), rgba(15, 23, 42, .92)),
    url("https://images.unsplash.com/photo-1581092921461-eab62e97a780?auto=format&fit=crop&w=1400&q=80") center/cover;
}

.login-visual h1 {
  margin: 0;
  max-width: 620px;
  font-size: 42px;
  line-height: 1.18;
  letter-spacing: 0;
}

.login-visual p {
  max-width: 620px;
  color: #dbeafe;
  font-size: 16px;
}

.login-card-wrap {
  display: grid;
  place-items: center;
  padding: 28px;
  background: #f8fafc;
}

.login-card {
  width: min(420px, 100%);
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .18);
}

.login-card h2 { margin: 0 0 6px; font-size: 24px; }
.login-card p { margin: 0 0 22px; color: var(--muted); }

.form-field { margin-bottom: 16px; }
.form-field label {
  display: block;
  margin-bottom: 6px;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
}

.form-field input, .form-field select, .form-field textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: white;
  padding: 9px 11px;
  color: var(--ink);
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  width: 100%;
  border: 1px solid var(--blue);
  border-radius: 8px;
  background: var(--blue);
  color: white;
  font-weight: 800;
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--navy);
  color: white;
  padding: 18px 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 20px;
  border-bottom: 1px solid rgba(255,255,255,.12);
  margin-bottom: 16px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, #2563eb, #0f766e);
}

.brand small {
  display: block;
  color: #cbd5e1;
  font-size: 12px;
  margin-top: 2px;
}

.sidebar nav { display: grid; gap: 5px; }
.sidebar nav a, .logout {
  display: block;
  min-height: 38px;
  padding: 9px 11px;
  border-radius: 8px;
  color: #cbd5e1;
  font-size: 14px;
}

.sidebar nav a.active {
  background: var(--blue);
  color: white;
  font-weight: 800;
}

.logout {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 16px;
  background: rgba(255,255,255,.08);
}

.main {
  padding: 24px;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1 { margin: 0; font-size: 26px; line-height: 1.25; letter-spacing: 0; }
h2 { margin: 0 0 12px; font-size: 18px; letter-spacing: 0; }

.top-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.top-actions button, .secondary-button {
  min-height: 36px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: white;
  padding: 7px 11px;
  color: #334155;
  font-weight: 700;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 12px;
  margin-bottom: 12px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.panel, .metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .04);
}

.panel { padding: 16px; }
.metric { padding: 15px; }
.metric span { display: block; color: var(--muted); font-size: 13px; }
.metric strong { display: block; margin-top: 5px; font-size: 24px; }
.danger-text { color: var(--red); }

table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
}

th, td {
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

th {
  background: #f8fafc;
  color: #334155;
  font-size: 13px;
}

tr:last-child td { border-bottom: 0; }

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.badge.success { color: #047857; background: var(--soft-teal); }
.badge.danger { color: #b91c1c; background: var(--soft-red); }
.badge.info { color: #1d4ed8; background: var(--soft-blue); }
.badge.neutral { color: #475569; background: #f1f5f9; }

.bars {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
  align-items: end;
  height: 150px;
  margin-top: 16px;
}

.bar {
  min-height: 22px;
  border-radius: 6px 6px 0 0;
  background: var(--blue);
}

.detail-list {
  display: grid;
  gap: 10px;
}

.detail-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfdff;
}

.detail-row span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.thumbnail {
  width: 62px;
  height: 40px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, .75), rgba(15, 118, 110, .75)),
    repeating-linear-gradient(45deg, #e2e8f0 0 8px, #cbd5e1 8px 16px);
}

.event-preview {
  width: 100%;
  height: 170px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, .58), rgba(15, 118, 110, .70)),
    repeating-linear-gradient(45deg, #e2e8f0 0 10px, #cbd5e1 10px 20px);
  margin-bottom: 12px;
}

.status-line {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 800;
}

.status-line::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #22c55e;
}

.status-line.warn::before { background: var(--amber); }

@media (max-width: 920px) {
  .login-page, .app-shell, .grid-2, .settings-grid { grid-template-columns: 1fr; }
  .login-visual { min-height: 360px; padding: 34px; }
  .sidebar { position: static; height: auto; }
  .sidebar nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .logout { position: static; margin-top: 12px; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* --- v1.1 追加: フラッシュメッセージ / 補助 --- */
.flash {
  border-radius: 8px;
  padding: 11px 14px;
  margin-bottom: 14px;
  font-size: 14px;
  font-weight: 700;
  border: 1px solid var(--line);
}
.flash-success { color: #047857; background: var(--soft-teal); border-color: #99f6e4; }
.flash-danger  { color: #b91c1c; background: var(--soft-red);  border-color: #fecaca; }
.flash-info    { color: #1d4ed8; background: var(--soft-blue); border-color: #bfdbfe; }

.login-error {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--soft-red);
  color: #b91c1c;
  font-size: 13px;
  font-weight: 700;
}
.inline-form { display: inline; }
.muted { color: var(--muted); font-size: 13px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
