/* V-MARC prototype - shared styles */
:root {
  --brand: #ea580c;         /* orange-600 */
  --brand-dark: #c2410c;
  --bg: #f8fafc;
  --panel: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --ok: #16a34a;
  --warn: #dc2626;
  --sidebar: #0f172a;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
}

/* Layout */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--sidebar);
  color: #e2e8f0;
  padding: 20px 0;
  position: sticky; top: 0; height: 100vh;
}
.brand {
  padding: 0 20px 20px; border-bottom: 1px solid #1e293b;
  display: flex; align-items: center; gap: 10px;
}
.brand-logo {
  width: 34px; height: 34px; border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), #f97316);
  display: grid; place-items: center; color: #fff; font-weight: 800;
}
.brand-name { font-weight: 700; font-size: 15px; }
.brand-sub { font-size: 11px; color: #94a3b8; }

.nav { padding: 16px 0; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px; color: #cbd5e1; text-decoration: none;
  font-size: 13px; border-left: 3px solid transparent;
  transition: all .15s;
}
.nav a:hover { background: #1e293b; color: #fff; }
.nav a.active {
  background: #1e293b; color: #fff; border-left-color: var(--brand);
}
.nav-icon { width: 18px; height: 18px; opacity: .85; }
.nav-section { padding: 12px 20px 6px; font-size: 10px; letter-spacing: 1.5px; color: #64748b; text-transform: uppercase; }

/* Main */
.main { padding: 0; }
.topbar {
  background: #fff; border-bottom: 1px solid var(--line);
  padding: 14px 28px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 10;
}
.topbar h1 { margin: 0; font-size: 18px; font-weight: 600; }
.topbar .crumb { color: var(--muted); font-size: 12px; }
.content { padding: 24px 28px; }

/* Cards */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 20px; margin-bottom: 16px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line);
}
.card-title { font-size: 15px; font-weight: 600; margin: 0; }
.card-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* Form */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 500; color: var(--ink); }
.field select, .field input {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px;
  background: #fff; font-size: 13px; color: var(--ink); font-family: inherit;
  transition: border-color .15s;
}
.field select:focus, .field input:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(234,88,12,.12);
}
.field .hint { font-size: 11px; color: var(--muted); }
.field.full { grid-column: 1 / -1; }

/* Buttons */
.btn {
  padding: 8px 14px; border: 1px solid var(--line); border-radius: 6px;
  background: #fff; font-size: 13px; cursor: pointer; font-weight: 500;
  transition: all .15s;
}
.btn:hover { background: #f1f5f9; }
.btn-primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-ghost { background: transparent; border: none; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* Two-col layout for designer */
.split { display: grid; grid-template-columns: 380px 1fr; gap: 20px; align-items: start; }
@media (max-width: 1100px) { .split { grid-template-columns: 1fr; } }

/* Output tables */
.output-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.output-table th, .output-table td {
  padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line);
}
.output-table th {
  background: #f8fafc; font-weight: 500; color: var(--muted);
  font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
}
.output-table td.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
.output-table tr:last-child td { border-bottom: none; }
.output-table tr.total td { background: #fff7ed; font-weight: 600; color: var(--brand-dark); }

/* Stat pills / badges */
.pill {
  display: inline-block; padding: 3px 8px; border-radius: 12px;
  background: #f1f5f9; font-size: 11px; font-weight: 500; color: var(--muted);
}
.pill.brand { background: #ffedd5; color: var(--brand-dark); }
.pill.ok    { background: #dcfce7; color: #15803d; }
.pill.warn  { background: #fee2e2; color: #991b1b; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tab {
  padding: 10px 14px; background: none; border: none; cursor: pointer;
  font-size: 13px; color: var(--muted); border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tab.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 500; }
.tab:hover { color: var(--ink); }

/* Cable SVG panel */
.cable-viz {
  background: linear-gradient(135deg, #0f172a, #1e293b);
  border-radius: 10px; padding: 20px; color: #e2e8f0;
  display: flex; align-items: center; justify-content: center;
  min-height: 300px;
}
.cable-viz svg { max-width: 100%; height: auto; }

/* Meta grid */
.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 16px; }
.meta {
  padding: 10px 12px; background: #f8fafc; border-radius: 8px; border: 1px solid var(--line);
}
.meta-label { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.meta-value { font-size: 16px; font-weight: 600; color: var(--ink); margin-top: 2px; }
.meta-value small { font-size: 11px; font-weight: 400; color: var(--muted); margin-left: 3px; }

/* Toast */
.toast {
  position: fixed; bottom: 24px; right: 24px; padding: 12px 18px;
  background: var(--ink); color: #fff; border-radius: 8px; font-size: 13px;
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
  opacity: 0; transform: translateY(10px); transition: all .2s;
  z-index: 100; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* Empty */
.empty {
  text-align: center; padding: 40px 20px; color: var(--muted);
}
.empty-icon { font-size: 40px; opacity: .3; margin-bottom: 8px; }

/* Master table */
.master-tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.master-tbl th, .master-tbl td {
  padding: 2px 6px; border-bottom: 1px solid var(--line); text-align: left;
  vertical-align: middle;
}
.master-tbl th { background: #f8fafc; font-weight: 500; font-size: 11px; color: var(--muted); position: sticky; top: 52px; }
.master-tbl tbody tr:hover { background: #f8fafc; }
.master-tbl input, .mcell {
  width: 100%; padding: 3px 6px; border: 1px solid transparent;
  background: transparent; font-size: 12px; font-family: inherit;
  color: var(--ink); border-radius: 4px;
  font-variant-numeric: tabular-nums;
  line-height: 1.4; height: 26px; box-sizing: border-box;
}
.master-tbl input:hover, .mcell:hover { background: #f8fafc; border-color: var(--line); }
.master-tbl input:focus, .mcell:focus { outline: none; border-color: var(--brand); background: #fff; box-shadow: 0 0 0 2px rgba(234,88,12,.15); }

/* Small utils */
.row { display: flex; gap: 10px; align-items: center; }
.gap { flex: 1; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; }
