/* ===================================================================
   LazyBooks design tokens
   Brewery-warm neutral palette: warm charcoal + copper accent.
   Fonts are Bootstrap's default system-ui stack — no custom faces.
   =================================================================== */
:root {
  --lb-bg: #ffffff;
  --lb-bg-subtle: #f7f6f4;
  --lb-surface: #ffffff;

  --lb-sidebar-bg: #23211f;
  --lb-sidebar-bg-active: rgba(181, 101, 29, 0.22);
  --lb-sidebar-bg-hover: rgba(255, 255, 255, 0.06);
  --lb-sidebar-text: #b9b2a4;
  --lb-sidebar-text-active: #f5f1e8;
  --lb-sidebar-heading: #837c6d;
  --lb-sidebar-heading-current: #d8a066;
  --lb-sidebar-border: rgba(255, 255, 255, 0.08);

  --lb-text: #23211f;
  --lb-text-muted: #6b6558;
  --lb-border: #e4e1da;
  --lb-border-strong: #cfc9bd;

  --lb-accent: #b5651d;
  --lb-accent-hover: #9a5518;
  --lb-accent-active: #834714;
  --lb-accent-soft: #f5e9dc;

  --lb-positive: #2f6b4f;
  --lb-negative: #a3372b;

  --lb-sidebar-width: 15.5rem;
}

/* ---- base ---- */
html {
  font-size: 16px;
  position: relative;
  min-height: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 15px;
  }
}

body {
  background: var(--lb-bg-subtle);
  color: var(--lb-text);
}

h1, h2, h3, h4, h5, h6 {
  color: var(--lb-text);
  letter-spacing: -0.01em;
}

a {
  color: var(--lb-accent);
}
a:hover {
  color: var(--lb-accent-hover);
}

.text-muted {
  color: var(--lb-text-muted) !important;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-select:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem var(--lb-bg), 0 0 0 0.25rem rgba(181, 101, 29, 0.35);
  border-color: var(--lb-accent);
}

/* ---- buttons: retint the brand/interactive accent only; keep semantic
   success/warning/danger colors as Bootstrap defaults for recognizability ---- */
.btn-primary {
  --bs-btn-bg: var(--lb-accent);
  --bs-btn-border-color: var(--lb-accent);
  --bs-btn-hover-bg: var(--lb-accent-hover);
  --bs-btn-hover-border-color: var(--lb-accent-hover);
  --bs-btn-active-bg: var(--lb-accent-active);
  --bs-btn-active-border-color: var(--lb-accent-active);
  --bs-btn-disabled-bg: var(--lb-accent);
  --bs-btn-disabled-border-color: var(--lb-accent);
  --bs-btn-focus-shadow-rgb: 181, 101, 29;
}
.btn-outline-primary {
  --bs-btn-color: var(--lb-accent);
  --bs-btn-border-color: var(--lb-accent);
  --bs-btn-hover-bg: var(--lb-accent);
  --bs-btn-hover-border-color: var(--lb-accent);
  --bs-btn-active-bg: var(--lb-accent-active);
  --bs-btn-active-border-color: var(--lb-accent-active);
}

/* Flash toast — the only alert-info usage in this app, so it's safe to brand. */
.alert-info {
  --bs-alert-color: #7a4515;
  --bs-alert-bg: var(--lb-accent-soft);
  --bs-alert-border-color: #e6c8a4;
}

/* ---- money ---- */
.money {
  font-variant-numeric: tabular-nums;
}
.money-negative {
  color: var(--lb-negative);
}

/* ---- tables: compact, quiet header, hover row for scanning ---- */
.table {
  --bs-table-border-color: var(--lb-border);
  font-size: 0.875rem;
}
.table > :not(caption) > * > * {
  padding-top: 0.4rem;
  padding-bottom: 0.4rem;
}
.table.table-sm > :not(caption) > * > * {
  padding-top: 0.3rem;
  padding-bottom: 0.3rem;
}
.table > thead > tr > th {
  text-transform: uppercase;
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
  font-weight: 600;
  color: var(--lb-text-muted);
  border-bottom-width: 1px;
}
.table > tbody > tr:hover > * {
  background-color: var(--lb-bg-subtle);
}

/* ---- inline edit row: slides in directly under the row being edited ---- */
.account-edit-row > td {
  padding: 0 !important;
  border-top: none;
}
.account-edit-panel {
  background: var(--lb-bg-subtle);
  border-left: 3px solid var(--lb-accent);
  padding: 0.85rem 1rem;
  animation: lb-slide-in 0.15s ease-out;
}
@keyframes lb-slide-in {
  from { opacity: 0; transform: translateY(-0.5rem); }
  to { opacity: 1; transform: translateY(0); }
}
.account-edit-row.lb-slide-out > td > .account-edit-panel {
  animation: lb-slide-out 0.15s ease-in forwards;
}
@keyframes lb-slide-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-0.5rem); }
}

/* Brief highlight on a row right after its edit panel saves, so a change is visibly
   confirmed even though the panel that was open has just disappeared. */
