:root {
  --pt-bg: #15261C;
  --pt-bg-2: #1E3328;
  --pt-surface: #ffffff;
  --pt-ink: #1c2433;
  --pt-ink-2: #5a6678;
  --pt-ink-3: #8a94a6;
  --pt-line: #e6eaf1;
  --pt-teal: #0fae8e;
  --pt-teal-d: #0a8d72;
  --pt-accent: #2f6df6;
  --pt-warn: #c97a16;
  --pt-danger: #d8453f;
  --pt-radius: 12px;
  --pt-sans: "Inter", -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  --pt-display: "Space Grotesk", var(--pt-sans);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--pt-sans);
  color: var(--pt-ink);
  background:
    linear-gradient(rgba(126, 156, 140, 0.04) 1px, transparent 1px) 0 0 / 64px 64px,
    linear-gradient(90deg, rgba(126, 156, 140, 0.04) 1px, transparent 1px) 0 0 / 64px 64px,
    radial-gradient(1100px 620px at 72% 10%, rgba(200, 160, 56, 0.08), transparent 62%),
    radial-gradient(900px 560px at 16% 90%, rgba(126, 156, 140, 0.07), transparent 60%),
    linear-gradient(165deg, #13231A 0%, #15261C 50%, #112019 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Auth screens ---------- */
.pt-auth-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.pt-auth-body .pt-main {
  flex: 1;
  display: grid;
  place-items: center;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 24px;
}
.pt-auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--pt-surface);
  border-radius: 18px;
  padding: 34px 30px 26px;
  box-shadow: 0 30px 80px rgba(5, 12, 25, 0.45);
}
.pt-auth-card-wide { max-width: 460px; }
.pt-auth-head { text-align: center; margin-bottom: 22px; }
.pt-auth-head h1 { font-family: var(--pt-display); font-size: 1.4rem; margin: 14px 0 4px; }
.pt-auth-head p { color: var(--pt-ink-3); font-size: 0.86rem; margin: 0; }

.pt-logo {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--pt-teal), var(--pt-teal-d));
  color: #fff; font-family: var(--pt-display); font-weight: 700; font-size: 1.1rem;
}
.pt-logo-lg { width: 52px; height: 52px; border-radius: 14px; font-size: 1.6rem; }

.pt-form { display: flex; flex-direction: column; gap: 14px; }
.pt-form label { display: flex; flex-direction: column; gap: 6px; font-size: 0.82rem; font-weight: 600; color: var(--pt-ink-2); }
.pt-form input, .pt-form select {
  font: inherit; font-weight: 500;
  padding: 11px 12px; border: 1px solid var(--pt-line); border-radius: 10px;
  background: #fbfcfe; color: var(--pt-ink);
}
.pt-form input:focus, .pt-form select:focus {
  outline: none; border-color: var(--pt-teal);
  box-shadow: 0 0 0 3px rgba(15, 174, 142, 0.16);
}
.pt-auth-foot { text-align: center; font-size: 0.85rem; margin: 18px 0 0; color: var(--pt-ink-2); }
.pt-auth-foot a, .pt-auth-note a { color: var(--pt-teal-d); font-weight: 600; text-decoration: none; }
.pt-auth-note { text-align: center; font-size: 0.76rem; color: var(--pt-ink-3); margin: 10px 0 0; }

