:root {
  --bg: #f2f5f8;
  --panel: #ffffff;
  --text: #17212b;
  --muted: #5d6873;
  --line: #d6dee6;
  --accent: #0f6bc8;
  --danger: #be123c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background: radial-gradient(circle at 0% 0%, #f8fbff 0%, var(--bg) 45%, #eaf0f5 100%);
  font-family: "Segoe UI", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
}

body.has-sidebar {
  padding-left: 280px;
}

body.has-sidebar .app-header,
body.has-sidebar .layout,
body.has-sidebar .single-layout,
body.has-sidebar .footer {
  max-width: none;
  margin-left: 0;
  margin-right: 0;
  padding-left: 32px;
  padding-right: 32px;
}

.side-nav {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(243, 248, 253, 0.98) 100%),
    radial-gradient(circle at top left, rgba(15, 107, 200, 0.12), transparent 42%);
  backdrop-filter: blur(10px);
  z-index: 20;
}

.side-nav-inner {
  display: flex;
  flex-direction: column;
  gap: 18px;
  height: 100%;
  padding: 24px 18px;
  overflow-y: auto;
}

.side-nav-brand h2 {
  margin: 6px 0 0;
  font-size: 24px;
}

.side-nav-kicker {
  margin: 0;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.side-user-card {
  border: 1px solid #d8e4ef;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  padding: 14px;
  box-shadow: 0 10px 24px rgba(18, 34, 53, 0.06);
}

.side-user-name {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.side-user-email {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  word-break: break-word;
}

.side-user-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0;
}

.side-user-card button {
  width: 100%;
}

.side-menu {
  display: grid;
  gap: 8px;
}

.side-menu a {
  display: block;
  border: 1px solid #c9d9ea;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.8);
  color: #1a3e68;
  text-decoration: none;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 600;
}

.side-menu a.active {
  border-color: #0f63b6;
  background: linear-gradient(180deg, #1574d6 0%, #0f63b6 100%);
  color: #fff;
}

.app-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 14px;
}

.kicker {
  margin: 0;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 12px;
}

h1 {
  margin: 8px 0;
  font-size: clamp(28px, 3.6vw, 40px);
}

.lead {
  margin: 0;
  color: var(--muted);
}

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

.layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 8px 20px 24px;
  display: grid;
  gap: 14px;
}

.single-layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 8px 20px 24px;
}

.top-nav {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.top-nav a {
  display: inline-block;
  border: 1px solid #a8bdd6;
  background: #f4f9ff;
  color: #1b4a82;
  border-radius: 999px;
  font-size: 13px;
  text-decoration: none;
  padding: 6px 12px;
}

.top-nav a.active {
  background: #0f63b6;
  color: #fff;
  border-color: #0f63b6;
}

.menu-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.menu-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 14px;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 4px 12px rgba(16, 24, 40, 0.05);
}

.menu-card h3 {
  margin: 0 0 6px;
  font-size: 18px;
}

.menu-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.admin-menu-card {
  border-color: #bfd7f2;
  background: linear-gradient(180deg, #f8fbff 0%, #eef5fd 100%);
}

.dfd-panel {
  overflow: hidden;
}

.dfd-board {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fcfdff;
  padding: 8px;
  overflow-x: auto;
}

.dfd-svg {
  width: 100%;
  min-width: 1120px;
  height: auto;
  display: block;
}

.dfd-line {
  stroke: #4f647b;
  stroke-width: 1.5;
  fill: none;
  marker-end: url(#dfd-arrow);
}

.dfd-label {
  fill: #415266;
  font-size: 12px;
  font-family: "Segoe UI", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
}

.dfd-process {
  stroke: #2d3b4f;
  stroke-width: 1.6;
  fill: #ffffff;
}

.dfd-entity,
.dfd-store {
  stroke: #2d3b4f;
  stroke-width: 1.4;
  fill: #ffffff;
}

.dfd-node-link {
  cursor: pointer;
}

.dfd-node-link .dfd-store {
  transition: fill 0.16s ease, stroke 0.16s ease;
}

.dfd-node-link .dfd-text {
  transition: fill 0.16s ease;
}

.dfd-node-link:hover .dfd-store,
.dfd-node-link:focus .dfd-store,
.dfd-node-link:focus-visible .dfd-store {
  fill: #eef6ff;
  stroke: #0f63b6;
  stroke-width: 1.8;
}

.dfd-node-link:hover .dfd-text,
.dfd-node-link:focus .dfd-text,
.dfd-node-link:focus-visible .dfd-text {
  fill: #0c3d73;
}

.dfd-text {
  fill: #152335;
  font-size: 14px;
  font-family: "Segoe UI", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
}

.dfd-process-text {
  font-weight: 600;
}

.dfd-entity-text,
.dfd-store-text {
  font-size: 13px;
}

.site-cards {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.site-card {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  padding: 12px;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(16, 24, 40, 0.04);
}

.site-card:hover {
  border-color: #7fb0e0;
  background: #f8fbff;
}

.site-card-id {
  margin: 0 0 4px;
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
}

.site-card-name {
  margin: 0;
  font-size: 15px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 6px 16px rgba(18, 34, 53, 0.05);
}

.panel h2 {
  margin: 2px 0 2px;
  font-size: 19px;
}

.desc {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 14px;
}

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

.inline-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin: 8px 0;
}

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

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

textarea {
  resize: vertical;
}

button,
.file-label {
  border: 1px solid #1f5eaa;
  color: #fff;
  background: linear-gradient(180deg, #1574d6 0%, #0f63b6 100%);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button:hover,
.file-label:hover {
  filter: brightness(0.95);
}

.file-label {
  white-space: nowrap;
}

#backup-import-input {
  display: none;
}

.summary {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  border: 1px solid #d4dee8;
  background: #f7fafc;
  color: #43576c;
}

.pill-admin {
  border-color: #b9d2f1;
  background: #edf5ff;
  color: #0f4f95;
}

.pill-ok {
  border-color: #b9e1c6;
  background: #effbf2;
  color: #19693b;
}

.pill-muted {
  border-color: #d7dce2;
  background: #f3f5f7;
  color: #5f6b77;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
  background: #fff;
}

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

th {
  position: sticky;
  top: 0;
  background: #f7fbff;
  z-index: 1;
}

tbody tr:hover {
  background: #f8fbff;
}

.status-select {
  min-width: 120px;
}

.mono {
  font-family: Menlo, Consolas, monospace;
  font-size: 12px;
}

.bad {
  color: var(--danger);
  font-weight: 700;
}

.footer {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px 24px;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 820px) {
  body.has-sidebar {
    padding-left: 0;
    padding-top: 0;
  }

  body.has-sidebar .app-header,
  body.has-sidebar .layout,
  body.has-sidebar .single-layout,
  body.has-sidebar .footer {
    padding-left: 20px;
    padding-right: 20px;
  }

  .side-nav {
    position: static;
    width: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .side-nav-inner {
    gap: 12px;
    padding: 18px 20px 14px;
  }

  .side-menu {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-header {
    flex-direction: column;
  }

  .header-actions {
    justify-content: flex-start;
  }

  table {
    min-width: 560px;
  }

  .dfd-board {
    padding: 6px;
  }
}
