:root {
  --bg: #f4efe8;
  --ink: #1f252f;
  --muted: #637084;
  --card: #ffffff;
  --line: #d8e1ec;
  --accent: #0d8ecf;
  --accent-ink: #ffffff;
  --warn: #bb3f28;
  --ok: #167a3f;
  --radius: 16px;
  --shadow: 0 16px 40px rgba(15, 26, 45, 0.08);
  --maxw: 1160px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'IBM Plex Sans', 'Trebuchet MS', sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 10% 20%, #ffe6d5 0%, transparent 36%),
    radial-gradient(circle at 90% 80%, #c5ebff 0%, transparent 40%),
    var(--bg);
  min-height: 100vh;
}

.background-orb {
  position: fixed;
  width: 380px;
  height: 380px;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.25;
  z-index: 0;
  pointer-events: none;
}

.background-orb-a {
  top: -140px;
  left: -100px;
  background: #ff9f66;
}

.background-orb-b {
  right: -130px;
  bottom: -130px;
  background: #4ca8ff;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(8px);
  background: rgba(244, 239, 232, 0.86);
  border-bottom: 1px solid rgba(31, 37, 47, 0.08);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.brand {
  font-weight: 700;
  font-size: 1.03rem;
  cursor: pointer;
  letter-spacing: 0.02em;
}

.top-nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.nav-link {
  color: var(--ink);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.nav-link:hover,
.nav-link.active {
  border-color: var(--line);
  background: #fff;
}

.app-shell {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 20px 16px 56px;
  position: relative;
  z-index: 1;
}

.page-head {
  margin-bottom: 14px;
}

.page-head h1 {
  margin: 0;
  font-size: 1.45rem;
}

.page-head p {
  margin: 8px 0 0;
  color: var(--muted);
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}

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

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

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
  color: #2d3b4f;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #b9c7d8;
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
}

textarea {
  min-height: 94px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(13, 142, 207, 0.26);
  border-color: var(--accent);
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: #2d3b4f;
}

.checkbox-row input[type='checkbox'] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

button.primary,
.button.primary {
  background: var(--accent);
  color: var(--accent-ink);
}

button.secondary,
.button.secondary {
  background: #f0f5fb;
  color: #11395f;
  border: 1px solid #c4daef;
}

button.danger,
.button.danger {
  background: #ffe7e3;
  color: #7f2012;
  border: 1px solid #ffc3bb;
}

button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.org-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}

.org-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: #fff;
}

.org-card h3 {
  margin: 0 0 8px;
  font-size: 1.03rem;
}

.org-card p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.org-logo {
  width: 76px;
  height: 76px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: #f4f6f8;
}

.kv {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 6px 10px;
  font-size: 0.92rem;
}

.kv div:nth-child(odd) {
  color: var(--muted);
}

.table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 10px;
  font-size: 0.88rem;
  vertical-align: top;
}

th {
  background: #f6f9fc;
  color: #31445d;
  font-weight: 600;
}

.badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.78rem;
  border: 1px solid transparent;
}

.badge.ok {
  background: #e7f8ec;
  color: #106d35;
  border-color: #b5e4c5;
}

.badge.warn {
  background: #fff1d7;
  color: #916000;
  border-color: #f0d69b;
}

.badge.off {
  background: #f4f4f4;
  color: #666;
  border-color: #ddd;
}

.notice {
  border-left: 4px solid var(--accent);
  background: #eef8ff;
  padding: 10px 12px;
  border-radius: 8px;
  color: #184769;
}

.error {
  border-left-color: var(--warn);
  background: #fff0ed;
  color: #7c2110;
}

.success {
  border-left-color: var(--ok);
  background: #edf9f1;
  color: #146838;
}

.meta {
  color: var(--muted);
  font-size: 0.86rem;
}

.inline-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.inline-links a {
  color: #045e90;
}

.qr-box {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.qr-box img {
  width: 140px;
  height: 140px;
  border-radius: 12px;
  border: 1px solid var(--line);
}

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

.fade-in {
  animation: fadeInMove 0.36s ease-out both;
}

@keyframes fadeInMove {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 920px) {
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }

  .kv {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .page-head h1 {
    font-size: 1.25rem;
  }
}
