/*
 * Apitheek Natural Premium – visual migration layer
 * Phase 1: shared tokens and application shell only.
 * Domain workflows and data behaviour remain in index.html.
 */
:root {
  --forest: #24483a;
  --sage: #789685;
  --honey-accent: #e5a82b;
  --cream-base: #f8f5ed;
  --surface: #fffefa;
  --charcoal: #26302b;
  --text-muted: #707a74;
  --border-soft: #dfe3dc;
  --success-soft: #edf5ef;
  --warning-soft: #fff7e7;
  --danger-soft: #fff2ef;
  --ink: var(--charcoal);
  --muted: var(--text-muted);
  --cream: var(--cream-base);
  --paper: var(--surface);
  --green: var(--forest);
  --honey: var(--honey-accent);
  --honey2: #f2c45a;
  --red: #b84a3d;
  --line: var(--border-soft);
  --shadow: 0 8px 24px rgba(36, 72, 58, .08);
}

html { background: var(--cream-base); }
body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--cream-base);
  color: var(--charcoal);
  line-height: 1.45;
  text-rendering: optimizeLegibility;
}

button, input, select, textarea { min-height: 44px; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, [role="button"]:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(229, 168, 43, .48);
  outline-offset: 2px;
}

.app { max-width: 1220px; }
.top {
  position: sticky;
  top: 0;
  z-index: 8;
  min-height: 72px;
  margin: -8px -10px 22px;
  padding: 10px;
  background: rgba(248, 245, 237, .94);
  backdrop-filter: blur(14px);
}
.brand { border-radius: 14px; color: var(--forest); }
.brand .mark {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  box-shadow: 0 5px 16px rgba(36, 72, 58, .13);
}
.brand h1 {
  color: var(--forest);
  font-size: 1.38rem;
  font-weight: 780;
  letter-spacing: -.035em;
}
.brand small { color: var(--text-muted); font-size: .82rem; }
.account-state { gap: 10px; }
.sync-dot { width: 9px; height: 9px; }
.header-icon {
  width: 46px;
  min-width: 46px;
  height: 46px;
  min-height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: var(--surface);
  color: var(--forest);
  box-shadow: 0 4px 14px rgba(36, 72, 58, .06);
}
.header-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.avatar {
  min-width: 62px;
  height: 46px;
  min-height: 46px;
  border-color: var(--border-soft);
  border-radius: 14px;
  background: var(--surface);
  color: var(--charcoal);
  box-shadow: 0 4px 14px rgba(36, 72, 58, .06);
}
.avatar-menu { color: var(--forest); }
.avatar.active { border-color: var(--forest); background: #edf3ef; }

.headline h2 { color: var(--charcoal); letter-spacing: -.025em; }
.headline p, .dashboard-head small { color: var(--text-muted); }
.section-title h3, .dashboard-head h3 { color: var(--charcoal); }

/* Today v1: intentionally quiet, focused and field-readable. */
.layout.today-layout {
  display: block;
  max-width: 960px;
  margin: 0 auto;
}
#mainLayout { display: block; max-width: 1120px; margin: 0 auto; }
#workAside { display: none !important; }
#mainLayout.today-layout #workAside { display: none !important; }
.today-headline {
  position: relative;
  align-items: flex-start;
  margin: 8px 0 34px;
  padding: 10px 0 27px;
  border-bottom: 1px solid var(--border-soft);
}
.today-headline::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 72px;
  height: 3px;
  border-radius: 99px;
  background: var(--honey-accent);
}
.today-headline h2 {
  margin: 0 0 7px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.35rem, 5vw, 3.7rem);
  line-height: 1.03;
  font-weight: 700;
  letter-spacing: -.045em;
  color: var(--forest);
}
.today-headline p { font-size: 1rem; }
.dashboard { margin: 0 0 34px; }
.dashboard-head { margin-bottom: 15px; }
.dashboard-head h3 { font-size: 1.3rem; letter-spacing: -.02em; }
.dashboard-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.dash-stat {
  position: relative;
  min-height: 130px;
  padding: 22px 20px 18px;
  overflow: hidden;
}
.dash-stat::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--sage);
  opacity: .72;
}
.dash-stat strong {
  margin-bottom: 17px;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 2.65rem;
  font-weight: 720;
  letter-spacing: -.06em;
  color: var(--forest);
}
.dash-stat span { display: block; max-width: calc(100% - 20px); font-size: .94rem; line-height: 1.3; }
.dash-stat i {
  position: absolute;
  right: 18px;
  bottom: 16px;
  color: var(--sage);
  font-size: 1.5rem;
  font-style: normal;
}
.dash-stat.danger, .dash-stat.warn { background: var(--surface); }
.dash-stat.danger::before { background: #c95345; }
.dash-stat.warn::before { background: var(--honey-accent); }
.dash-stat.danger strong { color: #a94236; }
.dash-stat.warn strong { color: #8a5c08; }
.today-tasks-head { margin-top: 0; padding-top: 2px; border-top: 0; }
.today-tasks-head h3 { font-size: 1.3rem; letter-spacing: -.02em; }
.all-tasks-link { display: inline-flex; align-items: center; gap: 6px; padding: 8px 0 8px 12px; }
.all-tasks-link span { font-size: 1.35rem; line-height: 1; }
#todayView .tasks { gap: 12px; }
#todayView .task {
  min-height: 82px;
  padding: 14px 16px;
  border-left-width: 1px;
  background: var(--surface);
}
#todayView .task.today { border-left: 4px solid #c95345; }
.today-empty {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 90px;
  padding: 18px;
  border: 1px solid #cfddd4;
  border-radius: 16px;
  background: var(--success-soft);
  color: var(--forest);
}
.today-empty > span {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--surface);
  font-size: 1.2rem;
  font-weight: 800;
}
.today-empty b, .today-empty small { display: block; }
.today-empty small { margin-top: 3px; color: var(--text-muted); }
.task-list-modal { width: min(760px, calc(100vw - 28px)); }
.task-list-modal .tasks { margin-top: 20px; max-height: 58vh; overflow: auto; }
.today-delight {
  position: relative;
  height: 260px;
  margin: 28px 0 -18px;
  overflow: hidden;
  border-radius: 0;
  background: #faf7ee;
  box-shadow: none;
}
.today-delight img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 9%, #000 94%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 9%, #000 94%, transparent 100%);
}
.today-delight figcaption {
  position: absolute;
  left: 7%;
  top: 24%;
  margin: 0;
  color: var(--forest);
  font-family: "Segoe Print", "Bradley Hand", cursive;
  font-size: clamp(1.45rem, 3vw, 2rem);
  line-height: 1.35;
  transform: rotate(-5deg);
}

