:root {
  --pico-form-element-spacing-vertical: 0.25rem;
  --pico-form-element-spacing-horizontal: 1rem;
}

[data-theme="light"],
:root:not([data-theme="dark"]) {
  /* --pico-background-color: #dcebd7; */
  --pico-background-color: whitesmoke;
  --pico-primary: #0d5b64;
  --pico-primary-background: #0d5b64;
  --pico-primary-hover: #0c606b;
  --pico-primary-hover-background: #09464e;
  --pico-primary-border: teal;
  --pico-muted-border-color: #80978f;
  --secondary: #3A7F62;
  --secondary-hover: #2d614c;
}

html,
body {
  height: 100%;
  padding: 0;
  /* background-color: var(--pico-background-color); */
}

footer {
  /* background-color: lightgray; */
  text-align: center;
  margin: 0;
  padding: 0;
  line-height: 0.1;
  border-top: 1px solid #aaa;
}

/* .content {
  background-color: whitesmoke;
  padding: 1rem;
  border-radius: 5px;
  overflow-x: auto;
  max-width: 100%;
  box-sizing: border-box;
} */

.highlight {
  max-width: 30rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.highlight.red {
  background-color: #eca1a1;
  border-top: 1px solid #e23d3d;
  border-bottom: 1px solid #e23d3d;
  border-right: 1px solid #e23d3d;
  border-left: 6px solid #e23d3d;
}

.highlight.blue {
  background-color: #80afc9;
  border-top: 1px solid #00507a;
  border-bottom: 1px solid #00507a;
  border-right: 1px solid #00507a;
  border-left: 6px solid #00507a;
}

.highlight.green {
  background-color: #89b390;
  border-top: 1px solid #2d6b47;
  border-bottom: 1px solid #2d6b47;
  border-right: 1px solid #2d6b47;
  border-left: 6px solid #2d6b47;
}

/* ============================== TOP NAVIGATION ============================== */

.topnav {
  border-bottom: 1px solid #aaa;
}

.topnav ul {
  align-items: center;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.topnav h1 {
  --pico-font-family: Chango, cursive;
  --pico-font-size: 1.875rem;
  --pico-font-weight: 400;
  --pico-typography-spacing-vertical: 0.5rem;
}

.topnav form {
  margin: 0;
}

.topnav button {
  margin: 0;
  padding: 0.4rem 0.8rem;
  font-weight: 400;
}

nav a.active {
  position: relative;
  color: var(--pico-primary);
  font-weight: bold;
}

nav a.active::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 100%;
  height: 2px;
  background-color: var(--pico-primary);
  border-radius: 2px;
}

/* ============================== COMMON STYLES ============================== */

table {
  border-collapse: separate;
}

th,
td {
  font-size: 0.75rem;
  /* padding: calc(var(--pico-spacing) / 4) calc(var(--pico-spacing) / 8); */
  padding: 0.3rem 0.1rem;
  vertical-align: middle;
}

th {
  border-bottom: 2px solid green;
  font-weight: bold;
}

td {
  border-bottom: 1px solid green;
  /* border-left: 1px solid green; */
  /* border-right: 1px solid green; */
  /* height: 4rem; */
}

td.nowrap {
  white-space: nowrap;
}

/* td.date-cell {
  white-space: nowrap;
}*/

th.amount {
  text-align: right;
  padding-right: 0.5rem;
}

td.amount {
  text-align: right;
  padding-right: 0.5rem;
}

td.account {
  padding-right: 0.5rem;
}

td.status-cell {
  padding-left: 0.2rem;
  width: 5rem;
}

/* td.date-cell {
  max-width: 6rem;
} */

/* td.actions-cell {
  display: flex;
  flex-wrap: wrap;
  padding-left: 0.5rem;
  gap: 0.3rem;
  justify-content: flex-start;
  align-items: center;
} */

.actions-cell {
  white-space: nowrap;
}

.actions-cell form {
  display: inline-block;
  margin: 0;
}

.actions-cell .btn {
  margin: 0 0.2rem 0 0;
}
/*---------- Pagination ----------*/

.pagination {
  max-width: 350px;
  margin: 0 auto;
}

/* .pager {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.75rem;
}

.pagination a {
  padding: 0.15rem 0.4rem;
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 4px;
  text-decoration: none;
}

.pagination .disabled,
.pagination .current {
  padding: 0.15rem 0.4rem;
  opacity: 0.6;
} */

/*---------- Messages ----------*/

.message-container {
  padding: 0 var(--pico-spacing);
}

.message {
  background-color: #def5ec;
  color: #084c4d;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  border-radius: 4px;
  border-top: 1px solid var(--pico-primary-border);
  border-bottom: 1px solid var(--pico-primary-border);
  border-right: 1px solid var(--pico-primary-border);
  border-left: 6px solid var(--pico-primary-border);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/*---------- Alerts ----------*/
.alert-icon {
  width: 18px;
  height: 18px;
  vertical-align: middle;
  margin-left: 4px;
}

.alert-overdue {
  color: #e23d3d;
}

.alert-soon {
  color: #f9a825;
}

/*---------- Sorting ----------*/
.sortable-header {
  text-decoration: none;
  color: inherit;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.sort-icon {
  width: 14px;
  height: 14px;
}

/* Filter toggle button */
.filter-toggle-container {
  margin-bottom: 1rem;
}

.btn-filter-toggle {
  padding: 0.4rem 1rem;
}

/* Filter row */
.filter-row {
  display: none;
}

.filter-input {
  width: 100%;
  border: 1px solid #2d6b47;
  padding: 0rem;
  font-size: 0.5rem;
}

/* ============================== LOGIN PAGE ============================== */
.loginform {
  max-width: 500px;
  margin: 0 auto;
}

/* ============================== PROFILE PAGE ============================== */

.notificationform {
  max-width: 500px;
  margin: 0 0;
}

/* ============================== EXPENSES PAGE ============================== */


/* ============================== INVOICES PAGE ============================== */

.file-link i {
  width: 1rem;
  height: 1rem;
  color: var(--pico-primary);
  vertical-align: middle;
}

.file-link:hover i {
  color: var(--secondary-hover);
}

.status-badge {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: smaller;
  font-weight: 600;
  /* color: #fff; */
}

.status-1 {
  background-color: #e3f2fd;
  color: #1565c0;
}

.status-2 {
  background-color: #fff8e1;
  color: #ef6c00;
}

.status-3 {
  background-color: #e8f5e9;
  color: #2e7d32;
}

.status-4 {
  background-color: #ffebee;
  color: #c62828;
}

.btn {
  padding: 0.1rem;
  border-radius: 5px;
  /* border: 0px; */
  font-size: smaller;
  text-decoration: none;
  text-align: center;
  white-space: nowrap;
  width: auto;
  min-width: 4rem;
  box-sizing: border-box;
  /* line-height: 1.2; */
}

.btn-pay {
  background-color: #4caf50;
  border-color: #357a37;
}

.btn-reject {
  background-color: #e53935;
  border-color: #8f2321;
}

.btn-check {
  background-color: #f9a825;
  border-color: #9c6918;
}

.btn-reset {
  background-color: #1565c0;
  border-color: #0d3e77
}

/* ============================== EVENTS PAGE ============================== */

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.4);
}

.modal-content {
  background-color: #fefefe;
  margin: 5% auto;
  padding: 20px;
  border: 1px solid #888;
  width: 90%;
  max-width: 500px;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  max-height: 90vh;
  overflow-y: auto;
}

.close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  line-height: 20px;
}

