/* =========================================================
   TaskCare – Design System (mobile-first, light / dark ocean theme)
   Giao diện chọn qua <html data-theme="light|dark"> (mặc định: light)
   ========================================================= */

:root {
  /* Palette */
  --bg: hsl(212 45% 7%);
  --bg-2: hsl(212 40% 10%);
  --surface: hsl(212 35% 13% / .72);
  --surface-solid: hsl(212 33% 14%);
  --surface-2: hsl(212 30% 18%);
  --border: hsl(205 40% 70% / .10);
  --border-strong: hsl(205 40% 70% / .2);

  --text: hsl(205 30% 95%);
  --text-2: hsl(208 18% 72%);
  --text-3: hsl(210 14% 52%);

  --primary: hsl(178 72% 45%);
  --primary-2: hsl(196 85% 52%);
  --primary-soft: hsl(178 72% 45% / .14);
  --grad: linear-gradient(135deg, hsl(172 75% 46%), hsl(198 88% 54%));
  --grad-warm: linear-gradient(135deg, hsl(28 95% 60%), hsl(350 85% 62%));
  --grad-violet: linear-gradient(135deg, hsl(258 80% 66%), hsl(212 90% 60%));

  --success: hsl(152 62% 48%);
  --success-soft: hsl(152 62% 48% / .14);
  --warning: hsl(38 95% 58%);
  --warning-soft: hsl(38 95% 58% / .14);
  --danger: hsl(355 82% 63%);
  --danger-soft: hsl(355 82% 63% / .14);
  --info: hsl(205 90% 62%);
  --info-soft: hsl(205 90% 62% / .14);
  --violet: hsl(258 80% 70%);
  --violet-soft: hsl(258 80% 70% / .14);

  /* Shape & motion */
  --r-sm: 10px;
  --r: 16px;
  --r-lg: 12px;
  --r-xl: 12px;
  --shadow: 0 10px 30px -12px hsl(212 80% 2% / .7);
  --shadow-glow: 0 10px 30px -10px hsl(178 80% 45% / .55);
  --ease: cubic-bezier(.2, .8, .2, 1);

  --topbar-h: 60px;
  --nav-h: 72px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);

  /* Theme-dependent tokens (dark) */
  --on-primary: hsl(212 60% 8%);
  --topbar-bg: hsl(212 45% 7% / .7);
  --nav-bg: hsl(212 38% 12% / .78);
  --nav-shadow: 0 20px 40px -12px hsl(212 80% 2% / .8);
  --backdrop: hsl(212 60% 3% / .55);
  --field-bg: hsl(212 40% 6% / .6);
  --overlay-1: hsl(0 0% 100% / .03);
  --overlay-2: hsl(0 0% 100% / .06);
  --switch-off: hsl(210 15% 30%);
  --glow-1: hsl(185 80% 40% / .22);
  --glow-2: hsl(220 80% 50% / .14);
  --glow-3: hsl(172 80% 40% / .12);
  --alert-info-text: hsl(205 90% 80%);
  --alert-warning-text: hsl(38 95% 80%);
  --alert-danger-text: hsl(355 90% 85%);
  --auth-title: linear-gradient(135deg, #fff, hsl(180 60% 80%));
  --picker-filter: invert(.8);
  --pond-card-bg: linear-gradient(160deg, hsl(190 60% 40% / .10), hsl(0 0% 100% / .02));
  --chart-text: hsl(210 14% 52%);
  --chart-label: hsl(208 18% 72%);
  --chart-grid: hsl(205 40% 70% / .08);
  --chart-dot-stroke: hsl(212 45% 7%);

  color-scheme: dark;
}

