:root {
  color-scheme: light;
  --page:            #f9f9f7;
  --surface:         #fcfcfb;
  --surface-2:       #ffffff;
  --text-primary:    #0b0b0b;
  --text-secondary:  #52514e;
  --text-muted:      #898781;
  --grid:            #e1e0d9;
  --baseline:        #c3c2b7;
  --border:          rgba(11,11,11,0.08);
  --border-strong:   rgba(11,11,11,0.14);

  --series-actual:   #2a78d6; /* 実績 */
  --series-estimate: #eb6834; /* 予定 */
  --series-plan:     #898781; /* 計画（目標） */
  --series-3:        #1baf7a;
  --series-4:        #eda100;
  --series-5:        #e87ba4;

  --good:            #0ca30c;
  --good-text:       #006300;
  --warning:         #fab219;
  --critical:        #d03b3b;

  --shadow-sm: 0 1px 2px rgba(11,11,11,0.06);
  --shadow-md: 0 4px 16px rgba(11,11,11,0.08);
  --shadow-lg: 0 12px 32px rgba(11,11,11,0.12);
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page:            #0d0d0d;
    --surface:         #1a1a19;
    --surface-2:       #202020;
    --text-primary:    #ffffff;
    --text-secondary:  #c3c2b7;
    --text-muted:      #898781;
    --grid:            #2c2c2a;
    --baseline:        #383835;
    --border:          rgba(255,255,255,0.08);
    --border-strong:   rgba(255,255,255,0.16);

    --series-actual:   #3987e5;
    --series-estimate: #d95926;
    --series-plan:     #a3a199;
    --series-3:        #199e70;
    --series-4:        #c98500;
    --series-5:        #d55181;

    --good:            #0ca30c;
    --good-text:       #0ca30c;
    --warning:         #fab219;
    --critical:        #e66767;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.5);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page:            #0d0d0d;
  --surface:         #1a1a19;
  --surface-2:       #202020;
  --text-primary:    #ffffff;
  --text-secondary:  #c3c2b7;
  --text-muted:      #898781;
  --grid:            #2c2c2a;
  --baseline:        #383835;
  --border:          rgba(255,255,255,0.08);
  --border-strong:   rgba(255,255,255,0.16);

  --series-actual:   #3987e5;
  --series-estimate: #d95926;
  --series-plan:     #a3a199;
  --series-3:        #199e70;
  --series-4:        #c98500;
  --series-5:        #d55181;

  --good:            #0ca30c;
  --good-text:       #0ca30c;
  --warning:         #fab219;
  --critical:        #e66767;
}

* { box-sizing: border-box; }

html, body {
  background: var(--page);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

#app { min-height: 100vh; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}

.tabular { font-variant-numeric: tabular-nums; }

.scroll-x { overflow-x: auto; }

::-webkit-scrollbar { height: 10px; width: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-md);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text-primary);
  white-space: nowrap;
  z-index: 30;
  opacity: 0;
  transition: opacity .1s ease;
}

.bar-rect { transition: opacity .12s ease; }
.bar-rect:hover { opacity: 0.85; }

.nav-pill {
  transition: background-color .15s ease, color .15s ease;
}

.entry-row:hover { background: var(--surface-2); }

input, select {
  background: var(--surface-2);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
}
input:focus, select:focus {
  outline: 2px solid var(--series-actual);
  outline-offset: 1px;
}

.modal-backdrop {
  background: rgba(11,11,11,0.5);
}
