:root {
  color-scheme: light;
  --bg: #f7efe4;
  --bg-secondary: #fbf8f3;
  --panel: rgba(255, 255, 255, 0.9);
  --panel-strong: #fffdf9;
  --line: rgba(139, 101, 63, 0.18);
  --text: #2e241c;
  --muted: #76695c;
  --accent: #c96f3b;
  --accent-deep: #9a4e23;
  --accent-soft: #f6e2cf;
  --success: #557b59;
  --danger: #b44c3b;
  --shadow: 0 18px 60px rgba(88, 62, 35, 0.12);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --font-sans: "Hiragino Sans", "Yu Gothic", sans-serif;
  --font-serif: "Hiragino Mincho ProN", "Yu Mincho", Georgia, serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font-sans);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.36), rgba(255, 255, 255, 0.1)),
    var(--bg);
  position: relative;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.bg-orb {
  position: fixed;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  filter: blur(8px);
  pointer-events: none;
  z-index: 0;
}

.bg-orb-left {
  top: -90px;
  left: -70px;
  background: radial-gradient(circle, rgba(201, 111, 59, 0.22), rgba(201, 111, 59, 0));
}

.bg-orb-right {
  top: 10%;
  right: -80px;
  background: radial-gradient(circle, rgba(121, 147, 104, 0.18), rgba(121, 147, 104, 0));
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 1120px);
  margin: 0 auto;
  padding: 20px 16px 110px;
}

.patient-shell {
  max-width: 760px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.topbar h1,
.hero-card h2,
.panel h2,
.panel h3,
.panel h4 {
  font-family: var(--font-serif);
  letter-spacing: 0.03em;
}

.topbar h1,
.hero-card h2 {
  margin: 0;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: var(--accent-deep);
  font-weight: 700;
}

.page-stack {
  display: grid;
  gap: 16px;
}

.auth-layout {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}

.single-column {
  max-width: 760px;
}

.hero-card,
.panel,
.modal-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.hero-card {
  padding: 26px 22px;
  overflow: hidden;
  position: relative;
}

.hero-card::after {
  content: "";
  position: absolute;
  right: -30px;
  bottom: -34px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201, 111, 59, 0.18), rgba(201, 111, 59, 0));
}

.panel,
.modal-card {
  padding: 22px 18px;
}

.welcome-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.welcome-copy {
  min-width: 0;
}

.body-profile-home {
  display: grid;
  gap: 8px;
  width: 150px;
  flex: 0 0 150px;
  padding: 0;
  overflow: hidden;
  border-radius: 18px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  text-align: left;
}

.body-profile-home > span:first-child {
  padding: 10px 12px 0;
  color: var(--accent-deep);
  font-size: 0.76rem;
  font-weight: 700;
}

.body-profile-home img {
  width: 100%;
  height: 188px;
  object-fit: cover;
}

.body-profile-home-empty {
  display: grid;
  place-items: center;
  min-height: 188px;
  padding: 14px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.6;
  text-align: center;
}

.body-profile-field {
  display: grid;
  gap: 12px;
  padding-top: 8px;
}

.body-profile-field h4 {
  margin: -8px 0 0;
}

.body-profile-field .support-copy {
  margin: 0;
}

.body-profile-preview,
.body-profile-empty {
  width: min(100%, 280px);
  min-height: 180px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-strong);
}

.body-profile-preview img {
  width: 100%;
  height: 280px;
  object-fit: cover;
}

.body-profile-empty {
  display: grid;
  place-items: center;
  padding: 16px;
  color: var(--muted);
  text-align: center;
}

.support-copy,
.meta-text,
.helper-text,
.empty-state,
.notice,
.flash {
  color: var(--muted);
  line-height: 1.7;
}

.notice,
.flash {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(255, 253, 249, 0.94);
}

.flash {
  color: var(--text);
}

.stack-form,
.list-stack,
.screen,
.mobile-nav,
.desktop-nav {
  display: grid;
  gap: 14px;
}

