/* ---------------------------------------------------------------------------
   Dentix patient portal.

   A dashboard shape wearing the website's clothes: sidebar, stat tiles and
   data panels, but on the site's warm beige ground with the Playfair
   headings and gold hairlines, not the cool grey of the staff dashboard.

   The tokens below are lifted verbatim from site.css so the two never drift.
   The same two rules hold here:

     1. The ground is warm beige and the cards are white.
     2. Gold is a line weight, not a fill.

   Where this differs from the website is density. A patient reading their
   treatment history wants a table, not a landing section - so the rhythm is
   tighter, the display serif is reserved for page and panel titles, and
   everything else is Jakarta.
--------------------------------------------------------------------------- */

:root {
  --navy-900: #00163f;
  --navy-800: #002366;
  --navy-700: #0a3182;
  --navy-600: #10409d;
  --blue-600: #0b52d4;
  --blue-500: #1264f2;
  --blue-300: #7fa9f8;
  --blue-100: #dce8fd;
  --blue-50:  #eff5fe;

  --beige-50:  #fcf9f4;
  --beige-100: #f5eee3;
  --beige-200: #ece0cf;
  --beige-300: #ddcbb1;

  --gold-700: #8a6a16;
  --gold-600: #a8822c;
  --gold-500: #be9442;
  --gold-400: #d4af59;
  --gold-300: #e8cb84;
  --gold-100: #f6ecd6;

  --canvas: var(--beige-100);
  --canvas-soft: var(--beige-50);
  --surface: #ffffff;
  --surface-tint: #f9fbff;

  --ink: #101a33;
  --ink-soft: #414c66;
  --muted: #6c7792;
  --faint: #99a3b8;
  --on-dark: #eef3fb;
  --on-dark-soft: #b9c7e0;

  --line: #e6dccd;
  --line-cool: #dfe7f4;
  --line-strong: #d3c4ad;

  --success: #11795a;
  --success-soft: #e6f4ef;
  --warning: #9a6c08;
  --warning-soft: #fbf1dc;
  --danger: #b4332c;
  --danger-soft: #fbeceb;
  --info: var(--navy-700);
  --info-soft: #e7eefc;

  --r-xs: 0.375rem;
  --r-sm: 0.625rem;
  --r-md: 0.875rem;
  --r-lg: 1.25rem;
  --r-xl: 1.75rem;
  --r-pill: 999px;

  --shadow-xs: 0 1px 2px rgb(16 26 51 / 0.05);
  --shadow-sm: 0 1px 3px rgb(16 26 51 / 0.06), 0 6px 16px -10px rgb(16 26 51 / 0.14);
  --shadow-md: 0 2px 6px rgb(16 26 51 / 0.05), 0 18px 40px -22px rgb(16 26 51 / 0.22);
  --shadow-blue: 0 10px 26px -12px rgb(18 100 242 / 0.55);

  --font-display: "Playfair Display", "Iowan Old Style", Georgia, serif;
  --font-sans: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;

  --side-w: 248px;
}

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

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--blue-600); text-decoration: none; }
a:hover { color: var(--navy-700); }

.pt-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ============================================================ the shell == */

.pt-app { display: flex; min-height: 100vh; }

/* ---------------------------------------------------------------- aside -- */

.pt-side {
  width: var(--side-w); flex: none;
  background: var(--navy-900); color: var(--on-dark);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}

.pt-brand {
  display: flex; flex-direction: column; gap: 0.5rem;
  padding: 1.5rem 1.25rem 1.25rem;
  border-bottom: 1px solid rgb(255 255 255 / 0.1);
}
.pt-brand img { height: 30px; width: auto; filter: brightness(0) invert(1); }
.pt-brand span {
  font-size: 0.625rem; letter-spacing: 0.18em; text-transform: uppercase;
  font-weight: 700; color: var(--gold-300);
}

