:root{--bg:#0d1117;--panel:#111827;--panel2:#151c2a;--line:#263244;--text:#f8fafc;--muted:#94a3b8;--blue:#4f8cff;--green:#6ee7b7;--red:#ff5c7a;--yellow:#facc15}*{box-sizing:border-box}body{background:var(--bg);color:var(--text);margin:0;font-family:Inter,Arial,Helvetica,sans-serif}button,input{font:inherit}button{border:1px solid var(--line);color:var(--text);cursor:pointer;background:#0b1220;border-radius:12px;padding:10px 14px}button:hover{border-color:var(--blue)}button:disabled{opacity:.45;cursor:not-allowed}input{width:100%;min-height:46px;color:var(--text);border:1px solid var(--line);background:#080d16;border-radius:12px;padding:10px 12px}input:focus{border-color:var(--blue);outline:none;box-shadow:0 0 0 3px #4f8cff2e}label{color:#cbd5e1;margin-bottom:6px;font-size:13px;display:block}h1,h2,h3,p{margin-top:0}.primary{background:linear-gradient(135deg, var(--blue), var(--green));color:#061018;border:0;font-weight:800}.ghost{background:0 0}.danger{color:#ffd6dd;border-color:#ff5c7a80}.error{color:#ffd6dd;background:#ff5c7a1f;border:1px solid #ff5c7a73;border-radius:12px;padding:12px}.login-page{background:radial-gradient(circle at 15% 15%,#4f8cff40,#0000 30%),radial-gradient(circle at 85% 15%,#6ee7b729,#0000 28%),linear-gradient(135deg,#080d16,#0d1117);place-items:center;min-height:100vh;padding:24px;display:grid}.login-card{border:1px solid var(--line);background:#111827e0;border-radius:28px;width:min(460px,100%);padding:30px;box-shadow:0 30px 80px #00000073}.login-brand{align-items:center;gap:14px;margin-bottom:22px;display:flex}.brand-mark{background:linear-gradient(135deg, var(--blue), var(--green));color:#061018;border-radius:18px;place-items:center;width:56px;height:56px;font-size:28px;font-weight:900;display:grid}.login-brand h1{margin-bottom:4px}.login-brand p,.auth-form p{color:var(--muted)}.security-chip{background:#4f8cff1f;border:1px solid #4f8cff47;border-radius:16px;justify-content:space-between;gap:12px;margin-bottom:22px;padding:12px;display:flex}.auth-form{gap:12px;display:grid}.code-input{text-align:center;letter-spacing:8px;font-size:24px;font-weight:900}.app-shell{max-width:1680px;margin:0 auto;padding:18px}.app-header{border:1px solid var(--line);background:var(--panel);border-radius:22px;justify-content:space-between;align-items:center;gap:16px;margin-bottom:18px;padding:22px;display:flex}.app-header h1{margin-bottom:6px}.app-header p{color:var(--muted);margin-bottom:0}.layout{grid-template-columns:360px minmax(0,1fr);gap:18px;display:grid}.sidebar{align-content:start;gap:14px;display:grid}.card,.content{border:1px solid var(--line);background:var(--panel);border-radius:22px;padding:18px}.card h2{margin-bottom:14px}.form-grid,.edit-grid{gap:12px;display:grid}.edit-grid{grid-template-columns:repeat(3,minmax(0,1fr));align-items:end}.save-button{grid-column:1/-1}.search-row{grid-template-columns:1fr auto;gap:8px;display:grid}.estate-list{gap:8px;max-height:45vh;display:grid;overflow:auto}.estate{text-align:left;gap:3px;width:100%;display:grid}.estate span{color:var(--muted);font-size:13px}.estate.active{border-color:var(--blue);background:#1d3557}.case-title{margin-bottom:16px}.case-title h2{margin-bottom:6px}.case-title p{color:var(--muted)}.date-field{position:relative}.date-field input{padding-right:54px}.calendar-button{border:1px solid var(--line);cursor:pointer;background:#101827;border-radius:10px;place-items:center;width:36px;height:34px;margin:0;display:grid;position:absolute;top:6px;right:6px;overflow:hidden}.calendar-button span{pointer-events:none}.calendar-button input{opacity:0;cursor:pointer;position:absolute;inset:0}.upload-row{grid-template-columns:1fr 220px;gap:12px;margin-bottom:18px;display:grid}.file-box{border:1px dashed var(--line);cursor:pointer;background:#080d16;border-radius:14px;align-items:center;min-height:50px;padding:0 14px;display:flex}.file-box input{display:none}.file-box span{color:var(--muted)}.table-wrap{overflow-x:auto}table{border-collapse:collapse;width:100%;font-size:14px}th,td{border-bottom:1px solid var(--line);text-align:left;vertical-align:middle;padding:12px 10px}th{color:#cbd5e1;background:var(--panel2)}.status{color:#fde68a;background:#facc1526;border-radius:999px;padding:5px 9px;font-size:13px;display:inline-flex}.actions{flex-wrap:wrap;gap:8px;display:flex}.empty{color:var(--muted);text-align:center;padding:48px 20px}.empty.small{padding:20px}@media (width<=1100px){.layout{grid-template-columns:1fr}.estate-list{max-height:none}.edit-grid,.upload-row{grid-template-columns:1fr}}@media (width<=640px){.app-shell{padding:10px}.app-header{flex-direction:column;align-items:stretch}.card,.content,.app-header{border-radius:16px;padding:14px}.search-row{grid-template-columns:1fr}.actions{flex-direction:column}.actions button{width:100%}}.text-modal{z-index:1000;background:#000000b8;place-items:center;padding:20px;display:grid;position:fixed;inset:0}.text-modal-card{border:1px solid var(--line);background:var(--panel);border-radius:22px;grid-template-rows:auto 1fr;width:min(1100px,96vw);max-height:90vh;display:grid;overflow:hidden}.text-modal-head{border-bottom:1px solid var(--line);justify-content:space-between;gap:16px;padding:16px;display:flex}.text-modal-head p{color:var(--muted);margin:0}.text-modal-card pre{white-space:pre-wrap;color:#e5e7eb;background:#080d16;margin:0;padding:18px;font-family:Consolas,monospace;font-size:13px;line-height:1.55;overflow:auto}.ai-result{background:#080d16;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;padding:18px;display:grid;overflow:auto}.ai-result section{border:1px solid var(--line);background:var(--panel);border-radius:16px;padding:14px}.ai-result h3{color:var(--green);margin-bottom:10px}.ai-result p{color:#e5e7eb;margin:6px 0}.ai-row{border-bottom:1px solid var(--line);gap:4px;padding:10px;display:grid}.ai-row:last-child{border-bottom:0}.ai-row span{color:var(--muted)}.ai-summary{grid-column:1/-1}@media (width<=900px){.ai-result{grid-template-columns:1fr}}.section-head{justify-content:space-between;align-items:center;gap:12px;margin-bottom:14px;display:flex}@media (width<=700px){.section-head{flex-direction:column;align-items:stretch}}.case-title{justify-content:space-between;align-items:flex-start;gap:16px;display:flex}.ai-edit-layout{grid-template-columns:1fr;gap:16px;display:grid;overflow:auto}.ai-json-editor{border:1px solid var(--line);background:var(--panel);border-radius:16px;padding:14px}.ai-json-editor textarea{resize:vertical;color:#e5e7eb;border:1px solid var(--line);background:#080d16;border-radius:12px;width:100%;min-height:360px;padding:12px;font-family:Consolas,monospace;font-size:13px;line-height:1.5}.ai-json-editor button{margin-top:12px}@media (width<=800px){.case-title{flex-direction:column}}@media (width<=900px){.ai-field-grid{grid-template-columns:1fr}}.ai-edit-section-head{justify-content:space-between;align-items:center;gap:12px;margin-bottom:12px;display:flex}.ai-field-grid{grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;display:grid}@media (width<=900px){.ai-field-grid{grid-template-columns:1fr}}.case-actions{flex-wrap:wrap;gap:10px;display:flex}.draft-modal-card{width:min(1100px,96vw);height:92vh}.draft-toolbar{border-bottom:1px solid var(--line);background:var(--panel);grid-template-columns:1fr auto auto;gap:10px;padding:14px;display:grid}.draft-editor{color:#111827;resize:none;background:#fff;border:1px solid #d1d5db;border-radius:4px;width:calc(100% - 40px);min-height:calc(92vh - 190px);margin:20px;padding:38px 46px;font-family:Times New Roman,Times,serif;font-size:12pt;line-height:1.55;box-shadow:0 18px 50px #00000059}@media (width<=800px){.draft-toolbar{grid-template-columns:1fr}.draft-editor{width:calc(100% - 20px);margin:10px;padding:22px}}.word-editor-shell{grid-template-rows:auto auto 1fr;height:100%;display:grid;overflow:hidden}.word-toolbar{border-bottom:1px solid var(--line);background:#0f172a;flex-wrap:wrap;gap:6px;padding:10px 14px;display:flex}.word-toolbar button{min-width:42px;padding:8px 10px}.word-page{color:#111827;background:#fff;border:1px solid #d1d5db;width:min(850px,100% - 30px);min-height:1100px;margin:18px auto;padding:46px 58px;font-family:Times New Roman,Times,serif;font-size:12pt;line-height:1.55;overflow:auto;box-shadow:0 18px 50px #00000059}.word-page h1{text-align:center;color:#111827;font-size:18pt}.word-page h2{color:#111827;margin-top:22px;font-size:13pt}.word-page h3{color:#111827;margin-top:16px;font-size:12pt}.word-page p{color:#111827}.word-page table{border-collapse:collapse;color:#111827;width:100%;margin:10px 0 16px}.word-page th,.word-page td{color:#111827;vertical-align:top;border:1px solid #374151;padding:6px 8px}.word-page th{background:#f3f4f6;font-weight:700}.ai-editor-shell{border:1px solid var(--line);background:var(--panel);border-radius:16px;grid-column:1/-1;padding:14px}.ai-edit-section-head{justify-content:space-between;align-items:center;display:flex}.draft-modal-card{grid-template-rows:auto 1fr;width:min(1200px,96vw);height:92vh;max-height:92vh;display:grid;overflow:hidden}.word-editor-shell{height:100%;min-height:0;overflow:hidden}.ai-editor-shell{border:1px solid var(--line);background:var(--panel);border-radius:16px;grid-column:1/-1;margin-top:14px;padding:14px}.ai-editor{gap:16px;margin-top:14px;display:grid}.ai-edit-section{border:1px solid var(--line);background:#080d16;border-radius:16px;padding:14px}.ai-edit-section-head{justify-content:space-between;align-items:center;gap:12px;display:flex}.ai-edit-table input{min-width:160px}@media print{body *{visibility:hidden!important}.word-page,.word-page *{visibility:visible!important}.word-page{position:absolute;top:0;left:0;width:210mm!important;min-height:297mm!important;box-shadow:none!important;border:0!important;margin:0!important;padding:18mm 20mm!important;overflow:visible!important}.word-toolbar,.draft-toolbar,.text-modal-head{display:none!important}@page{size:A4;margin:0}}.ai-editor-shell{max-height:70vh;overflow-y:auto}.ai-table-scroll{width:100%;overflow:auto visible}.ai-edit-table{min-width:900px}.ai-edit-table input{width:100%;min-width:150px}.text-modal-card{max-height:92vh;overflow:auto}.draft-modal-card{width:min(1200px,96vw);height:92vh;max-height:92vh;overflow:hidden}.word-editor-shell{height:100%;min-height:0}.word-page{height:calc(92vh - 160px);min-height:0;overflow:auto}@media print{html,body{background:#fff!important;margin:0!important;padding:0!important;overflow:visible!important}body *{visibility:hidden!important}.word-page,.word-page *{visibility:visible!important}.text-modal,.text-modal-card,.draft-modal-card,.word-editor-shell{width:auto!important;height:auto!important;max-height:none!important;box-shadow:none!important;background:#fff!important;border:0!important;display:block!important;position:static!important;overflow:visible!important}.word-page{width:auto!important;height:auto!important;min-height:auto!important;box-shadow:none!important;background:#fff!important;border:0!important;margin:0!important;padding:18mm 20mm!important;position:static!important;overflow:visible!important}.word-page .ProseMirror{height:auto!important;min-height:auto!important;overflow:visible!important}.app-header,.layout,.text-modal-head,.draft-toolbar,.word-toolbar{display:none!important}table{break-inside:auto;page-break-inside:auto}tr{break-inside:avoid;page-break-inside:avoid}@page{size:A4;margin:15mm}}.word-page{color:#111827;background:#fff;border:1px solid #d1d5db;width:210mm;max-width:210mm;min-height:297mm;margin:24px auto;padding:20mm;overflow:visible;box-shadow:0 20px 60px #00000073}.word-page .ProseMirror{outline:none;min-height:257mm}.page-break{text-align:center;page-break-after:always;break-after:page;border-top:2px dashed #94a3b8;height:32px;margin:28px -20mm;display:block;position:relative}.page-break span{color:#475569;background:#fff;padding:2px 10px;font-family:Arial,sans-serif;font-size:11px;position:relative;top:-12px}@media print{html,body{background:#fff!important;margin:0!important;padding:0!important;overflow:visible!important}body *{visibility:hidden!important}.word-page,.word-page *{visibility:visible!important}.word-page{width:170mm!important;max-width:170mm!important;min-height:auto!important;box-shadow:none!important;background:#fff!important;border:0!important;margin:0 auto!important;padding:0!important;position:static!important;overflow:visible!important}.word-page .ProseMirror{min-height:auto!important;overflow:visible!important}.page-break{page-break-after:always!important;break-after:page!important;border:0!important;height:0!important;margin:0!important}.page-break span,.app-header,.layout,.text-modal-head,.draft-toolbar,.word-toolbar{display:none!important}table{page-break-inside:auto;break-inside:auto}tr{page-break-inside:avoid;break-inside:avoid}@page{size:A4;margin:20mm}}.draft-modal-card{flex-direction:column!important;height:94vh!important;max-height:94vh!important;display:flex!important;overflow:hidden!important}.word-editor-shell{flex-direction:column!important;flex:auto!important;min-height:0!important;display:flex!important;overflow:hidden!important}.word-page{flex:auto!important;height:auto!important;min-height:0!important;overflow:auto!important}.word-page .ProseMirror{min-height:257mm!important}.word-page hr{page-break-after:always;break-after:page;background:#e2e8f0;border:3px solid #64748b;border-left:0;border-right:0;height:32px;margin:24px -20mm;display:block;position:relative}.word-page hr:after{content:"▼  SIVUNVAIHTO  ▼";color:#475569;letter-spacing:1px;background:#e2e8f0;padding:2px 14px;font-family:Arial,sans-serif;font-size:11px;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}@media print{.word-page hr{page-break-after:always!important;break-after:page!important;border:0!important;height:0!important;margin:0!important}html,body,#root{background:#fff!important;width:auto!important;height:auto!important;min-height:auto!important;margin:0!important;padding:0!important;overflow:visible!important}body *{visibility:hidden!important}.text-modal,.text-modal *,.draft-modal-card,.draft-modal-card *,.word-editor-shell,.word-editor-shell *,.word-page,.word-page *{visibility:visible!important}.text-modal{background:#fff!important;width:auto!important;height:auto!important;min-height:auto!important;max-height:none!important;display:block!important;position:static!important;inset:auto!important;overflow:visible!important}.draft-modal-card,.text-modal-card,.word-editor-shell{width:auto!important;height:auto!important;min-height:auto!important;max-height:none!important;box-shadow:none!important;background:#fff!important;border:0!important;margin:0!important;padding:0!important;display:block!important;position:static!important;overflow:visible!important}.text-modal-head,.draft-toolbar,.word-toolbar,.app-header,.layout{display:none!important}.word-page{width:auto!important;max-width:none!important;height:auto!important;min-height:auto!important;box-shadow:none!important;background:#fff!important;border:0!important;margin:0!important;padding:0!important;display:block!important;position:static!important;overflow:visible!important}.word-page .ProseMirror{height:auto!important;min-height:auto!important;display:block!important;overflow:visible!important}.word-page hr{page-break-after:always!important;break-after:page!important;border:0!important;height:0!important;margin:0!important;padding:0!important}.word-page hr:after{display:none!important}table{border-collapse:collapse!important;page-break-inside:auto!important;break-inside:auto!important;width:100%!important}tr{page-break-inside:avoid!important;break-inside:avoid!important}@page{size:A4;margin:20mm}}.admin-grid{gap:16px;display:grid}.inline-actions{align-items:center;gap:8px;display:flex}.inline-actions input{min-width:180px}.table-wrap{width:100%;overflow-x:auto}.twofa-box{gap:12px;margin-top:14px;display:grid}.twofa-box img{background:#fff;border-radius:12px;width:220px;height:220px;padding:10px}.twofa-box code{border:1px solid var(--line);word-break:break-all;background:#080d16;border-radius:8px;padding:10px;display:block}.draft-version-toolbar{border-bottom:1px solid var(--line);background:#0f172a;flex-wrap:wrap;gap:8px;padding:12px 14px;display:flex}.draft-version-toolbar select{min-width:260px}.checkbox-row{align-items:center;gap:8px;display:flex}.admin-grid textarea{width:100%;min-height:120px}.template-manager{min-height:88vh}.template-manager .word-editor-shell{min-height:78vh}.template-manager .word-page-viewport{min-height:72vh}.users-table input[type=text],.users-table td:nth-child(2) input{min-width:240px}.users-table td:nth-child(3) select{min-width:260px}.users-table td:nth-child(10) input{min-width:180px}.users-table{table-layout:auto;min-width:1300px}.users-table th:nth-child(2),.users-table td:nth-child(2){width:260px;min-width:260px}.users-table td:nth-child(2) input{width:240px!important;min-width:240px!important;max-width:240px!important}.users-table th:nth-child(3),.users-table td:nth-child(3){width:280px;min-width:280px}.users-table td:nth-child(3) select{width:260px!important;min-width:260px!important}@media print{button,select,input[type=button],input[type=submit],.draft-version-toolbar,.word-toolbar,.editor-controls{display:none!important}.template-manager,.template-manager *,.template-manager .word-page,.template-manager .word-page *{visibility:visible!important}.template-manager{background:#fff!important;width:auto!important;height:auto!important;display:block!important;position:static!important;overflow:visible!important}.template-manager .word-editor-shell,.template-manager .word-page,.template-manager .word-page .ProseMirror{background:#fff!important;height:auto!important;min-height:auto!important;max-height:none!important;display:block!important;position:static!important;overflow:visible!important}.template-manager .word-page{width:auto!important;max-width:none!important;box-shadow:none!important;border:0!important;margin:0!important;padding:0!important}.template-manager>h2,.template-manager>.draft-version-toolbar{display:none!important}}.no-table-borders table,.no-table-borders th,.no-table-borders td{border-color:#0000!important}.html-import-export{white-space:pre;width:100%;min-height:60vh;font-family:monospace;font-size:13px}.word-toolbar .btn-small{min-width:unset;opacity:.75;padding:4px 8px;font-size:11px}.word-toolbar select{color:#f1f5f9;cursor:pointer;background:#1e293b;border:1px solid #334155;border-radius:6px;padding:6px 8px;font-size:13px}.word-page-viewport{background:#525659;flex:auto;min-height:0;padding:28px 0 48px;overflow:auto}.word-page-viewport .word-page{flex:none!important;width:210mm!important;max-width:210mm!important;height:auto!important;min-height:297mm!important;margin:0 auto 28px!important;overflow:visible!important}.word-page-viewport .word-page .ProseMirror{min-height:257mm!important}@media print{.word-page-viewport{background:#fff!important;height:auto!important;min-height:auto!important;padding:0!important;display:block!important;overflow:visible!important}}
