/* Healworks CARE portal — shared theme.
   Mirrors the marketing site (assets/css/style.css):
   - Primary: #40B0DF (cyan)
   - Heading font: B612, body: Roboto
   - Body text #666666 on #ffffff, headings #111111
   - Pill buttons (30px radius), #40B0DF border / fill on hover
*/

@import url("https://fonts.googleapis.com/css2?family=B612:wght@400;700&family=Roboto:wght@300;400;500;700&display=swap");

:root {
  --hw-primary: #40B0DF;
  --hw-primary-dark: #2c93bf;
  --hw-primary-soft: rgba(64, 176, 223, 0.08);
  --hw-text: #111111;
  --hw-muted: #666666;
  --hw-border: rgba(12, 184, 182, 0.25);
  --hw-bg: #f6fafc;
  --hw-card: #ffffff;
  --hw-danger: #d6336c;
  --hw-warn:   #f59f00;
  --hw-ok:     #2f9e44;
  --hw-radius: 12px;
  --hw-radius-pill: 30px;
  --hw-shadow: 0 2px 8px rgba(17, 17, 17, 0.06);
  --hw-shadow-lg: 0 12px 32px rgba(17, 17, 17, 0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--hw-bg);
  color: var(--hw-muted);
  font-family: "Roboto", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--hw-text);
  font-family: "B612", sans-serif;
  font-weight: 700;
  margin: 0 0 12px;
  line-height: 1.3;
}

h1 { font-size: 28px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
h4 { font-size: 16px; }

a { color: var(--hw-primary); text-decoration: none; }
a:hover { color: var(--hw-primary-dark); text-decoration: underline; }

/* ---------- Layout ---------- */

.hw-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.hw-topbar {
  background: #ffffff;
  border-bottom: 1px solid #eef3f6;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.hw-topbar .hw-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--hw-text);
  font-family: "B612", sans-serif;
  font-weight: 700;
  font-size: 18px;
}

.hw-topbar .hw-brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--hw-primary), var(--hw-primary-dark));
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
}

.hw-topbar nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.hw-topbar nav a {
  color: var(--hw-muted);
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 500;
}

.hw-topbar nav a:hover,
.hw-topbar nav a.active {
  background: var(--hw-primary-soft);
  color: var(--hw-primary-dark);
  text-decoration: none;
}

.hw-topbar .hw-user {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--hw-muted);
  font-size: 14px;
}

.hw-content {
  flex: 1;
  padding: 32px 24px 80px;
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
}

.hw-section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.hw-section-title h1 { margin: 0; }

.hw-subtle { color: var(--hw-muted); font-size: 14px; }

/* ---------- Cards ---------- */

.hw-card {
  background: var(--hw-card);
  border: 1px solid #eef3f6;
  border-radius: var(--hw-radius);
  box-shadow: var(--hw-shadow);
  padding: 20px;
}

.hw-card + .hw-card { margin-top: 16px; }

.hw-grid {
  display: grid;
  gap: 16px;
}
.hw-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.hw-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.hw-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) {
  .hw-grid.cols-3, .hw-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .hw-grid.cols-2, .hw-grid.cols-3, .hw-grid.cols-4 { grid-template-columns: 1fr; }
}

/* ---------- Resident card ---------- */

.hw-resident-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.hw-resident-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--hw-shadow-lg);
  border-color: var(--hw-primary);
}
.hw-resident-card .hw-resident-name {
  color: var(--hw-text);
  font-family: "B612", sans-serif;
  font-weight: 700;
  font-size: 16px;
}
.hw-resident-card .hw-resident-meta {
  color: var(--hw-muted);
  font-size: 13px;
}

/* ---------- Buttons ---------- */

.hw-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--hw-radius-pill);
  font-size: 15px;
  font-weight: 500;
  font-family: inherit;
  border: 1px solid var(--hw-primary);
  background: transparent;
  color: var(--hw-text);
  cursor: pointer;
  transition: all .25s ease;
  position: relative;
  overflow: hidden;
  text-decoration: none;
}

.hw-btn:hover {
  background: var(--hw-primary);
  color: #ffffff;
  text-decoration: none;
}

.hw-btn-primary {
  background: var(--hw-primary);
  color: #ffffff;
}
.hw-btn-primary:hover {
  background: var(--hw-primary-dark);
  border-color: var(--hw-primary-dark);
}

.hw-btn-ghost {
  border-color: transparent;
  color: var(--hw-muted);
}
.hw-btn-ghost:hover {
  background: var(--hw-primary-soft);
  color: var(--hw-primary-dark);
}

.hw-btn-danger {
  border-color: var(--hw-danger);
  color: var(--hw-danger);
}
.hw-btn-danger:hover {
  background: var(--hw-danger);
  color: #fff;
}

