body,
html {
    margin: 0;
    padding: 0;
    font-family: sans-serif;
    overflow: hidden; /* Disable global scroll */
}

/* Top Header Bar */
.topbar {
    background-color: #121212;
    color: #ECF0F1;
    padding: 6px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 40px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.topbar-content {
    display: flex;
    justify-content: space-between;
    width: 100%;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 18px;
}

.app-name {
    font-size: 1.1rem;
    font-weight: bold;
}

.tools-nav {
    display: flex;
    gap: 12px;
}

.tools-nav a {
    color: #BDC3C7;
    text-decoration: none;
    font-size: 0.95rem;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.tools-nav a:hover,
.tools-nav a.active {
    color: #FFFFFF;
    background-color: #5DADE2;
}

.top-nav a {
    color: #ccc;
    text-decoration: none;
    margin-left: 20px;
    font-size: 0.95rem;
}

.top-nav a:hover {
    color: white;
}

.container {
    display: flex;
    height: calc(100vh - 40px);
}

.sidebar {
    background-color: #26415c;
    color: ECF0F1;
    width: 220px;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

/* Left Navigation sidebar */
.nav {
    display: flex;
    flex-direction: column;
}

/* Grouped nav: non-clickable section header + its links */
.nav-group {
    display: flex;
    flex-direction: column;
    margin-top: 22px;
}
.nav-group:first-child {
    margin-top: 4px;
}
.nav-group-title {
    color: #7C8B9E;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0 10px;
    margin-bottom: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #DCE3EC;
    text-decoration: none;
    margin-top: 2px;
    padding: 8px 10px;
    border-radius: 4px;
    border-left: 3px solid transparent;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

/* Leading icons: inherit link colour, fixed size, slightly dimmed */
.nav-item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.75;
}
.nav-item.active svg,
.nav-item:hover svg {
    opacity: 1;
}

.nav-item:hover:not(.active) {
    background-color: rgba(255, 255, 255, 0.06);
    color: #FFFFFF;
    border-left-color: rgba(93, 173, 226, 0.45);
}

/* Active leaf: subtle tint + left accent bar (lighter than a full pill) */
.nav-item.active {
    background-color: rgba(93, 173, 226, 0.608);
    color: #FFFFFF;
    border-left-color: #5DADE2;
}

/* Main content */

.main-content {
    flex: 1;
    background-color: #FAFAFA;
    padding: 15px;
    overflow-y: auto;
}

/* Button related */
.btn-primary {
    background-color: #5DADE2;
    color: white;
    border: none;
    padding: 10px 16px;
    font-size: 0.95rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-primary:hover {
    background-color: #3498DB;
}

.btn-primary:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    color: #666;
}

/* Budget list related */
.budget-list {
    list-style: none;
    padding-left: 0;
    margin-top: 10px;
}

.budget-list li {
    margin-bottom: 6px;
}

.budget-link {
    display: inline-block;
    background-color: #ecf0f1;
    padding: 8px 12px;
    border-radius: 4px;
    color: #2c3e50;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.budget-link:hover {
    background-color: #d6eaf8;
    color: #1f618d;
}

/* Table related */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background-color: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    overflow: hidden;
}

thead {
    background-color: #c2c2c2;
    color: #000000;
}

th,
td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
    font-size: 0.95rem;
}

tbody tr:hover {
    background-color: #f2f2f2;
}

td {
    color: #333;
}

th:first-child,
td:first-child {
    border-left: none;
}

th:last-child,
td:last-child {
    border-right: none;
}

.text-right {
    text-align: right;
}

#budgetDetailsTable {
    width: 600px;
}

/* Form related */
.form-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: 0.25rem auto;
    justify-content: center;
}

.form-inline label,
.form-inline p {
    font-weight: bold;
    margin-right: 0.25rem;
}

.form-inline input[type="date"] {
    padding: 0.5rem;
    font-size: 1rem;
    border-radius: 6px;
    border: 1px solid #ccc;
}

.form-inline input[type="text"] {
    padding: 10px 12px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 6px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    background-color: #fff;
    width: 200px;
    box-sizing: border-box;
}

.form-inline input[type="text"]:focus {
    border-color: #007acc;
    box-shadow: 0 0 5px rgba(0, 122, 204, 0.3);
}

