:root {
  --bg: #edf1f5;
  --bg-band: #e4ebf3;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --text: #152232;
  --text-soft: #5f6f82;
  --line: #cfd8e3;
  --brand: #23598f;
  --brand-strong: #1a466f;
  --danger: #b42318;
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Trebuchet MS", "Lucida Sans Unicode", "Lucida Grande", sans-serif;
  color: var(--text);
  background:
    linear-gradient(160deg, var(--bg-band) 0%, transparent 38%),
    linear-gradient(0deg, var(--bg), var(--bg));
}

#app {
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px;
}

.panel,
.screen,
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.panel {
  max-width: 460px;
  margin: 64px auto;
  padding: 20px;
  box-shadow: 0 10px 24px rgba(23, 41, 61, 0.08);
}

h1,
h2,
h3,
h4 {
  margin: 0 0 8px;
  line-height: 1.25;
}

label {
  display: block;
  margin-bottom: 12px;
  font-weight: 600;
  font-size: 0.95rem;
}

input,
button {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  font: inherit;
}

input {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

input:focus {
  outline: none;
  border-color: #7aa2ca;
  box-shadow: 0 0 0 3px rgba(35, 89, 143, 0.15);
}

button {
  border: 1px solid transparent;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 0.01em;
}

button:hover {
  background: var(--brand-strong);
}

.danger {
  background: var(--danger);
}

.hidden {
  display: none !important;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.topbar-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(98px, 1fr));
  gap: 8px;
}

.topbar-actions button {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line);
  font-size: 0.9rem;
  padding: 8px 10px;
}

.topbar-actions button:hover {
  border-color: #9eb4cc;
  background: #edf3fb;
}

.topbar-actions .danger,
.topbar-actions .danger:hover {
  border-color: #d3a0a0;
  color: #fff;
  background: var(--danger);
}

.screen {
  padding: 14px;
}

.row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.row input {
  flex: 1;
}

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

.filter-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.check-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-weight: 500;
  font-size: 0.9rem;
}

.check-inline input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.list.compact {
  gap: 6px;
}

.card {
  padding: 12px;
  background: #fff;
}

.card p {
  margin: 6px 0;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.tile {
  min-height: 86px;
  border: 1px solid #9cb4cd;
  background: #f0f5fb;
  color: #17314a;
  font-size: 0.98rem;
}

.tile:hover {
  background: #e6eef8;
}

.muted {
  color: var(--text-soft);
}

.hint {
  color: var(--text-soft);
  font-size: 0.88rem;
}

.suggestion {
  text-align: left;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
}

.suggestion:hover {
  background: #f4f8fd;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}

.upload-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
  padding: 10px;
  margin-bottom: 12px;
}

#photos-current {
  margin: 0 0 8px;
}

#photo-upload-form {
  margin: 0;
}

.thumb {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  background: #fff;
}

.thumb img {
  display: block;
  width: 100%;
  height: 128px;
  object-fit: cover;
}

.thumb span {
  display: block;
  padding: 8px;
  font-size: 0.82rem;
  color: var(--text-soft);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.html-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfe;
  padding: 8px;
  margin-bottom: 8px;
}

.meteo-icons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 10px;
}

.meteo-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.meteo-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 800;
  color: #fff;
}

.meteo-good {
  background: #e7f7ec;
  color: #155724;
  border-color: #b9e6c5;
}

.meteo-good .meteo-icon {
  background: #2e9e44;
}

.meteo-bad,
.meteo-high {
  background: #fdecea;
  color: #7a1e1e;
  border-color: #f4c1bc;
}

.meteo-bad .meteo-icon,
.meteo-high .meteo-icon {
  background: #c0352b;
}

.meteo-medium {
  background: #fff6e6;
  color: #7a4c0d;
  border-color: #f0d39e;
}

.meteo-medium .meteo-icon {
  background: #cf8a1c;
}

.meteo-low {
  background: #eaf4ff;
  color: #194f84;
  border-color: #b5d1ef;
}

.meteo-low .meteo-icon {
  background: #2e73b8;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.pagination button {
  width: auto;
  min-width: 100px;
  padding: 8px 10px;
}

.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  background: #102337;
  color: #fff;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  max-width: 360px;
}

.toast.error {
  background: #7f1d1d;
}

@media (max-width: 900px) {
  #app {
    padding: 12px;
  }

  .panel {
    margin: 24px auto;
  }

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

  .topbar-actions {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    width: 100%;
  }

  .row {
    flex-direction: column;
  }

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

  .pagination {
    justify-content: stretch;
    flex-direction: column;
    align-items: stretch;
  }

  .pagination button {
    width: 100%;
  }
}
