:root { --bg: #ffffff; --ink: #0a0a0a; --ink-soft: #6b7280; --line: #e5e7eb; --line-soft: #f3f4f6; --hover: #f9fafb; --radius: 10px; --radius-sm: 6px; }
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #f8f9fa; color: var(--ink); font-size: 14px; line-height: 1.5; }

.app-bar { position: sticky; top: 0; z-index: 100; background: rgba(255,255,255,0.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.app-bar-inner { max-width: 1100px; margin: 0 auto; padding: 14px 24px; display: flex; align-items: center; justify-content: space-between; }
.app-bar-brand { display: flex; align-items: center; gap: 12px; }
.app-bar-brand img { height: 34px; }
.brand-name { font-size: 15px; font-weight: 600; }
.brand-sub { font-size: 10px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.1em; }
.app-nav { display: flex; gap: 12px; }
.btn-logout { background:transparent; border:1px solid #e5e7eb; padding: 8px 14px; border-radius: 6px; cursor:pointer; font-family:inherit; color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; font-size: 13px; }

.container { max-width: 1100px; margin: 0 auto; padding: 32px 24px; }
.page-header { margin-bottom: 24px; }
.page-header h1 { margin: 0 0 8px; font-size: 24px; font-weight: 600; }
.header-line { border: 0; border-top: 2px solid var(--ink); margin: 0 0 16px; }
.date-bar { display: flex; align-items: center; gap: 12px; }
.date-bar label { font-weight: 600; font-size: 14px; }
.date-bar input { padding: 8px 12px; border: 1px solid var(--line); border-radius: 6px; font-family: inherit; font-size: 14px; }

.btn-save { background: var(--ink); color: #fff; border: none; padding: 8px 16px; border-radius: 6px; cursor: pointer; font-family: inherit; font-size: 13px; font-weight: 500; }
.btn-save:hover { background: #262626; }

.table-wrapper { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: 0 4px 10px rgba(0,0,0,0.02); }
.buying-table { width: 100%; border-collapse: collapse; }
.buying-table th { text-align: left; padding: 10px 12px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); border-bottom: 2px solid var(--line); }
.buying-table th.num { text-align: right; }
.buying-table td { padding: 8px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.buying-table td.num { text-align: right; }

/* Column Width Adjustments */
.cat-col { width: 90px; }
.inv-col { width: 100px; }
.amt-col { width: 110px; }
.auth-col { width: 110px; } 
.act-col { width: 40px; text-align: center; }

.row-input { width: 100%; padding: 8px 10px; border: 1px solid transparent; background: transparent; font: inherit; font-size: 14px; border-radius: 4px; transition: all 0.15s; }
.row-input:hover { border-color: var(--line); background: #fff; }
.row-input:focus { outline: none; border-color: var(--ink); background: #fff; }
.row-input.num { text-align: right; }

.sec-select { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 4px; background: #fff; font: inherit; font-size: 14px; cursor: pointer; }
.sec-select:focus { outline: none; border-color: var(--ink); }

/* Premium Custom Dropdown */
.custom-select { position: relative; width: 100%; font-family: inherit; }
.cs-trigger { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 4px; background: #fff; cursor: pointer; font-size: 14px; min-height: 36px; transition: border-color 0.15s; }
.cs-trigger:hover { border-color: #d1d5db; }
.custom-select.open .cs-trigger { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.cs-placeholder { color: #9ca3af; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-trigger.has-value .cs-placeholder { color: var(--ink); }
.cs-arrow { transition: transform 0.2s ease; color: var(--ink-soft); flex-shrink: 0; margin-left: 8px; }
.custom-select.open .cs-arrow { transform: rotate(180deg); }
.cs-options { position: absolute; top: calc(100% + 4px); left: 0; width: 100%; background: #fff; border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 10px 20px rgba(0,0,0,0.1); z-index: 20; max-height: 200px; overflow-y: auto; opacity: 0; transform: translateY(-5px); pointer-events: none; transition: all 0.2s ease; }
.custom-select.open .cs-options { opacity: 1; transform: translateY(0); pointer-events: auto; }
.cs-option { padding: 8px 10px; font-size: 14px; cursor: pointer; transition: background 0.1s; color: var(--ink); }
.cs-option:hover { background: var(--hover); }

/* Paid Column & Status Dot */
.paid-wrapper { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.status-dot.red { background-color: #dc2626; }
.status-dot.green { background-color: #059669; }
.paid-input.red { color: #dc2626; font-weight: 600; }
.paid-input.green { color: #059669; font-weight: 600; }

.remove-btn { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; width: 28px; height: 28px; border-radius: 4px; cursor: pointer; font-size: 16px; display: flex; align-items: center; justify-content: center; }
.remove-btn:hover { background: #fee2e2; }

.btn-add-row { margin-top: 16px; background: #fff; color: var(--ink); border: 1px dashed var(--line); padding: 8px 16px; border-radius: 6px; cursor: pointer; font-family: inherit; font-size: 13px; font-weight: 500; transition: all 0.15s; }
.btn-add-row:hover { border-color: var(--ink); background: var(--hover); }