/* SANS PH — colorful Adobe-inspired UI (sp48) */
:root {
  --ph-bg: #1e1b2e;
  --ph-panel: #2a2640;
  --ph-head: linear-gradient(90deg, #31a8ff 0%, #7c3aed 45%, #ff6b00 100%);
  --ph-border: rgba(255, 255, 255, 0.08);
  --ph-text: #f8fafc;
  --ph-muted: #a5b4fc;
  --ph-accent: #31a8ff;
  --ph-accent2: #ff6b00;
  --ph-right: 300px;
  --ph-left: 56px;
  --ph-glow: 0 0 20px rgba(49, 168, 255, 0.35);
}
body.sans-ph-ui {
  font-family: 'Inter', 'Noto Sans Tamil', system-ui, sans-serif;
  background: radial-gradient(ellipse at top, #2d1f4e 0%, #1a1625 55%, #0f0d14 100%);
  color: var(--ph-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sans-ph-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--ph-head);
  border-bottom: 1px solid rgba(0, 0, 0, 0.2);
  min-height: 48px;
  flex-shrink: 0;
  box-shadow: 0 4px 24px rgba(49, 168, 255, 0.25);
}
.sans-ph-header .sans-ph-btn {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
  backdrop-filter: blur(8px);
}
.sans-ph-header .sans-ph-btn:hover {
  background: rgba(255, 255, 255, 0.28);
}
.sans-ph-header .sans-ph-btn.primary {
  background: rgba(255, 255, 255, 0.95);
  color: #5b21b6;
  font-weight: 600;
  border: 0;
}
.sans-ph-brand {
  font-weight: 800;
  font-size: 17px;
  color: #fff;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.3);
  letter-spacing: 0.02em;
}
.sans-ph-doc-name {
  padding: 5px 10px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: #fff;
  font-size: 12px;
  width: 150px;
}
.sans-ph-sp { flex: 1; }
.sans-ph-workspace { display: flex; flex: 1; min-height: 0; }
.sans-ph-tools {
  width: var(--ph-left);
  background: linear-gradient(180deg, #252038 0%, #1a1628 100%);
  border-right: 1px solid var(--ph-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0;
  gap: 3px;
  flex-shrink: 0;
}
.sans-ph-tool {
  width: 40px;
  height: 40px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: #c4b5fd;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.sans-ph-tool:hover {
  background: rgba(124, 58, 237, 0.25);
  border-color: rgba(167, 139, 250, 0.4);
  color: #fff;
  transform: scale(1.05);
}
.sans-ph-tool.active {
  background: linear-gradient(135deg, #31a8ff, #7c3aed);
  color: #fff;
  border-color: transparent;
  box-shadow: var(--ph-glow);
}
.sans-ph-tool-sep { width: 28px; height: 1px; background: var(--ph-border); margin: 4px 0; }
.sans-ph-center { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.sans-ph-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: rgba(42, 38, 64, 0.9);
  border-bottom: 1px solid var(--ph-border);
  flex-wrap: wrap;
}
.sans-ph-tb {
  padding: 5px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: #cbd5e1;
  font-size: 11px;
  cursor: pointer;
}
.sans-ph-tb:hover { background: rgba(49, 168, 255, 0.2); color: #fff; }
.sans-ph-tb.on { background: rgba(49, 168, 255, 0.35); color: #fff; border-color: rgba(49, 168, 255, 0.5); }
.sans-ph-viewport {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    repeating-conic-gradient(#2a2640 0% 25%, #322e4a 0% 50%) 50% / 18px 18px;
  position: relative;
}
.sans-ph-canvas-wrap {
  position: relative;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.06);
  transform-origin: center center;
  border-radius: 4px;
  overflow: hidden;
}
#phCanvas { display: block; background: #fff; cursor: crosshair; }
.sans-ph-right {
  width: var(--ph-right);
  background: linear-gradient(180deg, #2a2640 0%, #1f1b30 100%);
  border-left: 1px solid var(--ph-border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex-shrink: 0;
}
.sans-ph-tabs {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 2px;
  scrollbar-width: thin;
  border-bottom: 1px solid var(--ph-border);
  background: rgba(0, 0, 0, 0.2);
}
.sans-ph-tab {
  padding: 8px 8px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border: none;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  flex: 1;
  min-width: 52px;
}
.sans-ph-tab.on {
  color: #fff;
  border-bottom-color: #31a8ff;
  background: linear-gradient(180deg, rgba(49, 168, 255, 0.15), transparent);
}
.sans-ph-pane {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  min-height: 0;
}
.sans-ph-pane.on { display: block; }
.sans-ph-section { margin-bottom: 14px; }
.sans-ph-section h4 {
  font-size: 10px;
  color: #a78bfa;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 8px;
}
.sans-ph-row { margin-bottom: 8px; }
.sans-ph-row label { display: block; font-size: 10px; color: #94a3b8; margin-bottom: 3px; }
.sans-ph-row input[type=range], .sans-ph-row select, .sans-ph-row input[type=text], .sans-ph-row textarea {
  width: 100%;
  font-size: 11px;
}
.sans-ph-row select, .sans-ph-row input[type=text], .sans-ph-row textarea {
  padding: 7px 9px;
  border-radius: 8px;
  border: 1px solid var(--ph-border);
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
}
.sans-ph-layer-list { list-style: none; margin: 0; padding: 0; }
.sans-ph-layer {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 9px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 11px;
  margin-bottom: 3px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.03);
}
.sans-ph-layer:hover { background: rgba(124, 58, 237, 0.2); }
.sans-ph-layer.active {
  background: linear-gradient(90deg, rgba(49, 168, 255, 0.25), rgba(124, 58, 237, 0.2));
  border-color: rgba(49, 168, 255, 0.4);
}
.sans-ph-action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.sans-ph-action-tile {
  border: none;
  border-radius: 12px;
  padding: 10px 8px;
  cursor: pointer;
  text-align: left;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.3;
  min-height: 72px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: transform 0.12s, box-shadow 0.12s;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}
.sans-ph-action-tile:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.sans-ph-action-tile .icon { font-size: 20px; }
.sans-ph-action-tile .cr { font-size: 9px; opacity: 0.85; font-weight: 500; }
.sans-ph-ai-btn {
  width: 100%;
  padding: 9px 11px;
  margin-bottom: 6px;
  border-radius: 10px;
  border: 1px solid rgba(49, 168, 255, 0.35);
  background: linear-gradient(135deg, rgba(49, 168, 255, 0.12), rgba(124, 58, 237, 0.12));
  color: #e8e8e8;
  font-size: 11px;
  cursor: pointer;
  text-align: left;
}
.sans-ph-ai-btn:hover {
  background: linear-gradient(135deg, rgba(49, 168, 255, 0.28), rgba(124, 58, 237, 0.22));
}
.sans-ph-coach-log {
  max-height: 220px;
  overflow-y: auto;
  margin-bottom: 8px;
  padding: 6px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--ph-border);
}
.sans-ph-coach-msg {
  font-size: 11px;
  line-height: 1.45;
  margin-bottom: 8px;
  padding: 8px 10px;
  border-radius: 10px;
}
.sans-ph-coach-msg.user {
  background: linear-gradient(135deg, rgba(49, 168, 255, 0.35), rgba(124, 58, 237, 0.25));
  margin-left: 12px;
}
.sans-ph-coach-msg.bot {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--ph-border);
  margin-right: 8px;
}
.sans-ph-coach-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.sans-ph-chip {
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(167, 139, 250, 0.4);
  background: rgba(124, 58, 237, 0.15);
  color: #e9d5ff;
  font-size: 9px;
  cursor: pointer;
}
.sans-ph-chip:hover { background: rgba(124, 58, 237, 0.35); }
.sans-ph-history-item {
  font-size: 10px;
  padding: 5px 8px;
  border-radius: 6px;
  color: var(--ph-muted);
  cursor: pointer;
}
.sans-ph-history-item:hover { background: rgba(49, 168, 255, 0.15); color: #fff; }
.sans-ph-history-item.cur { color: #31a8ff; font-weight: 600; }
.sans-ph-status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 5px 12px;
  background: rgba(0, 0, 0, 0.35);
  border-top: 1px solid var(--ph-border);
  font-size: 11px;
  color: #94a3b8;
  flex-shrink: 0;
}
.sans-ph-status .accent { color: #31a8ff; font-weight: 600; }
.sans-ph-fg-bg { display: flex; gap: 4px; align-items: center; }
.sans-ph-swatch {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.3);
}
.sans-ph-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 13, 20, 0.75);
  backdrop-filter: blur(6px);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.sans-ph-modal.show { display: flex; }
.sans-ph-modal-card {
  background: linear-gradient(145deg, #2a2640, #1f1b30);
  border: 1px solid rgba(167, 139, 250, 0.3);
  border-radius: 14px;
  padding: 22px;
  max-width: 420px;
  width: 92%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}
.sans-ph-modal-card h3 {
  margin: 0 0 12px;
  font-size: 16px;
  background: linear-gradient(90deg, #31a8ff, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.sans-ph-btn {
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid var(--ph-border);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
}
.sans-ph-btn.primary {
  background: linear-gradient(135deg, #31a8ff, #7c3aed);
  border: 0;
  font-weight: 600;
}
.sans-ph-toast {
  position: fixed;
  bottom: 40px;
  right: 16px;
  padding: 12px 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2a2640, #1a1628);
  border: 1px solid rgba(49, 168, 255, 0.4);
  font-size: 12px;
  z-index: 300;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  box-shadow: var(--ph-glow);
}
.sans-ph-toast.show { opacity: 1; }
.lang-ta .en-only { display: none !important; }
.lang-en .ta-only { display: none !important; }
.hidden { display: none !important; }
.accent { color: #31a8ff; }
.sans-ph-muted { color: var(--ph-muted); font-size: 11px; }
.sans-ph-adj-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.sans-ph-preset-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}
.sans-ph-preset-tile {
  border: 1px solid var(--ph-border);
  border-radius: 8px;
  padding: 8px;
  font-size: 10px;
  background: rgba(0, 0, 0, 0.25);
  color: var(--ph-text);
  cursor: pointer;
  text-align: center;
  min-height: 44px;
}
.sans-ph-preset-tile:hover { border-color: var(--ph-accent); box-shadow: var(--ph-glow); }
.sans-ph-preset-tile.grad { color: #fff; text-shadow: 0 1px 4px #000; font-weight: 600; }
.sans-ph-plugin-card {
  border: 1px solid var(--ph-border);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 8px;
  background: rgba(0, 0, 0, 0.2);
}
.sans-ph-plugin-card .meta { font-size: 9px; color: var(--ph-muted); display: block; margin: 2px 0 6px; }
.sans-ph-plugin-card p { font-size: 10px; margin: 0 0 8px; color: var(--ph-muted); }
.sans-ph-cloud-list { max-height: 280px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.sans-ph-cloud-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--ph-border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  cursor: pointer;
  text-align: left;
  color: var(--ph-text);
  width: 100%;
}
.sans-ph-cloud-item img { width: 48px; height: 48px; object-fit: cover; border-radius: 4px; }
.sans-ph-cloud-item .ph { width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; background: #333; border-radius: 4px; font-size: 20px; }
.sans-ph-layer.adj .name { color: #a5f3fc; }
