@font-face{font-family:Vazirmatn;src:local("Vazirmatn"),local("Vazir");font-display:swap}
@media(max-width:760px){.saved-file-grid,.library-grid{grid-template-columns:1fr!important}.saved-picker-head{align-items:flex-start!important;flex-direction:column!important;gap:2px!important}.library-section{padding:15px!important}.library-intro{padding:18px!important}}
@media(max-width:430px){.topic-grid{grid-template-columns:1fr!important}.saved-file-card{padding:10px!important}}
:root{--bg:#f5f6fb;--surface:#fff;--surface-2:#f9f9fd;--text:#18182a;--muted:#747589;--line:#e9e9f2;--primary:#5b4bdb;--primary-2:#7868ed;--primary-soft:#eeebff;--blue:#3b82f6;--green:#1aa981;--coral:#f06d67;--amber:#e5a329;--shadow:0 14px 40px rgba(38,34,76,.08);--radius:22px;--sidebar:272px}
*{box-sizing:border-box}html{scroll-behavior:smooth}body{margin:0;background:var(--bg);color:var(--text);font-family:Vazirmatn,Tahoma,Arial,sans-serif;font-size:14px;line-height:1.65}button,input,select,textarea{font:inherit}button,a{touch-action:manipulation}a{color:inherit;text-decoration:none}button{cursor:pointer}svg{display:block}code{direction:ltr;display:inline-block;background:#f0eff7;border-radius:7px;padding:1px 7px;color:#696477;font-size:12px}
.app-shell{min-height:100vh}.sidebar{width:var(--sidebar);position:fixed;z-index:50;inset:0 0 0 auto;background:#161626;color:#fff;padding:24px 18px 18px;display:flex;flex-direction:column;box-shadow:-12px 0 40px rgba(23,21,46,.06)}.brand{display:flex;align-items:center;gap:12px;padding:0 8px 24px;border-bottom:1px solid rgba(255,255,255,.08)}.brand-mark{width:45px;height:45px;border-radius:15px;background:linear-gradient(145deg,#8475f8,#5544d3);display:grid;place-items:center;box-shadow:0 10px 24px rgba(91,75,219,.35);flex:none}.brand-mark svg{width:28px;height:28px;fill:none;stroke:white;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}.brand strong{display:block;font-size:17px}.brand small{display:block;color:#9c9caf;font-size:10.5px;margin-top:-2px}.main-nav{padding:25px 0;display:flex;flex-direction:column;gap:7px}.main-nav>a{display:flex;align-items:center;gap:12px;border-radius:13px;padding:11px 13px;color:#aaaabd;transition:.18s}.main-nav>a:hover{background:rgba(255,255,255,.06);color:#fff}.main-nav>a.active{background:linear-gradient(90deg,rgba(107,89,230,.3),rgba(91,75,219,.15));color:#fff;box-shadow:inset -3px 0 0 #8878fb}.main-nav>a em{font-style:normal;font-size:9px;color:#c7c0ff;background:rgba(122,104,237,.22);padding:1px 7px;border-radius:20px;margin-right:auto}.nav-icon{width:25px;text-align:center;font-size:20px;color:#8f82f5}.nav-label{color:#68687b;font-size:10px;padding:20px 13px 4px;text-transform:uppercase;letter-spacing:.05em}.sidebar-help{margin-top:auto;border:1px solid rgba(255,255,255,.08);background:linear-gradient(145deg,rgba(117,98,231,.16),rgba(255,255,255,.03));border-radius:16px;padding:15px;position:relative;overflow:hidden}.help-orb{width:27px;height:27px;border-radius:50%;display:grid;place-items:center;background:#6b58e5;font-weight:800;margin-bottom:8px}.sidebar-help strong{font-size:12px}.sidebar-help p{color:#9191a5;font-size:10px;line-height:1.7;margin:4px 0 0}.sidebar-user{margin-top:14px;padding-top:14px;border-top:1px solid rgba(255,255,255,.08);display:flex;align-items:center;gap:10px}.avatar{width:38px;height:38px;border-radius:12px;display:grid;place-items:center;background:linear-gradient(145deg,#7767e8,#4c3fc1);color:#fff;font-weight:800;flex:none}.sidebar-user>a{min-width:0;flex:1}.sidebar-user strong,.sidebar-user small{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.sidebar-user strong{font-size:12px}.sidebar-user small{color:#858599;font-size:9.5px}.sidebar-user form{margin:0}.icon-button{border:0;background:transparent;color:#9a9aae;font-size:21px;padding:4px}.icon-button:hover{color:#fff}
.main-area{margin-right:var(--sidebar);min-height:100vh}.topbar{height:92px;background:rgba(255,255,255,.88);backdrop-filter:blur(15px);border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;padding:0 36px;position:sticky;top:0;z-index:30}.eyebrow{color:var(--primary);font-size:10px;font-weight:800;letter-spacing:.03em}.topbar-title h1{margin:-2px 0 0;font-size:22px}.topbar-actions{display:flex;align-items:center;gap:15px}.system-state{color:#67687a;font-size:11px;background:#f7f7fb;border:1px solid var(--line);border-radius:30px;padding:7px 11px}.system-state i,.green-dot{display:inline-block;width:7px;height:7px;border-radius:50%;background:#20b889;margin-left:6px;box-shadow:0 0 0 4px rgba(32,184,137,.1)}.mobile-menu{display:none;border:0;background:transparent;font-size:23px}.page-content{padding:30px 36px 55px;max-width:1480px;margin:auto}.primary-button,.secondary-button,.danger-button{border:0;border-radius:12px;padding:11px 18px;display:inline-flex;align-items:center;justify-content:center;gap:8px;font-weight:800;transition:.18s}.primary-button{background:linear-gradient(135deg,var(--primary-2),var(--primary));color:#fff;box-shadow:0 9px 22px rgba(91,75,219,.22)}.primary-button:hover{transform:translateY(-1px);box-shadow:0 12px 25px rgba(91,75,219,.3)}.primary-button.compact,.secondary-button.compact,.danger-button.compact{padding:8px 13px;font-size:11px}.primary-button.wide{width:100%}.secondary-button{background:#f1f0f8;color:#5e5a71}.danger-button{background:#fff0f0;color:#d64f4f}.danger-button:hover{background:#ffe6e6}.button-loading{display:none}.is-submitting .button-loading{display:inline}.is-submitting .button-text{display:none}.is-submitting button[type=submit]{opacity:.72;pointer-events:none}
.welcome-panel{background:linear-gradient(135deg,#24213f,#353059 65%,#51488b);border-radius:var(--radius);padding:27px 31px;color:#fff;display:flex;align-items:center;justify-content:space-between;position:relative;overflow:hidden;box-shadow:var(--shadow)}.welcome-panel:before,.welcome-panel:after{content:"";position:absolute;border:1px solid rgba(255,255,255,.06);border-radius:50%;width:280px;height:280px;left:-80px;top:-160px}.welcome-panel:after{width:180px;height:180px;left:80px;top:-120px}.welcome-panel .eyebrow{color:#beb6ff}.welcome-panel h2{font-size:24px;margin:2px 0}.welcome-panel p{margin:0;color:#b8b7c9}.welcome-panel>*{position:relative;z-index:1}.stats-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:16px;margin:20px 0}.stat-card{background:var(--surface);border:1px solid var(--line);border-radius:18px;padding:18px;display:flex;align-items:center;gap:13px;position:relative;box-shadow:0 6px 20px rgba(35,32,69,.035)}.stat-icon{width:44px;height:44px;border-radius:14px;display:grid;place-items:center;font-size:20px}.stat-card small,.stat-card strong{display:block}.stat-card small{color:var(--muted);font-size:10px}.stat-card strong{font-size:24px;line-height:1.25}.stat-card em{font-style:normal;font-size:9px;color:#a2a2b1;margin-right:auto}.stat-card.purple .stat-icon{background:#eeebff;color:var(--primary)}.stat-card.blue .stat-icon{background:#e9f2ff;color:var(--blue)}.stat-card.green .stat-icon{background:#e8f8f3;color:var(--green)}.stat-card.coral .stat-icon{background:#fff0ef;color:var(--coral)}.quick-grid{display:grid;grid-template-columns:1fr 1fr;gap:18px;margin-bottom:20px}.quick-card{min-height:155px;background:var(--surface);border:1px solid var(--line);border-radius:20px;padding:23px;display:flex;align-items:center;gap:18px;position:relative;overflow:hidden;transition:.2s}.quick-card:hover{transform:translateY(-2px);box-shadow:var(--shadow);border-color:#dcd8ff}.quick-glow{position:absolute;width:180px;height:180px;border-radius:50%;left:-70px;top:-90px;background:radial-gradient(circle,rgba(99,81,222,.13),transparent 68%)}.quick-icon{width:58px;height:58px;border-radius:18px;display:grid;place-items:center;font-weight:900;position:relative}.quick-card.source .quick-icon{background:#eeeaff;color:#5848cc}.quick-card.archive .quick-icon{background:#e8f5ff;color:#287dcc;font-size:25px}.quick-card div{flex:1}.quick-card small{color:var(--primary);font-size:9px;font-weight:800}.quick-card h3{margin:0;font-size:16px}.quick-card p{margin:3px 0 0;color:var(--muted);font-size:11px}.quick-card>b{font-size:11px;color:var(--primary);align-self:flex-end}.content-card{background:var(--surface);border:1px solid var(--line);border-radius:20px;box-shadow:0 8px 25px rgba(35,32,69,.035)}.recent-card{padding:21px}.section-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:14px}.section-head h2{font-size:16px;margin:0}.section-head>a{color:var(--primary);font-size:11px;font-weight:800}.section-head.simple{margin-bottom:17px}.job-list{display:flex;flex-direction:column}.job-row{display:grid;grid-template-columns:44px minmax(180px,1fr) 125px 130px 20px;gap:12px;align-items:center;padding:12px 4px;border-top:1px solid #f0f0f5}.job-row:hover{background:#fafafe}.job-row:first-child{border-top:0}.job-type{width:38px;height:38px;border-radius:11px;display:grid;place-items:center;font-style:normal;font-weight:900;font-size:10px}.job-type.pdf{background:#fff0f0;color:#da5b5b}.job-type.archive{background:#e9f2ff;color:#367ed1}.job-main strong,.job-main small{display:block}.job-main strong{font-size:12px}.job-main small{font-size:9.5px;color:var(--muted)}.status-badge{display:inline-flex;align-items:center;gap:6px;border-radius:30px;padding:4px 9px;font-size:9.5px;font-style:normal;font-weight:800;width:max-content}.status-badge>i{width:6px;height:6px;border-radius:50%}.status-badge.completed{background:#e9f8f3;color:#158a69}.status-badge.completed>i{background:#1bae84}.status-badge.processing{background:#eeebff;color:#5c4bcf}.status-badge.processing>i{background:#6b59df;animation:pulse 1.4s infinite}.status-badge.queued{background:#fff6e5;color:#b47a13}.status-badge.queued>i{background:#dda02f}.status-badge.failed,.status-badge.cancelled{background:#fff0ef;color:#c75353}.status-badge.failed>i,.status-badge.cancelled>i{background:#db6662}.status-badge.big{padding:8px 13px;font-size:11px}.job-row time,.report-tr time{color:#8f90a0;font-size:10px}.row-arrow{color:#aaa7bb;font-size:17px}.empty-state{display:flex;flex-direction:column;align-items:center;text-align:center;padding:34px}.empty-state>span{width:50px;height:50px;display:grid;place-items:center;border-radius:16px;background:var(--primary-soft);color:var(--primary);font-size:24px}.empty-state h3{margin:10px 0 0;font-size:14px}.empty-state p{color:var(--muted);font-size:11px;margin:4px 0 13px}.empty-state.tall{padding:80px 20px}
.builder-shell{max-width:1080px;margin:auto}.builder-intro{display:flex;justify-content:space-between;align-items:center;margin-bottom:18px}.builder-intro h2,.section-intro h2{margin:1px 0;font-size:20px}.builder-intro p,.section-intro p{margin:0;color:var(--muted);font-size:11px}.privacy-note{display:flex;align-items:center;gap:10px;background:#eaf8f4;padding:10px 13px;border-radius:13px;color:#276f60}.privacy-note>span{font-size:20px}.privacy-note p,.privacy-note strong{display:block;margin:0;font-size:9.5px}.privacy-note strong{font-size:10.5px}.flow-tabs{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin-bottom:18px}.flow-tab{border:2px solid transparent;background:var(--surface);border-radius:18px;padding:16px;text-align:right;display:flex;align-items:center;gap:13px;color:var(--text);box-shadow:0 6px 20px rgba(35,32,69,.035)}.flow-tab.active{border-color:#7666e6;background:#fbfaff}.flow-tab .tab-icon{width:46px;height:46px;border-radius:14px;display:grid;place-items:center;background:#f0edff;color:var(--primary);font-weight:900}.flow-tab:nth-child(2) .tab-icon{background:#e9f5ff;color:#2780d0;font-size:20px}.flow-tab b,.flow-tab small{display:block}.flow-tab b{font-size:13px}.flow-tab small{font-size:9.5px;color:var(--muted)}.flow-tab>i{margin-right:auto;width:21px;height:21px;border-radius:50%;display:grid;place-items:center;background:#dddce6;color:#fff;font-style:normal;font-size:10px}.flow-tab.active>i{background:var(--primary)}.builder-form{display:none;background:var(--surface);border:1px solid var(--line);border-radius:22px;padding:26px;box-shadow:var(--shadow)}.builder-form.active{display:block}.form-step{display:flex;gap:11px;align-items:center;margin:24px 0 13px;padding-top:20px;border-top:1px solid var(--line)}.builder-form>.form-step:first-of-type{margin-top:0;padding-top:0;border:0}.form-step>span{width:29px;height:29px;border-radius:9px;background:var(--primary-soft);color:var(--primary);display:grid;place-items:center;font-weight:900}.form-step h3{margin:0;font-size:13px}.form-step p{margin:0;color:var(--muted);font-size:9.5px}.field{display:flex;flex-direction:column;gap:6px}.field>span{font-size:10.5px;font-weight:800;color:#555568}.field>span small{font-weight:400;color:#9999a8}.field input,.field select,.format-box textarea,.search-input input{width:100%;border:1px solid #dedee9;background:#fbfbfd;border-radius:11px;padding:10px 12px;outline:0;color:var(--text);transition:.15s}.field input:focus,.field select:focus,.format-box textarea:focus,.search-input input:focus{border-color:#8c7df0;box-shadow:0 0 0 3px rgba(91,75,219,.08);background:#fff}.upload-grid{display:grid;grid-template-columns:1fr 1fr;gap:13px}.dropzone{border:1.5px dashed #ccc9e8;background:#faf9ff;border-radius:17px;min-height:164px;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:18px;text-align:center;cursor:pointer;transition:.15s}.dropzone:hover,.dropzone.dragover{border-color:var(--primary);background:#f6f3ff}.dropzone input,.compact-upload input{display:none}.upload-icon{width:41px;height:41px;border-radius:13px;display:grid;place-items:center;background:#eae6ff;color:var(--primary);font-size:22px;margin-bottom:8px}.dropzone strong{font-size:12px}.dropzone p{font-size:9.5px;color:var(--muted);margin:2px 0}.dropzone small{color:#9796a5;font-size:9px;max-width:100%;overflow:hidden;text-overflow:ellipsis}.format-box{background:#f9f9fc;border-radius:16px;padding:13px}.format-box textarea{resize:vertical;min-height:115px;line-height:1.8}.format-box>small{display:block;color:var(--muted);font-size:9px;margin:5px 4px 0}.preset-row{display:flex;gap:7px;margin-bottom:9px}.preset-row button,.topic-tools button{border:1px solid #dedce9;background:#fff;color:#69677b;border-radius:30px;padding:5px 10px;font-size:9.5px}.preset-row button:hover,.topic-tools button:hover{border-color:#9c8ff3;color:var(--primary)}.submit-row{display:flex;justify-content:space-between;align-items:center;border-top:1px solid var(--line);margin-top:23px;padding-top:18px}.submit-row>span{font-size:9.5px;color:var(--muted)}.submit-row>span i{font-style:normal;color:var(--green);font-weight:900}.two-cols{display:grid;grid-template-columns:1fr 1fr;gap:13px}.compact-upload{border:1px dashed #ccc9e8;border-radius:12px;padding:9px 11px;display:flex;align-items:center;gap:10px;cursor:pointer}.compact-upload .upload-icon{width:35px;height:35px;margin:0;flex:none}.compact-upload strong,.compact-upload small{display:block}.compact-upload strong{font-size:10.5px}.compact-upload small{font-size:9px;color:var(--muted)}.topic-picker{border:1px solid var(--line);border-radius:16px;overflow:hidden}.topic-tools{display:flex;align-items:center;justify-content:space-between;padding:10px;background:#fafafd;border-bottom:1px solid var(--line)}.search-input{position:relative;max-width:300px;flex:1}.search-input span{position:absolute;right:11px;top:7px;color:#9b9aaa}.search-input input{padding:7px 31px 7px 10px}.topic-tools>div{display:flex;align-items:center;gap:10px}.topic-tools>div>span{font-size:9.5px;color:var(--muted)}.topic-tools b{color:var(--primary)}.topic-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:8px;padding:12px;max-height:240px;overflow:auto}.topic-chip{border:1px solid #e6e5ee;border-radius:10px;padding:7px 9px;display:flex;align-items:center;cursor:pointer;font-size:10px}.topic-chip input{display:none}.topic-chip i{font-style:normal;width:17px;height:17px;border-radius:6px;border:1px solid #d6d4df;color:transparent;display:grid;place-items:center;margin-right:auto;font-size:8px}.topic-chip:has(input:checked){border-color:#8d7ff0;background:#f4f1ff;color:#5142bd}.topic-chip input:checked~i{background:var(--primary);border-color:var(--primary);color:#fff}.inline-empty{padding:25px;text-align:center;color:var(--muted)}.date-range-box{display:grid;grid-template-columns:1fr 35px 1fr;align-items:end;gap:15px;background:#fafafe;border:1px solid var(--line);padding:16px;border-radius:16px}.date-range-box>div{display:grid;grid-template-columns:1fr 1fr;gap:8px;position:relative;padding-top:19px}.range-label{position:absolute;top:-3px;right:0;font-size:9px;color:var(--primary);font-weight:800}.range-arrow{width:30px;height:30px;border-radius:50%;display:grid;place-items:center;background:#eeeaff;color:var(--primary);margin-bottom:7px}.range-hint{background:#fff8e8;color:#8a6c2f;border-radius:10px;padding:7px 10px;margin-top:8px;font-size:9px}
.section-intro{display:flex;align-items:center;justify-content:space-between;margin-bottom:17px}.table-card{overflow:hidden}.report-table{width:100%}.report-tr{display:grid;grid-template-columns:minmax(230px,1.4fr) 1fr 130px 125px 25px;align-items:center;gap:12px;padding:13px 18px;border-top:1px solid var(--line);font-size:10.5px}.report-tr:hover:not(.report-th){background:#fafafe}.report-tr.report-th{background:#f9f9fc;color:#8d8e9f;border:0;font-size:9px}.report-title{display:flex;align-items:center;gap:10px}.report-title b{font-size:11px}.report-table:has(.report-th span:nth-child(6)) .report-tr{grid-template-columns:minmax(210px,1.4fr) .9fr .7fr 120px 110px 25px}
.report-hero{background:var(--surface);border:1px solid var(--line);border-radius:22px;padding:24px;box-shadow:var(--shadow)}.report-hero-top{display:flex;align-items:center;justify-content:space-between}.report-identity{display:flex;align-items:center;gap:14px}.job-type.large{width:58px;height:58px;border-radius:17px;font-size:12px}.report-identity h2{margin:0;font-size:19px}.report-identity p{font-size:9.5px;color:var(--muted);margin:2px 0 0}.progress-panel{margin-top:23px;background:#f8f7ff;border:1px solid #e8e3ff;border-radius:16px;padding:16px}.progress-panel.finished{display:none}.progress-copy,.progress-meta{display:flex;align-items:center;justify-content:space-between}.progress-copy span{display:flex;align-items:center;gap:8px}.progress-copy b{font-size:10.5px}.progress-copy strong{font-size:16px;color:var(--primary)}.pulse{width:9px;height:9px;border-radius:50%;background:var(--primary);box-shadow:0 0 0 0 rgba(91,75,219,.4);animation:pulse-ring 1.5s infinite}.progress-track{height:8px;background:#e2def9;border-radius:20px;overflow:hidden;margin:11px 0 8px}.progress-track i{display:block;height:100%;border-radius:20px;background:linear-gradient(90deg,#8171f0,#5948d1);transition:width .5s}.progress-meta{font-size:9px;color:var(--muted)}.result-panel,.error-panel{margin-top:20px;border-radius:16px;padding:17px;display:flex;align-items:center;gap:13px}.result-panel{background:#eaf9f3;border:1px solid #cdeee3}.result-check{width:40px;height:40px;border-radius:50%;display:grid;place-items:center;background:var(--green);color:#fff;font-weight:900}.result-panel div,.error-panel div{flex:1}.result-panel h3,.error-panel h3{font-size:13px;margin:0}.result-panel p,.error-panel p{font-size:9.5px;color:#598276;margin:1px 0}.error-panel{background:#fff1f0;border:1px solid #f7d7d4}.error-panel>span{width:38px;height:38px;border-radius:50%;display:grid;place-items:center;background:var(--coral);color:#fff;font-weight:900}.error-panel p{color:#986663}.hidden{display:none!important}.detail-grid{display:grid;grid-template-columns:1fr 1fr;gap:18px;margin-top:18px}.detail-grid .content-card{padding:20px}.detail-list{margin:0}.detail-list>div{display:flex;justify-content:space-between;padding:10px 0;border-top:1px solid var(--line);font-size:10px}.detail-list>div:first-child{border-top:0}.detail-list dt{color:var(--muted)}.detail-list dd{font-weight:800;margin:0}.instruction-copy{color:#656577;font-size:10.5px;line-height:1.9;margin:0;white-space:pre-wrap}.cancel-row{display:flex;align-items:center;gap:12px;margin-top:16px}.cancel-row small{color:var(--muted);font-size:9px}
.page-alert{margin-bottom:15px}.alert{padding:10px 13px;border-radius:11px;font-size:10px}.alert.danger{background:#fff0ef;color:#a74848;border:1px solid #f8d7d4}.alert.success{background:#eaf9f3;color:#157a5e;border:1px solid #cdeee3}.user-summary{display:grid;grid-template-columns:repeat(3,1fr);gap:14px;margin-bottom:16px}.user-summary>div{background:#fff;border:1px solid var(--line);border-radius:16px;padding:15px;display:flex;align-items:center;gap:11px}.user-summary>div>span{width:39px;height:39px;border-radius:12px;display:grid;place-items:center;background:var(--primary-soft);color:var(--primary);font-size:19px}.user-summary p,.user-summary strong,.user-summary small{margin:0;display:block}.user-summary strong{font-size:19px}.user-summary small{font-size:9px;color:var(--muted)}.users-card{overflow:hidden}.users-head,.user-row summary{display:grid;grid-template-columns:minmax(190px,1.4fr) 90px 100px 80px 130px 35px;gap:10px;align-items:center;padding:12px 17px}.users-head{background:#f8f8fc;color:#8f90a0;font-size:9px}.user-row{border-top:1px solid var(--line)}.user-row summary{cursor:pointer;list-style:none;font-size:10px}.user-row summary::-webkit-details-marker{display:none}.user-row[open] summary{background:#faf9ff}.user-cell{display:flex;align-items:center;gap:10px}.avatar.small{width:35px;height:35px;border-radius:11px}.user-cell b,.user-cell small{display:block}.user-cell b{font-size:11px}.user-cell small{font-size:8.5px;color:var(--muted);direction:ltr;text-align:right}.role-badge{font-style:normal;padding:3px 8px;border-radius:20px;font-size:9px;font-weight:800}.role-badge.admin{background:#eeeaff;color:#5948c6}.role-badge.user{background:#edf4fa;color:#4a718f}.more-button{color:#8f8d9e;font-size:15px}.user-editor{background:#fafafe;border-top:1px solid var(--line);padding:14px 17px;display:flex;align-items:end;justify-content:space-between;gap:15px}.admin-edit-form{display:grid;grid-template-columns:1.2fr .7fr 1fr auto auto;align-items:end;gap:10px;flex:1}.switch-field{display:flex;align-items:center;gap:7px;padding-bottom:8px;white-space:nowrap}.switch-field input{display:none}.switch-field>span{width:34px;height:19px;border-radius:20px;background:#cbcbd5;position:relative}.switch-field>span:before{content:"";position:absolute;width:13px;height:13px;border-radius:50%;background:#fff;top:3px;right:3px;transition:.15s}.switch-field input:checked+span{background:var(--green)}.switch-field input:checked+span:before{right:18px}.switch-field b{font-size:9px}.app-dialog{border:0;border-radius:20px;padding:0;width:min(470px,calc(100% - 28px));box-shadow:0 30px 90px rgba(19,17,39,.3)}.app-dialog::backdrop{background:rgba(18,17,34,.55);backdrop-filter:blur(4px)}.app-dialog form{padding:0}.dialog-head{padding:20px 22px 13px;display:flex;justify-content:space-between;align-items:center;border-bottom:1px solid var(--line)}.dialog-head h2{margin:0;font-size:17px}.dialog-head button{border:0;background:#f1f0f6;width:31px;height:31px;border-radius:9px;font-size:20px}.dialog-body{padding:18px 22px;display:grid;gap:12px}.dialog-actions{padding:13px 22px 19px;display:flex;justify-content:flex-end;gap:8px}.account-grid{display:grid;grid-template-columns:320px 1fr;gap:18px;max-width:900px;margin:auto}.profile-card{background:linear-gradient(145deg,#292642,#39345d);color:#fff;border-radius:21px;padding:28px;text-align:center;box-shadow:var(--shadow)}.avatar.giant{width:74px;height:74px;border-radius:23px;font-size:28px;margin:0 auto 12px}.profile-card h2{margin:0;font-size:18px}.profile-card>p{margin:0 0 9px;color:#aeacc0;font-size:10px}.profile-card dl{margin:25px 0 0;text-align:right}.profile-card dl>div{display:flex;justify-content:space-between;padding:9px 0;border-top:1px solid rgba(255,255,255,.08);font-size:9.5px}.profile-card dt{color:#aaa8bc}.profile-card dd{margin:0}.password-card{padding:24px}.password-card form{display:grid;gap:12px;margin-top:17px}.password-card .primary-button{justify-self:start}.muted{color:var(--muted);font-size:10.5px}.error-page{text-align:center;padding:80px 20px}.error-page>strong{font-size:65px;color:#dfdbee}.error-page h2{margin:-10px 0 3px}.error-page p{color:var(--muted);margin:0 0 17px}
.login-page{background:#f5f5fa;min-height:100vh}.login-layout{display:grid;grid-template-columns:1.08fr .92fr;min-height:100vh;direction:ltr}.login-visual{background:linear-gradient(145deg,#1e1c36,#332e59 58%,#4b4385);position:relative;overflow:hidden;padding:55px;direction:rtl;color:#fff}.login-visual:before{content:"";position:absolute;width:520px;height:520px;border-radius:50%;border:1px solid rgba(255,255,255,.06);left:-180px;bottom:-250px;box-shadow:0 0 0 80px rgba(255,255,255,.018),0 0 0 160px rgba(255,255,255,.012)}.visual-noise{position:absolute;inset:0;background-image:radial-gradient(rgba(255,255,255,.09) .7px,transparent .7px);background-size:22px 22px;mask-image:linear-gradient(to bottom,black,transparent)}.visual-copy{position:relative;z-index:2;max-width:560px;margin:8vh auto}.login-brand,.login-mobile-brand{display:flex;align-items:center;gap:11px;font-weight:900;font-size:18px;margin-bottom:11vh}.visual-badge{background:rgba(128,110,238,.18);border:1px solid rgba(170,157,255,.24);color:#cbc3ff;padding:5px 11px;border-radius:30px;font-size:10px}.visual-copy h1{font-size:43px;line-height:1.45;margin:18px 0 10px;letter-spacing:-.03em}.visual-copy h1 em{font-style:normal;color:#9a8bff}.visual-copy>p{color:#bab8ca;max-width:470px}.visual-points{display:flex;flex-wrap:wrap;gap:17px;margin-top:25px;color:#d6d4df;font-size:10px}.visual-points i{font-style:normal;color:#9c8eff}.floating-card{position:absolute;z-index:3;background:rgba(255,255,255,.1);backdrop-filter:blur(15px);border:1px solid rgba(255,255,255,.13);box-shadow:0 18px 45px rgba(0,0,0,.18);border-radius:14px;padding:11px 13px;display:flex;align-items:center;gap:10px;font-size:10px}.floating-card>span{width:32px;height:32px;border-radius:10px;display:grid;place-items:center;background:rgba(137,120,244,.22);color:#cfc7ff}.floating-card b,.floating-card small{display:block}.floating-card small{color:#aaa8ba;font-size:8px}.floating-card>i{font-style:normal;color:#7cdeb8}.card-a{bottom:8%;right:10%}.card-b{top:14%;left:7%;display:grid;grid-template-columns:32px 1fr}.mini-progress{height:4px;background:rgba(255,255,255,.12);grid-column:1/3;border-radius:10px;overflow:hidden}.mini-progress i{display:block;width:75%;height:100%;background:#9585fb}.login-panel{direction:rtl;display:grid;place-items:center;padding:40px;background:#f7f7fb}.login-card{width:min(390px,100%)}.login-mobile-brand{display:none}.login-card h2{font-size:26px;margin:1px 0}.login-card>.muted{margin:0 0 24px}.login-card .field{margin-top:14px}.input-wrap{position:relative;display:block!important}.input-wrap>i{position:absolute;right:12px;top:9px;font-style:normal;color:#9997aa}.input-wrap input{padding-right:36px!important}.password-toggle{position:absolute;left:8px;top:6px;border:0;background:transparent;color:#9997aa}.login-submit{margin-top:20px;padding:13px}.login-footnote{display:block;text-align:center;color:#9a99aa;margin-top:15px;font-size:9px}
.mobile-shade{display:none}.toast-stack{position:fixed;left:20px;bottom:20px;z-index:100}.toast{background:#24223a;color:#fff;padding:10px 14px;border-radius:11px;box-shadow:var(--shadow);font-size:10px;animation:slide-in .2s}
@keyframes pulse{50%{opacity:.35}}@keyframes pulse-ring{70%{box-shadow:0 0 0 8px rgba(91,75,219,0)}}@keyframes slide-in{from{transform:translateY(10px);opacity:0}}@keyframes spin{to{transform:rotate(360deg)}}
.saved-picker,.format-reference-box{margin-top:14px}.saved-picker-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:10px}.saved-picker-head>span{font-weight:800;color:var(--text)}.saved-picker-head small,.field-note{color:var(--muted)}.saved-file-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin-bottom:12px}.saved-file-grid.compact-list{max-height:260px;overflow:auto;padding:2px}.saved-file-card{position:relative;display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:10px;padding:12px;border:1px solid var(--line);border-radius:15px;background:var(--surface);cursor:pointer;transition:.18s ease}.saved-file-card:hover{border-color:#c9c3fa;transform:translateY(-1px)}.saved-file-card input{position:absolute;opacity:0;pointer-events:none}.saved-file-card:has(input:checked){border-color:var(--primary);background:var(--primary-soft);box-shadow:0 0 0 2px rgba(91,75,219,.08)}.saved-file-card>span:nth-of-type(2){min-width:0}.saved-file-card strong,.saved-file-card small{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.saved-file-card small{color:var(--muted);font-size:11px}.saved-file-card>i{display:grid;width:22px;height:22px;border-radius:50%;place-items:center;background:#ddd;color:white;font-style:normal;opacity:.55}.saved-file-card:has(input:checked)>i{background:var(--primary);opacity:1}.file-kind{display:grid;place-items:center;min-width:45px;height:36px;padding:0 7px;border-radius:10px;background:#f0eff8;color:#646477;font-size:10px;font-weight:900}.file-kind.pdf{background:#ffe9e8;color:#d84c47}.file-kind.new{background:#e8f8f3;color:var(--green);font-size:18px}.file-kind.result{background:#e9efff;color:#356fd0}.file-kind.sample{background:#fff3dc;color:#a56a00}.dropzone.is-collapsed{display:none}.source-drop{margin-top:10px}.format-reference-box{padding:16px;border:1px solid var(--line);border-radius:18px;background:var(--surface-2)}.reference-upload{margin-top:8px;background:#fff}.field-note{margin:8px 2px 0;font-size:12px}.privacy-note{text-decoration:none}.inline-loading{grid-column:1/-1;display:flex;align-items:center;justify-content:center;gap:10px;padding:28px;color:var(--muted)}.inline-loading i{width:17px;height:17px;border:2px solid #d8d4ff;border-top-color:var(--primary);border-radius:50%;animation:spin .8s linear infinite}.danger-text{color:#b34b47}.secondary-button.small{padding:7px 12px;font-size:12px}.hidden{display:none!important}.library-intro{background:linear-gradient(135deg,#fff,#f4f1ff);padding:24px;border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow)}.library-section{margin-top:20px;background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:20px}.library-section-head{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;margin-bottom:16px}.library-section-head h3,.library-section-head p{margin:0}.library-section-head p{color:var(--muted);font-size:12px}.library-section-head>span{padding:5px 10px;background:var(--primary-soft);color:var(--primary);border-radius:20px;font-size:11px;font-weight:800;white-space:nowrap}.library-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.library-card{display:grid;grid-template-columns:auto minmax(0,1fr);gap:12px;padding:14px;border:1px solid var(--line);border-radius:17px;background:var(--surface-2)}.library-file-icon{display:grid;width:56px;height:56px;place-items:center;border-radius:15px;background:#eee;color:#555;font-size:10px;font-weight:900}.library-file-icon.mother{background:#ffe9e8;color:#d84c47}.library-file-icon.format_reference{background:#fff3dc;color:#9d680a}.library-file-icon.result{background:#e9efff;color:#356fd0}.library-file-info{min-width:0}.library-file-info h4{margin:2px 0 1px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.library-file-info p,.library-file-info small{margin:0;color:var(--muted);font-size:11px}.library-actions{grid-column:1/-1;display:flex;align-items:center;justify-content:flex-end;gap:12px;border-top:1px solid var(--line);padding-top:10px}.danger-link{border:0;background:transparent;color:var(--coral);cursor:pointer;font-weight:700}.library-empty{padding:28px}.alert.success{background:#e9f8f2;color:#14795d;border-color:#c6ecdf}
@media(max-width:1100px){.stats-grid{grid-template-columns:repeat(2,1fr)}.topic-grid{grid-template-columns:repeat(3,1fr)}.admin-edit-form{grid-template-columns:1fr 1fr}.user-editor{align-items:flex-start}.users-head,.user-row summary{grid-template-columns:minmax(180px,1fr) 80px 90px 60px 30px}.users-head span:nth-child(5),.user-row summary time{display:none}.report-table:has(.report-th span:nth-child(6)) .report-tr{grid-template-columns:minmax(190px,1.3fr) .8fr .7fr 110px 25px}.report-table:has(.report-th span:nth-child(6)) .report-tr>time{display:none}}
@media(max-width:820px){:root{--sidebar:270px}.sidebar{transform:translateX(105%);transition:.2s}.nav-open .sidebar{transform:none}.mobile-shade{display:block;position:fixed;inset:0;background:rgba(17,16,31,.5);z-index:40;opacity:0;pointer-events:none;transition:.2s}.nav-open .mobile-shade{opacity:1;pointer-events:auto}.main-area{margin:0}.topbar{height:74px;padding:0 17px}.mobile-menu{display:block}.topbar-title{margin-left:auto;margin-right:11px}.topbar-title h1{font-size:17px}.topbar-actions .system-state{display:none}.page-content{padding:19px 15px 40px}.welcome-panel{padding:21px;align-items:flex-start}.welcome-panel h2{font-size:19px}.welcome-panel p{font-size:10px}.welcome-panel .primary-button{align-self:flex-end}.quick-grid{grid-template-columns:1fr}.job-row{grid-template-columns:40px 1fr 105px 18px}.job-row time{display:none}.builder-intro{align-items:flex-start}.privacy-note{display:none}.topic-grid{grid-template-columns:repeat(2,1fr)}.detail-grid{grid-template-columns:1fr}.report-tr{grid-template-columns:minmax(170px,1fr) 110px 25px!important}.report-tr>span:nth-child(2),.report-tr>span:nth-child(3),.report-tr>time{display:none}.report-th span:nth-child(4){display:block!important}.users-head,.user-row summary{grid-template-columns:1fr 85px 30px}.users-head span:nth-child(2),.users-head span:nth-child(4),.user-row summary>span:nth-child(2),.user-row summary>span:nth-child(4){display:none}.user-editor{flex-direction:column}.admin-edit-form{width:100%}.account-grid{grid-template-columns:1fr}.login-layout{grid-template-columns:1fr}.login-visual{display:none}.login-panel{padding:25px}.login-mobile-brand{display:flex;color:#242238;margin:0 0 35px}.login-mobile-brand .brand-mark{color:#fff}.flow-tabs{gap:9px}.flow-tab{padding:12px}.flow-tab .tab-icon{width:39px;height:39px}.date-range-box{grid-template-columns:1fr}.date-range-box .range-arrow{transform:rotate(-90deg);margin:auto}.section-intro{align-items:flex-end}}
@media(max-width:560px){body{font-size:13px}.topbar-actions .primary-button{font-size:0;width:38px;height:38px;padding:0}.topbar-actions .primary-button span{font-size:18px}.welcome-panel{display:block}.welcome-panel .primary-button{margin-top:15px;width:100%}.stats-grid{grid-template-columns:1fr 1fr;gap:9px}.stat-card{padding:12px;gap:9px}.stat-icon{width:37px;height:37px}.stat-card strong{font-size:20px}.stat-card em{display:none}.quick-card{padding:17px;min-height:135px}.quick-icon{width:48px;height:48px}.recent-card{padding:15px}.job-row{grid-template-columns:35px minmax(0,1fr) 18px}.job-row .status-badge{display:none}.builder-intro h2,.section-intro h2{font-size:17px}.flow-tabs{grid-template-columns:1fr}.builder-form{padding:17px}.upload-grid,.two-cols{grid-template-columns:1fr}.dropzone{min-height:140px}.preset-row{overflow:auto;padding-bottom:3px}.submit-row{display:block}.submit-row>span{display:block;margin-bottom:10px}.submit-row .primary-button{width:100%}.topic-tools{align-items:stretch;gap:8px;flex-direction:column}.search-input{max-width:none}.topic-tools>div{justify-content:space-between}.topic-grid{grid-template-columns:1fr 1fr;max-height:290px}.date-range-box>div{grid-template-columns:1fr 1fr}.report-hero{padding:17px}.report-hero-top{align-items:flex-start}.report-identity .job-type{display:none}.report-identity h2{font-size:15px}.status-badge.big{font-size:0;padding:8px}.status-badge.big b{display:none}.result-panel,.error-panel{flex-wrap:wrap}.result-panel .primary-button,.error-panel .secondary-button{width:100%}.cancel-row{align-items:flex-start;flex-direction:column}.user-summary{grid-template-columns:1fr 1fr}.user-summary>div:last-child{display:none}.users-head,.user-row summary{grid-template-columns:1fr 28px}.users-head span:nth-child(3),.user-row summary>span:nth-child(3){display:none}.admin-edit-form{grid-template-columns:1fr}.section-intro .primary-button{font-size:0;width:42px;height:42px;padding:0}.section-intro .primary-button::first-letter{font-size:20px}.profile-card{padding:22px}.password-card{padding:18px}}

/* ============================================================
   Vazirmatn Font (Google Fonts / jsDelivr CDN)
   ============================================================ */
@import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css');

/* ============================================================
   Design Tokens
   ============================================================ */
:root {
  --font-sans: 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;

  --brand-50:  #f0eefe;
  --brand-100: #e0ddfd;
  --brand-200: #c4bffb;
  --brand-300: #a49ef7;
  --brand-400: #857df2;
  --brand-500: #6b5ee8;
  --brand-600: #5b4bdb;
  --brand-700: #4a3bc4;
  --brand-800: #3a2ea3;
  --brand-900: #2e2582;

  --ink-900: #14122b;
  --ink-800: #1e1b3a;
  --ink-700: #2d2a4a;
  --ink-600: #4a4666;
  --ink-500: #6b678a;
  --ink-400: #908cab;
  --ink-300: #b8b5cc;
  --ink-200: #d6d4e3;
  --ink-100: #eae9f0;
  --ink-50:  #f5f4f9;

  --surface: #ffffff;
  --surface-raised: #ffffff;
  --bg: #f7f6fb;
  --bg-alt: #f0eef7;

  --green-500: #16a34a;
  --green-50: #f0fdf4;
  --green-100: #dcfce7;

  --red-500: #dc2626;
  --red-50: #fef2f2;
  --red-100: #fee2e2;

  --amber-500: #d97706;
  --amber-50: #fffbeb;
  --amber-100: #fef3c7;

  --blue-500: #2563eb;
  --blue-50: #eff6ff;
  --blue-100: #dbeafe;

  --coral-500: #e11d48;
  --coral-50: #fff1f2;
  --coral-100: #ffe4e6;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --radius-full: 999px;

  --shadow-xs: 0 1px 2px rgba(20, 18, 43, .05);
  --shadow-sm: 0 1px 4px rgba(20, 18, 43, .07), 0 1px 2px rgba(20, 18, 43, .04);
  --shadow: 0 4px 14px rgba(20, 18, 43, .08), 0 1px 3px rgba(20, 18, 43, .05);
  --shadow-md: 0 8px 26px rgba(20, 18, 43, .10), 0 2px 6px rgba(20, 18, 43, .05);
  --shadow-lg: 0 18px 48px rgba(20, 18, 43, .14), 0 4px 12px rgba(20, 18, 43, .06);
  --shadow-glow: 0 0 0 4px rgba(107, 94, 232, .16);

  --transition: .22s cubic-bezier(.4, 0, .2, 1);
  --transition-fast: .14s cubic-bezier(.4, 0, .2, 1);
  --transition-slow: .4s cubic-bezier(.4, 0, .2, 1);

  --sidebar-w: 276px;
  --topbar-h: 72px;
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: 14.5px;
  line-height: 1.75;
  color: var(--ink-800);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button { cursor: pointer; border: none; background: none; }
button:disabled { cursor: not-allowed; opacity: .55; }

img, svg { display: block; max-width: 100%; }

ul, ol { list-style: none; }

::selection {
  background: var(--brand-200);
  color: var(--brand-900);
}

:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ============================================================
   Typography
   ============================================================ */
h1, h2, h3, h4 {
  font-weight: 700;
  line-height: 1.4;
  color: var(--ink-900);
}

h1 { font-size: 1.65rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: 1rem; }

.eyebrow {
  display: inline-block;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--brand-600);
  text-transform: uppercase;
}

.muted { color: var(--ink-500); font-size: .9rem; }

code {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: .85em;
  background: var(--ink-100);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  color: var(--ink-700);
}

/* ============================================================
   App Shell / Sidebar
   ============================================================ */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: linear-gradient(175deg, var(--brand-800) 0%, var(--ink-900) 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  overflow-y: auto;
  z-index: 40;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.15) transparent;
}

.sidebar::-webkit-scrollbar { width: 5px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 4px; }

.sidebar > * { flex-shrink: 0; }

/* Brand */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 16px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--brand-400), var(--brand-600));
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(107,94,232,.4);
}

.brand-mark svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: #fff;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand > span:last-child {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand strong {
  font-size: .95rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand small {
  font-size: .7rem;
  color: rgba(255,255,255,.5);
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Nav */
.main-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.nav-label {
  font-size: .68rem;
  font-weight: 600;
  color: rgba(255,255,255,.35);
  padding: 16px 12px 6px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.main-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: rgba(255,255,255,.7);
  font-size: .875rem;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
}

.main-nav a:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
}

.main-nav a.active {
  background: rgba(255,255,255,.14);
  color: #fff;
  font-weight: 600;
}

.main-nav a.active::before {
  content: '';
  position: absolute;
  right: -16px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 22px;
  border-radius: 3px 0 0 3px;
  background: var(--brand-300);
}

.nav-icon {
  width: 22px;
  text-align: center;
  font-size: 1rem;
  flex-shrink: 0;
  opacity: .85;
}

.main-nav a em {
  margin-right: auto;
  font-size: .65rem;
  font-style: normal;
  background: rgba(255,255,255,.14);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 600;
  color: rgba(255,255,255,.8);
}

/* Sidebar help */
.sidebar-help {
  margin-top: 16px;
  padding: 14px;
  border-radius: var(--radius);
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.08);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.help-orb {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,.14);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: .85rem;
  margin-bottom: 4px;
}

.sidebar-help strong { font-size: .8rem; color: #fff; }
.sidebar-help p { font-size: .72rem; color: rgba(255,255,255,.5); line-height: 1.6; }

/* Sidebar user */
.sidebar-user {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-user > a {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.sidebar-user strong {
  font-size: .82rem;
  color: #fff;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user small {
  font-size: .68rem;
  color: rgba(255,255,255,.45);
}

/* Avatar */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--brand-400), var(--brand-600));
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: .9rem;
  color: #fff;
  flex-shrink: 0;
  user-select: none;
}

.avatar.small { width: 34px; height: 34px; font-size: .82rem; border-radius: var(--radius-sm); }
.avatar.giant {
  width: 84px;
  height: 84px;
  font-size: 2rem;
  border-radius: var(--radius-xl);
  box-shadow: 0 8px 24px rgba(107,94,232,.35);
}

.icon-button {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  color: rgba(255,255,255,.6);
  font-size: 1rem;
  transition: var(--transition);
  flex-shrink: 0;
}

.icon-button:hover {
  background: rgba(255,255,255,.1);
  color: #fff;
}

/* Mobile shade */
.mobile-shade {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20,18,43,.5);
  backdrop-filter: blur(4px);
  z-index: 35;
}

.mobile-shade.show { display: block; }

/* ============================================================
   Main Area
   ============================================================ */
.main-area {
  flex: 1;
  margin-right: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar-h);
  background: rgba(247,246,251,.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--ink-100);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
}

.mobile-menu {
  display: none;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  font-size: 1.2rem;
  color: var(--ink-700);
  background: var(--surface);
  border: 1px solid var(--ink-100);
  place-items: center;
}

.topbar-title { flex: 1; min-width: 0; }

.topbar-title .eyebrow { font-size: .68rem; margin-bottom: 1px; }

.topbar-title h1 {
  font-size: 1.25rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.system-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: .75rem;
  color: var(--ink-500);
  font-weight: 500;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-full);
}

.system-state i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green-500);
  box-shadow: 0 0 0 3px var(--green-100);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 3px var(--green-100); }
  50% { box-shadow: 0 0 0 6px rgba(22,163,74,.08); }
}

/* Page content */
.page-content {
  flex: 1;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ============================================================
   Buttons
   ============================================================ */
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  color: #fff;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: .875rem;
  box-shadow: 0 3px 12px rgba(107,94,232,.3);
  transition: var(--transition);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.primary-button::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent, rgba(255,255,255,.15));
  opacity: 0;
  transition: var(--transition);
}

.primary-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(107,94,232,.4);
}