.account-row-flash > * {
  animation: lb-row-flash 1s ease-out;
}
@keyframes lb-row-flash {
  from { background-color: var(--lb-accent-soft); }
  to { background-color: transparent; }
}

/* A row that was just deactivated while the list is filtered to active-only — fades out and
   is removed from the DOM rather than sitting there muted until the next reload drops it. */
.account-row-fade-out > * {
  animation: lb-row-fade-out 0.4s ease-in forwards;
}
@keyframes lb-row-fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* ---- forms ---- */
.form-label {
  color: var(--lb-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.6875rem;
  letter-spacing: 0.03em;
}
.form-control, .form-select {
  border-color: var(--lb-border-strong);
}
.form-control-plaintext::placeholder, .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}
.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* ---- cards ---- */
.card {
  border-color: var(--lb-border);
}
.account-box {
  transition: border-color 0.1s ease-in-out, box-shadow 0.1s ease-in-out;
}
.account-box:hover {
  border-color: var(--lb-accent);
}
.account-box-selected {
  border-color: var(--lb-accent);
  box-shadow: 0 0 0 1px var(--lb-accent);
}
.card-title {
  color: var(--lb-text-muted);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.03em;
}

/* ===================================================================
   Sidebar shell
   =================================================================== */
.app-shell {
  min-height: 100vh;
}

.sidebar {
  width: var(--lb-sidebar-width);
  flex: 0 0 var(--lb-sidebar-width);
  background: var(--lb-sidebar-bg);
  color: var(--lb-sidebar-text);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 0.75rem 0 1.5rem;
}

.sidebar-brand {
  display: block;
  padding: 0.5rem 1rem 1rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--lb-sidebar-border);
  color: var(--lb-sidebar-text-active);
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.25;
  text-decoration: none;
}
.sidebar-brand span {
  display: block;
  font-weight: 400;
  font-size: 0.6875rem;
  color: var(--lb-sidebar-heading);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0.15rem;
}
.sidebar-brand:hover {
  color: var(--lb-sidebar-text-active);
}

.nav-group {
  padding: 0 0.6rem;
  margin-bottom: 0.85rem;
}
.sidebar-footer {
  padding-top: 0.6rem;
  margin-top: 0.4rem;
  border-top: 1px solid var(--lb-sidebar-border);
}
.sidebar-footer .nav-link {
  color: var(--lb-sidebar-heading);
}
.sidebar-footer .nav-link:hover {
  color: var(--lb-sidebar-text-active);
}
.sidebar-signout span {
  display: block;
  padding: 0.5rem 1rem 0;
  font-size: 0.6875rem;
  color: var(--lb-sidebar-heading);
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-signout button {
  border: 0;
  background: none;
  width: 100%;
  text-align: left;
}
.nav-group-label {
  text-transform: uppercase;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--lb-sidebar-heading);
  padding: 0.2rem 0.4rem;
  margin-bottom: 0.1rem;
}
.nav-group-label.current {
  color: var(--lb-sidebar-heading-current);
}

.sidebar .nav-link {
  color: var(--lb-sidebar-text);
  font-size: 1rem;
  padding: 0.32rem 0.5rem;
  border-radius: 0.35rem;
  line-height: 1.3;
}
.sidebar .nav-link:hover {
  color: var(--lb-sidebar-text-active);
  background: var(--lb-sidebar-bg-hover);
}
.sidebar .nav-link.active {
  color: var(--lb-sidebar-text-active);
  background: var(--lb-sidebar-bg-active);
  font-weight: 600;
}

.content {
  flex: 1 1 auto;
  min-width: 0;
  padding: 1.25rem 1.5rem;
}

@media (max-width: 767.98px) {
  .app-shell {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    flex: 0 0 auto;
    height: auto;
    position: static;
  }
}

/* ---- combobox (wwwroot/js/combobox.js) ----
   A text input over a hidden <select>. The menu is absolutely positioned against the
   wrapper so it can spill out of a narrow table cell instead of being squeezed into it. */
.combobox {
  position: relative;
}
.combobox-menu {
  position: absolute;
  z-index: 1050;
  top: 100%;
  left: 0;
  min-width: 100%;
  width: max-content;
  max-width: 26rem;
  max-height: 15rem;
  overflow-y: auto;
  background: var(--lb-surface);
  border: 1px solid var(--lb-border-strong);
  border-radius: 0.35rem;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.12);
}
.combobox-option {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  font-size: 0.875rem;
}
.combobox-option.active {
  background: var(--lb-accent-soft);
}
.combobox-option.selected .combobox-label {
  font-weight: 600;
}
.combobox-hint {
  color: var(--lb-text-muted);
  font-size: 0.75rem;
  white-space: nowrap;
}
.combobox-empty {
  padding: 0.25rem 0.5rem;
  color: var(--lb-text-muted);
  font-size: 0.875rem;
}

/* Tables sorted by site.js. */
table[data-sortable] thead th { cursor: pointer; user-select: none; }
table[data-sortable] thead th[data-sort="asc"]::after { content: " \25B2"; font-size: .7em; }
table[data-sortable] thead th[data-sort="desc"]::after { content: " \25BC"; font-size: .7em; }
