/* ===== Global layout & typography ===== */

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Montserrat", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f5f6fa;
}

/* Layout shell */

.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 230px;
    background: #001633;
    color: #ffab40;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-header {
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-bottom: 1px solid #22344d;
    color: #ffab40;
}

.menu {
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
}

.menu li a {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.7rem 1rem;
    color: #f1f2f6;
    text-decoration: none;
    font-size: 0.95rem;
}

.menu li a:hover {
    background: #002952;
}

.menu i {
    width: 18px;
    text-align: center;
}

.content {
    flex: 1;
    padding: 1.5rem;
    background: #f5f6fa;
}

/* Topbar */

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.topbar h1 {
    margin: 0;
    font-size: 1.4rem;
}

/* User menu */

.user-menu {
    border-top: 1px solid #22344d;
    padding: 0.75rem 1rem;
    position: relative;
}

.user-menu-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: #f1f2f6;
    text-decoration: none;
    cursor: pointer;
    font-size: 0.95rem;
}

.user-menu-toggle i {
    font-size: 1.3rem;
}

.user-menu-items {
    display: none;
    position: absolute;
    left: 1rem;
    right: 1rem;
    bottom: 2.4rem;
    background: #001633;
    border: 1px solid #22344d;
    border-radius: 0.3rem;
    padding: 0.3rem 0;
    z-index: 20;
}

.user-menu-items a {
    display: block;
    padding: 0.4rem 0.7rem;
    font-size: 0.9rem;
    color: #f1f2f6;
    text-decoration: none;
}

.user-menu-items a:hover {
    background: #002952;
}

.user-menu.open .user-menu-items {
    display: block;
}

/* ===== Tables & generic UI ===== */

.table,
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    background: #ffffff;
}

.table th,
.table td,
table th,
table td {
    padding: 0.4rem 0.6rem;
    border: 1px solid #dcdde1;
    font-size: 0.9rem;
}

.table th,
table th {
    background: #ecf0f5;
    font-weight: 600;
}

.num-col,
td.num-col {
    text-align: right;
}

/* Filters bar */

.filters {
    margin-bottom: 1.5rem;
    padding: 0.75rem 1rem;
    background: #ffffff;
    border-radius: 0.6rem;
    box-shadow: 0 0 0 1px #e0e3ea;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1.5rem;
}

.filters label {
    font-size: 0.85rem;
    font-weight: 500;
}

.filters select,
.filters input[type="date"],
.filters input[type="text"],
.filters input[type="number"] {
    padding: 0.25rem 0.4rem;
    border-radius: 4px;
    border: 1px solid #ccd1dd;
    font: inherit;
}

/* Buttons */

.btn {
    font-family: "Montserrat", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    display: inline-block;
    padding: 0.4rem 0.85rem;
    border-radius: 4px;
    border: none;
    font-size: 0.9rem;
    cursor: pointer;
    background: #1e90ff;
    color: #ffffff;
    text-decoration: none;
}

.btn:hover {
    color:#ffab40;
    background: #001633;
}

.btn-secondary {
    color: #001633;
    border: 1px solid #001633;
    background-color: #ffffff;
}

.btn-secondary:hover {
    color: #ffab40;
    background: #001633;
}

.btn-danger {
    background-color: #ff0000;
    border: 1px solid #001633;
}

/* Forms */

form p {
    margin: 0 0 0.75rem 0;
}

/* Generic error box (non-field errors) */

.form-errors {
    padding: 0.5rem 0.75rem;
    margin-bottom: 1rem;
    background: #ffdddd;
    border: 1px solid #ffaaaa;
    border-radius: 4px;
}

/* KPIs */

.kpi-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kpi-card {
    flex: 1 1 160px;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    background: #f7f9fc;
    border: 1px solid #e2e6f0;
}

.kpi-card a, .kpi-card a:visited {
    color: #001633 !important;
    text-decoration: none !important;
}

.kpi-card a:hover {
    color: #ffab40 !important;  
}