.hw-btn:disabled,
.hw-btn[aria-disabled="true"] {
  opacity: 0.6;
  cursor: not-allowed;
}

.hw-btn-block {
  width: 100%;
}

/* ---------- Forms ---------- */

.hw-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hw-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hw-field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--hw-text);
}

.hw-field .hint {
  font-size: 12px;
  color: var(--hw-muted);
}

.hw-input,
.hw-textarea,
.hw-select {
  width: 100%;
  height: 46px;
  padding: 10px 14px;
  border: 1px solid var(--hw-border);
  border-radius: 8px;
  background: #ffffff;
  font-family: inherit;
  font-size: 15px;
  color: var(--hw-text);
  transition: border-color .2s ease, box-shadow .2s ease;
}

.hw-textarea {
  height: auto;
  min-height: 110px;
  resize: vertical;
}

.hw-input:focus,
.hw-textarea:focus,
.hw-select:focus {
  outline: none;
  border-color: var(--hw-primary);
  box-shadow: 0 0 0 3px rgba(64, 176, 223, 0.15);
}

.hw-input[readonly] {
  background: #f6fafc;
  color: var(--hw-muted);
}

.hw-input.error,
.hw-textarea.error,
.hw-select.error {
  border-color: var(--hw-danger);
}

.hw-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
@media (max-width: 600px) {
  .hw-row { grid-template-columns: 1fr; }
}

/* ---------- Login layout ---------- */

.hw-login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
  background:
    radial-gradient(ellipse at top, rgba(64, 176, 223, 0.18), transparent 60%),
    var(--hw-bg);
}

.hw-login-card {
  width: 100%;
  max-width: 420px;
  background: var(--hw-card);
  border-radius: 16px;
  box-shadow: var(--hw-shadow-lg);
  padding: 32px 28px;
}

.hw-login-card .hw-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  justify-content: center;
  margin-bottom: 22px;
  font-family: "B612", sans-serif;
  font-weight: 700;
  color: var(--hw-text);
  font-size: 20px;
}

.hw-brand-logo {
  width: 88px;
  height: 88px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
  border-radius: 20px;
  background: var(--hw-card);
  box-shadow: var(--hw-shadow-lg);
  padding: 6px;
}

.hw-login-card .hw-brand > span {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 999px;
  background: var(--hw-primary-soft);
  color: var(--hw-primary);
  font-size: 18px;
  letter-spacing: 0.3px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* Password / text input with trailing toggle button (e.g. show password). */
.hw-input-wrap {
  position: relative;
}
.hw-input-wrap .hw-input {
  padding-right: 44px;
}
.hw-input-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 0;
  padding: 6px;
  cursor: pointer;
  color: var(--hw-muted);
  display: flex;
  align-items: center;
  border-radius: 6px;
  line-height: 0;
}
.hw-input-toggle:hover {
  color: var(--hw-text);
  background: var(--hw-primary-soft);
}
.hw-input-toggle:focus-visible {
  outline: 2px solid var(--hw-primary);
  outline-offset: 1px;
}
.hw-input-toggle svg {
  width: 20px;
  height: 20px;
  display: block;
}

/* Push-notifications enable banner shown on the dashboard. */
.hw-push-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
  background: var(--hw-primary-soft);
  border: 1px solid var(--hw-primary);
  border-radius: 12px;
  color: var(--hw-text);
}
.hw-push-banner .push-msg {
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.hw-push-banner .push-msg-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--hw-primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.hw-push-banner .push-msg-icon svg {
  width: 16px;
  height: 16px;
}
.hw-push-banner .push-actions {
  display: flex;
  gap: 8px;
}

.hw-login-card h1 {
  text-align: center;
  font-size: 22px;
  margin-bottom: 6px;
}

.hw-login-card .hw-login-sub {
  text-align: center;
  color: var(--hw-muted);
  margin-bottom: 24px;
  font-size: 14px;
}

/* ---------- Tables ---------- */

.hw-table-wrap {
  overflow-x: auto;
  border-radius: var(--hw-radius);
  background: var(--hw-card);
  border: 1px solid #eef3f6;
}

.hw-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.hw-table th, .hw-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #eef3f6;
}

.hw-table thead th {
  background: #fafdff;
  font-weight: 600;
  color: var(--hw-text);
  white-space: nowrap;
}

.hw-table tbody tr {
  transition: background .15s ease;
}
.hw-table tbody tr:hover {
  background: var(--hw-primary-soft);
  cursor: pointer;
}

.hw-table tbody tr:last-child td {
  border-bottom: none;
}

/* ---------- Badges ---------- */

