:root{
  --rc-bg:#fbfaf8;
  --rc-surface:#ffffff;
  --rc-text:#111111;
  --rc-muted:#1c1c1b;
  --rc-border:#E6E2DC;
  --rc-sand:#dacfbf;
  --rc-focus:#dacfbf;
  --rc-tint: rgba(218,207,191,0.06);

  --radius-lg:18px;
  --radius-pill:999px;

  --shadow:0 10px 26px rgba(0,0,0,0.06);

  --text-xs:12px;
  --text-sm:13px;
  --text-md:14px;
  --text-lg:18px;
  --text-xl:22px;

  --font-heading: "Montserrat", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  --font-body: "Nunito Sans", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: var(--font-body);
  font-weight: 400;
  color:var(--rc-text);
  background:var(--rc-bg);
}

a{ color:inherit; }

.shell{
  min-height:100%;
  display:flex;
  align-items:flex-start;
  justify-content:center;
  padding:28px 14px;
}

.view{ width:100%; }

.card{
  background:var(--rc-surface);
  border:1px solid var(--rc-border);
  border-radius:var(--radius-lg);
  box-shadow:var(--shadow);
}

.auth-card{
  width:min(520px, 100%);
  margin:0 auto;
  padding:22px;
}

.auth-logo{
  display:block;
  height:65px;
  width:auto;
  margin:0 0 12px 0;
}

.h1{
  margin:0;
  font-family: var(--font-heading);
  font-size:var(--text-xl);
  font-weight: 700;
  letter-spacing:-0.01em;
}
.h2{
  margin:0;
  font-family: var(--font-heading);
  font-size:var(--text-lg);
  font-weight: 700;
  letter-spacing:-0.01em;
}

.hidden { display: none !important; }
.route-auth-action #auth-view,
.route-auth-action #setup-view,
.route-auth-action #app-view { display: none !important; }
.route-auth-action #auth-action-view { display: block !important; }

body.is-booting #auth-view,
body.is-booting #setup-view,
body.is-booting #app-view {
  display: none !important;
}

