/* Power DevBox workspace: Copilot Studio-style layout on the shared Console theme. */

:root {
  --nav-width: 264px;
  --nav-collapsed: 64px;
  --art-bg: linear-gradient(160deg, #f5f7f8, #e8edef);
  --art-line: #d3dcdf;
}

.dark-mode {
  --art-bg: linear-gradient(160deg, #1d2124, #16191b);
  --art-line: #30373c;
}

.tool-app { --tool: var(--tool-app); --tool-bright: var(--tool-app-bright); }
.tool-auto { --tool: var(--tool-auto); --tool-bright: var(--tool-auto-bright); }
.tool-copilot { --tool: var(--tool-copilot); --tool-bright: var(--tool-copilot-bright); }
.tool-solutions { --tool: var(--tool-solutions); --tool-bright: var(--tool-solutions-bright); }

body {
  display: grid;
  grid-template-columns: var(--nav-width) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}

body.nav-collapsed {
  grid-template-columns: var(--nav-collapsed) minmax(0, 1fr);
}

[hidden] {
  display: none !important;
}

/* ---------- Buttons: secondary by default, .primary for the main action ---------- */
.workspace button,
dialog button {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

.workspace button:hover,
dialog button:hover {
  background: var(--accent-soft);
  border-color: var(--muted);
  color: var(--ink);
}

.workspace button.primary,
dialog button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.workspace button.primary:hover,
dialog button.primary:hover {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
  color: var(--on-accent);
}

.workspace button.danger,
.danger {
  color: var(--red);
}

.workspace button.danger:hover {
  background: var(--red-soft);
  border-color: var(--red);
  color: var(--red);
}

button:disabled {
  opacity: 0.55;
  cursor: wait;
}

/* ---------- Sidebar ---------- */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
  padding: 14px 12px 12px;
  background: var(--charcoal);
  color: var(--menu-ink);
  overflow-x: hidden;
  overflow-y: auto;
  z-index: 30;
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 40px;
  margin-bottom: 14px;
  padding-left: 4px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: #fff;
  text-decoration: none;
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand-mark {
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 8px;
}

.sidebar-toggle {
  flex: none;
  width: 34px;
  height: 34px;
  padding: 0;
  background: transparent;
  border-color: transparent;
  color: var(--menu-muted);
}

.sidebar-toggle:hover,
:where(.dark-mode) .sidebar-toggle:hover {
  background: var(--charcoal-2);
  border-color: transparent;
  color: #fff;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.side-nav hr {
  width: 100%;
  margin: 8px 0;
  border: 0;
  border-top: 1px solid var(--charcoal-2);
}

.side-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--menu-ink);
  font: 500 0.95rem var(--font);
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.side-link > i:first-child,
.side-link > img {
  width: 22px;
  flex: none;
  text-align: center;
  font-size: 1.05rem;
  color: var(--menu-muted);
}

.side-link > img {
  height: 22px;
  border-radius: 5px;
  object-fit: contain;
}

.side-link:hover,
:where(.dark-mode) .side-link:hover {
  background: var(--charcoal-2);
  color: #fff;
}

.side-link.active {
  background: var(--charcoal-3);
  color: #fff;
  font-weight: 700;
}

.side-link.active > i:first-child {
  color: #fff;
}

/* Reviewer links carry their tool colour, like the reviewers' own menus. */
.side-link[class*="tool-"].active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 3px;
  background: var(--tool-bright);
}

.side-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.side-count {
  margin-left: auto;
  padding: 1px 8px;
  border-radius: 10px;
  background: var(--charcoal-2);
  color: var(--menu-ink);
  font: 600 0.75rem var(--mono);
  font-style: normal;
}

.sidebar-bottom {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--charcoal-2);
}

.solution-switch .side-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.solution-switch b {
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.86rem;
}

.solution-switch small {
  color: var(--menu-muted);
  font-size: 0.74rem;
}

.side-trailing {
  margin-left: auto;
  color: var(--menu-muted);
  font-size: 0.85rem;
}

.nav-collapsed .side-text,
.nav-collapsed .side-count,
.nav-collapsed .side-trailing {
  display: none;
}

