:root{--brand:#55318F;--accent:#D9A21B;--bg:#FFF8E8;--card:#fff;--ink:#2A1B45;--mut:#6E6385;--line:#EADFC8;--red:#C0392B;--amber:#B9770E;--blue:#2563EB;--ok:#1E8449;--r:14px;--shadow:0 1px 2px rgba(0,0,0,.05),0 4px 14px rgba(23,35,30,.05)}
*{box-sizing:border-box}html{-webkit-text-size-adjust:100%}
body{margin:0;font:16px/1.45 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;background:var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cg fill='%23D9A21B' fill-opacity='.13'%3E%3Cellipse cx='60' cy='70' rx='11' ry='9'/%3E%3Ccircle cx='46' cy='55' r='4.5'/%3E%3Ccircle cx='56' cy='49' r='4.5'/%3E%3Ccircle cx='66' cy='49' r='4.5'/%3E%3Ccircle cx='76' cy='55' r='4.5'/%3E%3C/g%3E%3C/svg%3E");color:var(--ink)}
h1,h2,h3{margin:0;line-height:1.2}h1{font-size:1.5rem}h2{font-size:1.15rem}h3{font-size:1.02rem}
a{color:var(--brand)}small,.hint{color:var(--mut)}
button,input,select,textarea{font:inherit;color:inherit}
.hidden{display:none!important}
/* layout */
#app{min-height:100vh}
.shell{display:grid;grid-template-columns:230px 1fr;min-height:100vh}
.side{background:var(--brand);color:#fff;padding:18px 12px;position:sticky;top:0;height:100vh;display:flex;flex-direction:column;gap:6px}
.logo{display:flex;align-items:center;gap:10px;padding:6px 10px 18px;font-weight:700;font-size:1.1rem}
.logo i{font-style:normal;background:var(--accent);color:var(--brand);width:36px;height:36px;border-radius:50%;display:grid;place-items:center;font-size:1.1rem}
.nav a{display:flex;align-items:center;gap:10px;color:#EFE6FA;text-decoration:none;padding:11px 12px;border-radius:10px;min-height:44px}
.nav a:hover{background:rgba(255,255,255,.1)}.nav a.on{background:var(--accent);color:#2b1d02;font-weight:700}
.side .me{margin-top:auto;padding:10px;font-size:.85rem;color:#D9C9F0}
.main{padding:22px 26px 80px;min-width:0}
.top{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:18px;flex-wrap:wrap}
.top .who{display:flex;align-items:center;gap:10px;color:var(--mut);font-size:.9rem}
.avatar{width:34px;height:34px;border-radius:50%;background:var(--brand);color:#fff;display:grid;place-items:center;font-weight:600;font-size:.85rem}
@media(max-width:820px){
 .shell{grid-template-columns:1fr}.side{position:fixed;bottom:0;left:0;right:0;top:auto;height:auto;flex-direction:row;padding:4px 6px;z-index:30;gap:0;box-shadow:0 -2px 12px rgba(0,0,0,.15)}
 .side .logo,.side .me{display:none}.nav{display:flex;width:100%;justify-content:space-around}
 .nav a{flex-direction:column;gap:2px;font-size:.68rem;padding:6px 4px;min-height:52px;text-align:center;flex:1}
 .main{padding:14px 14px 90px}
}
/* cards */
.card{background:var(--card);border:1px solid var(--line);border-radius:var(--r);padding:16px;box-shadow:var(--shadow);margin-bottom:16px}
.card>h2,.card>h3{margin-bottom:10px}
.grid{display:grid;gap:14px}.g2{grid-template-columns:repeat(2,1fr)}.g3{grid-template-columns:repeat(3,1fr)}.g4{grid-template-columns:repeat(4,1fr)}
@media(max-width:980px){.g4{grid-template-columns:repeat(2,1fr)}.g3{grid-template-columns:repeat(2,1fr)}}
@media(max-width:620px){.g2,.g3,.g4{grid-template-columns:1fr}}
.stat{padding:14px 16px}.stat .k{color:var(--mut);font-size:.82rem}.stat .v{font-size:1.6rem;font-weight:700;margin-top:2px}.stat .s{font-size:.82rem;color:var(--mut)}
.up{color:var(--ok)}.down{color:var(--red)}
/* buttons */
.btn{background:var(--brand);color:#fff;border:0;border-radius:10px;padding:10px 16px;min-height:44px;cursor:pointer;font-weight:600;text-decoration:none;display:inline-flex;align-items:center;justify-content:center;gap:6px}
.btn:hover{filter:brightness(1.08)}.btn:disabled{opacity:.5;cursor:not-allowed}
.btn.ghost{background:#fff;color:var(--brand);border:1px solid var(--line)}.btn.danger{background:var(--red)}.btn.sm{min-height:34px;padding:6px 11px;font-size:.85rem}.btn.accent{background:var(--accent);color:#2b1d02}
.icon-btn{background:none;border:0;font-size:1.1rem;cursor:pointer;padding:8px;border-radius:8px}.icon-btn:hover{background:var(--bg)}
.row{display:flex;gap:10px;align-items:center;flex-wrap:wrap}.row.end{justify-content:flex-end;margin-top:14px}.row.between{justify-content:space-between}
.sp{flex:1}
/* forms */
.form{display:grid;grid-template-columns:repeat(2,1fr);gap:12px 14px}
.f{display:flex;flex-direction:column;gap:5px}.span2{grid-column:span 2}.span1{grid-column:span 1}
@media(max-width:620px){.form{grid-template-columns:1fr}.span2{grid-column:span 1}}
.lbl{font-size:.82rem;font-weight:600;color:#3D2D5C}
input[type=text],input[type=email],input[type=tel],input[type=number],input[type=date],input[type=month],input[type=search],input[type=password],select,textarea{width:100%;min-height:44px;border:1px solid #D8CDB8;border-radius:10px;padding:9px 12px;background:#fff}
textarea{min-height:84px;resize:vertical}
input:focus,select:focus,textarea:focus{outline:2px solid var(--accent);outline-offset:0;border-color:var(--accent)}
.check{display:flex;gap:10px;align-items:flex-start;padding:6px 0;font-size:.95rem}.check input{width:22px;height:22px;margin-top:1px;accent-color:var(--brand);flex:none}
.filters{display:flex;gap:10px;flex-wrap:wrap;margin-bottom:14px;align-items:end}.filters .f{min-width:140px;flex:1}.filters .f.q{flex:2;min-width:200px}
/* tables */
.tbl-wrap{overflow-x:auto;border:1px solid var(--line);border-radius:12px;background:#fff}
table{border-collapse:collapse;width:100%;font-size:.92rem}
th{background:#F6EFDD;text-align:left;font-size:.78rem;text-transform:uppercase;letter-spacing:.03em;color:#6A5A82;padding:10px 12px;white-space:nowrap}
td{padding:10px 12px;border-top:1px solid var(--line);vertical-align:top}
tr.click{cursor:pointer}tr.click:hover td{background:#FFFAEE}
td.r,th.r{text-align:right}
.badge{display:inline-block;padding:2px 9px;border-radius:99px;font-size:.75rem;font-weight:600;background:#EFE8F8;color:#4A3375;white-space:nowrap}
.badge.green{background:#DDF3E4;color:#176B3A}.badge.red{background:#FBE0DC;color:#9C2A1D}.badge.amber{background:#FDEFD0;color:#8A5A07}.badge.blue{background:#DDE8FD;color:#1E43A8}.badge.grey{background:#F0EBE0;color:#555}
.chip{display:inline-flex;align-items:center;gap:6px;background:#EFE8F8;border-radius:99px;padding:3px 10px;font-size:.82rem;margin:2px 4px 2px 0}
.chip .x{background:none;border:0;cursor:pointer;font-size:.8rem;padding:0 2px}
.empty{padding:28px;text-align:center;color:var(--mut)}
.error-box{background:#FDECEA;border:1px solid #F5C6C0;color:#7B241C;padding:14px;border-radius:12px}
.loading{display:flex;gap:10px;align-items:center;padding:30px;color:var(--mut)}.spin{width:18px;height:18px;border:3px solid var(--line);border-top-color:var(--brand);border-radius:50%;animation:s 0.8s linear infinite}@keyframes s{to{transform:rotate(1turn)}}
.pager{display:flex;justify-content:space-between;align-items:center;margin-top:12px;color:var(--mut);font-size:.9rem}
.tabs{display:flex;gap:4px;border-bottom:1px solid var(--line);margin-bottom:16px;overflow-x:auto}
.tabs a{padding:10px 14px;text-decoration:none;color:var(--mut);border-bottom:3px solid transparent;white-space:nowrap;font-weight:600}.tabs a.on{color:var(--brand);border-color:var(--brand)}
/* picker */
.picks{display:flex;flex-direction:column;border:1px solid var(--line);border-radius:10px;background:#fff;margin-top:4px}.picks:empty{display:none}
.pick{text-align:left;background:none;border:0;border-bottom:1px solid var(--line);padding:10px 12px;cursor:pointer;min-height:44px}.pick:last-child{border:0}.pick:hover{background:#FBF5E4}.pick.none{color:var(--mut)}
/* modal + toast */
dialog.modal{border:0;border-radius:16px;padding:0;width:min(560px,94vw);max-height:92vh;box-shadow:0 20px 60px rgba(0,0,0,.3)}dialog.modal.wide{width:min(860px,96vw)}
dialog.modal::backdrop{background:rgba(10,20,15,.5)}
.modal-head{display:flex;justify-content:space-between;align-items:center;padding:14px 18px;border-bottom:1px solid var(--line);position:sticky;top:0;background:#fff;z-index:2}
.modal-body{padding:18px;overflow:auto;max-height:calc(92vh - 60px)}
#toasts{position:fixed;left:50%;transform:translateX(-50%);bottom:84px;display:flex;flex-direction:column;gap:8px;z-index:100;width:min(92vw,420px)}
.toast{background:#17231e;color:#fff;padding:12px 16px;border-radius:12px;box-shadow:0 6px 20px rgba(0,0,0,.25)}.toast.err{background:var(--red)}
/* kanban */
.board{display:grid;grid-template-columns:repeat(4,minmax(220px,1fr));gap:12px;overflow-x:auto;padding-bottom:8px}
.col{background:#F4EEFA;border-radius:12px;padding:10px;min-height:200px}.col.over{outline:2px dashed var(--brand)}
.col h3{display:flex;justify-content:space-between;margin-bottom:8px;font-size:.92rem}
.tcard{background:#fff;border:1px solid var(--line);border-radius:10px;padding:10px;margin-bottom:8px;box-shadow:var(--shadow);cursor:grab}
.tcard.overdue{border-left:4px solid var(--red)}.tcard .t{font-weight:600;margin-bottom:4px}.tcard .m{font-size:.8rem;color:var(--mut);display:flex;gap:6px;flex-wrap:wrap;align-items:center}
.tcard select{min-height:34px;margin-top:8px;font-size:.85rem;padding:4px 8px}
.taskrow{display:flex;gap:12px;align-items:flex-start;padding:12px 0;border-top:1px solid var(--line)}.taskrow:first-child{border:0}
.taskrow.overdue .t{color:var(--red)}
/* bars */
.bars{display:flex;flex-direction:column;gap:8px}.bar{display:grid;grid-template-columns:150px 1fr 110px;gap:10px;align-items:center;font-size:.9rem}
.bar .track{background:#F1E9FA;border-radius:6px;height:16px;overflow:hidden}.bar .fill{background:var(--brand);height:100%;border-radius:6px}
@media(max-width:620px){.bar{grid-template-columns:100px 1fr 80px;font-size:.8rem}}
.cols{display:flex;align-items:flex-end;gap:6px;height:150px;padding-top:10px}.cols .c{flex:1;display:flex;flex-direction:column;justify-content:flex-end;align-items:center;gap:4px;min-width:0;height:100%}
.cols .c b{width:100%;background:var(--brand);border-radius:5px 5px 0 0;min-height:2px;display:block}.cols .c.today b{background:var(--accent)}.cols .c span{font-size:.62rem;color:var(--mut)}
/* auth screens */
.auth{min-height:100vh;display:grid;place-items:center;padding:20px;background:linear-gradient(160deg,#F0E8FA,#FFF3D6)}
.auth-card{background:#fff;border-radius:20px;padding:28px;width:min(420px,100%);box-shadow:0 10px 40px rgba(23,35,30,.12)}
.auth-card .logo{color:var(--brand);padding:0 0 14px}.auth-card .logo i{background:var(--brand);color:#fff}
.auth-card .f{margin-bottom:12px}.auth-card h1{margin-bottom:4px}.auth-card p{color:var(--mut);margin:0 0 16px}
.auth-card .btn{width:100%}.links{text-align:center;margin-top:14px;font-size:.92rem}
.note{background:#FFF7E0;border:1px solid #F1DFA0;border-radius:10px;padding:10px 12px;font-size:.9rem;margin:8px 0}
.kv{display:grid;grid-template-columns:140px 1fr;gap:6px 12px;font-size:.92rem}.kv dt{color:var(--mut)}.kv dd{margin:0}
@media(max-width:560px){.kv{grid-template-columns:1fr}}

.fl-toggle{display:none}
@media(max-width:820px){.fl-toggle{display:inline-flex;min-height:44px}.filters.cl:not(.open) .f:not(.q),.filters.cl:not(.open) #clr{display:none}.filters .f{min-width:46%}}

.side{background:linear-gradient(180deg,#5B3697,#47287D)}h1,h2{color:var(--brand)}.btn.accent{color:#2b1d02}
.pimg{width:44px;height:44px;object-fit:cover;border-radius:8px;background:#F3ECDC;display:inline-block;flex:none}.pimg.big{width:64px;height:64px}
.msg{white-space:pre-wrap;background:#FBF5E4;border:1px solid var(--line);border-radius:10px;padding:12px;font:inherit;margin:10px 0 4px}