.overlay{
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(251, 250, 248, 0.92);
  backdrop-filter: blur(4px);
  z-index: 9999;
}
.overlay-card{
  background: var(--rc-surface);
  border: 1px solid var(--rc-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  text-align: center;
  min-width: 240px;
}
.overlay-title{
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.overlay-subtitle{
  margin-top: 6px;
}

.setup-panel .form {
  margin-top: 10px;
}

.setup-panel .row.row-tight {
  margin-top: 10px;
}

.setup-panel--compact {
  width: min(720px, 100%);
  margin: 0 auto;
}

.muted{
  color:rgba(17,17,17,0.70);
  font-size:var(--text-sm);
  font-weight: 400;
  line-height:1.45;
  margin:8px 0 0 0;
}

.form{ margin-top:16px; }
.label{
  display:block;
  font-size:var(--text-xs);
  color:rgba(17,17,17,0.70);
  margin:12px 0 6px;
}
.input, .select{
  width:100%;
  padding:11px 12px;
  border-radius:14px;
  border:1px solid var(--rc-border);
  background:var(--rc-surface);
  font-size:var(--text-md);
  outline:none;
}
.input:focus, .select:focus{
  border-color:rgba(218,207,191,0.90);
  box-shadow:0 0 0 3px rgba(218,207,191,0.25);
}

/* Nav login pill (if you add it to index later) */
.nav__login {
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.65);
}

.nav__login:hover {
  color: var(--text);
}

.row{
  display:flex;
  gap:12px;
  align-items:center;
  justify-content:space-between;
  margin-top:14px;
}
.row-tight{ justify-content:flex-start; }
.row-wrap{ flex-wrap:wrap; justify-content:flex-start; }
.row > *{ flex:1; }
.row > button{ flex:0 0 auto; }

.btn{
  appearance:none;
  border-radius:var(--radius-pill);
  padding:10px 14px;
  border:1px solid var(--rc-border);
  background:var(--rc-surface);
  font-family: var(--font-text);
  font-size:var(--text-sm);
  font-weight:600;
  color:var(--rc-text);
  cursor:pointer;
  transition:background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease, transform 80ms ease, filter 140ms ease;
}
.btn:hover{
  filter:brightness(1.05);
  box-shadow:0 10px 26px rgba(17,17,17,0.10);
}
.btn:active{ transform:translateY(1px); filter:brightness(0.96); }
.btn:disabled{ opacity:0.55; cursor:not-allowed; box-shadow:none; }

.btn-primary{
  background:var(--rc-text);
  color:#fff;
  border-color:var(--rc-text);
}
.btn-primary:hover{ filter:brightness(1.10); }

.btn-secondary{
  background:rgba(218,207,191,0.06);
  border-color:rgba(230,226,220,0.95);
}
.btn-secondary:hover{
  background:rgba(218,207,191,0.14);
  border-color:rgba(218,207,191,0.55);
}
/* Delete button: visible but clearly secondary (not competing with Download) */
.btn-danger{
  background: transparent;
  color: rgba(17,17,17,0.72);
  border-color: rgba(0,0,0,0.18);
  box-shadow: none;
  font-family: var(--font-text);
  font-size:var(--text-sm);
  font-weight: 600;
  margin-top: 2px;
}

.btn-danger:hover{
  background: rgba(0,0,0,0.04);
  border-color: rgba(0,0,0,0.22);
}

.btn-danger:active{
  transform: translateY(1px);
}

.link{
  text-decoration:underline;
  text-underline-offset:3px;
  text-decoration-thickness:1px;
}

.message{
  margin-top:12px;
  font-size:var(--text-sm);
  color:rgba(17,17,17,0.85);
  min-height:18px;
}

.fineprint{
  margin-top:18px;
  padding-top:14px;
  border-top:1px solid var(--rc-border);
  font-size:var(--text-xs);
  color:rgba(17,17,17,0.70);
  display:flex;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}
.fineprint-links{ display:flex; gap:12px; }

/* App shell */
.topbar{
  width:min(1040px, 100%);
  margin:0 auto 14px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
}
.brand{
  display:flex;
  gap:12px;
  align-items:center;
}
.brand-logo{
  width:34px;
  height:34px;
  border-radius:12px;
  border:1px solid var(--rc-border);
  background:#fff;
}
.brand-text{ display:flex; flex-direction:column; }
.brand-name{ font-family: var(--font-heading); font-weight:700; letter-spacing:-0.01em; }
.brand-subtitle{ font-size:var(--text-xs); color:rgba(17,17,17,0.70); margin-top:2px; }
.topbar-right{ display:flex; gap:10px; align-items:center; flex-wrap:wrap; }

.pill{
  display:inline-flex;
  align-items:center;
  border-radius:var(--radius-pill);
  padding:6px 10px;
  border:1px solid var(--rc-border);
  background:rgba(218,207,191,0.06);
  font-size:var(--text-xs);
  color:rgba(17,17,17,0.85);
}

/* Tabs */
.tabs{
  width:min(1040px, 100%);
  margin:0 auto 16px;
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}
.tab{
  border-radius:var(--radius-pill);
  padding:9px 12px;
  border:1px solid var(--rc-border);
  background: var(--rc-surface);
  font-family: var(--font-heading);
  font-size:var(--text-sm);
  font-weight:700;
  cursor:pointer;
  transition:background-color 140ms ease, border-color 140ms ease;
}
/* Hover like Sign out */
.tab:hover{
  background: rgba(0,0,0,0.03);
  box-shadow: 0 10px 26px rgba(17,17,17,0.10);
}

/* Active press */
.tab:active{
  transform: translateY(1px);
  box-shadow: none;
}

/* Panels */
.panel{
  width:min(1040px, 100%);
  margin:0 auto;
  padding:18px;
  border-radius:var(--radius-lg);
  border:1px solid var(--rc-border);
  background:rgba(255,255,255,0.78);
  box-shadow:var(--shadow);
}
.panel + .panel{ margin-top:16px; }
.panel-title{
  font-family: var(--font-heading);
  font-weight:700;
  font-size:var(--text-sm);
}
.panel-head{ margin-bottom:12px; }

/* Users: Admin clinical access panel */
.panel--access .access-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 12px;
  padding: 14px 16px;
  border: 1px solid var(--rc-border);
  border-radius: 14px;
  background: var(--rc-tint);
}


.panel--access .access-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.panel--access .access-status {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 84px;
}

/* Make the status pill feel like a chip, not a big capsule */
.panel--access #admin-clinical-status.pill {
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--rc-border);
  background: var(--rc-surface);
  font-size: var(--text-xs);
  line-height: 1;
  font-weight: 600;
}

/* Tighter note spacing */
.panel--access .access-note {
  margin-top: 10px;
}

