/* Look and feel copied from the www.pentlavalli.com login page */

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: Verdana, sans-serif;
    font-size: 12px;
    font-weight: bold;
    color: black;
    background-color: #E1DFD4;
}

/* The white card in the middle of the page */
.login-card {
    width: 320px;
    padding: 32px;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.login-card h1 {
    margin: 0 0 24px;
    font-size: 20px;
    font-weight: normal;
    text-align: center;
}

/* Flat grey inputs with square corners */
.login-card input {
    box-sizing: border-box;
    width: 100%;
    margin-bottom: 14px;
    padding: 10px;
    font-family: Verdana, sans-serif;
    font-size: 12px;
    background-color: #e5e5e5;
    border: 1px solid #cccccc;
    border-radius: 0;
}

.login-card input:focus {
    outline: none;
    border-color: #888888;
}

.login-card button {
    width: 100%;
    padding: 10px;
    font-family: Verdana, sans-serif;
    font-size: 12px;
    font-weight: bold;
    color: white;
    background-color: #ababab;
    border: none;
    cursor: pointer;
}

.login-card button:hover {
    background-color: #8f8f8f;
}

/* ---- Report page: full-width page instead of the small login card ---- */
body.report-page {
    display: block;
    min-height: 100vh;
}

/* Top bar with the title on the left and Logout on the right */
.report-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.report-header h1 {
    margin: 0;
    font-size: 20px;
    font-weight: normal;
}

.report-user {
    display: flex;
    align-items: center;
    gap: 16px;
}

.report-user form {
    margin: 0;
}

/* English | తెలుగు switch; Telugu letters need a font that has them (the browser picks one if Verdana has none) */
body, input, select, textarea, button {
    font-family: Verdana, "Nirmala UI", "Noto Sans Telugu", sans-serif;
}

.lang-switch {
    font-weight: normal;
    white-space: nowrap;
}

.login-card .lang-switch {
    display: block;
    margin-top: 16px;
    text-align: center;
}

.lang-link {
    color: #666666;
    text-decoration: none;
}

.lang-link.active {
    color: #000000;
    font-weight: bold;
    text-decoration: underline;
}

.logout-button {
    padding: 8px 18px;
    font-family: Verdana, sans-serif;
    font-size: 12px;
    font-weight: bold;
    color: white;
    background-color: #ababab;
    border: none;
    cursor: pointer;
}

.logout-button:hover {
    background-color: #8f8f8f;
}

.report-body {
    margin: 24px;
    padding: 16px;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Previous / page info / Next below the table */
.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.pager-button {
    padding: 8px 18px;
    color: white;
    text-decoration: none;
    background-color: #ababab;
}

a.pager-button:hover {
    background-color: #8f8f8f;
}

.pager-button.disabled {
    background-color: #e5e5e5;
    color: #999999;
}

.report-table {
    width: 100%;
    margin-bottom: 20px;
    border-collapse: collapse;
}

.report-table th,
.report-table td {
    padding: 8px;
    text-align: left;
    border-bottom: 1px solid #cccccc;
}

.report-table th {
    background-color: #e5e5e5;
}

.report-table .num {
    text-align: right;
}

.report-table .center {
    text-align: center;
}

/* The report icon link in the Details column */
.report-icon {
    display: inline-block;
    color: #666666;
}

.report-icon:hover {
    color: #000000;
}

/* ---- Details page: Filter and Results sections ---- */
.section-title {
    margin: 0 0 16px;
    padding-bottom: 8px;
    font-size: 16px;
    border-bottom: 2px solid #E1DFD4;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 16px;
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}

/* The search line: Search Criteria and Search Text side by side on a line of their own. It never
   wraps, and the search text box takes all the space that is left on the line. */
.filter-row.search-row {
    flex-wrap: nowrap;
}

.filter-field input.search-text {
    box-sizing: border-box;
    width: 100%;
}

.filter-grow {
    flex: 1;
    min-width: 200px;
}

.filter-label {
    color: #555555;
}

.filter-field input[type="date"],
.filter-field input[type="number"],
.filter-field input[type="text"],
.filter-field select {
    padding: 8px;
    font-family: Verdana, sans-serif;
    font-size: 12px;
    background-color: #e5e5e5;
    border: 1px solid #cccccc;
    border-radius: 0;
}

/* Editable results table */
.toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

/* Credits, debits and net on the right of the toolbar: no titles, only a symbol and the amount */
.totals {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 22px;
    margin-left: auto;          /* pushes the totals to the right edge */
    text-align: right;
    font-weight: bold;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.total-credit {
    color: #1f8a4c;             /* green */
}

.total-debit {
    color: #c0392b;             /* red */
}

.total-net {
    color: #1f8a4c;
}

.total-net.negative {
    color: #c0392b;             /* a negative net is red */
}

.delete-button {
    background-color: #b04a4a;
}

.delete-button:hover {
    background-color: #8f3a3a;
}

/* Column widths: "fit" columns are only as wide as their content (a dropdown is as wide as
   its longest choice), "wide" (VIVARANA) takes all the space that is left over */
.table-wrap {
    overflow-x: auto;
}

.details-table td,
.details-table th {
    padding: 6px;
    vertical-align: top;
}

.details-table .fit {
    width: 1%;
    white-space: nowrap;
}

.details-table .wide {
    width: 100%;
}

/* Column names can be clicked to sort */
.sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.sortable:hover {
    background-color: #d6d6d6;
}

/* The column name is a link; it should look like the other headers */
.sortable a {
    display: block;
    color: inherit;
    text-decoration: none;
}

.sort-ind {
    margin-left: 4px;
    font-size: 10px;
}

.hint {
    color: #888888;
    font-weight: normal;
}

.cell-input {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    padding: 6px;
    font-family: Verdana, sans-serif;
    font-size: 12px;
    background-color: #f4f4f4;
    border: 1px solid #cccccc;
    border-radius: 0;
}

.cell-input.num {
    text-align: right;
}

/* Dropdowns fit their longest choice; the number and date boxes have a fixed small width */
select.cell-input {
    width: auto;
    max-width: 360px;
}

/* VIBHAAGAMU has different choices in every row (only those of the row's VISHLESHANA),
   so a dropdown that fits its choices would be a different width in every row: fixed instead */
select.cell-input[name="vibhaagamu"] {
    width: 200px;
}

.cell-input.sno {
    width: 66px;
}

.cell-input.date {
    width: 92px;
}

.cell-input.amount {
    width: 124px;
}

/* Date box (dd.mm.yyyy) with a calendar button. The real date picker is a hidden box
   next to the button: it only opens the calendar of the browser. */
.date-field {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.calendar-button {
    padding: 4px 6px;
    font-size: 12px;
    cursor: pointer;
    background-color: #e5e5e5;
    border: 1px solid #cccccc;
}

.calendar-button:hover {
    background-color: #d6d6d6;
}

.date-field input[type="date"].calendar-native {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 1px;
    height: 1px;
    padding: 0;
    border: 0;
    opacity: 0;
    pointer-events: none;
}

/* The suggestions under the VIVARANA box of a new row (suggest.js) */
.suggestions {
    position: fixed;
    z-index: 100;
    max-height: 280px;
    overflow-y: auto;
    background: white;
    border: 1px solid #999999;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

.suggestion {
    padding: 6px 8px;
    cursor: pointer;
    border-bottom: 1px solid #eeeeee;
}

.suggestion:hover,
.suggestion.active {
    background-color: #DCD6FF;
}

.suggestion-meta {
    color: #777777;
    font-size: 11px;
    font-weight: normal;
}

.suggestion-text {
    font-weight: normal;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* The page dropdown next to "Page" and "of 90 (9000 rows)" */
.page-select {
    padding: 6px;
    font-family: Verdana, sans-serif;
    font-size: 12px;
    background-color: #e5e5e5;
    border: 1px solid #cccccc;
    border-radius: 0;
}

/* VIVARANA: the height follows the text (set by details.js), so no scrollbar or drag handle */
textarea.cell-input {
    resize: none;
    overflow-y: hidden;
    line-height: 1.4;
    min-width: 260px;
}

/* Row colours. Later rules win, so "marked for delete" beats the others. */
.new-row td {
    background-color: #D6FFEC;        /* added, not saved yet */
}

.row-modified td {
    background-color: #DCD6FF;        /* a value was changed */
}

.row-delete td,
.new-row.row-delete td {
    background-color: #FAA493;        /* ticked for delete */
}

/* The boxes in a coloured row are see-through, so the whole row shows its colour
   (otherwise the grey boxes would hide most of it) */
.new-row .cell-input,
.row-modified .cell-input,
.row-delete .cell-input {
    background-color: rgba(255, 255, 255, 0.35);
}

/* A darker bar at the left edge makes a coloured row easy to spot */
.new-row td:first-child {
    border-left: 5px solid #2e9e6b;
}

.row-modified td:first-child {
    border-left: 5px solid #6a5acd;
}

.row-delete td:first-child,
.new-row.row-delete td:first-child {
    border-left: 5px solid #d9503a;
}

/* The small colour key above the table */
.legend {
    margin: 0 0 12px;
    color: #555555;
    font-weight: normal;
}

.legend-box {
    display: inline-block;
    width: 12px;
    height: 12px;
    margin: 0 4px 0 14px;
    vertical-align: middle;
    border: 1px solid #999999;
}

.legend-box:first-child {
    margin-left: 0;
}

.legend-add { background-color: #D6FFEC; }
.legend-modified { background-color: #DCD6FF; }
.legend-delete { background-color: #FAA493; }

.success {
    margin: 0 0 14px;
    padding: 8px;
    color: #2d6a2d;
    background: #e9f6e9;
    border-left: 3px solid #2d6a2d;
}

/* Scrollable box with the KHAATA checkboxes */
.khaata-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 20px;
    max-height: 120px;
    overflow-y: auto;
    padding: 8px;
    background-color: #e5e5e5;
    border: 1px solid #cccccc;
}

.khaata-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: normal;
    cursor: pointer;
}

/* A KHAATA that is ticked in the filter is shown in bold green */
.khaata-item input:checked + span {
    font-weight: bold;
    color: #1f8a4c;
}

/* ---- The popup (delete confirmation): looks like the login card, in the middle of the screen ---- */
.dialog-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(60, 56, 44, 0.55);
}

/* [hidden] must win over the display: flex above */
.dialog-backdrop[hidden] {
    display: none;
}

.dialog-card {
    box-sizing: border-box;
    width: 380px;
    max-width: 90%;
    padding: 32px;
    text-align: center;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    border-top: 4px solid #b04a4a;
}

.dialog-card h1 {
    margin: 0 0 16px;
    font-size: 20px;
    font-weight: normal;
}

.dialog-card p {
    margin: 0 0 24px;
}

.dialog-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.dialog-buttons button {
    min-width: 100px;
    padding: 10px 18px;
}

.error {
    margin: 0 0 14px;
    padding: 8px;
    color: #a00000;
    background: #fbe9e9;
    border-left: 3px solid #a00000;
}