.primary-button:hover::after { opacity: 1; }

.primary-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(107,94,232,.3);
}

.primary-button.compact {
  padding: 8px 16px;
  font-size: .8rem;
  border-radius: var(--radius-sm);
}

.primary-button.wide { width: 100%; }

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 20px;
  background: var(--surface);
  color: var(--ink-700);
  border: 1.5px solid var(--ink-200);
  border-radius: var(--radius);
  font-weight: 600;
  font-size: .875rem;
  transition: var(--transition);
  white-space: nowrap;
}

.secondary-button:hover {
  border-color: var(--brand-300);
  color: var(--brand-700);
  background: var(--brand-50);
}

.secondary-button.small {
  padding: 6px 14px;
  font-size: .78rem;
  border-radius: var(--radius-sm);
}

.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 20px;
  background: var(--red-50);
  color: var(--red-500);
  border: 1.5px solid var(--red-100);
  border-radius: var(--radius);
  font-weight: 600;
  font-size: .875rem;
  transition: var(--transition);
}

.danger-button:hover {
  background: var(--red-100);
  border-color: var(--red-500);
}

.danger-button.compact {
  padding: 8px 16px;
  font-size: .8rem;
  border-radius: var(--radius-sm);
}

.danger-link {
  color: var(--red-500);
  font-size: .78rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.danger-link:hover { background: var(--red-50); }

/* ============================================================
   Cards & Surfaces
   ============================================================ */
.content-card {
  background: var(--surface);
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.content-card:hover { box-shadow: var(--shadow); }

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.section-head.simple { margin-bottom: 16px; }

.section-head .eyebrow { margin-bottom: 4px; }

.section-head h2 { font-size: 1.15rem; }

.section-head a {
  font-size: .82rem;
  font-weight: 600;
  color: var(--brand-600);
  transition: var(--transition);
  white-space: nowrap;
}

.section-head a:hover { color: var(--brand-800); }

/* ============================================================
   Alerts
   ============================================================ */
.alert {
  padding: 13px 18px;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slide-down .3s ease;
}

@keyframes slide-down {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.alert.success {
  background: var(--green-50);
  color: #15803d;
  border: 1px solid var(--green-100);
}

.alert.danger {
  background: var(--red-50);
  color: #b91c1c;
  border: 1px solid var(--red-100);
}

.page-alert { margin-bottom: 4px; }

/* ============================================================
   Form Fields
   ============================================================ */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.field > span:first-child {
  font-size: .8rem;
  font-weight: 600;
  color: var(--ink-700);
}

.field > span:first-child small {
  font-weight: 400;
  color: var(--ink-400);
  font-size: .72rem;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface);
  border: 1.5px solid var(--ink-200);
  border-radius: var(--radius);
  font-size: .875rem;
  color: var(--ink-800);
  transition: var(--transition);
  outline: none;
}

.field input::placeholder,
.field textarea::placeholder { color: var(--ink-300); }

.field input:hover,
.field select:hover,
.field textarea:hover { border-color: var(--ink-300); }

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--brand-500);
  box-shadow: var(--shadow-glow);
  background: #fff;
}

