@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Fraunces:opsz,wght@9..144,500;9..144,700&display=swap");

:root {
  --bg: #eef5ff;
  --ink: #10213a;
  --ink-muted: #50617b;
  --surface: #fefeff;
  --line: #d7e3f4;
  --primary: #0070e0;
  --primary-dark: #005cc8;
  --warn: #c33652;
  --ok: #198754;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", "Segoe UI", Tahoma, sans-serif;
  color: var(--ink);
  background-image: linear-gradient(160deg, #e8f1ff 0%, #f2f8ff 48%, #e6f3ff 100%);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  background-attachment: fixed;
}

.container {
  width: min(980px, 92vw);
  margin: 0 auto;
}

.site-header {
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(4px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 68px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: var(--ink);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.brand-logo {
  height: 34px;
  width: auto;
  display: block;
}

.brand-text {
  font-size: 0.95rem;
}

nav a {
  color: var(--ink-muted);
  text-decoration: none;
  margin-left: 0;
  font-weight: 600;
}

nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
}

nav a:hover {
  color: var(--primary-dark);
}

.panel {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 1.25rem;
  margin: 1.3rem 0;
  border-radius: 16px;
  box-shadow: 0 16px 38px rgba(16, 33, 58, 0.08);
}

.hero {
  padding: 2rem;
}

h1, h2 {
  margin-top: 0;
  font-family: "Fraunces", Georgia, serif;
}

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

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.inline-import-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.inline-import-form input[type="file"] {
  max-width: 220px;
  background: #fff;
}

.form-grid {
  display: grid;
  gap: 0.65rem;
  max-width: 720px;
}

input, select, button {
  font: inherit;
}

input, select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.6rem 0.7rem;
  background: #fff;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 0.6rem;
  vertical-align: middle;
}

.button {
  border: 0;
  border-radius: 8px;
  background: var(--primary);
  color: white;
  padding: 0.58rem 0.95rem;
  text-decoration: none;
  cursor: pointer;
  display: inline-block;
  font-weight: 700;
}

.button:hover {
  background: var(--primary-dark);
}

.button-secondary {
  background: #7589a8;
}

.button-secondary:hover {
  background: #667d9f;
}

.button-small {
  padding: 0.42rem 0.68rem;
  font-size: 0.9rem;
}

.inline-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.flash-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}

.flash {
  border-radius: 8px;
  padding: 0.7rem 0.9rem;
  margin: 0.45rem 0;
}

.flash-success {
  background: #eaf6ea;
  color: var(--ok);
}

.flash-error {
  background: #fdeeee;
  color: var(--warn);
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.8rem;
}

.card-link {
  border: 1px solid var(--line);
  border-radius: 10px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  padding: 1.1rem;
  background: #f9fcff;
}

.card-link:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.7rem;
  margin: 0.25rem 0 1rem;
}

.stats-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.8rem 0.9rem;
  background: #f7fbff;
}

.stats-label {
  margin: 0;
  color: var(--ink-muted);
  font-weight: 600;
  font-size: 0.9rem;
}

.stats-value {
  margin: 0.25rem 0 0;
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--ink);
}

.pill {
  border-radius: 999px;
  font-size: 0.8rem;
  padding: 0.15rem 0.55rem;
  background: #e4e4de;
}

.pill.open {
  background: #fef1cb;
}

.pill.settled {
  background: #ddf3e1;
}

.positive {
  color: var(--ok);
}

.negative {
  color: var(--warn);
}

.booking-shell {
  background:
    linear-gradient(180deg, rgba(0, 112, 224, 0.05), rgba(0, 112, 224, 0)) no-repeat,
    var(--surface);
}

.booking-subline {
  color: var(--ink-muted);
  margin-top: -0.2rem;
}

.booking-stepper {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.85rem 0 0.35rem;
}

.stepper-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: #6c809e;
  font-weight: 700;
}

.stepper-item.is-current {
  color: var(--primary-dark);
}

.stepper-item.is-done {
  color: #226a45;
}

.stepper-index {
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #b8cdea;
  background: #fff;
  font-size: 0.82rem;
}

.stepper-item.is-current .stepper-index {
  border-color: #2e87f7;
  background: #eaf3ff;
}