/* ---------- Light theme ---------- */
:root[data-theme="light"] {
  --bg: hsl(200 33% 96%);
  --bg-2: hsl(200 28% 92%);
  --surface: hsl(0 0% 100% / .82);
  --surface-solid: hsl(0 0% 100%);
  --surface-2: hsl(205 30% 94%);
  --border: hsl(212 35% 25% / .09);
  --border-strong: hsl(212 35% 25% / .17);

  --text: hsl(212 42% 13%);
  --text-2: hsl(212 18% 34%);
  --text-3: hsl(212 12% 50%);

  --primary: hsl(178 78% 31%);
  --primary-2: hsl(196 85% 40%);
  --primary-soft: hsl(178 72% 36% / .11);

  --success: hsl(152 66% 33%);
  --success-soft: hsl(152 62% 40% / .12);
  --warning: hsl(32 94% 43%);
  --warning-soft: hsl(38 95% 50% / .14);
  --danger: hsl(355 72% 50%);
  --danger-soft: hsl(355 82% 58% / .11);
  --info: hsl(207 86% 44%);
  --info-soft: hsl(205 90% 55% / .12);
  --violet: hsl(258 58% 54%);
  --violet-soft: hsl(258 80% 65% / .12);

  --shadow: 0 12px 30px -14px hsl(212 45% 30% / .28);
  --shadow-glow: 0 10px 26px -10px hsl(178 80% 35% / .45);

  --on-primary: hsl(212 60% 8%);
  --topbar-bg: hsl(200 33% 97% / .78);
  --nav-bg: hsl(0 0% 100% / .86);
  --nav-shadow: 0 18px 40px -16px hsl(212 50% 25% / .35);
  --backdrop: hsl(212 40% 15% / .35);
  --field-bg: hsl(0 0% 100%);
  --overlay-1: hsl(212 40% 30% / .04);
  --overlay-2: hsl(212 40% 30% / .07);
  --switch-off: hsl(212 15% 78%);
  --glow-1: hsl(185 85% 60% / .22);
  --glow-2: hsl(215 90% 70% / .16);
  --glow-3: hsl(165 80% 60% / .14);
  --alert-info-text: hsl(207 80% 30%);
  --alert-warning-text: hsl(30 85% 30%);
  --alert-danger-text: hsl(355 65% 38%);
  --auth-title: linear-gradient(135deg, hsl(190 70% 22%), hsl(178 75% 34%));
  --picker-filter: none;
  --pond-card-bg: linear-gradient(160deg, hsl(185 70% 45% / .09), hsl(0 0% 100% / .7));
  --chart-text: hsl(212 12% 50%);
  --chart-label: hsl(212 22% 30%);
  --chart-grid: hsl(212 35% 25% / .09);
  --chart-dot-stroke: hsl(0 0% 100%);

  color-scheme: light;
}

/* Chuyển màu mượt khi đổi giao diện */
html.theme-anim,
html.theme-anim *,
html.theme-anim *::before,
html.theme-anim *::after {
  transition: background-color .35s var(--ease), border-color .35s var(--ease), color .35s var(--ease), fill .35s var(--ease) !important;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(700px 420px at 100% -10%, var(--glow-1), transparent 60%),
    radial-gradient(600px 400px at -20% 30%, var(--glow-2), transparent 60%),
    radial-gradient(500px 500px at 50% 120%, var(--glow-3), transparent 60%),
    var(--bg);
}

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

img,
svg {
  display: block;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -.01em;
}

p {
  margin: 0;
}

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

::selection {
  background: hsl(178 72% 45% / .35);
}

.icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-sm {
  width: 16px;
  height: 16px;
}

.icon-lg {
  width: 24px;
  height: 24px;
}

/* ---------- App shell ---------- */
.app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  padding-bottom: calc(var(--nav-h) + var(--safe-b) + 24px);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: calc(var(--topbar-h) + var(--safe-t));
  padding: var(--safe-t) 16px 0;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--topbar-bg);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid var(--border);
}

.topbar-title {
  flex: 1;
  min-width: 0;
}

.topbar-title h1 {
  font-size: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-title small {
  display: block;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 500;
}

.icon-btn {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: .2s var(--ease);
}

.icon-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.icon-btn:active {
  transform: scale(.94);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--grad);
  box-shadow: var(--shadow-glow);
  color: var(--on-primary);
}

.brand-logo .icon {
  stroke-width: 2.4;
}

main.content {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ---------- Bottom navigation ---------- */
.bottom-nav {
  position: fixed;
  z-index: 40;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(10px + var(--safe-b));
  width: min(calc(100% - 20px), 540px);
  height: var(--nav-h);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  padding: 0 6px;
  background: var(--nav-bg);
  backdrop-filter: blur(22px) saturate(170%);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
  border: 1px solid var(--border-strong);
  border-radius: 24px;
  box-shadow: var(--nav-shadow);
}

.nav-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  transition: color .2s var(--ease);
}

.nav-item .icon {
  width: 22px;
  height: 22px;
  transition: transform .25s var(--ease);
}

.nav-item.active {
  color: var(--primary);
}

.nav-item.active .icon {
  transform: translateY(-1px);
}

.nav-item.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  width: 18px;
  height: 3px;
  border-radius: 3px;
  background: var(--grad);
}

.nav-badge {
  position: absolute;
  top: 2px;
  left: calc(50% + 6px);
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.nav-fab {
  justify-self: center;
  width: 56px;
  height: 56px;
  margin-top: -26px;
  border-radius: 18px;
  border: 0;
  display: grid;
  place-items: center;
  background: var(--grad);
  color: var(--on-primary);
  box-shadow: var(--shadow-glow), 0 0 0 6px var(--bg);
  cursor: pointer;
  transition: transform .25s var(--ease);
}

.nav-fab .icon {
  width: 26px;
  height: 26px;
  stroke-width: 2.6;
  transition: transform .3s var(--ease);
}

.nav-fab:active {
  transform: scale(.92);
}

.nav-fab.open .icon {
  transform: rotate(45deg);
}

/* Quick action sheet */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 35;
  background: var(--backdrop);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s var(--ease);
}

