:root {
  --bg: #f1efe8;
  --bg-strong: #e3e7df;
  --surface: rgba(255, 252, 247, 0.88);
  --surface-solid: #fffdfa;
  --ink: #14211e;
  --muted: #5b6763;
  --line: rgba(25, 56, 50, 0.12);
  --brand: #0f3b36;
  --brand-soft: #2d6a61;
  --accent: #db8b2b;
  --danger: #b14646;
  --success: #2d7c62;
  --shadow: 0 24px 60px rgba(13, 37, 33, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #f7f8f4, #e7ece6 80%);
  min-height: 100vh;
}

a {
  color: inherit;
}

.shell {
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(245, 241, 234, 0.84);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.brand h1,
.section-head h2,
.record-card h3,
.hero-card h2,
.page-head h2,
.card h2 {
  margin: 0;
}

.brand p,
.hero-card p,
.page-head p,
.record-card p,
.topbar p {
  margin: 0;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), var(--brand-soft));
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.08em;
  box-shadow: var(--shadow);
}

.topbar p {
  color: var(--muted);
}

.user-panel {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.user-chip {
  display: grid;
  gap: 0.15rem;
  padding: 0.65rem 0.9rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid var(--line);
}

.user-chip span {
  color: var(--muted);
  font-size: 0.85rem;
}

.menu {
  display: flex;
  gap: 0.6rem;
  padding: 0.8rem 1.25rem 1rem;
  overflow-x: auto;
  position: sticky;
  top: 78px;
  z-index: 35;
  background: rgba(245, 241, 234, 0.76);
  backdrop-filter: blur(12px);
}

.menu a {
  white-space: nowrap;
  text-decoration: none;
  padding: 0.8rem 1rem;
  border-radius: 999px;
  font-weight: 700;
  color: var(--brand);
  border: 1px solid transparent;
}

.menu a.active {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 12px 24px rgba(15, 59, 54, 0.24);
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2rem;
}

.flash,
.alert,
.help-box {
  padding: 1rem 1.1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  border: 1px solid transparent;
}

.flash-success,
.help-box {
  background: rgba(45, 124, 98, 0.12);
  color: var(--success);
  border-color: rgba(45, 124, 98, 0.24);
}

.flash-error,
.alert {
  background: rgba(177, 70, 70, 0.12);
  color: var(--danger);
  border-color: rgba(177, 70, 70, 0.24);
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.35rem;
  box-shadow: var(--shadow);
}

.hero-panel,
.stats,
.dashboard-grid,
.split,
.auth-layout,
.single-column {
  display: grid;
  gap: 1.2rem;
}

.stats {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-top: 1.2rem;
}

.dashboard-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 1.2rem;
}

.split {
  grid-template-columns: minmax(320px, 440px) minmax(0, 1fr);
}

.auth-layout {
  grid-template-columns: 1.2fr 0.9fr;
  align-items: start;
  min-height: calc(100vh - 170px);
}

.single-column {
  justify-content: center;
}

.medium-card {
  max-width: 620px;
}

.hero-card {
  padding: 1.6rem;
}

.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1rem;
}

.pill-link,
.secondary-link,
.icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border-radius: 999px;
  font-weight: 700;
}

.pill-link {
  padding: 0.8rem 1rem;
  background: var(--brand);
  color: #fff;
}

.secondary-link,
.icon-link {
  padding: 0.7rem 0.95rem;
  background: rgba(15, 59, 54, 0.08);
  color: var(--brand);
}

.eyebrow,
.stat-label {
  display: inline-block;
  margin-bottom: 0.45rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 800;
}

.metric {
  margin: 0;
  font-size: clamp(2rem, 6vw, 3.25rem);
  line-height: 1;
  color: var(--brand);
  font-weight: 800;
}

.page-head,
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.page-head {
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.search-form {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
  width: min(100%, 480px);
}

.search-form input {
  flex: 1 1 220px;
}

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

.stack-form {
  display: grid;
  gap: 0.9rem;
}

.grid-form .full {
  grid-column: 1 / -1;
}

.reminder-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem 0.8rem;
  margin: 0;
  padding: 0.8rem 0.9rem 0.9rem;
  border: 1px solid rgba(15, 59, 54, 0.16);
  border-radius: 8px;
  background: var(--surface-solid);
}

.reminder-options.full {
  grid-column: 1 / -1;
}

.reminder-options legend {
  padding: 0 0.35rem;
  font-weight: 700;
}

.reminder-options label {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.55rem;
  min-height: 2rem;
  padding: 0.25rem 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-weight: 700;
  line-height: 1.2;
}

.reminder-options input {
  width: 1rem;
  min-height: auto;
  margin: 0;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 3rem;
  padding: 0.85rem 0.95rem;
  border-radius: 8px;
  border: 1px solid rgba(15, 59, 54, 0.16);
  background: var(--surface-solid);
}

.checkbox-field input {
  width: 1.15rem;
  min-height: auto;
  margin: 0;
}

.compact-head {
  margin-top: 1.25rem;
}

.log-card {
  background: rgba(255, 255, 255, 0.84);
}

label {
  display: grid;
  gap: 0.4rem;
  font-weight: 700;
}

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

