:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --line: #dfe5ef;
  --text: #061638;
  --muted: #6f7a96;
  --accent: #18b8aa;
  --accent-strong: #087f78;
  --accent-soft: #c9f6ed;
  --nav: #1c2a50;
  --nav-2: #263760;
  --nav-muted: #aab7d6;
  --shadow: 0 10px 28px rgba(21, 34, 72, 0.06);
  font-family: "Segoe UI", Inter, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button, input, textarea { font: inherit; }
button { cursor: pointer; }

.hidden { display: none !important; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
}

.sidebar {
  background: var(--nav);
  color: #fff;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-copy span, .account-box span {
  color: var(--nav-muted);
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--nav-muted);
  text-align: left;
}

.nav-item.active, .nav-item:hover {
  background: var(--nav-2);
  color: #fff;
}

.nav-item svg, .top-actions svg, .primary-button svg, .secondary-button svg, .ghost-button svg {
  width: 18px;
  height: 18px;
}

.account-box {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 8px;
  background: var(--nav-2);
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.mobile-bar {
  display: none;
}

.content {
  padding: 30px;
  max-width: 1440px;
  width: 100%;
}

.topline {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 30px; line-height: 1.18; }
h2 { margin-bottom: 6px; font-size: 19px; line-height: 1.25; }
p { color: var(--muted); line-height: 1.5; }

.top-actions, .actions-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-button, .secondary-button, .ghost-button, .icon-button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}

.primary-button {
  padding: 0 16px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.primary-button:hover { background: var(--accent-strong); }

.secondary-button {
  padding: 0 14px;
  background: #eaf0f8;
  color: var(--text);
}

.ghost-button {
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
}

.icon-button {
  width: 40px;
  background: #eaf0f8;
  color: var(--text);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr);
  gap: 18px;
  align-items: start;
}

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

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
}

.dropzone {
  min-height: 162px;
  border: 1px dashed #9fb1ca;
  border-radius: 8px;
  background: #f8fbff;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
  color: var(--muted);
}

.dropzone input { display: none; }
.dropzone svg { width: 34px; height: 34px; color: var(--accent); margin-bottom: 8px; }
.dropzone strong { display: block; color: var(--text); margin-bottom: 4px; }

.selected-files {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.file-row, .job-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.file-row span, .job-row span {
  color: var(--muted);
  font-size: 13px;
}

.provider-strip, .provider-grid {
  display: grid;
  gap: 10px;
}

.provider-strip {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin: 14px 0;
}

.provider-grid {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.provider-button, .provider-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f9fd;
  color: var(--text);
  text-align: left;
}

.provider-button {
  min-height: 58px;
  padding: 10px 12px;
}

.provider-card {
  padding: 14px;
  min-height: 126px;
}

.provider-button.active-provider, .provider-card.active-provider {
  border-color: var(--accent);
  background: #eafffb;
  box-shadow: 0 8px 22px rgba(24, 184, 170, .13);
}

.provider-button.pale, .provider-card.pale {
  opacity: .58;
}

.provider-button.selected {
  outline: 2px solid var(--accent);
}

.provider-name {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 800;
}

.provider-badge {
  border-radius: 999px;
  background: #eaf0f8;
  color: var(--muted);
  padding: 4px 8px;
  font-size: 11px;
  white-space: nowrap;
}

.active-provider .provider-badge {
  background: var(--accent);
  color: #fff;
}

.provider-card p {
  margin: 10px 0 0;
  font-size: 14px;
}

.jobs-panel, .result-panel {
  grid-column: span 1;
}

.jobs-list {
  display: grid;
  gap: 8px;
  max-height: 420px;
  overflow: auto;
}

.job-row {
  width: 100%;
  cursor: pointer;
}

.job-row.active {
  border-color: var(--accent);
  background: #eafffb;
}

.job-title {
  min-width: 0;
}

.job-title strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.tab {
  border: 0;
  background: #eaf0f8;
  color: var(--muted);
  min-height: 34px;
  padding: 0 12px;
  border-radius: 8px;
}

.tab.active {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.result-text {
  min-height: 360px;
  max-height: 560px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
  color: #102044;
  line-height: 1.55;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(6, 22, 56, .42);
  padding: 18px;
  z-index: 20;
}

.modal-card {
  position: relative;
  width: min(460px, 100%);
  background: #fff;
  border-radius: 8px;
  padding: 26px;
  box-shadow: 0 24px 70px rgba(6, 22, 56, .22);
}

.close-modal {
  position: absolute;
  right: 14px;
  top: 14px;
}

.modal-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  margin-bottom: 14px;
}

.link-button { width: 100%; }

@media (max-width: 920px) {
  .app-shell {
    display: block;
    padding-top: 62px;
  }

  .sidebar {
    display: none;
    position: fixed;
    inset: 62px 0 0 0;
    z-index: 15;
  }

  .sidebar.open { display: flex; }

  .mobile-bar {
    position: fixed;
    inset: 0 0 auto 0;
    height: 62px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    background: var(--nav);
    color: #fff;
    z-index: 16;
  }

  .content { padding: 20px; }
  .topline, .auth-panel { flex-direction: column; }
  .workspace-grid { grid-template-columns: 1fr; }
  h1 { font-size: 24px; }
}

@media (max-width: 520px) {
  .content { padding: 16px; }
  .panel { padding: 16px; }
  .top-actions, .actions-row { width: 100%; }
  .primary-button, .secondary-button, .ghost-button { width: 100%; }
  .provider-strip, .provider-grid { grid-template-columns: 1fr; }
}