.sheet-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.quick-sheet {
  position: fixed;
  z-index: 38;
  left: 50%;
  bottom: calc(var(--nav-h) + var(--safe-b) + 22px);
  width: min(calc(100% - 32px), 420px);
  transform: translate(-50%, 20px) scale(.96);
  opacity: 0;
  pointer-events: none;
  transition: .28s var(--ease);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.quick-sheet.show {
  transform: translate(-50%, 0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

.quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 8px;
  border-radius: var(--r);
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  font-size: 12.5px;
  font-weight: 600;
  text-align: center;
  box-shadow: var(--shadow);
}

.quick-action .qa-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
}

/* ---------- Cards & surfaces ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.card-flush {
  padding: 0;
  overflow: hidden;
}

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

.card-title {
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.section-head h2 {
  font-size: 16px;
}

.link {
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Hero greeting */
.hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-xl);
  padding: 20px;
  background:
    radial-gradient(260px 160px at 100% 0%, hsl(190 90% 60% / .35), transparent 70%),
    linear-gradient(135deg, hsl(182 70% 28%), hsl(205 70% 26%));
  border: 1px solid hsl(180 70% 60% / .2);
  box-shadow: 0 20px 40px -20px hsl(185 80% 30% / .8);
  color: hsl(0 0% 100%);
}

.hero::after {
  content: '';
  position: absolute;
  right: -40px;
  bottom: -60px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, hsl(175 80% 60% / .25), transparent 70%);
}

.hero small {
  color: hsl(180 40% 85%);
  font-weight: 500;
}

.hero h2 {
  font-size: 22px;
  margin: 2px 0 14px;
}

.progress-ring {
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  z-index: 1;
}

.progress-bar {
  flex: 1;
  height: 10px;
  border-radius: 10px;
  background: hsl(0 0% 100% / .15);
  overflow: hidden;
}

.progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, hsl(160 90% 60%), hsl(190 95% 70%));
  transition: width 1s var(--ease);
}

.progress-text {
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
}

/* Stats grid */
.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.stat {
  position: relative;
  overflow: hidden;
  padding: 14px;
  border-radius: var(--r);
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform .2s var(--ease), border-color .2s;
}

.stat:active {
  transform: scale(.98);
}

.stat:hover {
  border-color: var(--border-strong);
}

.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
}

.stat-value {
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
}

.stat-label {
  font-size: 12.5px;
  color: var(--text-2);
  font-weight: 500;
}

.tone-primary {
  background: var(--primary-soft);
  color: var(--primary);
}

.tone-success {
  background: var(--success-soft);
  color: var(--success);
}

.tone-warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.tone-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.tone-info {
  background: var(--info-soft);
  color: var(--info);
}

.tone-violet {
  background: var(--violet-soft);
  color: var(--violet);
}

/* ---------- Tabs / chips ---------- */
.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  flex: 1;
  white-space: nowrap;
  text-align: center;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  transition: .2s var(--ease);
}

.tab.active {
  background: var(--grad);
  color: var(--on-primary);
  box-shadow: 0 6px 16px -6px hsl(178 80% 45% / .6);
}

.tab .count {
  margin-left: 4px;
  opacity: .8;
}

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  white-space: nowrap;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
  transition: .2s var(--ease);
}

.chip.active {
  border-color: transparent;
  background: var(--primary-soft);
  color: var(--primary);
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge-done {
  background: var(--success-soft);
  color: var(--success);
}

.badge-pending {
  background: var(--info-soft);
  color: var(--info);
}

.badge-overdue {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge-skipped {
  background: hsl(210 10% 50% / .15);
  color: var(--text-3);
}

.badge-admin {
  background: var(--violet-soft);
  color: var(--violet);
}

.badge-manager {
  background: var(--warning-soft);
  color: var(--warning);
}

.badge-user {
  background: var(--info-soft);
  color: var(--info);
}

.prio-low {
  color: var(--text-3);
}

.prio-normal {
  color: var(--info);
}

.prio-high {
  color: var(--warning);
}

.prio-urgent {
  color: var(--danger);
}

/* ---------- Task item ---------- */
.task-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.day-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-3);
  margin: 6px 4px 0;
}

.task-item {
  position: relative;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  border-radius: var(--r);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: .25s var(--ease);
  animation: rise .4s var(--ease) both;
}

.task-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--prio, var(--info));
}

.task-item[data-prio="low"] {
  --prio: var(--text-3);
}

.task-item[data-prio="high"] {
  --prio: var(--warning);
}

