@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&display=swap');

:root {
  --bg:        #090709;
  --bg-2:      #060506;
  --surface:   #0e0c10;
  --surface-2: #141118;
  --surface-3: #1b1720;
  --line:      #211d28;
  --line-2:    #2a2534;
  --blue:      #c96e48;
  --blue-soft: #e89872;
  --blue-dim:  #1a0d08;
  --gold:      #f0a830;
  --gold-2:    #c87c14;
  --gold-soft: #f5d080;
  --gold-dim:  #3a2808;
  --text:      #f0ece6;
  --muted:     #7a7282;
  --faint:     #38333e;
  --ok:        #4ecf80;
  --ko:        #e05454;
  --warn:      #e8b44a;
  --radius:    10px;
  --radius-sm: 7px;
  --side:      220px;
  --shadow:    0 12px 36px rgba(0,0,0,.55);
  --shadow-sm: 0 4px 14px rgba(0,0,0,.4);
  --ease:      cubic-bezier(.22,.61,.36,1);
  --font:      "Outfit", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100vh; min-height: 100dvh; }
::selection { background: rgba(201,110,72,.3); color: #fff; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--surface-3); }

body {
  font-family: var(--font); color: var(--text);
  font-size: 15px; line-height: 1.55; letter-spacing: .1px;
  -webkit-font-smoothing: antialiased; background: var(--bg);
}

/* ============================================================ SIDEBAR */
.ml-sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--side); z-index: 120;
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  transform: translateX(-100%); transition: transform .3s var(--ease);
}
.ml-sidebar.open { transform: translateX(0); }

.ml-brand { display: flex; align-items: center; gap: 11px; padding: 20px 16px 18px; border-bottom: 1px solid var(--line); }
.ml-logo {
  width: 36px; height: 36px; border-radius: 9px; flex: 0 0 auto;
  background: var(--blue-dim); border: 1px solid rgba(201,110,72,.22);
  color: var(--blue-soft); font-weight: 800; font-size: 13px; letter-spacing: .5px;
  display: flex; align-items: center; justify-content: center;
}
.ml-brandtext { display: flex; flex-direction: column; line-height: 1.15; }
.ml-brandtext b { font-size: 13.5px; font-weight: 700; color: var(--text); letter-spacing: .2px; }
.ml-brandtext small { font-size: 9px; color: var(--blue); letter-spacing: 3px; font-weight: 600; margin-top: 1px; }

.ml-nav { flex: 1; overflow-y: auto; padding: 10px 8px; display: flex; flex-direction: column; gap: 1px; }
.ml-group {
  font-size: 9px; font-weight: 700; letter-spacing: 1.6px; text-transform: uppercase;
  color: var(--faint); padding: 12px 10px 5px;
}
.ml-group:first-child { padding-top: 4px; }
.ml-link {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  border-radius: var(--radius-sm); color: var(--muted); text-decoration: none;
  font-weight: 500; font-size: 13px;
  transition: background .15s, color .15s;
}
.ml-link i { font-size: 17px; width: 20px; text-align: center; flex: 0 0 auto; }
.ml-link:hover { background: var(--surface-2); color: var(--text); }
.ml-link.active { color: var(--text); font-weight: 600; background: var(--blue-dim); }
.ml-link.active i { color: var(--blue-soft); }
.ml-link .ml-label { flex: 1; }

.ml-badge { min-width: 18px; height: 18px; padding: 0 5px; background: var(--ko); color: #fff;
  font-size: 10px; font-weight: 700; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; }

.ml-side-foot { border-top: 1px solid var(--line); padding: 12px; }
.ml-user { display: flex; align-items: center; gap: 10px; }
.ml-avatar { width: 32px; height: 32px; border-radius: 8px; flex: 0 0 auto;
  background: var(--blue-dim); color: var(--blue-soft); font-weight: 700; font-size: 11px;
  display: flex; align-items: center; justify-content: center; border: 1px solid rgba(201,110,72,.15); }
.ml-user-meta { flex: 1; min-width: 0; }
.ml-user-meta b { display: block; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ml-user-meta span { font-size: 10px; color: var(--blue); text-transform: uppercase; letter-spacing: .8px; }
.ml-logout { background: none; border: 1px solid var(--line-2); color: var(--muted); width: 32px; height: 32px;
  border-radius: 7px; cursor: pointer; flex: 0 0 auto; display: flex; align-items: center; justify-content: center;
  font-size: 16px; transition: all .15s; }
.ml-logout:hover { border-color: var(--ko); color: var(--ko); }

/* ============================================================ TOPBAR */
.ml-topbar { position: fixed; top: 0; left: 0; right: 0; height: 54px; z-index: 110;
  background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; padding: 0 14px; }
.ml-burger { background: none; border: 1px solid var(--line-2); color: var(--text); width: 36px; height: 36px;
  border-radius: 8px; font-size: 19px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all .15s; }
.ml-burger:active { transform: scale(.93); }
.ml-topbrand { font-weight: 700; letter-spacing: .3px; font-size: 15px; color: var(--text); }
.ml-topbrand span { color: var(--blue); }
.ml-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 115; opacity: 0; pointer-events: none;
  transition: opacity .3s; }
.ml-overlay.open { opacity: 1; pointer-events: auto; }

