:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #172033;
  --muted: #667085;
  --border: #e5e7eb;
  --primary: #111827;
  --primary-soft: #f3f4f6;
  --green: #0f766e;
  --green-bg: #ccfbf1;
  --red: #b91c1c;
  --red-bg: #fee2e2;
  --yellow: #a16207;
  --yellow-bg: #fef3c7;
  --orange: #c2410c;
  --orange-bg: #ffedd5;
  --blue: #1d4ed8;
  --blue-bg: #dbeafe;
  --gray: #475569;
  --gray-bg: #e5e7eb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a {
  color: inherit;
}

.topbar {
  height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  font-weight: 800;
  text-decoration: none;
  letter-spacing: -0.02em;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-user {
  font-weight: 600;
}

.topbar-role {
  color: var(--muted);
  font-size: 13px;
}

.app-shell {
  display: flex;
  min-height: calc(100vh - 60px);
}

.sidebar {
  width: 240px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 18px 12px;
  flex-shrink: 0;
}

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

.sidebar-link {
  display: block;
  padding: 10px 12px;
  color: var(--text);
  text-decoration: none;
  border-radius: 8px;
}

.sidebar-link:hover {
  background: var(--primary-soft);
}

.sidebar-link.active {
  background: var(--primary);
  color: #fff;
}

.app-main {
  flex: 1;
  min-width: 0;
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.page-header h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: -0.03em;
}

.page-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
}

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

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.04);
}

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

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

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

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

.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

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

.table th,
.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.table th {
  font-size: 13px;
  color: var(--muted);
  background: #fafafa;
}

.table tr:last-child td {
  border-bottom: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-green {
  background: var(--green-bg);
  color: var(--green);
}

.badge-red {
  background: var(--red-bg);
  color: var(--red);
}

.badge-yellow {
  background: var(--yellow-bg);
  color: var(--yellow);
}

.badge-orange {
  background: var(--orange-bg);
  color: var(--orange);
}

.badge-blue {
  background: var(--blue-bg);
  color: var(--blue);
}

.badge-gray {
  background: var(--gray-bg);
  color: var(--gray);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 14px;
  line-height: 1;
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  font-weight: 700;
}

.btn-sm {
  padding: 7px 10px;
  font-size: 13px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-secondary {
  background: #fff;
  color: var(--text);
  border-color: var(--border);
}

.btn-light {
  background: var(--primary-soft);
  color: var(--text);
}

.btn-danger {
  background: var(--red);
  color: #fff;
}

.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
}

.form-row {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-weight: 700;
  margin-bottom: 6px;
}

.form-hint {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

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

.textarea {
  min-height: 110px;
  resize: vertical;
}

.alert {
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 14px;
  border: 1px solid transparent;
}

.alert-success {
  background: var(--green-bg);
  color: var(--green);
}

.alert-error {
  background: var(--red-bg);
  color: var(--red);
}

.alert-info {
  background: var(--blue-bg);
  color: var(--blue);
}

.empty-state {
  text-align: center;
  padding: 36px 18px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 12px;
}

.empty-state h3 {
  margin: 0 0 6px;
}

.empty-state p {
  margin: 0 0 16px;
  color: var(--muted);
}

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

.stat-label {
  color: var(--muted);
  font-size: 13px;
}

.stat-value {
  font-size: 26px;
  font-weight: 800;
}

@media (max-width: 900px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    width: 100%;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    padding: 10px;
  }

  .sidebar-nav {
    flex-direction: row;
    white-space: nowrap;
  }

  .container {
    padding: 16px;
  }

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

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

  .topbar-user,
  .topbar-role {
    display: none;
  }
}