.task-item[data-prio="urgent"] {
  --prio: var(--danger);
}

.task-item.is-done {
  opacity: .6;
}

.task-item.is-done .task-title {
  text-decoration: line-through;
  text-decoration-color: var(--text-3);
}

.task-item.is-overdue {
  border-color: hsl(355 82% 63% / .3);
  background: linear-gradient(90deg, hsl(355 82% 63% / .07), var(--surface) 50%);
}

.check {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  margin-top: 1px;
  border-radius: 9px;
  border: 2px solid var(--border-strong);
  display: grid;
  place-items: center;
  background: transparent;
  cursor: pointer;
  color: transparent;
  transition: .25s var(--ease);
}

.check:hover {
  border-color: var(--primary);
}

.check .icon {
  width: 16px;
  height: 16px;
  stroke-width: 3;
}

.check.checked {
  background: var(--grad);
  border-color: transparent;
  color: var(--on-primary);
  animation: pop .35s var(--ease);
}

.check:disabled {
  cursor: default;
  opacity: .5;
}

.task-body {
  flex: 1;
  min-width: 0;
}

.task-title {
  font-weight: 600;
  font-size: 14.5px;
  line-height: 1.35;
  display: block;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-3);
}

.task-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.task-meta .icon {
  width: 13px;
  height: 13px;
}

/* ---------- List rows (customers, users...) ---------- */
.list {
  display: flex;
  flex-direction: column;
}

.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  transition: background .2s;
}

.list-row:last-child {
  border-bottom: 0;
}

.list-row:active {
  background: var(--overlay-1);
}

.list-main {
  flex: 1;
  min-width: 0;
}

.list-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-sub {
  font-size: 12.5px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.list-end {
  text-align: right;
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text-3);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.avatar {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 16px;
  background: var(--grad-violet);
  color: #fff;
}

.avatar.sm {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  font-size: 13px;
}

.avatar.teal {
  background: var(--grad);
  color: var(--on-primary);
}

.avatar.warm {
  background: var(--grad-warm);
}

/* ---------- Metric chips (care logs) ---------- */
.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.metric {
  padding: 10px 8px;
  border-radius: 12px;
  text-align: center;
  background: var(--overlay-1);
  border: 1px solid var(--border);
}

.metric-label {
  font-size: 10.5px;
  color: var(--text-3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.metric-value {
  font-size: 16px;
  font-weight: 800;
  margin-top: 2px;
}

.metric.warn {
  border-color: hsl(38 95% 58% / .35);
  background: var(--warning-soft);
}

.metric.warn .metric-value {
  color: var(--warning);
}

.metric.ok .metric-value {
  color: var(--success);
}

.log-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.log-item:last-child {
  border-bottom: 0;
}

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

.log-date {
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.log-date small {
  color: var(--text-3);
  font-weight: 500;
}

.log-note {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-2);
  background: var(--overlay-1);
  padding: 8px 10px;
  border-radius: 10px;
}

/* Nhật ký: nội dung "Khác" là trọng tâm, chỉ số hiển thị dạng chữ nhỏ */
.log-content {
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-line;
  word-break: break-word;
}

.log-content.is-empty {
  font-size: 13px;
  font-style: italic;
  color: var(--text-3);
}

.log-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  font-size: 12px;
  color: var(--text-3);
}

.log-meta b {
  color: var(--text-2);
  font-weight: 700;
}

.log-meta .is-warn,
.log-meta .is-warn b {
  color: var(--warning);
}

.log-meta .log-by {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.log-meta .log-by .icon {
  width: 13px;
  height: 13px;
}

/* Chart */
.chart-wrap {
  position: relative;
  height: 170px;
}

.chart-wrap svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.chart-legend {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--text-2);
  margin-top: 8px;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chart-legend i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}

/* Trend chart (pH / Kiềm / Thức ăn) */
.trend-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 0;
  margin-bottom: 10px;
  border-radius: 12px;
  background: var(--field-bg);
  border: 1px solid var(--border);
}

.trend-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px;
  border-radius: 10px;
  border: 0;
  background: transparent;
  color: var(--text-3);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background .25s var(--ease), color .25s var(--ease), box-shadow .25s var(--ease);
}

.trend-tab i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c);
  opacity: .5;
  transition: .25s var(--ease);
}

.trend-tab:hover {
  color: var(--text-2);
}

.trend-tab.active {
  color: var(--text);
  background: color-mix(in srgb, var(--c) 16%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 45%, transparent);
}

.trend-tab.active i {
  opacity: 1;
  box-shadow: 0 0 10px var(--c);
}

.trend-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 2px;
}

.trend-stats>div {
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--overlay-1);
  border: 1px solid var(--border);
  min-width: 0;
}

