/* ---- Base (from _blank_grey) ---- */
body, html {
    height: 100%;
    margin: 0;
    padding: 0;
    background-color: black;
    font-size: 16px;
    color: rgb(146, 146, 146);
    font-family: 'Consolas', 'Courier New', monospace;
    overflow: hidden;
}

* {
    box-sizing: border-box;
}

/* ---- Layout ---- */
#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* ---- Header ---- */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    border-bottom: 1px solid #333;
    flex-shrink: 0;
}

header h1 {
    margin: 0;
    font-size: 22px;
    letter-spacing: 2px;
    color: #aaa;
}

header .version {
    font-size: 13px;
    color: #555;
}

/* ---- Tab Bar ---- */
#tab-bar {
    display: flex;
    gap: 2px;
    padding: 4px 16px;
    border-bottom: 1px solid #333;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.tab {
    background: transparent;
    border: 1px solid #444;
    color: #888;
    padding: 6px 14px;
    font-family: inherit;
    font-size: 15px;
    cursor: pointer;
    letter-spacing: 1px;
    transition: all 0.15s;
}

.tab:hover {
    color: #ccc;
    border-color: #666;
}

.tab.active {
    color: #ddd;
    border-color: #888;
    background: #1a1a1a;
}

.tab-action {
    color: #8c8 !important;
    border-color: #585 !important;
    margin-left: auto;
}

.tab-action:hover {
    color: #afa !important;
    border-color: #6a6 !important;
    background: #0a1a0a;
}

/* ---- Tab Content ---- */
.tab-content {
    display: none;
    flex: 1;
    overflow: hidden;
}

.tab-content.active {
    display: flex;
}

/* ---- Two Panel Layout ---- */
.panel-form {
    width: 280px;
    padding: 12px 16px;
    border-right: 1px solid #333;
    flex-shrink: 0;
    overflow-y: auto;
}

.panel-list {
    flex: 1;
    padding: 12px 16px;
    overflow-y: auto;
}

.panel-form h2 {
    margin: 0 0 10px 0;
    font-size: 17px;
    color: #aaa;
    letter-spacing: 1px;
}

/* ---- Forms ---- */
input, select, textarea {
    background: #111;
    border: 1px solid #444;
    color: #ccc;
    font-family: inherit;
    font-size: 15px;
    padding: 6px 8px;
    width: 100%;
    margin-bottom: 8px;
    outline: none;
}

input:focus, select:focus, textarea:focus {
    border-color: #777;
}

input::placeholder, textarea::placeholder {
    color: #555;
}

select {
    cursor: pointer;
}

textarea {
    resize: vertical;
    min-height: 40px;
}

.qty-row {
    display: flex;
    gap: 4px;
}

.qty-row input {
    flex: 1;
}

.qty-row select {
    width: 90px;
    flex-shrink: 0;
}

.form-actions {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}

.form-actions button {
    flex: 1;
}

button {
    background: #1a1a1a;
    border: 1px solid #444;
    color: #aaa;
    font-family: inherit;
    font-size: 15px;
    padding: 6px 12px;
    cursor: pointer;
    transition: all 0.15s;
}

button:hover {
    color: #ddd;
    border-color: #666;
    background: #222;
}

button.btn-primary {
    color: #8c8;
    border-color: #585;
}

button.btn-primary:hover {
    color: #afa;
    border-color: #6a6;
    background: #0a1a0a;
}

button.btn-danger {
    color: #c88;
    border-color: #855;
}

button.btn-danger:hover {
    color: #faa;
    border-color: #a66;
    background: #1a0a0a;
}

button.btn-sm {
    padding: 3px 8px;
    font-size: 14px;
}

/* ---- Tables ---- */
table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    font-size: 14px;
    color: #777;
    letter-spacing: 1px;
    padding: 6px 8px;
    border-bottom: 1px solid #444;
    white-space: nowrap;
}

td {
    padding: 6px 8px;
    border-bottom: 1px solid #222;
    font-size: 15px;
    vertical-align: top;
}

tr:hover td {
    background: #111;
}

td.actions {
    white-space: nowrap;
}

td.actions button {
    margin-right: 4px;
}

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

.text-dim {
    color: #555;
}

.text-warn {
    color: #ca8;
}

.qty-zero {
    color: #855;
}

.empty-msg {
    color: #555;
    font-style: italic;
    padding: 20px 0;
}