/* Notes */
.note{
  border:1px solid var(--rc-border);
  background:rgba(218,207,191,0.08);
  border-radius:14px;
  padding:12px 14px;
  font-size:var(--text-sm);
  color:rgba(17,17,17,0.82);
  margin-top:12px;
}

/* Dashboard */
.dash-actions{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:14px;
  margin-top:14px;
}
.dash-action-card{
  text-align:center;
  display:flex;
  flex-direction:column;
  align-items:center;
  padding:16px;
}
.dash-action-card .btn{
  margin-top:10px;
}
.dash-action-title{
  font-family: var(--font-heading);
  font-weight:700;
  margin-bottom:6px;
}
.dash-action-icon{
  color: var(--rc-text);
  opacity: 0.85;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}
@media (max-width: 720px){
  .dash-actions{ grid-template-columns:1fr; }
}

/* Clinic overview */
.clinic-overview{ margin-top:12px; }
.overview-grid{
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:12px;
  margin-top:12px;
}
.overview-item{
  border:1px solid var(--rc-border);
  background:rgba(255,255,255,0.85);
  border-radius:14px;
  padding:12px;
}
.overview-label{
  font-size:var(--text-xs);
  color:rgba(17,17,17,0.70);
}
.overview-value{
  margin-top:6px;
  font-size:var(--text-md);
  font-weight:600;
}
@media (max-width: 720px){
  .overview-grid{ grid-template-columns:1fr; }
}

/* File picker */
.file-picker{
  display:flex;
  align-items:center;
  gap:10px;
  flex:1;
}
.file-input{
  position:absolute;
  left:-9999px;
  width:1px;
  height:1px;
}
.file-name{
  font-size:var(--text-sm);
  color:rgba(17,17,17,0.70);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  max-width:340px;
}

/* Admin mode surface */
.admin-actions{ margin-top:16px; }

.admin-actions__toggle{
  border-radius: var(--radius-pill);
  padding: 9px 12px;
  border: 1px solid var(--rc-border);
  background: var(--rc-surface);
  font-family: var(--font-heading);
  font-weight: 700;
}
.admin-actions__toggle:hover{
  background: rgba(0,0,0,0.03);
  box-shadow: 0 10px 26px rgba(17,17,17,0.10);
}

.admin-actions__body{
  margin-top:12px;
  padding:14px;
  border-radius:14px;
  border:1px solid rgba(218,207,191,0.55);
  background:rgba(218,207,191,0.06);
}
/* Document list tools */
#admin-search-row{
  margin-top: 12px;
  margin-bottom: 12px;
}

/* Documents list */
.docs-list{
  list-style:none;
  padding:0;
  margin:16px 0 0 0;
  display:flex;
  flex-direction:column;
  gap:12px;
}
.doc{
  display:flex;
  gap:14px;
  align-items:flex-start;
  justify-content:space-between;
  padding:14px 16px;
  border-radius:var(--radius-lg);
  border:1px solid var(--rc-border);
  background:var(--rc-surface);
  box-shadow:var(--shadow);
}
.doc-main{ flex:1; min-width:0; }
.doc-name{
  font-family: var(--font-heading);
  font-weight:700;
  font-size:var(--text-md);
  line-height:1.25;
  word-break:break-word;
  margin-bottom: 6px;
}
.doc-meta{
  font-family: var(--font-body);
  font-weight:400;
  margin-top:8px;
  font-size:var(--text-xs);
  color:rgba(17,17,17,0.72);
  line-height:1.35;
}
.doc-meta > div{
  margin-top: 4px;
}
.meta-k{
  font-family: var(--font-body);
  font-weight: 400; /* label emphasis only */
  display:inline-block;
  min-width:92px;
  color:rgba(17,17,17,0.55);
}
.doc-actions{
  display:flex;
  flex-direction:column;
  align-items:flex-end;
  gap:14px;
  min-width:160px;
}
.doc-download-btn{
  text-decoration: none;
  border: 1px solid var(--rc-border);
  border-radius: var(--radius-pill);
  padding: 8px 12px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--text-sm);
  background: rgba(255,255,255,0.9);
  box-shadow: 0 10px 26px rgba(17,17,17,0.06);
}

.doc-download-btn:hover{
  background: rgba(0,0,0,0.03);
}
.doc-action-note{
  font-size: var(--text-xs);
  color: rgba(17,17,17,0.62);
  text-align: right;
  border: 1px solid var(--rc-border);
  border-radius: 12px;
  padding: 8px 10px;
  background: rgba(218,207,191,0.08);
}
.doc-expiry{
  font-weight: 600;
}