.nav-collapsed .sidebar {
  padding-left: 10px;
  padding-right: 10px;
}

.nav-collapsed .sidebar-top {
  flex-direction: column;
  padding-left: 0;
}

.nav-collapsed .side-link {
  justify-content: center;
  padding: 8px;
}

.nav-collapsed .side-link[class*="tool-"].active::before {
  left: -6px;
}

/* ---------- Workspace area ---------- */
.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--canvas);
}

#content {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

#reviewer-host {
  flex: 1 1 auto;
  min-height: 0;
  background: var(--canvas);
}

#reviewer-host iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Copilot Studio-style announcement banner */
.banner {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px 10px 28px;
  font-size: 0.9rem;
  color: var(--ink);
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.banner-icon {
  color: var(--accent);
}

.banner.error {
  background: var(--red-soft);
}

.banner.error .banner-icon {
  color: var(--red);
}

#notice-text {
  flex: 1;
  min-width: 0;
}

.workspace .banner-close {
  flex: none;
  width: 30px;
  height: 30px;
  padding: 0;
  border-color: transparent;
  color: var(--muted);
}

/* ---------- Pages ---------- */
.page {
  max-width: 1240px;
  margin: 0 auto;
  padding: 32px 36px 64px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.page-header h1 {
  margin: 0;
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.page-header p {
  margin: 6px 0 0;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

.section-heading h2 {
  margin: 0;
}

.muted {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.6;
}

.actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 18px;
}

.toolbar input {
  flex: 1;
  min-width: 200px;
}

.panel {
  padding: 20px 22px;
  margin-bottom: 18px;
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.panel h2,
.panel summary {
  margin: 0 0 12px;
  font-size: 1.02rem;
  font-weight: 700;
}

.panel h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

details.panel {
  padding: 14px 22px;
}

details.panel summary {
  margin: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
}

details.panel[open] summary {
  margin-bottom: 14px;
}

.two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
}

.workspace .segmented button {
  border: 0;
  padding: 7px 14px;
  color: var(--muted);
}

.workspace .segmented button.active {
  background: var(--accent-soft);
  color: var(--ink);
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
  font-size: 0.86rem;
  font-weight: 600;
}

label.inline {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

input[type="checkbox"] {
  width: 17px;
  height: 17px;
}

textarea {
  width: 100%;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.6;
}

pre {
  font-family: var(--mono);
  font-size: 0.78rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 22px;
}

.metric b {
  display: block;
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.metric span {
  font-size: 0.78rem;
  color: var(--muted);
}

.metric.stat {
  border-top-color: var(--tool, var(--accent));
}

/* Tables */
.table-scroll {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
}

.workspace table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  text-align: left;
}

.workspace th {
  padding: 12px 14px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 2px solid var(--line);
  white-space: nowrap;
}

.workspace td {
  padding: 11px 14px;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}

.workspace tbody tr:last-child td {
  border-bottom: 0;
}

.workspace tbody tr:hover {
  background: var(--card-2);
}

.workspace td pre {
  margin: 0;
  max-height: 240px;
  overflow: auto;
}

.workspace td .actions {
  flex-wrap: nowrap;
}

.workspace td button {
  padding: 5px 10px;
  font-size: 0.78rem;
}

.empty {
  padding: 36px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 12px;
}

.tree-list {
  margin: 0;
  padding: 0;
  list-style: none;
  font: 0.82rem var(--mono);
}

.tree-list .tree-list {
  padding-left: 1.1rem;
  border-left: 1px dotted var(--line);
}

.tree-list li {
  padding: 2px 0;
}

.tree-list summary {
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 6px;
}

.tree-list summary:hover {
  background: var(--card-2);
}

.workspace .tree-list button {
  border: 0;
  padding: 3px 6px;
  font: inherit;
  font-weight: 400;
  text-align: left;
  overflow-wrap: anywhere;
}

.file-preview {
  max-height: 520px;
  overflow: auto;
  margin: 0;
  padding: 16px;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-left: 4px solid var(--tool, var(--accent));
  border-radius: 8px;
}

.license-details {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 0;
  margin: 12px 0 0;
  font-size: 0.86rem;
}

.license-details dt,
.license-details dd {
  margin: 0;
  padding: 6px 0;
  border-bottom: 1px dashed var(--line);
}

.license-details dt {
  color: var(--muted);
}

.license-details dd {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.bug-item {
  padding: 12px 0;
  border-top: 1px dashed var(--line);
  font-size: 0.88rem;
}

.pref-icon {
  width: 20px;
  height: 20px;
  margin-right: 8px;
  vertical-align: -4px;
  object-fit: contain;
}

#reviewer-preferences h3 {
  margin: 8px 0 12px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--tool);
  display: inline-block;
}

/* Reviewer placeholder before a solution is loaded */
.reviewer-empty {
  display: grid;
  justify-items: center;
  gap: 12px;
  max-width: 520px;
  margin: 12vh auto 0;
  padding: 40px 32px;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 4px solid var(--tool);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.reviewer-empty img {
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.reviewer-empty h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
}

.reviewer-empty p {
  margin: 0 0 8px;
}

/* ---------- Home (Copilot Studio layout) ---------- */
.home {
  max-width: 900px;
  margin: 0 auto;
  padding: 72px 32px 72px;
}

.greeting {
  margin: 0;
  font-size: clamp(2rem, 3.4vw, 2.75rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.greeting em {
  padding-right: 0.08em;
  font-weight: 700;
  background: linear-gradient(90deg, var(--tool-app), var(--tool-auto) 55%, var(--tool-copilot));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lede {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0 0;
  font-size: 1.2rem;
  color: var(--muted);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.lede .pill {
  background: var(--card);
}

a.pill {
  text-decoration: none;
  background: var(--card);
}

a.pill:hover {
  border-color: var(--muted);
}

.create-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin-top: 56px;
}

.create-card {
  display: flex;
  flex-direction: column;
  padding: 18px 18px 22px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.create-card:hover {
  border-color: var(--tool);
  transform: translateY(-2px);
  box-shadow: var(--shadow-pop);
}

.create-card h2 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 8px;
  font-size: 1.05rem;
  font-weight: 700;
}

.create-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  color: var(--tool);
  font-size: 0.82rem;
  font-weight: 700;
}

/* Illustrations: CSS shapes in each reviewer's colour */
.art {
  position: relative;
  height: 124px;
  overflow: hidden;
  border-radius: 14px;
  background: var(--art-bg);
  border: 1px solid var(--art-line);
}

.art i,
.art b,
.art span {
  position: absolute;
  display: block;
  border-radius: 999px;
}

.art-app .device {
  left: 12%;
  top: 14px;
  width: 64px;
  height: 108px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--art-line);
  box-shadow: var(--shadow);
}

.art-app .device i {
  left: 9px;
  right: 9px;
  height: 9px;
  background: var(--art-line);
}

.art-app .device i:nth-child(1) { top: 14px; background: var(--tool); opacity: 0.35; }
.art-app .device i:nth-child(2) { top: 30px; right: 22px; }
.art-app .device i:nth-child(3) { top: 46px; }

.art-app .device b {
  left: 9px;
  right: 9px;
  top: 66px;
  height: 16px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--tool), var(--tool-bright));
}

.art-app .tile {
  left: 52%;
  width: 34%;
  height: 22px;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--tool), var(--tool-bright));
  opacity: 0.85;
}