.trend-stats small {
  display: block;
  font-size: 10.5px;
  color: var(--text-3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.trend-stats b {
  display: block;
  font-size: 15px;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trend-stats b.warn {
  color: var(--warning);
}

.trend-stats b.ok {
  color: var(--success);
}

.trend-wrap {
  height: 200px;
  touch-action: pan-y;
}

.trend-wrap svg {
  display: block;
}

.trend-wrap .trend-anim {
  animation: trendIn .55s var(--ease) both;
}

@keyframes trendIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.trend-tip {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  padding: 6px 10px;
  border-radius: 10px;
  pointer-events: none;
  white-space: nowrap;
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  font-size: 12px;
  color: var(--text-2);
  z-index: 2;
}

.trend-tip b {
  color: var(--text);
  font-size: 14px;
  margin-right: 4px;
}

/* ---------- Forms ---------- */
.form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label,
.field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

.field .hint {
  font-size: 12px;
  color: var(--text-3);
}

.field .error {
  font-size: 12px;
  color: var(--danger);
  font-weight: 500;
}

.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 10px;
  background: var(--field-bg);
  border: 1px solid var(--border-strong);
  font-size: 12px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  appearance: none;
  -webkit-appearance: none;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--text-3);
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px hsl(178 72% 45% / .15);
}

.textarea {
  min-height: 96px;
  resize: vertical;
}

.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

.select option {
  background: var(--surface-solid);
}

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

.input-group {
  position: relative;
}

.input-group .input {
  padding-right: 56px;
}

.input-suffix {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  color: var(--text-3);
  font-weight: 600;
}

.input-icon {
  position: relative;
}

.input-icon .icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
}

.input-icon .input {
  padding-left: 44px;
}

/* segmented / option pills */
.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented label {
  padding: 4px 8px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid var(--border-strong);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  transition: .2s var(--ease);
  user-select: none;
}

.segmented input:checked+label {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: hsl(178 72% 45% / .5);
}

.segmented.days label {
  width: 42px;
  padding: 9px 0;
  text-align: center;
}

/* toggle */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
}

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

.toggle-row strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
}

.toggle-row small {
  color: var(--text-3);
  font-size: 12px;
}

.switch {
  position: relative;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch span {
  position: absolute;
  inset: 0;
  border-radius: 28px;
  cursor: pointer;
  background: var(--switch-off);
  transition: .25s var(--ease);
}

.switch span::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  transition: .25s var(--ease);
  box-shadow: 0 2px 6px hsl(0 0% 0% / .3);
}

.switch input:checked+span {
  background: var(--grad);
}

.switch input:checked+span::after {
  transform: translateX(20px);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .15s var(--ease), box-shadow .2s, background .2s, opacity .2s;
}

.btn:active {
  transform: scale(.97);
}

.btn-primary {
  background: var(--grad);
  color: var(--on-primary);
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
  box-shadow: 0 14px 34px -10px hsl(178 80% 45% / .75);
}

.btn-ghost {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: hsl(355 82% 63% / .3);
}

.btn-success {
  background: var(--success-soft);
  color: var(--success);
  border-color: hsl(152 62% 48% / .3);
}

.btn-sm {
  min-height: 36px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 11px;
}

.btn-block {
  width: 100%;
}

.btn-row {
  display: flex;
  gap: 10px;
}

.btn-row .btn {
  flex: 1;
}

.form-actions {
  position: sticky;
  bottom: calc(var(--nav-h) + var(--safe-b) + 18px);
  display: flex;
  gap: 10px;
  padding-top: 8px;
}

.form-actions .btn {
  flex: 1;
}

/* ---------- Detail info ---------- */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.info-item small {
  display: block;
  font-size: 10px;
  color: var(--text-3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.info-item div {
  font-size: 14px;
  font-weight: 600;
  margin-top: 2px;
  word-break: break-word;
}

.info-item.full {
  grid-column: 1 / -1;
}

.profile-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.profile-head .avatar {
  width: 56px;
  height: 56px;
  font-size: 22px;
  border-radius: 18px;
}

.profile-head h2 {
  font-size: 19px;
}

.profile-head p {
  color: var(--text-3);
  font-size: 13px;
}

.doc-pill {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  padding: 8px 10px;
  border-radius: 16px;
  background: var(--grad);
  color: var(--on-primary);
}

.doc-pill b {
  font-size: 20px;
  line-height: 1;
}

.doc-pill small {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
}

/* ---------- Menu (More page) ---------- */
.menu {
  display: flex;
  flex-direction: column;
}

.menu a,
.menu button {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 16px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: none;
  text-align: left;
  cursor: pointer;
  font-weight: 600;
  transition: background .2s;
}

.menu> :last-child {
  border-bottom: 0;
}

.menu a:active,
.menu button:active {
  background: var(--overlay-1);
}

.menu .menu-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
}

.menu .menu-text {
  flex: 1;
}

.menu .menu-text small {
  display: block;
  color: var(--text-3);
  font-weight: 500;
  font-size: 12px;
}

.menu .chev {
  color: var(--text-3);
}

/* ---------- Monitor card ---------- */
.monitor {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.monitor-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.monitor-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.monitor.is-off {
  opacity: .6;
}

.monitor-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.monitor-result {
  font-size: 12.5px;
  color: var(--text-2);
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--overlay-1);
  display: flex;
  gap: 8px;
  align-items: center;
}

.cron-code {
  font-family: ui-monospace, 'Cascadia Code', monospace;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 8px;
  background: var(--overlay-2);
  color: var(--text-2);
}

.type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.type-option input {
  position: absolute;
  opacity: 0;
}

.type-option label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
  padding: 12px;
  border-radius: var(--r);
  cursor: pointer;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  transition: .2s var(--ease);
}

