*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --surface-2: #2a2a2a;
  --border: #333;
  --accent: #6c63ff;
  --accent-hover: #5a52e0;
  --text: #e0e0e0;
  --text-muted: #666;
  --text-dim: #aaa;
  --white: #ffffff;
  --danger: #ff4d4d;
  --success-bg: #1a2e1a;
  --success-text: #4caf50;
  --error-bg: #2e1a1a;
  --error-text: #ff6b6b;
  --radius: 10px;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── HEADER ── */
header {
  background: #0a0a0a;
  border-bottom: 0.5px solid var(--border);
  padding: 18px 40px;
  display: flex;
  align-items: center;
  gap: 12px;
}
header .logo-icon { font-size: 24px; }
header h1 {
  font-family: 'DM Serif Display', serif;
  font-size: 20px;
  color: var(--white);
  letter-spacing: -.3px;
}
header span {
  color: var(--accent);
  font-style: italic;
}

/* ── LAYOUT ── */
.container {
  max-width: 1060px;
  margin: 40px auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 24px;
  align-items: start;
}

/* ── CARD ── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 0.5px solid var(--border);
  padding: 32px;
}

.card-title {
  font-family: 'DM Serif Display', serif;
  font-size: 22px;
  color: var(--white);
  margin-bottom: 4px;
}
.card-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 26px;
}

/* ── FORM ── */
label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

input {
  width: 100%;
  padding: 10px 13px;
  border: 0.5px solid var(--border);
  border-radius: 7px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--surface-2);
  transition: border-color .2s, box-shadow .2s;
  outline: none;
  margin-bottom: 16px;
}
input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108,99,255,.15);
}
input::placeholder { color: var(--text-muted); }
input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(0.5); }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

.dob-wrap {
  display: grid;
  grid-template-columns: 2fr 1fr 1.2fr;
  gap: 8px;
  margin-bottom: 16px;
}

/* ── CUSTOM SELECT ── */
.custom-select {
  position: relative;
}

.cs-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 13px;
  border: 0.5px solid var(--border);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  user-select: none;
  transition: border-color .2s;
}
.cs-trigger:hover { border-color: #555; }
.cs-trigger.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108,99,255,.15);
  color: var(--text);
}

.cs-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #1e1e1e;
  border: 0.5px solid var(--border);
  border-radius: 7px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
  scrollbar-width: thin;
  scrollbar-color: #444 transparent;
}
.cs-dropdown.open { display: block; }

.cs-option {
  padding: 9px 13px;
  font-size: 13.5px;
  color: var(--text-dim);
  cursor: pointer;
  transition: background .1s;
}
.cs-option:hover { background: #2a2a2a; color: var(--text); }
.cs-option.selected { color: var(--accent); background: rgba(108,99,255,.1); }


.btn {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: var(--white);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background .2s, transform .1s;
}
.btn:hover { background: var(--accent-hover); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: default; }

.btn-test {
  width: 100%;
  margin-top: 10px;
  padding: 10px;
  background: transparent;
  color: var(--accent);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  border: 0.5px solid var(--accent);
  border-radius: 8px;
  cursor: pointer;
  transition: background .2s;
}
.btn-test:hover { background: rgba(108,99,255,.1); }

/* ── TOAST ── */
#toast {
  display: none;
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
}
#toast.success { background: var(--success-bg); color: var(--success-text); border: 0.5px solid #2d5a2d; }
#toast.error   { background: var(--error-bg);   color: var(--error-text);   border: 0.5px solid #5a2d2d; }

/* ── TABLE ── */
.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.count-badge {
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  border: 0.5px solid var(--border);
}

.search-wrap { position: relative; margin-bottom: 14px; }
.search-wrap input {
  padding-left: 34px;
  margin-bottom: 0;
}
.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  color: var(--text-muted);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
thead th {
  text-align: left;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 10px 10px;
  border-bottom: 0.5px solid var(--border);
}
tbody tr {
  border-bottom: 0.5px solid #222;
  transition: background .15s;
}
tbody tr:hover { background: var(--surface-2); }
tbody td {
  padding: 11px 10px;
  color: var(--text-dim);
  vertical-align: middle;
}
tbody td:first-child { color: var(--text); }

.avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(108,99,255,.2);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  margin-right: 8px;
  flex-shrink: 0;
}
.user-cell { display: flex; align-items: center; }

.birthday-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 20px;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 0.5px solid var(--border);
}
.birthday-chip.today {
  background: rgba(108,99,255,.15);
  color: var(--accent);
  border-color: rgba(108,99,255,.3);
  font-weight: 600;
}

.del-btn {
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color .15s, background .15s;
}
.del-btn:hover { color: var(--danger); background: rgba(255,77,77,.1); }

.empty {
  text-align: center;
  padding: 48px 0;
  color: var(--text-muted);
  font-size: 13.5px;
}
.empty .empty-icon { font-size: 32px; display: block; margin-bottom: 10px; }



@media (max-width: 720px) {
  header { padding: 14px 16px; }
  header h1 { font-size: 17px; }
  header .logo-icon { font-size: 20px; }

  .container {
    grid-template-columns: 1fr;
    margin: 16px auto;
    padding: 0 12px;
    gap: 16px;
  }

  .card { padding: 20px 16px; }

  .card-title { font-size: 19px; }
  .card-sub { font-size: 12px; margin-bottom: 20px; }

  input, .cs-trigger {
    font-size: 16px; /* prevents iOS zoom on focus */
    padding: 11px 12px;
  }

  .btn { padding: 13px; font-size: 15px; }
  .btn-test { font-size: 13px; }

  .dob-wrap {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
  }
  .dob-wrap input[type="number"] {
    grid-column: 1 / -1;
  }

  .table-header { flex-direction: column; align-items: flex-start; gap: 8px; }

  table { font-size: 12.5px; }
  thead th { padding: 0 6px 8px; font-size: 10px; }
  tbody td { padding: 10px 6px; }

  /* hide email column on small screens */
  thead th:nth-child(2),
  tbody td:nth-child(2) { display: none; }

  .avatar { width: 26px; height: 26px; font-size: 11px; margin-right: 6px; }

  .cs-dropdown { max-height: 180px; }
}