/* ---- Sale Detail Rows ---- */
.sale-detail {
    display: none;
}

.sale-detail.expanded {
    display: table-row;
}

.sale-detail td {
    padding: 4px 8px 12px 24px;
    color: #777;
    font-size: 14px;
    border-bottom: 1px solid #333;
}

.sale-detail-items {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sale-detail-items li {
    padding: 2px 0;
}

.sale-row {
    cursor: pointer;
}

.sale-row:hover td {
    background: #151515;
}

/* ---- Modal ---- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-content {
    background: #0a0a0a;
    border: 1px solid #444;
    padding: 20px;
    width: 600px;
    max-width: 95vw;
    max-height: 85vh;
    overflow-y: auto;
}

.modal-content h2 {
    margin: 0 0 16px 0;
    font-size: 18px;
    color: #aaa;
    letter-spacing: 1px;
}

.sale-customer {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}

.sale-customer select {
    flex: 1;
    margin-bottom: 0;
}

.sale-customer button {
    flex-shrink: 0;
}

/* ---- Sale Line Items ---- */
#sale-items {
    margin-bottom: 8px;
}

.sale-line-item {
    display: flex;
    gap: 4px;
    align-items: center;
    margin-bottom: 6px;
    padding: 6px;
    border: 1px solid #333;
    flex-wrap: wrap;
}

.sale-line-item select {
    width: 90px;
    margin-bottom: 0;
}

.sale-line-item select.item-select {
    width: 140px;
}

.sale-line-item input {
    width: 70px;
    margin-bottom: 0;
}

.sale-line-item .item-info {
    font-size: 13px;
    color: #666;
    flex-basis: 100%;
    padding-top: 2px;
}

.sale-line-item .item-line-total {
    color: #aaa;
    font-size: 15px;
    min-width: 60px;
    text-align: right;
}

.sale-line-item .btn-remove-item {
    padding: 3px 6px;
    font-size: 11px;
    color: #c88;
    border-color: #855;
}

.sale-total {
    text-align: right;
    font-size: 16px;
    color: #aaa;
    padding: 10px 0;
    border-top: 1px solid #444;
    margin-top: 8px;
}

.sale-total span {
    color: #ccc;
}

.modal-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.modal-actions button {
    flex: 1;
}

/* ---- Quick Customer Input (inline in modal) ---- */
.quick-customer {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}

.quick-customer input {
    flex: 1;
    margin-bottom: 0;
}

/* ---- Status Bar ---- */
#status-bar {
    display: flex;
    align-items: center;
    padding: 6px 16px;
    border-top: 1px solid #333;
    font-size: 14px;
    color: #555;
    flex-shrink: 0;
}

/* ---- Hidden utility ---- */
.hidden {
    display: none !important;
}

/* ---- Confirm Dialog ---- */
.confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.confirm-box {
    background: #0a0a0a;
    border: 1px solid #666;
    padding: 20px;
    max-width: 400px;
    text-align: center;
}

.confirm-box p {
    margin: 0 0 16px 0;
    color: #aaa;
}

.confirm-box .confirm-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

/* ---- Error Message ---- */
.error-msg {
    color: #c66;
    font-size: 14px;
    margin-bottom: 6px;
}

/* ---- Sale Notes ---- */
.sale-notes-input {
    width: 100%;
    margin-top: 8px;
}

/* ---- Sale Discount ---- */
.sale-discount {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
}

.sale-discount label {
    color: #aaa;
    font-size: 15px;
    white-space: nowrap;
}

.sale-discount input {
    width: 90px;
    margin-bottom: 0;
}

.sale-discount select {
    width: 80px;
    margin-bottom: 0;
}

/* ---- Sale Total Breakdown ---- */
.sale-subtotal {
    font-size: 14px;
    color: #777;
    padding-bottom: 2px;
}

.sale-discount-line {
    font-size: 14px;
    color: #c88;
    padding-bottom: 2px;
}

.sale-final-total {
    font-size: 17px;
    color: #ccc;
    padding-top: 4px;
}

/* ---- Dashboard ---- */
.dashboard {
    padding: 16px;
    overflow-y: auto;
    width: 100%;
}

.dash-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.dash-card {
    border: 1px solid #333;
    padding: 14px;
    flex: 1;
    min-width: 140px;
}

.dash-card-wide {
    min-width: 280px;
}

.dash-label {
    font-size: 13px;
    color: #777;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.dash-value {
    font-size: 24px;
    color: #ccc;
}

