:root{--bg:#f3f5f8;--panel:#fff;--text:#18212f;--muted:#6b7280;--line:#e5e7eb;--brand:#6657d9;--brand2:#8b7cf3;--green:#15803d;--red:#b42318;--amber:#b45309;--shadow:0 12px 34px rgba(20,27,45,.08)}
*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--text);font:14px/1.45 Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}.topbar{min-height:68px;background:#161a28;color:white;display:flex;align-items:center;padding:0 28px;gap:30px;position:sticky;top:0;z-index:20}.brand{display:flex;align-items:center;gap:10px;font-weight:800;font-size:17px;white-space:nowrap}.brand-mark,.login-badge{display:grid;place-items:center;background:linear-gradient(135deg,var(--brand2),var(--brand));color:white;border-radius:12px;font-weight:900}.brand-mark{width:35px;height:35px}.main-nav{display:flex;align-self:stretch;align-items:center;gap:5px;overflow:auto}.main-nav a{color:#c9cce0;text-decoration:none;padding:10px 12px;border-radius:9px;white-space:nowrap}.main-nav a:hover,.main-nav a.active{background:#292f45;color:white}.logout-form{margin-left:auto}.container{max-width:1500px;margin:0 auto;padding:28px}.footer{text-align:center;color:#9298a5;padding:25px}.page-head{display:flex;justify-content:space-between;align-items:flex-start;gap:20px;margin-bottom:22px}.page-head h1{margin:0 0 4px;font-size:28px}.muted{color:var(--muted)}.actions,.three-actions{display:flex;gap:10px;flex-wrap:wrap}.button{display:inline-flex;align-items:center;justify-content:center;border:1px solid #d5d9e2;background:white;color:#252c3a;border-radius:9px;padding:9px 14px;text-decoration:none;font:inherit;font-weight:650;cursor:pointer}.button:hover{border-color:#aaaed0}.button.primary{background:var(--brand);border-color:var(--brand);color:white}.button.danger{color:var(--red);border-color:#fecaca}.button.ghost{background:transparent;color:white;border-color:#444c67}.button.small{padding:7px 11px}.button.tiny{padding:5px 8px;font-size:12px}.button.full{width:100%}.panel{background:var(--panel);border:1px solid var(--line);border-radius:15px;box-shadow:var(--shadow);padding:20px;margin-bottom:22px}.panel-head{display:flex;justify-content:space-between;align-items:center;gap:15px;margin-bottom:15px}.panel-head h2,.panel h2{margin:0;font-size:18px}.panel-head a{color:var(--brand);text-decoration:none}.kpi-grid{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:14px;margin-bottom:22px}.kpi-grid.compact{grid-template-columns:repeat(3,minmax(0,1fr));max-width:900px}.kpi{background:white;border:1px solid var(--line);border-radius:14px;padding:17px;box-shadow:var(--shadow);display:flex;flex-direction:column}.kpi span{color:var(--muted);font-size:12px;text-transform:uppercase;letter-spacing:.04em}.kpi strong{font-size:24px;margin:7px 0}.kpi small{color:var(--muted)}.danger-kpi{border-color:#fecaca;background:#fff8f8}.two-col{display:grid;grid-template-columns:1fr 1fr;gap:22px}.align-start{align-items:start}.list-row{display:flex;justify-content:space-between;gap:15px;padding:12px 0;border-bottom:1px solid var(--line)}.list-row:last-child{border-bottom:0}.list-row small,td small{display:block;color:var(--muted);margin-top:3px}.right{text-align:right}.badge{display:inline-block;background:#eef0f5;color:#4b5563;border-radius:999px;padding:4px 8px;font-size:11px;font-weight:750;white-space:nowrap}.badge.green{background:#dcfce7;color:var(--green)}.badge.red{background:#fee2e2;color:var(--red)}.badge.amber{background:#fef3c7;color:var(--amber)}.proof-status{display:flex;align-items:center;gap:15px;padding:20px;border-radius:13px;background:#f7f5ff}.proof-status strong{font-size:42px;color:var(--brand)}.proof-status span{max-width:240px}.table-wrap{overflow:auto}.wide-table{max-height:680px}table{width:100%;border-collapse:collapse;min-width:850px}th{text-align:left;color:#6b7280;font-size:11px;text-transform:uppercase;letter-spacing:.04em;padding:10px;border-bottom:1px solid var(--line);position:sticky;top:0;background:white}td{padding:11px 10px;border-bottom:1px solid #eef0f4;vertical-align:top}.empty{text-align:center;color:var(--muted);padding:30px}.nowrap{white-space:nowrap}.inline{display:inline}.alert{padding:12px 15px;border-radius:10px;margin-bottom:18px;background:#dcfce7;color:#166534}.alert.danger{background:#fee2e2;color:#991b1b}.form-panel{scroll-margin-top:90px}.form-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px}.form-grid.two{grid-template-columns:repeat(2,minmax(0,1fr))}.form-grid label,.stack-form label{display:flex;flex-direction:column;gap:6px;color:#4b5563;font-size:12px;font-weight:700}.form-grid input,.form-grid select,.form-grid textarea,.stack-form input,.quick-operation input,.quick-operation select,.three-actions select{width:100%;border:1px solid #d9dde6;border-radius:8px;padding:9px;background:white;color:var(--text);font:inherit}.form-grid textarea{min-height:80px;resize:vertical}.span-2{grid-column:span 2}.span-3{grid-column:span 3}.span-4{grid-column:span 4}.form-actions{display:flex;justify-content:flex-end}.form-end{display:flex;align-items:end}.check{flex-direction:row!important;align-items:center;margin-top:23px}.check input{width:auto}.fund-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:15px}.fund-card{border:1px solid var(--line);border-radius:14px;padding:16px;background:#fbfcfe}.sector.fiat{border-top:4px solid #2563eb}.sector.crypto{border-top:4px solid #8b5cf6}.fund-top{display:flex;justify-content:space-between}.fund-top h3{margin:7px 0}.status-dot{width:10px;height:10px;border-radius:50%;background:#22c55e}.fund-balance{font-size:25px;font-weight:800;margin:15px 0}.fund-balance small{font-size:13px;color:var(--muted)}.fund-meta{display:flex;flex-wrap:wrap;gap:8px;color:var(--muted);font-size:12px}.quick-operation{display:grid;grid-template-columns:1fr 1fr;gap:7px;margin-top:14px}.quick-operation input:nth-of-type(1){grid-column:span 1}.quick-operation button{grid-column:span 2}.positive{color:var(--green);font-weight:750}.negative{color:var(--red);font-weight:750}.hash{display:block;font-family:monospace;margin-top:5px}.narrow-panel{max-width:900px;margin-left:auto;margin-right:auto}.proof-box{border:1px dashed #bbb4ee;background:#faf9ff;border-radius:12px;padding:15px;display:grid;grid-template-columns:1fr 1fr;gap:14px}.proof-box h3,.proof-box p{grid-column:span 2;margin:0}.budget-card-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:15px}.budget-card{display:flex;justify-content:space-between;gap:20px;padding:17px;border:1px solid var(--line);border-radius:13px;text-decoration:none;color:var(--text);background:#fbfcfe}.budget-card:hover{border-color:#a69cee}.budget-card h3{margin:9px 0 3px}.budget-card p{margin:0;color:var(--muted)}.budget-card strong{font-size:20px}.explainer ol{margin:13px 0 0;padding-left:20px}.summary-row{display:flex;justify-content:space-between;padding:10px 0;border-bottom:1px solid var(--line)}.three-actions{margin-bottom:20px}.three-actions form{display:flex;gap:7px}.login-wrap{min-height:calc(100vh - 170px);display:grid;place-items:center}.login-card{width:min(420px,100%);background:white;border:1px solid var(--line);border-radius:20px;padding:35px;box-shadow:var(--shadow);text-align:center}.login-badge{width:60px;height:60px;margin:0 auto 18px;font-size:20px}.login-card h1{margin:0}.stack-form{display:grid;gap:15px;text-align:left;margin-top:25px}
@media(max-width:1100px){.kpi-grid{grid-template-columns:repeat(3,1fr)}.fund-grid{grid-template-columns:repeat(2,1fr)}.budget-card-grid{grid-template-columns:repeat(2,1fr)}.topbar{flex-wrap:wrap;padding:12px 18px}.main-nav{order:3;width:100%}.container{padding:20px}.form-grid{grid-template-columns:repeat(2,1fr)}.span-3,.span-4{grid-column:span 2}}
@media(max-width:720px){.page-head,.two-col{grid-template-columns:1fr;display:grid}.kpi-grid,.kpi-grid.compact,.fund-grid,.budget-card-grid{grid-template-columns:1fr}.form-grid,.form-grid.two{grid-template-columns:1fr}.span-2,.span-3,.span-4{grid-column:span 1}.proof-box{grid-template-columns:1fr}.proof-box h3,.proof-box p{grid-column:span 1}.container{padding:14px}.topbar{position:static}.logout-form{margin-left:0}.quick-operation{grid-template-columns:1fr}.quick-operation button{grid-column:span 1}}

/* v2 spreadsheet-style registries */
.service-table-panel{padding:16px}.spreadsheet-table-wrap{max-height:72vh;border:1px solid var(--line);border-radius:10px}.spreadsheet-table{min-width:3300px;font-size:12px;background:white}.spreadsheet-table th{background:#4389ee;color:white;top:0;z-index:3;text-transform:none;font-size:11px;letter-spacing:0;border-right:1px solid rgba(255,255,255,.25);white-space:nowrap}.spreadsheet-table td{border-right:1px solid #cbd5e1;min-width:105px;max-width:260px;white-space:pre-wrap;word-break:break-word}.spreadsheet-table tbody tr:nth-child(even){background:#eaf2ff}.spreadsheet-table tbody tr:hover{background:#fff7d6}.spreadsheet-table td:first-child,.spreadsheet-table th:first-child{position:sticky;left:0;z-index:2}.spreadsheet-table td:first-child{background:inherit;min-width:150px}.spreadsheet-table th:first-child{z-index:4;background:#3479db}.spreadsheet-table a{color:#1859c9}.number-cell{text-align:right;font-variant-numeric:tabular-nums}.notes-cell{min-width:240px;max-width:360px}.unknown-cell{background:#fff3a3!important;color:#9a3412;font-weight:800}.blocked-row{background:#ffe2e2!important}.blocked-row td:first-child{background:#ef4444!important;color:white}.warning-text{color:var(--amber);font-weight:800}.service-kpis{max-width:none}.test-table{min-width:1700px}.budget-sheet-table{min-width:1800px}.budget-total-panel{max-width:650px;margin-left:auto}.budget-total-row{display:flex;justify-content:space-between;padding:10px 4px;border-bottom:1px solid var(--line)}.budget-total-row.grand{font-size:20px;border-top:2px solid #111827;border-bottom:0}.service-budget-kpis{grid-template-columns:repeat(5,minmax(0,1fr))}.small-input{width:90px!important}.hash{max-width:230px;overflow:hidden;text-overflow:ellipsis}.form-grid small{font-weight:400}.right small{display:block;color:var(--muted);margin-top:4px}
@media(max-width:1100px){.service-budget-kpis{grid-template-columns:repeat(3,1fr)}}
@media(max-width:720px){.service-budget-kpis{grid-template-columns:1fr}.spreadsheet-table-wrap{max-height:none}}

/* v2.1 deletion actions */
.row-actions{display:flex;align-items:center;gap:6px}.row-actions form{margin:0}.fund-delete{display:flex;justify-content:flex-end;margin-top:10px;padding-top:10px;border-top:1px solid var(--line)}

/* v2.3 inline service registry */
.service-inline-table{min-width:3900px}
.service-inline-table td{vertical-align:middle}
.service-inline-table .action-column{width:64px!important;min-width:64px!important;max-width:64px!important;padding:4px!important;text-align:center;white-space:nowrap;word-break:normal}
.service-inline-table .service-name-column{min-width:165px!important;max-width:220px!important}
.service-inline-table .payment-method-column{min-width:210px!important;max-width:290px!important}
.service-inline-table th.sticky-edit-column,.service-inline-table td.sticky-edit-column{position:sticky;left:0;z-index:5}
.service-inline-table th.service-name-column,.service-inline-table td.service-name-column{position:sticky;left:64px;z-index:4}
.service-inline-table th.sticky-edit-column{background:#2f6fca}
.service-inline-table th.service-name-column{background:#3479db}
.service-inline-table td.sticky-edit-column,.service-inline-table td.service-name-column{background:inherit}
.inline-edit-actions{height:30px;display:flex;align-items:center;justify-content:center;gap:3px;flex-wrap:nowrap}
.compact-delete-form{display:flex;align-items:center;justify-content:center;margin:0;height:30px}
.table-action-button{height:27px;min-height:27px;border:1px solid #cbd5e1;border-radius:6px;background:#fff;color:#334155;padding:0 7px;font:700 10px/1 Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;display:inline-flex;align-items:center;justify-content:center;white-space:nowrap;cursor:pointer;box-shadow:none}
.table-action-button:hover{border-color:#8b7cf3;background:#f5f3ff}
.table-action-button.save-button,.table-action-button.cancel-button{display:none;width:27px;min-width:27px;padding:0;font-size:15px}
.table-action-button.save-button{background:#16a34a;border-color:#16a34a;color:#fff}
.table-action-button.cancel-button{background:#fff;border-color:#cbd5e1;color:#475569}
.table-action-button.delete-button{padding:0 6px;color:#b42318;border-color:#fecaca;background:#fff7f7;font-size:9px}
.service-data-row.is-editing .edit-button{display:none}
.service-data-row.is-editing .save-button,.service-data-row.is-editing .cancel-button{display:inline-flex}
.table-cell-editor{display:none;width:100%;min-width:92px;border:1px solid #94a3b8;border-radius:5px;background:#fff;color:#111827;padding:5px 6px;font:12px/1.3 Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;box-shadow:0 0 0 2px rgba(102,87,217,.08)}
textarea.table-cell-editor{min-height:52px;resize:vertical}
.service-data-row.is-editing .cell-view{display:none}
.service-data-row.is-editing .table-cell-editor{display:block}
.service-data-row.is-editing{background:#fff7d6!important}
.service-data-row.is-editing td.sticky-edit-column,.service-data-row.is-editing td.service-name-column{background:#fff7d6!important}
.number-editor{text-align:right;min-width:86px}
.date-editor{min-width:128px}
.payment-method-editor{min-width:205px}
.payment-method-link{font-weight:750;text-decoration:underline;text-underline-offset:2px}
.payment-method-link::after{content:" ↗";font-size:10px}
.blocked-row td.sticky-edit-column{background:#ffe2e2!important;color:inherit!important}
.blocked-row td.service-name-column{background:#ef4444!important;color:white}
@media(max-width:720px){.inline-edit-actions,.compact-delete-form{height:28px}.table-action-button{height:25px;min-height:25px}}

/* v2.4 inline tests registry */
.test-table-panel{padding:16px}
.test-inline-table{min-width:2700px}
.test-inline-table td{vertical-align:middle}
.test-inline-table .action-column{width:64px!important;min-width:64px!important;max-width:64px!important;padding:4px!important;text-align:center;white-space:nowrap;word-break:normal}
.test-inline-table th.sticky-test-edit-column,.test-inline-table td.sticky-test-edit-column{position:sticky;left:0;z-index:5}
.test-inline-table th.sticky-test-edit-column{background:#2f6fca}
.test-inline-table td.sticky-test-edit-column{background:inherit}
.test-inline-table .test-description-column{min-width:260px!important;max-width:380px!important}
.test-inline-table .test-payment-method-column{min-width:210px!important;max-width:290px!important}
.test-inline-table .test-proof-column{min-width:260px!important;max-width:360px!important}
.test-inline-table .test-notes-column{min-width:220px!important;max-width:340px!important}
.test-data-row.is-editing .edit-button{display:none}
.test-data-row.is-editing .save-button,.test-data-row.is-editing .cancel-button{display:inline-flex}
.test-data-row.is-editing .cell-view{display:none}
.test-data-row.is-editing .table-cell-editor{display:block}
.test-data-row.is-editing{background:#fff7d6!important}
.test-data-row.is-editing td.sticky-test-edit-column{background:#fff7d6!important}
.test-proof-editor{min-width:250px;padding:6px;background:#fff;border:1px solid #94a3b8;border-radius:6px}
.test-proof-editor select,.test-proof-editor input{display:block;width:100%;margin:0 0 5px;border:1px solid #cbd5e1;border-radius:5px;padding:5px;font:11px/1.3 Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}
.test-proof-editor small{display:block;margin-top:4px}

/* v2.5 compact spreadsheet rows — prevent a small registry from stretching body rows */
.spreadsheet-table-wrap{
  height:auto!important;
  min-height:0!important;
}
.spreadsheet-table{
  height:auto!important;
  min-height:0!important;
  table-layout:auto;
}
.spreadsheet-table thead,
.spreadsheet-table tbody{
  height:auto!important;
}
.spreadsheet-table thead tr{
  height:36px!important;
}
.spreadsheet-table tbody tr{
  height:1px!important;
  min-height:0!important;
}
.spreadsheet-table th{
  height:36px!important;
  padding:7px 10px!important;
  line-height:1.2!important;
  vertical-align:middle!important;
}
.service-inline-table tbody td,
.test-inline-table tbody td{
  height:auto!important;
  min-height:0!important;
  padding:7px 10px!important;
  line-height:1.3!important;
  vertical-align:top!important;
  font-weight:400;
}
.service-inline-table tbody td.action-column,
.test-inline-table tbody td.action-column{
  padding:5px 4px!important;
  vertical-align:top!important;
}
.service-inline-table .cell-view,
.test-inline-table .cell-view{
  display:block;
  min-height:0!important;
  margin:0!important;
  line-height:1.3!important;
}
.service-inline-table .service-name-column .cell-view,
.service-inline-table .payment-method-link,
.test-inline-table .payment-method-link{
  font-weight:600;
}
.inline-edit-actions,
.compact-delete-form{
  height:27px!important;
  min-height:27px!important;
  margin:0!important;
}
.table-action-button{
  margin:0!important;
  line-height:1!important;
}

/* v2.6 compact registries + inline create/AJAX updates */
.spreadsheet-table-wrap{
  display:block!important;
  height:auto!important;
  min-height:0!important;
  max-height:72vh;
  overflow:auto!important;
  align-items:flex-start!important;
}
.spreadsheet-table{
  display:table!important;
  height:1px!important;
  min-height:0!important;
  table-layout:fixed!important;
  margin:0!important;
}
.spreadsheet-table thead{display:table-header-group!important;height:auto!important}
.spreadsheet-table tbody{display:table-row-group!important;height:auto!important;min-height:0!important}
.spreadsheet-table thead tr{display:table-row!important;height:34px!important}
.spreadsheet-table tbody tr{display:table-row!important;height:40px!important;min-height:40px!important;max-height:40px!important}
.service-inline-table tbody td,
.test-inline-table tbody td{
  height:40px!important;
  min-height:40px!important;
  max-height:40px!important;
  padding:4px 8px!important;
  line-height:16px!important;
  vertical-align:middle!important;
  overflow:hidden!important;
}
.service-inline-table tbody td.action-column,
.test-inline-table tbody td.action-column{
  height:40px!important;
  min-height:40px!important;
  max-height:40px!important;
  padding:4px!important;
  vertical-align:middle!important;
}
.service-inline-table .cell-view,
.test-inline-table .cell-view{
  display:-webkit-box!important;
  -webkit-box-orient:vertical;
  -webkit-line-clamp:2;
  max-height:32px!important;
  min-height:0!important;
  overflow:hidden!important;
  line-height:16px!important;
  margin:0!important;
  white-space:normal!important;
}
.service-inline-table .cell-view a,
.test-inline-table .cell-view a{
  display:inline;
}
.service-data-row.is-editing,
.test-data-row.is-editing{
  height:auto!important;
  min-height:48px!important;
  max-height:none!important;
}
.service-data-row.is-editing td,
.test-data-row.is-editing td{
  height:auto!important;
  min-height:48px!important;
  max-height:none!important;
  overflow:visible!important;
  vertical-align:top!important;
}
.inline-edit-actions,.compact-delete-form{
  height:28px!important;
  min-height:28px!important;
  align-items:center!important;
}
.table-action-button{
  height:26px!important;
  min-height:26px!important;
  padding:0 6px!important;
}
.service-add-row{
  height:42px!important;
  min-height:42px!important;
  max-height:42px!important;
  background:#eef8ee!important;
}
.service-add-row td{
  height:42px!important;
  min-height:42px!important;
  max-height:42px!important;
  padding:4px 6px!important;
  vertical-align:middle!important;
  overflow:hidden!important;
  border-top:2px solid #86c98a;
}
.service-add-row td.sticky-edit-column,
.service-add-row td.service-name-column{background:#eef8ee!important}
.table-add-editor{
  display:block;
  width:100%;
  height:28px;
  min-width:85px;
  margin:0;
  border:1px solid #b8c5d6;
  border-radius:5px;
  background:#fff;
  color:#111827;
  padding:3px 6px;
  font:11px/1.2 Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
}
textarea.table-add-editor.compact-textarea{
  height:28px!important;
  min-height:28px!important;
  resize:none;
  overflow:hidden;
}
.table-action-button.add-button{
  width:58px;
  background:#16833b;
  border-color:#16833b;
  color:#fff;
  font-size:9px;
}
.table-action-button:disabled,.table-add-editor:disabled,.table-cell-editor:disabled{
  cursor:wait;
  opacity:.65;
}
.table-notice{
  display:none;
  margin:0 0 12px;
  padding:9px 12px;
  border-radius:8px;
  font-size:12px;
  font-weight:650;
}
.table-notice.is-visible{display:block;background:#dcfce7;color:#166534}
.table-notice.is-visible.danger{background:#fee2e2;color:#991b1b}
/* Critical row-height fix: collapse template indentation outside .cell-view. */
.service-inline-table tbody td,
.test-inline-table tbody td{
  white-space:normal!important;
}
