:root {
  color-scheme: dark;
  --black: #08090a;
  --panel: #101113;
  --panel-2: #17191c;
  --line: #292c30;
  --text: #f4f5f6;
  --muted: #989da5;
  --red: #d71920;
  --red-bright: #ef2930;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; }
body {
  overflow: hidden;
  background: var(--black);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, a { font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }
.login-screen { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 0, #2a1618 0, #0b0c0e 42%, #08090a 100%); }
.login-card { width: min(430px,100%); padding: 36px; border: 1px solid var(--line); border-radius: 18px; background: rgba(16,17,19,.96); box-shadow: 0 30px 80px rgba(0,0,0,.45); }
.login-mark { margin-bottom: 22px; }
.login-eyebrow { margin: 0 0 8px; color: var(--red-bright); font-size: 11px; font-weight: 800; letter-spacing: 1.8px; text-transform: uppercase; }
.login-card h1 { margin: 0 0 8px; font-size: 30px; letter-spacing: -1px; }
.login-help { margin: 0 0 26px; color: var(--muted); font-size: 13px; }
.login-card label { display: block; margin: 0 0 17px; color: #d7d9dc; font-size: 12px; font-weight: 700; }
.login-card input { width: 100%; margin-top: 7px; padding: 12px 13px; border: 1px solid #383c42; border-radius: 9px; background: #0c0d0f; color: white; font: inherit; }
.login-card input:focus { border-color: var(--red); outline: 2px solid rgba(215,25,32,.2); }
.login-button { width: 100%; padding: 13px; border: 0; border-radius: 9px; background: var(--red); color: white; font-weight: 800; cursor: pointer; }
.login-error { min-height: 18px; color: #ff777b; font-size: 12px; }
.signed-in { align-self: center; color: var(--muted); font-size: 12px; }

.app-shell { display: flex; height: 100%; }
.sidebar {
  width: 260px;
  flex: 0 0 260px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #111214 0%, #0b0c0e 100%);
  z-index: 20;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 86px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 13px;
  background: var(--red);
  color: white;
  font-size: 16px;
  font-weight: 900;
  font-style: italic;
  letter-spacing: -1px;
  box-shadow: 0 8px 24px rgba(215, 25, 32, .24);
}
.brand-copy { display: flex; flex-direction: column; min-width: 0; }
.brand-copy strong { font-size: 17px; letter-spacing: -.2px; }
.brand-copy span { margin-top: 2px; color: var(--muted); font-size: 11px; }

.tool-nav { flex: 1; display: flex; flex-direction: column; gap: 7px; padding: 16px 12px; }
.tool-link {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 14px;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 10px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}
.tool-link:hover { background: #191b1e; transform: translateX(2px); }
.tool-link.active {
  border-color: rgba(239, 41, 48, .35);
  background: linear-gradient(90deg, rgba(215, 25, 32, .22), rgba(215, 25, 32, .06));
}
.tool-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: #22252a;
  color: #b4b8bf;
}
.active .tool-icon { background: var(--red); color: white; }
.tool-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tool-icon svg rect { fill: none; }
.tool-copy { display: flex; flex-direction: column; min-width: 0; }
.tool-copy strong { font-size: 14px; }
.tool-copy small { overflow: hidden; margin-top: 2px; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.chevron { color: #737780; font-size: 22px; }
.sidebar-footer { display: flex; align-items: center; gap: 8px; padding: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #39c56a; box-shadow: 0 0 10px rgba(57, 197, 106, .65); }

.workspace { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.topbar {
  min-height: 86px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px 14px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(16, 17, 19, .96);
}
.page-heading { min-width: 0; flex: 1; }
.page-heading h1 { margin: 0; font-size: 20px; line-height: 1.2; letter-spacing: -.3px; }
.page-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.top-actions { display: flex; gap: 8px; }
.action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid #35383e;
  border-radius: 9px;
  background: #1d1f23;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}
.action-button:hover { border-color: #565b63; background: #24272b; }
.action-button.primary { border-color: var(--red); background: var(--red); }
.action-button.primary:hover { background: var(--red-bright); }
.icon-button { border: 0; background: transparent; cursor: pointer; }
.menu-button { display: none; width: 38px; height: 38px; padding: 8px; }
.menu-button span { display: block; height: 2px; margin: 4px 0; border-radius: 2px; background: #fff; }

.frame-area { position: relative; flex: 1; min-height: 0; background: #eceff2; }
#toolFrame { display: block; width: 100%; height: 100%; border: 0; background: white; }
.loading {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #0d0e10;
  color: var(--text);
  transition: opacity .18s ease, visibility .18s ease;
}
.loading span { color: var(--muted); font-size: 12px; }
.loading.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.spinner { width: 35px; height: 35px; border: 3px solid #292c31; border-top-color: var(--red); border-radius: 50%; animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.backdrop { display: none; }

@media (max-width: 820px) {
  .sidebar { position: fixed; inset: 0 auto 0 0; transform: translateX(-105%); transition: transform .2s ease; box-shadow: 18px 0 50px rgba(0,0,0,.45); }
  .sidebar.open { transform: translateX(0); }
  .menu-button { display: block; flex: 0 0 auto; }
  .backdrop { position: fixed; inset: 0; z-index: 10; display: block; visibility: hidden; background: rgba(0,0,0,.58); opacity: 0; transition: opacity .2s ease, visibility .2s ease; }
  .backdrop.visible { visibility: visible; opacity: 1; }
  .topbar { min-height: 74px; padding: 10px 12px; }
  .page-heading p { display: none; }
  .top-actions .action-button:first-child { display: none; }
  .action-button { min-height: 36px; padding: 0 10px; font-size: 12px; }
}

@media (max-width: 560px) {
  .top-actions #openButton { display: none; }
  .page-heading h1 { font-size: 17px; }
}