.field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b678a' d='M6 8.825 1.4 4.2l.7-.7L6 7.425 9.9 3.5l.7.7z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 14px center;
  padding-left: 36px;
  cursor: pointer;
}

.field textarea { resize: vertical; min-height: 100px; line-height: 1.8; }

.field-note {
  font-size: .75rem;
  color: var(--ink-400);
  line-height: 1.7;
}

/* Input wrap with icon */
.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrap i {
  position: absolute;
  right: 14px;
  font-style: normal;
  color: var(--ink-400);
  font-size: .9rem;
  pointer-events: none;
  z-index: 1;
}

.input-wrap input { padding-right: 40px; }

.password-toggle {
  position: absolute;
  left: 10px;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  color: var(--ink-400);
  font-size: .9rem;
  transition: var(--transition);
}

.password-toggle:hover { color: var(--brand-600); background: var(--brand-50); }

/* Switch */
.switch-field {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 10px 0;
  user-select: none;
}

.switch-field input { display: none; }

.switch-field > span {
  width: 44px;
  height: 24px;
  border-radius: var(--radius-full);
  background: var(--ink-200);
  position: relative;
  transition: var(--transition);
  flex-shrink: 0;
}

.switch-field > span::after {
  content: '';
  position: absolute;
  top: 3px;
  right: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-xs);
  transition: var(--transition);
}

