/* ──────────────────────────────────────────────
   Platform Admin — shadcn × Apple-minimal
   ────────────────────────────────────────────── */

:root {
  --background: #f5f5f7;
  --foreground: #1d1d1f;
  --card: #ffffff;
  --card-foreground: #1d1d1f;
  --primary: #0071e3;
  --primary-foreground: #ffffff;
  --secondary: #e8e8ed;
  --secondary-foreground: #1d1d1f;
  --muted: #f5f5f7;
  --muted-foreground: #86868b;
  --accent: #f0f7ff;
  --destructive: #ef4444;
  --destructive-foreground: #ffffff;
  --success: #22c55e;
  --border: #d2d2d7;
  --input: #d2d2d7;
  --ring: #0071e3;
  --radius: 12px;
}

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--background);
  color: var(--foreground);
  line-height: 1.6;
  font-size: 14px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Navigation ─────────────────────────────── */

nav {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  height: 3.5rem;
  display: flex;
  align-items: center;
}

.nav-inner {
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.5px;
  color: var(--foreground);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-brand-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

.nav-links a {
  color: var(--muted-foreground);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;
}

.nav-links a:hover {
  color: var(--foreground);
  background: var(--secondary);
}

.btn-link {
  background: none;
  border: none;
  color: var(--muted-foreground);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  padding: 6px 12px;
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;
}

.btn-link:hover {
  color: var(--foreground);
  background: var(--secondary);
}

/* ── Main ───────────────────────────────────── */

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 40px 20px;
}

/* ── Typography ─────────────────────────────── */

h2 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.2;
  margin-bottom: 4px;
}

.page-description {
  color: var(--muted-foreground);
  font-size: 15px;
  margin-bottom: 24px;
}

/* ── Flash Messages ─────────────────────────── */

.flash {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 12px;
  font-size: 14px;
  border: 1px solid;
  word-break: break-all;
}

.flash-error {
  background: #fff0f0;
  border-color: #fcc;
  color: #c00;
}

.flash-success {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}

/* ── Card ───────────────────────────────────── */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.card-header {
  padding: 1.5rem 1.5rem 0;
}

.card-content {
  padding: 1.5rem;
}

.card-footer {
  padding: 0 1.5rem 1.5rem;
}

/* ── Table ──────────────────────────────────── */

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead tr {
  border-bottom: 1px solid var(--border);
}

th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  color: var(--muted-foreground);
  white-space: nowrap;
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid #e8e8ed;
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr {
  transition: background 0.15s;
}

tbody tr:hover {
  background: var(--muted);
}

tr.inactive {
  opacity: 0.45;
}

td code {
  background: var(--muted);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  border: 1px solid var(--border);
}

/* ── Badges ─────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge-active {
  background: #f0fdf4;
  color: #15803d;
  border-color: #bbf7d0;
}

.badge-revoked {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

/* ── Buttons ────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  padding: 10px 20px;
  line-height: 1.25;
  transition: background 0.2s;
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-foreground);
}

.btn-primary:hover {
  background: #0077ed;
}

.btn-outline {
  background: transparent;
  color: var(--foreground);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  background: var(--secondary);
}

.btn-sm {
  font-size: 13px;
  padding: 6px 14px;
  height: auto;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  font-family: inherit;
  border: none;
  transition: background 0.2s;
}

.btn-danger {
  background: var(--destructive);
  color: var(--destructive-foreground);
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-success {
  background: var(--primary);
  color: var(--primary-foreground);
}

.btn-success:hover {
  background: #0077ed;
}

/* ── Forms ──────────────────────────────────── */

label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--foreground);
}

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--input);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: var(--muted);
  color: var(--foreground);
  transition: border-color 0.2s, background 0.2s;
  outline: none;
}

input[type="text"]:focus,
input[type="password"]:focus {
  border-color: var(--ring);
  background: var(--card);
}

input[type="text"]::placeholder,
input[type="password"]::placeholder {
  color: var(--muted-foreground);
}

/* ── Login ──────────────────────────────────── */

.login-wrapper {
  min-height: calc(100vh - 3.5rem);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.login-container {
  width: 100%;
  max-width: 380px;
}

.login-header {
  text-align: center;
  margin-bottom: 24px;
}

.login-header h2 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

.login-header p {
  color: var(--muted-foreground);
  font-size: 15px;
}

.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
}

.login-card .form-group {
  margin-bottom: 16px;
}

.login-card .btn {
  width: 100%;
  margin-top: 8px;
  padding: 14px;
  font-size: 16px;
}

/* ── Create Client Form ─────────────────────── */

.form-create {
  max-width: 480px;
}

.form-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group:last-of-type {
  margin-bottom: 0;
}

fieldset {
  border: none;
  margin: 0;
  padding: 0;
}

legend {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 8px;
  color: var(--foreground);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-weight: 400;
  font-size: 14px;
  color: var(--foreground);
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--primary);
  cursor: pointer;
}

.form-actions {
  margin-top: 24px;
}

.form-actions .btn {
  padding: 14px 24px;
  font-size: 16px;
}

/* ── Dashboard Header ───────────────────────── */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-header-text h2 {
  margin-bottom: 2px;
}

.page-header .btn {
  flex-shrink: 0;
}

.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--muted-foreground);
}

.empty-state p {
  margin-bottom: 12px;
  font-size: 15px;
}

.empty-state a {
  color: var(--primary);
  font-weight: 500;
  text-decoration: none;
}

.empty-state a:hover {
  text-decoration: underline;
}

/* ── Utilities ──────────────────────────────── */

.inline { display: inline; }

/* ── Responsive ─────────────────────────────── */

@media (max-width: 600px) {
  main {
    padding: 24px 16px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  h2 {
    font-size: 24px;
  }
}
