:root {
  --bg0: #1a1410;
  --bg1: #241c16;
  --bg2: #2f241c;
  --panel: #fffaf4;
  --panel-2: #f3ebe1;
  --ink: #1f1712;
  --muted: #6b5b4e;
  --line: #e4d7c8;
  --accent: #c45c26;
  --accent-2: #2f6b4f;
  --ok: #1f6b45;
  --warn: #9a5b12;
  --danger: #a33a2c;
  --shadow: 0 12px 40px rgba(26, 20, 16, 0.12);
  --radius: 14px;
  --font: "Zen Kaku Gothic New", sans-serif;
  --display: "Zen Old Mincho", serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(196, 92, 38, 0.18), transparent 60%),
    radial-gradient(900px 400px at 100% 0%, rgba(47, 107, 79, 0.14), transparent 55%),
    linear-gradient(180deg, #f7f1ea 0%, #efe6db 100%);
  min-height: 100vh;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.9rem 1.5rem;
  background: linear-gradient(90deg, var(--bg0), var(--bg2));
  color: #f8f0e8;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 0.75rem; min-width: 180px; }
.brand a { color: inherit; text-decoration: none; }
.brand-mark {
  font-family: var(--display);
  font-size: 1.35rem;
  letter-spacing: 0.04em;
  padding: 0.25rem 0.55rem;
  border: 1px solid rgba(248, 240, 232, 0.35);
}
.brand-name { font-weight: 700; letter-spacing: 0.08em; }
.brand-sub { font-size: 0.75rem; opacity: 0.7; }

.nav { display: flex; flex-wrap: wrap; gap: 0.35rem; flex: 1; }
.nav a {
  color: rgba(248, 240, 232, 0.82);
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.92rem;
}
.nav a:hover, .nav a.is-active {
  background: rgba(248, 240, 232, 0.12);
  color: #fff;
}
.userbox { display: flex; align-items: center; gap: 0.75rem; font-size: 0.9rem; }

.wrap { width: min(1120px, calc(100% - 2rem)); margin: 1.5rem auto 3rem; }
.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 1.5rem;
}

h1, h2, h3 { font-family: var(--display); font-weight: 600; margin: 0 0 0.75rem; }
h1 { font-size: 1.8rem; letter-spacing: 0.04em; }
.lead { color: var(--muted); margin: 0 0 1.25rem; line-height: 1.6; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.toolbar .actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.55rem 1rem;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  background: var(--accent);
  color: #fff;
}
.btn:hover { filter: brightness(1.05); text-decoration: none; }
.btn-secondary { background: var(--bg2); color: #fff; }
.btn-ghost {
  background: transparent;
  border-color: rgba(248, 240, 232, 0.35);
  color: #f8f0e8;
}
.btn-outline {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}
.btn-danger { background: var(--danger); }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.85rem; }

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}
@media (max-width: 800px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .site-header { flex-wrap: wrap; }
  .userbox { width: 100%; justify-content: space-between; }
}

label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.3rem; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=date],
select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  font: inherit;
  background: #fff;
  color: var(--ink);
}
textarea { min-height: 100px; resize: vertical; }
.field { margin-bottom: 0.9rem; }
.hint { font-size: 0.8rem; color: var(--muted); margin-top: 0.25rem; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
table.data th, table.data td {
  border-bottom: 1px solid var(--line);
  padding: 0.7rem 0.55rem;
  text-align: left;
  vertical-align: top;
}
table.data th {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
  background: var(--panel-2);
}
table.data tr:hover td { background: rgba(47, 107, 79, 0.04); }

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: var(--panel-2);
  color: var(--muted);
}
.badge-ok { background: #e5f4eb; color: var(--ok); }
.badge-warn { background: #fff1d9; color: var(--warn); }
.badge-off { background: #eee; color: #777; }

.flash {
  padding: 0.85rem 1rem;
  border-radius: 12px;
  margin-bottom: 1rem;
  border: 1px solid var(--line);
}
.flash-ok { background: #e8f6ee; border-color: #b9dfc8; }
.flash-error { background: #fceceb; border-color: #efc4be; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}
.card-stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow);
}
.card-stat .num {
  font-family: var(--display);
  font-size: 2rem;
  line-height: 1.1;
}
.card-stat .lbl { color: var(--muted); margin-top: 0.35rem; }

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    linear-gradient(160deg, rgba(26,20,16,0.88), rgba(47,36,28,0.75)),
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23c45c26' fill-opacity='0.08'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.login-box {
  width: min(420px, 100%);
  background: var(--panel);
  border-radius: 18px;
  padding: 2rem 1.75rem;
  box-shadow: var(--shadow);
}
.login-box .brand-line {
  font-family: var(--display);
  font-size: 1.6rem;
  margin-bottom: 0.25rem;
}
.step-block {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}
.step-block img {
  width: 160px;
  height: 120px;
  object-fit: cover;
  border-radius: 10px;
  background: var(--panel-2);
}
@media (max-width: 640px) {
  .step-block { grid-template-columns: 1fr; }
  .step-block img { width: 100%; height: 180px; }
}
.empty {
  text-align: center;
  color: var(--muted);
  padding: 2rem 1rem;
}
.muted { color: var(--muted); }
.mono { font-variant-numeric: tabular-nums; }