.kpi-label {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.kpi-value {
    font-size: 1.3rem;
    font-weight: 600;
    color: #222;
}

/* KPI variants (from inline styles) */

.kpi-row-spaced {
    margin-bottom: 2rem;
}

.kpi-row-wide {
    margin-bottom: 2rem;
    gap: 1.5rem;
}

.kpi-card-center {
    flex: 1;
    text-align: center;
}

.kpi-value-large {
    font-size: 2rem;
}

/* Make the two big KPI cards (revenue / expenses) sit side-by-side and be equal width */
.kpi-row .wide {
    flex: 1 1 0;
    min-width: 420px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Center the pie and make it fill the card nicely */
.pie-container {
    margin-top: 1rem;
    height: 300px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Slightly taller pies on big screens */
@media (min-width: 1200px) {
    .pie-container {
        height: 340px;
    }
}

/* Utility margins for previously inline styles */
.mt-05 {
    margin-top: 0.5rem;
}

.mt-1 {
    margin-top: 1rem;
}

.mt-15 {
    margin-top: 1.5rem;
}

/* DataTables tweaks */

.dataTables_wrapper .dataTables_paginate {
    margin-top: 0.5rem;
}

/* ===== Upload panel ===== */

/* Full-screen dark overlay */
.upload-overlay {
    position: fixed;
    inset: 0; /* top:0; right:0; bottom:0; left:0 */
    background: rgba(0, 0, 0, 0.4);
    display: none;
    z-index: 1000;
}

/* When visible, override display */
.upload-overlay.is-visible {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 4rem; /* space from top */
}

.upload-panel {
    background: #fff;
    border-radius: 4px;
    max-width: 600px;
    width: 100%;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    border: 1px solid #ddd;
    padding: 1em;
}

/* ===== Login page ===== */

.auth-body {
    font-family: Montserrat, Arial, sans-serif;
    background: #f5f5f5;
    margin: 0;
}

.auth-wrapper {
    max-width: 400px;
    margin: 4rem auto;
}

.auth-card {
    background: #ffffff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.auth-card h2 {
    margin-top: 0;
    margin-bottom: 1.5rem;
}

.auth-field {
    margin-bottom: 1rem;
}

.auth-field label {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.auth-field input {
    width: 100%;
    padding: 0.4rem 0.5rem;
    border-radius: 4px;
    border: 1px solid #ccc;
    font: inherit;
}

.auth-error {
    background: #ffe5e5;
    color: #a40000;
    padding: 0.45rem 0.75rem;
    border-radius: 4px;
    margin-bottom: 0.6rem;
    font-size: 0.85rem;
}

/* Make login button style explicit so it doesn’t clash with other .btns */

.auth-body .btn {
    background: #004aad;
}

.auth-body .btn:hover {
    background: #00357d;
}

/* ===== Expandable breakdown table ===== */

.proj-row,
.rec-row {
    display: none;
}

.summary-row {
    background: #f0f0f0;
    font-weight: bold;
    border-top: 3px double #333;
}

.table.vat-table a, .table.vat-table a:visited, 
.datatable a, .datatable a:visited,
.table.pnl-table a, .table.pnl-table a:visited {
    color: #001633 !important;
    text-decoration: none !important;
    color: #001633 !important;
}

.table.vat-table a:hover, .table.pnl-table a:hover, .datatable a:hover {
    color: #ffab40 !important;
}

.detail-table{
    text-align: left;
}

.invoice-totals {
    width: 50%;
    text-align: left;

}

/* ===== Invoice PDF styling ===== */

/* Montserrat font for invoice PDF (fonts in static/fonts/) */
@font-face {
    font-family: 'Montserrat';
    src: url("../fonts/Montserrat-Regular.ttf") format("truetype");
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Montserrat';
    src: url("../fonts/Montserrat-Bold.ttf") format("truetype");
    font-weight: bold;
    font-style: normal;
}

/* TEXT SIZE */
.invoice-pdf {
    font-family: 'Montserrat', Arial, sans-serif !important;
    font-size: 8pt !important;
    color: #000;
    margin: 18px;
    background-color: #fff !important;
}

.invoice-pdf * { 
    font-size: inherit !important;
}

/* Top header row */
.invoice-pdf .header-row {
    width: 100%;
    border-collapse: separate !important;
    margin-bottom: 10px;
}

.invoice-pdf .header-row > tbody > tr > td {
    border: 1px !important;
    padding: 12px;
    vertical-align: top;
}

.invoice-pdf .header-left {
    width: 50%;
    vertical-align: top;
}

.invoice-pdf .header-right {
    width: 50%;
    vertical-align: top;
}

.invoice-pdf .company-name {
    font-weight: bold;
    font-size: 1.2em;
}

.invoice-pdf .tax-invoice-title {
    font-weight: bold;
    font-size: 1.9em !important;
    margin-bottom: 6px;
    text-align: center;
    color: #001633;
}

/* Meta table (invoice number, date, etc.) */
.invoice-pdf .meta-table {
    width: 100%;
    border-collapse: collapse;
}

.invoice-pdf .meta-table th,
.invoice-pdf .meta-table td {
    border: 1px solid #000;
    padding: 3px 4px;
    border-left: none !important;
    border-right: none !important;
}

.invoice-pdf .meta-table th {
    background: #001633;
    color: #ffab40;
}

/* Section titles (“Payment info”, “Billed to”, etc.) */
.invoice-pdf .section-title {
    font-weight: bold;
    margin-top: 8px;
    margin-bottom: 4px;
    font-size: 1em;
}

/* Lines table */
.invoice-pdf .lines-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
    font-size: 0.9em;
}

.invoice-pdf .lines-table th,
.invoice-pdf .lines-table td {
    border: 1px solid #000;
    padding: 3px 4px;
    border-left: none !important;
    border-right: none !important;
}

.invoice-pdf .lines-table th {
    background: #001633;
    color: #ffab40;
}

/* Numeric alignment */
.invoice-pdf .num {
    text-align: right;
}

/* Totals table */
.invoice-pdf .totals-table {
    width: 60%;
    float: right;
    border-collapse: collapse;
    margin-top: 12px;
    font-size: 0.9em;
}

.invoice-pdf .totals-table th,
.invoice-pdf .totals-table td {
    border-top: 1px solid #000;
    border-bottom: 1px solid #000;
    padding: 3px 4px;
    border-left: none !important;
    border-right: none !important;
}

.invoice-pdf .totals-table th {
    text-align: left;
    background-color: #fff !important;
}

/* Highlighted grand total row */
.invoice-pdf .totals-highlight {
    background-color: #ffab40;
    font-weight: bold;
}
/* Fixed width to align amount columns */
.invoice-pdf .amount-col {
    width: 100px !important;
    min-width: 100px !important;
    max-width: 100px !important;
    padding-right: 8px !important;
}
.invoice-pdf th.amount-col {
    width: 100px !important;
}

/* ===== Input forms styling ===== */
.form, form.form {
    max-width: 600px;
}

/* One row per field: label | field */
.form-row {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

/* Fixed-width labels so all inputs start at the same x-position */
.form-row > label {
    width: 140px;       /* adjust to taste */
    margin-right: 0.75rem;
    color:#001633;
    text-align: left;  /* or left if you prefer */
}

/* Inputs expand to fill remaining space */
.form-field {
    flex: 1;
}

.form-field input,
.form-field select,
.form-field textarea {
    width: 100%;
    box-sizing: border-box;
}

/* Optional styling for errors/help text */
.form-error {
    color: #c0392b;
    font-size: 0.85rem;
    margin-top: 0.15rem;
}

.form-help {
    font-size: 0.8rem;
    color: #777;
    margin-top: 0.15rem;
}

.form-actions {
    margin-top: 1rem;
}
form.form input,
form.form select,
form.form textarea,
form.form button,
.form input,
.form select,
.form textarea,
.form button {
    font-family: "Montserrat", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Hide the raw DELETE checkboxes in formsets */
.hidden-delete {
    display: none;
}

/* Ensure line inputs use Montserrat and fill the cell */
.line-input input,
.line-input select,
.line-input textarea {
    font-family: "Montserrat", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    width: 100%;
    box-sizing: border-box;
}

table.datatable .line-input {
    padding: 4px 6px;
}

#milestones-table {
    font-family: "Montserrat", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ==== Kanban boards styling ==== */

.kanban-board {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.kanban-column {
    flex: 1;
    min-width: 220px;
    border-radius: 6px;
    padding: 0.5rem;
    background: #ffffff;
    border: 1px solid #e0e3ea;
    border-radius: 8px;
    padding: 0.5rem;
}

.kanban-column-header {
    font-weight: 600;
    margin-bottom: 0.5rem;
    padding-bottom: 0.25rem;
    text-align: center;
}

.kanban-column-body {
    min-height: 50px;
}

.kanban-card {
    background: #f5f6fa;
    border-radius: 4px;
    border: 1px solid #cccccc;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
    cursor: grab;
    font-family: "Montserrat", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.kanban-card-dragging {
  opacity: 0.4;
    cursor: grabbing;
}

.kanban-card a, .kanban-card a:visited {
    color: #001633;
    text-decoration: none;
}

.kanban-card a:hover {
    color: #ffab40;
    text-decoration: none;
}