.switch-field input:checked + span {
  background: var(--brand-500);
}

.switch-field input:checked + span::after {
  transform: translateX(-20px);
}

.switch-field b {
  font-size: .82rem;
  font-weight: 600;
  color: var(--ink-700);
}

/* ============================================================
   Dashboard
   ============================================================ */
.welcome-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 32px 36px;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, var(--brand-700) 0%, var(--brand-900) 100%);
  color: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 36px rgba(74,59,196,.28);
}

.welcome-panel::before {
  content: '';
  position: absolute;
  top: -60%;
  left: -10%;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(164,158,247,.3), transparent 70%);
  pointer-events: none;
}

.welcome-panel::after {
  content: '';
  position: absolute;
  bottom: -50%;
  right: 5%;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.08), transparent 70%);
  pointer-events: none;
}

.welcome-panel > div { position: relative; z-index: 1; }

.welcome-panel .eyebrow { color: var(--brand-200); }

.welcome-panel h2 {
  font-size: 1.6rem;
  color: #fff;
  margin: 4px 0 6px;
}

.welcome-panel p {
  font-size: .9rem;
  color: rgba(255,255,255,.65);
}

.welcome-panel .primary-button {
  position: relative;
  z-index: 1;
  background: #fff;
  color: var(--brand-700);
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
}

