:root {
  --ink: #f3ead6;
  --muted: #b8aa8e;
  --line: rgba(211, 169, 90, 0.22);
  --panel: rgba(24, 25, 22, 0.88);
  --panel-soft: rgba(34, 35, 30, 0.78);
  --bg: #0d0e0c;
  --teal: #4f9f98;
  --green: #6f9d68;
  --gold: #c99a4d;
  --gold-soft: #e3c47d;
  --coral: #d7765e;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Noto Sans Thai", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 0%, rgba(201, 154, 77, 0.13), transparent 28%),
    radial-gradient(circle at 90% 16%, rgba(79, 159, 152, 0.09), transparent 32%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 220px),
    var(--bg);
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.sidebar {
  padding: 28px 20px;
  background:
    linear-gradient(180deg, rgba(20, 21, 18, 0.94), rgba(11, 12, 10, 0.96)),
    url("assets/medaka-daily-banner.png") center / cover;
  border-right: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 34px;
}

.brand-logo {
  width: 58px;
  height: 58px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(227, 196, 125, 0.45);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.brand h1, .topbar h2, .panel h3, .form-panel h3 {
  margin: 0;
  letter-spacing: 0;
}

.brand h1 { font-size: 20px; color: var(--gold-soft); }
.brand p, .eyebrow, .panel-head span, .metric small { color: var(--muted); margin: 0; }

.nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 13px 14px;
  text-align: left;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.nav-item.active, .nav-item:hover {
  background: rgba(201, 154, 77, 0.14);
  color: var(--gold-soft);
}

.main {
  padding: 28px;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.eyebrow {
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 800;
  color: var(--gold-soft);
}

.topbar h2 { font-size: clamp(28px, 4vw, 42px); }

.top-actions, .panel-head, .form-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.primary-button, .ghost-button {
  border: 0;
  border-radius: 8px;
  min-height: 42px;
  padding: 10px 16px;
  font-weight: 800;
}

.primary-button {
  background: linear-gradient(135deg, #a86d2e, var(--gold));
  color: #17130c;
}
.ghost-button {
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  border: 1px solid var(--line);
}

.farm-hero {
  position: relative;
  min-height: 300px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  border: 1px solid rgba(227, 196, 125, 0.28);
  border-radius: 8px;
  margin-bottom: 18px;
  background:
    linear-gradient(90deg, rgba(8, 9, 8, 0.72), rgba(8, 9, 8, 0.22) 52%, rgba(8, 9, 8, 0.74)),
    linear-gradient(0deg, rgba(8, 9, 8, 0.82), transparent 58%),
    #0b0c0a url("assets/medaka-daily-banner.png") center / contain no-repeat;
  box-shadow: var(--shadow);
}

.farm-hero-content {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 24px;
}

.farm-hero-content img {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(227, 196, 125, 0.55);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.42);
}

.farm-hero-content h3 {
  margin: 2px 0 2px;
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1.05;
  color: var(--gold-soft);
  letter-spacing: 0;
}

.farm-hero-content span {
  color: #dfd1b2;
  font-weight: 700;
}

.view { display: none; }
.view.active { display: block; }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.metric, .panel, .form-panel, .table-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric { padding: 20px; }
.metric span { display: block; color: var(--muted); font-weight: 700; }
.metric strong { display: block; font-size: 38px; line-height: 1; margin: 10px 0; }
.metric.urgent strong { color: var(--coral); }
.metric.money strong { color: var(--gold-soft); font-size: 30px; }

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 18px;
}

.today-tasks-panel { grid-column: 1 / -1; }

.today-task-list {
  display: grid;
  gap: 8px;
}

.today-task {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0 12px 12px;
  border-left: 3px solid var(--teal);
  border-bottom: 1px solid var(--line);
}

.today-task:last-child { border-bottom: 0; }
.today-task.urgent { border-left-color: var(--coral); }
.today-task.warning { border-left-color: var(--gold); }
.today-task strong { display: block; }
.today-task p { margin: 4px 0 0; color: var(--muted); }
.today-task.urgent strong { color: #ed9a86; }
.today-task.warning strong { color: var(--gold-soft); }
.today-task .compact-button { flex: 0 0 auto; }

.calendar-panel { min-height: 460px; }
.calendar-head > div { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.calendar-head > div:first-child { display: block; }
.calendar-controls input { width: 150px; min-height: 36px; padding: 7px 9px; }
.calendar-list { display: grid; gap: 14px; }
.calendar-day { border-top: 1px solid var(--line); padding-top: 12px; }
.calendar-day:first-child { border-top: 0; padding-top: 0; }
.calendar-day h4 { margin: 0 0 8px; color: var(--gold-soft); font-size: 15px; }
.calendar-events { display: grid; gap: 8px; }
.calendar-event { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 0 11px 12px; border-left: 3px solid var(--teal); border-bottom: 1px solid var(--line); }
.calendar-event.hatch { border-left-color: var(--gold); }
.calendar-event.grading { border-left-color: var(--green); }
.calendar-event.overdue { border-left-color: var(--coral); }
.calendar-event strong { display: block; }
.calendar-event p, .calendar-event small { margin: 4px 0 0; color: var(--muted); }
.calendar-event.overdue strong, .calendar-event.overdue small { color: #ed9a86; }

.panel, .form-panel, .table-panel { padding: 18px; }

.panel-head {
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.pond-map {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
}

.pond-tile, .fish-card, .qr-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel-soft);
}

.interactive-card,
.interactive-row {
  cursor: pointer;
}

.interactive-card:hover,
.interactive-card:focus-visible,
.interactive-row:hover,
.interactive-row:focus-visible {
  outline: 2px solid rgba(227, 196, 125, 0.72);
  outline-offset: 2px;
  background: rgba(201, 154, 77, 0.13);
}

.pond-thumb, .fish-thumb {
  width: 100%;
  height: 118px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 12px;
  border: 1px solid rgba(227, 196, 125, 0.24);
  background: rgba(255, 255, 255, 0.04);
}

.table-thumb {
  width: 62px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(227, 196, 125, 0.24);
  vertical-align: middle;
}

.pond-tile strong, .fish-card strong { display: block; font-size: 18px; }
.water-cycle { color: var(--gold-soft) !important; font-weight: 800; }
.line-performance-head { margin-top: 22px; }
.photo-timeline { display: grid; gap: 12px; }
.photo-timeline-item { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.photo-timeline-item:last-child { border-bottom: 0; }
.photo-timeline-item strong { display: block; }
.photo-timeline-item p, .photo-timeline-item time { display: block; margin: 5px 0 0; color: var(--muted); }
.photo-timeline-image { width: 130px; height: 96px; object-fit: cover; border-radius: 8px; border: 1px solid rgba(227, 196, 125, 0.24); }
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 800;
  background: rgba(111, 157, 104, 0.16);
  color: #9fc891;
}

.readiness-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  background: rgba(201, 154, 77, 0.16);
  color: var(--gold-soft);
  font-size: 13px;
  font-weight: 800;
}

.split-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 18px;
  align-items: start;
}

form {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
}

input::placeholder, textarea::placeholder { color: rgba(184, 170, 142, 0.66); }
select option { background: #171815; color: var(--ink); }
input[readonly] {
  color: var(--gold-soft);
  background: rgba(201, 154, 77, 0.1);
}

input[type="file"] {
  padding: 8px;
}

.image-preview {
  min-height: 150px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  font-weight: 700;
}

.image-preview img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
}

.empty-preview {
  padding: 18px;
  text-align: center;
}

textarea { resize: vertical; }
.form-row > label { flex: 1; }

.egg-module-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.egg-module-summary > div {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px;
  background: var(--surface);
}

.egg-module-summary strong,
.egg-module-summary span { display: block; }
.egg-module-summary span { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }

.lifecycle-list { display: grid; gap: 8px; }

.lifecycle-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.lifecycle-row:last-child { border-bottom: 0; }
.lifecycle-row span { color: var(--muted); text-align: right; }

.form-note { min-height: 18px; margin: -2px 0 4px; color: var(--muted); font-size: 13px; }
.form-note.warning { color: #ed9a86; font-weight: 700; }
.health-treatment-layout { margin-top: 16px; }
.performance-grading-layout { margin-top: 16px; }
.inventory-movement-layout { margin-top: 16px; }
.status-pill.stock-low { background: rgba(214, 104, 81, 0.18); color: #ed9a86; }

.quick-pond-fieldset { border: 0; padding: 0; margin: 0; }
.quick-pond-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.quick-pond-label { font-weight: 800; }
.quick-pond-head > div { display: flex; gap: 8px; }
.text-button { border: 0; padding: 0; color: var(--gold-soft); background: transparent; font: inherit; font-size: 13px; font-weight: 800; cursor: pointer; }
.quick-pond-list { display: grid; gap: 8px; }
.quick-pond-option { display: flex; align-items: center; gap: 8px; padding: 9px; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.quick-pond-option input { width: auto; }
.quick-log-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.quick-action { min-height: 44px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-soft); color: var(--muted); font-weight: 800; }
.quick-action.active { background: rgba(201, 154, 77, 0.18); color: var(--gold-soft); border-color: rgba(227, 196, 125, 0.42); }
.quick-fields.hidden { display: none; }
.quick-last-note { min-height: 18px; margin: -2px 0 2px; color: var(--muted); font-size: 13px; }
.quick-reuse-button { justify-self: start; min-height: 36px; padding: 7px 11px; font-size: 13px; }
.quick-save-status { min-height: 18px; margin: 0; color: var(--gold-soft); font-size: 13px; font-weight: 700; }
.quick-water-alert { display: grid; gap: 6px; margin-top: 10px; padding: 10px 12px; border: 1px solid rgba(214, 104, 81, 0.6); border-left: 3px solid var(--coral); border-radius: 6px; background: rgba(214, 104, 81, 0.12); }
.quick-water-alert p { margin: 0; color: #ed9a86; font-size: 13px; font-weight: 800; }

.quick-action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.quick-action-grid .ghost-button {
  min-height: 48px;
  justify-content: center;
}

.search {
  max-width: 280px;
  min-height: 40px;
}

.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
}

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

th { color: var(--muted); font-size: 13px; }

.row-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.icon-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--gold-soft);
  border-radius: 8px;
  min-width: 36px;
  height: 36px;
}

.compact-button {
  min-height: 36px;
  padding: 7px 11px;
  font-size: 13px;
}

.ai-analysis {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(227, 196, 125, 0.28);
  border-radius: 8px;
  background: rgba(201, 154, 77, 0.1);
  text-align: left;
}

.ai-analysis-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.ai-analysis-head strong {
  color: var(--gold-soft);
}

.ai-analysis-head span,
.ai-analysis small {
  color: var(--muted);
  font-weight: 800;
}

.ai-analysis p {
  margin: 7px 0 0;
}

.detail-modal {
  width: min(780px, calc(100% - 28px));
  max-height: min(860px, calc(100vh - 28px));
  padding: 0;
  color: var(--ink);
  border: 1px solid rgba(227, 196, 125, 0.42);
  border-radius: 8px;
  background: #171815;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.62);
}

.detail-modal::backdrop {
  background: rgba(3, 4, 3, 0.74);
  backdrop-filter: blur(3px);
}

.detail-modal-shell {
  max-height: inherit;
  overflow: auto;
}

.detail-modal-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: #1b1c18;
}

.detail-modal-head h3 {
  margin: 2px 0 0;
  color: var(--gold-soft);
  font-size: 23px;
  overflow-wrap: anywhere;
}

.detail-modal-content {
  padding: 20px;
}

.detail-modal-top {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.compact-detail-top {
  grid-template-columns: 1fr;
}

.detail-modal-image {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border: 1px solid rgba(227, 196, 125, 0.3);
  border-radius: 8px;
  background: var(--panel-soft);
}

.zoomable-image {
  cursor: zoom-in;
}

.zoomable-image:hover {
  border-color: rgba(227, 196, 125, 0.7);
  filter: brightness(1.06);
}

.detail-modal-image-empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 800;
}

.image-modal {
  width: min(1040px, calc(100% - 24px));
  max-height: calc(100vh - 24px);
  padding: 0;
  color: var(--ink);
  border: 1px solid rgba(227, 196, 125, 0.42);
  border-radius: 8px;
  background: #11120f;
  box-shadow: 0 30px 96px rgba(0, 0, 0, 0.68);
}

.image-modal::backdrop {
  background: rgba(3, 4, 3, 0.82);
  backdrop-filter: blur(4px);
}

.image-modal-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  max-height: inherit;
}

