/* D'Taisa Hub — ERP & Clinic */
:root{
  --bg:#f6f6fb; --card:#fff; --ink:#1f1d2b; --muted:#7b7a8e; --line:#ecebf3;
  --purple:#5b21b6; --purple-2:#6d28d9; --purple-soft:#f1ecfd; --lav:#eef0ff;
  --orange:#f97316; --orange-soft:#fff1e6; --red:#dc2626; --red-soft:#fdecec; --pink:#fdf1ef;
  --green:#16a34a; --green-soft:#e8f8ee; --mint:#34d399;
  --radius:16px; --shadow:0 1px 2px rgba(31,29,43,.04),0 6px 24px rgba(31,29,43,.05);
  font-family:"Plus Jakarta Sans",system-ui,-apple-system,"Segoe UI",sans-serif;
}
*{box-sizing:border-box}
html,body{margin:0;background:var(--bg);color:var(--ink);font-size:14px;line-height:1.45}
a{color:var(--purple);text-decoration:none}
a:hover{text-decoration:underline}
code{font-family:ui-monospace,Menlo,Consolas,monospace;font-size:.85em;color:var(--purple)}
h1{font-size:1.35rem;margin:0 0 .2rem;font-weight:700}
h2{font-size:1.05rem;margin:0 0 .25rem;font-weight:700}
h3{font-size:.95rem;margin:1.2rem 0 .5rem}
p{margin:.2rem 0}
.muted{color:var(--muted)} .sm{font-size:.82rem} .tiny{font-size:.75rem;margin-top:1rem} .nowrap{white-space:nowrap}
.ic{width:18px;height:18px;flex:none}