/* ============================================================ MAIN */
main, .ml-main { max-width: 1160px; margin: 0 auto; padding: 72px 16px 48px; }

h1 { font-size: 22px; font-weight: 700; letter-spacing: -.2px; margin-bottom: 4px; }
h2 { font-size: 16px; font-weight: 600; color: var(--text); margin: 20px 0 12px; }
h3 { font-size: 11px; font-weight: 600; color: var(--muted); margin: 14px 0 8px; text-transform: uppercase; letter-spacing: .8px; }
.ml-sub { color: var(--muted); font-size: 13px; margin-bottom: 20px; }

/* ============================================================ HERO */
.hero {
  border-radius: var(--radius-sm); margin-bottom: 16px; padding: 20px 22px;
  background: var(--surface); border: 1px solid var(--line);
}
.hero h1 { font-size: 22px; margin-bottom: 4px; }
.hero .hsub { color: var(--muted); font-size: 13px; }

/* ============================================================ CARDS */
.card { background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 18px; margin-bottom: 14px; }

.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: 1fr; }

/* ============================================================ KPI */
.kpi { display: flex; align-items: center; gap: 14px; }
.kpi .ic { width: 42px; height: 42px; border-radius: var(--radius-sm); flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; color: var(--blue-soft); background: var(--blue-dim);
  border: 1px solid rgba(201,110,72,.18); }
.kpi .meta { min-width: 0; }
.kpi .val { font-size: 24px; font-weight: 700; color: var(--gold); letter-spacing: -.3px; line-height: 1.15; }
.kpi .lbl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; margin-top: 2px; }

/* ============================================================ FORMS */
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; font-weight: 500; }
input, select, textarea { width: 100%; background: var(--surface-2); border: 1px solid var(--line-2); color: var(--text);
  padding: 11px 13px; border-radius: var(--radius-sm); font-size: 15px; font-family: inherit; margin-bottom: 12px;
  transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(201,110,72,.12); }
input::placeholder, textarea::placeholder { color: var(--faint); }
select { appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 32px; }

/* ============================================================ BUTTONS */
.btn { position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; border: none; border-radius: var(--radius-sm); padding: 12px 18px; font-size: 14px; font-weight: 600;
  cursor: pointer; font-family: inherit; color: #f0ece6; background: var(--blue);
  transition: filter .15s, transform .08s; }
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .4; cursor: not-allowed; filter: none; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--line-2); }
.btn-ghost:hover { background: var(--surface-2); filter: none; }
.btn-danger { background: var(--ko); }
.btn-row { display: flex; gap: 10px; }
.btn-sm { width: auto; padding: 7px 13px; font-size: 13px; }
.ripple { position: absolute; border-radius: 50%; transform: scale(0); background: rgba(255,255,255,.25);
  pointer-events: none; animation: rip .5s var(--ease); }
@keyframes rip { to { transform: scale(3); opacity: 0; } }

/* ============================================================ TABLES / TAGS / TOAST */
table.ml-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.ml-table th, .ml-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.ml-table th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .6px; font-weight: 600; }
.ml-table tr:last-child td { border-bottom: none; }

.tag { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 5px; font-size: 11px; font-weight: 600; border: 1px solid transparent; }
.tag-ok   { background: rgba(78,207,128,.1);  color: var(--ok);   border-color: rgba(78,207,128,.2); }
.tag-ko   { background: rgba(224,84,84,.1);   color: var(--ko);   border-color: rgba(224,84,84,.2); }
.tag-warn { background: rgba(232,180,74,.1);  color: var(--warn); border-color: rgba(232,180,74,.2); }
.tag-muted { background: var(--surface-2); color: var(--muted); border-color: var(--line-2); }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--surface-2); color: var(--text); border: 1px solid var(--line-2); border-left: 3px solid var(--blue);
  padding: 12px 18px; border-radius: var(--radius-sm); box-shadow: var(--shadow); font-weight: 600; max-width: 88vw; z-index: 300;
  opacity: 0; pointer-events: none; transition: all .28s var(--ease); }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.ok { border-left-color: var(--ok); }
#toast.ko { border-left-color: var(--ko); }

/* ============================================================ UTILS */
.muted { color: var(--muted); } .center { text-align: center; }
.mt { margin-top: 14px; } .mb { margin-bottom: 14px; }
.hidden, [hidden] { display: none !important; }
.row { display: flex; align-items: center; gap: 10px; } .between { justify-content: space-between; }
.gold { color: var(--gold); } a { color: var(--blue-soft); }

/* ============================================================ DESKTOP */
@media (min-width: 900px) {
  .ml-sidebar { transform: translateX(0); }
  .ml-topbar, .ml-overlay { display: none; }
  main, .ml-main { margin-left: var(--side); max-width: 980px; padding: 36px 40px 60px; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  h1 { font-size: 26px; } .hero h1 { font-size: 26px; }
}
@media (max-width: 600px) {
  body { overflow-x: hidden; }
  .grid-2 { grid-template-columns: 1fr; }
  .kpi .val { font-size: 20px; }
  .form-grid, .add-row, .emp, .prod, .req, .as, .chg, .tbl-row, .ach, .so {
    grid-template-columns: 1fr !important; gap: 8px !important;
  }
}