.pt-side nav { padding: 1rem 0.75rem; flex: 1; overflow-y: auto; }
.pt-side nav a {
  display: flex; align-items: center; gap: 0.6875rem;
  padding: 0.625rem 0.75rem; margin-bottom: 0.125rem;
  border-radius: var(--r-sm); color: var(--on-dark-soft);
  font-size: 0.875rem; font-weight: 600;
}
.pt-side nav a:hover { background: rgb(255 255 255 / 0.07); color: #fff; }
.pt-side nav a.is-active { background: var(--blue-500); color: #fff; box-shadow: var(--shadow-blue); }
.pt-side nav svg { flex: none; }

.pt-side-foot {
  padding: 1.125rem 1.25rem; border-top: 1px solid rgb(255 255 255 / 0.1);
  font-size: 0.8125rem;
}
.pt-side-foot strong { display: block; color: #fff; font-weight: 700; }
.pt-side-foot .pt-mob {
  display: block; color: var(--on-dark-soft); font-size: 0.75rem; margin-bottom: 0.625rem;
}
.pt-side-foot a { display: block; color: var(--gold-300); font-size: 0.8125rem; }
.pt-side-foot a:hover { color: var(--gold-100); }

/* ----------------------------------------------------------------- main -- */

.pt-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.pt-top {
  background: var(--surface); border-bottom: 1px solid var(--line);
  padding: 1.25rem 1.75rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  flex-wrap: wrap;
}
.pt-top-eyebrow {
  display: block; font-family: var(--font-sans);
  font-size: 0.6875rem; letter-spacing: 0.16em; text-transform: uppercase;
  font-weight: 700; color: var(--gold-600); margin-bottom: 0.25rem;
}
.pt-title {
  margin: 0; font-family: var(--font-display); font-weight: 600;
  font-size: 1.5rem; line-height: 1.15; letter-spacing: -0.015em;
  color: var(--navy-800);
}
.pt-top-actions { display: flex; gap: 0.625rem; flex-wrap: wrap; }

.pt-content { padding: 1.75rem; flex: 1; }

/* Hidden on desktop; the only nav on a phone. */
.pt-burger { display: none; }

/* ============================================================== panels == */

.pt-grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  margin-bottom: 1.25rem;
}

.pt-panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-xs);
  margin-bottom: 1.25rem; overflow: hidden;
}
.pt-panel-wide { grid-column: 1 / -1; }

.pt-panel-head {
  padding: 1rem 1.375rem; border-bottom: 1px solid var(--line);
  background: var(--canvas-soft);
}
.pt-panel-head h2 {
  display: flex; align-items: center; gap: 0.5rem; margin: 0;
  font-family: var(--font-display); font-weight: 600; font-size: 1.0625rem;
  color: var(--navy-800); letter-spacing: -0.01em;
}
.pt-panel-head h2 svg { color: var(--gold-600); }
.pt-panel-head p { margin: 0.25rem 0 0; font-size: 0.8125rem; color: var(--muted); }
.pt-panel-body { padding: 1.375rem; }

/* --------------------------------------------------------- stat tiles --- */

.pt-tiles {
  display: grid; gap: 1rem; margin-bottom: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}
.pt-tile {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 1.125rem 1.25rem;
  box-shadow: var(--shadow-xs);
  /* The gold hairline is the one brand flourish on an otherwise plain tile. */
  border-top: 2px solid var(--gold-400);
}
.pt-tile .pt-label {
  display: block; font-size: 0.6875rem; letter-spacing: 0.12em;
  text-transform: uppercase; font-weight: 700; color: var(--muted);
  margin-bottom: 0.375rem;
}
.pt-tile .pt-value {
  font-family: var(--font-display); font-size: 1.5rem; font-weight: 600;
  color: var(--navy-800); line-height: 1.2; letter-spacing: -0.015em;
}
.pt-tile .pt-value-sm { font-size: 1.125rem; }
.pt-tile .pt-sub { font-size: 0.8125rem; color: var(--muted); margin-top: 0.25rem; }
.pt-tile.is-alert { border-top-color: var(--danger); }
.pt-tile.is-alert .pt-value { color: var(--danger); }

.pt-big { margin: 0 0 0.25rem; font-family: var(--font-display);
          font-size: 1.1875rem; font-weight: 600; color: var(--navy-800); }
.pt-quiet { color: var(--muted); font-size: 0.875rem; margin: 0 0 0.5rem; }
.pt-money { font-weight: 700; }
.pt-link { font-size: 0.875rem; font-weight: 700; }
.pt-link:hover { text-decoration: underline; }
.pt-ref {
  font-size: 0.6875rem; color: var(--muted); letter-spacing: 0.06em;
  text-transform: uppercase; font-weight: 700;
}
.pt-h2 {
  margin: 1.75rem 0 0.75rem; font-family: var(--font-display);
  font-size: 1.1875rem; font-weight: 600; color: var(--navy-800);
}
.pt-h3 { margin: 1.25rem 0 0.5rem; font-size: 0.9375rem; font-weight: 700; color: var(--navy-800); }