/* Shell */
.shell{display:flex;min-height:100vh}
.sidebar{width:240px;flex:none;background:#fff;border-right:1px solid var(--line);display:flex;flex-direction:column;padding:16px 12px;position:sticky;top:0;height:100vh;z-index:30}
.brand{display:flex;align-items:center;gap:10px;color:var(--ink);padding:4px 6px 14px}
.brand:hover{text-decoration:none}
.brand strong{display:block;color:var(--purple);font-size:1rem}
.brand small{display:block;color:var(--muted);font-size:.68rem;letter-spacing:.08em;font-weight:600}
.brand-mark{width:36px;height:36px;border-radius:10px;background:linear-gradient(135deg,var(--purple),#8b5cf6);color:#fff;display:grid;place-items:center}
.brand.big .brand-mark{width:44px;height:44px}
.api-pill{display:flex;align-items:center;gap:6px;font-size:.75rem;background:#f8f8fc;border:1px solid var(--line);border-radius:10px;padding:8px 10px;color:var(--muted)}
.api-pill b{margin-left:auto;color:var(--ink)}
.api-pill .dot{width:8px;height:8px;border-radius:50%;background:var(--green)}
.api-pill.off .dot{background:var(--red)}
.nav-title{font-size:.68rem;letter-spacing:.1em;text-transform:uppercase;color:var(--muted);margin:18px 8px 6px;font-weight:700}
.nav{display:flex;flex-direction:column;gap:2px}
.nav a{display:flex;align-items:center;gap:10px;padding:10px 12px;border-radius:10px;color:#3d3b4f;font-weight:500}
.nav a:hover{background:var(--purple-soft);text-decoration:none}
.nav a.active{background:var(--purple);color:#fff;box-shadow:0 6px 16px rgba(91,33,182,.25)}
.me{margin-top:auto;display:flex;align-items:center;gap:10px;padding:12px 8px 4px;border-top:1px solid var(--line)}
.me strong{display:block;font-size:.85rem;color:var(--ink)}
.me small{display:block;color:var(--purple);font-size:.72rem;font-weight:600}
.me form{margin-left:auto}
.avatar{width:36px;height:36px;border-radius:50%;background:var(--purple);color:#fff;display:grid;place-items:center;font-weight:700;font-size:.8rem;flex:none}
.avatar:hover{text-decoration:none}
.avatar.sm{width:34px;height:34px}
.main{flex:1;min-width:0;display:flex;flex-direction:column}
.topbar{display:flex;align-items:center;gap:12px;padding:12px 24px;background:#fff;border-bottom:1px solid var(--line);position:sticky;top:0;z-index:20}
.search{flex:1;max-width:560px;display:flex;align-items:center;gap:8px;background:#f4f4f9;border-radius:12px;padding:0 12px;color:var(--muted)}
.search input{border:0;background:transparent;padding:10px 0;width:100%;font:inherit;outline:none;color:var(--ink)}
.topbar .btn-orange{margin-left:auto}
.icon-btn{border:0;background:transparent;width:34px;height:34px;border-radius:10px;display:inline-grid;place-items:center;color:#4b4960;cursor:pointer;position:relative}
.icon-btn:hover{background:var(--purple-soft);color:var(--purple)}
.bell i{position:absolute;top:6px;right:7px;width:8px;height:8px;border-radius:50%;background:var(--red);border:2px solid #fff}
.menu-btn{display:none}
.content{padding:22px 24px;display:flex;flex-direction:column;gap:18px;max-width:1400px;width:100%}
.foot{color:var(--muted);font-size:.75rem;text-align:center;padding:8px}

/* Buttons */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;border:1px solid transparent;border-radius:10px;padding:9px 14px;font:inherit;font-weight:600;font-size:.85rem;cursor:pointer;background:#f1f0f7;color:var(--ink);white-space:nowrap;text-decoration:none!important;line-height:1.2}
.btn .ic{width:16px;height:16px}
.btn-primary{background:var(--purple);color:#fff}
.btn-primary:hover{background:var(--purple-2)}
.btn-orange{background:var(--orange);color:#fff;box-shadow:0 6px 14px rgba(249,115,22,.25)}
.btn-ghost{background:#fff;border-color:#e4e2ef;color:var(--purple)}
.btn-ghost:hover{background:var(--lav)}
.btn.sm{padding:7px 11px;font-size:.8rem}
.btn.xs{padding:6px 10px;font-size:.75rem;border-radius:8px}
.btn.block{width:100%}
.link{background:none;border:0;color:var(--purple);cursor:pointer;font:inherit;padding:0}

/* Cards */
.card{background:var(--card);border-radius:var(--radius);box-shadow:var(--shadow);padding:20px;border:1px solid #f0eff6;min-width:0}
a.card{color:inherit;text-decoration:none!important;transition:transform .15s}
a.card:hover{transform:translateY(-2px)}
.card.narrow{max-width:520px}
.card.empty{text-align:center;padding:48px}
.card-h{display:flex;align-items:flex-start;gap:12px;margin-bottom:14px}
.card-h > div{flex:1;min-width:0}
.card-h p{color:var(--muted);font-size:.82rem}
.card-f{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-top:14px;padding-top:12px;border-top:1px dashed var(--line);font-size:.8rem;color:var(--muted)}
.card-f a{display:inline-flex;align-items:center;gap:4px;font-weight:600}
.card-f .ic{width:15px;height:15px}
.tile{width:40px;height:40px;border-radius:12px;display:grid;place-items:center;flex:none}
.tile.sm{width:36px;height:36px}
.tile.purple{background:var(--lav);color:var(--purple)}
.tile.soft{background:#f3f2fa;color:var(--purple)}
.tile.orange{background:var(--orange-soft);color:var(--orange)}
.tile.red{background:#fff;color:var(--red)}
.tile.red-soft{background:var(--red-soft);color:var(--red)}
.tile.orange-soft{background:var(--orange-soft);color:var(--orange)}

/* Store header */
.store-head{display:flex;justify-content:space-between;gap:16px;flex-wrap:wrap;align-items:center}
.store-id{display:flex;gap:14px;align-items:flex-start}
.store-head .actions{display:flex;gap:10px;flex-wrap:wrap;justify-content:flex-end;max-width:440px}
.chip{display:inline-flex;align-items:center;gap:6px;font-size:.72rem;font-weight:600;padding:3px 9px;border-radius:99px}
.chip-ok{background:var(--green-soft);color:#15803d}
.chip .dot{width:7px;height:7px;border-radius:50%;background:var(--green)}

/* KPIs */
.kpis{display:grid;grid-template-columns:repeat(4,1fr);gap:16px}
.kpi{display:flex;flex-direction:column;gap:10px}
.kpi header{display:flex;justify-content:space-between;align-items:flex-start;font-size:.72rem;letter-spacing:.06em;text-transform:uppercase;color:var(--muted);font-weight:600}
.kpi strong{font-size:2.1rem;font-weight:800;letter-spacing:-.02em}
.kpi strong.money{color:var(--purple)}
.kpi strong small{font-size:.9rem;color:var(--muted)}
.kpi footer{display:flex;justify-content:space-between;align-items:flex-end;gap:8px;font-size:.75rem;color:var(--muted);margin-top:auto}
.kpi .pill{background:#f3f2fa;padding:3px 8px;border-radius:8px;color:#4b4960}
.kpi .pill.orange{background:var(--orange-soft);color:#c2410c}
.kpi.danger{background:var(--pink);border-color:#f9dcd7}
.kpi.danger strong,.red-txt{color:var(--red)}
.kpi.danger header span:first-child{color:var(--red)}
.kpi.warm{background:#fff4ed;border-color:#fde3cf}
.kpi.warm strong{color:#c2410c}
.kpi.warm header span:first-child{color:#c2410c}
.up{color:var(--green);display:inline-flex;gap:4px;align-items:center;font-weight:700}
.down{color:var(--red);display:inline-flex;gap:4px;align-items:center;font-weight:700}
.up .ic,.down .ic{width:14px;height:14px}

/* Layout grids */
.grid-2{display:grid;grid-template-columns:1fr 1fr;gap:18px}
.grid-2.wide-left{grid-template-columns:minmax(0,1.75fr) minmax(0,1fr)}
.grid-3{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px}
.span-2{grid-column:span 2}
.page-h{display:flex;justify-content:space-between;align-items:flex-end;gap:12px;flex-wrap:wrap}

/* Row items (alerts) */
.rows{display:flex;flex-direction:column;gap:10px}
.row-item{display:flex;gap:12px;align-items:center;background:#f7f7fc;border-radius:12px;padding:12px}
.row-item .grow{flex:1;min-width:0;display:flex;flex-direction:column;gap:3px}
.row-item small{color:var(--muted);font-size:.75rem}
.clip{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:600}
.lote{color:var(--purple);font-weight:600;font-size:.75rem;background:var(--lav);padding:2px 7px;border-radius:6px;width:max-content}
.empty-sm{color:var(--muted);text-align:center;padding:18px;font-size:.85rem}

/* Badges */
.badge{display:inline-flex;align-items:center;padding:3px 9px;border-radius:99px;font-size:.72rem;font-weight:700;white-space:nowrap;width:max-content}
.badge.xs{padding:1px 7px;font-size:.68rem}
.b-bad{background:var(--red-soft);color:var(--red)}
.b-ok{background:var(--green-soft);color:#15803d}
.b-warn,.b-orange{background:var(--orange-soft);color:#c2410c}
.b-soft{background:var(--lav);color:var(--purple)}
.b-muted{background:#f1f0f5;color:var(--muted)}
.ok-txt{color:var(--green);font-weight:600}

/* Popover forms (details/summary) */
.pop{position:relative}
.pop summary{list-style:none}
.pop summary::-webkit-details-marker{display:none}
.pop-body{position:absolute;right:0;top:calc(100% + 6px);z-index:15;background:#fff;border:1px solid var(--line);box-shadow:0 12px 32px rgba(31,29,43,.15);border-radius:12px;padding:14px;width:260px;display:flex;flex-direction:column;gap:10px}

/* Charts */
.legend{display:flex;gap:12px;flex-wrap:wrap;font-size:.72rem;color:var(--muted)}
.legend i{display:inline-block;width:8px;height:8px;border-radius:50%;margin-right:5px}
.lg-purple{background:var(--purple)} .lg-orange{background:var(--orange)} .lg-green{background:var(--mint)}
.chart-box{position:relative;height:260px}
.donut-box{position:relative;height:200px;margin:8px auto 14px;max-width:220px}
.donut-center{position:absolute;inset:0;display:grid;place-content:center;text-align:center;pointer-events:none}
.donut-center strong{font-size:1.8rem;font-weight:800;color:var(--purple);line-height:1}
.donut-center small{font-size:.65rem;color:var(--muted);letter-spacing:.08em;font-weight:700}
.legend-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:10px}
.legend-list li{display:flex;align-items:center;gap:8px;font-size:.85rem}
.legend-list li span{flex:1}
.sw{width:10px;height:10px;border-radius:50%;flex:none;background:#ddd}

/* Tables */
.table-wrap{overflow-x:auto;margin:0 -4px}
.table{width:100%;border-collapse:collapse;font-size:.85rem}
.table th{text-align:left;font-size:.7rem;text-transform:uppercase;letter-spacing:.06em;color:var(--muted);font-weight:700;background:#f8f8fc;padding:10px}
.table td{padding:12px 10px;border-bottom:1px solid var(--line);vertical-align:middle}
.table td small{display:block;color:var(--muted);font-size:.74rem}
.table .r{text-align:right}
.table tr.dim td{opacity:.55}
.table tfoot th{background:transparent;font-size:.9rem;color:var(--ink)}
.oid{font-weight:700}
.mod{display:inline-flex;gap:6px;align-items:center;font-size:.8rem}
.mod .ic{width:15px;height:15px;color:var(--orange)}
.perms td,.perms th{padding:6px;text-align:center;font-size:.72rem}
.perms td:first-child{text-align:left}
.pager{display:flex;align-items:center;gap:8px;justify-content:flex-end;margin-top:14px;font-size:.8rem;color:var(--muted)}
.pager span{margin-right:auto}

/* Timeline */
.timeline{list-style:none;margin:0;padding:0 0 0 18px;border-left:2px solid var(--line);display:flex;flex-direction:column;gap:16px}
.timeline li{position:relative;font-size:.82rem}
.timeline li::before{content:"";position:absolute;left:-25px;top:3px;width:11px;height:11px;border-radius:50%;background:var(--purple);border:2px solid #fff;box-shadow:0 0 0 1px var(--line)}
.timeline li.dot-green::before,.dot-green.dotted{background:var(--green)}
.timeline li.dot-orange::before,.dot-orange.dotted{background:var(--orange)}
.timeline li.dot-red::before,.dot-red.dotted{background:var(--red)}
.timeline p{color:var(--muted);margin:2px 0}
.timeline small{color:var(--purple);font-size:.72rem;font-weight:600}
.dotted{display:inline-block;width:8px;height:8px;border-radius:50%;background:var(--purple);margin-right:6px}

/* Forms */
label{display:flex;flex-direction:column;gap:5px;font-size:.8rem;font-weight:600;color:#4b4960}
input,select,textarea{font:inherit;font-size:.88rem;font-weight:400;padding:9px 11px;border:1px solid #dddbe8;border-radius:10px;background:#fff;color:var(--ink);width:100%}
input:focus,select:focus,textarea:focus{outline:2px solid rgba(91,33,182,.25);border-color:var(--purple)}
.check{flex-direction:row;align-items:center;gap:8px;font-weight:500}
.check input{width:auto}
.form-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin-top:6px}
.form-grid .span-2{grid-column:span 2}
.form-actions{display:flex;gap:10px;justify-content:flex-end;align-items:end}
.checks{display:flex;gap:20px;align-items:center;flex-wrap:wrap}
.stack{display:flex;flex-direction:column;gap:12px;margin-top:8px}
.toolbar{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin-bottom:14px}
.toolbar input[type=search]{max-width:280px}
.toolbar select{max-width:220px}
.tabs{display:flex;gap:4px;background:#f4f4f9;padding:4px;border-radius:12px;margin-right:auto;flex-wrap:wrap}
.tabs a{padding:7px 12px;border-radius:9px;color:#4b4960;font-weight:600;font-size:.8rem}
.tabs a.on{background:#fff;color:var(--purple);box-shadow:var(--shadow)}
.tabs a:hover{text-decoration:none}
.inline-form{display:flex;gap:6px;align-items:center}
.inline-form input[type=number]{width:76px;padding:6px 8px}
.inline-form input[type=text]{width:130px;padding:6px 8px}
.inline-form select{padding:6px 8px;font-size:.8rem}
form.inline{display:inline}
.pw{display:flex;gap:8px;align-items:center}
.dl{display:grid;grid-template-columns:auto 1fr;gap:8px 14px;font-size:.85rem;margin:10px 0 14px}
.dl dt{color:var(--muted)} .dl dd{margin:0}
.note{background:#f7f7fc;border-radius:10px;padding:10px;font-size:.85rem;margin-top:12px}
.secret{border:2px dashed var(--purple)}
code.big{font-size:1.1rem;padding:4px 8px;background:var(--lav);border-radius:6px;user-select:all}
.checklist{list-style:none;padding:0;margin:10px 0;display:flex;flex-direction:column;gap:8px}
.checklist li{display:flex;gap:10px;align-items:center}
.checklist span{width:22px;height:22px;border-radius:50%;display:grid;place-items:center;font-weight:700;font-size:.75rem}
.checklist .ok span{background:var(--green-soft);color:var(--green)}
.checklist .bad span{background:var(--red-soft);color:var(--red)}

/* Flash */
.flash{padding:11px 14px;border-radius:12px;font-size:.85rem;font-weight:500}
.flash-success{background:var(--green-soft);color:#166534}
.flash-error{background:var(--red-soft);color:#991b1b}
.flash-warning{background:var(--orange-soft);color:#9a3412}
.flash-info{background:var(--lav);color:var(--purple)}
.flash a{margin-left:6px}

/* Login */
.login-page{min-height:100vh;display:grid;place-items:center;background:radial-gradient(circle at 15% 20%,#ede7fe 0,transparent 45%),radial-gradient(circle at 85% 80%,#ffe9db 0,transparent 40%),var(--bg)}
.login-wrap{display:grid;grid-template-columns:1.1fr 1fr;max-width:940px;width:calc(100% - 32px);background:#fff;border-radius:24px;box-shadow:0 30px 80px rgba(31,29,43,.12);overflow:hidden;margin:24px 0}
.login-wrap.single{grid-template-columns:1fr;max-width:460px}
.login-art{background:linear-gradient(150deg,#4c1d95,#6d28d9 60%,#8b5cf6);color:#fff;padding:40px;display:flex;flex-direction:column;gap:22px}
.login-art .brand strong,.login-art .brand small{color:#fff}
.login-art .brand-mark{background:rgba(255,255,255,.18)}
.login-art h1{font-size:1.7rem;line-height:1.25;margin-top:auto}
.login-art ul{list-style:none;padding:0;margin:0 0 auto;display:flex;flex-direction:column;gap:12px;opacity:.95}
.login-art li{display:flex;gap:10px;align-items:center}
.login-card{padding:40px;display:flex;flex-direction:column;gap:14px}
.login-card form{display:flex;flex-direction:column;gap:14px;margin-top:4px}

/* Responsive */
@media (max-width:1180px){
  .kpis{grid-template-columns:repeat(2,1fr)}
  .grid-2.wide-left,.grid-3{grid-template-columns:1fr}
  .span-2{grid-column:auto}
}
@media (max-width:900px){
  .grid-2{grid-template-columns:1fr}
  .form-grid{grid-template-columns:1fr 1fr}
  .sidebar{position:fixed;left:0;transform:translateX(-100%);transition:transform .2s;box-shadow:0 0 40px rgba(0,0,0,.15)}
  .sidebar.open{transform:none}
  .menu-btn{display:inline-grid}
  .topbar{padding:10px 16px}
  .topbar .btn-orange span{display:none}
  .content{padding:16px}
  .login-wrap{grid-template-columns:1fr}
  .login-art{display:none}
}
@media (max-width:560px){
  .kpis{grid-template-columns:1fr}
  .form-grid{grid-template-columns:1fr}
  .form-grid .span-2{grid-column:auto}
  .store-head .actions{justify-content:flex-start}
  .login-card{padding:28px 22px}
}