.hw-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: #eef3f6;
  color: var(--hw-text);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.hw-badge.urg-routine   { background: #e7f5ff; color: #1971c2; }
.hw-badge.urg-early      { background: #fff9db; color: #b06200; }
.hw-badge.urg-urgent    { background: #fff4e6; color: #d9480f; }
.hw-badge.urg-emergency { background: #fff5f5; color: #c92a2a; }

.hw-badge.st-open        { background: #e7f5ff; color: #1864ab; }
.hw-badge.st-assigned    { background: #fff9db; color: #966200; }
.hw-badge.st-in_progress { background: #fff4e6; color: #d9480f; }
.hw-badge.st-resolved    { background: #ebfbee; color: #2b8a3e; }
.hw-badge.st-closed      { background: #f1f3f5; color: #495057; }

/* ---------- Toasts / alerts ---------- */

.hw-alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  border: 1px solid transparent;
}
.hw-alert.error   { background: #fff5f5; border-color: #ffe3e3; color: #c92a2a; }
.hw-alert.success { background: #ebfbee; border-color: #d3f9d8; color: #2b8a3e; }
.hw-alert.info    { background: #e7f5ff; border-color: #d0ebff; color: #1864ab; }
.hw-alert.warn    { background: #fff9db; border-color: #fff3bf; color: #966200; }

/* ---------- Loading ---------- */

.hw-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(64, 176, 223, 0.2);
  border-top-color: var(--hw-primary);
  border-radius: 50%;
  animation: hw-spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes hw-spin {
  to { transform: rotate(360deg); }
}

.hw-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  gap: 10px;
  color: var(--hw-muted);
}

.hw-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--hw-muted);
}
.hw-empty h3 { color: var(--hw-text); margin-bottom: 6px; }

/* ---------- Stats ---------- */

.hw-stat {
  background: var(--hw-card);
  border: 1px solid #eef3f6;
  border-radius: var(--hw-radius);
  padding: 18px 20px;
}
.hw-stat .hw-stat-label {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--hw-muted);
  letter-spacing: 0.6px;
  margin-bottom: 6px;
}
.hw-stat .hw-stat-value {
  font-family: "B612", sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--hw-text);
}

/* ---------- Utilities ---------- */

.hw-flex { display: flex; }
.hw-flex.gap-8 { gap: 8px; }
.hw-flex.gap-12 { gap: 12px; }
.hw-flex.gap-16 { gap: 16px; }
.hw-flex.between { justify-content: space-between; align-items: center; }
.hw-flex.center { justify-content: center; align-items: center; }
.hw-flex.wrap { flex-wrap: wrap; }
.hw-mt-8  { margin-top: 8px; }
.hw-mt-16 { margin-top: 16px; }
.hw-mt-24 { margin-top: 24px; }
.hw-mb-16 { margin-bottom: 16px; }
.hw-text-right { text-align: right; }
.hw-text-muted { color: var(--hw-muted); }
.hw-hidden { display: none !important; }

/* Modal helper styles — scoped under .hw-modal-backdrop so older page-scoped
   .hw-modal class names (used as backdrop in some pages) keep working. */
.hw-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(17, 17, 17, 0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 16px;
}
.hw-modal-backdrop > .hw-modal {
  background: var(--hw-card);
  border-radius: var(--hw-radius);
  box-shadow: var(--hw-shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 32px);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.hw-modal-backdrop .hw-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #eef3f6;
}
.hw-modal-backdrop .hw-modal-header h3 { margin: 0; font-size: 18px; }
.hw-modal-backdrop .hw-modal-close {
  background: transparent; border: 0;
  font-size: 24px; line-height: 1;
  color: var(--hw-muted);
  cursor: pointer;
  padding: 0 4px;
}
.hw-modal-backdrop .hw-modal-close:hover { color: var(--hw-text); }
.hw-modal-backdrop .hw-modal-body {
  padding: 20px;
  overflow-y: auto;
  color: var(--hw-text);
}
.hw-modal-backdrop .hw-modal-body p { margin: 0 0 8px; }
.hw-modal-backdrop .hw-modal-footer {
  display: flex; gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  padding: 14px 20px;
  border-top: 1px solid #eef3f6;
  background: #fafdff;
}

/* ---------- Role pills (header) ---------- */
.hw-role-pill {
  display: inline-block;
  padding: 3px 11px;
  border-radius: var(--hw-radius-pill);
  font-size: 12px; font-weight: 700; letter-spacing: .3px;
  font-family: "B612", sans-serif;
  text-transform: uppercase;
  margin-left: 4px;
}
.hw-role-pill.role-admin    { background: #5f3dc4; color: #fff; }
.hw-role-pill.role-doctor   { background: #2f9e44; color: #fff; }
.hw-role-pill.role-facility { background: var(--hw-primary); color: #fff; }
