/* Data Export > TallyPrime.

   Pinned under the header and beside the sidebar the way CompanySetting is, but scrolling: with
   transactions chosen the page runs to three cards and a log, taller than a laptop screen.
   Own file and own tally- prefix, like every other page -- see report-page conventions. */

.tally-container {
    position: fixed;
    top: 4rem;
    bottom: 4rem;
    left: 14rem;
    right: 0;
    overflow-y: auto;
    transition: left 0.2s ease;
}

.tally-container.sidebar-collapsed {
    left: 5rem;
}

.tally-column {
    max-width: 1280px;
    margin: 0 10px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Side column (connection, send) beside the main one (what to send). The buttons are in the side
   column so they are on screen however long the register list grows -- with transactions chosen it
   is taller than a laptop screen, and the send card used to end up below the fold. The side column
   is sticky for the same reason when the page does scroll. */
.tally-layout {
    display: grid;
    grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
    gap: 12px;
    align-items: start;
}

.tally-side {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.tally-main {
    min-width: 0;
}

.tally-side .tally-grid {
    grid-template-columns: minmax(0, 1fr);
}

.tally-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 17px;
    font-weight: bold;
    color: #222;
}

.tally-title svg {
    flex: none;
}

.tally-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tally-card-head {
    font-size: 14px;
    font-weight: bold;
    color: #222;
}

.tally-sub {
    font-size: 13px;
    font-weight: bold;
    color: #374151;
    margin-top: 2px;
}

.tally-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px 16px;
}

.tally-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 12px;
    color: #4b5563;
    min-width: 0;
}

.tally-field em,
.tally-check em {
    font-style: normal;
    color: #9ca3af;
}

.tally-field input {
    width: 100%;
    height: 32px;
    padding: 4px 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    color: #111827;
    background: #fff;
    box-sizing: border-box;
}

.tally-field input:focus {
    outline: none;
    border-color: #6b7280;
}

.tally-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.tally-row-tight {
    gap: 14px;
}

.tally-mode,
.tally-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 22px;
}

.tally-registers {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 6px 16px;
}

.tally-radio,
.tally-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #222;
    cursor: pointer;
}

.tally-radio input,
.tally-check input {
    margin: 0;
    flex: none;
}

.tally-btn {
    height: 35px;
    min-width: 150px;
    padding: 6px 14px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    font-size: 14px;
    font-weight: bold;
    color: #222;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: background-color .12s ease, border-color .12s ease, color .12s ease;
}

.tally-btn:hover:not(:disabled) {
    background: #f3f4f6;
}

.tally-btn-primary {
    background: #1f2937;
    border-color: #1f2937;
    color: #fff;
}

.tally-btn-primary:hover:not(:disabled) {
    background: #111827;
}

.tally-btn:disabled {
    opacity: .6;
    cursor: default;
}

.tally-link {
    border: none;
    background: none;
    padding: 0;
    font-size: 12px;
    color: #2563eb;
    cursor: pointer;
}

.tally-link:hover {
    text-decoration: underline;
}

.tally-status {
    font-size: 12px;
    line-height: 1.4;
}

.tally-status.ok {
    color: #15803d;
}

.tally-status.bad {
    color: #b91c1c;
}

.tally-note {
    font-size: 12px;
    line-height: 1.5;
    color: #6b7280;
}

.tally-ledgers {
    border-top: 1px solid #f0f0f0;
    padding-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tally-ledgers summary {
    font-size: 13px;
    font-weight: bold;
    color: #374151;
    cursor: pointer;
}

.tally-ledgers[open] summary {
    margin-bottom: 6px;
}

.tally-log {
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #f9fafb;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tally-log-line {
    font-size: 12px;
    line-height: 1.45;
    color: #374151;
    overflow-wrap: anywhere;
}

.tally-log-line.ok {
    color: #15803d;
}

.tally-log-line.warn {
    color: #b45309;
}

.tally-log-line.bad {
    color: #b91c1c;
}

/* Too narrow for two columns: stack them, the side column (with the buttons) first. */
@media (max-width: 1100px) {
    .tally-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .tally-side {
        position: static;
    }
}

/* Below 700px the sidebar is off-canvas and the header is two lines tall, as on every other page. */
@media (max-width: 700px) {
    .tally-container,
    .tally-container.sidebar-collapsed {
        position: static;
        top: auto;
        bottom: auto;
        left: auto;
        right: auto;
        overflow: visible;
        margin: 5.5rem 1rem 1rem;
    }

    .tally-column {
        margin: 0;
    }

    .tally-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .tally-btn {
        flex: 1 1 100%;
    }
}