/* ---------- App chrome ---------- */
.pt-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 26px;
  background: var(--pt-bg);
  color: #eef2f8;
  position: sticky; top: 0; z-index: 20;
}
.pt-brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; font-family: var(--pt-display); font-weight: 600; }
.pt-brand em { font-style: normal; font-weight: 400; color: #9fb0c7; font-size: 0.78em; }
.pt-whoami { display: flex; align-items: center; gap: 12px; font-size: 0.84rem; }
.pt-org { color: #c4cfde; }
.pt-inline { display: inline; margin: 0; }

.pt-main { max-width: 1080px; margin: 0 auto; padding: 26px 22px 80px; }
.pt-app .pt-main { padding-top: 30px; }

.pt-h1 { font-family: var(--pt-display); font-size: 1.55rem; margin: 0 0 20px; color: #F1F2EC; }
.pt-h1-sub { font-family: var(--pt-sans); font-weight: 500; font-size: 0.95rem; color: #AAB9B0; margin-left: 8px; }

/* ---------- Stats ---------- */
.pt-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 24px; }
.pt-stat {
  background: var(--pt-surface); border: 1px solid var(--pt-line);
  border-radius: var(--pt-radius); padding: 16px 16px;
  display: flex; flex-direction: column; gap: 4px;
}
.pt-stat-soft { background: #eef6f4; border-color: #d7ece6; }
.pt-stat-n { font-family: var(--pt-display); font-size: 1.7rem; font-weight: 700; color: var(--pt-teal-d); }
.pt-stat-l { font-size: 0.76rem; color: var(--pt-ink-3); text-transform: uppercase; letter-spacing: 0.04em; }

/* ---------- Panels ---------- */
.pt-panel {
  background: var(--pt-surface); border: 1px solid var(--pt-line);
  border-radius: var(--pt-radius); padding: 20px; margin-bottom: 22px;
}
.pt-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.pt-panel-head h2 { font-family: var(--pt-display); font-size: 1.05rem; margin: 0; }

.pt-grid-form {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  padding: 14px; background: #f7f9fc; border: 1px dashed var(--pt-line);
  border-radius: 10px; margin-bottom: 16px;
}
.pt-grid-form input, .pt-grid-form select {
  font: inherit; padding: 9px 11px; border: 1px solid var(--pt-line);
  border-radius: 8px; background: #fff; min-width: 150px; flex: 0 1 auto;
}
.pt-grid-form .pt-grow { flex: 1 1 220px; min-width: 200px; }
.pt-grid-form input:focus, .pt-grid-form select:focus {
  outline: none; border-color: var(--pt-teal); box-shadow: 0 0 0 3px rgba(15,174,142,0.14);
}
.pt-hint { font-size: 0.78rem; color: var(--pt-ink-3); margin: -6px 0 12px; }

/* ---------- Tables ---------- */
.pt-table-wrap { overflow-x: auto; }
.pt-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.pt-table th {
  text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--pt-ink-3); padding: 8px 10px; border-bottom: 2px solid var(--pt-line); white-space: nowrap;
}
.pt-table td { padding: 11px 10px; border-bottom: 1px solid var(--pt-line); vertical-align: middle; }
.pt-table tr:last-child td { border-bottom: none; }
.pt-ta-r { text-align: right; }
.pt-mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.82rem; color: var(--pt-ink-2); }
.pt-dim { color: var(--pt-ink-3); font-size: 0.82rem; }
.pt-empty { color: var(--pt-ink-3); font-size: 0.88rem; padding: 8px 2px; margin: 0; }

.pt-actions { display: inline-flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.pt-actions select { font: inherit; padding: 6px 8px; border: 1px solid var(--pt-line); border-radius: 7px; background: #fff; }

/* ---------- Buttons ---------- */
.pt-btn {
  font: inherit; font-weight: 600; cursor: pointer;
  padding: 9px 15px; border-radius: 9px; border: 1px solid var(--pt-line);
  background: #fff; color: var(--pt-ink); transition: filter .12s, background .12s;
}
.pt-btn:hover { filter: brightness(0.97); }
.pt-btn-sm { padding: 6px 11px; font-size: 0.8rem; border-radius: 7px; }
.pt-btn-block { width: 100%; padding: 12px; }
.pt-btn-primary { background: linear-gradient(135deg, var(--pt-teal), var(--pt-teal-d)); color: #fff; border-color: transparent; }
.pt-btn-ghost { background: transparent; color: #dbe4f0; border-color: rgba(255,255,255,0.25); }
.pt-btn-ghost:hover { background: rgba(255,255,255,0.08); }
.pt-btn-warn { color: var(--pt-warn); border-color: #ecd3ad; background: #fdf6ea; }
.pt-btn-danger { color: var(--pt-danger); border-color: #efc9c7; background: #fdf0ef; }

/* ---------- Badges ---------- */
.pt-badge, .pt-role {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 0.72rem; font-weight: 700; text-transform: capitalize; letter-spacing: 0.02em;
}
.pt-badge-approved, .pt-badge-active, .pt-badge-confirmed { background: #e2f5ee; color: #0a7a5f; }
.pt-badge-pending, .pt-badge-requested { background: #fdf2dc; color: #9a6a12; }
.pt-badge-suspended, .pt-badge-inactive, .pt-badge-cancelled { background: #fbe7e6; color: #b23c37; }
.pt-badge-completed { background: #e6edfb; color: #2a51b8; }
.pt-badge-genie { background: #eef0ff; color: #4a4fb0; margin-left: 6px; }
.pt-ok-text { color: #0a7a5f; font-weight: 600; }
.pt-confirm-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pt-confirm-form input[type="datetime-local"] {
  font: inherit; padding: 6px 8px; border: 1px solid var(--pt-line);
  border-radius: 8px; background: #fff;
}

.pt-role-admin { background: #2a2f45; color: #fff; }
.pt-role-hospital { background: #e3f1fb; color: #1f6aa6; }
.pt-role-insurance { background: #eee7fb; color: #6a3fb0; }
.pt-role-pharma { background: #e6f5ea; color: #2c8a4b; }

/* ---------- Flash ---------- */
.pt-flash { margin-bottom: 16px; display: flex; flex-direction: column; gap: 8px; }
.pt-alert { padding: 11px 14px; border-radius: 9px; font-size: 0.86rem; font-weight: 500; }
.pt-alert-ok { background: #e2f5ee; color: #0a7a5f; border: 1px solid #bfe7d8; }
.pt-alert-error { background: #fbe7e6; color: #b23c37; border: 1px solid #f0c8c5; }

@media (max-width: 640px) {
  .pt-top { padding: 12px 16px; }
  .pt-brand em { display: none; }
  .pt-main { padding: 18px 14px 60px; }
  .pt-grid-form input, .pt-grid-form select { min-width: 100%; flex: 1 1 100%; }
}

/* ---------- Legal footer + consent ---------- */
.pt-legal { border-top: 1px solid rgba(241, 242, 236, 0.10); padding: 20px 22px 36px; }
.pt-legal-inner { max-width: 1080px; margin: 0 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; }
.pt-legal-co { color: #AAB9B0; font-size: 0.8rem; }
.pt-legal-links { display: flex; gap: 16px; }
.pt-legal-links a { color: #C8A038; font-size: 0.8rem; font-weight: 600; text-decoration: none; }
.pt-legal-links a:hover { text-decoration: underline; }
.pt-legal-note { flex-basis: 100%; color: #8FA597; font-size: 0.74rem; line-height: 1.5; margin: 2px 0 0; }

.pt-form label.pt-check {
  flex-direction: row; align-items: flex-start; gap: 10px;
  font-weight: 500; font-size: 0.8rem; color: var(--pt-ink-2); line-height: 1.45;
}
.pt-form label.pt-check input { width: auto; margin: 3px 0 0; flex: 0 0 auto; }
.pt-form label.pt-check a { color: var(--pt-teal-d); font-weight: 600; text-decoration: none; }
.pt-form label.pt-check a:hover { text-decoration: underline; }

.pt-auth-legal { text-align: center; font-size: 0.76rem; color: var(--pt-ink-3); margin: 12px 0 0; line-height: 1.5; }
.pt-auth-legal a { color: var(--pt-teal-d); font-weight: 600; text-decoration: none; }
.pt-auth-legal a:hover { text-decoration: underline; }
