:root {
  --hg-bg: #111111;
  --hg-panel: #1a1a1a;
  --hg-panel-soft: #1a1a1a;
  --hg-border: #2a2a2a;
  --hg-text: #e4e4e7;
  --hg-muted: #71717a;
  --hg-muted-strong: #a1a1aa;
  --hg-primary: #a855f7;
  --hg-primary-soft: #c084fc;
  --hg-accent: #ec4899;
  --hg-success: #22c55e;
  --hg-graphs-bg: #0f172a;
  --hg-graphs-panel: #1a1f35;
  --hg-graphs-card: #1e293b;
  --hg-graphs-border: #334155;
  --hg-graphs-border-strong: #475569;
  --hg-graphs-purple: #9333ea;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #1a1a1a;
  color: var(--hg-text);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;
}

.pencil-dashboard {
  display: flex;
  min-height: 100vh;
  background: var(--hg-bg);
  color: var(--hg-text);
}

.pencil-sidebar {
  position: sticky;
  top: 0;
  display: flex;
  width: 220px;
  height: 100vh;
  flex: 0 0 220px;
  flex-direction: column;
  border-right: 1px solid var(--hg-border);
  background: #1a1a1a;
}

.pencil-brand {
  display: flex;
  height: 64px;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  font-size: 12px;
  font-weight: 600;
  color: #ffffff;
}

.pencil-brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--hg-primary);
}

.pencil-nav {
  display: grid;
  gap: 2px;
  padding: 4px 10px;
}

.pencil-nav a {
  display: flex;
  height: 36px;
  align-items: center;
  gap: 10px;
  border-radius: 6px;
  padding: 0 10px;
  color: var(--hg-muted-strong);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}

.pencil-nav a[aria-current='page'] {
  background: var(--hg-primary);
  color: #ffffff;
}

.pencil-nav-icon {
  width: 15px;
  height: 15px;
  border: 1.5px solid currentColor;
  border-radius: 4px;
}

.pencil-sidebar-spacer {
  flex: 1;
}

.pencil-account {
  display: flex;
  height: 52px;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--hg-border);
  padding: 0 16px;
  color: var(--hg-muted-strong);
  font-size: 13px;
}

.pencil-account-avatar {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  background: var(--hg-primary);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
}

.pencil-main {
  flex: 1;
  min-width: 0;
}

.pencil-header {
  padding: 20px 32px 16px;
}

.pencil-title {
  margin: 0;
  color: #ffffff;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.2;
}

.pencil-subtitle {
  margin: 4px 0 0;
  color: var(--hg-muted);
  font-size: 13px;
}

.pencil-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding: 0 32px;
  background: #111111;
}

.pencil-toolbar-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pencil-toolbar-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: #52525b;
  text-transform: uppercase;
}

.pencil-segment {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border-radius: 6px;
  background: #1a1a1a;
  padding: 2px;
}

.pencil-segment button {
  height: 28px;
  min-width: 28px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--hg-muted-strong);
  font: inherit;
  font-size: 11px;
  cursor: default;
}

.pencil-segment button.is-active {
  background: var(--hg-primary);
  color: #ffffff;
}

.pencil-segment button.is-disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.pencil-divider {
  width: 1px;
  height: 20px;
  background: var(--hg-border);
}

.pencil-content {
  display: grid;
  gap: 28px;
}

.pencil-section {
  display: grid;
  gap: 12px;
}

