:root {
  --bg-0: #071821;
  --bg-1: #0b2530;
  --bg-2: #11384a;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-strong: #ffffff;
  --ink: #0f2230;
  --muted: #58707e;
  --line: rgba(15, 34, 48, 0.12);
  --brand: #0c7a80;
  --brand-2: #f28c28;
  --brand-soft: rgba(12, 122, 128, 0.12);
  --good: #1b7f4a;
  --warn: #a45c00;
  --bad: #a61d1d;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.22);
  --radius-xl: 28px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --font-head: "Space Grotesk", "IBM Plex Sans", sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--ink);
  font-family: var(--font-body);
  background:
    radial-gradient(circle at top left, rgba(242, 140, 40, 0.18), transparent 30%),
    radial-gradient(circle at 80% 20%, rgba(12, 122, 128, 0.28), transparent 28%),
    linear-gradient(140deg, var(--bg-0), var(--bg-1) 45%, var(--bg-2));
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.34), transparent 70%);
}

#app {
  min-height: 100vh;
}

.bp_shell {
  min-height: 100vh;
  padding: 28px;
}

.bp_frame {
  width: min(1440px, 100%);
  margin: 0 auto;
}

.bp_login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
}

.bp_login_card,
.bp_dashboard_card {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.bp_login_card {
  width: min(640px, 100%);
  border-radius: var(--radius-xl);
  padding: 34px;
  color: var(--ink);
}

.bp_eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(12, 122, 128, 0.1);
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.bp_eyebrow::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand-2);
  box-shadow: 0 0 0 5px rgba(242, 140, 40, 0.16);
}

.bp_login h1,
.bp_dashboard_title {
  margin: 16px 0 0;
  font-family: var(--font-head);
  letter-spacing: -0.03em;
  line-height: 1;
}

.bp_login h1 {
  font-size: clamp(2.1rem, 4vw, 3.7rem);
  max-width: 12ch;
}

.bp_lead {
  margin: 16px 0 0;
  font-size: 1.03rem;
  line-height: 1.6;
  color: var(--muted);
  max-width: 58ch;
}

.bp_login_panel {
  margin-top: 28px;
  display: grid;
  gap: 18px;
  padding: 22px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(12, 122, 128, 0.08), rgba(255, 255, 255, 0.86));
  border: 1px solid rgba(12, 122, 128, 0.12);
}

.bp_google_host {
  min-height: 44px;
}

.bp_login_status,
.bp_dashboard_status {
  min-height: 22px;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.45;
}

.bp_dashboard_toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 10050;
  display: none;
  max-width: min(420px, calc(100vw - 32px));
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(27, 127, 74, 0.22);
  background: linear-gradient(180deg, rgba(238, 250, 242, 0.99), rgba(255, 255, 255, 0.98));
  color: #14532d;
  font-weight: 700;
  line-height: 1.45;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.16), 0 0 0 1px rgba(27, 127, 74, 0.08) inset;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: auto;
}

.bp_dashboard_toast_body {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.bp_dashboard_toast_text {
  flex: 1 1 auto;
  min-width: 0;
}

.bp_dashboard_toast_close {
  flex: 0 0 auto;
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  padding: 0 2px;
  opacity: 0.8;
}

.bp_dashboard_toast_close:hover {
  opacity: 1;
}

.bp_dashboard_toast.is_visible {
  opacity: 1;
  transform: translateY(0);
}

.bp_dashboard_toast.is_error {
  border-color: rgba(188, 28, 92, 0.20);
  background: linear-gradient(180deg, rgba(255, 243, 247, 0.98), rgba(255, 255, 255, 0.96));
  color: var(--bad);
}

.bp_dashboard_toast:not(.is_error) .bp_dashboard_toast_close {
  color: #166534;
}

.bp_login_status.is_error,
.bp_dashboard_status.is_error {
  color: var(--bad);
  font-weight: 600;
}

.bp_dashboard {
  min-height: 100vh;
  padding: 24px;
}

.bp_dashboard_card {
  border-radius: 34px;
  padding: 22px;
}

.bp_topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 6px 6px 22px;
  border-bottom: 1px solid var(--line);
}

.bp_title_block {
  min-width: 0;
}

.bp_dashboard_title {
  font-size: clamp(2rem, 3vw, 3.1rem);
}

