:root {
  /* Original tokens (retained for backward compatibility) */
  --bg-deep: #0d1117;
  --bg-base: #161b22;
  --bg-card: #21262d;
  --bg-hover: #30363d;
  --border: #30363d;
  --border-light: #484f58;
  --text: #f0f6fc;
  --text-muted: #8b949e;
  --text-dim: #6e7681;
  --green: #238636;
  --green-bg: rgba(35,134,54,0.15);
  --red: #f85149;
  --warn: #d29922;
  --blue: #58a6ff;
  --purple: #a371f7;
  --purple-bg: rgba(163,113,247,0.15);
  --radius: 10px;
  --radius-sm: 6px;

  /* Semantic aliases (prefer these in new code) */
  --primary: var(--green);
  --primary-hover: #16a34a;
  --primary-bg: var(--green-bg);
  --danger: var(--red);
  --danger-bg: rgba(248,81,73,0.1);
  --warning: var(--warn);
  --info: var(--blue);
  --surface-1: var(--bg-deep);
  --surface-2: var(--bg-base);
  --surface-3: var(--bg-card);
  --surface-hover: var(--bg-hover);
  --on-surface: var(--text);
  --on-surface-muted: var(--text-muted);
  --on-surface-dim: var(--text-dim);
  --border-default: var(--border);
  --radius-lg: var(--radius);
  --radius-md: var(--radius-sm);

  /* Z-index layers (use these in new code) */
  --z-content: 1;
  --z-tooltip: 100;
  --z-overlay: 50;
  --z-drawer: 500;
  --z-modal: 600;
  --z-modal-toolbar: 610;
  --z-floating-panel: 700;
  --z-context-menu: 800;
  --z-context-sub: 810;
  --z-confirm-modal: 850;
  --z-welcome-modal: 860;
  --z-toast: 900;
  --z-unlock: 900;
}
[data-theme="light"] {
  --bg-deep: #f0f9ff;
  --bg-base: #ffffff;
  --bg-card: #f8fbff;
  --bg-hover: #e0f2fe;
  --border: #cbd5e1;
  --border-light: #94a3b8;
  --text: #1e293b;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  --green: #10b981;
  --green-bg: rgba(16,185,129,0.12);
  --red: #dc2626;
  --warn: #f59e0b;
  --blue: #3b82f6;
  --purple: #8b5cf6;
  --purple-bg: rgba(139,92,246,0.12);
  /* Gradient presets for light theme */
  --gradient-body: linear-gradient(135deg, #f0f9ff 0%, #f0f4ff 50%, #f5f3ff 100%);
  --gradient-sidebar: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  --gradient-surface: linear-gradient(180deg, #ffffff 0%, #fefefe 100%);
  --gradient-card: linear-gradient(135deg, #ffffff 0%, #f8fbff 100%);
  --gradient-item: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  --gradient-item-hover: linear-gradient(135deg, #e0f2fe 0%, #dbeafe 100%);
  --gradient-workspace: linear-gradient(135deg, #f0f9ff 0%, #f0f4ff 100%);
}
* { margin:0; padding:0; box-sizing:border-box; }
html { height:100%; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background:var(--bg-deep); color:var(--text); height:100%; min-height:100vh; min-height:100dvh; display:flex; flex-direction:column; overflow:hidden; }
[data-theme="light"] body { background: var(--gradient-body); }
[data-theme="light"] .toolbar-panel { background: var(--gradient-sidebar); }
[data-theme="light"] .tool-sidebar { background: var(--gradient-sidebar); }
[data-theme="light"] .right-panel { background: var(--gradient-sidebar); }
[data-theme="light"] .cp-workspace { background: var(--gradient-workspace); }
[data-theme="light"] .cp-toolbar { background: var(--gradient-surface); }
[data-theme="light"] .cp-bottom-bar { background: var(--gradient-surface); }
[data-theme="light"] .panel-card { background: var(--gradient-card); }
[data-theme="light"] .lp-pl-item { background: var(--gradient-item); }
[data-theme="light"] .history-item { background: var(--gradient-item); border-color: rgba(0,0,0,0.04); }
[data-theme="light"] .pl-item { background: var(--gradient-item); }
[data-theme="light"] .lp-pl-item:hover { background: var(--gradient-item-hover); }
[data-theme="light"] .history-item:hover { background: var(--gradient-item-hover); border-color: rgba(100,150,255,0.2); }
[data-theme="light"] .pl-item:hover { background: var(--gradient-item-hover); }
button { font-family:inherit; border:none; cursor:pointer; background:none; color:inherit; }
button:focus-visible, [role="button"]:focus-visible, select:focus-visible, a:focus-visible { outline:2px solid var(--green); outline-offset:2px; }
input:focus-visible, textarea:focus-visible { outline:none; } /* inputs use border-color change instead */
input, select, textarea { font-family:inherit; }

/* ===== Utility Classes ===== */
.u-flex-1 { flex: 1; }
.u-hidden { display: none !important; }
.u-sr-only { position: absolute; left: -9999px; top: -9999px; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.u-btn-row-padding { padding: 12px 14px 0 2px; }