.stepper-item.is-done .stepper-index {
  border-color: #5eb88b;
  background: #e7f8ef;
}

.stepper-line {
  width: 2.1rem;
  height: 2px;
  background: #b9cbe4;
}

.booking-form {
  display: grid;
  gap: 1.1rem;
}

.booking-step {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.95rem;
  background: #fcfeff;
  display: grid;
  gap: 0.8rem;
}

.booking-step.is-hidden {
  display: none;
}

.booking-step.is-disabled {
  opacity: 0.6;
}

.booking-step-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.person-selected {
  min-height: 1.35rem;
  font-weight: 600;
  color: var(--ink-muted);
}

.person-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.8rem;
}

.person-card {
  border: 1px solid #b5cbed;
  border-radius: 16px;
  background: linear-gradient(165deg, #f8fbff 0%, #eef6ff 100%);
  padding: 1rem;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
  min-height: 102px;
  display: grid;
  align-content: space-between;
  gap: 0.35rem;
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.person-card:hover {
  transform: translateY(-1px);
  border-color: #6fa8ee;
  box-shadow: 0 10px 20px rgba(0, 112, 224, 0.12);
}

.person-card.selected {
  border-color: #2e87f7;
  background: linear-gradient(160deg, #edf6ff 0%, #ddecff 100%);
  box-shadow: 0 8px 16px rgba(0, 90, 175, 0.15);
}

.person-card-name {
  font-size: 1.22rem;
  font-weight: 700;
  line-height: 1.2;
}

.person-card-meta {
  font-size: 0.88rem;
  color: var(--ink-muted);
}

.step-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.step-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.step-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.step-nav-right {
  justify-content: flex-end;
}

.person-balance {
  font-weight: 700;
  font-size: 0.92rem;
  border-radius: 999px;
  padding: 0.25rem 0.62rem;
  background: #edf3ff;
  color: #2858a7;
}

.article-selected-person {
  font-weight: 700;
  font-size: 0.92rem;
  border-radius: 999px;
  padding: 0.25rem 0.62rem;
  background: #e9f5ff;
  color: #1c517f;
}

.booking-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.9rem;
}

.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.9rem;
}

.article-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.9rem;
  display: grid;
  gap: 0.55rem;
  cursor: pointer;
  background: #fafdff;
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}

.article-card:hover {
  transform: translateY(-1px);
  border-color: #a7c8f2;
  box-shadow: 0 10px 20px rgba(0, 91, 175, 0.11);
}

.article-card.selected {
  border-color: #2e87f7;
  background: #eef6ff;
  box-shadow: 0 9px 20px rgba(0, 112, 224, 0.17);
}

.article-card header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.article-card h3 {
  margin: 0;
  font-size: 1.08rem;
}

.article-card p {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.92rem;
}

.type-badge {
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.73rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.type-badge.charge {
  background: #ffe4dd;
  color: #b4412f;
}

.type-badge.credit {
  background: #ddf5e9;
  color: #1f7e53;
}

.price {
  font-weight: 700;
}

.qty-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.3rem;
}

.qty-btn {
  width: 2.05rem;
  height: 2.05rem;
  border-radius: 999px;
  border: 1px solid #bed4ef;
  background: #fff;
  font-weight: 700;
  color: var(--primary-dark);
  cursor: pointer;
}

.qty-btn:hover {
  border-color: #90baf0;
  background: #f2f8ff;
}

.qty-value {
  min-width: 2ch;
  text-align: center;
  font-weight: 700;
  font-size: 1.02rem;
}

.booking-footer {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: center;
  flex-wrap: wrap;
}

.booking-summary {
  color: var(--ink-muted);
  font-weight: 500;
}

.booking-submit {
  min-width: 200px;
}

.recent-bookings {
  border-top: 1px solid var(--line);
  margin-top: 0.45rem;
  padding-top: 0.75rem;
}

.recent-bookings h3 {
  margin: 0 0 0.45rem;
  font-size: 1.02rem;
}

.recent-bookings-empty {
  color: var(--ink-muted);
  font-size: 0.92rem;
}

.recent-bookings-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.5rem;
}

