
:root{--nav:#102f70;--blue:#123c7a;--orange:#ff7b19;--bg:#f4f7fb;--line:#dbe4ee;--text:#172033;--muted:#64748b}
*{box-sizing:border-box}body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;background:var(--bg);color:var(--text)}
button,input,textarea{font:inherit}.hidden{display:none!important}
.login-brand{display:block;width:100%;height:auto;margin-bottom:20px}.brand-icon{width:44px;height:44px;object-fit:contain;background:white;border-radius:8px;flex-shrink:0}.login-card{border-top:4px solid var(--orange)!important}.nav.active{box-shadow:inset 3px 0 0 var(--orange)!important}
.comment-cell{min-width:324px;width:324px;white-space:normal;vertical-align:top}.comment-edit{display:block;width:300px;max-width:100%;min-height:80px;max-height:180px;padding:10px 12px;border:1px solid #cfd8e3;border-radius:8px;line-height:1.45;font-size:16px;white-space:pre-wrap;overflow-wrap:anywhere;resize:vertical;overflow-y:auto}.comment-edit:focus,input.edit:focus{outline:2px solid var(--blue);outline-offset:2px}input.edit{font-size:16px;min-height:44px!important}
.login-shell{min-height:100vh;display:grid;place-items:center;padding:24px;background:linear-gradient(145deg,#eef4ff,#f8fafc)}
.login-card{width:min(440px,100%);background:white;padding:30px;border:1px solid var(--line);border-radius:20px;box-shadow:0 14px 40px #0f172a14}
.brand{display:flex;gap:12px;align-items:center}.brand small{display:block;color:#94a3b8;margin-top:3px}
.logo{width:48px;height:48px;display:grid;place-items:center;background:linear-gradient(135deg,var(--nav),var(--blue));color:white;border-radius:13px;font-weight:800}.logo.small{width:40px;height:40px}
.login-card input{width:100%;height:48px;margin:7px 0;border:1px solid var(--line);border-radius:10px;padding:0 12px}.login-card button{width:100%;height:46px;border:0;border-radius:10px;background:var(--blue);color:white;font-weight:700;margin-top:8px}.login-card .secondary{background:#eaf0ff;color:#0f4bd8}
.app{min-height:100vh;display:grid;grid-template-columns:280px 1fr}aside{background:var(--nav);color:white;padding:20px 16px;display:flex;flex-direction:column;gap:26px;min-height:100vh}nav{display:grid;gap:8px}.nav{border:0;background:transparent;color:#cbd5e1;text-align:left;padding:12px;border-radius:10px;min-height:46px}.nav.active{background:#165dff33;color:white;box-shadow:inset 3px 0 0 var(--blue)}.userbox{margin-top:auto;border-top:1px solid #ffffff18;padding-top:16px;display:grid;gap:8px}.userbox button{border:0;background:transparent;color:#cbd5e1;text-align:left}
main{min-width:0;padding:26px}header{display:flex;justify-content:space-between;gap:20px}.eyebrow{font-size:12px;color:var(--blue);font-weight:800;letter-spacing:.1em}h2{margin:5px 0}header p{margin:0;color:var(--muted)}.head-actions{display:flex;gap:8px;align-items:start}.badge{background:#fff7ed;color:#9a5b00;border:1px solid #fed7aa;border-radius:999px;padding:8px 10px;font-size:11px;font-weight:800}#menuBtn{display:none}
.cards{display:grid;grid-template-columns:repeat(4,1fr);gap:14px;margin:18px 0}.cards article{background:white;border:1px solid var(--line);border-radius:14px;padding:16px}.cards span{display:block;color:var(--muted);font-size:12px;font-weight:700}.cards strong{display:block;margin-top:8px;font-size:22px}
.panel{background:white;border:1px solid var(--line);border-radius:14px;overflow:hidden}.toolbar{display:flex;justify-content:space-between;gap:10px;padding:14px;background:#f8fafc;border-bottom:1px solid var(--line)}.toolbar input{min-height:44px;width:min(360px,70vw);border:1px solid var(--line);border-radius:10px;padding:0 12px}.toolbar button{min-height:44px;border:0;border-radius:10px;background:var(--blue);color:white;font-weight:700;padding:0 18px}
.table-wrap{overflow:auto;max-height:calc(100vh - 310px);-webkit-overflow-scrolling:touch}table{width:100%;min-width:980px;border-collapse:separate;border-spacing:0;font-size:13px}th,td{white-space:nowrap;padding:11px 12px;border-bottom:1px solid #edf2f7;background:white;text-align:left}th{position:sticky;top:0;z-index:4;background:#f8fafc;color:#475569}.sticky1{position:sticky;left:0;z-index:3;min-width:180px}.sticky2{position:sticky;left:180px;z-index:3;min-width:300px}th.sticky1,th.sticky2{z-index:6;background:#f8fafc}input.edit{min-height:36px;border:1px solid #cfd8e3;border-radius:8px;padding:0 8px}.status{display:inline-block;padding:6px 9px;border-radius:999px;font-weight:800;font-size:11px}.good{background:#ecfdf5;color:#087f5b}.watch{background:#fff7ed;color:#a85d00}.risk{background:#fef2f2;color:#b42318}
.table-wrap{overflow-x:scroll;scrollbar-gutter:stable}
.toast{position:fixed;right:20px;bottom:20px;background:var(--nav);color:white;padding:12px 16px;border-radius:10px}
#saveStatus{align-self:center;font-size:13px;white-space:normal;max-width:420px}.toolbar{flex-wrap:wrap}.toolbar button:disabled{opacity:.6}
.adjustable-table{table-layout:fixed;min-width:0}.adjustable-table th,.adjustable-table td{min-width:0;width:auto;max-width:none;white-space:normal;overflow-wrap:anywhere;vertical-align:top}.adjustable-table .comment-cell{min-width:0;width:auto}.adjustable-table .edit,.adjustable-table .comment-edit{width:100%;max-width:100%;min-width:0;min-height:44px;padding:8px;font-size:16px;line-height:24px}.adjustable-table .comment-edit{height:44px;resize:none;max-height:180px}.column-head{display:flex;gap:3px;align-items:flex-start}.sort-btn{flex:1;min-width:0;border:0;background:transparent;text-align:left;min-height:44px;padding:4px;font-weight:700;white-space:normal;color:inherit}.column-menu summary{cursor:pointer;list-style:none;min-width:32px;min-height:44px;display:grid;place-items:center}.column-menu summary::-webkit-details-marker{display:none}.column-options{position:absolute;top:100%;right:0;width:250px;padding:14px;background:white;border:1px solid var(--line);border-radius:10px;box-shadow:0 8px 24px #102f7020;z-index:12}.column-options label{display:block;font-size:13px;margin:8px 0}.column-options input{display:block;width:100%;min-height:44px;padding:8px;border:1px solid var(--line);border-radius:6px;font-size:16px}.column-options button{min-height:44px;margin:3px;border:1px solid var(--line);border-radius:6px;background:#f4f7fb;padding:8px}.resize-handle{position:absolute;top:0;right:-4px;width:12px;height:100%;cursor:col-resize;touch-action:none;z-index:15;border-right:2px solid #ccd7e8}.adjustable-table th:has(details[open]){z-index:18}.collapse-btn{min-height:44px;background:#ffffff14;color:white;border:1px solid #ffffff30;border-radius:8px;padding:8px}.toolbar .secondary-action{background:#eaf0ff;color:var(--blue)}
@media(min-width:901px){.app.sidebar-collapsed{grid-template-columns:76px 1fr}.sidebar-collapsed aside{padding:16px 8px}.sidebar-collapsed aside .brand,.sidebar-collapsed aside nav,.sidebar-collapsed aside .userbox{display:none}.sidebar-collapsed .collapse-btn{font-size:0}.sidebar-collapsed .collapse-btn:after{content:'☰';font-size:22px}}
.column-options{position:fixed;right:auto;top:auto;overflow:auto;z-index:100}.workflow-nav{border:1px solid #ffffff25;background:transparent;color:#e5edff;min-height:46px;text-align:left;border-radius:10px;padding:12px}.calculation-note{font-size:13px;color:var(--muted);line-height:1.6}.approval-label{display:flex;gap:8px;align-items:center;min-height:44px}.approval-label input{width:24px;height:24px}.adjustable-table input:disabled,.adjustable-table textarea:disabled{background:#f1f5f9;color:#475569;opacity:1}.workflow-dialog{width:min(900px,calc(100vw - 24px));max-height:calc(100dvh - 30px);border:1px solid var(--line);border-radius:16px;padding:20px;color:var(--text);background:white}.workflow-dialog::backdrop{background:#102f7080}.workflow-dialog header{align-items:center}.workflow-dialog button{min-height:44px;background:var(--blue);color:white;border:0;border-radius:8px;padding:9px 14px;cursor:pointer}.workflow-dialog button:disabled{opacity:.5;cursor:default}.workflow-dialog .close-dialog{background:#eef2f8;color:var(--text)}.workflow-body{margin-top:18px}.workflow-form{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;margin:18px 0}.workflow-form label{display:block;font-size:14px}.workflow-form input,.workflow-form select,.workflow-form textarea{display:block;width:100%;min-height:44px;padding:10px;border:1px solid var(--line);border-radius:8px;font-size:16px;margin-top:5px}.workflow-form .checkbox-field{grid-column:1/-1;display:flex;align-items:center;gap:12px}.checkbox-field input{width:24px;height:24px;min-height:24px;flex-shrink:0}.workflow-list{display:grid;gap:12px}.workflow-list article{border:1px solid var(--line);border-radius:10px;padding:16px}.workflow-list p{line-height:1.6}.workflow-list pre{white-space:pre-wrap;overflow-wrap:anywhere;max-height:300px;overflow:auto;font-size:12px}.workflow-status{color:#a44412;line-height:1.6}.workflow-dialog dl{display:grid;grid-template-columns:180px 1fr;gap:8px}.workflow-dialog dd{margin:0}.decision-actions{display:flex;gap:12px;margin:18px 0;flex-wrap:wrap}.import-note{padding:12px;background:#fff7ed;border:1px solid #fed7aa;border-radius:8px}
@media(max-width:600px){.workflow-form{grid-template-columns:1fr}.workflow-dialog{padding:14px}.workflow-dialog dl{grid-template-columns:1fr}.workflow-dialog dd{margin-bottom:10px}}
@media(max-width:900px){.app{grid-template-columns:1fr}aside{position:fixed;z-index:20;width:min(86vw,320px);transform:translateX(-102%);transition:.2s}aside.open{transform:translateX(0)}#menuBtn{display:block;min-width:44px;min-height:44px}.cards{grid-template-columns:repeat(2,1fr)}main{padding:18px}}
@media(max-width:560px){.cards{grid-template-columns:1fr}.toolbar{flex-direction:column}.toolbar input,.toolbar button{width:100%}}
.table-wrap::-webkit-scrollbar{width:14px;height:14px}.table-wrap::-webkit-scrollbar-track{background:#edf2f7}.table-wrap::-webkit-scrollbar-thumb{background:#8298b8;border:3px solid #edf2f7;border-radius:8px}.table-wrap::-webkit-scrollbar-thumb:hover{background:#496b9b}
.refresh-status{margin:0;padding:8px 16px;color:#64748b;font-size:13px;overflow-wrap:anywhere}
#refreshBtn{min-height:44px;white-space:nowrap}
#app[aria-busy="true"] .panel{pointer-events:none}
.column-total{display:block;min-height:24px;margin:0 0 6px;padding:3px 5px;background:#e8effb;color:#244a7d;border-radius:5px;font-size:12px;font-weight:600;line-height:1.4;overflow-wrap:anywhere;max-width:100%;text-align:right}
.column-total:empty{background:transparent}
.forecast-gate{display:flex;flex-wrap:wrap;gap:10px 20px;align-items:center;margin:8px 0 16px;color:#526780;font-size:13px}
.forecast-gate label{display:flex;gap:8px;align-items:center;font-weight:600}
.forecast-gate input[type="checkbox"]{width:22px;height:22px}
.export-actions{display:flex;gap:12px;flex-wrap:wrap}
.export-actions button{min-height:44px}
.app{height:100dvh;min-height:0;grid-template-columns:240px minmax(0,1fr)}
#sidebar{height:100dvh;min-height:0;overflow-y:auto;padding:14px 12px;gap:16px}
#sidebar .nav,#sidebar .workflow-nav{padding:9px 10px;min-height:38px;font-size:13px}
#sidebar nav{gap:5px}
#sidebar .collapse-btn{min-height:34px;padding:5px 8px}
#sidebar .userbox{padding-top:10px;font-size:13px}
main{height:100dvh;min-height:0;display:flex;flex-direction:column;overflow:hidden;padding:14px 18px;gap:0}
main>header{flex:none;gap:12px;align-items:center}
main>header h2{font-size:23px;margin:3px 0;line-height:1.2}
main>header p{font-size:12px;line-height:1.3}
.eyebrow{font-size:10px}
.head-actions{align-items:center;flex-wrap:wrap;justify-content:flex-end}
.badge{padding:5px 8px}
.period-badge{font-size:11px;line-height:1.3;padding:4px 7px;background:#eaf5ee;color:#326348;border-radius:5px;white-space:nowrap}
.period-closed{background:#fff0dc;color:#85550e}
.cards{flex:none;gap:8px;margin:10px 0;grid-template-columns:repeat(4,minmax(0,1fr))}
.cards article{padding:7px 12px;border-radius:8px;min-width:0}
.cards span{font-size:10px;line-height:1.3}
.cards strong{font-size:19px;line-height:1.25;margin-top:3px;overflow-wrap:anywhere}
.panel{flex:1;min-height:0;display:flex;flex-direction:column;border-radius:10px}
.toolbar{flex:none;justify-content:flex-start;align-items:center;flex-wrap:nowrap;padding:7px 9px;gap:7px}
.toolbar input{min-height:34px;height:34px;flex:0 1 230px;width:230px;min-width:100px;font-size:13px;padding:0 9px;border-radius:7px}
.toolbar button,#refreshBtn{min-height:34px;font-size:12px;padding:0 11px;border-radius:7px;white-space:nowrap;flex:none}
#saveStatus{margin-left:auto;max-width:28%;font-size:11px;line-height:1.35}
.table-wrap{flex:1;min-height:0;max-height:none;overflow:auto;scrollbar-gutter:stable}
.adjustable-table th,.adjustable-table td{padding:6px 9px;line-height:1.35}
.sort-btn{min-height:32px;padding:2px;font-size:12px;line-height:1.25}
.column-menu summary{min-height:32px;min-width:26px}
.column-total{min-height:19px;margin-bottom:4px;padding:2px 4px;font-size:11px;line-height:1.3}
.adjustable-table .edit,.adjustable-table .comment-edit{min-height:34px;padding:5px 7px;font-size:14px;line-height:20px}
.adjustable-table input.edit{min-height:34px!important;height:34px}
.adjustable-table .comment-edit{height:34px}
.approval-label{min-height:34px;font-size:12px}
.approval-label input{width:20px;height:20px}
.table-footer{flex:none;padding-top:5px;color:var(--muted);font-size:11px;line-height:1.3}
.table-footer .refresh-status{padding:0;margin:0 0 3px;font-size:10px}
.table-footer .calculation-note{margin:2px 0;font-size:11px;line-height:1.35}
.table-footer .forecast-gate{margin:4px 0 0;gap:5px 14px;font-size:11px;line-height:1.35}
.table-footer .forecast-gate input[type="checkbox"]{width:18px;height:18px}
.table-footer .forecast-gate label{gap:6px}
@media(max-width:900px){.app{grid-template-columns:minmax(0,1fr)}main{padding:12px}.cards{grid-template-columns:repeat(4,minmax(0,1fr))}.cards article{padding:7px}.cards strong{font-size:17px}}
@media(pointer:coarse){.toolbar button,#refreshBtn,.toolbar input{min-height:44px;height:44px}.sort-btn,.column-menu summary{min-height:44px}.column-menu summary{min-width:32px}.adjustable-table input.edit{min-height:44px!important;height:44px}.adjustable-table .comment-edit{min-height:44px;font-size:16px;line-height:24px}.approval-label{min-height:44px}.approval-label input{width:24px;height:24px}#sidebar .nav,#sidebar .workflow-nav,#sidebar .collapse-btn{min-height:44px}.forecast-gate label{min-height:44px}}
@media(max-width:620px){main>header h2{font-size:19px}.head-actions{max-width:150px}.cards{grid-template-columns:repeat(2,minmax(0,1fr))}.toolbar{flex-direction:row;flex-wrap:wrap}.toolbar input{flex:1 0 100%;width:100%}.toolbar button{width:auto;flex:1;padding:0 7px}#saveStatus{flex:1 0 100%;max-width:100%;margin-left:0}.table-footer .forecast-gate{display:block}.table-footer .forecast-gate label{margin-bottom:3px}.table-footer .calculation-note{font-size:10px}}
@media(max-height:540px){main{height:auto;min-height:100dvh;overflow:visible}.app{height:auto;min-height:100dvh}.panel{flex:none}.table-wrap{height:60dvh;min-height:180px}}
@media(pointer:coarse){.adjustable-table .edit{font-size:16px}}
#sidebar .brand b{font-size:13px;line-height:1.3}
#sidebar .brand small{font-size:11px}
.year-navigation{border:1px solid #ffffff26;border-radius:9px;overflow:hidden}
.year-navigation>summary{padding:10px;cursor:pointer;font-size:13px;font-weight:700;background:#ffffff0a;min-height:38px}
.year-views{display:grid;gap:3px;padding:4px}
.category-tabs{flex:none;display:flex;gap:5px;overflow-x:auto;padding:5px 9px;border-bottom:1px solid var(--line);background:#f8fafc}
.category-tabs button{flex:none;min-height:32px;padding:5px 10px;font-size:11px;font-weight:700;border:1px solid var(--line);border-radius:6px;background:white;color:var(--blue);cursor:pointer}
.category-tabs button[aria-selected="true"]{background:var(--blue);border-color:var(--blue);color:white}
.category-tabs button:focus-visible{outline:2px solid var(--orange);outline-offset:1px}
.column-chooser-anchor{position:relative;display:flex;align-items:center;gap:10px;margin-bottom:3px}
#columnsBtn,.columns-panel button{min-height:28px;padding:4px 9px;border:1px solid #c8d6e9;border-radius:6px;background:#eaf0ff;color:var(--blue);font-size:11px;cursor:pointer}
#columnVisibilityStatus{font-size:10px}
.columns-panel{position:absolute;bottom:calc(100% + 6px);left:0;width:min(520px,calc(100vw - 48px));max-height:min(400px,55dvh);overflow:auto;padding:12px;background:white;border:1px solid var(--line);border-radius:10px;box-shadow:0 6px 24px #102f7030;z-index:30}
.columns-panel-head{display:flex;gap:8px;align-items:center;margin-bottom:8px;font-size:13px}
.columns-panel-head b{margin-right:auto}
.column-choices{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:4px 10px}
.column-choices label{display:flex;gap:8px;align-items:center;min-height:32px;padding:3px;font-size:12px;cursor:pointer}
.column-choices input{width:18px;height:18px;flex:none}
.table-empty{padding:16px;line-height:1.5;color:var(--muted)}
@media(pointer:coarse){.category-tabs button,#columnsBtn,.columns-panel button,.year-navigation>summary,.column-choices label{min-height:44px}.column-choices input{width:24px;height:24px}}
@media(max-width:480px){.column-choices{grid-template-columns:1fr}}