.art-app .tile:nth-of-type(2) { top: 26px; }
.art-app .tile:nth-of-type(3) { top: 54px; left: 58%; width: 26%; opacity: 0.5; }
.art-app .tile:nth-of-type(4) { top: 82px; width: 30%; opacity: 0.3; }

.art-auto .node {
  width: 46px;
  height: 18px;
  background: var(--art-line);
}

.art-auto .n2,
.art-auto .n4,
.art-auto .n6,
.art-auto .n8 {
  background: linear-gradient(90deg, var(--tool), var(--tool-bright));
}

.art-auto .n1 { left: 12%; top: 22px; }
.art-auto .n2 { left: 12%; top: 52px; }
.art-auto .n3 { left: 12%; top: 82px; }
.art-auto .n4 { left: 41%; top: 37px; }
.art-auto .n5 { left: 41%; top: 67px; }
.art-auto .n6 { left: 70%; top: 22px; }
.art-auto .n7 { left: 70%; top: 52px; }
.art-auto .n8 { left: 70%; top: 82px; }

.art-auto .wire {
  height: 2px;
  width: 12%;
  border-radius: 0;
  background: var(--tool);
  opacity: 0.55;
}

.art-auto .w1 { left: 30%; top: 46px; transform: rotate(-12deg); }
.art-auto .w2 { left: 30%; top: 76px; transform: rotate(-12deg); }
.art-auto .w3 { left: 59%; top: 38px; transform: rotate(-20deg); }
.art-auto .w4 { left: 59%; top: 74px; transform: rotate(12deg); }