input,
textarea,
select {
  width: 100%;
  min-height: 3rem;
  border-radius: 8px;
  border: 1px solid rgba(15, 59, 54, 0.16);
  padding: 0.85rem 0.95rem;
  background: var(--surface-solid);
  color: var(--ink);
}

textarea {
  min-height: 7rem;
  resize: vertical;
}

button {
  min-height: 3rem;
  border: 0;
  border-radius: 8px;
  padding: 0.85rem 1rem;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

button.secondary {
  background: rgba(15, 59, 54, 0.08);
  color: var(--brand);
}

.auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1rem;
  color: var(--muted);
}

.text-link {
  color: var(--brand);
  font-weight: 800;
  text-decoration: none;
}

.text-link:hover {
  text-decoration: underline;
}

.telegram-panel {
  display: grid;
  gap: 1rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 800;
}

.status-pill.success {
  background: rgba(45, 124, 98, 0.14);
  color: var(--success);
}

.status-pill.warning {
  background: rgba(219, 139, 43, 0.16);
  color: #8b5a16;
}

.muted-line {
  margin: 0;
  color: var(--muted);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.action-row form {
  margin: 0;
}

button.danger {
  background: rgba(177, 70, 70, 0.12);
  color: var(--danger);
}

.feature-list,
.mobile-cards {
  display: grid;
  gap: 0.8rem;
}

.feature-list {
  padding-left: 1.2rem;
  margin: 1rem 0 0;
}

.record-card {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.64);
}

.featured-record {
  background:
    linear-gradient(135deg, rgba(15, 59, 54, 0.08), rgba(219, 139, 43, 0.12)),
    rgba(255, 255, 255, 0.72);
}

.record-main {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.bulk-actions {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.select-all-control,
.record-select {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-weight: 800;
}

.select-all-control input,
.record-select input {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--brand);
}

.record-select {
  margin-bottom: 0.65rem;
  color: var(--brand);
}

.bulk-delete-button {
  min-height: 2.6rem;
  padding: 0 0.95rem;
}

.bulk-delete-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.plate {
  display: inline-block;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid rgba(15, 59, 54, 0.16);
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.auth-hero {
  position: relative;
  overflow: hidden;
  padding: 2rem;
  min-height: 100%;
  background:
    linear-gradient(145deg, rgba(3, 15, 35, 0.92), rgba(4, 42, 69, 0.58) 48%, rgba(2, 10, 26, 0.72)),
    url("/images/login-hero.jpg") center / cover no-repeat;
  color: #fff;
}

.auth-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(2, 9, 24, 0.1), rgba(2, 9, 24, 0.36));
  pointer-events: none;
}

.auth-hero > * {
  position: relative;
  z-index: 1;
  max-width: 680px;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.38);
}

.auth-hero .eyebrow,
.auth-hero p,
.auth-hero li {
  color: rgba(255, 255, 255, 0.9);
}

.login-card {
  align-self: center;
}

@media (max-width: 980px) {
  .dashboard-grid,
  .split,
  .auth-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .topbar {
    position: static;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.65rem;
    padding: 0.75rem 1rem;
  }

  .brand {
    gap: 0.7rem;
    min-width: 0;
  }

  .brand-mark {
    width: 2.4rem;
    height: 2.4rem;
    flex: 0 0 auto;
    font-size: 0.82rem;
    box-shadow: none;
  }

  .brand h1 {
    font-size: 1.55rem;
    line-height: 1.05;
  }

  .brand p {
    display: none;
  }

  .user-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
  }

  .user-chip {
    min-width: 0;
    padding: 0.45rem 0.6rem;
  }

  .user-chip strong {
    overflow: hidden;
    font-size: 0.95rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .user-chip span {
    font-size: 0.78rem;
  }

  .secondary-link,
  .user-panel button.secondary {
    padding: 0.55rem 0.7rem;
    border-radius: 999px;
    line-height: 1;
  }

  .user-panel form {
    margin: 0;
  }

  .menu {
    top: 0;
    gap: 0.45rem;
    overflow-x: auto;
    padding: 0.55rem 1rem 0.7rem;
  }

  .menu a {
    padding: 0.6rem 0.85rem;
  }

  .container {
    padding: 1rem 0.9rem 1.6rem;
  }

  .card {
    border-radius: 8px;
    padding: 1rem;
  }

  .page-head,
  .section-head,
  .record-main {
    flex-direction: column;
    align-items: stretch;
  }

  .grid-form,
  .search-form {
    grid-template-columns: 1fr;
  }

  .reminder-options {
    grid-template-columns: 1fr;
  }

  .search-form {
    width: 100%;
  }

  .actions {
    justify-content: stretch;
  }

  .bulk-actions {
    justify-content: stretch;
  }

  .select-all-control,
  .bulk-delete-button {
    width: 100%;
  }

  .select-all-control {
    justify-content: center;
    min-height: 2.6rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
  }

  .actions form,
  .actions a,
  .actions button {
    width: 100%;
  }

  .menu a,
  .pill-link,
  .secondary-link,
  .icon-link,
  button {
    min-height: 3rem;
  }

  .topbar .secondary-link,
  .topbar button.secondary {
    min-height: 2.35rem;
  }
}