.recent-booking-item {
  border: 1px solid #d6e3f5;
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  background: #f8fbff;
  display: grid;
  gap: 0.28rem;
}

.recent-booking-head {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
  font-size: 0.9rem;
}

.recent-booking-head span {
  color: var(--ink-muted);
}

.recent-booking-items {
  color: #27496f;
  font-size: 0.88rem;
}

@media (max-width: 768px) {
  .container {
    width: min(980px, 95vw);
  }

  .panel {
    padding: 1rem;
    border-radius: 12px;
  }

  nav {
    width: 100%;
    justify-content: flex-start;
    gap: 0.6rem;
  }

  nav a {
    font-size: 0.95rem;
    padding: 0.2rem 0;
  }

  .header-inner {
    min-height: 60px;
    padding: 0.45rem 0;
  }

  .booking-section-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .booking-step-head {
    align-items: flex-start;
  }

  .booking-stepper {
    margin-top: 0.6rem;
  }

  .stepper-label {
    font-size: 0.9rem;
  }

  .step-nav-right {
    justify-content: stretch;
  }

  .step-nav-right .button {
    width: 100%;
  }

  .person-card-grid {
    grid-template-columns: 1fr;
  }

  .person-card {
    min-height: 88px;
    padding: 0.9rem;
  }

  .person-card-name {
    font-size: 1.1rem;
  }

  .booking-submit {
    width: 100%;
  }

  .brand-text {
    display: none;
  }

  .toolbar-actions {
    width: 100%;
    gap: 0.5rem;
  }

  .toolbar-actions > .button,
  .toolbar-actions > form,
  .toolbar-actions > .inline-import-form {
    width: 100%;
  }

  .toolbar-actions form .button,
  .toolbar-actions .inline-import-form .button {
    width: 100%;
  }

  .inline-import-form {
    width: 100%;
    flex-wrap: wrap;
  }

  .inline-import-form input[type="file"] {
    max-width: none;
    flex: 1 1 100%;
  }

  .table {
    display: block;
    overflow-x: auto;
  }

  .table-mobile-cards {
    display: block;
    overflow: visible;
    border: 0;
  }

  .table-mobile-cards thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .table-mobile-cards tbody {
    display: grid;
    gap: 0.75rem;
  }

  .table-mobile-cards tr {
    display: block;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fbfdff;
    padding: 0.65rem 0.75rem;
    box-shadow: 0 8px 22px rgba(16, 33, 58, 0.06);
  }

  .table-mobile-cards td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.45rem 0;
    border-bottom: 1px dashed #d9e5f5;
    white-space: normal;
    text-align: left;
  }

  .table-mobile-cards td:last-child {
    border-bottom: 0;
    padding-bottom: 0;
  }

  .table-mobile-cards td::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--ink-muted);
    text-align: left;
  }

  .table-mobile-cards td form,
  .table-mobile-cards td .toolbar-actions,
  .table-mobile-cards td .inline-actions {
    width: 100%;
  }

  .table-mobile-cards td .toolbar-actions,
  .table-mobile-cards td .inline-actions {
    justify-content: flex-end;
    flex-direction: column;
    align-items: stretch;
  }

  .table-mobile-cards td .button {
    width: 100%;
    text-align: center;
  }

  .table-mobile-cards td small {
    display: block;
    text-align: left;
    line-height: 1.35;
  }

  .step-actions {
    width: 100%;
  }

  .step-actions .button {
    width: 100%;
  }

  .step-nav {
    width: 100%;
  }

  .step-nav .button {
    width: 100%;
  }

  .booking-stepper {
    overflow-x: auto;
    padding-bottom: 0.2rem;
  }

  .booking-stepper::-webkit-scrollbar {
    height: 6px;
  }

  .booking-stepper::-webkit-scrollbar-thumb {
    background: #bfd3ee;
    border-radius: 999px;
  }
}

@media (max-width: 520px) {
  .hero {
    padding: 1.15rem;
  }

  h1 {
    font-size: 1.55rem;
  }

  h2 {
    font-size: 1.2rem;
  }

  .qty-btn {
    width: 1.9rem;
    height: 1.9rem;
  }
}