.welcome-panel .primary-button:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
  color: var(--brand-800);
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  box-shadow: var(--shadow-xs);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  height: 3px;
  background: var(--brand-500);
  opacity: .8;
}

.stat-card.purple::before { background: var(--brand-500); }
.stat-card.blue::before   { background: var(--blue-500); }
.stat-card.green::before  { background: var(--green-500); }
.stat-card.coral::before  { background: var(--coral-500); }

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  font-weight: 700;
}

.stat-card.purple .stat-icon { background: var(--brand-50); color: var(--brand-600); }
.stat-card.blue .stat-icon   { background: var(--blue-50); color: var(--blue-500); }
.stat-card.green .stat-icon  { background: var(--green-50); color: var(--green-500); }
.stat-card.coral .stat-icon  { background: var(--coral-50); color: var(--coral-500); }

.stat-card div { display: flex; flex-direction: column; }

.stat-card small {
  font-size: .75rem;
  color: var(--ink-400);
  font-weight: 500;
}

.stat-card strong {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--ink-900);
  line-height: 1.2;
}

.stat-card em {
  font-size: .7rem;
  font-style: normal;
  color: var(--ink-400);
  font-weight: 500;
  padding-top: 6px;
  border-top: 1px solid var(--ink-50);
}

/* Quick cards */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.quick-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 24px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--ink-100);
  box-shadow: var(--shadow-xs);
  transition: var(--transition);
  overflow: hidden;
}

.quick-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--brand-200);
}

.quick-glow {
  position: absolute;
  top: -50%;
  left: -20%;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  opacity: .5;
  pointer-events: none;
  transition: var(--transition-slow);
}

.quick-card.source .quick-glow { background: radial-gradient(circle, var(--brand-100), transparent 70%); }
.quick-card.archive .quick-glow { background: radial-gradient(circle, var(--blue-100), transparent 70%); }

.quick-card:hover .quick-glow { opacity: .8; transform: scale(1.2); }

.quick-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: .85rem;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.quick-card.source .quick-icon {
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  color: #fff;
  box-shadow: 0 6px 18px rgba(107,94,232,.3);
}

