/* ============================================================
   PlantLab tool — mobile-first, тёмная тема
   База: 1rem = 20px при ширине экрана 360px (font-size: 5.5555dvw)
   ============================================================ */
:root{
  --bg:      #000000;
  --text:    #ffffff;
  --panel:   #002140;
  --accent:  #fffe02;
  --danger:  #ef3124;

  --muted:   rgba(255,255,255,.55);
  --divider: rgba(255,255,255,.08);

  --r:    0.8rem;    /* 16px */
  --r-sm: 0.5rem;    /* 10px */

  --pad:  0.8rem;    /* 16px */
  --gap:  0.6rem;    /* 12px */

  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

*{ box-sizing: border-box; }

html{
  font-size: 5.5555dvw;
}

html, body{
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  font-size: 0.8rem;    /* 16px */
  line-height: 1.45;
}

@media (min-width: 480px) {
    html{
        font-size: 20px;
    }
}

/* ограничиваем ширину на любых экранах — «десктопы не интересны» */
body > header,
body > main,
body > footer{
  max-width: 24rem;     /* 480px */
  margin: 0 auto;
  padding-left: var(--pad);
  padding-right: var(--pad);
}

a{
  color: var(--accent);
  text-decoration: none;
  transition: opacity .2s ease;
}
a:hover{ opacity: .8; }

/* ---------------------------------------------------------- topbar */
.topbar{
  display: flex;
  flex-flow: column nowrap;
  align-items: flex-start;
  justify-content: flex-start;
  gap: calc(var(--gap) * 2);
  padding-top: 1rem;    /* 20px */
  padding-bottom: 0.8rem; /* 16px */
}
.brand{ display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.brand svg { width: 8rem; height: 0.8rem; display: block; }

.nav{
  display: flex;
  align-items: center;
  gap: 0.3rem;          /* 6px */
  flex-wrap: wrap;
  justify-content: flex-end;
}
.nav-link{
  color: var(--text);
  padding: 0.4rem 0.6rem;   /* 8 / 12 */
  border-radius: var(--r-sm);
  font-size: 0.7rem;        /* 14px */
  font-weight: 600;
  transition: background .2s ease, color .2s ease;
}
.nav-link:hover{ background: rgba(255,255,255,.06); opacity: 1; }
.nav-link.is-active{
  background: var(--accent);
  color: #000;
}
.nav-link--ghost{ color: var(--muted); }
.nav-link--ghost:hover{ color: var(--text); }

/* ---------------------------------------------------------- main */
.main{
  padding-top: 0.4rem;      /* 8px */
  padding-bottom: 2rem;     /* 40px */
  animation: fade-in .25s ease both;
}
@keyframes fade-in{
  from{ opacity: 0; transform: translateY(0.2rem); }  /* 4px */
  to  { opacity: 1; transform: none; }
}

/* ---------------------------------------------------------- type */
h1{ font-size: 1.1rem; margin: 0.4rem 0 0.8rem; font-weight: 700; letter-spacing: .2px; } /* 22/8/16 */
h2{ font-size: 0.85rem; margin: 1.2rem 0 0.5rem; font-weight: 700; }                      /* 17/24/10 */
p { margin: 0 0 0.6rem; }          /* 12px */
.muted{ color: var(--muted); }
.small{ font-size: 0.65rem; }      /* 13px */
.tiny { font-size: 0.6rem; }       /* 12px */

/* ---------------------------------------------------------- card */
.card{
  background: var(--panel);
  border-radius: var(--r);
  padding: 0.9rem;              /* 18px */
  margin: 0 0 0.7rem;           /* 14px */
}
.card--flat{ background: rgba(0,33,64,.5); }

/* ---------------------------------------------------------- form */
.field{ display: block; margin-bottom: 0.7rem; }   /* 14px */
.field-label{
  display: block;
  font-size: 0.65rem;           /* 13px */
  color: var(--muted);
  margin-bottom: 0.3rem;        /* 6px */
}
.input{
  width: 100%;
  background: rgba(255,255,255,.06);
  color: var(--text);
  border: none;
  border-radius: var(--r-sm);
  padding: 0.7rem 0.8rem;       /* 14 / 16 */
  font-size: 0.8rem;            /* 16px */
  font-family: inherit;
  transition: background .2s ease, box-shadow .2s ease;
}
.input:focus{
  outline: none;
  background: rgba(255,255,255,.10);
  box-shadow: 0 0 0 2px var(--accent);   /* 2px — оставляем как визуальный хэйрлайн */
}

/* file input — кастомный вид */
.file{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;                  /* 10px */
  padding: 1.4rem 0.8rem;       /* 28 / 16 */
  border-radius: var(--r);
  background: rgba(255,255,255,.05);
  color: var(--muted);
  font-size: 0.75rem;           /* 15px */
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
  text-align: center;
}
.file:hover{ background: rgba(255,255,255,.08); color: var(--text); }
.file input{ display: none; }
.file.has-file{
  background: rgba(255,254,2,.10);
  color: var(--accent);
}
.file-name{
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------------------------------------------------------- buttons */
.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;                  /* 8px */
  width: 100%;
  padding: 0.75rem 1rem;        /* 15 / 20 */
  border: none;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: #000;
  font-family: inherit;
  font-size: 0.8rem;            /* 16px */
  font-weight: 700;
  cursor: pointer;
  transition: transform .15s ease, filter .2s ease;
  text-decoration: none;
}
.btn:hover{ filter: brightness(1.05); opacity: 1; }
.btn:active{ transform: scale(.98); }
.btn--ghost{
  background: transparent;
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);  /* 1px хэйрлайн */
}
.btn--ghost:hover{ background: rgba(255,255,255,.06); }
.btn--danger{ background: var(--danger); color: #fff; }

/* ---------------------------------------------------------- alerts */
.alert{
  padding: 0.7rem 0.8rem;       /* 14 / 16 */
  border-radius: var(--r-sm);
  margin-bottom: 0.7rem;        /* 14px */
  font-size: 0.7rem;            /* 14px */
  animation: fade-in .2s ease both;
}
.alert--error{
  background: rgba(239,49,36,.15);
  color: #ffb8b3;
}
.alert--ok{
  background: rgba(255,254,2,.10);
  color: var(--accent);
}

/* ---------------------------------------------------------- table */
.table{
  width: 100%;
  border-collapse: collapse;
  font-size: 0.7rem;            /* 14px */
}
.table th,
.table td{
  text-align: left;
  padding: 0.5rem 0.3rem;       /* 10 / 6 */
  vertical-align: top;
  border-bottom: 1px solid var(--divider);
}
.table tr:last-child th,
.table tr:last-child td{ border-bottom: none; }
.table th{
  color: var(--muted);
  font-weight: 600;
  width: 30%;
}
.table td{ color: var(--text); word-break: break-word; }

/* ---------------------------------------------------------- chip */
.chip{
  display: inline-block;
  padding: 0.2rem 0.5rem;       /* 4 / 10 */
  border-radius: 50rem;         /* было 999px — визуально pill */
  font-size: 0.6rem;            /* 12px */
  font-weight: 700;
  background: rgba(255,255,255,.08);
  color: var(--text);
}
.chip--accent{ background: var(--accent); color: #000; }
.chip--danger{ background: var(--danger); color: #fff; }
.chip--ok    { background: #0f7a3d; color: #fff; }

/* ---------------------------------------------------------- image */
.shot{
  width: 100%;
  display: block;
  border-radius: var(--r);
  background: rgba(255,255,255,.04);
}

/* ---------------------------------------------------------- history list */
.h-list{ display: grid; gap: 0.5rem; }       /* 10px */
.h-item{
  display: grid;
  grid-template-columns: 3.6rem 1fr;         /* 72px */
  gap: 0.6rem;                               /* 12px */
  align-items: center;
  background: var(--panel);
  border-radius: var(--r);
  padding: 0.5rem;                           /* 10px */
  color: var(--text);
  transition: background .2s ease, transform .15s ease;
}
.h-item:hover{ background: #00305c; opacity: 1; }
.h-item:active{ transform: scale(.99); }
.h-thumb{
  width: 3.6rem; height: 3.6rem;             /* 72px */
  border-radius: var(--r-sm);
  object-fit: cover;
  display: block;
  background: rgba(255,255,255,.06);
}
.h-body{ min-width: 0; }
.h-date{
  font-size: 0.6rem;                         /* 12px */
  color: var(--muted);
  margin-bottom: 0.2rem;                     /* 4px */
}
.h-summary{
  font-size: 0.7rem;                         /* 14px */
  font-weight: 600;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ---------------------------------------------------------- select month */
.select-wrap{
  position: relative;
  margin-bottom: 0.8rem;                     /* 16px */
}
.select-wrap::after{
  content: "▾";
  position: absolute;
  right: 0.8rem; top: 50%;                   /* 16px */
  transform: translateY(-50%);
  color: var(--accent);
  pointer-events: none;
  font-size: 0.7rem;                         /* 14px */
}
.select{
  width: 100%;
  appearance: none;
  background: var(--panel);
  color: var(--text);
  border: none;
  border-radius: var(--r-sm);
  padding: 0.7rem 2rem 0.7rem 0.8rem;        /* 14 / 40 / 14 / 16 */
  font-family: inherit;
  font-size: 0.75rem;                        /* 15px */
  font-weight: 600;
}
.select:focus{ outline: none; box-shadow: 0 0 0 2px var(--accent); }

/* ---------------------------------------------------------- raw JSON */
.raw-toggle{ margin-top: 0.7rem; }           /* 14px */
.raw{
  margin-top: 0.6rem;                        /* 12px */
  background: rgba(255,255,255,.04);
  border-radius: var(--r-sm);
  padding: 0.7rem;                           /* 14px */
  font-family: var(--mono);
  font-size: 0.6rem;                         /* 12px */
  line-height: 1.5;
  color: var(--text);
  overflow-x: auto;
  white-space: pre;
  animation: fade-in .2s ease both;
}
.raw[hidden]{ display: none; }

/* ---------------------------------------------------------- footer */
.footer{
  padding-top: 1.2rem;                       /* 24px */
  padding-bottom: 1.6rem;                    /* 32px */
  text-align: center;
  font-size: 0.6rem;                         /* 12px */
  color: var(--muted);
}

/* ---------------------------------------------------------- usage strip */
.usage{
  margin-top: 0.9rem;                        /* 18px */
  text-align: center;
  font-size: 0.6rem;                         /* 12px */
  color: var(--muted);
}
.usage b{ color: var(--text); font-weight: 700; }