:root {
  --bg: #0c1110;
  --bg-soft: #121917;
  --card: #17211d;
  --card-2: #1d2823;
  --line: #2a3932;
  --text: #e6efe9;
  --text-muted: #a8b7af;
  --brand: #8bc34a;
  --brand-strong: #9fd455;
  --danger: #f87171;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 5%, rgba(139, 195, 74, 0.17), transparent 26%),
    radial-gradient(circle at 95% 8%, rgba(115, 167, 62, 0.11), transparent 24%),
    var(--bg);
}

h1,
h2,
h3,
p {
  margin: 0;
}

label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.92rem;
  color: var(--text-muted);
}

input,
select,
textarea,
button {
  font-family: inherit;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #101613;
  color: var(--text);
  padding: 0.72rem 0.78rem;
  font-size: 0.95rem;
}

textarea {
  resize: vertical;
  min-height: 86px;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  outline: 2px solid rgba(159, 212, 85, 0.4);
  outline-offset: 1px;
}

.stores-app {
  width: min(1140px, calc(100% - 1.2rem));
  margin: 0 auto;
  padding: 0.8rem 0 2.2rem;
  display: grid;
  gap: 0.75rem;
}

.card {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent), var(--card);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.brand-block {
  display: grid;
  grid-template-columns: 68px 1fr;
  gap: 0.9rem;
  align-items: center;
}

.brand-logo {
  width: 68px;
  height: 68px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: #0f1512;
}

.eyebrow {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--text-muted);
}

.subtext {
  color: var(--text-muted);
  margin-top: 0.3rem;
}

.status-block {
  display: grid;
  justify-items: end;
  gap: 0.35rem;
}

.pill,
.chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(159, 212, 85, 0.35);
  color: var(--brand-strong);
  background: rgba(139, 195, 74, 0.14);
  border-radius: 999px;
  padding: 0.3rem 0.62rem;
  font-size: 0.82rem;
  font-weight: 700;
}

.version {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.notice,
.helper {
  color: var(--text-muted);
  font-size: 0.93rem;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.form-grid {
  display: grid;
  gap: 0.78rem;
}

.grid-2 {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.tab-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tab-btn {
  border: 1px solid var(--line);
  background: #101613;
  color: var(--text);
  border-radius: 10px;
  padding: 0.55rem 0.8rem;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

.tab-btn.active {
  border-color: rgba(159, 212, 85, 0.45);
  background: rgba(139, 195, 74, 0.22);
  color: #dff1cf;
}

.auth-panel,
.tab-panel {
  display: none;
  margin-top: 0.9rem;
}

.auth-panel.active,
.tab-panel.active {
  display: block;
}

.btn {
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 0.68rem 0.88rem;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--brand);
  color: #15200f;
}

.btn-soft {
  background: #26342d;
  border-color: #36483f;
  color: var(--text);
}

.btn-danger {
  background: rgba(248, 113, 113, 0.18);
  border-color: rgba(248, 113, 113, 0.45);
  color: #ffdada;
}

.row-actions,
.session-row,
.session-actions,
.map-actions {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  flex-wrap: wrap;
}

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

.map-actions p {
  margin-left: auto;
}

.check-field {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text);
  min-height: 42px;
}

.check-field input,
.schedule-day input {
  width: auto;
}

.map-wrap {
  position: relative;
}

.stores-map {
  width: 100%;
  min-height: 340px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.map-wrap.expanded {
  position: fixed;
  inset: 0.6rem;
  z-index: 9002;
}

.map-wrap.expanded .stores-map {
  height: calc(100vh - 1.2rem);
  border-radius: var(--radius);
}

.map-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9001;
  background: rgba(0, 0, 0, 0.72);
}

.map-close {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  z-index: 9003;
}

.schedule-grid {
  display: grid;
  gap: 0.55rem;
}

.schedule-row {
  display: grid;
  gap: 0.55rem;
  grid-template-columns: minmax(170px, 1fr) minmax(130px, 1fr) minmax(130px, 1fr);
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.6rem;
  background: var(--card-2);
}

.schedule-day {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 700;
}

.product-list {
  display: grid;
  gap: 0.65rem;
}

.product-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card-2);
  padding: 0.7rem;
  display: grid;
  gap: 0.6rem;
}

.product-head {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  align-items: center;
}

.product-status {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.product-media {
  width: 92px;
  height: 92px;
  object-fit: cover;
  border-radius: 9px;
  border: 1px solid var(--line);
}

.media-grid {
  display: grid;
  gap: 0.6rem;
}

.media-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card-2);
  padding: 0.65rem;
  display: grid;
  grid-template-columns: 76px 1fr auto;
  gap: 0.65rem;
  align-items: center;
}

.media-thumb {
  width: 76px;
  height: 76px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: #0f1513;
}

.media-meta {
  display: grid;
  gap: 0.2rem;
}

.media-kind {
  font-size: 0.78rem;
  color: var(--brand-strong);
}

.media-date {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.preview-box {
  display: grid;
  gap: 0.42rem;
}

.preview-box p {
  border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
  padding-bottom: 0.32rem;
}

.log-box {
  margin: 0;
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem;
  background: #0f1513;
  color: #cfddd5;
  font-size: 0.82rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.busy-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.38rem 0.7rem;
  width: fit-content;
  color: var(--text-muted);
}

.spinner,
.boot-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(159, 212, 85, 0.2);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}

.boot-splash {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 0.55rem;
  z-index: 9500;
  background: rgba(8, 12, 10, 0.94);
  color: #d8e7dc;
}

.boot-spinner {
  width: 48px;
  height: 48px;
  margin: 0 auto;
  border-width: 4px;
}

.toast-host {
  position: fixed;
  right: 0.75rem;
  top: 0.75rem;
  z-index: 9999;
  display: grid;
  gap: 0.45rem;
  width: min(360px, calc(100% - 1.5rem));
}

.toast {
  border: 1px solid rgba(159, 212, 85, 0.35);
  background: #17211d;
  color: #def0d0;
  border-radius: 10px;
  padding: 0.65rem 0.78rem;
  box-shadow: var(--shadow);
  animation: toastIn 0.18s ease-out;
}

.toast.error {
  border-color: rgba(248, 113, 113, 0.45);
  color: #ffe2e2;
}

.is-hidden {
  display: none !important;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes toastIn {
  from {
    transform: translateY(-8px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (max-width: 920px) {
  .grid-3 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .stores-app {
    width: calc(100% - 0.7rem);
    padding-bottom: 1rem;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .status-block {
    width: 100%;
    justify-items: start;
  }

  .brand-block {
    grid-template-columns: 52px 1fr;
  }

  .brand-logo {
    width: 52px;
    height: 52px;
  }

  .grid-2,
  .schedule-row {
    grid-template-columns: 1fr;
  }

  .media-item {
    grid-template-columns: 1fr;
  }

  .media-thumb {
    width: 100%;
    height: 170px;
  }

  .map-actions p {
    margin-left: 0;
    width: 100%;
  }

  .stores-map {
    min-height: 300px;
  }
}
