/* SD Lenvix ERP — shared styles */
:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f0f2f8;
  --border: #e3e7ef;
  --text: #121826;
  --muted: #5f6b7e;
  --primary: #4f46e5;
  --primary-ink: #ffffff;
  --primary-soft: #eceafd;
  --accent: #0ea5a4;
  --success: #15803d;
  --success-soft: #dcfce7;
  --warning: #b45309;
  --warning-soft: #fef3c7;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 4px 16px rgba(16,24,40,.06);
  --radius: 12px;
  --sidebar: 248px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0d1117;
  --surface: #151b24;
  --surface-2: #1c2430;
  --border: #283241;
  --text: #e6eaf2;
  --muted: #95a1b4;
  --primary: #818cf8;
  --primary-ink: #0d1117;
  --primary-soft: #232848;
  --accent: #2dd4bf;
  --success: #4ade80;
  --success-soft: #11301d;
  --warning: #fbbf24;
  --warning-soft: #352a0d;
  --danger: #f87171;
  --danger-soft: #3a1515;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 15px;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .6rem 1rem; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: var(--primary); filter: brightness(1.08); }
.btn-sm { padding: .35rem .7rem; font-size: 13px; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-danger { color: var(--danger); }

input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; padding: .55rem .75rem; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: transparent; }
label { font-size: 13px; font-weight: 600; color: var(--muted); display: block; margin-bottom: .3rem; }

