:root {
  --ping-teal: #29A19C;
  --ping-teal-dark: #1f7d79;
  --ping-teal-light: #A3F7BF;
  --ping-dark: #222831;
  --ping-gray: #393E46;
  --ping-white: #FFFFFF;
  --ping-bg: #F4F7F6;
  --ping-border: #E1E6E5;
  --ping-danger: #C0392B;
  --ping-danger-dark: #96291D;
  --font-display: 'Archivo Black', 'Open Sans', sans-serif;
  --font-body: 'Open Sans', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--ping-bg);
  color: var(--ping-dark);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
}

h1, h2, h3 { font-family: var(--font-display); color: var(--ping-dark); letter-spacing: 0.2px; }
h1 { font-size: 1.6rem; margin: 0 0 4px; }
h2 { font-size: 1.2rem; }
p { margin: 0 0 12px; }
a { color: var(--ping-teal); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: var(--ping-dark);
  color: var(--ping-white);
  padding: 0 28px;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--ping-white); }
.brand:hover { text-decoration: none; }
.brand-dots {
  display: grid;
  grid-template-columns: repeat(3, 8px);
  grid-template-rows: repeat(3, 8px);
  gap: 3px;
  width: 27px;
}
.brand-dots .dot { width: 8px; height: 8px; border-radius: 50%; }
.dot-teal { background: var(--ping-teal-light); }
.dot-dark { background: transparent; }
.brand-dots .dot:nth-child(1) { grid-area: 1 / 2; background: var(--ping-teal-light); }
.brand-dots .dot:nth-child(2) { grid-area: 2 / 1; background: var(--ping-white); }
.brand-dots .dot:nth-child(3) { grid-area: 2 / 3; background: var(--ping-teal-light); }
.brand-dots .dot:nth-child(4) { grid-area: 3 / 1; background: var(--ping-white); }
.brand-dots .dot:nth-child(5) { grid-area: 2 / 2; background: var(--ping-teal-light); }
.brand-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.brand-name small { font-family: var(--font-body); font-weight: 600; font-size: 0.62rem; color: var(--ping-teal-light); text-transform: uppercase; letter-spacing: 0.6px; }

.topnav { display: flex; gap: 22px; flex: 1; }
.topnav a { color: #cfd6d5; font-weight: 600; font-size: 0.92rem; padding: 8px 0; border-bottom: 2px solid transparent; }
.topnav a:hover { color: var(--ping-white); text-decoration: none; }
.topnav a.is-active { color: var(--ping-white); border-bottom-color: var(--ping-teal-light); }

.topbar-user { display: flex; align-items: center; gap: 14px; font-size: 0.9rem; color: #cfd6d5; }
.btn-link { background: none; border: none; color: var(--ping-teal-light); cursor: pointer; font: inherit; font-weight: 600; padding: 0; }
.btn-link:hover { text-decoration: underline; }

/* ---------- layout ---------- */
.page { max-width: 1080px; margin: 0 auto; padding: 32px 28px 64px; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.subtitle { color: var(--ping-gray); margin-top: -4px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 8px;
  border: none;
  background: var(--ping-teal);
  color: var(--ping-white);
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  transition: background .15s ease;
}
.btn:hover { background: var(--ping-teal-dark); text-decoration: none; }
.btn-secondary { background: var(--ping-white); color: var(--ping-dark); border: 1px solid var(--ping-border); }
.btn-secondary:hover { background: #eef2f1; }
.btn-danger { background: var(--ping-danger); }
.btn-danger:hover { background: var(--ping-danger-dark); }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 6px 12px; font-size: 0.82rem; }

/* ---------- forms ---------- */
label { display: block; font-weight: 700; font-size: 0.85rem; margin-bottom: 6px; color: var(--ping-gray); }
input[type="text"], input[type="password"], input[type="email"], textarea, select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--ping-border);
  background: var(--ping-white);
  font: inherit;
  color: var(--ping-dark);
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--ping-teal-light); border-color: var(--ping-teal); }
.field { margin-bottom: 18px; }
.hint { font-size: 0.8rem; color: #6a7472; margin-top: 4px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.checkbox-row input { width: auto; }

.card {
  background: var(--ping-white);
  border: 1px solid var(--ping-border);
  border-radius: 14px;
  padding: 26px;
}

.alert {
  background: #FDEDEC;
  border: 1px solid #F5B7B1;
  color: var(--ping-danger-dark);
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 18px;
  font-weight: 600;
  font-size: 0.9rem;
}

/* ---------- login ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--ping-dark) 0%, var(--ping-gray) 55%, var(--ping-teal-dark) 100%);
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--ping-white);
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.28);
}
.login-logo { display: flex; justify-content: center; margin-bottom: 18px; }
.login-logo .brand-dots { width: 40px; grid-template-columns: repeat(3, 12px); grid-template-rows: repeat(3, 12px); gap: 4px; }
.login-logo .brand-dots .dot { width: 12px; height: 12px; }
.login-logo .dot-dark-fill { background: var(--ping-dark) !important; }
.login-title { text-align: center; margin-bottom: 4px; }
.login-subtitle { text-align: center; color: var(--ping-gray); font-size: 0.9rem; margin-bottom: 26px; }

/* ---------- dashboard tool grid ---------- */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}
.tool-card {
  background: var(--ping-white);
  border: 1px solid var(--ping-border);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform .12s ease, box-shadow .12s ease;
}
.tool-card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(34,40,49,0.10); text-decoration: none; }
.tool-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--ping-teal-light);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  color: var(--ping-teal-dark);
  font-size: 1.1rem;
}
.tool-card h3 { margin: 0; font-family: var(--font-body); font-weight: 700; font-size: 1rem; color: var(--ping-dark); }
.tool-card p { margin: 0; font-size: 0.85rem; color: var(--ping-gray); flex: 1; }
.tool-card .open { font-size: 0.82rem; font-weight: 700; color: var(--ping-teal); }

.empty-state { text-align: center; padding: 60px 20px; color: var(--ping-gray); }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; background: var(--ping-white); border: 1px solid var(--ping-border); border-radius: 12px; overflow: hidden; }
thead th { text-align: left; background: #EEF4F3; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.4px; color: var(--ping-gray); padding: 12px 16px; }
tbody td { padding: 12px 16px; border-top: 1px solid var(--ping-border); font-size: 0.9rem; vertical-align: middle; }
tbody tr:hover { background: #FAFCFB; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; }
.badge-admin { background: var(--ping-teal-light); color: var(--ping-teal-dark); }
.badge-user { background: #E7EAEA; color: var(--ping-gray); }
.badge-inactive { background: #FDEDEC; color: var(--ping-danger-dark); }
.row-actions { display: flex; gap: 12px; }

/* ---------- permission checkbox grid ---------- */
.tool-checklist {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  border: 1px solid var(--ping-border);
  border-radius: 10px;
  padding: 14px;
  max-height: 320px;
  overflow-y: auto;
  background: #FAFCFB;
}
.tool-checklist label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.88rem;
  margin: 0;
}
.tool-checklist input { width: auto; }
.tool-checklist .empty { grid-column: 1 / -1; color: var(--ping-gray); font-weight: 400; }

.form-actions { display: flex; gap: 12px; margin-top: 22px; }

.error-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; text-align: center; padding: 24px; }
