:root {
  color-scheme: light;
  --brand: #1f6f43;
  --brand-dark: #185735;
  --brand-tint: #e8f3ed;
  --ink: #1f2430;
  --ink-soft: #5b6472;
  --line: #e6e9ed;
  --bg: #f4f6f8;
  --card: #ffffff;
  --amber: #a15c00;
  --danger: #b3261e;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 30, 20, 0.08), 0 1px 2px rgba(15, 30, 20, 0.04);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

/* ---------- Top navigation ---------- */
.app-header {
  display: flex;
  align-items: center;
  gap: 24px;
  background: var(--brand);
  color: #fff;
  padding: 0 24px;
  height: 56px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}

.brand span {
  font-weight: 400;
  opacity: 0.8;
  font-size: 14px;
  margin-left: 4px;
}

.app-nav {
  display: flex;
  gap: 4px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}

.app-nav::-webkit-scrollbar {
  display: none;
}

.app-nav a {
  white-space: nowrap;
}

.app-nav a {
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  font-size: 14px;
  padding: 6px 14px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}

.app-nav a:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.app-nav a.active {
  background: #fff;
  color: var(--brand-dark);
  font-weight: 600;
}

.user-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-badge {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.25;
}

.user-badge strong {
  font-size: 13px;
  font-weight: 600;
}

.user-badge small {
  font-size: 11px;
  opacity: 0.8;
}

/* ---------- Layout ---------- */
main {
  max-width: 1000px;
  margin: 28px auto;
  padding: 0 20px;
}

.page-title {
  font-size: 22px;
  margin: 0 0 20px;
}

.section-title {
  font-size: 16px;
  margin: 28px 0 14px;
  color: var(--ink-soft);
}

.muted {
  color: var(--ink-soft);
  font-size: 13px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}

.card h2 {
  font-size: 16px;
  margin: 0 0 16px;
}

.card h3 {
  font-size: 14px;
  margin: 18px 0 12px;
}

/* ---------- Login ---------- */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
}

.login-main {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  margin: 0;
}

.login-card {
  width: 100%;
  max-width: 460px;
  margin: 0;
}

.login-brand {
  font-size: 22px;
  font-weight: 700;
  color: var(--brand);
  margin-bottom: 8px;
}

.login-brand span {
  font-weight: 400;
  color: var(--ink-soft);
  font-size: 16px;
}

/* ---------- Hero / dashboard ---------- */
.hero h1 {
  font-size: 24px;
  margin: 0 0 6px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 8px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

a.stat-card:hover {
  box-shadow: 0 2px 8px rgba(15, 30, 20, 0.12);
  transform: translateY(-1px);
}

.stat-card.accent {
  border-color: var(--brand);
  background: var(--brand-tint);
}

.stat-value {
  font-size: 30px;
  font-weight: 700;
  color: var(--brand);
}

.stat-label {
  font-size: 13px;
  color: var(--ink-soft);
}

.stat-hint {
  font-size: 11px;
  color: var(--ink-lighter);
}

.stat-group {
  margin-bottom: 24px;
}

.stat-group-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-grid-inner {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.entry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.entry-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.entry-card:hover {
  transform: translateY(-2px);
  border-color: var(--brand);
  box-shadow: 0 6px 16px rgba(31, 111, 67, 0.14);
}

.entry-icon {
  font-size: 28px;
}

.entry-title {
  font-size: 16px;
  font-weight: 600;
}

.entry-desc {
  font-size: 13px;
  color: var(--ink-soft);
}

/* ---------- Role grid (login) ---------- */
.role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

/* ---------- Buttons ---------- */
button {
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 9px 16px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s;
}

button:hover {
  background: var(--brand-dark);
}

button.secondary {
  background: #eef1f4;
  color: var(--ink);
}

button.secondary:hover {
  background: #e2e6ea;
}

button:disabled {
  background: #b7c4bd;
  cursor: not-allowed;
}

/* ---------- Tables ---------- */
table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

th {
  color: var(--ink-soft);
  font-weight: 600;
  background: #fafbfc;
}

tbody tr:hover {
  background: #fafbfc;
}

code {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  background: #f0f2f4;
  padding: 1px 5px;
  border-radius: 4px;
}

/* ---------- Forms ---------- */
label {
  display: block;
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 12px;
}

textarea,
input,
select {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  margin-top: 4px;
  border: 1px solid #d5d9dd;
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
  color: var(--ink);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(31, 111, 67, 0.12);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0 18px;
}

.form-actions {
  margin-top: 8px;
  display: flex;
  gap: 10px;
}

/* ---------- Status badges ---------- */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.status-draft,
.badge-draft {
  color: var(--amber);
  background: #fdf1de;
}

.status-published,
.badge-published {
  color: var(--brand);
  background: var(--brand-tint);
}

.badge-active {
  color: var(--brand);
  background: var(--brand-tint);
}

.badge-pending {
  color: var(--amber);
  background: #fdf1de;
}

.today-row td {
  background: var(--brand-tint);
  font-weight: 600;
}

.badge-muted {
  color: var(--ink-soft);
  background: #eef1f4;
}

.badge-risk {
  color: var(--danger);
  background: #fbe7e5;
}

.urgent-row td {
  background: #fdf2f1;
}

/* ---------- Order / subscribe ---------- */
.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.plan-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  color: var(--ink);
  transition: border-color 0.15s, background 0.15s;
}

.plan-card:hover {
  border-color: var(--brand);
  background: #fff;
}

.plan-card.selected {
  border-color: var(--brand);
  background: var(--brand-tint);
}

.plan-price {
  font-size: 24px;
  font-weight: 700;
  color: var(--brand);
}

.plan-label {
  font-size: 14px;
  font-weight: 600;
}

.plan-desc {
  font-size: 12px;
  color: var(--ink-soft);
}

.pay-amount {
  font-size: 20px;
  font-weight: 700;
  color: var(--brand);
}

.button-link {
  display: inline-flex;
  align-items: center;
  padding: 9px 16px;
  font-size: 14px;
  color: var(--ink-soft);
  text-decoration: none;
  border-radius: 6px;
}

.button-link:hover {
  background: #eef1f4;
}

.order-card .order-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.order-card .order-head strong {
  margin-right: 8px;
}

.order-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 12px;
}

