/* Smart Factory & EnMS Pro · MOHINHLAI — Industrial 4.0 MES + OEE + ISO 50001 UI */
:root {
  --brand: #0F172A;
  --teal: #0F766E;
  --emerald: #059669;
  --amber: #D97706;
  --red: #DC2626;
  --blue: #2563EB;
  --bg: #F1F5F9;
  --card: #FFFFFF;
  --text: #0F172A;
  --muted: #475569;
  --line: #CBD5E1;
  --sh: 0 2px 8px rgba(15,23,42,.06), 0 10px 24px rgba(15,23,42,.06);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; }
.hide { display: none !important; }
a { color: var(--teal); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 11px 16px; border: 0; border-radius: 11px; background: var(--brand); color: #fff; font: inherit; font-weight: 800; cursor: pointer; min-height: 44px; text-decoration: none; }
.btn:active { transform: scale(.985); }
.btn.full { width: 100%; }
.btn.teal { background: linear-gradient(180deg, #14B8A6, #0F766E); color: #fff; box-shadow: 0 4px 12px rgba(15,118,110,.28); }
.btn.green { background: linear-gradient(180deg, #10B981, #059669); color: #fff; }
.btn.amber { background: linear-gradient(180deg, #F59E0B, #D97706); color: #0F172A; }
.btn.red { background: linear-gradient(180deg, #EF4444, #DC2626); color: #fff; }
.btn.soft { background: #CCFBF1; color: #115E59; }
.btn.outline { background: #fff; color: var(--text); border: 1.5px solid var(--line); }
.btn.ghost { background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.26); }
.btn.sm { min-height: 36px; padding: 7px 12px; font-size: .84rem; border-radius: 9px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

label { display: block; font-weight: 700; font-size: .86rem; color: #334155; margin-bottom: 4px; }
input, select, textarea { width: 100%; padding: 9px 12px; border: 1.5px solid var(--line); border-radius: 10px; font: inherit; background: #F8FAFC; min-height: 41px; }
textarea { min-height: 78px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(15,118,110,.2); border-color: var(--teal); background: #fff; }
.field { margin-bottom: 11px; }
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.fgrid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
@media (max-width: 640px) { .fgrid, .fgrid3 { grid-template-columns: 1fr; } }

.msg { padding: 11px 14px; border-radius: 11px; font-size: .9rem; margin-bottom: 12px; }
.msg.err { background: #FEE2E2; color: #991B1B; border: 1px solid #FCA5A5; }
.msg.ok { background: #DCFCE7; color: #065F46; border: 1px solid #86EFAC; }
.msg.info { background: #DBEAFE; color: #1E3A8A; border: 1px solid #93C5FD; }
.msg.warn { background: #FEF3C7; color: #92400E; border: 1px solid #FCD34D; }

.pill { display: inline-block; padding: 3px 9px; border-radius: 99px; font-size: .74rem; font-weight: 800; white-space: nowrap; }
.pill.ok { background: #DCFCE7; color: #065F46; }
.pill.warn { background: #FEF3C7; color: #92400E; }
.pill.err { background: #FEE2E2; color: #991B1B; }
.pill.blue { background: #DBEAFE; color: #1E40AF; }
.pill.teal { background: #CCFBF1; color: #115E59; }
.pill.gray { background: #E2E8F0; color: #475569; }
.muted { color: var(--muted); font-size: .85rem; }
.card { background: #fff; border: 1px solid #E2E8F0; border-radius: 15px; padding: 16px; box-shadow: var(--sh); margin-bottom: 14px; }
.card h2 { margin: 0 0 10px; font-size: 1.06rem; color: var(--brand); }

/* LANDING */
.lp-nav { position: sticky; top: 0; z-index: 40; background: rgba(255,255,255,.95); backdrop-filter: blur(12px); border-bottom: 1px solid #E2E8F0; }
.lp-wrap { max-width: 1180px; margin: 0 auto; padding: 0 18px; }
.lp-nav-in { display: flex; align-items: center; justify-content: space-between; height: 66px; gap: 10px; }
.lp-brand { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 1.12rem; color: var(--brand); text-decoration: none; }
.lp-brand img { width: 38px; height: 38px; border-radius: 10px; }
.lp-brand small { display: block; font-size: .72rem; color: var(--muted); font-weight: 600; }

.lp-hero { background: linear-gradient(135deg, #020617 0%, #0F172A 48%, #115E59 100%); color: #fff; padding: 54px 0 62px; }
.lp-hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 34px; align-items: center; }
.lp-badge { display: inline-flex; align-items: center; gap: 8px; background: rgba(20,184,166,.2); border: 1px solid rgba(45,212,191,.45); color: #99F6E4; padding: 6px 14px; border-radius: 99px; font-size: .83rem; font-weight: 800; margin-bottom: 14px; }
.lp-hero h1 { font-size: clamp(1.9rem, 3.8vw, 2.9rem); line-height: 1.14; margin: 0 0 14px; font-weight: 900; }
.lp-hero h1 em { font-style: normal; color: #34D399; }
.lp-hero p.lead { font-size: 1.03rem; color: #CBD5E1; margin: 0 0 22px; }
.hero-panel { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.16); border-radius: 20px; padding: 18px; display: grid; gap: 8px; }
.hp-row { background: rgba(255,255,255,.09); border-radius: 11px; padding: 10px 12px; display: flex; justify-content: space-between; align-items: center; font-size: .86rem; }

.lp-sec { padding: 50px 0; }
.lp-sec.alt { background: #fff; border-top: 1px solid #E2E8F0; border-bottom: 1px solid #E2E8F0; }
.lp-head { text-align: center; max-width: 740px; margin: 0 auto 28px; }
.lp-head h2 { font-size: clamp(1.45rem, 2.8vw, 2.05rem); color: var(--brand); margin: 0 0 8px; font-weight: 900; }
.feat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; }
.price-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.feat-card, .price-card { background: #fff; border: 1.5px solid #E2E8F0; border-radius: 16px; padding: 20px 16px; box-shadow: var(--sh); display: flex; flex-direction: column; position: relative; }
.price-card.pop { border-color: var(--teal); box-shadow: 0 12px 30px rgba(15,118,110,.2); }
.price-tag { position: absolute; top: -11px; right: 14px; background: var(--teal); color: #fff; font-size: .72rem; font-weight: 800; padding: 3px 11px; border-radius: 99px; }
.price-amt { font-size: 1.65rem; font-weight: 900; color: var(--brand); margin: 8px 0 3px; }
.price-ul { list-style: none; padding: 0; margin: 12px 0 18px; flex: 1; display: grid; gap: 7px; font-size: .85rem; color: #334155; }
.price-ul li::before { content: "✓ "; color: var(--emerald); font-weight: 900; }
.lp-footer { background: #020617; color: #94A3B8; padding: 28px 0; font-size: .88rem; }
.lp-footer a { color: #CBD5E1; text-decoration: none; }
@media (max-width: 980px) { .lp-hero-grid, .price-grid { grid-template-columns: 1fr; } .feat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .feat-grid { grid-template-columns: 1fr; } }

/* WORKSPACE */
.sf-layout { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sf-side { background: #0B1324; color: #CBD5E1; padding: 14px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sf-logo { display: flex; align-items: center; gap: 10px; padding: 6px 6px 12px; border-bottom: 1px solid rgba(255,255,255,.1); margin-bottom: 8px; color: #fff; }
.sf-logo img { width: 34px; height: 34px; border-radius: 9px; }
.side-btn { width: 100%; text-align: left; background: transparent; border: 0; color: #CBD5E1; padding: 10px 11px; border-radius: 10px; font: inherit; font-size: .89rem; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.side-btn.on { background: linear-gradient(90deg, #0D9488, #0F766E); color: #fff; }
.side-btn .bdg { background: #EF4444; color: #fff; border-radius: 99px; font-size: .7rem; padding: 2px 7px; font-weight: 800; }

.sf-main { min-width: 0; display: flex; flex-direction: column; }
.sf-top { background: #fff; border-bottom: 1px solid #E2E8F0; padding: 10px 20px; display: flex; align-items: center; justify-content: space-between; gap: 10px; position: sticky; top: 0; z-index: 25; }
.sf-top h1 { margin: 0; font-size: 1.15rem; color: var(--brand); }
.sf-body { padding: 18px 20px 36px; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(195px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi-card { background: #fff; border: 1px solid #E2E8F0; border-radius: 14px; padding: 14px 16px; border-left: 5px solid var(--teal); box-shadow: var(--sh); }
.kpi-card.green { border-left-color: var(--emerald); }
.kpi-card.amber { border-left-color: var(--amber); }
.kpi-card.red { border-left-color: var(--red); }
.kpi-card.blue { border-left-color: var(--blue); }
.kpi-card small { color: var(--muted); font-weight: 700; font-size: .79rem; display: block; }
.kpi-card b { font-size: 1.38rem; color: var(--brand); display: block; margin-top: 3px; }

/* Live Machine Cards (SCADA Grid) */
.mach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(265px, 1fr)); gap: 12px; margin-bottom: 16px; }
.mach-card { background: #fff; border: 1.5px solid #E2E8F0; border-radius: 14px; padding: 14px; box-shadow: var(--sh); position: relative; }
.mach-card.running { border-top: 5px solid #10B981; }
.mach-card.idle { border-top: 5px solid #F59E0B; }
.mach-card.down { border-top: 5px solid #EF4444; background: #FEF2F2; }
.mach-card.maintenance { border-top: 5px solid #64748B; }
.mach-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 10px 0; text-align: center; }
.mach-metrics div { background: #F8FAFC; border: 1px solid #E2E8F0; border-radius: 9px; padding: 6px 4px; }
.mach-metrics small { display: block; font-size: .71rem; color: var(--muted); }
.mach-metrics b { font-size: .92rem; color: var(--brand); }

.tbl-wrap { overflow-x: auto; background: #fff; border: 1px solid #E2E8F0; border-radius: 12px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .86rem; }
table.tbl th { background: #F8FAFC; color: #334155; font-weight: 800; text-align: left; padding: 9px 10px; border-bottom: 1.5px solid #CBD5E1; white-space: nowrap; }
table.tbl td { padding: 9px 10px; border-bottom: 1px solid #F1F5F9; vertical-align: middle; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.bar-track { height: 10px; background: #E2E8F0; border-radius: 99px; overflow: hidden; margin-top: 5px; }
.bar-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, #0D9488, #10B981); }

.mask { position: fixed; inset: 0; background: rgba(15,23,42,.55); z-index: 80; display: flex; align-items: center; justify-content: center; padding: 14px; }
.sheet { background: #fff; width: 100%; max-width: 700px; border-radius: 18px; max-height: 92vh; overflow: auto; padding: 0 20px 20px; box-shadow: 0 24px 60px rgba(0,0,0,.3); }
.sheet-head { position: sticky; top: 0; background: #fff; margin: 0 -20px 14px; padding: 14px 20px; border-bottom: 1px solid #E2E8F0; display: flex; justify-content: space-between; align-items: center; z-index: 5; }
.sheet-head h3 { margin: 0; font-size: 1.06rem; color: var(--brand); }
.sheet-x { background: #F1F5F9; border: 0; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 1.1rem; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); top: 16px; z-index: 120; padding: 11px 18px; border-radius: 11px; font-weight: 800; box-shadow: 0 10px 28px rgba(0,0,0,.25); }
.toast.ok { background: #065F46; color: #fff; }
.toast.err { background: #991B1B; color: #fff; }
.toast.info { background: var(--brand); color: #fff; }

.mob-btn { display: none; }
@media (max-width: 920px) {
  .sf-layout { grid-template-columns: 1fr; }
  .sf-side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 65; transform: translateX(-105%); transition: transform .2s; }
  .sf-side.open { transform: translateX(0); }
  .mob-btn { display: inline-flex; }
  .sf-body { padding: 12px; }
}
