:root {
  color-scheme: light;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f7efe6;
  color: #3e322d;
  font-size: 16px;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html, body {
  min-height: 100%;
}

body {
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at top left, rgba(255, 235, 213, 0.7), transparent 28%),
              radial-gradient(circle at bottom right, rgba(223, 194, 155, 0.35), transparent 22%),
              linear-gradient(180deg, #fbf3ea 0%, #f4e6d8 100%);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.24), transparent 58%);
  pointer-events: none;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle at 20% 15%, rgba(255, 223, 186, 0.25), transparent 16%),
                    radial-gradient(circle at 85% 80%, rgba(206, 170, 120, 0.18), transparent 14%);
  pointer-events: none;
}

.app-shell {
  position: relative;
  max-width: 980px;
  margin: 0 auto;
  padding: 20px 18px 40px;
}

.card {
  position: relative;
  background: #fff9f2;
  border: 1px solid rgba(154, 111, 85, 0.16);
  box-shadow: 0 24px 60px rgba(145, 100, 68, 0.14);
  border-radius: 32px;
  padding: 28px;
  margin-bottom: 24px;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255,255,255,0.55), transparent 72%);
  pointer-events: none;
}

h1, h2 {
  margin: 0 0 14px 0;
  line-height: 1.15;
}

h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  font-family: Georgia, 'Times New Roman', serif;
  letter-spacing: -0.03em;
}

h2 {
  font-size: 1.25rem;
  color: #7b5d47;
  font-family: Georgia, 'Times New Roman', serif;
}

p {
  margin: 0;
  color: #6f5847;
}

label {
  display: block;
  margin: 18px 0 10px;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #7d5f4d;
}

input[type="text"], input[type="password"], input[type="date"], input[type="time"], textarea {
  width: 100%;
  border: 1px solid rgba(158, 120, 92, 0.24);
  border-radius: 22px;
  padding: 16px 18px;
  font: inherit;
  color: #3e322d;
  background: #fffdf8;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  filter: invert(0.18) brightness(1.2);
}

input:focus, textarea:focus {
  outline: none;
  border-color: rgba(176, 132, 96, 0.65);
  box-shadow: 0 0 0 4px rgba(248, 224, 200, 0.42);
}

textarea {
  resize: vertical;
  min-height: 140px;
}

button {
  border: none;
  border-radius: 20px;
  cursor: pointer;
  font: inherit;
  padding: 16px 20px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

button:hover {
  transform: translateY(-1px);
}

button.primary {
  background: linear-gradient(135deg, #c69163, #d6b08d);
  color: #4a3423;
  width: 100%;
  box-shadow: 0 14px 32px rgba(196, 130, 92, 0.22);
}

button.secondary {
  background: #f2dfcb;
  color: #6b4f3b;
  border: 1px solid rgba(156, 112, 78, 0.22);
}

.auth-card {
  max-width: 580px;
  margin: 52px auto 0;
  padding: 36px;
}

.brand-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(186, 143, 106, 0.14);
  color: #856046;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.85rem;
}

.auth-type-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 24px 0 24px;
}

.auth-tab {
  padding: 14px 0;
  border-radius: 18px;
  background: #fff4e8;
  color: #6c4f3d;
  font-weight: 700;
}

