* {
  box-sizing: border-box;
}

:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --line: #e5e7eb;
  --text: #0f172a;
  --muted: #6b7280;
  --primary: #0f9d58;
  --danger: #dc2626;
  --radius: 12px;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
}

.hidden {
  display: none !important;
}

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
}

.auth-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}

.auth-card h1 {
  margin: 0 0 6px;
  font-size: 22px;
}

.auth-card p {
  margin: 0 0 12px;
  color: var(--muted);
}

.auth-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

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

.sidebar {
  background: #0b1326;
  color: #dbe3f3;
  padding: 18px 14px;
}

.brand {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
}

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

.menu button {
  background: transparent;
  color: #dbe3f3;
  border: 0;
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
}

.menu button.active,
.menu button:hover {
  background: rgba(255, 255, 255, 0.12);
}

.main {
  padding: 18px;
}

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

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

.badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  background: var(--panel);
  color: var(--muted);
}

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

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

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}

.kpi strong {
  display: block;
  font-size: 22px;
}

.kpi span {
  color: var(--muted);
  font-size: 13px;
}

.two {
  grid-template-columns: 1.3fr 1fr;
}

h2 {
  margin: 0 0 10px;
  font-size: 17px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

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

.table th {
  color: var(--muted);
  font-weight: 600;
}

.tag {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--line);
  color: #334155;
  background: #f8fafc;
}

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

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

label {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 4px;
  display: block;
}

input,
select,
textarea,
button.primary,
button.ghost,
button.danger {
  width: 100%;
  border-radius: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  font: inherit;
}

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

button.primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  cursor: pointer;
}

button.ghost {
  background: #fff;
  cursor: pointer;
}

button.danger {
  background: #fff;
  color: var(--danger);
  border-color: #fecaca;
  cursor: pointer;
}

button.mini {
  width: auto;
  padding: 6px 10px;
  font-size: 12px;
}

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

.module {
  display: none;
}

.module.active {
  display: grid;
  gap: 12px;
}

@media (max-width: 1024px) {
  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
  }

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

  .menu button {
    text-align: center;
    font-size: 12px;
    padding: 8px 6px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

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