html {
  font-size: 14px;
}

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

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
  background: #f5f7f4;
  color: #243027;
}

.app-shell {
  max-width: 1680px;
  padding-left: clamp(.75rem, 2vw, 2rem);
  padding-right: clamp(.75rem, 2vw, 2rem);
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: .55rem;
  background: #285b3d;
  color: #fff;
  font-size: .75rem;
  letter-spacing: .04em;
}

.brand-identity { display: inline-grid; place-items: center; flex: 0 0 auto; }
.brand-identity > * { grid-area: 1 / 1; }
.brand-logo { display: block; width: auto; max-width: 7.5rem; height: 2rem; object-fit: contain; }

.navbar .nav-link:hover,
.navbar .nav-link:focus { color: #285b3d !important; }

.card {
  border-color: #dde5de;
  box-shadow: 0 .1rem .35rem rgb(32 62 41 / 5%);
}

.btn-primary {
  --bs-btn-bg: #285b3d;
  --bs-btn-border-color: #285b3d;
  --bs-btn-hover-bg: #204a32;
  --bs-btn-hover-border-color: #204a32;
  --bs-btn-active-bg: #183c28;
  --bs-btn-active-border-color: #183c28;
}

.form-control:focus, .form-select:focus {
  border-color: #659474;
  box-shadow: 0 0 0 .2rem rgb(40 91 61 / 15%);
}

.page-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: 1rem;
}

.metric-card .metric-value {
  font-size: clamp(1.35rem, 2vw, 2rem);
  font-weight: 700;
  line-height: 1.15;
}

.metric-card .metric-label {
  color: var(--bs-secondary-color);
  font-size: .85rem;
}

.simple-bar {
  display: flex;
  height: .65rem;
  overflow: hidden;
  border-radius: 999px;
  background: #e9ecef;
}

.simple-bar > span { min-width: 2px; background: #3f7b53; }

.month-chart { display: flex; align-items: end; gap: .75rem; height: 230px; padding-top: 1rem; }
.month-chart-item { flex: 1; min-width: 2.5rem; text-align: center; height: 100%; display: flex; flex-direction: column; }
.month-bars { flex: 1; display: flex; align-items: end; justify-content: center; gap: 4px; border-bottom: 1px solid #d9ded9; }
.month-bars span { width: min(1.25rem, 35%); min-height: 2px; border-radius: .25rem .25rem 0 0; }
.income { background: #3f7b53; }
.expense { background: #c8785a; }
.chart-key { display: inline-block; width: .7rem; height: .7rem; border-radius: 2px; }

.form-floating > .form-control-plaintext::placeholder, .form-floating > .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;
}

.data-table-container {
  width: 100%;
  max-width: 100%;
  max-height: 70vh;
  overflow: auto;
  border: 1px solid var(--bs-border-color);
  border-radius: .5rem;
}

.data-table-container thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bs-tertiary-bg);
}

.table-compact {
  font-size: .875rem;
  white-space: nowrap;
}

.table-compact > :not(caption) > * > * {
  padding: .38rem .5rem;
}

.cell-truncate {
  max-width: 9rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cell-truncate.cell-wide {
  max-width: 13rem;
}

.compact-fieldset { padding: .85rem 1rem; }
.compact-fieldset legend { float: none; width: auto; margin: 0 0 .35rem; color: #285b3d; }
.compact-fieldset .form-label { margin-bottom: .2rem; font-size: .85rem; }
.compact-fieldset .form-text { margin-top: .15rem; font-size: .75rem; }
.expense-form-actions { position: sticky; bottom: .5rem; z-index: 10; display: flex; align-items: center; gap: .5rem; width: max-content; padding: .55rem .7rem; border: 1px solid #dde5de; border-radius: .65rem; background: rgb(255 255 255 / 94%); box-shadow: 0 .25rem 1rem rgb(32 62 41 / 12%); backdrop-filter: blur(5px); }
.quick-filter-card { transition: transform .15s ease, box-shadow .15s ease; }
.quick-filter-card:hover { transform: translateY(-2px); box-shadow: 0 .35rem 1rem rgb(32 62 41 / 12%); }
.quick-filter-card.active { outline: 3px solid rgb(40 91 61 / 20%); border-color: #285b3d; }

@media (max-width: 767.98px) {
  .expense-form-actions { position: static; width: 100%; }
}

.bank-card { border-top: 3px solid #285b3d; }
.bank-balance { font-size: clamp(1.5rem, 3vw, 2.15rem); font-weight: 700; line-height: 1.1; }
.finance-section { margin-bottom: 2rem; }
.section-heading { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.projection-panel { padding: 1rem; border: 1px dashed #c59b37; border-radius: .75rem; background: #fffaf0; }
.login-shell { min-height: min(72vh, 42rem); align-items: center; }
.login-brand { display: inline-grid; place-items: center; min-height: 4.5rem; }
.login-brand > * { grid-area: 1 / 1; }
.login-logo { display: block; width: auto; max-width: min(15rem, 70vw); height: 4.5rem; object-fit: contain; }
.login-logo-fallback { display: inline-grid; place-items: center; width: 4rem; height: 4rem; border-radius: 1rem; background: #285b3d; color: #fff; font-size: 1.15rem; font-weight: 700; letter-spacing: .06em; }

.debt-table { width: 100%; min-width: 76rem; table-layout: fixed; font-size: .78rem; }
.debt-table > :not(caption) > * > * { padding: .3rem .32rem; }
.debt-table .debt-date { width: 6.2rem; }
.debt-table .debt-select { width: 2rem; padding-left: .4rem; padding-right: .2rem; text-align: center; }
.debt-table .debt-days { width: 6rem; }
.debt-table .debt-field { width: 6.4rem; }
.debt-table .debt-supplier { width: 11rem; }
.debt-table .debt-invoice { width: 7rem; }
.debt-table .debt-unit { width: 8rem; }
.debt-table .debt-money { width: 8.2rem; }
.debt-table .debt-check-status { width: 8.2rem; }
.debt-table .debt-actions { width: 15.2rem; text-align: right; }
.debt-table .debt-actions .btn { padding: .22rem .38rem; font-size: .72rem; }
.debt-ellipsis { display: block; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.debt-table .badge.debt-ellipsis { display: block; }

@media (max-width: 991.98px) {
  .brand-logo { max-width: 6rem; height: 1.8rem; }
  .login-logo { max-width: min(12rem, 65vw); height: 3.75rem; }
}

@media (max-width: 575.98px) {
  .section-heading > form { width: 100%; }
  .section-heading > form > div { flex: 1; }
}