.quick-card.archive .quick-icon {
  background: linear-gradient(135deg, var(--blue-500), #1d4ed8);
  color: #fff;
  box-shadow: 0 6px 18px rgba(37,99,235,.3);
}

.quick-card > div { flex: 1; position: relative; z-index: 1; }

.quick-card small {
  font-size: .72rem;
  color: var(--ink-400);
  font-weight: 600;
}

.quick-card h3 { font-size: 1.05rem; margin: 2px 0 4px; }

.quick-card p {
  font-size: .82rem;
  color: var(--ink-500);
  line-height: 1.6;
}

.quick-card b {
  font-size: .82rem;
  color: var(--brand-600);
  font-weight: 700;
  white-space: nowrap;
  position: relative;
  z-index: 1;
  transition: var(--transition);
}

.quick-card:hover b { transform: translateX(-4px); }

/* Job list */
.job-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.job-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius);
  transition: var(--transition);
  border: 1px solid transparent;
}

.job-row:hover {
  background: var(--brand-50);
  border-color: var(--brand-100);
}

.job-type {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  font-size: .7rem;
  font-weight: 800;
  flex-shrink: 0;
}

.job-type.pdf {
  background: linear-gradient(135deg, #fee2e2, #fecaca);
  color: #b91c1c;
}

.job-type.archive {
  background: linear-gradient(135deg, var(--blue-100), #bfdbfe);
  color: #1d4ed8;
}

.job-type.large {
  width: 54px;
  height: 54px;
  font-size: .85rem;
  border-radius: var(--radius);
}

.job-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.job-main strong {
  font-size: .88rem;
  font-weight: 600;
  color: var(--ink-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.job-main small {
  font-size: .75rem;
  color: var(--ink-400);
}

.job-row time {
  font-size: .75rem;
  color: var(--ink-400);
  white-space: nowrap;
}

.row-arrow {
  color: var(--ink-300);
  font-size: .9rem;
  transition: var(--transition);
}

.job-row:hover .row-arrow {
  color: var(--brand-600);
  transform: translateX(-3px);
}

/* ============================================================
   Status Badges
   ============================================================ */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: .72rem;
  font-weight: 600;
  white-space: nowrap;
  font-style: normal;
}

.status-badge i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-badge.completed {
  background: var(--green-50);
  color: #15803d;
}
.status-badge.completed i { background: var(--green-500); }

.status-badge.processing {
  background: var(--brand-50);
  color: var(--brand-700);
}
.status-badge.processing i {
  background: var(--brand-500);
  animation: pulse-dot 1.5s ease-in-out infinite;
}

.status-badge.queued {
  background: var(--amber-50);
  color: #b45309;
}
.status-badge.queued i { background: var(--amber-500); }

.status-badge.failed {
  background: var(--red-50);
  color: #b91c1c;
}
.status-badge.failed i { background: var(--red-500); }

.status-badge.cancelled {
  background: var(--ink-100);
  color: var(--ink-500);
}
.status-badge.cancelled i { background: var(--ink-400); }

.status-badge.big {
  padding: 7px 18px;
  font-size: .82rem;
}

.status-badge.big i { width: 8px; height: 8px; }

/* Role badge */
.role-badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: var(--radius-full);
  font-size: .7rem;
  font-weight: 600;
  font-style: normal;
}

.role-badge.admin {
  background: linear-gradient(135deg, var(--brand-100), var(--brand-200));
  color: var(--brand-800);
}

.role-badge.user {
  background: var(--ink-100);
  color: var(--ink-600);
}

.green-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green-500);
  box-shadow: 0 0 0 3px var(--green-100);
  margin-left: 6px;
}

/* ============================================================
   Empty States
   ============================================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
  gap: 8px;
}

.empty-state.tall { padding: 72px 24px; }

.empty-state > span {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-lg);
  background: var(--brand-50);
  color: var(--brand-400);
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.empty-state h3 { font-size: 1.05rem; }

.empty-state p {
  font-size: .85rem;
  color: var(--ink-500);
  max-width: 340px;
}

.empty-state .primary-button { margin-top: 12px; }

.inline-empty {
  padding: 28px 20px;
  text-align: center;
  font-size: .85rem;
  color: var(--ink-400);
  background: var(--ink-50);
  border-radius: var(--radius);
  border: 1px dashed var(--ink-200);
}

.inline-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 36px 20px;
  font-size: .85rem;
  color: var(--ink-400);
}

.inline-loading i {
  width: 18px;
  height: 18px;
  border: 2.5px solid var(--ink-200);
  border-top-color: var(--brand-500);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   Account Page
   ============================================================ */
.account-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 24px;
  align-items: start;
}

.profile-card {
  background: var(--surface);
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-xl);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: calc(var(--topbar-h) + 28px);
}

.profile-card h2 { font-size: 1.15rem; margin-top: 10px; }

.profile-card > p {
  font-size: .82rem;
  color: var(--ink-400);
}

.profile-card .role-badge { margin-top: 4px; }

.profile-card dl {
  width: 100%;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--ink-100);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.profile-card dl > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.profile-card dt {
  font-size: .78rem;
  color: var(--ink-500);
  font-weight: 500;
}

.profile-card dd {
  font-size: .82rem;
  font-weight: 600;
  color: var(--ink-800);
  display: flex;
  align-items: center;
}

.password-card { padding: 28px; }

.password-card form { max-width: 420px; }

/* ============================================================
   Admin Users
   ============================================================ */
.section-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.section-intro h2 { font-size: 1.25rem; margin-bottom: 4px; }

.section-intro p {
  font-size: .85rem;
  color: var(--ink-500);
}

.user-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.user-summary > div {
  background: var(--surface);
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-xs);
  transition: var(--transition);
}

.user-summary > div:hover { box-shadow: var(--shadow); }

.user-summary > div > span {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: var(--brand-50);
  color: var(--brand-600);
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.user-summary p { display: flex; flex-direction: column; }

.user-summary strong {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--ink-900);
  line-height: 1.2;
}

.user-summary small {
  font-size: .75rem;
  color: var(--ink-400);
}

/* Users card */
.users-card { padding: 0; overflow: hidden; }

.users-head {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr .8fr 1.2fr 40px;
  gap: 12px;
  padding: 14px 20px;
  background: var(--ink-50);
  border-bottom: 1px solid var(--ink-100);
  font-size: .72rem;
  font-weight: 700;
  color: var(--ink-500);
  letter-spacing: .02em;
}

.user-row {
  border-bottom: 1px solid var(--ink-50);
  transition: var(--transition);
}

.user-row:last-child { border-bottom: none; }

.user-row summary {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr .8fr 1.2fr 40px;
  gap: 12px;
  align-items: center;
  padding: 14px 20px;
  cursor: pointer;
  transition: var(--transition);
  list-style: none;
}

.user-row summary::-webkit-details-marker { display: none; }

.user-row summary:hover { background: var(--brand-50); }

.user-row[open] summary {
  background: var(--brand-50);
  border-bottom: 1px solid var(--brand-100);
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.user-cell > span {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-cell b {
  font-size: .85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-cell small {
  font-size: .72rem;
  color: var(--ink-400);
}

.user-row summary > span {
  font-size: .82rem;
  color: var(--ink-600);
}

.user-row summary time {
  font-size: .75rem;
  color: var(--ink-400);
}

.more-button {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  color: var(--ink-400);
  font-size: .85rem;
  transition: var(--transition);
  letter-spacing: 1px;
}

.user-row summary:hover .more-button {
  background: var(--brand-100);
  color: var(--brand-700);
}

.user-editor {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--ink-50);
  animation: slide-down .25s ease;
}

.admin-edit-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  align-items: end;
}

.admin-edit-form .field { margin-bottom: 0; }

.admin-edit-form .switch-field { padding-bottom: 10px; }

.admin-edit-form .primary-button { align-self: end; justify-self: start; }

.user-editor > form:last-child:not(:only-child) { align-self: flex-start; }

/* ============================================================
   Dialogs
   ============================================================ */
.app-dialog {
  border: none;
  border-radius: var(--radius-xl);
  padding: 0;
  max-width: 520px;
  width: calc(100% - 32px);
  box-shadow: var(--shadow-lg);
  animation: dialog-in .28s cubic-bezier(.34,1.56,.64,1);
  background: var(--surface);
}

.app-dialog::backdrop {
  background: rgba(20,18,43,.5);
  backdrop-filter: blur(6px);
}

@keyframes dialog-in {
  from { opacity: 0; transform: scale(.94) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 24px 28px 16px;
  border-bottom: 1px solid var(--ink-100);
}

.dialog-head .eyebrow { margin-bottom: 3px; }

.dialog-head h2 { font-size: 1.2rem; }

.dialog-head button {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  font-size: 1.3rem;
  color: var(--ink-400);
  transition: var(--transition);
  line-height: 1;
}

.dialog-head button:hover {
  background: var(--red-50);
  color: var(--red-500);
}

.dialog-body { padding: 24px 28px; }

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 28px 24px;
  border-top: 1px solid var(--ink-100);
}

/* ============================================================
   Reports Table
   ============================================================ */
.table-card { padding: 0; overflow: hidden; }

.report-table { display: flex; flex-direction: column; }

.report-tr {
  display: grid;
  grid-template-columns: 2.5fr 1fr 1fr 1.2fr 1.2fr 40px;
  gap: 12px;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--ink-50);
  transition: var(--transition);
  font-size: .85rem;
  color: var(--ink-700);
}

.report-tr.report-th {
  background: var(--ink-50);
  border-bottom: 1px solid var(--ink-100);
  font-size: .72rem;
  font-weight: 700;
  color: var(--ink-500);
  padding: 14px 20px;
}

a.report-tr:hover {
  background: var(--brand-50);
}

a.report-tr:last-child { border-bottom: none; }