/* ---------- Landing page ---------- */
.nav {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.container { max-width: 1140px; margin: 0 auto; padding: 0 20px; }
.nav .container { display: flex; align-items: center; justify-content: space-between; height: 66px; gap: 1rem; }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 800; font-size: 18px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand img { width: 34px; height: 34px; }
.brand small { font-weight: 600; color: var(--muted); font-size: 12px; letter-spacing: .08em; }
.nav-links { display: flex; gap: 1.4rem; align-items: center; }
.nav-links a:not(.btn) { color: var(--muted); font-weight: 500; }
.nav-links a:not(.btn):hover { color: var(--text); text-decoration: none; }

.hero { padding: 84px 0 64px; text-align: center; }
.badge {
  display: inline-block; padding: .3rem .8rem; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary); font-weight: 600; font-size: 13px; margin-bottom: 1.2rem;
}
.hero h1 { font-size: clamp(2rem, 5vw, 3.4rem); letter-spacing: -.02em; max-width: 820px; margin: 0 auto .6em; }
.hero h1 span { background: linear-gradient(90deg, var(--primary), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { font-size: 18px; color: var(--muted); max-width: 640px; margin: 0 auto 2rem; }
.hero .cta { display: flex; gap: .8rem; justify-content: center; flex-wrap: wrap; }

.preview {
  margin: 56px auto 0; max-width: 980px; border-radius: 16px; overflow: hidden;
  border: 1px solid var(--border); box-shadow: var(--shadow); background: var(--surface);
}
.preview-bar { display: flex; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.preview-bar i { width: 10px; height: 10px; border-radius: 50%; background: var(--border); }
.preview-body { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; padding: 20px; text-align: left; }
.preview-body .kpi { margin: 0; }

.section { padding: 72px 0; }
.section-head { text-align: center; max-width: 640px; margin: 0 auto 40px; }
.section-head p { color: var(--muted); }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.feature {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow);
}
.feature .ico {
  width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary); margin-bottom: 14px;
}
.feature h3 { font-size: 17px; }
.feature p { color: var(--muted); margin: 0; }

.pricing { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.plan { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; display: flex; flex-direction: column; }
.plan.featured { border: 2px solid var(--primary); }
.plan .price { font-size: 36px; font-weight: 800; margin: .4rem 0; }
.plan .price small { font-size: 15px; color: var(--muted); font-weight: 500; }
.plan ul { list-style: none; padding: 0; margin: 1rem 0 1.6rem; flex: 1; }
.plan li { padding: .35rem 0; color: var(--muted); }
.plan li::before { content: "✓"; color: var(--success); font-weight: 700; margin-right: .5rem; }

.cta-band {
  background: linear-gradient(120deg, var(--primary), var(--accent)); color: #fff;
  border-radius: 18px; padding: 48px; text-align: center;
}
.cta-band p { opacity: .9; }
.cta-band .btn { background: #fff; color: #1e1b4b; border-color: #fff; }

.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
}
.form-row { margin-bottom: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

footer.site { border-top: 1px solid var(--border); padding: 28px 0; color: var(--muted); font-size: 14px; }
footer.site .container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }

/* ---------- Login ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-card { width: 100%; max-width: 410px; }
.auth-card .brand { justify-content: center; margin-bottom: 1.4rem; }
.demo-note { background: var(--primary-soft); color: var(--primary); padding: .7rem .9rem; border-radius: 10px; font-size: 13px; margin-bottom: 1rem; }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  background: var(--surface); border-right: 1px solid var(--border);
  position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 18px 14px; display: flex; flex-direction: column;
}
.sidebar .brand { padding: 4px 8px 18px; }
.side-label { font-size: 11px; font-weight: 700; letter-spacing: .1em; color: var(--muted); text-transform: uppercase; padding: 14px 10px 6px; }
.side-link {
  display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem; border-radius: 9px;
  color: var(--muted); font-weight: 500;
}
.side-link svg { width: 18px; height: 18px; flex: none; }
.side-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.side-link.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.side-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 64px; display: flex; align-items: center; gap: 12px; padding: 0 24px;
  background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5;
}
.topbar .search { max-width: 360px; }
.topbar .spacer { flex: 1; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; font-weight: 700; font-size: 13px;
}
.icon-btn { width: 38px; height: 38px; padding: 0; justify-content: center; }
.menu-btn { display: none; }

.content { padding: 24px; max-width: 1400px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: 24px; margin: 0; }
.page-head p { margin: .2rem 0 0; color: var(--muted); }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.kpi .label { color: var(--muted); font-size: 13px; font-weight: 600; }
.kpi .value { font-size: 26px; font-weight: 800; margin: .25rem 0; font-variant-numeric: tabular-nums; }
.kpi .delta { font-size: 13px; font-weight: 600; }
.up { color: var(--success); }
.down { color: var(--danger); }

.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 18px; }
.grid-2e { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 18px; }
.card h2 { font-size: 16px; margin-bottom: .2rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: 12px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: .7rem .8rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; background: var(--surface-2); }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
td.right, th.right { text-align: right; }
tbody tr:hover { background: var(--surface-2); }
.toolbar { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input { max-width: 280px; }
.toolbar select { max-width: 180px; }
.empty { text-align: center; color: var(--muted); padding: 30px; }

.pill { display: inline-block; padding: .15rem .6rem; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill.ok { background: var(--success-soft); color: var(--success); }
.pill.warn { background: var(--warning-soft); color: var(--warning); }
.pill.bad { background: var(--danger-soft); color: var(--danger); }
.pill.info { background: var(--primary-soft); color: var(--primary); }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; gap: 1rem; padding: .65rem 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }

.bar-track { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--primary); border-radius: 99px; }

/* ---------- Charts ---------- */
.chart svg { width: 100%; height: auto; display: block; }
.chart .axis { stroke: var(--border); }
.chart text { fill: var(--muted); font-size: 11px; }
.legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }
.chart-tip {
  position: fixed; pointer-events: none; background: var(--text); color: var(--bg);
  padding: .35rem .6rem; border-radius: 8px; font-size: 12px; font-weight: 600; z-index: 50; display: none;
}

/* ---------- Modal & toast ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(10,14,22,.5); display: none; align-items: center; justify-content: center; padding: 16px; z-index: 40; }
.modal-bg.open { display: flex; }
.modal { width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 8px; }
.toast {
  position: fixed; bottom: 20px; right: 20px; background: var(--text); color: var(--bg);
  padding: .75rem 1rem; border-radius: 10px; font-weight: 600; box-shadow: var(--shadow);
  transform: translateY(120%); opacity: 0; transition: .25s; z-index: 60;
}
.toast.show { transform: none; opacity: 1; }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.switch { display: flex; align-items: center; justify-content: space-between; padding: .6rem 0; border-bottom: 1px solid var(--border); }
.switch:last-child { border-bottom: 0; }
.switch input { width: auto; }

/* ---------- 404 ---------- */
.notfound { min-height: 100vh; display: grid; place-items: center; text-align: center; padding: 20px; }
.notfound h1 { font-size: 80px; margin: 0; background: linear-gradient(90deg, var(--primary), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .features, .pricing { grid-template-columns: 1fr 1fr; }
  .preview-body { grid-template-columns: 1fr 1fr; }
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: var(--sidebar); z-index: 30; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .grid-2e, .settings-grid, .contact-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .nav-links a:not(.btn) { display: none; }
  .features, .pricing, .kpis, .form-grid { grid-template-columns: 1fr; }
  .content { padding: 16px; }
  .topbar { padding: 0 16px; }
  .topbar .search { display: none; }
  .cta-band { padding: 32px 20px; }
  .container { padding: 0 16px; }
}