.art-copilot .bubble {
  height: 22px;
  border-radius: 12px;
}

.art-copilot .b1 { top: 18px; width: 46%; }
.art-copilot .b2 { top: 50px; width: 38%; }
.art-copilot .b3 { top: 82px; width: 30%; }

.art-copilot .bubble.agent {
  left: 14%;
  background: var(--card);
  border: 1px solid var(--art-line);
  border-bottom-left-radius: 4px;
}

.art-copilot .bubble.user {
  right: 14%;
  background: linear-gradient(90deg, var(--tool), var(--tool-bright));
  border-bottom-right-radius: 4px;
}

.art-copilot .spark {
  right: 14%;
  top: 82px;
  border-radius: 0;
  color: var(--tool);
  font-size: 1.4rem;
  line-height: 1;
}

/* "Other ways to build" row */
.wide-row {
  display: flex;
  align-items: center;
  gap: 18px;
  width: 100%;
  margin-top: 20px;
  padding: 18px 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.workspace .wide-row:hover,
.wide-row.dragging {
  border-color: var(--muted);
  background: var(--card);
}

.wide-row.dragging {
  border-style: dashed;
  background: var(--accent-soft);
}

.wide-row h3 {
  margin: 0 0 4px;
  font-size: 1.05rem;
  font-weight: 700;
}

.wide-row p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 400;
}

.wide-row > div {
  flex: 1;
  min-width: 0;
}

.wide-row > .fa-arrow-right {
  color: var(--muted);
}

.row-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--ink);
}

.home-section {
  margin-top: 56px;
}

.home-section .section-heading h2 {
  font-size: 1.1rem;
  font-weight: 700;
}

.home-section .section-heading a {
  color: var(--muted);
  font-size: 0.86rem;
}

/* "Last opened" style list */
.list-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.list-card th {
  padding: 16px 18px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  border-bottom: 1px solid var(--line);
}

.list-card td {
  padding: 14px 18px;
  vertical-align: middle;
}

.list-card tbody tr {
  cursor: pointer;
}

.item-name {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.item-name b {
  display: block;
  font-weight: 600;
}

.item-name small {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.item-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--tool), var(--tool-bright));
  color: #fff;
  font-size: 0.95rem;
}

.status-dot::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--muted);
  vertical-align: 1px;
}

.status-dot.on::before {
  background: var(--green);
}

.status-dot.warn::before {
  background: var(--amber);
}

/* ---------- Dialogs ---------- */
dialog {
  width: calc(100% - 40px);
  max-width: 820px;
  max-height: 90vh;
  padding: 24px 26px;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 4px solid var(--accent);
  border-radius: 14px;
  box-shadow: var(--shadow-pop);
}

dialog::backdrop {
  background: rgba(20, 28, 30, 0.45);
  backdrop-filter: blur(2px);
}

.dialog-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.dialog-heading h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
}

#flag-test-output {
  max-height: 220px;
  overflow: auto;
}

#flag-test-output:empty {
  display: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .create-grid,
  .two-column {
    grid-template-columns: 1fr;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home {
    padding: 40px 20px;
  }

  .page {
    padding: 24px 20px 48px;
  }
}