.bp_subtitle {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.5;
  max-width: 82ch;
}

.bp_user_chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 999px;
  background: rgba(12, 122, 128, 0.08);
  color: var(--ink);
  border: 1px solid rgba(12, 122, 128, 0.14);
  white-space: nowrap;
}

.bp_user_dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--brand), var(--brand-2));
  box-shadow: 0 0 0 6px rgba(12, 122, 128, 0.12);
}

.bp_toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) auto;
  gap: 14px;
  align-items: end;
  margin-top: 18px;
}

.bp_toolbar_actions {
  display: flex;
  gap: 14px;
  align-items: end;
  justify-content: flex-end;
  flex-wrap: nowrap;
  min-width: 0;
}

.bp_toolbar_actions .bp_button {
  white-space: nowrap;
}

.bp_filters,
.bp_meta_panel,
.bp_table_shell,
.bp_empty {
  margin-top: 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
}

.bp_filters {
  padding: 18px;
}

.bp_filters_header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.bp_section_toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  user-select: none;
}

.bp_section_toggle input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--brand);
}

.bp_filter_grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}

.bp_app_filter {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(15, 34, 48, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(245, 249, 250, 0.88));
  box-shadow: 0 10px 28px rgba(10, 23, 30, 0.06);
}

.bp_app_filter input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.bp_app_filter strong {
  display: block;
  font-size: 0.96rem;
}

.bp_app_filter span {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.bp_field {
  display: grid;
  gap: 7px;
}

.bp_field label {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.bp_input,
.bp_button {
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid rgba(15, 34, 48, 0.12);
  font: inherit;
}

.bp_input {
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--ink);
  font-weight: 600;
}

.bp_input:focus {
  outline: 3px solid rgba(12, 122, 128, 0.16);
  border-color: rgba(12, 122, 128, 0.65);
}

.bp_button {
  padding: 0 16px;
  font-weight: 800;
  cursor: pointer;
  background: var(--surface-strong);
  color: var(--ink);
}

.bp_button.bp_button_primary {
  background: linear-gradient(180deg, var(--brand), #0a5d62);
  color: white;
  border-color: rgba(12, 122, 128, 0.42);
  box-shadow: 0 12px 28px rgba(12, 122, 128, 0.22);
}

.bp_button:disabled {
  opacity: 0.56;
  cursor: not-allowed;
  box-shadow: none;
}

.bp_modal_backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(6, 18, 28, 0.56);
  backdrop-filter: blur(8px);
}

.bp_modal {
  width: min(640px, 100%);
  position: relative;
  z-index: 1;
}

.bp_modal_card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 248, 250, 0.98));
  border: 1px solid rgba(15, 34, 48, 0.12);
  border-radius: 24px;
  box-shadow: 0 28px 80px rgba(6, 18, 28, 0.30);
  overflow: hidden;
}

.bp_modal_header,
.bp_modal_footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
}

.bp_modal_header {
  border-bottom: 1px solid rgba(15, 34, 48, 0.08);
}

.bp_modal_header h3 {
  margin: 0;
  font-family: var(--font-head);
  letter-spacing: -0.04em;
  font-size: 1.4rem;
}

.bp_modal_subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.92rem;
}

.bp_icon_button {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(15, 34, 48, 0.12);
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.bp_modal_body {
  padding: 20px;
}

.bp_modal_field {
  display: grid;
  gap: 8px;
}

.bp_modal_checkbox_field {
  margin-top: 12px;
}

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

.bp_modal_field span,
.bp_modal_label {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  font-weight: 900;
}

.bp_toggle_row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(15, 34, 48, 0.12);
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  font-weight: 700;
}

.bp_toggle_row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.bp_modal_row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(12, 122, 128, 0.06);
  border: 1px solid rgba(12, 122, 128, 0.10);
}

.bp_modal_row strong {
  display: block;
  margin-top: 8px;
  font-family: var(--font-head);
  font-size: 1.08rem;
  letter-spacing: -0.03em;
}

.bp_modal_note {
  margin: 16px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.bp_modal_footer {
  border-top: 1px solid rgba(15, 34, 48, 0.08);
}

.bp_meta_panel {
  padding: 16px 18px;
}

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

.bp_summary_card {
  padding: 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(12, 122, 128, 0.08), rgba(255, 255, 255, 0.92));
  border: 1px solid rgba(12, 122, 128, 0.10);
}