.close:hover,
.close:focus {
  color: #000;
}

/* Django form.as_div styling */
#eventForm > div {
  margin-bottom: 10px;
}

#eventForm label {
  display: block;
  margin-bottom: 5px;
  font-size: smaller;
  /* font-weight: bold; */
}

#eventForm input[type="text"],
#eventForm input[type="date"],
#eventForm input[type="datetime-local"],
#eventForm textarea,
#eventForm select {
  width: 100%;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-sizing: border-box;
}

#eventForm input:disabled,
#eventForm textarea:disabled {
  background-color: #e9ecef;
  cursor: not-allowed;
}

#eventForm .errorlist {
  color: #dc3545;
  font-size: 12px;
  list-style: none;
  padding: 0;
  margin: 5px 0 0 0;
}

.alert-error {
  background-color: #f8d7da;
  border: 1px solid #f5c6cb;
  color: #721c24;
  padding: 10px;
  border-radius: 4px;
  margin-bottom: 15px;
}

.alert-error ul {
  margin: 0;
  padding-left: 20px;
}

.form-actions {
  margin-top: 20px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.ebtn {
  padding: 10px 10px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
}

.ebtn-primary {
  background-color: #007bff;
  color: white;
}

.ebtn-primary:hover {
  background-color: #0056b3;
}

.ebtn-secondary {
  background-color: #6c757d;
  color: white;
}

.ebtn-secondary:hover {
  background-color: #545b62;
}

/* ============================== BOOKKEEPING ACCOUNTS PAGE ============================== */

/* Configurable constants */
:root {
  --toggle-w: 1.25rem;
  /* fixed width for the chevron area */
  --indent-step: 1.25rem;
  /* width added per tree level */
  --firstcol-width: 8rem;
  /* reserve enough width so other cols never shift */
}

.accounts-actions {
  margin-bottom: 1rem;
}

.accounts-actions button {
  margin-right: 0.5rem;
  padding: 0.2rem 0.2rem;
  cursor: pointer;
}

/* Fix the first column width (prevents layout jump on expand/collapse) */
.accounts .col-number,
.accounts td.account-number,
.accounts th:first-child {
  width: var(--firstcol-width);
  /* padding: calc(var(--pico-spacing)/ 8) calc(var(--pico-spacing)/10); */
}

/* First cell layout: [toggle-box][indent][label] */
.account-number {
  display: inline-flex;
  /* inline to respect fixed column width */
  align-items: center;
  white-space: nowrap;
}

/* 1) Toggle area: fixed width always present */
.toggle-box {
  width: var(--toggle-w);
  display: inline-flex;
  justify-content: center;
  align-items: center;
  flex: 0 0 var(--toggle-w);
}

.toggle {
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  line-height: 1;
  color: green;
}

.toggle.placeholder {
  width: 1em;
  height: 1em;
  visibility: hidden;
}

/* Feather icon sizing + smooth rotation */
.toggle svg {
  width: 1em;
  height: 1em;
  transition: transform 0.2s ease-in-out;
  display: block;
  transform-origin: 50% 50%;
}

.toggle[aria-expanded="true"] svg {
  transform: rotate(90deg);
}

/* 2) Indent spacer: exact, predictable width = level × step */
.indent {
  width: calc(var(--level, 0) * var(--indent-step));
  flex: 0 0 auto;
}

/* Label (the number) */
.account-number .label {
  margin-left: 0.25rem;
}

/* Optional: visual hint for roots */
.account-row.is-root td {
  font-weight: 600;
}

.accounts tr.grand-total-row {
  border-bottom: none;
}

.accounts td.grand-total-label {
  font-weight: bold;
  font-size: large;
  text-align: right;
  padding-right: calc(var(--pico-spacing) * 2);
}

.accounts td.grand-total-value {
  font-weight: bold;
  font-size: large;
}
