:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --border: #d9dee3;
  --text: #1f2937;
  --muted: #6b7280;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --danger: #dc2626;
  --warn-bg: #fff7ed;
  --warn-border: #fdba74;
  --ok: #16a34a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
}

header.app-header {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 10;
}
header.app-header h1 { font-size: 17px; margin: 0; }
header.app-header nav { display: flex; gap: 14px; flex-wrap: wrap; }
header.app-header nav a { color: var(--muted); text-decoration: none; font-size: 14px; padding: 4px 8px; border-radius: 6px; }
header.app-header nav a.active, header.app-header nav a:hover { color: var(--accent); background: #eef2ff; }

main { max-width: 1100px; margin: 20px auto; padding: 0 16px 60px; }

.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 18px 20px; margin-bottom: 18px; }
.panel h2 { margin-top: 0; font-size: 16px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 13px; }
tr:hover td { background: #fafbfc; }

button, .btn {
  font-family: inherit;
  font-size: 14px;
  padding: 7px 14px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover, .btn.primary:hover { background: var(--accent-dark); }
button.danger { color: var(--danger); border-color: #fecaca; }
button.danger:hover { background: #fef2f2; }
button:disabled { opacity: .5; cursor: not-allowed; }

input, select, textarea {
  font-family: inherit;
  font-size: 14px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
}
label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 4px; }
.field { margin-bottom: 12px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > .field { flex: 1; min-width: 140px; }

.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.tag.proper { background: #e0f2fe; color: #0369a1; }
.tag.outlet { background: #fef3c7; color: #92400e; }

.warn { background: var(--warn-bg); border: 1px solid var(--warn-border); color: #9a3412; padding: 8px 12px; border-radius: 8px; font-size: 13px; margin: 8px 0; }
.ok-text { color: var(--ok); }
.danger-text { color: var(--danger); }
.muted { color: var(--muted); }

.toast { position: fixed; bottom: 20px; right: 20px; background: #111827; color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 13px; opacity: 0; transform: translateY(10px); transition: all .2s; pointer-events: none; z-index: 100; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--danger); }

.search-result { border: 1px solid var(--border); border-radius: 8px; max-height: 240px; overflow-y: auto; margin-top: 6px; }
.search-result .item { padding: 8px 10px; border-bottom: 1px solid var(--border); cursor: pointer; }
.search-result .item:hover { background: #eef2ff; }
.search-result .item:last-child { border-bottom: none; }

.empty { color: var(--muted); text-align: center; padding: 30px; }