.bp_summary_card .k {
  display: block;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  font-weight: 900;
}

.bp_summary_card .v {
  display: block;
  margin-top: 10px;
  font-family: var(--font-head);
  font-size: 1.6rem;
  letter-spacing: -0.04em;
}

.bp_table_shell {
  overflow: hidden;
}

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

.bp_table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  background: rgba(246, 248, 250, 0.98);
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.bp_table tbody td {
  padding: 16px 18px;
  border-bottom: 1px solid rgba(15, 34, 48, 0.08);
  vertical-align: top;
  background: rgba(255, 255, 255, 0.84);
}

.bp_table tbody tr:hover td {
  background: rgba(12, 122, 128, 0.05);
}

.bp_customer {
  font-weight: 800;
  font-size: 1rem;
}

.bp_meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.bp_next_billing_meta {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    flex-wrap: nowrap;
    justify-content: flex-start;
  }

.bp_next_billing_text {
    min-width: 0;
    display: grid;
    gap: 2px;
    flex: 0 1 auto;
  }

.bp_manual_state {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: none;
}

.bp_inline_icon_button {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  margin-left: 2px;
  border-radius: 8px;
  border: 1px solid rgba(15, 34, 48, 0.10);
  background: rgba(255, 255, 255, 0.92);
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  line-height: 1;
}

.bp_inline_icon_button:hover {
  color: var(--ink);
  border-color: rgba(12, 122, 128, 0.22);
  background: rgba(12, 122, 128, 0.08);
}

.bp_invoice_block {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.bp_invoice_text {
  min-width: 0;
  flex: 1 1 auto;
}

.bp_invoice_trash {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  margin-top: 2px;
  border-radius: 10px;
  border: 1px solid rgba(170, 55, 55, 0.18);
  background: rgba(170, 55, 55, 0.08);
  color: #9c2e2e;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.98rem;
  line-height: 1;
}

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

.bp_bullet {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.bp_bullet::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--brand-2);
  flex: 0 0 auto;
}

.bp_badge {
  display: inline-flex;
  align-items: center;
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.bp_badge.ok {
  color: var(--good);
  background: rgba(27, 127, 74, 0.11);
}

.bp_badge.pending {
  color: var(--warn);
  background: rgba(164, 92, 0, 0.11);
}

.bp_badge.neutral {
  color: var(--muted);
  background: rgba(88, 112, 126, 0.11);
}

.bp_actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.bp_table .bp_action_cell {
  width: 1%;
  white-space: nowrap;
}

.bp_empty {
  padding: 44px 24px;
  text-align: center;
  color: var(--muted);
}

.bp_empty h2 {
  margin: 0;
  font-family: var(--font-head);
  letter-spacing: -0.03em;
  color: var(--ink);
}

.bp_empty p {
  margin: 12px auto 0;
  max-width: 56ch;
  line-height: 1.6;
}

@media (max-width: 1100px) {
  .bp_toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .bp_summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bp_toolbar_actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

@media (max-width: 860px) {
  .bp_shell,
  .bp_dashboard {
    padding: 18px;
  }

  .bp_login_card,
  .bp_dashboard_card {
    border-radius: 24px;
  }

  .bp_topbar {
    flex-direction: column;
  }

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

  .bp_toolbar_actions {
    grid-column: auto;
    justify-content: stretch;
  }

  .bp_toolbar_actions .bp_button {
    flex: 1 1 0;
  }

  .bp_table,
  .bp_table thead,
  .bp_table tbody,
  .bp_table tr,
  .bp_table th,
  .bp_table td {
    display: block;
  }

  .bp_table thead {
    display: none;
  }

  .bp_table tbody tr {
    border-bottom: 1px solid var(--line);
  }

  .bp_table tbody td {
    padding: 12px 16px;
    border-bottom: 0;
  }

  .bp_table tbody td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    font-weight: 900;
  }

  .bp_action_cell {
    white-space: normal;
  }
}

@media (max-width: 640px) {
  .bp_login,
  .bp_dashboard {
    padding: 14px;
  }

  .bp_login_card {
    padding: 24px 20px;
  }

  .bp_filters,
  .bp_meta_panel {
    padding: 14px;
  }

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

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

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