.auth-tab.active,
.auth-tab:hover {
  background: linear-gradient(135deg, #dcb48b, #e6c9aa);
  color: #4f341d;
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-switch {
  width: 100%;
  margin-top: 14px;
}

.hint {
  margin-top: 16px;
  color: #8d7060;
  line-height: 1.7;
}

.error-message {
  color: #b24632;
  margin-top: 18px;
  min-height: 1.3em;
}

.screen-header {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.screen-header .header-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

@supports (display: grid) {
  .screen-header {
    grid-template-columns: 1fr auto;
    display: grid;
    align-items: center;
  }
}

.grid.two-column {
  display: grid;
  gap: 20px;
}

.session-summary {
  min-height: 150px;
  padding: 26px;
  border-radius: 32px;
  background: linear-gradient(180deg, rgba(224, 176, 126, 0.16), rgba(255, 255, 255, 0.72));
  color: #5f402f;
  display: grid;
  gap: 14px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.section-header p {
  color: #7d5f4e;
}

.session-list,
.appointment-list,
.shared-writings-list,
.notes-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 16px;
}

.session-item,
.appointment-card,
.writing-card,
.note {
  background: #fff7ef;
  border: 1px solid rgba(163, 123, 88, 0.18);
  border-radius: 28px;
  padding: 20px;
}

.session-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
}

.session-item strong,
.appointment-card strong,
.writing-card strong {
  display: block;
  font-size: 1rem;
  color: #4e372b;
}

.session-item p,
.appointment-card p,
.writing-card p,
.note div {
  color: #6f5444;
  margin-top: 6px;
  line-height: 1.7;
}

.psychologist-info,
.code-card,
.calendar-card,
.summary-card,
.shares-card,
.notes-card {
  overflow: hidden;
}

.psychologist-card,
.next-session,
.form-card,
.session-list-card,
.code-card,
.calendar-card,
.summary-card,
.shares-card,
.notes-card {
  position: relative;
}

.psychologist-info {
  margin-top: 18px;
  padding: 18px;
  border-radius: 24px;
  background: #fff3e8;
  border: 1px solid rgba(163, 120, 92, 0.16);
  color: #5f4234;
}

.code-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.overline {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.8rem;
  color: #8a6950;
}

.psych-code {
  display: block;
  margin-top: 10px;
  font-size: 1.75rem;
  color: #5b3f2f;
}

.code-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
  position: relative;
}

.calendar-day {
  min-height: 72px;
  display: grid;
  align-items: center;
  justify-items: center;
  border-radius: 18px;
  background: #fff8f1;
  color: #6e4f3e;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid rgba(171, 132, 100, 0.18);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.calendar-day:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(141, 99, 68, 0.12);
}

.calendar-day.empty {
  background: transparent;
  border: none;
  cursor: default;
}

.calendar-day.has-appointments {
  background: linear-gradient(180deg, #f5dcc3 0%, #faefde 100%);
  border-color: rgba(170, 112, 60, 0.28);
}

.calendar-day.active {
  background: linear-gradient(135deg, #d8b092, #f1d3b6);
  color: #3f2518;
  box-shadow: 0 14px 26px rgba(163, 113, 71, 0.2);
}

.calendar-day .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #a06243;
  margin-top: 8px;
}

.calendar-popup {
  position: relative;
  margin-top: 18px;
  padding: 20px 22px;
  border-radius: 28px;
  background: #fffaf3;
  border: 1px solid rgba(166, 118, 82, 0.2);
  box-shadow: 0 18px 40px rgba(148, 101, 64, 0.14);
  color: #5a3f2f;
}

.calendar-popup::before {
  content: '';
  position: absolute;
  top: -14px;
  left: 24px;
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-bottom: 14px solid #fffaf3;
}

.popup-list {
  margin-top: 12px;
  display: grid;
  gap: 12px;
}

.popup-patient {
  background: #fff3e8;
  border-radius: 18px;
  padding: 12px 14px;
  border: 1px solid rgba(163, 113, 74, 0.16);
}

.popup-patient p {
  margin: 6px 0 0;
  font-size: 0.95rem;
  color: #725541;
}

.app-footer {
  text-align: center;
  margin: 0 auto;
  padding: 14px 0 24px;
  color: #7a5f4f;
  font-size: 0.95rem;
}

.psychologist-name {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 22px;
  background: #fff6ed;
  border: 1px solid rgba(163, 125, 96, 0.14);
  color: #5b3f2f;
  font-weight: 600;
}

.writing-card {
  background: #fff7ef;
  border: 1px solid rgba(163, 123, 88, 0.18);
  border-radius: 26px;
  padding: 20px;
}

.writing-card time {
  display: block;
  margin-bottom: 10px;
  font-size: 0.92rem;
  color: #7c5c45;
}

.note {
  display: grid;
  gap: 10px;
}

.note time {
  display: block;
  color: #7c5c45;
  font-size: 0.9rem;
}

.note div {
  color: #4f3a2d;
}

.share-button {
  margin-top: 20px;
  width: 100%;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  padding: 14px 20px;
  border-radius: 24px;
  background: rgba(68, 47, 30, 0.92);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 20px 40px rgba(46, 29, 15, 0.24);
  z-index: 1000;
}

.hidden {
  display: none !important;
}

@media (min-width: 720px) {
  .app-shell {
    padding: 32px 28px 48px;
  }

  .card {
    padding: 34px;
  }

  .grid.two-column {
    grid-template-columns: 1.1fr 0.9fr;
  }

  .auth-card {
    padding: 42px;
  }
}

@media (min-width: 980px) {
  .app-shell {
    padding: 40px 32px 56px;
  }

  .auth-card {
    padding: 46px;
  }
}