.dash-sub {
    font-size: 14px;
    color: #666;
    margin-top: 4px;
}

.dash-list {
    margin: 0;
    padding: 0 0 0 20px;
    color: #aaa;
    font-size: 15px;
}

.dash-list li {
    padding: 3px 0;
}

.dash-list-unordered {
    list-style: none;
    padding-left: 0;
}

.dash-empty {
    color: #555;
    font-style: italic;
    font-size: 14px;
}

/* ---- Date Range Filter ---- */
.date-range {
    margin-top: 10px;
    margin-bottom: 10px;
}

.date-range label {
    display: block;
    font-size: 13px;
    color: #777;
    margin-bottom: 2px;
    margin-top: 6px;
}

.date-range input[type="date"] {
    width: 100%;
}

.date-range button {
    margin-top: 6px;
    width: 100%;
}

/* ---- Export Actions ---- */
.export-actions {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.export-actions button {
    width: 100%;
}

/* ---- Low Stock Warning ---- */
tr.low-stock td {
    color: #ca8;
}

tr.low-stock td:first-child::before {
    content: "\26A0  ";
}

/* ============================================================
   SECTION COLOR CODING
   Each tab gets a subtle accent color for visual distinction
   ============================================================ */

/* ---- Plants: Dark Green ---- */
.tab[data-tab="plants"].active {
    border-color: #3a7a3a;
    color: #7c7;
    background: #0a150a;
}
.tab[data-tab="plants"]:hover {
    color: #9d9;
    border-color: #3a7a3a;
}

#tab-plants {
    border-top: 3px solid #2a5a2a;
}
#tab-plants .panel-form {
    border-right-color: #2a5a2a;
}
#tab-plants .panel-form h2 {
    color: #7b7;
}
#tab-plants th {
    border-bottom-color: #2a5a2a;
    color: #7a7;
}
#tab-plants input:focus,
#tab-plants select:focus {
    border-color: #3a7a3a;
}

/* ---- Products: Dark Amber ---- */
.tab[data-tab="products"].active {
    border-color: #7a6a3a;
    color: #cc9;
    background: #15120a;
}
.tab[data-tab="products"]:hover {
    color: #dd9;
    border-color: #7a6a3a;
}

#tab-products {
    border-top: 3px solid #5a4a2a;
}
#tab-products .panel-form {
    border-right-color: #5a4a2a;
}
#tab-products .panel-form h2 {
    color: #bb9;
}
#tab-products th {
    border-bottom-color: #5a4a2a;
    color: #a97;
}
#tab-products input:focus,
#tab-products select:focus {
    border-color: #7a6a3a;
}

/* ---- Customers: Dark Blue ---- */
.tab[data-tab="customers"].active {
    border-color: #3a5a8a;
    color: #8bf;
    background: #0a0e15;
}
.tab[data-tab="customers"]:hover {
    color: #9cf;
    border-color: #3a5a8a;
}

#tab-customers {
    border-top: 3px solid #2a3a5a;
}
#tab-customers .panel-form {
    border-right-color: #2a3a5a;
}
#tab-customers .panel-form h2 {
    color: #89b;
}
#tab-customers th {
    border-bottom-color: #2a3a5a;
    color: #79a;
}
#tab-customers input:focus,
#tab-customers select:focus {
    border-color: #3a5a8a;
}

/* ---- Sales: Dark Purple ---- */
.tab[data-tab="sales"].active {
    border-color: #6a3a8a;
    color: #c8f;
    background: #120a15;
}
.tab[data-tab="sales"]:hover {
    color: #d9f;
    border-color: #6a3a8a;
}

#tab-sales {
    border-top: 3px solid #4a2a5a;
}
#tab-sales .panel-form {
    border-right-color: #4a2a5a;
}
#tab-sales .panel-form h2 {
    color: #a8c;
}
#tab-sales th {
    border-bottom-color: #4a2a5a;
    color: #97a;
}
#tab-sales input:focus,
#tab-sales select:focus {
    border-color: #6a3a8a;
}

/* ---- Dashboard: Dark Teal ---- */
.tab[data-tab="dashboard"].active {
    border-color: #3a7a7a;
    color: #7cc;
    background: #0a1515;
}
.tab[data-tab="dashboard"]:hover {
    color: #9dd;
    border-color: #3a7a7a;
}

#tab-dashboard {
    border-top: 3px solid #2a5a5a;
}
