:root{
  --bg:#fbfbfa; --panel:#fff; --line:#e7e5e0; --text:#2b2a27; --muted:#7a766e; --accent:#c2410c; --accent-soft:#fff1e8;
  --c-gray:#e8e6e1; --c-default:#e8e6e1; --c-blue:#d6e6f7; --c-green:#d7efdc; --c-orange:#fde3c8; --c-red:#fbd5d1;
  --c-yellow:#faf0c0; --c-pink:#f8d9e8; --c-purple:#e5dcf6; --c-brown:#eadbcf;
  --radius:8px; --shadow:0 1px 2px rgba(0,0,0,.06),0 4px 14px rgba(0,0,0,.06);
}
*{box-sizing:border-box}
html,body{margin:0;height:100%}
body{font:14px/1.45 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;color:var(--text);background:var(--bg)}
button,input,select,textarea{font:inherit;color:inherit}
button{cursor:pointer}
.hidden{display:none!important}

/* login */
.login{min-height:100%;display:grid;place-items:center;padding:24px}
.login-card{width:100%;max-width:360px;background:var(--panel);border:1px solid var(--line);border-radius:12px;padding:28px;box-shadow:var(--shadow)}
.login-card h1{margin:0 0 4px;font-size:20px}
.login-card p{margin:0 0 18px;color:var(--muted)}
.field{display:block;margin-bottom:12px}
.field>span{display:block;font-size:12px;color:var(--muted);margin-bottom:4px}
.field input,.field select,.field textarea{width:100%;padding:8px 10px;border:1px solid var(--line);border-radius:6px;background:#fff}
.field textarea{min-height:90px;resize:vertical}
.btn{padding:8px 14px;border:1px solid var(--line);border-radius:6px;background:#fff}
.btn:hover{background:#f4f3ef}
.btn.primary{background:var(--accent);border-color:var(--accent);color:#fff}
.btn.primary:hover{filter:brightness(1.08)}
.btn.danger{color:#b42318}
.err{color:#b42318;font-size:13px;margin:8px 0 0;min-height:18px}
.setup{max-width:560px;margin:60px auto;padding:24px;background:#fff;border:1px solid var(--line);border-radius:12px}
.setup code{background:#f4f3ef;padding:1px 5px;border-radius:4px}

/* shell */
.shell{display:grid;grid-template-columns:210px 1fr;height:100vh}
.side{border-right:1px solid var(--line);background:#f6f5f2;padding:14px 10px;display:flex;flex-direction:column;gap:2px}
.brand{font-weight:700;padding:4px 8px 12px;font-size:15px}
.brand small{display:block;font-weight:400;color:var(--muted);font-size:11px}
.nav{display:flex;align-items:center;gap:8px;padding:7px 10px;border-radius:6px;border:0;background:none;text-align:left;width:100%}
.nav:hover{background:#ecebe6}
.nav.on{background:#e4e2db;font-weight:600}
.side .sp{flex:1}
.me{padding:8px;font-size:12px;color:var(--muted);border-top:1px solid var(--line);margin-top:8px}
.me b{color:var(--text);display:block}
.main{display:flex;flex-direction:column;min-width:0;height:100vh}
.bar{display:flex;flex-wrap:wrap;gap:8px;align-items:center;padding:12px 18px;border-bottom:1px solid var(--line);background:var(--panel)}
.bar h2{margin:0 8px 0 0;font-size:17px}
.bar input[type=search],.bar select{padding:6px 9px;border:1px solid var(--line);border-radius:6px;background:#fff}
.bar label{display:flex;align-items:center;gap:5px;color:var(--muted)}
.bar .sp{flex:1}
.content{flex:1;overflow:auto;padding:14px 18px}

/* tags */
.tag{display:inline-block;padding:1px 8px;border-radius:4px;font-size:12px;line-height:1.6;white-space:nowrap;background:var(--c-gray)}
.tag.blue{background:var(--c-blue)}.tag.green{background:var(--c-green)}.tag.orange{background:var(--c-orange)}
.tag.red{background:var(--c-red)}.tag.yellow{background:var(--c-yellow)}.tag.pink{background:var(--c-pink)}
.tag.purple{background:var(--c-purple)}.tag.brown{background:var(--c-brown)}
.tags{display:flex;flex-wrap:wrap;gap:4px}

/* table */
table.t{border-collapse:collapse;width:100%;background:var(--panel);border:1px solid var(--line);border-radius:var(--radius);overflow:hidden}
.t th{position:sticky;top:0;background:#f6f5f2;text-align:left;font-weight:600;font-size:12px;color:var(--muted);padding:8px 10px;border-bottom:1px solid var(--line);white-space:nowrap}
.t td{padding:8px 10px;border-bottom:1px solid #f0eee9;vertical-align:top}
.t tr.row{cursor:pointer}
.t tr.row:hover td{background:#faf9f6}
.t td.title{min-width:280px;font-weight:500}
.late{color:#b42318;font-weight:600}
.muted{color:var(--muted)}
.count{color:var(--muted);font-size:12px}

/* board */
.board{display:flex;gap:12px;align-items:flex-start;min-height:100%}
.col{flex:0 0 270px;background:#f3f2ee;border-radius:10px;padding:8px;max-height:100%}
.col h3{margin:2px 4px 8px;font-size:13px;display:flex;justify-content:space-between}
.col.over{outline:2px dashed var(--accent)}
.card{background:#fff;border:1px solid var(--line);border-radius:8px;padding:9px 10px;margin-bottom:8px;cursor:grab;box-shadow:0 1px 1px rgba(0,0,0,.04)}
.card:hover{border-color:#cfcbc2}
.card .ct{font-weight:500;margin-bottom:6px}
.card .cm{display:flex;flex-wrap:wrap;gap:6px;align-items:center;font-size:12px;color:var(--muted)}

/* calendar */
.cal{display:grid;grid-template-columns:repeat(7,1fr);border:1px solid var(--line);border-radius:var(--radius);overflow:hidden;background:#fff}
.cal .h{background:#f6f5f2;padding:6px;font-size:12px;color:var(--muted);text-align:center;border-bottom:1px solid var(--line)}
.cal .d{min-height:104px;border-right:1px solid #f0eee9;border-bottom:1px solid #f0eee9;padding:4px;overflow:hidden}
.cal .d.out{background:#fafaf8;color:#b7b3aa}
.cal .d.today .n{background:var(--accent);color:#fff;border-radius:10px;padding:0 6px}
.cal .n{font-size:12px;margin-bottom:3px;display:inline-block}
.ev{font-size:11.5px;padding:1px 5px;border-radius:3px;margin-bottom:2px;cursor:pointer;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;background:var(--c-orange)}
.ev.done{background:var(--c-green);text-decoration:line-through;color:#4b6b53}

/* timeline */
.tl{background:#fff;border:1px solid var(--line);border-radius:var(--radius);overflow:auto}
.tl-row{display:grid;grid-template-columns:260px 1fr;border-bottom:1px solid #f0eee9;min-height:30px;align-items:center}
.tl-row .lbl{padding:4px 10px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer}
.tl-track{position:relative;height:30px;background-image:linear-gradient(to right,#f0eee9 1px,transparent 1px);background-size:calc(100%/12) 100%}
.tl-bar{position:absolute;top:6px;height:18px;border-radius:4px;background:var(--c-orange);cursor:pointer;font-size:11px;padding:0 5px;overflow:hidden;white-space:nowrap}
.tl-bar.done{background:var(--c-green)}
.tl-head{background:#f6f5f2;font-size:11px;color:var(--muted)}
.tl-head .tl-track{height:24px}
.tl-today{position:absolute;top:0;bottom:0;width:2px;background:var(--accent);opacity:.6;z-index:2}

/* drawer */
.scrim{position:fixed;inset:0;background:rgba(0,0,0,.25);z-index:20}
.drawer{position:fixed;right:0;top:0;bottom:0;width:min(560px,100%);background:var(--panel);z-index:21;box-shadow:var(--shadow);display:flex;flex-direction:column}
.drawer header{padding:14px 18px;border-bottom:1px solid var(--line);display:flex;gap:10px;align-items:center}
.drawer header h3{margin:0;flex:1;font-size:16px}
.drawer .body{flex:1;overflow:auto;padding:16px 18px}
.drawer footer{padding:12px 18px;border-top:1px solid var(--line);display:flex;gap:8px;justify-content:flex-end}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:0 12px}
.meta{font-size:12px;color:var(--muted);margin:2px 0 14px}
.chips{display:flex;flex-wrap:wrap;gap:6px}
.chip{border:1px solid var(--line);border-radius:14px;padding:2px 10px;background:#fff;font-size:12px}
.chip.on{background:var(--accent-soft);border-color:var(--accent);color:var(--accent)}
.coms h4{margin:18px 0 8px}
.com{background:#f6f5f2;border-radius:8px;padding:8px 10px;margin-bottom:8px}
.com small{color:var(--muted)}
.com p{margin:3px 0 0;white-space:pre-wrap}

/* audit */
.ac{font-size:12px;white-space:pre-wrap;word-break:break-word;background:#f6f5f2;border-radius:6px;padding:6px 8px;margin-top:4px;max-width:560px}
.badge{padding:1px 8px;border-radius:10px;font-size:11px;font-weight:600;background:#eee}
.badge.login{background:#d6e6f7}.badge.logout{background:#e8e6e1}.badge.ver{background:#f0eee9}
.badge.criar{background:#d7efdc}.badge.editar{background:#fde3c8}.badge.excluir{background:#fbd5d1}
.badge.comentar{background:#e5dcf6}.badge.admin{background:#faf0c0}
.toast{position:fixed;bottom:18px;left:50%;transform:translateX(-50%);background:#2b2a27;color:#fff;padding:9px 16px;border-radius:8px;z-index:50;font-size:13px}

@media(max-width:800px){
  .shell{grid-template-columns:1fr;grid-template-rows:auto 1fr;height:auto}
  .side{flex-direction:row;flex-wrap:wrap;border-right:0;border-bottom:1px solid var(--line)}
  .brand,.me,.side .sp{display:none}
  .main{height:auto}
  .grid2{grid-template-columns:1fr}
}