.pencil-section-title {
  margin: 0;
  color: var(--hg-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.pencil-card-grid {
  display: grid;
  gap: 12px;
}

.pencil-card-grid.status {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.pencil-card-grid.gauges {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.pencil-card,
.pencil-chart {
  border-radius: 6px;
  background: var(--hg-panel);
}

.pencil-card-header {
  display: flex;
  min-height: 28px;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
}

.pencil-card-title {
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
}

.pencil-gear {
  width: 12px;
  height: 12px;
  border: 1px solid var(--hg-primary);
  border-radius: 999px;
}

.pencil-status-card {
  min-height: 150px;
}

.pencil-status-body {
  display: grid;
  min-height: 118px;
  place-items: center;
  text-align: center;
}

.pencil-status-value {
  color: var(--hg-success);
  font-size: 20px;
  font-weight: 700;
}

.pencil-status-caption {
  margin-top: 8px;
  color: var(--hg-muted);
  font-size: 10px;
}

.pencil-gauge-card {
  min-height: 260px;
}

.pencil-gauge-body {
  display: grid;
  min-height: 228px;
  place-items: center;
  text-align: center;
}

.pencil-gauge-icon {
  width: 86px;
  height: 54px;
  border: 12px solid var(--hg-primary);
  border-bottom: 0;
  border-radius: 86px 86px 0 0;
}

.pencil-gauge-icon.leaf {
  width: 70px;
  height: 48px;
  border-radius: 6px 44px 6px 44px;
  transform: skewX(-14deg);
}

.pencil-gauge-icon.triangle {
  width: 0;
  height: 0;
  border-right: 28px solid transparent;
  border-bottom: 52px solid var(--hg-primary);
  border-left: 28px solid transparent;
  border-top: 0;
  border-radius: 0;
  background: transparent;
}

.pencil-gauge-value {
  margin-top: 28px;
  color: #ffffff;
  font-size: 20px;
  font-weight: 700;
}

.pencil-gauge-caption {
  margin-top: 8px;
  color: var(--hg-muted);
  font-size: 10px;
}

.pencil-chart {
  min-height: 240px;
  overflow: hidden;
}

.pencil-chart-title {
  display: flex;
  height: 40px;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
}

.pencil-chart-plot {
  position: relative;
  height: 200px;
  padding: 20px 24px 28px;
}

.pencil-chart-plot::before {
  position: absolute;
  inset: 20px 24px 42px;
  content: '';
  background:
    linear-gradient(var(--hg-border) 1px, transparent 1px) 0 0 / 100% 34px,
    linear-gradient(90deg, rgba(42, 42, 42, 0.4) 1px, transparent 1px) 0 0 / 80px 100%;
  opacity: 0.45;
}

.pencil-line-svg {
  position: relative;
  display: block;
  width: 100%;
  height: 120px;
}

.pencil-legend {
  position: relative;
  display: flex;
  justify-content: center;
  gap: 20px;
  color: var(--hg-muted);
  font-size: 10px;
}

.pencil-legend span::before {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 5px;
  border-radius: 999px;
  background: var(--legend-color, var(--hg-accent));
  content: '';
}

.pencil-graphs {
  min-height: 100vh;
  background: var(--hg-graphs-bg);
  color: #ffffff;
}

.pencil-graphs-topbar {
  display: flex;
  height: 70px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--hg-graphs-border);
  background: var(--hg-graphs-panel);
  padding: 0 32px;
}

.pencil-graphs-topbar h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}

.pencil-new-graph {
  height: 40px;
  border: 0;
  border-radius: 6px;
  background: var(--hg-graphs-purple);
  color: #ffffff;
  padding: 0 16px;
  font-size: 12px;
  font-weight: 600;
}

.pencil-graphs-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  min-height: calc(100vh - 70px);
}

.pencil-graphs-canvas {
  padding: 24px;
}

.pencil-empty-chart {
  display: grid;
  height: 300px;
  place-items: center;
  border: 1px solid var(--hg-graphs-border);
  border-radius: 5px;
  background: var(--hg-graphs-card);
  color: #64748b;
  font-size: 12px;
}

.pencil-saved-graphs {
  border-left: 1px solid var(--hg-graphs-border);
  background: var(--hg-graphs-panel);
  padding: 16px;
}

.pencil-saved-graphs h2 {
  margin: 0 0 12px;
  font-size: 16px;
}

.pencil-saved-list {
  display: grid;
  gap: 8px;
}

.pencil-saved-item {
  border: 1px solid var(--hg-graphs-border-strong);
  border-radius: 5px;
  background: #0f172a;
  padding: 12px;
}

.pencil-saved-item.is-active {
  border-color: #7c3aed;
  box-shadow: inset 0 0 0 1px #7c3aed;
}

.pencil-saved-item strong {
  display: block;
  font-size: 12px;
}

.pencil-saved-item span {
  color: #94a3b8;
  font-size: 11px;
}

.pencil-saved-empty {
  margin-top: 28px;
  color: #64748b;
  text-align: center;
  font-size: 11px;
}

@media (max-width: 960px) {
  .pencil-dashboard {
    display: block;
  }

  .pencil-sidebar {
    position: static;
    width: 100%;
    height: auto;
    flex: none;
  }

  .pencil-card-grid.status,
  .pencil-card-grid.gauges,
  .pencil-graphs-shell {
    grid-template-columns: 1fr;
  }

  .pencil-saved-graphs {
    border-left: 0;
    border-top: 1px solid var(--hg-graphs-border);
  }
}
