* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #070816;
  --card: rgba(18, 21, 43, 0.94);
  --soft: rgba(34, 38, 72, 0.78);
  --border: rgba(167, 139, 250, 0.23);
  --purple: #7c3aed;
  --purple-light: #a78bfa;
  --text: #f8fafc;
  --muted: #aeb6ca;
  --green: #55e6a5;
  --red: #fb7185;
}

body {
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(124, 58, 237, 0.23), transparent 34%),
    var(--bg);
  font-family: Inter, Arial, sans-serif;
}

body[dir="rtl"] {
  font-family: Tahoma, Arial, sans-serif;
}

button,
select,
input {
  font: inherit;
}

button,
a,
label {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

.shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 0 22px 60px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 74px;
  margin: 0 -22px;
  padding: 12px 22px;
  background: rgba(7, 8, 22, 0.88);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(18px);
}

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

.mark {
  display: grid;
  place-items: center;
  width: 43px;
  height: 43px;
  border-radius: 14px;
  background: linear-gradient(135deg, #6d28d9, #8b5cf6);
  font-size: 21px;
  font-weight: 900;
}

.brand strong {
  display: block;
  font-size: 18px;
}

.brand small {
  color: var(--muted);
}

.top-actions {
  display: flex;
  gap: 8px;
}

.top-button {
  min-height: 42px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--soft);
  color: var(--text);
  cursor: pointer;
}

.hero {
  padding: 55px 0 29px;
  text-align: center;
}

.hero-icon {
  font-size: 40px;
}

.hero h1 {
  margin-top: 13px;
  font-size: clamp(34px, 6vw, 54px);
  line-height: 1.15;
}

.hero h1 span {
  color: var(--purple-light);
}

.hero p {
  max-width: 690px;
  margin: 15px auto 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.8;
}

.account-strip {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  margin-bottom: 18px;
  padding: 15px 17px;
  border: 1px solid var(--border);
  border-radius: 17px;
  background: var(--card);
}

.account-email {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.balance strong {
  color: var(--green);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  gap: 20px;
}

.panel {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--card);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.25);
}

.panel h2 {
  font-size: 22px;
}

.panel-intro {
  margin-top: 7px;
  color: var(--muted);
  line-height: 1.65;
}

.field {
  margin-top: 22px;
}

.field-label {
  display: block;
  margin-bottom: 9px;
  font-weight: 750;
}

.dropzone {
  display: grid;
  place-items: center;
  min-height: 190px;
  padding: 22px;
  border: 1.5px dashed rgba(167, 139, 250, 0.48);
  border-radius: 19px;
  background: rgba(124, 58, 237, 0.08);
  text-align: center;
  cursor: pointer;
}

.dropzone.dragging {
  border-color: var(--green);
  background: rgba(85, 230, 165, 0.08);
}

.dropzone-icon {
  font-size: 39px;
}

.dropzone strong {
  display: block;
  margin-top: 9px;
}

.dropzone small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  line-height: 1.5;
}

#sourceFile {
  display: none;
}

.file-preview {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 13px 14px;
  border-radius: 14px;
  background: var(--soft);
}

.file-preview.show {
  display: flex;
}

.file-preview-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.remove-file {
  border: 0;
  background: transparent;
  color: var(--red);
  cursor: pointer;
}

.select {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  outline: 0;
  background: var(--soft);
  color: var(--text);
}

.cost-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
  padding: 14px 15px;
  border-radius: 15px;
  background: rgba(124, 58, 237, 0.12);
}

.cost-row strong {
  color: var(--purple-light);
}

.primary-button {
  width: 100%;
  min-height: 54px;
  margin-top: 18px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, #6d28d9, #8b5cf6);
  color: white;
  font-weight: 850;
  cursor: pointer;
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.status {
  display: none;
  margin-top: 15px;
  padding: 13px 14px;
  border-radius: 14px;
  line-height: 1.55;
}

.status.show {
  display: block;
}

.status.loading {
  color: #ddd3ff;
  background: rgba(124, 58, 237, 0.14);
}

.status.success {
  color: var(--green);
  background: rgba(85, 230, 165, 0.1);
}

.status.error {
  color: var(--red);
  background: rgba(251, 113, 133, 0.1);
}

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

.history-card {
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--soft);
}

.history-name {
  overflow-wrap: anywhere;
  font-weight: 750;
}

.history-meta {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}

.history-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.history-actions button {
  flex: 1;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: rgba(7, 8, 22, 0.55);
  color: var(--text);
  cursor: pointer;
}

.empty {
  padding: 35px 14px;
  color: var(--muted);
  text-align: center;
}

.size-result {
  display: none;
  margin-top: 14px;
  padding: 13px;
  border-radius: 14px;
  background: rgba(85, 230, 165, 0.09);
  color: var(--green);
  text-align: center;
}

.size-result.show {
  display: block;
}

.estimate-panel {
  display: none;
  margin-top: 20px;
  padding: 17px;
  border: 1px solid rgba(167, 139, 250, 0.28);
  border-radius: 17px;
  background: rgba(124, 58, 237, 0.09);
}

.estimate-panel.show {
  display: block;
}

.estimate-panel h3 {
  font-size: 16px;
}

.estimate-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 13px;
}

.estimate-grid div {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 12px;
  border-radius: 13px;
  background: rgba(7, 8, 22, 0.48);
}

.estimate-grid span {
  color: var(--muted);
  font-size: 12px;
}

.estimate-grid strong {
  overflow-wrap: anywhere;
  color: var(--green);
  font-size: 15px;
}

.estimate-panel p {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

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

@media (max-width: 560px) {
  .shell {
    padding-inline: 14px;
  }

  .topbar {
    margin-inline: -14px;
    padding-inline: 14px;
  }

  .brand small,
  .back-label {
    display: none;
  }

  .top-button {
    padding-inline: 11px;
  }

  .hero {
    padding-top: 38px;
  }

  .panel {
    padding: 19px;
    border-radius: 20px;
  }

  .estimate-grid {
    grid-template-columns: 1fr;
  }
}
