:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --ink: #17202a;
  --muted: #657382;
  --line: #d9e0e7;
  --accent: #176b87;
  --accent-soft: #e6f2f6;
  --warning: #b05b12;
  --danger: #b33a3a;
  --success: #2f7a4f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Yu Gothic UI", "Meiryo", sans-serif;
}

button,
input,
select {
  font: inherit;
}

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

.sidebar {
  background: #10212b;
  color: #fff;
  padding: 20px 16px;
}

.brand {
  display: grid;
  gap: 4px;
  margin-bottom: 24px;
}

.brand span {
  color: #b6c5ce;
  font-size: 13px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-button,
.mobile-nav button {
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 11px 12px;
  border-radius: 8px;
  cursor: pointer;
}

.nav-button.active {
  background: rgba(255, 255, 255, 0.14);
}

.main {
  padding: 24px;
}

.topbar {
  margin-bottom: 18px;
}

.topbar h1 {
  margin: 0 0 4px;
  font-size: 28px;
}

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

.grid {
  display: grid;
  gap: 16px;
}

.stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel,
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stat {
  padding: 18px;
}

.stat strong {
  display: block;
  font-size: 28px;
}

.stat span {
  color: var(--muted);
}

.panel {
  padding: 18px;
}

.panel h2 {
  margin: 0 0 14px;
  font-size: 18px;
}

.quick-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

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

.button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
}

.button.secondary {
  background: #fff;
  color: var(--accent);
}

.button.warning {
  border-color: var(--warning);
  background: var(--warning);
}

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

.field {
  display: grid;
  gap: 6px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  font-size: 14px;
  color: var(--muted);
}

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

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
}

.table-wrap {
  overflow: auto;
}

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

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

th {
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  background: #eef3f6;
}

.badge.success {
  color: var(--success);
  background: #e9f5ee;
}

.badge.warning {
  color: var(--warning);
  background: #fbf0e7;
}

.badge.danger {
  color: var(--danger);
  background: #faeaea;
}

.stack {
  display: grid;
  gap: 16px;
}

.inline-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: end;
}

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

.compact-input {
  width: 88px;
}

.log {
  display: grid;
  gap: 8px;
}

.log-item {
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.log-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.muted {
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  background: #10212b;
  color: #fff;
  padding: 12px 14px;
  border-radius: 8px;
  transition: 0.2s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.mobile-nav {
  display: none;
}

@media (max-width: 860px) {
  .app-shell {
    display: block;
    padding-bottom: 72px;
  }

  .sidebar {
    display: none;
  }

  .main {
    padding: 16px;
  }

  .topbar h1 {
    font-size: 24px;
  }

  .stats,
  .form-grid,
  .inline-form {
    grid-template-columns: 1fr;
  }

  table {
    min-width: 680px;
  }

  .mobile-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0;
    background: #10212b;
    color: #fff;
    z-index: 10;
  }

  .mobile-nav button {
    min-height: 58px;
    text-align: center;
    padding: 8px 4px;
    border-radius: 0;
    font-size: 13px;
  }

  .toolbar {
    align-items: stretch;
  }
}