.type-option input:checked+label {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 3px hsl(178 72% 45% / .15);
}

/* ---------- Alerts / toasts ---------- */
.toast-stack {
  position: fixed;
  top: calc(var(--topbar-h) + var(--safe-t) + 10px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  width: min(calc(100% - 24px), 520px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  font-size: 14px;
  font-weight: 500;
  animation: toastIn .35s var(--ease) both;
}

.toast.success .icon {
  color: var(--success);
}

.toast.error .icon {
  color: var(--danger);
}

.toast.hide {
  animation: toastOut .3s var(--ease) forwards;
}

.alert {
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.alert-info {
  background: var(--info-soft);
  color: var(--alert-info-text);
  border: 1px solid hsl(205 90% 62% / .25);
}

.alert-warning {
  background: var(--warning-soft);
  color: var(--alert-warning-text);
  border: 1px solid hsl(38 95% 58% / .25);
}

.alert-danger {
  background: var(--danger-soft);
  color: var(--alert-danger-text);
  border: 1px solid hsl(355 82% 63% / .25);
}

/* Empty state */
.empty {
  text-align: center;
  padding: 36px 20px;
  color: var(--text-3);
}

.empty-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
}

.empty-icon .icon {
  width: 30px;
  height: 30px;
}

.empty h3 {
  color: var(--text);
  font-size: 16px;
  margin-bottom: 4px;
}

/* Search */
.search {
  position: relative;
}

.search .icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
}

.search .input {
  padding-left: 44px;
  border-radius: 14px;
}

/* Pagination */
.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-3);
}

/* Utility */
.muted {
  color: var(--text-3);
}

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

.small {
  font-size: 12.5px;
}

.flex {
  display: flex;
}

.items-center {
  align-items: center;
}

.between {
  justify-content: space-between;
}

.gap-8 {
  gap: 8px;
}

.gap-12 {
  gap: 12px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.wrap {
  flex-wrap: wrap;
}

.mt-4 {
  margin-top: 4px;
}

.mt-8 {
  margin-top: 8px;
}

.w-full {
  width: 100%;
}

.nowrap {
  white-space: nowrap;
}

.mono {
  font-family: ui-monospace, 'Cascadia Code', monospace;
  font-size: 12px;
  word-break: break-all;
}

.hidden {
  display: none !important;
}

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

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

/* ---------- Auth ---------- */
.auth {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px 20px calc(24px + var(--safe-b));
  max-width: 440px;
  margin: 0 auto;
}

.auth-hero {
  text-align: center;
  margin-bottom: 28px;
}

.auth-logo {
  width: 76px;
  height: 76px;
  margin: 0 auto 18px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  background: var(--grad);
  color: var(--on-primary);
  box-shadow: 0 20px 50px -12px hsl(178 80% 45% / .7);
  animation: float 5s ease-in-out infinite;
}

.auth-logo .icon {
  width: 38px;
  height: 38px;
  stroke-width: 2.2;
}

.auth-hero h1 {
  font-size: 28px;
  background: var(--auth-title);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.auth-hero p {
  color: var(--text-2);
  margin-top: 6px;
}

.demo-accounts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.demo-accounts button {
  padding: 10px;
  border-radius: 12px;
  border: 1px dashed var(--border-strong);
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-size: 12px;
  color: var(--text-2);
  transition: .2s;
}

.demo-accounts button:hover {
  border-color: var(--primary);
  color: var(--text);
}

.demo-accounts b {
  display: block;
  color: var(--text);
  font-size: 13px;
}

/* ---------- Ao nuôi (nhiều ao / khách) ---------- */
.pond-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.pond-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border-radius: 16px;
  background: var(--pond-card-bg);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  transition: transform .2s var(--ease), border-color .2s, box-shadow .2s;
  animation: rise .45s var(--ease) both;
}

.pond-card::before {
  content: '';
  position: absolute;
  inset: auto -20% -60% -20%;
  height: 80%;
  background: radial-gradient(ellipse at center, hsl(185 80% 50% / .10), transparent 70%);
  pointer-events: none;
}

.pond-card:hover {
  border-color: hsl(178 72% 45% / .45);
  box-shadow: 0 10px 28px -14px hsl(178 80% 45% / .6);
}

.pond-card:active {
  transform: scale(.98);
}

.pond-card.is-off {
  opacity: .55;
  filter: grayscale(.4);
}

.pond-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.pond-name {
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pond-card .list-sub {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pond-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-3);
}

.pond-foot span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.metrics.compact {
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.metrics.compact .metric {
  padding: 6px 4px;
  border-radius: 10px;
}

.metrics.compact .metric-label {
  font-size: 9.5px;
}

.metrics.compact .metric-value {
  font-size: 14px;
}

.doc-pill.sm {
  min-width: 44px;
  padding: 5px 7px;
  border-radius: 12px;
  flex-shrink: 0;
}

.doc-pill.sm b {
  font-size: 15px;
}

.doc-pill.sm small {
  font-size: 8.5px;
}

.pond-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.pond-dot {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--overlay-2);
  color: var(--text-3);
  border: 1px solid var(--border);
}

.pond-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: .8;
}

