/* Solar ERP — admin theme. Self-contained, no external dependencies. */
:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --sidebar: #0f2438;
  --sidebar-hover: #1b3a58;
  --primary: #1f8a4c;
  --primary-dark: #176b3a;
  --accent: #f5a623;
  --text: #1f2933;
  --muted: #66788a;
  --border: #e3e8ee;
  --danger: #d64545;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16,32,52,.08), 0 1px 2px rgba(16,32,52,.06);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout shell */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; background: var(--sidebar); color: #cdd8e3; flex-shrink: 0;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { padding: 20px 20px 16px; font-size: 17px; font-weight: 700; color: #fff; display: flex; align-items: center; gap: 10px; }
.sidebar .brand .logo { width: 28px; height: 28px; background: var(--primary); border-radius: 7px; display: grid; place-items: center; font-size: 15px; }
.sidebar nav { padding: 6px 10px; overflow-y: auto; flex: 1; }
.sidebar .nav-section { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: #64788e; padding: 14px 12px 6px; }
.sidebar a.nav-link {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 8px;
  color: #cdd8e3; font-weight: 500; margin-bottom: 2px;
}
.sidebar a.nav-link:hover { background: var(--sidebar-hover); text-decoration: none; color: #fff; }
.sidebar a.nav-link.active { background: var(--primary); color: #fff; }
.sidebar a.nav-link .ico { width: 18px; text-align: center; opacity: .9; }
.sidebar a.nav-link.disabled { opacity: .45; cursor: default; }
.sidebar a.nav-link.disabled:hover { background: transparent; color: #cdd8e3; }
.badge-soon { margin-left: auto; font-size: 9px; background: #24425f; padding: 2px 6px; border-radius: 6px; color: #9fb3c6; }

/* Main column */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  background: var(--surface); border-bottom: 1px solid var(--border); padding: 0 24px;
  height: 60px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 20;
}
.topbar .page-title { font-size: 16px; font-weight: 600; }
.topbar .user { display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 13px; }
.content { padding: 24px; max-width: 1200px; width: 100%; }

/* Cards & tiles */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card .card-head { padding: 16px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card .card-head h3 { margin: 0; font-size: 15px; }
.card .card-body { padding: 18px; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 22px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.kpi .label { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.kpi .value { font-size: 26px; font-weight: 700; margin-top: 6px; }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.accent { border-top: 3px solid var(--primary); }
.kpi.warn { border-top: 3px solid var(--accent); }

/* Tables */
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); }
table.data th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
table.data tbody tr:hover { background: #f9fbfc; }
table.data td.num, table.data th.num { text-align: right; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 15px; border-radius: 8px; border: 1px solid transparent; font-size: 13.5px; font-weight: 600; cursor: pointer; background: #eef1f5; color: var(--text); }
.btn:hover { text-decoration: none; filter: brightness(.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 5px; color: #384656; }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; font-size: 13.5px; background: #fff; font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(31,138,76,.12); }
.field .err { color: var(--danger); font-size: 12px; margin-top: 4px; }
.field.has-error input, .field.has-error select { border-color: var(--danger); }
.form-actions { display: flex; gap: 10px; margin-top: 22px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: auto; }

/* Badges / pills */
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.pill-new { background: #e7f0ff; color: #2b62c4; }
.pill-open { background: #e9f7ef; color: var(--primary-dark); }
.pill-won { background: #d8f5e3; color: #14683a; }
.pill-lost { background: #fdeaea; color: var(--danger); }
.pill-neutral { background: #eef1f5; color: #55657a; }
.pill-high { background: #fdeaea; color: var(--danger); }
.pill-medium { background: #fff3e0; color: #b26a00; }
.pill-low { background: #eef1f5; color: #55657a; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; font-weight: 500; }
.alert-success { background: #e9f7ef; color: #14683a; border: 1px solid #bfe6cd; }
.alert-error { background: #fdeaea; color: #a3262c; border: 1px solid #f3c2c2; }

/* Pipeline strip */
.pipeline { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 22px; }
.pipeline .stage { background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 11px 14px; min-width: 120px; flex-shrink: 0; }
.pipeline .stage .n { font-size: 20px; font-weight: 700; }
.pipeline .stage .s { font-size: 11.5px; color: var(--muted); }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 18px 24px; border-left: 2px solid var(--border); }
.timeline li:last-child { border-left-color: transparent; }
.timeline li .dot { position: absolute; left: -7px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--primary); border: 2px solid #fff; }
.timeline li .meta { font-size: 12px; color: var(--muted); }

.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 26px 0 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.two-col { display: grid; grid-template-columns: 2fr 1fr; gap: 22px; align-items: start; }
.dl { display: grid; grid-template-columns: 130px 1fr; gap: 8px 14px; }
.dl dt { color: var(--muted); font-size: 13px; }
.dl dd { margin: 0; font-size: 13.5px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar input, .toolbar select { padding: 8px 11px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; }

/* Reports */
.report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-bottom: 22px; }
.report-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; display: block; color: inherit; }
.report-tile:hover { text-decoration: none; border-color: var(--primary); box-shadow: 0 2px 8px rgba(31,138,76,.12); }
.report-tile .ico { font-size: 22px; }
.report-tile h3 { margin: 8px 0 4px; font-size: 15px; }
.report-tile p { margin: 0; color: var(--muted); font-size: 12.5px; }
.chart-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.chart-card h3 { margin: 0 0 12px; font-size: 14px; }
.report-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.report-tabs a { padding: 7px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); background: var(--surface); border: 1px solid var(--border); }
.report-tabs a:hover { text-decoration: none; color: var(--text); }
.report-tabs a.active { background: var(--primary); color: #fff; border-color: var(--primary); }

@media (max-width: 860px) {
  .sidebar { display: none; }
  .form-grid, .two-col, .chart-2col { grid-template-columns: 1fr; }
}
