
@import "tailwind/application.css";

/* Keep the staff navigation usable until there is room for every control. */
.admin-nav-bar,
.admin-navigation,
.admin-nav-links,
.admin-nav-account {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

.admin-nav-bar { min-height: 4rem; }
.admin-navigation { flex: 1; justify-content: space-between; }
.admin-nav-links { gap: 1.5rem; }
.admin-nav-account > span { overflow-wrap: anywhere; }
.admin-menu-toggle { display: none; }
.admin-main { min-width: 0; }

/* Table contents scroll within their card instead of widening the page. */
.admin-main :is(div, turbo-frame):has(> table) {
  max-width: 100%;
  overflow-x: auto;
}

@media (max-width: 1535px) {
  .admin-nav { background-color: #fff; }
  .admin-nav-bar { flex-wrap: wrap; justify-content: space-between; gap: 0; }
  .admin-menu-toggle {
    display: flex;
    align-items: center;
    gap: .5rem;
    min-height: 44px;
    padding: .5rem .75rem;
    border: 1px solid #d1d5db;
    border-radius: .375rem;
  }
  .admin-navigation { display: none; flex-basis: 100%; }
  .admin-navigation.is-open {
    display: flex;
    align-items: stretch;
    flex-direction: column;
    max-height: calc(100dvh - 4rem);
    overflow-y: auto;
    padding: .75rem 0 1rem;
  }
  .admin-nav-links,
  .admin-nav-account { flex-direction: column; align-items: stretch; gap: .5rem; }
  .admin-nav-links > .relative > button { width: 100%; min-height: 44px; justify-content: space-between; }
  .admin-nav-links [data-dropdown-target="menu"] { position: static; width: 100%; margin-top: 0; box-shadow: none; }
  .admin-nav-links a { min-height: 44px; display: flex; align-items: center; }
  .admin-nav-account { border-top: 1px solid #e5e7eb; padding-top: 1rem; }
  .admin-nav-account input { width: 100%; min-width: 0; }
  .admin-nav-account button { min-height: 44px; }
}

@media (max-width: 639px) {
  .admin-main { padding-inline: .75rem; }
  .admin-main > .container { padding-inline: 0; }
  .admin-main .flex.justify-between { flex-wrap: wrap; gap: .75rem; }
  .admin-main .flex.justify-between > * { min-width: 0; }
  .admin-main h1 { overflow-wrap: anywhere; }
}

/* Customer workspace: compact overview with independently loaded sections. */
.customer-workspace { color: #172033; padding: 1rem 0 2rem; }
.customer-back { display: inline-flex; align-items: center; gap: .5rem; font-size: .75rem; color: #64748b; margin-bottom: 1rem; }
.customer-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.5rem; }
.customer-identity { display: flex; gap: 1rem; min-width: 0; }
.customer-avatar { display: grid; place-items: center; flex-shrink: 0; width: 3.25rem; height: 3.25rem; background: #e0e7ff; color: #1d4ed8; border-radius: 50%; font-size: 1.2rem; font-weight: 700; }
.customer-name { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.customer-name h1 { font-size: 1.5rem; font-weight: 700; overflow-wrap: anywhere; }
.customer-status, .customer-badge { background: #f1f5f9; border-radius: .25rem; padding: .2rem .45rem; font-size: .7rem; font-weight: 600; }
.customer-status { display: inline-flex; align-items: center; gap: .35rem; color: #475569; white-space: nowrap; }
.customer-status::before { content: ""; width: .45rem; height: .45rem; flex-shrink: 0; border-radius: 50%; background: currentColor; }
.customer-status[data-status="active"] { background: #dcfce7; color: #166534; }
.customer-status[data-status="unpaid"] { background: #fef3c7; color: #92400e; }
.customer-status[data-status="collection"] { background: #ffedd5; color: #9a3412; }
.customer-status[data-status="terminated"] { background: #fee2e2; color: #991b1b; }
.customer-status[data-status="write_off"] { background: #f3e8ff; color: #6b21a8; }
.customer-status[data-status="inactive"] { background: #e2e8f0; color: #475569; }
.customer-index-row > td { color: #475569; }
.customer-index-row[data-status="active"] { background-color: #f0fdf4; }
.customer-index-row[data-status="unpaid"] { background-color: #fffbeb; }
.customer-index-row[data-status="collection"] { background-color: #fff7ed; }
.customer-index-row[data-status="terminated"] { background-color: #fef2f2; }
.customer-index-row[data-status="write_off"] { background-color: #faf5ff; }
.customer-index-row[data-status="inactive"] { background-color: #f8fafc; }
.customer-meta { display: flex; flex-wrap: wrap; gap: .35rem 1rem; color: #64748b; font-size: .75rem; margin-top: .4rem; overflow-wrap: anywhere; }
.customer-header-actions, .customer-quick-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.customer-button { display: inline-flex; align-items: center; justify-content: center; padding: .5rem .8rem; border: 1px solid #dce2eb; border-radius: .3rem; background: #fff; color: #334155; font-size: .75rem; font-weight: 500; min-height: 2.25rem; }
.customer-button:hover { background: #f1f5f9; }
.customer-button-primary { background: #2563eb; border-color: #2563eb; color: white; }
.customer-button-primary:hover { background: #1d4ed8; }
.customer-button-danger { color: #dc2626; border-color: #fecaca; }
.customer-tabs { display: flex; overflow-x: auto; border-bottom: 1px solid #dce2eb; margin-bottom: 1rem; gap: .25rem; }
.customer-tab { display: inline-flex; align-items: center; gap: .5rem; white-space: nowrap; padding: .8rem .75rem; font-size: .75rem; color: #475569; border-bottom: 2px solid transparent; }
.customer-tab:hover, .customer-tab.is-active { color: #2563eb; }
.customer-tab.is-active { border-bottom-color: #2563eb; font-weight: 600; }
.customer-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; margin: 1rem 0; }
.customer-card { background: #fff; border: 1px solid #e5e9f0; border-radius: .5rem; min-width: 0; overflow: hidden; }
.customer-stat { display: flex; gap: .9rem; padding: 1rem; }
.customer-stat > div { min-width: 0; }
.customer-stat h2 { font-size: .75rem; font-weight: 600; }
.customer-stat-icon { color: #2563eb; background: #eff6ff; padding: .6rem; border-radius: .6rem; align-self: flex-start; }
.customer-stat-value { font-size: 1.25rem; line-height: 1.4; font-weight: 700; margin: .35rem 0; overflow-wrap: anywhere; }
.customer-muted { font-size: .7rem; color: #64748b; }
.customer-link { color: #2563eb; font-size: .75rem; }
.customer-link:hover { text-decoration: underline; }
.customer-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 1rem; margin-bottom: 1rem; }
.customer-workspace turbo-frame { display: block; min-width: 0; }
.customer-card-heading { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .8rem 1rem; border-bottom: 1px solid #f1f5f9; }
.customer-card-heading h2 { font-size: .875rem; font-weight: 650; }
.customer-quick-actions { padding: .75rem 1rem; }
.customer-table-scroll { overflow-x: auto; padding: .5rem .75rem; }
.customer-table { width: 100%; white-space: nowrap; text-align: left; font-size: .7rem; }
.customer-table th { font-size: .65rem; color: #64748b; font-weight: 500; background: #f8fafc; }
.customer-table :is(th, td) { padding: .6rem .5rem; border-bottom: 1px solid #f1f5f9; }
.customer-loading { min-height: 9rem; padding: 1rem; display: flex; flex-direction: column; justify-content: center; gap: .75rem; color: #64748b; font-size: .8rem; }
.customer-empty { padding: 2rem 1rem; font-size: .8rem; color: #64748b; }
.customer-workspace dl { gap: .8rem 1rem; }
.customer-workspace :is(dt, dd) { font-size: .75rem; overflow-wrap: anywhere; }
.customer-workspace :is(a, button, input, select):focus-visible { outline: 2px solid #2563eb; outline-offset: 3px; }
.customer-workspace turbo-frame > .shadow-md { box-shadow: none; border: 1px solid #e5e9f0; margin-top: 0; margin-bottom: 1rem; }
.customer-workspace turbo-frame h2.text-xl { font-size: 1rem; }
@media (max-width: 1100px) {
  .customer-header { flex-wrap: wrap; }
  .customer-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .customer-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 639px) {
  .customer-summary { grid-template-columns: minmax(0, 1fr); }
  .customer-avatar { width: 2.5rem; height: 2.5rem; }
  .customer-name h1 { font-size: 1.25rem; }
  .customer-button, .customer-tab { min-height: 44px; }
}
.customer-account-details { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.customer-alert-loading { min-height: 0; padding: .5rem 1rem; margin-bottom: 1rem; flex-direction: row; justify-content: space-between; }
@media (max-width: 639px) {
  .customer-account-details { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 380px) {
  .customer-account-details { grid-template-columns: minmax(0, 1fr); }
}
.customer-usage-totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; padding: 1rem; border-bottom: 1px solid #f1f5f9; }
.customer-allowances { padding: 1rem; }
.customer-allowances h3 { font-size: .75rem; font-weight: 600; margin-bottom: .75rem; }
.customer-allowance { margin-bottom: .75rem; font-size: .75rem; }
.customer-allowance-progress { appearance: none; width: 100%; height: .4rem; border: 0; border-radius: 1rem; display: block; margin-top: .5rem; }
.customer-allowance-progress::-webkit-progress-bar { background: #f1f5f9; border-radius: 1rem; }
.customer-allowance-progress::-webkit-progress-value { background: #a7f3d0; border-radius: 1rem; }
.customer-allowance-progress::-moz-progress-bar { background: #a7f3d0; border-radius: 1rem; }
body:has(.customer-workspace) { background: #f8fafc; }
