/* ESE-EXPRESS – arkusz stylów witryny i panelu klienta */

:root {
  --brand: #50c0e9;
  --brand-dark: #167ca3;
  --brand-deep: #09506d;
  --ink: #1d2a33;
  --muted: #5b6b76;
  --line: #d8eef7;
  --surface: #ffffff;
  --surface-soft: #f3f9fc;
  --footer: #0c3446;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(12, 52, 70, 0.10);
  --shadow-sm: 0 2px 10px rgba(12, 52, 70, 0.08);
  --content: 1200px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--surface-soft);
}

h2, h3 { line-height: 1.25; }

h2 {
  margin: 0 0 16px;
  color: var(--brand-dark);
  font-size: 1.75rem;
  font-weight: 700;
}

h3 {
  margin: 0 0 8px;
  color: var(--brand-dark);
  font-size: 1.1rem;
}

p { margin: 0 0 14px; font-size: 1rem; }

img { max-width: 100%; height: auto; }

button { font: inherit; }

input:focus-visible, button:focus-visible, a:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

[hidden] { display: none !important; }

/* --- UKŁAD STRONY: nagłówek, treść, stopka --- */
.site-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.site-content {
  flex: 1 0 auto;
  width: 100%;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: var(--content);
  margin: 0 auto;
  padding: 14px 24px;
}

.title {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--brand-dark);
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.title::before {
  content: "";
  flex: none;
  width: 14px;
  height: 28px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--brand), var(--brand-dark));
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

nav button.menu, nav button.smenu {
  padding: 9px 16px;
  border: 0;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

nav button.menu { color: var(--ink); background: transparent; }
nav button.menu:hover { color: var(--brand-dark); background: var(--surface-soft); }
nav button.smenu { color: #fff; background: var(--brand-dark); }
nav button.smenu:hover { background: var(--brand-deep); }

.site-footer {
  flex: none;
  margin-top: 48px;
  color: #cfe6f0;
  background: var(--footer);
  border-top: 4px solid var(--brand);
}

.site-footer-inner {
  max-width: var(--content);
  margin: 0 auto;
  padding: 28px 24px;
  display: flex;
  align-items: center;
  font-size: 0.9rem;
}

/* --- STRONY PUBLICZNE --- */
main {
  max-width: var(--content);
  margin: 0 auto;
  padding: 48px 24px 0;
}

main.home-page, main.contact {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  align-items: center;
  gap: 48px;
}

.hero-image, .contact-img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--line);
}

main.home-page section, .contact-info {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 36px 40px;
}

main.home-page section p:first-of-type {
  font-size: 1.1rem;
  color: var(--ink);
}

main.home-page section p { color: var(--muted); }
main.home-page section p:last-child, .contact-info p:last-child { margin-bottom: 0; }

main.contact { align-items: start; }
.contact-info { border-top: 4px solid var(--brand); }

/* --- STRONA LOGOWANIA I REJESTRACJI --- */
main.login {
  display: flex;
  justify-content: center;
  padding: 56px 24px 0;
}

.client-preview {
  width: 100%;
  max-width: 480px;
  padding: 36px 40px 32px;
  background: var(--surface);
  border-radius: 16px;
  border-top: 5px solid var(--brand);
  box-shadow: var(--shadow);
}

.client-preview > h2 {
  margin: 0 0 4px;
  color: var(--brand);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: center;
}

.client-preview > p { margin: 0; min-height: 0; }

.client-preview > p:has(span:not(:empty)) {
  margin: 12px 0 18px;
  padding: 10px 14px;
  border-radius: 8px;
  background: #fff4e5;
  border-left: 4px solid #e8a33d;
  font-size: 0.95rem;
}

.auth-grid { width: 100%; }

.login-form { width: 100%; }

.login-form h2 {
  margin: 0 0 20px;
  text-align: center;
  font-size: 1.6rem;
}

.login-form > p {
  color: var(--muted);
  font-size: 0.95rem;
  text-align: center;
}

.login-form label {
  display: block;
  margin-top: 14px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
}

