:root {
  --bg: #f2ede2;
  --bg-accent: #ead8ba;
  --surface: rgba(255, 252, 246, 0.78);
  --surface-strong: #fffaf0;
  --border: rgba(70, 55, 33, 0.14);
  --text: #1e1b16;
  --muted: #6a6255;
  --primary: #1b7f73;
  --primary-strong: #11584f;
  --danger: #b54d3f;
  --shadow: 0 24px 64px rgba(48, 34, 16, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Space Grotesk", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(35, 145, 132, 0.18), transparent 26%),
    radial-gradient(circle at bottom right, rgba(190, 122, 74, 0.18), transparent 22%),
    linear-gradient(145deg, var(--bg), #f8f4ec 58%, var(--bg-accent));
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: linear-gradient(rgba(30, 27, 22, 0.025) 1px, transparent 1px), linear-gradient(90deg, rgba(30, 27, 22, 0.025) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
}

.auth-page,
.app-shell {
  position: relative;
  z-index: 1;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card,
.panel,
.hero-card {
  border: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.auth-card {
  width: min(480px, 100%);
  padding: 36px;
  border-radius: 28px;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--primary), #ea8a42);
  color: white;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.eyebrow {
  margin: 18px 0 8px;
  color: var(--primary-strong);
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1;
  margin-bottom: 12px;
}

h2 {
  margin-bottom: 0;
  font-size: 1.25rem;
}

.lede,
.muted-text {
  color: var(--muted);
}

.stack-lg > * + * {
  margin-top: 14px;
}

.field-label {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 6px;
}

.text-input,
.primary-button,
.ghost-button,
.text-button {
  font: inherit;
}

.text-input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(27, 127, 115, 0.18);
  background: rgba(255, 255, 255, 0.9);
}

.primary-button,
.ghost-button,
.text-button,
.tab-button {
  border: 0;
  cursor: pointer;
  transition: transform 160ms ease, opacity 160ms ease, background-color 160ms ease;
}

.primary-button {
  padding: 14px 18px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary), #0f5e56);
  color: white;
  font-weight: 700;
}

.ghost-button,
.text-button,
.tab-button {
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--text);
}

.ghost-button:hover,
.text-button:hover,
.tab-button:hover,
.primary-button:hover {
  transform: translateY(-1px);
}

.error-text {
  color: var(--danger);
  margin-top: 14px;
}

.app-shell {
  padding: 24px;
}

.hero-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  border-radius: 32px;
  padding: 28px 32px;
  margin-bottom: 22px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 22px;
  align-items: start;
}

.panel {
  border-radius: 28px;
  padding: 24px;
}

.panel-upload,
.panel-results {
  grid-column: 1;
}

.panel-history {
  grid-column: 2;
  grid-row: 1 / span 2;
  min-height: 640px;
}

.panel-head,
.actions-row,
.result-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-head {
  margin-bottom: 18px;
}

.pill {
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(27, 127, 115, 0.1);
  color: var(--primary-strong);
  font-size: 0.85rem;
}

.upload-dropzone {
  display: grid;
  place-items: center;
  min-height: 220px;
  padding: 28px;
  text-align: center;
  border-radius: 24px;
  border: 1.5px dashed rgba(27, 127, 115, 0.28);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.32));
  cursor: pointer;
}

.upload-dropzone.drag-active {
  border-color: var(--primary);
  background: linear-gradient(180deg, rgba(240, 255, 251, 0.96), rgba(216, 245, 239, 0.9));
}

.upload-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.upload-subtitle {
  margin-top: 8px;
  color: var(--muted);
}

.language-row {
  display: grid;
  grid-template-columns: minmax(220px, 280px) 1fr;
  gap: 18px;
  align-items: end;
  margin-top: 18px;
}

.select-input {
  appearance: none;
  cursor: pointer;
}

.helper-text {
  margin-bottom: 0;
  font-size: 0.92rem;
}

.actions-row {
  margin-top: 18px;
}

.status-box,
.history-item,
.text-output,
.empty-state {
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border);
}

.status-box,
.empty-state {
  margin-top: 18px;
  padding: 14px 16px;
}

.history-list {
  display: grid;
  gap: 12px;
}

.history-item {
  padding: 16px;
}

.history-item h3 {
  font-size: 1rem;
  margin-bottom: 6px;
}

.history-meta {
  color: var(--muted);
  font-size: 0.86rem;
}

.history-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 14px;
}

.tab-strip {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.tab-button.active {
  background: var(--text);
  color: white;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.text-output {
  padding: 18px;
  line-height: 1.8;
  white-space: pre-wrap;
  min-height: 240px;
}

.rtl-text {
  direction: rtl;
  text-align: right;
}

.urdu-text {
  font-family: "Noto Nastaliq Urdu", serif;
  font-size: 1.2rem;
}

.arabic-text {
  font-family: "Noto Naskh Arabic", serif;
  font-size: 1.15rem;
}

.summary-block {
  min-height: 120px;
}

.key-points {
  margin: 16px 0 0;
  padding-left: 24px;
}

.key-points li {
  margin-bottom: 10px;
}

.empty-state {
  color: var(--muted);
}

@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .panel-upload,
  .panel-results,
  .panel-history {
    grid-column: auto;
    grid-row: auto;
    min-height: auto;
  }
}

@media (max-width: 720px) {
  .app-shell,
  .auth-shell {
    padding: 16px;
  }

  .hero-card,
  .panel,
  .auth-card {
    padding: 20px;
    border-radius: 22px;
  }

  .hero-card,
  .panel-head,
  .actions-row,
  .result-toolbar,
  .language-row {
    flex-direction: column;
    align-items: stretch;
  }

  .language-row {
    display: flex;
  }
}
