:root {
  --primary: #0d665f;
  --primary-dark: #084d48;
  --primary-soft: #e7f4f1;
  --accent: #315f78;
  --background: #f5f7f6;
  --surface: #ffffff;
  --surface-alt: #f8faf9;
  --text: #172422;
  --muted: #5c6a68;
  --border: #d7e0de;
  --success: #18794e;
  --warning: #9a5b00;
  --danger: #b42318;
  --info: #245d7a;
  --shadow: 0 10px 28px rgba(20, 55, 50, 0.09);
  --radius: 18px;
  --radius-small: 12px;
  --tap: 48px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif;
  color: var(--text);
  background: var(--background);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--background); }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top right, rgba(13, 102, 95, 0.08), transparent 28rem),
    var(--background);
  font-size: 17px;
  line-height: 1.72;
  -webkit-text-size-adjust: 100%;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(49, 95, 120, 0.35);
  outline-offset: 2px;
}
a { color: var(--primary-dark); }
[hidden] { display: none !important; }

.app-shell { width: min(100%, 1120px); margin: 0 auto; padding: 0 20px 48px; }
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(215, 224, 222, 0.92);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
}
.header-inner {
  width: min(100%, 1120px);
  min-height: 70px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: white;
  font-weight: 800;
  letter-spacing: .04em;
  flex: 0 0 auto;
}
.brand-copy { min-width: 0; }
.brand-title { margin: 0; font-size: 18px; line-height: 1.25; font-weight: 800; }
.brand-subtitle { margin: 3px 0 0; color: var(--muted); font-size: 13px; line-height: 1.35; }
.header-actions { display: flex; align-items: center; gap: 8px; }

.hero { padding: 34px 0 20px; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(280px, .7fr); gap: 24px; align-items: stretch; }
.hero-panel {
  border-radius: 24px;
  padding: clamp(24px, 5vw, 44px);
  background: linear-gradient(145deg, var(--primary-dark), var(--primary));
  color: white;
  box-shadow: var(--shadow);
}
.eyebrow { margin: 0 0 8px; font-size: 14px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; opacity: .86; }
h1, h2, h3 { line-height: 1.35; }
h1 { margin: 0; font-size: clamp(30px, 6vw, 48px); letter-spacing: -.02em; }
.hero-lead { margin: 18px 0 0; max-width: 42rem; font-size: 18px; line-height: 1.8; color: rgba(255,255,255,.92); }
.hero-note { align-self: stretch; }

