:root {
  --bg: #f5f6fb;
  --surface: #ffffff;
  --primary: #6c5ce7;
  --primary-dark: #5a4cd1;
  --danger: #ef476f;
  --text: #1f2430;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --success: #17c3b2;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

.layout {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.app-shell {
  display: flex;
  min-height: 0;
  flex: 1;
}

.sidebar {
  width: 220px;
  background: linear-gradient(180deg, #eef2ff 0%, #e0f2ff 100%);
  color: var(--text);
  border-right: 1px solid var(--border);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar-header {
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.6);
}

.sidebar-title {
  font-size: 1rem;
  font-weight: 600;
}

.sidebar-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.93rem;
  cursor: pointer;
  border: none;
  background: transparent;
  color: inherit;
  text-align: left;
}

.nav-item:hover {
  background: rgba(129, 140, 248, 0.12);
}

.nav-item--active {
  background: var(--primary);
  color: #ffffff;
}

.nav-item--muted {
  color: var(--text-muted);
  margin-top: 8px;
}

.nav-item--muted:hover {
  background: rgba(148, 163, 184, 0.25);
  color: var(--text);
}

.top-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 32px;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 12px;
}

.top-bar h1 {
  margin: 0;
  font-size: 1.2rem;
}

.top-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.menu-toggle {
  display: none;
  border: none;
  border-radius: 999px;
  padding: 8px 10px;
  background: #edeafe;
  color: var(--primary);
  cursor: pointer;
  font-size: 1.1rem;
}

.container {
  padding: 24px 32px 48px;
  flex: 1;
  overflow-y: auto;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.card {
  background: var(--surface);
  border-radius: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.card .label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.card .value {
  font-size: 1.8rem;
  font-weight: 600;
}

.panel {
  background: var(--surface);
  border-radius: 20px;
  padding: 20px;
  border: 1px solid var(--border);
  margin-bottom: 28px;
}

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

.panel-header h2 {
  margin: 0;
  font-size: 1.15rem;
}

.button {
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  background: var(--primary);
  color: #fff;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease;
}

.button.secondary {
  background: #edeafe;
  color: var(--primary);
}

.button.danger {
  background: var(--danger);
}

.button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.table-wrapper {
  overflow-x: auto;
}

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

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

th {
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

tbody tr:hover {
  background: #fafafa;
}

.type-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
}

.type-link {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(108, 92, 231, 0.12);
  color: var(--primary);
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.type-link:hover,
.type-link:focus-visible {
  background: var(--primary);
  color: #ffffff;
  transform: translateY(-1px);
}

.type-link:focus-visible {
  outline: 2px solid rgba(108, 92, 231, 0.4);
  outline-offset: 2px;
}

.type-link__icon {
  width: 16px;
  height: 16px;
  display: block;
}

.muted {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

input[type="text"],
input[type="number"],
select,
textarea {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 0.95rem;
  width: 100%;
}

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

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 30;
}

.modal.active {
  display: flex;
}

.modal-card {
  background: var(--surface);
  border-radius: 18px;
  width: min(640px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  border: 1px solid var(--border);
}

.modal-footer {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef2ff;
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 600;
}

.status-pill {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
}

.status-pill.success {
  background: #ecfdf5;
  color: var(--success);
}

.status-pill.danger {
  background: #fee2e2;
  color: var(--danger);
}

.status-pill.warning {
  background: #fef3c7;
  color: #d97706;
}

.grid-two {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.config-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.config-item h3 {
  margin: 0 0 8px;
}

.text-sm {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.link {
  color: var(--primary);
  cursor: pointer;
}

@media (max-width: 768px) {
  .app-shell {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 12px 16px 10px;
    display: none;
  }
  .sidebar.sidebar--open {
    display: flex;
  }
  .sidebar-header {
    border-bottom: none;
    padding-bottom: 0;
  }
  .sidebar-nav {
    flex-direction: column;
    gap: 4px;
    width: 100%;
    margin-top: 8px;
  }
  .nav-item {
    width: 100%;
  }
  .top-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .panel-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .filters {
    flex-direction: column;
  }
  .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}
