/* T Care — Phase 0 base styles
   Mobile-first, RTL, no web fonts, no external assets.
   Palette is intentionally neutral/temporary — branding is pending review. */

/* ---------- tokens ---------- */
:root {
  --bg:        #f4f5f6;
  --surface:   #ffffff;
  --surface-2: #eceef0;
  --text:      #1b1d21;
  --muted:     #6a6f78;
  --line:      #dfe2e6;
  --accent:    #2f6f6a;
  --accent-ink:#ffffff;
  --danger:    #a8362f;

  --radius:   14px;
  --radius-s: 10px;
  --tap:      48px;

  --gap:   12px;
  --pad:   16px;
  --stack: 10px;

  --shadow: 0 1px 2px rgba(16, 20, 24, .06), 0 4px 14px rgba(16, 20, 24, .05);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #141619;
    --surface:   #1d2025;
    --surface-2: #262a30;
    --text:      #eceef1;
    --muted:     #9aa1ab;
    --line:      #333941;
    --accent:    #5fada6;
    --accent-ink:#10201e;
    --danger:    #e08078;
    --shadow: none;
  }
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Noto Naskh Arabic", "Geeza Pro", system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

h1, h2, h3, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  inset-inline-start: -9999px;
  top: 0;
  z-index: 10;
  padding: 10px 14px;
  background: var(--surface);
  color: var(--text);
}
.skip-link:focus { inset-inline-start: 0; }

/* Available to assistive tech, removed from the visual layout. */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- layout ---------- */
.shell {
  max-width: 480px;
  margin-inline: auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 56px;
  padding: env(safe-area-inset-top) var(--pad) 0;
  padding-block-end: 0;
  background: var(--bg);
  border-block-end: 1px solid transparent;
}

.topbar__title {
  font-size: 1.0625rem;
  font-weight: 650;
  letter-spacing: .2px;
}

.topbar__back {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-inline-start: -10px;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
.topbar__back:active { background: var(--surface-2); }
.topbar__back svg { width: 22px; height: 22px; }
.topbar__back[hidden] { display: none; }

.main {
  flex: 1;
  padding: 4px var(--pad) calc(28px + env(safe-area-inset-bottom));
}
.main:focus { outline: none; }

/* ---------- typography blocks ---------- */
.view__title {
  font-size: 1.375rem;
  font-weight: 700;
  line-height: 1.35;
  margin-block: 8px 4px;
}

.view__lead {
  color: var(--muted);
  font-size: .9375rem;
  margin-block-end: 18px;
}

.section {
  margin-block-start: 22px;
}

.section__label {
  font-size: .875rem;
  font-weight: 650;
  color: var(--muted);
  margin-block-end: var(--stack);
}

.hint {
  font-size: .8125rem;
  color: var(--muted);
  line-height: 1.55;
}

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--pad);
  box-shadow: var(--shadow);
}

.card--quiet {
  background: var(--surface-2);
  border-color: transparent;
  box-shadow: none;
}

.appointment__label {
  font-size: .8125rem;
  color: var(--muted);
}
.appointment__date {
  font-size: 1.25rem;
  font-weight: 700;
  margin-block-start: 2px;
}

/* ---------- buttons ---------- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: var(--tap);
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  background: var(--surface);
  color: var(--text);           /* anchors styled as buttons must not go link-blue */
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform .06s ease;
}
.btn:active { transform: scale(.985); }

.btn--primary {
  min-height: 56px;
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-size: 1.0625rem;
  font-weight: 700;
}

.btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  font-weight: 600;
}

.btn--danger {
  width: auto;
  min-height: 36px;
  padding: 6px 12px;
  border-color: transparent;
  background: transparent;
  color: var(--danger);
  font-size: .875rem;
}

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

.btn-stack {
  display: flex;
  flex-direction: column;
  gap: var(--stack);
}

/* ---------- link rows ---------- */
.rows {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--tap);
  padding: 12px var(--pad);
  text-decoration: none;
  color: inherit;
  background: none;
  border: 0;
  border-block-end: 1px solid var(--line);
  cursor: pointer;
  text-align: start;
}
.row:last-child { border-block-end: 0; }
.row:active { background: var(--surface-2); }

.row__text { flex: 1; font-weight: 600; }

/* The glyph is drawn pointing right; "forward" in RTL is left, so mirror it.
   The topbar back chevron is NOT mirrored — back in RTL does point right. */
.row__chev {
  width: 18px;
  height: 18px;
  color: var(--muted);
  flex: none;
  transform: scaleX(-1);
}

/* ---------- choice chips / grid ---------- */
.choices {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--gap);
}

.choices--levels {
  grid-template-columns: repeat(3, 1fr);
}

.choice {
  min-height: var(--tap);
  padding: 12px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}
.choice:active { background: var(--surface-2); }

.choice[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

/* ---------- form fields ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field__input {
  width: 100%;
  min-height: var(--tap);
  padding: 12px 14px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  font: inherit;
  text-align: start;
}

/* ---------- history list ---------- */
.entry {
  display: flex;
  align-items: center;
  gap: var(--gap);
  padding: 12px var(--pad);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.entry__main { flex: 1; min-width: 0; }
.entry__area { font-weight: 650; }
.entry__meta {
  font-size: .8125rem;
  color: var(--muted);
  margin-block-start: 2px;
}

.list {
  display: flex;
  flex-direction: column;
  gap: var(--stack);
}

/* ---------- empty state ---------- */
.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
}
.empty__title {
  font-weight: 650;
  color: var(--text);
  margin-block-end: 6px;
}

/* ---------- success mark ---------- */
.success {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  color: var(--accent);
  margin-block: 8px 4px;
}
.success svg { width: 26px; height: 26px; flex: none; }

/* ---------- footnote ---------- */
.footnote {
  margin-block-start: 26px;
  padding-block-start: 14px;
  border-block-start: 1px solid var(--line);
  font-size: .8125rem;
  color: var(--muted);
  text-align: center;
}

/* ---------- inline messages ---------- */
.notice {
  margin-block-start: 18px;
  padding: 10px 14px;
  border-radius: var(--radius-s);
  font-size: .9375rem;
  font-weight: 600;
}
.notice[hidden] { display: none; }

.notice--error {
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
  color: var(--danger);
}

/* ---------- install hint steps ---------- */
.steps {
  margin-block-start: 14px;
  padding-inline-start: 20px;
  list-style: decimal;
}
.steps li { margin-block-end: 4px; }
.steps[hidden] { display: none; }

/* ---------- delete confirmation ---------- */
.entry__actions { flex: none; }

.confirm {
  display: flex;
  align-items: center;
  gap: 6px;
}

.confirm__text {
  font-size: .8125rem;
  color: var(--muted);
  white-space: nowrap;
}

.btn--quiet-sm {
  width: auto;
  min-height: 36px;
  padding: 6px 12px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-size: .875rem;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