/* Apiaries: information-rich cards without dashboard clutter. */
.apiaries-headline {
  margin: 6px 0 26px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border-soft);
}
.apiaries-headline h2 {
  color: var(--forest);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.25rem, 4.6vw, 3.25rem);
  line-height: 1.04;
}
#apiariesView > .section-title { margin-top: 0; }
.apiary-toolbar {
  display: flex;
  justify-content: flex-end;
  margin: -10px 0 16px;
}
.apiary-toolbar label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: .82rem;
  font-weight: 700;
}
.apiary-toolbar select {
  min-height: 44px;
  padding: 0 36px 0 13px;
  border: 1px solid var(--border-soft);
  border-radius: 13px;
  background: var(--surface);
  color: var(--charcoal);
  font: inherit;
}
.apiary-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.apiary-card {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  min-height: 238px;
  padding: 0;
  overflow: hidden;
  border-radius: 16px;
  text-align: left;
}
.apiary-card:hover { transform: translateY(-3px); box-shadow: 0 14px 32px rgba(36, 72, 58, .13); }
.apiary-card-visual {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 100%;
  background: linear-gradient(155deg, #dce8df 0%, #f5ead0 100%);
  overflow: hidden;
}
.apiary-card-visual::after {
  content: "";
  position: absolute;
  width: 92px;
  height: 92px;
  border: 1px solid rgba(36, 72, 58, .12);
  border-radius: 50%;
}
.apiary-card-visual img {
  position: relative;
  z-index: 1;
  width: 60px;
  height: 60px;
  border-radius: 17px;
  object-fit: cover;
  box-shadow: 0 8px 22px rgba(36, 72, 58, .15);
}
.apiary-card-body { display: flex; min-width: 0; padding: 18px; flex-direction: column; }
.apiary-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.apiary-card h3 {
  margin: 0 0 5px;
  color: var(--charcoal);
  font-size: 1.3rem;
  line-height: 1.15;
  letter-spacing: -.025em;
}
.apiary-card .address {
  display: block;
  max-width: 250px;
  overflow: hidden;
  color: var(--text-muted);
  font-size: .86rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.apiary-card .status { flex: 0 0 auto; padding: 6px 9px; font-size: .72rem; }
.apiary-card-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 18px 0 14px;
}
.apiary-card-metrics > span {
  min-width: 0;
  padding: 10px 8px;
  border-radius: 12px;
  background: var(--cream-base);
}
.apiary-card-metrics strong {
  display: block;
  margin-bottom: 4px;
  color: var(--forest);
  font-size: 1.25rem;
  line-height: 1;
}
.apiary-card-metrics small {
  display: block;
  color: var(--text-muted);
  font-size: .7rem;
  line-height: 1.2;
}
.apiary-card-metrics .needs-attention {
  background: #fff0ed;
}
.apiary-card-metrics .needs-attention strong { color: #c74436; }
.apiary-card-details {
  display: grid;
  gap: 4px;
  margin: -3px 0 11px;
  color: var(--text-muted);
  font-size: .76rem;
  line-height: 1.3;
}
.apiary-card-details b { color: #b87800; }
.apiary-card-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
}
.apiary-card-footer > span:first-child { display: grid; gap: 2px; min-width: 0; }
.apiary-card-footer small { color: var(--text-muted); font-size: .72rem; }
.apiary-card-footer b { overflow: hidden; color: var(--forest); font-size: .88rem; text-overflow: ellipsis; white-space: nowrap; }
.apiary-open {
  width: 34px;
  height: 34px;
  display: grid;
  flex: 0 0 34px;
  place-items: center;
  border-radius: 11px;
  background: #edf3ef;
  color: var(--forest);
  font-size: 1.45rem;
}
.apiary-empty {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px;
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  background: var(--surface);
}
.apiary-empty img { width: 58px; height: 58px; border-radius: 16px; }
.apiary-empty b { font-size: 1.05rem; }
.apiary-empty p { margin: 3px 0 0; color: var(--text-muted); }

/* Apiary profile: final information architecture — Hives, Tasks, Supers. */
#apiaryDetail { width: min(760px, calc(100% - 24px)); max-width: 760px; }
.apiary-detail-shell { padding: 0 24px 26px; overflow: hidden; }
.apiary-detail-cover {
  height: 132px;
  margin: 0 -24px 18px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: linear-gradient(135deg, #e4eee5, #fbf1d9 62%, #f8f5ed);
}
.apiary-detail-cover img { width: 74px; height: 74px; border-radius: 20px; box-shadow: 0 10px 26px rgba(36,72,58,.14); }
.apiary-detail-heading h3 { color: var(--forest); font-family: Georgia, "Times New Roman", serif; font-size: 2rem; }
.apiary-detail-forage { display: inline-flex; margin-top: 7px; padding: 5px 10px; border-radius: 999px; background: #e9f1e5; color: var(--forest); font-size: .78rem; font-weight: 750; }
.apiary-detail-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.apiary-detail-stats .detail-stat { display: grid; gap: 5px; text-align: center; }
.apiary-detail-stats .detail-stat b { color: var(--forest); font-size: 1.15rem; }
.apiary-detail-note { margin: 12px 0; padding: 12px 14px; border-radius: 12px; background: #edf3ec; color: var(--charcoal); }
.apiary-detail-tabs { display: grid; grid-template-columns: repeat(3, 1fr); margin: 18px 0 4px; border-bottom: 1px solid var(--border-soft); }
.apiary-detail-tabs button { min-height: 46px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--text-muted); font-weight: 800; }
.apiary-detail-tabs button.active { border-bottom-color: var(--forest); color: var(--forest); }
.apiary-hive-list, .apiary-detail-list { display: grid; gap: 8px; }
.apiary-hive-chip, .apiary-detail-row { width: 100%; min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 14px; border: 1px solid var(--border-soft); border-radius: 13px; background: var(--surface); color: var(--charcoal); text-align: left; }
.apiary-hive-chip span, .apiary-detail-row span { display: grid; gap: 3px; }
.apiary-hive-chip small, .apiary-detail-row small { color: var(--text-muted); }
.apiary-hive-chip i, .apiary-detail-row i { color: var(--forest); font-size: 1.25rem; font-style: normal; }

.btn, .mini-btn, .linkbtn, .top-tabs button { min-height: 44px; }
.btn {
  border-radius: 14px;
  background: var(--forest);
  color: white;
}
.btn.gold { background: var(--forest); color: white; }
.action-launch, .bottom .action-launch {
  background: var(--honey-accent);
  color: var(--charcoal);
}
.btn.ghost, .mini-btn {
  background: var(--surface);
  border-color: var(--border-soft);
  color: var(--forest);
}
.linkbtn { color: var(--forest); }

.dash-stat, .alert, .task, .apiary-card, .hive, .panel.light,
.attention-item, .group, .detail-stat, .menu-card {
  border-color: var(--border-soft);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.dash-stat, .apiary-card, .hive { transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
.dash-stat:hover, .apiary-card:hover, .hive:hover { border-color: rgba(36, 72, 58, .32); }
.panel { border-radius: 18px; }
.panel:not(.light) { background: var(--forest); }
.status { background: var(--success-soft); color: var(--forest); }
.status.watch { background: var(--warning-soft); color: #825a13; }

dialog { border-radius: 20px; }
dialog::backdrop { background: rgba(25, 31, 27, .62); backdrop-filter: blur(2px); }
.close { min-height: 44px; width: 44px; height: 44px; background: var(--cream-base); color: var(--charcoal); }
.field input, .field select, .field textarea {
  min-height: 48px;
  border-color: var(--border-soft);
  border-radius: 12px;
  background: var(--surface);
}

.bottom {
  background: rgba(255, 254, 250, .97);
  border: 1px solid rgba(36, 72, 58, .13);
  box-shadow: 0 16px 42px rgba(36, 48, 43, .2);
}
.bottom button {
  min-width: 64px;
  min-height: 52px;
  color: var(--text-muted);
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
}
.bottom button span {
  color: currentColor;
  font-size: 20px;
  line-height: 1.05;
  margin-bottom: 4px;
}
.bottom button.active { color: var(--forest); background: #edf3ef; }
.bottom .action-launch {
  width: 58px;
  min-width: 58px;
  height: 58px;
  min-height: 58px;
  margin: -18px 4px 0;
  border-radius: 18px;
  box-shadow: 0 9px 22px rgba(229, 168, 43, .35);
}
.bottom .action-launch span {
  margin: 0;
  color: var(--charcoal);
  font-size: 30px;
  font-weight: 400;
}

@media (max-width: 780px) {
  .app { padding: 10px 16px 112px; }
  .top { margin: 0 -4px 20px; padding: 8px 4px; }
  .brand { gap: 10px; }
  .brand .mark { width: 44px; height: 44px; }
  .brand h1 { font-size: 1.28rem; }
  .account-state { gap: 7px; }
  .header-icon { width: 44px; min-width: 44px; height: 44px; min-height: 44px; }
  .avatar { min-width: 58px; height: 44px; min-height: 44px; padding: 0 9px; }
  .bottom {
    bottom: max(10px, env(safe-area-inset-bottom));
    width: calc(100% - 24px);
    max-width: 470px;
    justify-content: space-around;
    padding: 8px 6px;
    border-radius: 20px;
  }
  .bottom button { flex: 1; padding: 6px 3px; }
  .headline h2 { font-size: 2rem; }
  .today-headline { margin: 2px 0 28px; padding: 8px 0 23px; }
  .today-headline h2 { font-size: clamp(2rem, 8.7vw, 2.55rem); }
  .dashboard { margin-bottom: 26px; }
  .dashboard-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .dash-stat { min-height: 112px; padding: 17px 16px 15px; }
  .dash-stat:nth-child(3) { grid-column: 1 / -1; min-height: 92px; }
  .dash-stat strong { margin-bottom: 11px; font-size: 2.25rem; }
  .today-tasks-head { align-items: center; }
  #todayView .task { grid-template-columns: 1fr auto; }
  #todayView .task .task-check { grid-row: 2; grid-column: 1 / -1; width: 100%; }
  #todayView .task-actions { grid-column: 2; grid-row: 1; }
  .today-delight {
    width: 100vw;
    height: 230px;
    margin: 18px 0 -24px calc(50% - 50vw);
    border-radius: 0;
  }
  .today-delight figcaption { left: 7%; top: 22%; font-size: 1.45rem; }
  .apiaries-headline { margin-bottom: 20px; padding-bottom: 18px; }
  .apiaries-headline h2 { font-size: 2.3rem; }
  .apiary-toolbar { margin-top: -6px; }
  .apiary-toolbar label { width: 100%; justify-content: space-between; }
  .apiary-cards { grid-template-columns: 1fr; gap: 12px; }
  .apiary-card { grid-template-columns: 84px minmax(0, 1fr); min-height: 218px; }
  .apiary-card-body { padding: 15px; }
  .apiary-card-visual img { width: 52px; height: 52px; border-radius: 15px; }
  .apiary-card-visual::after { width: 74px; height: 74px; }
  .apiary-card-metrics { margin: 15px 0 12px; }
  .apiary-card-metrics > span { padding: 9px 6px; }
  .apiary-card-metrics small { font-size: .66rem; }
  #apiaryDetail { width: 100%; max-width: none; height: min(92dvh, 820px); margin: auto 0 0; border-radius: 24px 24px 0 0; }
  .apiary-detail-shell { max-height: 92dvh; padding: 0 16px calc(24px + env(safe-area-inset-bottom)); overflow-y: auto; }
  .apiary-detail-cover { height: 112px; margin: 0 -16px 16px; }
  .apiary-detail-heading h3 { font-size: 1.8rem; }
  .apiary-detail-stats { gap: 8px; }
  .apiary-detail-stats .detail-stat { padding: 10px 6px; }
  .apiary-detail-stats .detail-stat b { font-size: .95rem; }
  .apiary-detail-stats .detail-stat span { font-size: .68rem; }
}

@media (max-width: 380px) {
  .app { padding-left: 12px; padding-right: 12px; }
  .brand .mark { width: 40px; height: 40px; }
  .brand h1 { font-size: 1.18rem; }
  .header-icon { width: 40px; min-width: 40px; height: 40px; min-height: 40px; }
  .avatar { min-width: 54px; height: 40px; min-height: 40px; }
  .bottom { width: calc(100% - 16px); }
  .bottom button { min-width: 0; font-size: 10px; }
}

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