.card-large {
  padding: 22px 18px;
}

.accent-card {
  background: linear-gradient(180deg, rgba(246, 226, 207, 0.8), rgba(255, 255, 255, 0.94));
}

.card-head,
.toolbar-row,
.action-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.two-column,
.three-column,
.admin-grid {
  display: grid;
  gap: 12px;
}

.auth-card {
  max-width: 640px;
}

.segmented {
  display: inline-grid;
  grid-template-columns: repeat(2, 1fr);
  border-radius: 999px;
  padding: 4px;
  background: var(--accent-soft);
  margin-bottom: 18px;
}

.segment,
.nav-pill {
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.segment.is-active,
.nav-pill.is-active {
  background: #fff;
  color: var(--accent-deep);
  box-shadow: 0 8px 20px rgba(108, 75, 39, 0.1);
}

.mobile-nav {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  position: sticky;
  bottom: 12px;
  z-index: 5;
  padding: 8px;
  border-radius: 24px;
  background: rgba(255, 252, 247, 0.92);
  border: 1px solid var(--line);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.desktop-nav {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 7px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(139, 101, 63, 0.22);
  border-radius: 16px;
  padding: 14px 15px;
  background: rgba(255, 253, 249, 0.98);
  color: var(--text);
}

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

.primary-button,
.secondary-button,
.ghost-button,
.icon-button {
  min-height: 48px;
  border-radius: 999px;
  padding: 12px 18px;
  transition: transform 150ms ease, opacity 150ms ease, background 150ms ease;
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.icon-button:hover,
.segment:hover,
.nav-pill:hover {
  transform: translateY(-1px);
}

.primary-button {
  background: linear-gradient(180deg, var(--accent), var(--accent-deep));
  color: #fff;
  font-weight: 700;
}

.primary-button-large {
  min-height: 56px;
  font-size: 1rem;
}

.secondary-button {
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-weight: 700;
}

.ghost-button,
.icon-button {
  background: rgba(255, 255, 255, 0.76);
  color: var(--text);
  border: 1px solid var(--line);
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
}

.chip-soft {
  background: rgba(201, 111, 59, 0.12);
  color: var(--accent-deep);
}

.screen {
  display: none;
}

.screen.is-active {
  display: grid;
}

.list-card,
.detail-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel-strong);
  padding: 16px;
}

.list-card h4,
.detail-card h4 {
  margin: 0;
}

.list-card p,
.detail-card p,
.article-body p {
  margin: 8px 0 0;
}

.list-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--danger);
}

.status-dot.is-ok {
  background: var(--success);
}

.video-frame {
  aspect-ratio: 16 / 9;
  border-radius: 20px;
  overflow: hidden;
  background: rgba(118, 105, 92, 0.08);
  margin-bottom: 16px;
}

.video-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.photo-thumb {
  width: 100%;
  max-width: 220px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  margin-top: 12px;
}

.photo-thumb img {
  width: 100%;
  height: auto;
  object-fit: contain;
}

.modal {
  width: min(92vw, 760px);
  border: 0;
  padding: 0;
  background: transparent;
}

.modal::backdrop {
  background: rgba(44, 31, 17, 0.34);
}

.article-body {
  white-space: pre-wrap;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 120px;
  text-align: center;
  border: 1px dashed rgba(139, 101, 63, 0.28);
  border-radius: 18px;
  padding: 18px;
}

@media (min-width: 720px) {
  .two-column {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .three-column {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .admin-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 719px) {
  .topbar,
  .welcome-panel,
  .card-head,
  .toolbar-row,
  .action-row {
    flex-direction: column;
    align-items: stretch;
  }

  .body-profile-home {
    width: 100%;
    flex-basis: auto;
  }

  .body-profile-home img,
  .body-profile-home-empty {
    height: 260px;
  }

  .mobile-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .app-shell {
    padding: 16px 12px 110px;
  }

  .hero-card,
  .panel,
  .modal-card {
    border-radius: 22px;
    padding: 18px 16px;
  }

  .mobile-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
