*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #f5f5f5;
  --bg-alt: #ffffff;
  --fg: #111111;
  --muted: #777777;
  --accent: #e53935;
  --accent-soft: rgba(229, 57, 53, 0.08);
  --border: #e0e0e0;
  --shadow-soft: 0 12px 30px rgba(0, 0, 0, 0.06);
  --radius-lg: 16px;
  --radius-xl: 24px;
}

body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, #ffffff 0, #f7f7f7 40%, #eeeeee 100%);
  color: var(--fg);
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.container {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 16px;
}

.header {
  padding-top: 16px;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.logo {
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 18px;
}

.logo span.accent {
  color: var(--accent);
}

.tagline {
  font-size: 12px;
  color: var(--muted);
}

.btn {
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 18px;
  cursor: pointer;
  background: var(--bg-alt);
  color: var(--fg);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.02);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.btn.primary {
  background: linear-gradient(135deg, #111111, #333333);
  color: #ffffff;
}

.btn.primary.red {
  background: linear-gradient(135deg, #e53935, #b71c1c);
}

.btn.secondary {
  background: #ffffff;
  border-color: var(--border);
}

.btn.text {
  background: transparent;
  border-color: transparent;
  padding-left: 0;
  padding-right: 0;
  box-shadow: none;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

.btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.main {
  flex: 1;
}

.hero {
  padding: 32px 0 8px;
}

.hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2.2fr);
  gap: 24px;
  align-items: center;
}

.hero-title {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 8px;
}

.hero-subtitle {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 14px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #b71c1c;
  font-size: 12px;
  font-weight: 500;
}

.hero-card {
  background: rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-xl);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(0, 0, 0, 0.02);
  backdrop-filter: blur(18px);
}

.hero-card-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.hero-card-text {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
}

.hero-card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.hero-card-kpi {
  font-size: 20px;
  font-weight: 700;
}

.hero-card-kpi span {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

/* contacts */
.contacts {
  margin-top: 24px;
}

.contacts-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.contact-card {
  border-radius: var(--radius-lg);
  padding: 12px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border 0.12s ease;
}

.contact-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.08);
}

.contact-label {
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.contact-main {
  font-weight: 600;
}

.contact-extra {
  color: var(--muted);
  font-size: 12px;
}

/* cards, layout shared */
.card {
  background: rgba(255, 255, 255, 0.96);
  border-radius: var(--radius-xl);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(0, 0, 0, 0.04);
  backdrop-filter: blur(18px);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
}

.card-subtitle {
  font-size: 12px;
  color: var(--muted);
}

.info {
  font-size: 13px;
  color: var(--muted);
}

.info strong {
  color: var(--fg);
}

/* modal */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(4px);
}

.modal-body {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  border-radius: 24px;
  padding: 20px 20px 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.2);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  border-radius: 999px;
  width: 26px;
  height: 26px;
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: #ffffff;
}

.switcher {
  display: inline-flex;
  background: #f5f5f5;
  border-radius: 999px;
  padding: 4px;
  margin-top: 4px;
}

.switcher-btn {
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
}

.switcher-btn.active {
  background: #ffffff;
  color: var(--fg);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

/* forms */
.form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
}

.field-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.field {
  display: flex;
  flex-direction: column;
}

.input {
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 9px 12px;
  font-size: 14px;
  outline: none;
  background: #fafafa;
}

.input:focus {
  border-color: var(--accent);
  background: #ffffff;
  box-shadow: 0 0 0 1px rgba(229, 57, 53, 0.16);
}

.form-footer {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.form-error {
  margin-top: 4px;
  font-size: 12px;
  color: #d32f2f;
}

/* client dashboard */
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2.5fr);
  gap: 20px;
  margin-top: 20px;
}

.qr-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.qr-canvas-wrap {
  width: 240px;
  height: 240px;
  border-radius: 24px;
  padding: 12px;
  background: #ffffff;
  border: 1px dashed rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-status {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.qr-expired {
  opacity: 0.3;
  filter: grayscale(1);
}

.badge-soft {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #f7f7f7;
  font-size: 11px;
  color: var(--muted);
}

.badge-soft span.value {
  color: var(--fg);
  font-weight: 600;
}

/* admin */
.admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 2.3fr) minmax(0, 3fr);
  gap: 20px;
  margin-top: 20px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table thead {
  background: #fafafa;
}

.table th,
.table td {
  padding: 6px 8px;
  border-bottom: 1px solid #f0f0f0;
}

.table tbody tr:hover {
  background: #fafafa;
}

.table th {
  text-align: left;
  font-weight: 500;
  color: var(--muted);
}

.status {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

/* qr reader */
#qr-reader {
  width: 100%;
  max-width: 360px;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--border);
  margin-top: 12px;
}

.hidden {
  display: none !important;
}

/* footer */
.footer {
  padding: 12px 0 18px;
  font-size: 11px;
  color: var(--muted);
}

/* responsive */
@media (max-width: 840px) {
  .hero-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .contacts-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dashboard-grid,
  .admin-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 520px) {
  .contacts-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .hero-title {
    font-size: 26px;
  }
}