.page-heading { padding: 30px 0 14px; }
.page-heading h1 { font-size: clamp(28px, 5vw, 40px); }
.page-heading p { margin: 10px 0 0; color: var(--muted); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.card + .card { margin-top: 18px; }
.card-title { margin: 0; font-size: 22px; }
.card-description { margin: 8px 0 0; color: var(--muted); }
.card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.card-header > div { min-width: 0; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dashboard-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 18px; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; }
.span-8 { grid-column: span 8; }
.span-12 { grid-column: 1 / -1; }

.stat-card { padding: 20px; }
.stat-label { color: var(--muted); font-size: 14px; font-weight: 700; }
.stat-value { margin-top: 6px; font-size: 30px; line-height: 1.2; font-weight: 850; color: var(--primary-dark); }
.stat-note { margin-top: 5px; color: var(--muted); font-size: 14px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.field { display: grid; gap: 7px; }
.field-full { grid-column: 1 / -1; }
.field label { font-weight: 750; font-size: 15px; }
.required { color: var(--danger); font-size: 13px; margin-left: 5px; }
.help { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
input, select, textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 12px 14px;
  border: 1.5px solid #bccbc8;
  border-radius: 12px;
  background: white;
  color: var(--text);
}
textarea { min-height: 140px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #85918f; }

.button-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 22px; }
.button {
  min-height: var(--tap);
  padding: 11px 20px;
  border: 0;
  border-radius: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  cursor: pointer;
  font-weight: 800;
  line-height: 1.3;
}
.button:disabled { cursor: not-allowed; opacity: .55; }
.button-primary { background: var(--primary); color: white; }
.button-primary:hover { background: var(--primary-dark); }
.button-secondary { background: var(--primary-soft); color: var(--primary-dark); border: 1px solid #bddbd6; }
.button-ghost { background: white; color: var(--primary-dark); border: 1px solid var(--border); }
.button-danger { background: #fff0ee; color: var(--danger); border: 1px solid #f3b7b0; }
.button-small { min-height: 42px; padding: 9px 14px; font-size: 15px; }
.button-block { width: 100%; }

.segmented { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 18px 0; }
.segment {
  min-height: 56px;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: white;
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}
.segment[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); }

.alert { border-radius: 14px; padding: 15px 17px; border: 1px solid; line-height: 1.6; }
.alert-info { background: #eef6fa; color: #173f55; border-color: #b8d7e6; }
.alert-success { background: #ecf8f1; color: #14573b; border-color: #addac2; }
.alert-warning { background: #fff7e7; color: #734500; border-color: #efd49a; }
.alert-danger { background: #fff0ee; color: #7b2018; border-color: #efb7b0; }
.alert-title { display: block; margin-bottom: 3px; font-weight: 850; }

.status-pill {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: #edf2f1;
  color: #42514f;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}
.status-scheduled, .status-confirmed { background: #eaf3f8; color: var(--info); }
.status-in_progress { background: #fff3dc; color: var(--warning); }
.status-completed, .status-published, .status-answered { background: #e9f6ee; color: var(--success); }
.status-cancelled, .status-closed { background: #f0f1f1; color: #5c6261; }
.status-urgent { background: #fff0ee; color: var(--danger); }

.list { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.list-item {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-alt);
  padding: 16px;
}
.list-item-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.list-title { margin: 0; font-size: 17px; font-weight: 850; }
.list-meta { margin: 5px 0 0; color: var(--muted); font-size: 14px; }
.list-body { margin: 10px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); border: 1px dashed #bdcbc8; border-radius: 14px; }

.profile-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--primary-soft);
  border: 1px solid #bddbd6;
  border-radius: 16px;
  padding: 17px 19px;
  margin-top: 24px;
}
.profile-name { margin: 0; font-size: 21px; font-weight: 850; }
.profile-meta { margin: 3px 0 0; color: var(--muted); font-size: 14px; }

.quick-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.quick-action {
  min-height: 92px;
  padding: 16px;
  border-radius: 15px;
  border: 1px solid var(--border);
  background: white;
  color: var(--text);
  text-decoration: none;
  display: grid;
  align-content: center;
  gap: 4px;
  cursor: pointer;
}
.quick-action strong { font-size: 16px; }
.quick-action span { color: var(--muted); font-size: 13px; }

.tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.tab-button { min-height: 44px; border: 1px solid var(--border); border-radius: 999px; padding: 8px 15px; background: white; white-space: nowrap; font-weight: 750; cursor: pointer; }
.tab-button[aria-selected="true"] { background: var(--primary); color: white; border-color: var(--primary); }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(7, 24, 22, .58);
}
.modal {
  width: min(100%, 620px);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: white;
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(0,0,0,.28);
  padding: 24px;
}
.modal-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.modal-title { margin: 0; font-size: 24px; }
.icon-button { width: 46px; height: 46px; border-radius: 12px; border: 1px solid var(--border); background: white; cursor: pointer; font-size: 24px; line-height: 1; }

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: rgba(245, 247, 246, .9);
}
.loader-card { display: grid; justify-items: center; gap: 14px; padding: 28px; border-radius: 18px; background: white; box-shadow: var(--shadow); }
.spinner { width: 42px; height: 42px; border: 4px solid #d9e8e5; border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast-region { position: fixed; right: 18px; bottom: 18px; z-index: 90; width: min(390px, calc(100vw - 36px)); display: grid; gap: 10px; }
.toast { border-radius: 14px; padding: 15px 17px; box-shadow: var(--shadow); border: 1px solid; background: white; }
.toast-success { border-color: #addac2; color: #14573b; }
.toast-error { border-color: #efb7b0; color: #7b2018; }

.footer { padding: 32px 0 10px; color: var(--muted); text-align: center; font-size: 13px; }
.code-note { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; overflow-wrap: anywhere; }

@media (max-width: 820px) {
  .hero-grid, .grid-2, .grid-3, .form-grid { grid-template-columns: 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-grid > * { grid-column: 1 / -1 !important; }
  .quick-actions { grid-template-columns: 1fr; }
  .hero { padding-top: 24px; }
  .header-inner { min-height: 64px; }
  .brand-subtitle { display: none; }
  .card { padding: 20px; }
}

@media (max-width: 520px) {
  body { font-size: 16px; }
  .app-shell { padding-left: 14px; padding-right: 14px; }
  .header-inner { padding-left: 14px; padding-right: 14px; }
  .brand-title { font-size: 16px; }
  .brand-mark { width: 40px; height: 40px; }
  .hero-panel { border-radius: 20px; padding: 24px 20px; }
  .card { padding: 18px; border-radius: 16px; }
  .segmented { grid-template-columns: 1fr; }
  .button-row > .button { width: 100%; }
  .profile-strip { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* STEP HOMECARE-12: UI/UX横断ブラッシュアップ */
:root { --tap: 50px; }
.button-small,
.tab-button {
  min-height: 48px;
  font-size: 16px;
}
.status-pill {
  min-height: 30px;
  font-size: 14px;
}
.quick-action strong { font-size: 17px; }
.quick-action span,
.help,
.list-meta,
.profile-meta { font-size: 14px; }
@media (max-width: 520px) {
  body { font-size: 17px; }
  .brand-title { font-size: 17px; }
  .button-row > .button { min-height: 52px; }
}
