@font-face {
  font-family: "B Yekan";
  src: url("../fonts/BYekan.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #061726;
  --bg2: #09253a;
  --card: #ffffff;
  --text: #102033;
  --muted: #66778b;
  --line: #e8edf3;
  --brand: #10b981;
  --brand2: #f59e0b;
  --danger: #ef4444;
  --soft: #f7fafc;
  --shadow: 0 18px 50px rgba(1, 15, 29, .12);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "B Yekan", Tahoma, Arial, sans-serif;
  background: linear-gradient(135deg, var(--bg), #0b304c 42%, #07131f);
  color: var(--text);
  min-height: 100vh;
}

.app-shell { max-width: 1240px; margin: auto; padding: 18px; }
.hero { color: #fff; padding: 8px 4px 24px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0 24px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 22px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 15px;
  background: linear-gradient(135deg, var(--brand2), #fef3c7);
  color: #111827;
  box-shadow: 0 10px 30px rgba(245, 158, 11, .25);
}
.admin-link {
  color: #d1fae5;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, .18);
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .06);
}

.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: stretch; }
.eyebrow { color: #a7f3d0; font-weight: 700; margin: 0 0 10px; }
.hero h1 { font-size: clamp(28px, 5vw, 52px); line-height: 1.25; margin: 0; max-width: 820px; }
.hero-text { color: #dbeafe; line-height: 2; font-size: 16px; max-width: 760px; }
.glass { background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .18); backdrop-filter: blur(14px); }
.hero-card { border-radius: var(--radius); padding: 28px; display: flex; flex-direction: column; justify-content: center; min-height: 170px; }
.hero-card span,
.hero-card small { color: #cbd5e1; }
.hero-card strong { font-size: 46px; direction: ltr; text-align: right; margin: 12px 0; }

.layout { display: grid; grid-template-columns: 1fr; gap: 16px; }
.mobile-stepper { display: none; }
.site-footer {
  margin: 18px 0 0;
  padding: 18px;
  color: #dbeafe;
  border-top: 1px solid rgba(255,255,255,.12);
  text-align: center;
  line-height: 2;
  font-size: 13px;
}
.site-footer a { color: #a7f3d0; direction: ltr; display: inline-block; text-decoration: none; font-weight: 900; }
.panel {
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, .7);
}
.section-title { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.section-title span {
  width: 36px;
  height: 36px;
  border-radius: 13px;
  background: #ecfdf5;
  color: #047857;
  font-weight: 900;
  display: grid;
  place-items: center;
}
.section-title h2 { margin: 0; font-size: 20px; }
.row-between { justify-content: space-between; align-items: center; }

.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.add-grid { grid-template-columns: 2fr repeat(6, 1fr); }
.settings-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }

label { display: flex; flex-direction: column; gap: 7px; font-size: 13px; font-weight: 700; color: #334155; min-width: 0; }
.wide { grid-column: span 2; }
.field-title { display: flex; align-items: center; justify-content: space-between; gap: 7px; min-height: 24px; }
.field-title > span { min-width: 0; line-height: 1.55; }
.field-help {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  padding: 0;
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #bbf7d0;
  font-size: 13px;
  line-height: 1;
  box-shadow: none;
}
.field-help:hover,
.field-help:focus { background: #d1fae5; color: #065f46; transform: none; }
.field-help-box {
  position: fixed;
  z-index: 50;
  background: #fff;
  color: #334155;
  border: 1px solid #cbd5e1;
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, .18);
  padding: 14px;
  line-height: 1.9;
  font-size: 13px;
}
.field-help-box strong { display: block; color: #0f172a; margin-bottom: 4px; }
.field-help-box p { margin: 0; }

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 12px;
  font: inherit;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: .2s;
}
input:focus,
select:focus,
textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(16, 185, 129, .12); }
small { color: var(--muted); line-height: 1.7; }

.check-row { flex-direction: row; align-items: flex-start; gap: 10px; margin-top: 14px; background: #f8fafc; border: 1px solid var(--line); padding: 14px; border-radius: 16px; line-height: 1.9; }
.check-row input { width: auto; margin-top: 5px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
button { border: 0; border-radius: 15px; padding: 13px 18px; font: inherit; font-weight: 900; cursor: pointer; transition: .2s; }
.primary { background: linear-gradient(135deg, #059669, #10b981); color: #fff; box-shadow: 0 10px 24px rgba(16, 185, 129, .24); }
.primary:hover { transform: translateY(-1px); }
.ghost { background: #f1f5f9; color: #0f172a; }
.danger { background: #fee2e2; color: #991b1b; }
.small { padding: 9px 12px; font-size: 12px; }
.big { font-size: 16px; padding: 15px 22px; }
.soft-hidden { display: none !important; }
.mini-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 18px; }
.items-table { width: 100%; border-collapse: collapse; min-width: 940px; }
.items-table th,
.items-table td { padding: 12px; border-bottom: 1px solid var(--line); text-align: right; vertical-align: middle; }
.items-table th { background: #f8fafc; color: #475569; font-size: 12px; }
.inline-input { padding: 8px; border-radius: 10px; min-width: 78px; }
.inline-check { width: auto; min-width: 0; transform: scale(1.15); }
.item-toggle { cursor: pointer; }
.accordion-btn { display: none; }
.row-name { font-weight: 900; display: block; }
.row-note { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }
.empty-row td { text-align: center; color: var(--muted); padding: 26px; }

.status-pill { font-size: 12px; background: #f1f5f9; color: #475569; padding: 8px 12px; border-radius: 999px; }
.status-pill.loading { background: #fef3c7; color: #92400e; }
.status-pill.done { background: #dcfce7; color: #166534; }
.status-pill.error { background: #fee2e2; color: #991b1b; }
.final-actions { align-items: center; }
.results-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
.result-card { border: 1px solid var(--line); border-radius: 20px; padding: 17px; background: linear-gradient(180deg, #fff, #f8fafc); }
.result-card.important { border-color: rgba(16, 185, 129, .35); box-shadow: 0 12px 28px rgba(16, 185, 129, .08); }
.result-card .label { color: #64748b; font-size: 13px; }
.result-card .value { font-size: 24px; font-weight: 950; margin: 9px 0; direction: ltr; text-align: right; }
.result-card .sub { color: #64748b; font-size: 12px; line-height: 1.8; }
.progress { height: 7px; background: #e5e7eb; border-radius: 999px; margin-top: 12px; overflow: hidden; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand2)); border-radius: 999px; }
.result-empty { grid-column: 1 / -1; text-align: center; color: var(--muted); background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 18px; padding: 28px; }
.warnings { display: grid; gap: 8px; margin-top: 14px; }
.warning-item { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; padding: 12px; border-radius: 14px; line-height: 1.8; }
.hint-box { background: #f0f9ff; color: #075985; border: 1px solid #bae6fd; padding: 12px; border-radius: 14px; line-height: 1.9; margin: 12px 0; font-size: 13px; }
.design-warning { margin-top: 14px; }
.legal-box { margin-top: 16px; background: #f8fafc; border: 1px solid var(--line); border-radius: 16px; padding: 14px; color: #475569; line-height: 1.9; font-size: 13px; }
.link-box { margin-top: 16px; background: #ecfdf5; border: 1px solid #bbf7d0; border-radius: 16px; padding: 16px; line-height: 2; }
.link-box a { direction: ltr; display: inline-block; color: #047857; font-weight: 900; }
.contact-request-box { margin-top: 16px; background: #f8fafc; border: 1px solid var(--line); border-radius: 16px; padding: 16px; line-height: 1.9; }
.contact-request-box h3 { margin: 0 0 6px; font-size: 18px; }
.contact-request-box p { margin: 0 0 12px; color: #64748b; }
.toast { position: fixed; left: 18px; bottom: 18px; z-index: 20; background: #0f172a; color: #fff; padding: 14px 18px; border-radius: 16px; box-shadow: var(--shadow); max-width: min(420px, calc(100vw - 36px)); line-height: 1.8; }
.toast.error { background: #991b1b; }

.admin-body { background: #f1f5f9; color: #0f172a; }
.admin-wrap { max-width: 1180px; margin: auto; padding: 20px; }
.admin-nav { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0; }
.admin-nav a { background: #fff; text-decoration: none; color: #0f172a; border: 1px solid #e2e8f0; border-radius: 12px; padding: 10px 13px; }
.admin-card { background: #fff; border-radius: 18px; padding: 18px; box-shadow: 0 10px 35px rgba(15, 23, 42, .08); margin-bottom: 16px; }
.admin-table { width: 100%; border-collapse: collapse; background: #fff; }
.admin-table th,
.admin-table td { border-bottom: 1px solid #e2e8f0; padding: 10px; text-align: right; }
.admin-table th { background: #f8fafc; }
.admin-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.admin-form .full { grid-column: 1 / -1; }
.login-box { max-width: 420px; margin: 10vh auto; background: #fff; border-radius: 24px; padding: 26px; box-shadow: var(--shadow); }

@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; }
  .form-grid,
  .form-grid.two,
  .form-grid.add-grid,
  .settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .results-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wide { grid-column: 1 / -1; }
  .admin-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .app-shell { padding: 10px; }
  .mobile-stepper { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; position: sticky; top: 0; z-index: 9; padding: 8px 0; background: rgba(6, 23, 38, .88); backdrop-filter: blur(10px); }
  .step-tab { border-radius: 12px; padding: 9px 4px; font-size: 11px; background: rgba(255,255,255,.12); color: #dbeafe; box-shadow: none; }
  .step-tab.active { background: #ecfdf5; color: #047857; }
  .step-hidden { display: none !important; }
  .hero { padding-bottom: 12px; }
  .topbar { padding-bottom: 14px; }
  .brand { font-size: 18px; }
  .brand-mark { width: 36px; height: 36px; }
  .hero-card { min-height: auto; padding: 18px; }
  .hero-card strong { font-size: 36px; }
  .panel { border-radius: 18px; padding: 16px; }
  .section-title { align-items: flex-start; }
  .row-between { align-items: flex-start; flex-direction: column; }
  .form-grid,
  .form-grid.two { grid-template-columns: 1fr; }
  .form-grid.add-grid,
  .settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .form-grid.add-grid .wide { grid-column: 1 / -1; }
  .results-grid { grid-template-columns: 1fr; }
  label { font-size: 12px; gap: 6px; }
  input,
  select,
  textarea { padding: 11px 9px; font-size: 13px; }
  .field-title { gap: 5px; align-items: flex-start; min-height: 22px; }
  .field-title > span { overflow-wrap: anywhere; }
  .field-help { width: 21px; height: 21px; font-size: 12px; }
  .field-help-box { left: 10px !important; right: 10px !important; bottom: 12px !important; top: auto !important; width: auto !important; max-height: 45vh; overflow: auto; }
  .actions { position: relative; }
  .sticky-mobile-actions { position: sticky; bottom: 8px; background: rgba(255, 255, 255, .82); backdrop-filter: blur(10px); padding: 10px; border-radius: 18px; border: 1px solid var(--line); z-index: 5; }
  .sticky-mobile-actions button,
  .final-actions button { width: 100%; }
  .table-wrap { border: 0; overflow: visible; }
  .items-table,
  .items-table thead,
  .items-table tbody,
  .items-table tr,
  .items-table td { display: block; width: 100%; min-width: 0; }
  .items-table thead { display: none; }
  .items-table tr { border: 1px solid var(--line); border-radius: 14px; margin-bottom: 10px; padding: 10px; background: #fff; }
  .items-table td { border: 0; padding: 8px 0; display: grid; grid-template-columns: minmax(74px,.75fr) minmax(0,1.2fr); gap: 8px; align-items: center; }
  .items-table td:before { content: attr(data-label); font-weight: 900; color: #64748b; }
  .items-table td.item-toggle { grid-template-columns: minmax(0,1fr) 34px; align-items: center; border-bottom: 1px dashed var(--line); padding-bottom: 10px; }
  .items-table td.item-toggle:before { display: none; }
  .accordion-btn { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; padding: 0; background: #ecfdf5; color: #047857; border: 1px solid #bbf7d0; font-size: 18px; box-shadow: none; }
  .items-table tr:not(.mobile-collapsed) .accordion-btn::before { content: "-"; }
  .items-table tr.mobile-collapsed .accordion-btn::before { content: "+"; }
  .items-table tr.mobile-collapsed td:not(:first-child):not(:last-child) { display: none; }
  .items-table .empty-row td { display: block; }
  .inline-input { max-width: none; width: 100%; }
  .admin-form { grid-template-columns: 1fr; }
  .admin-table { font-size: 12px; }
  .admin-wrap { padding: 10px; }
}

@media (max-width: 380px) {
  .form-grid.add-grid,
  .settings-grid { gap: 9px; }
  .field-help { width: 20px; height: 20px; }
  .small { padding: 8px 10px; }
}

@media print {
  body { background: #fff; }
  .topbar,
  .actions,
  .admin-link,
  .add-panel,
  .settings-panel,
  .customer-panel { display: none !important; }
  .panel { box-shadow: none; border: 1px solid #ddd; }
  .layout { display: block; }
  .result-panel { page-break-inside: avoid; }
  .legal-box { border-color: #ddd; }
}