.report-title {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.report-title b {
  font-size: .85rem;
  font-weight: 600;
  color: var(--ink-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.report-tr time { font-size: .75rem; color: var(--ink-400); }

.report-tr .row-arrow { justify-self: center; }

/* ============================================================
   Library
   ============================================================ */
.library-intro {
  background: linear-gradient(135deg, var(--surface), var(--brand-50));
  border: 1px solid var(--brand-100);
  border-radius: var(--radius-xl);
  padding: 28px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.library-intro h2 { font-size: 1.3rem; margin: 4px 0 6px; }

.library-intro p {
  font-size: .85rem;
  color: var(--ink-500);
  max-width: 480px;
}

.library-section {
  background: var(--surface);
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.library-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.library-section-head h3 { font-size: 1.05rem; }

.library-section-head p {
  font-size: .8rem;
  color: var(--ink-500);
  margin-top: 2px;
}

.library-section-head > span {
  font-size: .72rem;
  font-weight: 600;
  color: var(--brand-600);
  background: var(--brand-50);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.library-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--ink-100);
  border-radius: var(--radius);
  transition: var(--transition);
  background: var(--surface);
}

.library-card:hover {
  border-color: var(--brand-200);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.library-file-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  font-size: .65rem;
  font-weight: 800;
  flex-shrink: 0;
  letter-spacing: .02em;
}

.library-file-icon.mother {
  background: linear-gradient(135deg, #fee2e2, #fecaca);
  color: #b91c1c;
}

.library-file-icon.format,
.library-file-icon.sample {
  background: linear-gradient(135deg, var(--blue-100), #bfdbfe);
  color: #1d4ed8;
}

.library-file-icon.result {
  background: linear-gradient(135deg, var(--green-100), #bbf7d0);
  color: #15803d;
}

.library-file-info {
  flex: 1;
  min-width: 0;
}

.library-file-info h4 {
  font-size: .82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.library-file-info p {
  font-size: .72rem;
  color: var(--ink-400);
  margin-top: 2px;
}

.library-file-info small {
  font-size: .68rem;
  color: var(--ink-300);
}

.library-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.library-empty { margin-top: 4px; }

/* ============================================================
   New Report Builder
   ============================================================ */
.builder-shell {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.builder-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: var(--surface);
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-xl);
  padding: 24px 28px;
  box-shadow: var(--shadow-sm);
}

.builder-intro h2 { font-size: 1.25rem; margin: 4px 0 5px; }

.builder-intro p {
  font-size: .85rem;
  color: var(--ink-500);
  max-width: 500px;
}

.privacy-note {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: var(--brand-50);
  border: 1px solid var(--brand-100);
  border-radius: var(--radius);
  transition: var(--transition);
  min-width: 220px;
}

.privacy-note:hover {
  background: var(--brand-100);
  border-color: var(--brand-200);
}

.privacy-note > span {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--brand-500);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: .95rem;
  flex-shrink: 0;
}

.privacy-note p {
  display: flex;
  flex-direction: column;
  font-size: .72rem;
  color: var(--ink-500);
  line-height: 1.5;
}

.privacy-note strong {
  font-size: .8rem;
  color: var(--brand-800);
  font-weight: 700;
}

/* Flow tabs */
.flow-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.flow-tab {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 22px;
  background: var(--surface);
  border: 2px solid var(--ink-100);
  border-radius: var(--radius-lg);
  transition: var(--transition);
  text-align: right;
  position: relative;
}

.flow-tab:hover {
  border-color: var(--brand-200);
  background: var(--brand-50);
}

.flow-tab.active {
  border-color: var(--brand-500);
  background: var(--brand-50);
  box-shadow: 0 0 0 4px rgba(107,94,232,.1);
}

.tab-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  font-size: .8rem;
  font-weight: 800;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  color: #fff;
}

.flow-tab > span:nth-child(2) {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.flow-tab b { font-size: .9rem; color: var(--ink-900); }

.flow-tab small {
  font-size: .72rem;
  color: var(--ink-400);
  font-weight: 400;
}

.flow-tab > i {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--ink-200);
  display: grid;
  place-items: center;
  font-size: .7rem;
  color: transparent;
  transition: var(--transition);
  flex-shrink: 0;
  font-style: normal;
}

.flow-tab.active > i {
  background: var(--brand-500);
  border-color: var(--brand-500);
  color: #fff;
}

/* Builder form */
.builder-form {
  display: none;
  background: var(--surface);
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow-sm);
  flex-direction: column;
  gap: 8px;
}

.builder-form.active { display: flex; animation: fade-in .3s ease; }

@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.form-step {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin: 20px 0 14px;
  padding-top: 20px;
  border-top: 1px solid var(--ink-100);
}

.form-step:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.form-step > span {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  color: #fff;
  display: grid;
  place-items: center;
  font-size: .82rem;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(107,94,232,.25);
}

.form-step h3 { font-size: 1rem; margin-bottom: 2px; }

.form-step p {
  font-size: .78rem;
  color: var(--ink-400);
}

/* Dropzone */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 36px 24px;
  border: 2px dashed var(--ink-200);
  border-radius: var(--radius-lg);
  background: var(--ink-50);
  cursor: pointer;
  transition: var(--transition);
  gap: 6px;
  position: relative;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--brand-400);
  background: var(--brand-50);
}

.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  background: var(--brand-100);
  color: var(--brand-600);
  display: grid;
  place-items: center;
  font-size: 1.3rem;
  margin-bottom: 6px;
  transition: var(--transition);
}

.dropzone:hover .upload-icon {
  background: var(--brand-200);
  transform: scale(1.05);
}

.dropzone strong { font-size: .92rem; color: var(--ink-800); }

.dropzone p {
  font-size: .8rem;
  color: var(--ink-400);
}

.dropzone small {
  font-size: .72rem;
  color: var(--ink-400);
  background: var(--surface);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--ink-100);
  margin-top: 4px;
}

.dropzone.is-collapsed {
  display: none;
}

.dropzone.has-file {
  border-color: var(--green-500);
  background: var(--green-50);
}

.dropzone.has-file .upload-icon {
  background: var(--green-100);
  color: var(--green-500);
}

/* Saved picker */
.saved-picker {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.saved-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.saved-picker-head > span {
  font-size: .82rem;
  font-weight: 600;
  color: var(--ink-700);
}

.saved-picker-head small {
  font-size: .72rem;
  color: var(--ink-400);
}

.saved-file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}

.compact-list {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.saved-file-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1.5px solid var(--ink-100);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  background: var(--surface);
}

.saved-file-card:hover {
  border-color: var(--brand-200);
  background: var(--brand-50);
}

.saved-file-card input { display: none; }

.saved-file-card:has(input:checked) {
  border-color: var(--brand-500);
  background: var(--brand-50);
  box-shadow: 0 0 0 3px rgba(107,94,232,.1);
}

.saved-file-card > span:nth-child(3) {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.saved-file-card strong {
  font-size: .8rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.saved-file-card small {
  font-size: .7rem;
  color: var(--ink-400);
}

.saved-file-card > i {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--ink-200);
  display: grid;
  place-items: center;
  font-size: .65rem;
  color: transparent;
  transition: var(--transition);
  flex-shrink: 0;
  font-style: normal;
}

.saved-file-card:has(input:checked) > i {
  background: var(--brand-500);
  border-color: var(--brand-500);
  color: #fff;
}

.file-kind {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  font-size: .62rem;
  font-weight: 800;
  flex-shrink: 0;
}

.file-kind.pdf {
  background: linear-gradient(135deg, #fee2e2, #fecaca);
  color: #b91c1c;
}

.file-kind.new {
  background: var(--brand-50);
  color: var(--brand-600);
  font-size: 1.1rem;
  border: 1.5px dashed var(--brand-300);
}

.file-kind.sample {
  background: linear-gradient(135deg, var(--blue-100), #bfdbfe);
  color: #1d4ed8;
}

.file-kind.result {
  background: linear-gradient(135deg, var(--green-100), #bbf7d0);
  color: #15803d;
}

/* Format box */
.format-box {
  background: var(--ink-50);
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.preset-row button {
  padding: 7px 16px;
  border-radius: var(--radius-full);
  background: var(--surface);
  border: 1px solid var(--ink-200);
  font-size: .78rem;
  font-weight: 600;
  color: var(--ink-600);
  transition: var(--transition);
}

.preset-row button:hover {
  border-color: var(--brand-400);
  color: var(--brand-700);
  background: var(--brand-50);
}

.format-box textarea {
  width: 100%;
  padding: 14px;
  border: 1.5px solid var(--ink-200);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: .85rem;
  line-height: 1.9;
  resize: vertical;
  transition: var(--transition);
  outline: none;
}

.format-box textarea:focus {
  border-color: var(--brand-500);
  box-shadow: var(--shadow-glow);
}

.format-box small {
  font-size: .72rem;
  color: var(--ink-400);
}

.format-reference-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 6px;
}

.compact-upload {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1.5px dashed var(--ink-200);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  background: var(--ink-50);
}

.compact-upload:hover {
  border-color: var(--brand-400);
  background: var(--brand-50);
}

.compact-upload input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.compact-upload .upload-icon {
  width: 38px;
  height: 38px;
  font-size: 1rem;
  margin: 0;
  flex-shrink: 0;
}

.compact-upload > span:last-child {
  display: flex;
  flex-direction: column;
}

.compact-upload strong { font-size: .82rem; }

.compact-upload small {
  font-size: .72rem;
  color: var(--ink-400);
}

/* Topic picker */
.topic-picker {
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
}

.topic-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--ink-50);
  border-bottom: 1px solid var(--ink-100);
  flex-wrap: wrap;
}

.search-input {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1.5px solid var(--ink-200);
  border-radius: var(--radius);
  flex: 1;
  min-width: 180px;
  transition: var(--transition);
}

.search-input:focus-within {
  border-color: var(--brand-500);
  box-shadow: var(--shadow-glow);
}

.search-input span { color: var(--ink-400); font-size: .9rem; }

.search-input input {
  border: none;
  background: none;
  outline: none;
  width: 100%;
  font-size: .82rem;
}

.topic-tools > div {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topic-tools button {
  font-size: .78rem;
  font-weight: 600;
  color: var(--brand-600);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.topic-tools button:hover:not(:disabled) { background: var(--brand-50); }

.topic-tools > div > span {
  font-size: .75rem;
  color: var(--ink-500);
  white-space: nowrap;
}

.topic-tools b { color: var(--brand-600); font-weight: 700; }

.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 6px;
  padding: 14px;
  max-height: 280px;
  overflow-y: auto;
}

.topic-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: .8rem;
  cursor: pointer;
  transition: var(--transition-fast);
  border: 1px solid transparent;
}

.topic-grid label:hover { background: var(--brand-50); }

.topic-grid input { accent-color: var(--brand-500); width: 16px; height: 16px; }

.topic-grid label:has(input:checked) {
  background: var(--brand-50);
  border-color: var(--brand-200);
  font-weight: 600;
}

.hidden { display: none !important; }

/* Date range */
.date-range-box {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--ink-50);
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-lg);
  padding: 18px;
  flex-wrap: wrap;
}

.date-range-box > div {
  flex: 1;
  min-width: 220px;
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.date-range-box .field { margin-bottom: 0; flex: 1; }

.range-label {
  font-size: .75rem;
  font-weight: 600;
  color: var(--brand-600);
  white-space: nowrap;
  padding-bottom: 12px;
}

.range-arrow {
  font-size: 1.2rem;
  color: var(--ink-300);
  flex-shrink: 0;
  padding-bottom: 8px;
}

.range-hint {
  font-size: .75rem;
  color: var(--ink-400);
  background: var(--amber-50);
  border: 1px solid var(--amber-100);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-top: 8px;
  line-height: 1.7;
}

/* Submit row */
.submit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--ink-100);
  flex-wrap: wrap;
}

.submit-row > span {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .8rem;
  color: var(--ink-500);
}

.submit-row > span i {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--green-50);
  color: var(--green-500);
  display: grid;
  place-items: center;
  font-size: .65rem;
  font-style: normal;
}

.submit-row .primary-button {
  padding: 13px 28px;
  font-size: .9rem;
}

.button-loading { display: none; }

.primary-button.loading .button-text { display: none; }
.primary-button.loading .button-loading { display: inline; }

.primary-button.loading {
  pointer-events: none;
  opacity: .8;
}

/* ============================================================
   Report Detail
   ============================================================ */
.report-hero {
  background: var(--surface);
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-xl);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.report-hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.report-identity {
  display: flex;
  align-items: center;
  gap: 16px;
}