.mini-table {
  margin-bottom: 10px;
}

.mini-table td {
  padding: 6px 8px;
  font-size: 12px;
}

.request-list {
  margin: 0 0 12px;
  padding-left: 18px;
  font-size: 13px;
  color: var(--ink-soft);
}

.inline-form {
  margin-top: 12px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

/* ---------- Page head with action ---------- */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.page-head .page-title {
  margin-bottom: 20px;
}

/* ---------- Photo / care timeline ---------- */
.photo-preview {
  display: block;
  max-width: 220px;
  max-height: 220px;
  border-radius: 8px;
  margin-top: 10px;
  border: 1px solid var(--line);
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 60vh;
  overflow-y: auto;
}

.timeline-item {
  border-left: 3px solid var(--brand);
  padding: 4px 0 4px 12px;
}

.timeline-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

tr.row-today td {
  background: var(--brand-tint);
}

/* ---------- Binding management ---------- */
.binding-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.check-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 14px;
  color: var(--ink);
}

.check-row input {
  width: auto;
  margin: 0;
}

/* ---------- Estimate box ---------- */
.estimate-box {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--brand-tint);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.estimate-label {
  font-size: 13px;
  color: var(--ink-soft);
}

.estimate-amount {
  font-size: 26px;
  font-weight: 700;
  color: var(--brand);
}

.choice-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0 0 14px;
}

.choice-list legend {
  padding: 0 4px;
  font-size: 13px;
  color: var(--ink-soft);
}

.choice-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
}

.choice-row + .choice-row {
  border-top: 1px solid var(--line);
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 30, 20, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 22px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
}

.modal-title {
  font-size: 16px;
  margin: 0 0 14px;
}

.modal-error {
  margin-bottom: 12px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

/* ---------- Error banner ---------- */
.error-banner {
  background: #fdeceb;
  color: var(--danger);
  border: 1px solid #f2b8b5;
  border-radius: 8px;
  padding: 11px 14px;
  margin-bottom: 16px;
  font-size: 13px;
  display: none;
}

/* ---------- Ops list toolbar / pager ---------- */
.list-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: flex-end;
  margin: 0 0 12px;
  padding: 0;
  border: 0;
}

.list-toolbar label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  font-size: 13px;
  color: var(--ink-soft);
  min-width: 140px;
}

.list-toolbar input,
.list-toolbar select {
  min-width: 160px;
}

.list-toolbar .toolbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.list-meta {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0 0 8px;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}

.pager-meta {
  font-size: 13px;
  color: var(--ink-soft);
}

.stat-hint {
  display: block;
  font-size: 11px;
  color: var(--ink-soft);
  margin-top: 2px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 720px) {
  .two-col {
    grid-template-columns: 1fr;
  }
}

.plain-list {
  list-style: none;
  padding: 0;
  margin: 0 0 8px;
}

.plain-list li {
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.site-footer {
  text-align: center;
  padding: 16px 12px;
  font-size: 12px;
}

.site-footer a {
  color: var(--ink-soft);
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

/* login-page has a dark brand-gradient background; ink-soft is illegible on it */
.login-page .site-footer a {
  color: rgba(255, 255, 255, 0.75);
}

/* ---------- Public marketing pages (index/join) ---------- */
.public-page {
  background: var(--bg);
}

.public-hero {
  text-align: center;
  padding: 32px 0 8px;
}

.public-logo {
  max-width: 320px;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
}

.public-tagline {
  margin: 14px 0 0;
  color: var(--ink-soft);
  font-size: 15px;
}

.public-hero-image {
  display: block;
  width: 100%;
  max-width: 640px;
  height: auto;
  margin: 0 auto 18px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.cta-button {
  display: inline-block;
  margin-top: 10px;
  padding: 10px 20px;
  background: var(--brand);
  color: #fff;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 600;
}

.cta-button:hover {
  background: var(--brand-dark);
}