.pond-dot:not(.ok):not(.warn):not(.stale):not(.none)::before {
  display: none;
}

.pond-dot.ok {
  color: var(--success);
  background: var(--success-soft);
  border-color: hsl(152 62% 48% / .3);
}

.pond-dot.warn {
  color: var(--warning);
  background: var(--warning-soft);
  border-color: hsl(38 95% 58% / .35);
}

.pond-dot.stale,
.pond-dot.none {
  color: var(--text-3);
}

.pond-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  border: 1px dashed var(--border-strong);
  background: var(--overlay-1);
}

.pond-row.pop-in {
  animation: rise .35s var(--ease) both;
}

.pond-row-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pond-row-head .input {
  flex: 1;
  min-width: 0;
  font-weight: 600;
}

.pond-row-index {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
}

.pond-row .icon-btn:disabled {
  opacity: .35;
  pointer-events: none;
}

.pond-picker label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.pond-picker label small {
  font-weight: 500;
  font-size: 11.5px;
}

.select:disabled {
  opacity: .55;
}

/* ---------- Chi tiết khách hàng (bản gọn) ---------- */
.cust-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
}

.cust-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cust-head .avatar {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  font-size: 18px;
}

.cust-main {
  flex: 1;
  min-width: 0;
}

.cust-main h2 {
  font-size: 17px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cust-main p {
  color: var(--text-3);
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cust-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cust-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--overlay-1);
  border: 1px solid var(--border);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
}

.cust-chip .icon {
  width: 14px;
  height: 14px;
  color: var(--text-3);
}

.cust-chip.is-link {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: transparent;
}

.cust-chip.is-link .icon {
  color: var(--primary);
}

.cust-lines {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--text-2);
}

.cust-lines>div {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.cust-lines .icon {
  width: 15px;
  height: 15px;
  margin-top: 2px;
  color: var(--text-3);
}

.btn-md {
  min-height: 30px;
  font-size: 13px;
  border-radius: 8px;
  padding: 0 14px;
}

.pond-card.compact {
  gap: 8px;
  padding: 11px 12px;
}

.pond-card.compact .pond-name {
  font-size: 14.5px;
}

.pond-card.compact .list-sub {
  font-size: 12px;
}

/* ---------- Theme picker (More page) ---------- */
.theme-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 14px;
}

.theme-option {
  position: relative;
}

.theme-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.theme-option label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px 8px 12px;
  border-radius: 16px;
  cursor: pointer;
  border: 1.5px solid var(--border-strong);
  background: var(--overlay-1);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
  transition: border-color .25s var(--ease), box-shadow .25s var(--ease), color .25s var(--ease), transform .15s var(--ease);
}

.theme-option label:active {
  transform: scale(.97);
}

