:root {
  --brand: #1957d6;
  --brand-dark: #123f9e;
  --brand-light: #eaf1ff;
  --ok: #1e9e5a;
  --warn: #d68a19;
  --danger: #d63a3a;
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1c2333;
  --muted: #667085;
  --border: #e3e7ef;
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { color: var(--brand); text-decoration: none; }

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
}
.topbar .brand img {
  height: 34px;
  width: auto;
}
.topbar .user-area {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 14px;
  color: var(--muted);
}
.topbar .user-area strong { color: var(--text); }
.btn {
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .05s ease, opacity .15s ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: #f0f2f7; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--ok); color: #fff; }
.btn-sm { padding: 6px 10px; font-size: 13px; border-radius: 6px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

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

.grid {
  display: grid;
  gap: 18px;
}
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 800px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
}
.card h2, .card h3 { margin-top: 0; }

.stat {
  text-align: center;
  padding: 18px 10px;
}
.stat .value { font-size: 28px; font-weight: 800; color: var(--brand); }
.stat .label { font-size: 13px; color: var(--muted); margin-top: 4px; }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: 32px;
  text-align: center;
}
.login-card img { height: 50px; margin-bottom: 14px; }
.login-card h1 { font-size: 20px; margin: 0 0 4px; }
.login-card p.sub { color: var(--muted); font-size: 14px; margin-bottom: 20px; }

input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 14px;
  font-family: inherit;
  margin-bottom: 12px;
  background: #fff;
  color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
}
label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 4px; text-align: left; }

.error-msg {
  background: #fdeaea;
  color: var(--danger);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 12px;
  text-align: left;
}
.success-msg {
  background: #e8f7ee;
  color: var(--ok);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 12px;
  text-align: left;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
tr:last-child td { border-bottom: none; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge-ok { background: #e8f7ee; color: var(--ok); }
.badge-warn { background: #fdf3e2; color: var(--warn); }
.badge-danger { background: #fdeaea; color: var(--danger); }
.badge-muted { background: #eef0f4; color: var(--muted); }

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.section-title h2 { margin: 0; font-size: 18px; }

.tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.tab {
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 2px solid transparent;
}
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }

.filter-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.filter-row .field { min-width: 140px; }
.filter-row label { margin-bottom: 4px; }
.filter-row input, .filter-row select { margin-bottom: 0; }

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(20,25,40,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal {
  background: #fff;
  border-radius: 14px;
  padding: 24px;
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal h3 { margin-top: 0; }

.hidden { display: none !important; }

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 30px 10px;
  font-size: 14px;
}

.progress-bar {
  height: 8px;
  border-radius: 4px;
  background: #eef0f4;
  overflow: hidden;
}
.progress-bar .fill {
  height: 100%;
  background: var(--brand);
}

.footer-note {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin-top: 30px;
}
