:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --border: #d8dee8;
  --text: #162032;
  --muted: #526177;
  --primary: #155eef;
  --primary-hover: #1049bd;
  --warn-bg: #fff7e6;
  --warn-border: #f0b429;
  --info-bg: #eef4ff;
  --info-border: #84adff;
  --danger-bg: #fef2f2;
  --danger-border: #ef4444;
  --ok-bg: #ecfdf3;
  --ok-border: #12b76a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  overflow-x: hidden;
}

.topbar {
  background: #0f172a;
  color: #f8fafc;
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.brand h1 {
  margin: 0;
  font-size: 1.15rem;
}

.brand .sub {
  font-size: 0.78rem;
  color: #94a3b8;
}

.status-pills,
.user-area,
.row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.pill {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.pill-warn { background: #fef0c7; color: #93370d; }
.pill-info { background: #dbeafe; color: #1e40af; }
.pill-ok { background: #d1fae5; color: #065f46; }
.pill-danger { background: #fee2e2; color: #991b1b; }
.pill-muted { background: #334155; color: #e2e8f0; }

.container {
  max-width: 1280px;
  margin: 16px auto;
  padding: 0 12px 40px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  min-width: 0;
}

.login-card {
  max-width: 440px;
  margin: 40px auto;
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.card h2, .card h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.tab {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.86rem;
}

.tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

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

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.kpi-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
}

.kpi-box .kpi-val {
  font-size: 1.3rem;
  font-weight: 700;
}

.kpi-box .kpi-lbl {
  font-size: 0.76rem;
  color: var(--muted);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.84rem;
  font-weight: 600;
}

input, select, textarea {
  font: inherit;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 100%;
  max-width: 100%;
}

.btn {
  border: none;
  border-radius: 6px;
  padding: 8px 12px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.84rem;
}

.btn-sm { padding: 5px 9px; font-size: 0.78rem; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: #e2e8f0; color: #1e293b; }
.btn-danger { background: #dc2626; color: #fff; }

.alert, .banner-info, .banner-warn {
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 0.86rem;
  word-break: break-word;
}

.banner-info { background: var(--info-bg); border: 1px solid var(--info-border); }
.banner-warn { background: var(--warn-bg); border: 1px solid var(--warn-border); }
.alert-ok { background: var(--ok-bg); border: 1px solid var(--ok-border); }
.alert-err { background: var(--danger-bg); border: 1px solid var(--danger-border); }

.list-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.item-box {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  background: #fafbfd;
  word-break: break-word;
}

.muted { color: var(--muted); font-size: 0.84rem; }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }
.sep { border: none; border-top: 1px solid var(--border); margin: 14px 0; }
a.btn { text-decoration: none; display: inline-block; }

pre.code-block {
  background: #0f172a;
  color: #e2e8f0;
  padding: 10px;
  border-radius: 6px;
  font-size: 0.76rem;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
  max-width: 100%;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.data-table th, .data-table td {
  border: 1px solid var(--border);
  padding: 6px 8px;
  text-align: left;
  word-break: break-word;
}

.data-table th {
  background: #f1f5f9;
}