.empty{
  padding:14px 16px;
  border-radius:14px;
  border:1px dashed rgba(0,0,0,0.12);
  background:rgba(255,255,255,0.65);
  color:rgba(17,17,17,0.70);
}

/* Users list */
.users-list{
  list-style:none;
  padding:0;
  margin:12px 0 0 0;
  display:flex;
  flex-direction:column;
  gap:10px;
}
  .user{
    border:1px solid var(--rc-border);
    border-radius:14px;
    padding:12px;
    background:rgba(255,255,255,0.85);
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
  }
  .user-main{ flex:1; min-width:0; }
  .user-actions{ display:flex; align-items:center; gap:8px; }
  .user-actions .btn{ white-space:nowrap; }
.user-name{ font-weight:700; font-size:var(--text-sm); }
.user-meta{ margin-top:6px; font-size:var(--text-xs); color:rgba(17,17,17,0.72); }
/* Activity log (Dashboard) */
.audit-list{
  list-style:none;
  padding:0;
  margin:12px 0 0 0;
  display:flex;
  flex-direction:column;
  gap:10px;
}

.audit-item{
  border:1px solid var(--rc-border);
  border-radius:14px;
  padding:12px;
  background:rgba(255,255,255,0.85);
}

.audit-top{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  align-items:baseline;
  justify-content:space-between;
}

.audit-action{
  font-family: var(--font-heading);
  font-weight:700;
  font-size:var(--text-sm);
}

.audit-when{
  font-size:var(--text-xs);
  color:rgba(17,17,17,0.70);
}

.audit-meta{
  margin-top:6px;
  font-size:var(--text-xs);
  color:rgba(17,17,17,0.72);
  line-height:1.35;
}

/* Invite warning */
.invite-warning{
  border:1px solid rgba(17,17,17,0.14);
  background:var(--rc-tint);
  border-radius:14px;
  padding:12px;
}
.invite-warning-title{ font-weight:500; margin-bottom:6px; }
.invite-warning-controls{
  margin-top:10px;
  padding-top:10px;
  border-top:1px solid rgba(230,226,220,0.95);
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
}

/* Users: visually separate high-risk actions */
.panel--admin-danger {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--rc-border);
  background: transparent;
}


/* Admin invite warning box: calmer, cleaner, less heavy */
.invite-warning--admin {
  border: 1px solid var(--rc-border);
  background: var(--rc-tint);
  border-radius: 14px;
  padding: 16px;
}

.invite-warning--admin .invite-warning-title {
  font-weight: 500;
  margin-bottom: 6px;
}

/* Improve spacing and alignment of the safeguard controls */
.invite-warning--admin .invite-warning-controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(230,226,220,0.8);
}

.invite-warning--admin .invite-warning-controls .checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Hide Invite clinic admin by default (shown only for owner_practitioner) */
#invite-admin-panel {
  display: none;
}

/* Make the typed confirmation feel intentional */
#invite-admin-confirm-text.input {
  max-width: 360px;
}

/* Invite admin form row: keep button compact */
#invite-admin-form .row {
  align-items: center;
}

#invite-admin-submit.btn-primary {
  opacity: 0.9;
}

#invite-admin-submit.btn-primary:hover {
  opacity: 1;
}

.checkbox{
  display:flex;
  gap:8px;
  align-items:center;
  font-size:var(--text-sm);
  color:rgba(17,17,17,0.80);
}
.checkbox input{ width:16px; height:16px; }

:focus-visible{
  outline:2px solid var(--rc-focus);
  outline-offset:2px;
  border-radius:10px;
}
/* 6) Footer styles — add to styles.css */
.trust-footer{
  width:min(1040px, 100%);
  margin:18px auto 0;
  padding:12px 14px 28px;
  font-size:var(--text-sm);
  color:rgba(17,17,17,0.70);
  display:flex;
  flex-direction:column;
  gap:8px;
}
.trust-items{
  display:flex;
  flex-wrap:wrap;
  gap:12px;
}
.trust-items span{ white-space:nowrap; }

.trust-links{
  display:flex;
  gap:12px;
  flex-wrap:wrap;
}
.trust-links a{
  color:rgba(17,17,17,0.70);
  text-decoration:underline;
  text-underline-offset:2px;
}