.pt-dl { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 0.5rem 1.5rem; }
.pt-dl dt {
  font-size: 0.6875rem; letter-spacing: 0.1em; text-transform: uppercase;
  font-weight: 700; color: var(--gold-600);
}
.pt-dl dd { margin: 0; }

/* ============================================================= notices == */

.pt-note {
  padding: 0.9375rem 1.25rem; border-radius: var(--r-md); margin-bottom: 1.25rem;
  font-size: 0.9375rem; border: 1px solid transparent; border-left-width: 3px;
}
.pt-note-ok    { background: var(--success-soft); border-color: #a9d7c7; border-left-color: var(--success); color: #0b5a43; }
.pt-note-warn  { background: var(--warning-soft); border-color: #e2caa0; border-left-color: var(--warning); color: #7a5506; }
.pt-note-error { background: var(--danger-soft);  border-color: #e7b4b0; border-left-color: var(--danger); color: #8d2822; }
.pt-note-info  { background: var(--info-soft);    border-color: #c6d8f8; border-left-color: var(--navy-700); color: var(--navy-700); }
.pt-note-dev   { background: #f3eefc; border-color: #d3c4ef; border-left-color: #6d4fc4; color: #4b3b9c; }
.pt-note code  { font-size: 1.25rem; font-weight: 800; letter-spacing: 0.18em; }

.pt-empty {
  padding: 2rem 1.25rem; text-align: center; color: var(--muted);
  border: 1px dashed var(--line-strong); border-radius: var(--r-md);
  background: var(--canvas-soft); font-size: 0.9375rem;
}

/* ================================================================ data == */

.pt-list { list-style: none; margin: 0; padding: 0; }
.pt-item {
  display: flex; gap: 1rem; align-items: flex-start; justify-content: space-between;
  padding: 0.9375rem 1.375rem; border-bottom: 1px solid var(--line-cool); flex-wrap: wrap;
}
.pt-item:last-child { border-bottom: 0; }
.pt-item:hover { background: var(--surface-tint); }
.pt-item-main { flex: 1 1 240px; display: flex; flex-direction: column; gap: 0.125rem; }
.pt-item-main strong { color: var(--navy-800); font-weight: 700; }
.pt-item-side { display: flex; align-items: center; gap: 0.625rem; flex-wrap: wrap; }
.pt-item-past { opacity: 0.75; }

/* --- Status colour codes. Hue is never the only signal: every chip also
       carries its label in words. --- */
.pt-chip {
  display: inline-block; padding: 0.25rem 0.625rem; border-radius: var(--r-pill);
  font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.04em;
  background: var(--beige-200); color: var(--ink-soft); white-space: nowrap;
  border: 1px solid transparent;
}
.pt-chip-new,
.pt-chip-contacted { background: var(--info-soft); color: var(--navy-700); border-color: #c6d8f8; }
.pt-chip-confirmed { background: var(--blue-100); color: var(--navy-700); border-color: var(--blue-300); }
.pt-chip-completed,
.pt-chip-ok        { background: var(--success-soft); color: var(--success); border-color: #a9d7c7; }
.pt-chip-cancelled,
.pt-chip-no_show   { background: var(--danger-soft); color: var(--danger); border-color: #e7b4b0; }
.pt-chip-progress,
.pt-chip-warn      { background: var(--warning-soft); color: var(--warning); border-color: #e2caa0; }
.pt-chip-plain     { background: var(--gold-100); color: var(--gold-700); border-color: var(--gold-300); }

/* ------------------------------------------------------------ timeline -- */

.pt-timeline { list-style: none; margin: 0; padding: 0; }
.pt-timeline li {
  display: grid; grid-template-columns: 120px 1fr; gap: 1.5rem;
  padding: 1.25rem 1.375rem; border-bottom: 1px solid var(--line-cool);
  position: relative;
}
.pt-timeline li:last-child { border-bottom: 0; }
.pt-when {
  font-size: 0.8125rem; font-weight: 700; color: var(--gold-600);
  letter-spacing: 0.02em; padding-top: 0.125rem;
}
.pt-what h3 {
  margin: 0 0 0.25rem; font-family: var(--font-display); font-size: 1.0625rem;
  font-weight: 600; color: var(--navy-800);
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
}
.pt-what p { margin: 0 0 0.375rem; }

/* ========================================================= tooth chart == */

.pt-chart { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem 2rem; margin: 0 0 1.25rem; }
.pt-quad h3 {
  margin: 0 0 0.5rem; font-size: 0.6875rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--gold-600); font-weight: 700;
}
.pt-teeth { display: flex; gap: 0.25rem; flex-wrap: wrap; }
.pt-tooth {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 42px; border-radius: 8px 8px 12px 12px;
  border: 1px solid var(--line-strong); background: var(--surface);
  font-size: 0.75rem; font-weight: 700; color: var(--ink-soft); cursor: help;
}

/* Condition colour codes, identical to the dashboard chart so a patient and
   their dentist are looking at the same picture. The legend below the chart
   names every colour that actually appears. */
.pt-tooth-none       { background: var(--canvas-soft); color: var(--faint); border-style: dashed; }
.pt-tooth-healthy    { background: var(--success-soft); border-color: #a9d7c7; color: var(--success); }
.pt-tooth-caries     { background: var(--danger-soft);  border-color: #e7b4b0; color: var(--danger); }
.pt-tooth-filled     { background: var(--blue-100); border-color: var(--blue-300); color: var(--navy-700); }
.pt-tooth-crown,
.pt-tooth-bridge     { background: var(--gold-100); border-color: var(--gold-300); color: var(--gold-700); }
.pt-tooth-implant    { background: #ece9f7; border-color: #c3b9e4; color: #4b3b9c; }
.pt-tooth-root_canal { background: #fdeee2; border-color: #eec6a4; color: #9a5a12; }
.pt-tooth-veneer     { background: #e6f6fb; border-color: #a9d8e7; color: #10657e; }
.pt-tooth-impacted   { background: var(--beige-200); border-color: var(--line-strong); color: #6b5a2c; }
.pt-tooth-missing,
.pt-tooth-extracted  { background: var(--beige-200); border-color: var(--line-strong); color: var(--muted);
                       text-decoration: line-through; }
.pt-tooth-watch      { background: var(--warning-soft); border-color: #e2caa0; color: var(--warning); }

.pt-legend {
  list-style: none; margin: 0; padding: 1rem 0 0; border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; font-size: 0.8125rem; color: var(--ink-soft);
}
.pt-legend li { display: flex; align-items: center; gap: 0.4375rem; }
.pt-swatch {
  width: 15px; height: 15px; border-radius: 4px; border: 1px solid var(--line-strong);
  display: inline-block; flex: none;
}
.pt-notes { margin: 0.5rem 0 0; padding-left: 1.125rem; font-size: 0.9375rem; }
.pt-notes li { margin-bottom: 0.375rem; }
.pt-notes .pt-chip { margin: 0 0.375rem; }

/* =============================================================== forms == */

.pt-form { margin: 0; }
.pt-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.25rem; }
.pt-field { margin-bottom: 1.125rem; }
.pt-field label {
  display: block; font-size: 0.75rem; font-weight: 700; margin-bottom: 0.375rem;
  letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-soft);
}
.pt-field input, .pt-field select, .pt-field textarea {
  width: 100%; font: inherit; font-size: 0.9375rem; padding: 0.6875rem 0.875rem;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink);
}
.pt-field textarea { resize: vertical; }
.pt-field input:focus, .pt-field select:focus, .pt-field textarea:focus {
  outline: 2px solid var(--blue-500); outline-offset: 1px; border-color: var(--blue-500);
}
.pt-field small { display: block; margin-top: 0.375rem; font-size: 0.8125rem;
                  color: var(--muted); text-transform: none; letter-spacing: 0; }
.pt-field.has-error input, .pt-field.has-error textarea { border-color: var(--danger); }
.pt-err { color: var(--danger) !important; font-weight: 700; }
.pt-code {
  letter-spacing: 0.45em; font-size: 1.375rem !important; text-align: center;
  font-weight: 700; font-family: var(--font-display);
}

.pt-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  font: inherit; font-size: 0.9375rem; font-weight: 700; min-height: 44px;
  padding: 0.6875rem 1.375rem; border-radius: var(--r-pill);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--navy-800);
  cursor: pointer; transition: transform 0.1s ease, background 0.15s ease;
}
.pt-btn:hover { transform: translateY(-1px); border-color: var(--navy-800); color: var(--navy-800); }
.pt-btn:active { transform: translateY(0); }
.pt-btn-primary { background: var(--blue-500); border-color: var(--blue-500); color: #fff;
                  box-shadow: var(--shadow-blue); }
.pt-btn-primary:hover { background: var(--blue-600); border-color: var(--blue-600); color: #fff; }
.pt-btn-sm { font-size: 0.8125rem; padding: 0.4375rem 0.9375rem; min-height: 36px; }
.pt-btn-block { width: 100%; }

/* =============================================================== login == */

.pt-login-body {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(1200px 500px at 50% -10%, var(--beige-50), transparent 70%),
    var(--canvas);
}
.pt-login { width: 100%; padding: 2.5rem 1.25rem; }
.pt-card {
  max-width: 420px; margin: 0 auto; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-xl);
  padding: 2.25rem 2rem; box-shadow: var(--shadow-md);
  border-top: 3px solid var(--gold-400);
}
.pt-logo { height: 40px; width: auto; margin: 0 auto 1.5rem; }
.pt-card h1 {
  margin: 0 0 0.375rem; font-family: var(--font-display); font-weight: 600;
  font-size: 1.625rem; text-align: center; color: var(--navy-800);
  letter-spacing: -0.015em;
}
.pt-sub { margin: 0 0 1.75rem; text-align: center; color: var(--muted); font-size: 0.9375rem; }
.pt-alt { margin: 1.125rem 0 0; text-align: center; font-size: 0.8125rem; color: var(--muted); }

/* ================================================================ foot == */

.pt-foot {
  padding: 1.5rem 1.75rem 2.5rem; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 0.8125rem; background: var(--canvas-soft);
}
.pt-foot p { margin: 0 0 0.5rem; max-width: 70ch; }

/* ========================================================== responsive == */

@media (max-width: 900px) {
  .pt-app { flex-direction: column; }

  /* The sidebar becomes a top bar with a horizontal scroller, so the nav is
     still one tap away without a drawer and the JavaScript it would need. */
  .pt-side {
    width: 100%; height: auto; position: static; flex-direction: row;
    align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; flex-wrap: wrap;
  }
  .pt-brand { flex-direction: row; align-items: center; gap: 0.625rem;
              padding: 0; border-bottom: 0; }
  .pt-brand span { display: none; }
  .pt-side nav {
    order: 3; width: 100%; padding: 0; display: flex; gap: 0.25rem;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
  }
  .pt-side nav a { white-space: nowrap; margin: 0; }
  .pt-side-foot {
    margin-left: auto; padding: 0; border-top: 0; display: flex;
    align-items: center; gap: 0.75rem;
  }
  .pt-side-foot .pt-mob { display: none; }
  .pt-side-foot strong { font-size: 0.8125rem; }

  .pt-top, .pt-content, .pt-foot { padding-left: 1.25rem; padding-right: 1.25rem; }
}

@media (max-width: 640px) {
  .pt-row { grid-template-columns: 1fr; }
  .pt-chart { grid-template-columns: 1fr; }
  .pt-timeline li { grid-template-columns: 1fr; gap: 0.25rem; }
  .pt-title { font-size: 1.25rem; }
  .pt-item { padding-left: 1.125rem; padding-right: 1.125rem; }
  .pt-panel-body, .pt-panel-head { padding-left: 1.125rem; padding-right: 1.125rem; }
}

/* --- The clinic-team door. Same card, navy rule instead of gold, so a
       dentist can tell at a glance they are not on the patient page. --- */
.pt-card-team { border-top-color: var(--navy-800); }
.pt-btn-navy {
  background: var(--navy-800); border-color: var(--navy-800); color: #fff;
  box-shadow: 0 10px 26px -14px rgb(0 35 102 / 0.7);
}
.pt-btn-navy:hover { background: var(--navy-700); border-color: var(--navy-700); color: #fff; }
.pt-alt-rule { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