.image-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #171815;
}

.image-modal-head h3 {
  margin: 0;
  color: var(--gold-soft);
  font-size: 18px;
  overflow-wrap: anywhere;
}

#imageZoomPreview {
  display: block;
  width: 100%;
  max-height: calc(100vh - 98px);
  object-fit: contain;
  background: #080907;
}

.detail-data-grid {
  display: grid;
  gap: 8px;
}

.detail-data-row {
  display: grid;
  grid-template-columns: minmax(118px, 0.42fr) minmax(0, 1fr);
  gap: 14px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.detail-data-row span,
.detail-note span,
.detail-related span {
  color: var(--muted);
  font-weight: 800;
}

.detail-data-row strong {
  text-align: right;
  overflow-wrap: anywhere;
}

.detail-note,
.detail-related {
  margin-top: 14px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.detail-note p,
.detail-related p {
  margin: 6px 0 0;
  overflow-wrap: anywhere;
}

.detail-modal-content .ai-analysis {
  margin-top: 14px;
}

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

.cards-grid, .qr-grid, .expense-summary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.expense-summary {
  margin-bottom: 16px;
}

.category-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -4px 0 16px;
}

.category-chip {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 13px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-weight: 800;
}

.category-chip.active,
.category-chip:hover {
  background: rgba(201, 154, 77, 0.18);
  color: var(--gold-soft);
  border-color: rgba(227, 196, 125, 0.42);
}

.expense-month {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(201, 154, 77, 0.1);
}

.expense-month span {
  display: block;
  color: var(--muted);
  font-weight: 800;
}

.expense-month strong {
  display: block;
  margin-top: 4px;
  color: var(--gold-soft);
  font-size: 24px;
}

.fish-card header, .activity-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.fish-card p, .activity-item p, .pond-tile p, .qr-card p {
  margin: 8px 0 0;
  color: var(--muted);
}

.activity-list {
  display: grid;
  gap: 10px;
}

.activity-list.large { max-height: 68vh; overflow: auto; padding-right: 4px; }

.activity-item {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.activity-item time { color: var(--gold-soft); font-weight: 800; white-space: nowrap; }

.water-reminder-list {
  display: grid;
  gap: 10px;
  max-height: 410px;
  overflow: auto;
  padding-right: 4px;
}

.water-reminder {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--teal);
  border-radius: 8px;
  background: var(--panel-soft);
}

.water-reminder.due { border-left-color: var(--coral); }
.water-reminder.soon { border-left-color: var(--gold); }
.water-reminder strong { display: block; }
.water-reminder p, .water-reminder small { margin: 4px 0 0; color: var(--muted); }
.water-reminder.due p { color: #ed9a86; font-weight: 800; }
.water-reminder.soon p { color: var(--gold-soft); font-weight: 800; }

.qr-card {
  text-align: center;
  break-inside: avoid;
}

.qr-direct-print-note {
  margin: -4px 0 16px;
  color: var(--muted);
  font-size: 13px;
}

.qr-direct-print-note.is-error { color: var(--coral); }

.qr-card [data-direct-print-qr] { margin-top: 8px; }

.cloud-access-panel { margin-top: 20px; }
.cloud-access-panel > p { margin: -2px 0 14px; color: var(--muted); }
.cloud-access-form { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto; gap: 12px; align-items: end; }
.cloud-access-form[hidden], .cloud-access-actions[hidden] { display: none; }
.cloud-access-actions { display: flex; align-items: center; gap: 12px; }
.cloud-access-actions code { overflow-wrap: anywhere; color: var(--muted); }

@media (max-width: 760px) {
  .cloud-access-form { grid-template-columns: 1fr; }
  .cloud-access-form .primary-button { width: 100%; }
  .cloud-access-actions { align-items: stretch; flex-direction: column; }
}

.qr-pond-name { font-weight: 700; }
.qr-strain { min-height: 22px; }

.qr-box {
  width: 148px;
  height: 148px;
  margin: 8px auto 12px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  background: #f4eddc;
}

.qr-fallback {
  width: 116px;
  height: 116px;
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 3px;
}

.qr-fallback i { background: #17130c; }

.empty {
  padding: 24px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.text-link {
  color: var(--gold-soft);
  font-weight: 800;
  text-decoration: none;
}

.text-link:hover {
  text-decoration: underline;
}

.pond-detail-page {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 42px;
}

.pond-detail-hero {
  min-height: 255px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
  border: 1px solid rgba(227, 196, 125, 0.28);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 18px;
  background:
    linear-gradient(90deg, rgba(8, 9, 8, 0.78), rgba(8, 9, 8, 0.28) 52%, rgba(8, 9, 8, 0.78)),
    linear-gradient(0deg, rgba(8, 9, 8, 0.86), transparent 58%),
    #0b0c0a url("assets/medaka-daily-banner.png") center / contain no-repeat;
  box-shadow: var(--shadow);
}

.pond-detail-hero .ghost-button {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.pond-detail-hero h1 {
  margin: 2px 0;
  color: var(--gold-soft);
  font-size: clamp(36px, 8vw, 68px);
  line-height: 1;
  letter-spacing: 0;
}

.pond-detail-hero p {
  margin: 0;
  color: #dfd1b2;
  font-weight: 800;
}

.pond-cloud-access { margin-top: 18px; max-width: 620px; }
.pond-cloud-access > p { margin: 0 0 10px; }
.pond-cloud-signin { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(150px, 1fr) auto; gap: 8px; align-items: center; }
.pond-cloud-signin input { min-width: 0; }
@media (max-width: 640px) {
  .pond-cloud-signin { grid-template-columns: 1fr; }
  .pond-cloud-signin button { width: 100%; }
}

.pond-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.72fr);
  gap: 18px;
  margin-bottom: 18px;
  align-items: start;
}

.detail-image {
  width: 100%;
  max-height: 300px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(227, 196, 125, 0.24);
  margin-bottom: 14px;
}

.detail-list {
  display: grid;
  gap: 10px;
}

.detail-list p {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.detail-list strong {
  color: var(--muted);
}

.detail-list span {
  text-align: right;
  font-weight: 800;
}

.detail-list .compact-button {
  justify-self: stretch;
  margin-top: 2px;
}

.qr-settings {
  display: grid;
  grid-template-columns: minmax(220px, 0.42fr) minmax(320px, 1fr);
  gap: 14px;
  align-items: end;
  margin-bottom: 18px;
}

.qr-settings h3,
.qr-settings p {
  margin: 0;
}

.qr-settings p {
  color: var(--muted);
  margin-top: 4px;
}

.qr-settings-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(5, auto);
  gap: 10px;
}

.qr-url-warning {
  grid-column: 2;
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid rgba(196, 135, 48, 0.75);
  border-radius: 8px;
  background: rgba(196, 135, 48, 0.13);
  color: var(--ink);
  font-weight: 800;
}

.qr-url-warning span {
  color: var(--muted);
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.qr-settings-note {
  grid-column: 2;
  margin: -6px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.server-access {
  grid-column: 2;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 170px;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.server-access strong {
  color: var(--gold-soft);
}

.server-access p {
  margin: 6px 0 10px;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-weight: 800;
}

.dashboard-qr-box {
  margin: 0 auto;
}

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 5; min-width: 0; padding: 16px; }
  .farm-hero { min-height: 220px; }
  .nav { grid-template-columns: repeat(8, minmax(0, 1fr)); overflow-x: auto; }
  .nav-item { text-align: center; white-space: nowrap; }
  .metric-grid, .dashboard-grid, .split-layout, .pond-detail-grid, .qr-settings, .qr-settings-row { grid-template-columns: 1fr; }
  .qr-url-warning, .qr-settings-note, .server-access { grid-column: auto; }
  .server-access { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 620px) {
  .main { padding: 18px; }
  .metric-grid { gap: 10px; }
  .metric { padding: 14px; }
  .top-actions, .panel-head { width: 100%; align-items: stretch; }
  .top-actions > *, .panel-head .search { flex: 1; max-width: none; }
  .brand p { display: none; }
  .nav { grid-template-columns: repeat(7, max-content); }
  .farm-hero-content { align-items: flex-end; padding: 18px; }
  .farm-hero-content img { width: 72px; height: 72px; }
  .quick-log-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick-log-form { gap: 14px; }
  .quick-log-actions { gap: 10px; }
  .quick-action { min-height: 52px; }
  .quick-pond-option { min-height: 48px; padding: 12px; }
  .quick-reuse-button, .quick-log-form .primary-button { width: 100%; min-height: 50px; }
  .quick-log-form .form-row { display: grid; grid-template-columns: 1fr; gap: 10px; }
  .water-reminder { align-items: stretch; flex-direction: column; }
  .water-reminder .compact-button { width: 100%; }
  .today-task { align-items: stretch; flex-direction: column; }
  .today-task .compact-button { width: 100%; }
  .calendar-head > div, .calendar-controls { width: 100%; }
  .calendar-controls input { flex: 1; width: auto; }
  .calendar-event { align-items: stretch; flex-direction: column; }
  .calendar-event .compact-button { width: 100%; }
  .detail-modal-head, .detail-modal-content { padding: 16px; }
  .detail-modal-top { grid-template-columns: 1fr; }
  .detail-modal-image { max-width: 190px; }
  .detail-data-row { grid-template-columns: 1fr; gap: 3px; }
  .detail-data-row strong { text-align: left; }
  .detail-modal-actions { display: grid; grid-template-columns: 1fr; }
  .photo-timeline-item { grid-template-columns: 1fr; }
  .photo-timeline-image { width: 100%; height: 190px; }
}

@media print {
  body { background: white; color: #17130c; }
  .sidebar, .topbar, .view:not(#qr), .qr-settings, #qr .panel-head, .qr-screen-only { display: none !important; }
  .app-shell, .main { display: block; padding: 0; }
  .panel { box-shadow: none; border: 0; background: white; padding: 0; }
  .qr-grid { grid-template-columns: repeat(3, 1fr); }
  .qr-card { color: #17130c; background: white; border: 1px solid #17130c; margin: 0; }
  .qr-card p { color: #17130c; }
  .qr-box { border-color: #17130c; }
  .print-single-qr .qr-grid { display: block; }
  .print-single-qr .qr-card { display: none; }
  .print-single-qr .qr-card.print-target {
    display: block;
    box-sizing: border-box;
    width: 50mm;
    height: 80mm;
    margin: 0;
    padding: 3mm;
  }
  .print-single-qr .qr-box {
    width: 34mm;
    height: 34mm;
    margin: 0 auto 2mm;
  }
  .print-single-qr .qr-box img,
  .print-single-qr .qr-box canvas {
    width: 34mm !important;
    height: 34mm !important;
    max-width: 34mm;
    max-height: 34mm;
  }
  .print-single-qr .qr-card strong { display: block; font-size: 11pt; line-height: 1.25; }
  .print-single-qr .qr-card p { margin: 1.2mm 0 0; font-size: 8.5pt; line-height: 1.25; }
  .print-single-qr .qr-strain { min-height: 0; }
}
