/* Chiri / Sale Record Upgrade CSS stylesheet */

/* Grid and Layout */
.chiri-container {
    padding: 16px;
    background: var(--card-bg, #fff);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
}

.chiri-header-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
    padding: 16px;
    background: rgba(248, 250, 252, 0.7);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

body.dark .chiri-header-grid {
    background: rgba(30, 41, 59, 0.5);
    border-color: #334155;
}

.chiri-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chiri-field label {
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.chiri-field input {
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
    color: inherit;
    transition: all 0.2s ease;
}

body.dark .chiri-field input {
    background: #1e293b;
    border-color: #475569;
}

.chiri-field input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.chiri-field input[readonly] {
    background: #f1f5f9;
    color: #64748b;
    cursor: not-allowed;
}

body.dark .chiri-field input[readonly] {
    background: #0f172a;
    color: #475569;
}

/* Excel Style Grid */
.chiri-grid-wrap {
    overflow-x: auto;
    margin-bottom: 20px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
}

body.dark .chiri-grid-wrap {
    border-color: #334155;
    background: #0f172a;
}

.chiri-grid {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.chiri-grid th {
    background: #f8fafc;
    color: #334155;
    font-weight: 600;
    padding: 10px 12px;
    border-bottom: 2px solid #cbd5e1;
    border-right: 1px solid #e2e8f0;
}

body.dark .chiri-grid th {
    background: #1e293b;
    color: #cbd5e1;
    border-bottom-color: #475569;
    border-right-color: #334155;
}

.chiri-grid td {
    padding: 6px 8px;
    border-bottom: 1px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
    vertical-align: middle;
}

body.dark .chiri-grid td {
    border-bottom-color: #334155;
    border-right-color: #334155;
}

.chiri-grid tr:hover {
    background: rgba(241, 245, 249, 0.4);
}

body.dark .chiri-grid tr:hover {
    background: rgba(30, 41, 59, 0.2);
}

.chiri-grid input {
    width: 100%;
    border: none;
    background: transparent;
    padding: 6px 8px;
    color: inherit;
    font-size: 13px;
}

.chiri-grid input:focus {
    outline: 2px solid #2563eb;
    background: #fff;
}

body.dark .chiri-grid input:focus {
    background: #1e293b;
}

.chiri-grid input[readonly] {
    cursor: default;
    color: #64748b;
}

/* Deductions Section */
.chiri-bottom-section {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 20px;
    margin-top: 20px;
}

@media (max-width: 768px) {
    .chiri-bottom-section {
        grid-template-columns: 1fr;
    }
}

.chiri-unsold-panel {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 14px;
    background: #f8fafc;
}

body.dark .chiri-unsold-panel {
    border-color: #334155;
    background: #1e293b;
}

.chiri-unsold-panel h3 {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 700;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 8px;
}

body.dark .chiri-unsold-panel h3 {
    color: #cbd5e1;
}

.chiri-unsold-table-wrap {
    max-height: 220px;
    overflow-y: auto;
}

.chiri-unsold-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.chiri-unsold-table th {
    background: #e2e8f0;
    padding: 6px 8px;
    text-align: left;
    border-bottom: 1px solid #cbd5e1;
}

body.dark .chiri-unsold-table th {
    background: #334155;
    border-bottom-color: #475569;
}

.chiri-unsold-table td {
    padding: 6px 8px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
}

body.dark .chiri-unsold-table td {
    border-bottom-color: #334155;
}

.chiri-unsold-table tr:hover td {
    background: #e0f2fe;
    color: #0369a1;
}

body.dark .chiri-unsold-table tr:hover td {
    background: #0c4a6e;
    color: #bae6fd;
}

.chiri-calculations {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
}

body.dark .chiri-calculations {
    background: #1e293b;
    border-color: #334155;
}

.chiri-calc-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 13px;
}

.chiri-calc-row label {
    font-weight: 600;
    color: #475569;
}

body.dark .chiri-calc-row label {
    color: #cbd5e1;
}

.chiri-calc-row .value {
    font-weight: 700;
}

.chiri-deduct-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 12px 0;
    padding: 10px 0;
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
}

body.dark .chiri-deduct-inputs {
    border-color: #334155;
}

.chiri-deduct-inputs label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
}

.chiri-deduct-inputs input {
    padding: 6px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 12px;
    text-align: right;
}

body.dark .chiri-deduct-inputs input {
    background: #0f172a;
    border-color: #475569;
}

.chiri-net-amount-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 14px;
    padding-top: 10px;
    border-top: 2px solid #cbd5e1;
}

body.dark .chiri-net-amount-row {
    border-top-color: #475569;
}

.chiri-net-amount-row label {
    font-size: 15px;
    font-weight: 800;
    color: #1e293b;
}

body.dark .chiri-net-amount-row label {
    color: #f8fafc;
}

.chiri-net-amount-row .value {
    font-size: 18px;
    font-weight: 800;
    color: #16a34a;
}

/* Modalls / Search LOVs */
.chiri-lov-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.chiri-lov {
    width: 600px;
    max-width: 90vw;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

body.dark .chiri-lov {
    background: #1e293b;
}

.chiri-lov-title {
    background: #2563eb;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    padding: 12px 16px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.chiri-lov-search {
    padding: 12px;
    border-bottom: 1px solid #e2e8f0;
}

body.dark .chiri-lov-search {
    border-color: #334155;
}

.chiri-lov-search input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 13px;
}

body.dark .chiri-lov-search input {
    background: #0f172a;
    border-color: #475569;
}

.chiri-lov-list {
    max-height: 300px;
    overflow-y: auto;
}

.chiri-lov-row {
    display: grid;
    grid-template-columns: 80px 1fr 120px;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    font-size: 13px;
    align-items: center;
}

body.dark .chiri-lov-row {
    border-bottom-color: #334155;
}

.chiri-lov-row:hover, .chiri-lov-row.active {
    background: #eff6ff;
}

body.dark .chiri-lov-row:hover, body.dark .chiri-lov-row.active {
    background: #2563eb;
    color: #fff;
}

.chiri-lov-row strong {
    font-weight: 600;
}

.chiri-lov-help {
    background: #f8fafc;
    padding: 8px 16px;
    font-size: 11px;
    color: #64748b;
    border-top: 1px solid #e2e8f0;
}

body.dark .chiri-lov-help {
    background: #0f172a;
    border-color: #334155;
    color: #94a3b8;
}