.theme-option input:checked+label {
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

.theme-option input:focus-visible+label {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.theme-preview {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  border: 1px solid hsl(212 30% 50% / .2);
}

.theme-preview i {
  position: absolute;
  display: block;
  border-radius: 4px;
}

.theme-preview .tp-bar {
  left: 0;
  right: 0;
  top: 0;
  height: 18%;
  border-radius: 0;
}

.theme-preview .tp-card {
  left: 10%;
  right: 10%;
  height: 20%;
}

.theme-preview .tp-card.c1 {
  top: 28%;
}

.theme-preview .tp-card.c2 {
  top: 54%;
  width: 50%;
  right: auto;
}

.theme-preview .tp-dot {
  width: 22%;
  height: 14%;
  right: 10%;
  bottom: 10%;
  border-radius: 6px;
  background: var(--grad);
}

.theme-preview.light {
  background: hsl(200 33% 95%);
}

.theme-preview.light .tp-bar {
  background: hsl(0 0% 100%);
}

.theme-preview.light .tp-card {
  background: hsl(0 0% 100%);
  box-shadow: 0 2px 6px hsl(212 40% 30% / .15);
}

.theme-preview.dark {
  background: hsl(212 45% 8%);
}

.theme-preview.dark .tp-bar {
  background: hsl(212 38% 13%);
}

.theme-preview.dark .tp-card {
  background: hsl(212 33% 17%);
}

.theme-preview.auto {
  background: linear-gradient(135deg, hsl(200 33% 95%) 50%, hsl(212 45% 8%) 50%);
}

.theme-preview.auto .tp-bar {
  background: linear-gradient(135deg, hsl(0 0% 100%) 50%, hsl(212 38% 13%) 50%);
}

.theme-preview.auto .tp-card {
  background: hsl(212 20% 60% / .45);
}

.theme-option .theme-name {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.theme-option .theme-name .icon {
  width: 15px;
  height: 15px;
}

/* ---------- Animations ---------- */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes pop {
  0% {
    transform: scale(.7);
  }

  60% {
    transform: scale(1.15);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-12px) scale(.96);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(-12px) scale(.96);
  }
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-6px);
  }
}

.stagger>* {
  animation: rise .45s var(--ease) both;
}

.stagger>*:nth-child(2) {
  animation-delay: .04s;
}

.stagger>*:nth-child(3) {
  animation-delay: .08s;
}

.stagger>*:nth-child(4) {
  animation-delay: .12s;
}

.stagger>*:nth-child(5) {
  animation-delay: .16s;
}

.stagger>*:nth-child(6) {
  animation-delay: .2s;
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* Small phones */
@media (max-width: 360px) {
  .metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  .row-3 {
    grid-template-columns: 1fr 1fr;
  }

  .pond-grid {
    grid-template-columns: 1fr;
  }

  .metrics.compact {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ---------- Vị trí khách hàng ---------- */
.loc-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.loc-actions .btn.is-loading {
  opacity: .6;
  pointer-events: none;
}

.loc-actions .btn.is-loading .icon,
.map-locate.is-loading .icon {
  animation: locPulse 1s ease-in-out infinite;
}

@keyframes locPulse {
  50% {
    transform: scale(.75);
    opacity: .5;
  }
}

button.link {
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
}

.cust-loc {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--overlay-1);
  border: 1px solid var(--border);
}

.cust-loc-coords {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.cust-loc-coords .icon {
  width: 18px;
  height: 18px;
  color: var(--primary);
  flex-shrink: 0;
}

.cust-loc-coords span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cust-loc-coords small {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* Hộp chọn vị trí trên bản đồ */
.map-picker {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: var(--backdrop);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity .25s var(--ease);
}

.map-picker[hidden] {
  display: none;
}

.map-picker.show {
  opacity: 1;
}

.map-picker-panel {
  width: min(100%, 560px);
  height: min(86dvh, 720px);
  display: flex;
  flex-direction: column;
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  border-bottom: 0;
  border-radius: 20px 20px 0 0;
  box-shadow: var(--shadow);
  overflow: hidden;
  transform: translateY(24px);
  transition: transform .3s var(--ease);
}

.map-picker.show .map-picker-panel {
  transform: none;
}

.map-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.map-picker-head h2 {
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.map-picker-map {
  position: relative;
  flex: 1;
  min-height: 0;
}

#map-picker-canvas {
  position: absolute;
  inset: 0;
  background: var(--bg-2);
}

.map-layer-toggle {
  position: absolute;
  z-index: 500;
  top: 10px;
  right: 10px;
  display: flex;
  padding: 3px;
  gap: 2px;
  border-radius: 10px;
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
}

.map-layer-toggle button {
  border: 0;
  background: none;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
  cursor: pointer;
}

.map-layer-toggle button.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.map-locate {
  position: absolute;
  z-index: 500;
  right: 10px;
  bottom: 24px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--surface-solid);
  color: var(--primary);
  box-shadow: var(--shadow);
  cursor: pointer;
}

.map-picker-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px calc(12px + var(--safe-b));
  border-top: 1px solid var(--border);
}

.map-picker-foot > div {
  flex: 1;
  min-width: 0;
  font-weight: 600;
}

.map-picker-foot .btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* Leaflet theo giao diện */
.leaflet-container {
  font-family: inherit;
}

:root[data-theme="dark"] .leaflet-bar a,
:root:not([data-theme="light"]) .leaflet-bar a {
  background: var(--surface-solid);
  color: var(--text);
  border-color: var(--border-strong);
}