.login-form input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 12px 14px;
  font: inherit;
  font-weight: 400;
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px solid #c9dde6;
  border-radius: 8px;
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}

.login-form input:focus {
  outline: none;
  background: #fff;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(80, 192, 233, 0.25);
}

.login-form button {
  display: block;
  width: 100%;
  margin-top: 22px;
  padding: 12px 18px;
  color: #fff;
  background: var(--brand-dark);
  border: 1px solid var(--brand-dark);
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

.login-form button:hover:not(:disabled) { background: var(--brand-deep); border-color: var(--brand-deep); }

.login-form button.secondary {
  margin-top: 10px;
  color: var(--brand-dark);
  background: transparent;
}

.login-form button.secondary:hover:not(:disabled) { color: #fff; background: var(--brand-dark); }

button:disabled { opacity: 0.55; cursor: wait; }
.login-form input:disabled { cursor: wait; }

/* --- PANEL KLIENTA --- */
#clientPanelPlaceholder { width: 100%; }

.client-panel {
  min-height: 100vh;
  background: var(--surface-soft);
  overflow-wrap: anywhere;
}

.account-toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.panel-title {
  flex: none;
  color: var(--brand-dark);
  font-size: 1.05rem;
  white-space: nowrap;
}

.account-tabs {
  display: flex;
  /* zakładki zawsze w osobnym wierszu paska, przewijane poziomo na wąskich ekranach */
  order: 3;
  flex: 1 1 100%;
  flex-wrap: nowrap;
  gap: 4px;
  min-width: 0;
  overflow-x: auto;
}

.account-tabs button {
  flex: none;
  padding: 8px 14px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 999px;
  white-space: nowrap;
  cursor: pointer;
}

.account-tabs button:hover { color: var(--brand-dark); background: var(--surface-soft); }
.account-tabs button.active { color: #fff; background: var(--brand-dark); }

.account-session {
  display: flex;
  flex: none;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  font-size: 0.9rem;
  color: var(--muted);
  white-space: nowrap;
}

.account-session button {
  padding: 7px 14px;
  color: var(--brand-dark);
  background: transparent;
  border: 1px solid var(--brand-dark);
  border-radius: 8px;
  cursor: pointer;
}

.account-session button:hover { color: #fff; background: var(--brand-dark); }

.client-panel > div:not(.account-toolbar) {
  max-width: var(--content);
  margin: 0 auto;
  padding: 32px 24px 48px;
}

#profilePanel h2 { font-size: 1.5rem; }

.client-panel dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 10px 24px;
  max-width: 560px;
  margin: 20px 0;
  padding: 20px 24px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.client-panel dt { font-weight: 600; color: var(--muted); }
.client-panel dd { margin: 0; }

/* --- TEST POŁĄCZENIA (tylko z #conntest w adresie, prawy dolny róg) --- */
.connection-test {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 30;
  width: 310px;
  max-width: calc(100vw - 32px);
  padding: 12px 16px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.connection-test strong { display: block; font-size: 0.85rem; }

.connection-test button {
  margin-top: 8px;
  padding: 7px 12px;
  color: #fff;
  background: var(--brand-dark);
  border: 0;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
}

.connection-test button:hover { background: var(--brand-deep); }

.connection-test p {
  margin: 8px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

/* --- RESPONSYWNOŚĆ --- */

@media (max-width: 900px) {
  main.home-page, main.contact {
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .hero-image, .contact-img { aspect-ratio: 16 / 9; max-height: 420px; }
  main { padding-top: 32px; }
  main.home-page section, .contact-info { padding: 28px; }
}

@media (max-width: 680px) {
  .site-header-inner {
    flex-direction: column;
    gap: 10px;
    padding: 12px 16px;
  }
  .title { font-size: 1.35rem; }
  nav {
    flex-wrap: nowrap;
    justify-content: center;
    width: 100%;
  }
  nav button.menu, nav button.smenu {
    flex: 1 1 0;
    padding: 9px 8px;
    font-size: 0.75rem;
    letter-spacing: 0.03em;
  }
  h2 { font-size: 1.4rem; }
  main { padding: 24px 16px 0; }
  main.home-page section, .contact-info { padding: 22px 20px; }
  main.login { padding: 24px 12px 0; }
  .client-preview { padding: 26px 20px 24px; border-radius: 12px; }
  .site-footer { margin-top: 32px; }
  .site-footer-inner {
    justify-content: center;
    text-align: center;
    padding: 22px 16px;
  }
  .connection-test {
    right: 8px; bottom: 8px; width: calc(100vw - 16px); max-width: none;
    display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 12px; padding: 10px 14px;
  }
  .connection-test button { margin-top: 0; grid-row: span 2; grid-column: 2; }
  .connection-test p { margin: 0; }
  .account-toolbar { padding: 10px 12px; }
  .account-tabs { justify-content: flex-start; }
  .panel-title { font-size: 0.95rem; }
  .panel-title { flex-basis: 100%; }
  .account-session { margin-left: 0; white-space: normal; flex-wrap: wrap; font-size: 0.85rem; }
  .client-panel > div:not(.account-toolbar) { padding: 24px 16px 32px; }
  .client-panel dl { display: block; }
  .client-panel dd { margin: 4px 0 14px; }
}

/* --- REJESTRACJA: zgoda na regulamin --- */
.login-form label.terms-consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 18px;
  font-weight: 400;
  line-height: 1.45;
}

.login-form input[type="checkbox"] {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  padding: 0;
  accent-color: var(--brand-dark);
}

.terms-consent a { color: var(--brand-dark); font-weight: 600; }

/* --- STRONA REGULAMINU --- */
main.terms-page { display: block; }

.terms-card {
  max-width: 820px;
  margin: 0 auto;
  padding: 36px 40px;
  background: var(--surface);
  border-radius: var(--radius);
  border-top: 4px solid var(--brand);
  box-shadow: var(--shadow-sm);
}

/* --- PANEL KLIENTA: firma, wybór firmy, komunikaty --- */
.panel-heading { display: flex; flex: none; flex-direction: column; line-height: 1.25; }
.panel-company { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.panel-company:empty { display: none; }

.client-panel > div.panel-status { padding-bottom: 0; }
.panel-status:has(span:empty) { display: none; }
.panel-status p {
  margin: 0;
  padding: 10px 14px;
  border-radius: 8px;
  background: #fff4e5;
  border-left: 4px solid #e8a33d;
}

.company-list { display: grid; gap: 10px; max-width: 560px; }

.company-choice {
  padding: 14px 18px;
  text-align: left;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.company-choice:hover { border-color: var(--brand); color: var(--brand-dark); }

/* --- PANEL ADMINISTRATORA --- */
.admin-title { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.admin-title h2 { margin: 0; }

.admin-title button {
  padding: 8px 16px;
  color: var(--brand-dark);
  background: transparent;
  border: 1px solid var(--brand-dark);
  border-radius: 8px;
  cursor: pointer;
}

.admin-title button:hover:not(:disabled) { color: #fff; background: var(--brand-dark); }
.admin-content > p { margin: 12px 0; min-height: 1.5em; color: var(--muted); }

.admin-counters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.admin-counter {
  padding: 18px 20px;
  color: var(--muted);
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.admin-counter strong { display: block; color: var(--brand-dark); font-size: 1.8rem; line-height: 1.2; }
.admin-content h3 { margin-top: 28px; }

.admin-table {
  overflow-x: auto;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.admin-table table { width: 100%; min-width: 720px; border-collapse: collapse; font-size: 0.9rem; overflow-wrap: normal; }
.admin-table th, .admin-table td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.admin-table th { color: var(--muted); font-weight: 600; background: var(--surface-soft); white-space: nowrap; }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table .muted { color: var(--muted); }

@media (max-width: 680px) {
  .terms-card { padding: 24px 20px; }
  .panel-heading { flex-basis: 100%; }
  .admin-counters { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .admin-counter { padding: 12px; font-size: 0.8rem; }
  .admin-counter strong { font-size: 1.4rem; }
}