.report-identity .eyebrow { margin-bottom: 2px; }

.report-identity h2 { font-size: 1.3rem; margin-bottom: 4px; }

.report-identity p {
  font-size: .78rem;
  color: var(--ink-400);
}

/* Progress panel */
.progress-panel {
  background: var(--ink-50);
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.progress-panel.finished { display: none; }

.progress-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.progress-copy > span {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: .85rem;
  color: var(--ink-700);
}

.progress-copy strong {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--brand-600);
}

.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand-500);
  animation: pulse-dot 1.5s ease-in-out infinite;
}

.progress-track {
  height: 8px;
  background: var(--ink-100);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-track > i {
  display: block;
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--brand-500), var(--brand-400));
  transition: width .6s cubic-bezier(.4,0,.2,1);
  position: relative;
}

.progress-track > i::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.3), transparent);
  animation: shimmer 1.8s infinite;
}

@keyframes shimmer {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

.progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: .75rem;
  color: var(--ink-400);
  flex-wrap: wrap;
}

/* Result & error panels */
.result-panel,
.error-panel {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border-radius: var(--radius-lg);
  flex-wrap: wrap;
}

.result-panel {
  background: var(--green-50);
  border: 1px solid var(--green-100);
}

.result-panel.hidden { display: none; }

.result-check {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--green-500);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(22,163,74,.3);
}

.result-panel > div { flex: 1; }

.result-panel h3 { font-size: 1rem; color: #15803d; margin-bottom: 2px; }

.result-panel p { font-size: .8rem; color: #166534; }

.error-panel {
  background: var(--red-50);
  border: 1px solid var(--red-100);
}

.error-panel.hidden { display: none; }

.error-panel > span {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--red-500);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  font-weight: 700;
  flex-shrink: 0;
}

.error-panel > div { flex: 1; }

.error-panel h3 { font-size: 1rem; color: #b91c1c; margin-bottom: 2px; }

.error-panel p { font-size: .8rem; color: #991b1b; }

/* Detail grid */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.detail-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--ink-50);
}

.detail-list > div:last-child { border-bottom: none; }

.detail-list dt {
  font-size: .8rem;
  color: var(--ink-500);
}

.detail-list dd {
  font-size: .82rem;
  font-weight: 600;
  color: var(--ink-800);
}

.instruction-copy {
  font-size: .85rem;
  color: var(--ink-600);
  line-height: 2;
  white-space: pre-wrap;
  background: var(--ink-50);
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--ink-100);
}

.cancel-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.cancel-row small {
  font-size: .75rem;
  color: var(--ink-400);
}

/* ============================================================
   Error Page
   ============================================================ */
.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 60vh;
  gap: 10px;
  padding: 40px 20px;
}

.error-page > strong {
  font-size: 5rem;
  font-weight: 900;
  line-height: 1;
  background: linear-gradient(135deg, var(--brand-400), var(--brand-700));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -.02em;
}

.error-page h2 { font-size: 1.3rem; }

.error-page p {
  font-size: .88rem;
  color: var(--ink-500);
  max-width: 380px;
}

.error-page .primary-button { margin-top: 16px; }

/* ============================================================
   Login Page
   ============================================================ */
.login-page {
  min-height: 100vh;
  background: var(--bg);
  display: grid;
  place-items: center;
}

.login-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  min-height: 100vh;
}

.login-visual {
  position: relative;
  background: linear-gradient(155deg, var(--brand-700) 0%, var(--brand-900) 50%, var(--ink-900) 100%);
  padding: 48px;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.visual-noise {
  position: absolute;
  inset: 0;
  opacity: .04;
  background-image: radial-gradient(circle at 20% 30%, #fff 1px, transparent 1px),
    radial-gradient(circle at 80% 70%, #fff 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

.visual-copy {
  position: relative;
  z-index: 2;
  max-width: 460px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 36px;
}

.login-brand .brand-mark { width: 40px; height: 40px; }

.visual-badge {
  display: inline-block;
  padding: 6px 16px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.15);
  color: var(--brand-200);
  font-size: .75rem;
  font-weight: 600;
  margin-bottom: 20px;
  backdrop-filter: blur(8px);
}

.visual-copy h1 {
  font-size: 2.1rem;
  color: #fff;
  line-height: 1.45;
  margin-bottom: 16px;
  font-weight: 800;
}

.visual-copy h1 em {
  font-style: normal;
  background: linear-gradient(135deg, var(--brand-200), var(--brand-300));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.visual-copy > p {
  font-size: .92rem;
  color: rgba(255,255,255,.6);
  line-height: 2;
  margin-bottom: 28px;
}

.visual-points {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.visual-points span {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .85rem;
  color: rgba(255,255,255,.8);
}

.visual-points i {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  color: var(--brand-200);
  display: grid;
  place-items: center;
  font-size: .68rem;
  font-style: normal;
  flex-shrink: 0;
}

/* Floating cards */
.floating-card {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: rgba(255,255,255,.95);
  border-radius: var(--radius);
  box-shadow: 0 12px 36px rgba(0,0,0,.2);
  backdrop-filter: blur(12px);
  z-index: 3;
  animation: float 6s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.floating-card > span {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--brand-50);
  color: var(--brand-600);
  display: grid;
  place-items: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.floating-card > div {
  display: flex;
  flex-direction: column;
}

.floating-card b {
  font-size: .8rem;
  font-weight: 700;
  color: var(--ink-900);
}

.floating-card small {
  font-size: .68rem;
  color: var(--ink-400);
}

.floating-card > i {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--green-500);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: .65rem;
  font-style: normal;
  flex-shrink: 0;
}

.card-a { top: 12%; left: 8%; animation-delay: 0s; }
.card-b { bottom: 14%; right: 6%; animation-delay: 3s; }

.mini-progress {
  width: 60px;
  height: 5px;
  border-radius: var(--radius-full);
  background: var(--ink-100);
  overflow: hidden;
  flex-shrink: 0;
}

.mini-progress i {
  display: block;
  width: 75%;
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--brand-500), var(--brand-400));
}

/* Login panel */
.login-panel {
  display: grid;
  place-items: center;
  padding: 48px 32px;
  background: var(--bg);
}

.login-card {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.login-mobile-brand {
  display: none;
  align-items: center;
  gap: 10px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink-900);
  margin-bottom: 24px;
}

.login-card h2 { font-size: 1.5rem; margin: 6px 0 6px; }

.login-card .muted { margin-bottom: 20px; }

.login-card .alert { margin-bottom: 16px; }

.login-card .field { margin-bottom: 16px; }

.login-submit { margin-top: 8px; padding: 13px 24px; font-size: .92rem; }

.login-footnote {
  display: block;
  text-align: center;
  font-size: .72rem;
  color: var(--ink-400);
  margin-top: 18px;
  line-height: 1.7;
}

/* ============================================================
   Toast Stack
   ============================================================ */
.toast-stack {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--ink-900);
  color: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: .85rem;
  animation: toast-in .35s cubic-bezier(.34,1.56,.64,1);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(-20px) scale(.96); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

.toast.success { background: var(--green-500); }
.toast.error   { background: var(--red-500); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .quick-grid { grid-template-columns: 1fr; }
  .account-grid { grid-template-columns: 1fr; }
  .profile-card { position: static; }
  .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 1024px) {
  .login-layout { grid-template-columns: 1fr; }
  .login-visual { display: none; }
  .login-mobile-brand { display: flex; }
  .login-panel { padding: 32px 20px; }
  .floating-card { display: none; }
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(100%);
    transition: transform var(--transition-slow);
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open { transform: translateX(0); }

  .main-area { margin-right: 0; }

  .mobile-menu { display: grid; }

  .topbar { padding: 0 16px; gap: 12px; }

  .topbar-actions .system-state { display: none; }

  .page-content { padding: 16px; gap: 16px; }

  .welcome-panel {
    flex-direction: column;
    align-items: flex-start;
    padding: 24px;
  }

  .welcome-panel h2 { font-size: 1.3rem; }

  .users-head { display: none; }

  .user-row summary {
    grid-template-columns: 1fr auto;
    gap: 8px;
  }

  .user-row summary > span:not(.user-cell):not(.more-button) {
    display: none;
  }

  .user-row summary .user-cell { grid-column: 1; }

  .user-row summary .more-button { grid-column: 2; }

  .report-table { overflow-x: auto; }

  .report-tr {
    grid-template-columns: 2fr 1fr 1fr 1fr;
    min-width: 600px;
  }

  .report-tr.report-th span:nth-child(5),
  .report-tr span:nth-child(5) { display: none; }

  .user-summary { grid-template-columns: 1fr; }

  .flow-tabs { grid-template-columns: 1fr; }

  .date-range-box { flex-direction: column; align-items: stretch; }

  .date-range-box > div { min-width: 100%; }

  .range-arrow { display: none; }

  .range-label { padding-bottom: 0; }

  .builder-form { padding: 20px; }

  .admin-edit-form { grid-template-columns: 1fr; }

  .library-grid { grid-template-columns: 1fr; }

  .saved-file-grid { grid-template-columns: 1fr; }

  .topic-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

@media (max-width: 600px) {
  :root { --topbar-h: 64px; }

  .topbar-title h1 { font-size: 1.05rem; }

  .topbar-actions .primary-button { padding: 7px 12px; font-size: .75rem; }

  .topbar-actions .primary-button span:first-child { display: none; }

  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }

  .stat-card { padding: 14px; }

  .stat-card strong { font-size: 1.4rem; }

  .quick-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 18px;
  }

  .quick-card b { align-self: flex-end; }

  .welcome-panel { padding: 20px; border-radius: var(--radius-lg); }

  .welcome-panel h2 { font-size: 1.15rem; }

  .content-card { padding: 18px; border-radius: var(--radius); }

  .builder-form { padding: 16px; border-radius: var(--radius); }

  .form-step > span { width: 30px; height: 30px; font-size: .75rem; }

  .profile-card { padding: 22px 18px; }

  .avatar.giant { width: 68px; height: 68px; font-size: 1.6rem; }

  .report-hero { padding: 18px; }

  .report-identity { flex-direction: column; align-items: flex-start; gap: 10px; }

  .report-hero-top { flex-direction: column; }

  .result-panel,
  .error-panel { flex-direction: column; align-items: flex-start; }

  .result-panel .primary-button,
  .error-panel .secondary-button { width: 100%; }

  .submit-row { flex-direction: column; align-items: stretch; }

  .submit-row .primary-button { width: 100%; }

  .submit-row > span { order: 2; justify-content: center; }

  .toast-stack { left: 12px; right: 12px; bottom: 12px; max-width: none; }

  .dialog-head,
  .dialog-body,
  .dialog-actions { padding-right: 18px; padding-left: 18px; }

  .topic-tools { flex-direction: column; align-items: stretch; }

  .topic-tools > div { justify-content: space-between; }
}

/* ============================================================
   Reduced Motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ============================================================
   Print
   ============================================================ */
@media print {
  .sidebar, .topbar, .toast-stack, .mobile-shade { display: none !important; }
  .main-area { margin-right: 0; }
  .page-content { padding: 0; }
  .content-card, .report-hero { box-shadow: none; border: 1px solid #ddd; }
}