.form-inline select {
    padding: 10px 12px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 6px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    background-color: #fff;
    width: 200px;
    box-sizing: border-box;
    cursor: pointer;
}

.form-inline select:focus {
    border-color: #007acc;
    box-shadow: 0 0 5px rgba(0, 122, 204, 0.3);
}

.upload-message {
    margin-top: 20px;
    padding: 12px 16px;
    border-radius: 6px;
    background-color: #e6f7ff; /* light blue */
    color: #004085; /* dark text */
    border: 1px solid #b8daff;
    font-size: 15px;
    font-weight: 500;
    max-width: 500px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.upload-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.upload-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* TableActions customizations / override */
.ta-bottom-div .interact {
    display: none !important;
}

/* Prettier, larger checkboxes for TableActions */
.ta-checkbox-row input[type="checkbox"],
.ta-checkbox-column input[type="checkbox"] {
  width: 1.5em;
  height: 1.5em;
  accent-color: #5DADE2; /* fallback for modern browsers */
  border-radius: 6px;
  border: 2px solid #5DADE2;
  box-shadow: 0 1px 2px rgba(93, 173, 226, 0.15);
  transition: border-color 0.2s, box-shadow 0.2s;
  cursor: pointer;
  vertical-align: middle;
}

.ta-checkbox-row input[type="checkbox"]:focus,
.ta-checkbox-column input[type="checkbox"]:focus {
  outline: 2px solid #3498DB;
  outline-offset: 2px;
}

.ta-checkbox-row input[type="checkbox"]:checked,
.ta-checkbox-column input[type="checkbox"]:checked {
  background-color: #5DADE2;
  border-color: #3498DB;
}

/* Optional: Hide default checkmark and use a custom one for more control */
.ta-checkbox-row input[type="checkbox"]::-webkit-checkmark,
.ta-checkbox-column input[type="checkbox"]::-webkit-checkmark {
  display: none;
}

h2, h3 {
    margin-top: 5px;
    margin-bottom: 5px;
}

/* Expenses summary row */
.expenses-row {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.expenses-row__count {
    margin: 0;
    font-size: 1.1rem;
    font-weight: bold;
}
.expenses-row__message {
    display: block;
    margin-top: 0;
    min-width: 350px;
    font-size: 1rem;
    text-align: left;
    overflow-wrap: break-word;
}

/* ---------------------------------------------------------------------------
   Polished vertical form (used by the investment tool). New classes, so the
   budget tool's .form-inline styling is untouched.
--------------------------------------------------------------------------- */
.form-vertical { max-width: 540px; }

.form-vertical .field {
    display: flex;
    flex-direction: column;
    margin-bottom: 16px;
}

.form-vertical label {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.92rem;
    margin-bottom: 6px;
}

.form-vertical .hint {
    color: #8a94a0;
    font-size: 0.78rem;
    font-weight: 400;
    margin-top: 4px;
}

.form-vertical input,
.form-vertical select {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    font-size: 15px;
    color: #2c3e50;
    background-color: #fff;
    border: 1px solid #d4dae2;
    border-radius: 8px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-vertical input::placeholder { color: #b3bcc7; }

.form-vertical input:hover,
.form-vertical select:hover { border-color: #b7c0cc; }

.form-vertical input:focus,
.form-vertical select:focus {
    outline: none;
    border-color: #5DADE2;
    box-shadow: 0 0 0 3px rgba(93, 173, 226, 0.20);
}

/* Custom dropdown chevron (inline SVG data URI — no external asset). */
.form-vertical select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 38px;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%235DADE2' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}

.form-vertical optgroup {
    font-weight: 700;
    color: #7C8B9E;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-vertical option {
    color: #2c3e50;
    font-weight: 400;
    text-transform: none;
    letter-spacing: normal;
    padding: 6px;
}

/* ---------------------------------------------------------------------------
   Sortable tables (see shared/static/js/sortable-tables.js)
--------------------------------------------------------------------------- */
table.sortable thead th { cursor: pointer; user-select: none; white-space: nowrap; }
table.sortable thead th:hover { background-color: #b3b3b3; }
.sort-ind { font-size: 0.75em; margin-left: 4px; }