/* B Nazanin — قلم رایگان برنا رایانه */
@font-face {
  font-family: "Nazanin";
  src: url("../fonts/BNazanin.woff2") format("woff2"),
       url("../fonts/BNazanin.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Nazanin";
  src: url("../fonts/BNazaninBold.woff2") format("woff2"),
       url("../fonts/BNazaninBold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #f5f3f8;
  --white: #ffffff;
  --ink: #3c334f;
  --fili: #6f6a76;
  --fili-soft: #8d8794;
  --line: #e6e1ec;
  --lilac: #6d5a90;
  --lilac-deep: #4c3d68;
  --lilac-wash: #f3eef8;
  --lilac-mid: #d9ccea;
  --danger: #7a5360;
  --radius: 22px;
  --font: "Nazanin", "B Nazanin", Tahoma, sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.85;
}

::selection {
  background: var(--lilac-mid);
  color: var(--ink);
}

:focus-visible {
  outline: 2px solid var(--lilac);
  outline-offset: 2px;
}

button, input, select {
  font: inherit;
}

a { color: var(--lilac-deep); }

.skip {
  position: absolute;
  right: 12px;
  top: -40px;
  background: var(--white);
  padding: 8px 12px;
  border-radius: 10px;
}

.skip:focus { top: 12px; }

.icon { width: 20px; height: 20px; flex: none; }

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 252px;
  flex: none;
  background: var(--lilac-wash);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  padding: 0 8px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--lilac);
  color: var(--white);
  display: grid;
  place-items: center;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.4; }
.brand-text strong { font-size: 22px; font-weight: 700; }
.brand-text small { color: var(--fili); font-size: 15px; }

.nav { display: flex; flex-direction: column; gap: 6px; }

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  color: var(--ink);
  text-decoration: none;
}

.nav a.is-active { background: var(--white); color: var(--lilac-deep); }
.nav a:hover { background: rgba(255, 255, 255, 0.7); }

.logout { margin-top: auto; }
.logout button {
  width: 100%;
  background: transparent;
  border: 0;
  color: var(--fili);
  text-align: right;
  padding: 10px 12px;
  cursor: pointer;
}

.main { flex: 1; min-width: 0; }

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 28px 0;
}

.topbar h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.4;
}

.nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(60, 51, 79, 0.38);
  z-index: 15;
}

.content {
  width: min(880px, calc(100% - 40px));
  margin: 18px auto 48px;
}

.greeting { margin-bottom: 22px; }
.hello {
  margin: 0;
  font-size: 40px;
  font-weight: 700;
  line-height: 1.35;
}
.welcome { margin: 4px 0 0; color: var(--fili); }

.section-reports {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 28px;
}

.section-report {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 4px solid var(--lilac);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  text-decoration: none;
  color: inherit;
}

.section-report strong { font-size: 26px; font-weight: 700; line-height: 1.4; }
.section-report span:last-child { color: var(--fili); font-size: 16px; }

.eyebrow {
  margin: 0;
  color: var(--lilac);
  font-size: 15px;
}

.latest h2, .form-intro h2, .message-block h2, .auth-card h2 {
  margin: 0 0 8px;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.4;
}

.report-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.report-list li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.report-list li:last-child { border-bottom: 0; }

.report-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.report-name { overflow-wrap: anywhere; }
.report-main span { color: var(--fili); font-size: 16px; }

.status {
  flex: none;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 15px;
  background: var(--paper);
  color: var(--fili);
}

.status-sent { background: var(--lilac-wash); color: var(--lilac-deep); }

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  justify-content: flex-end;
}

.row-actions form { margin: 0; }
.row-actions a, .row-actions button {
  background: none;
  border: 0;
  padding: 0;
  color: var(--lilac-deep);
  cursor: pointer;
  text-decoration: none;
}

.pager {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: center;
  margin-top: 16px;
}

.sheet {
  position: relative;
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 4px solid var(--lilac);
  border-radius: var(--radius);
  padding: 26px 26px 28px;
}

.sheet:not(.is-start)::before {
  content: "";
  display: block;
  height: 14px;
  margin: 0 0 18px;
  background-image: radial-gradient(circle, var(--lilac-mid) 3px, transparent 3.5px);
  background-size: 18px 14px;
  background-repeat: repeat-x;
  background-position: center;
}

.sheet.is-start { width: min(460px, 100%); margin-inline: auto; }

.customer-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}

.customer-bar h2 { margin: 0; font-size: 28px; font-weight: 700; }
.customer-bar p { margin: 0; color: var(--fili); }

.entry {
  background: var(--lilac-wash);
  border-radius: 20px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.items { margin-top: 8px; }

.item {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 0.8fr) minmax(0, 0.45fr) minmax(0, 0.9fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px 2px;
  border-bottom: 1px solid var(--line);
}

.item.is-new { animation: settle 220ms ease; }

@keyframes settle {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

.item-name { font-weight: 700; }
.item-line { color: var(--lilac-deep); }
.item-actions { display: flex; gap: 8px; }

.item-edit {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.8fr) minmax(0, 0.6fr) auto auto;
  gap: 8px;
  align-items: end;
}

.item-edit input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
  border-radius: 14px;
  padding: 10px 12px;
}

.settle {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-top: 18px;
}

.total { margin: 0; display: flex; gap: 10px; align-items: baseline; }
.total strong { font-size: 26px; font-weight: 700; }
.settle-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { color: var(--fili); font-size: 16px; }

.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
  border-radius: 14px;
  padding: 10px 12px;
}

.ltr {
  direction: ltr;
  text-align: left;
}

.product-field { position: relative; }

.suggest {
  position: absolute;
  z-index: 5;
  right: 0;
  left: 0;
  top: calc(100% - 4px);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 12px 28px rgba(60, 51, 79, 0.1);
}

.suggest button {
  display: flex;
  width: 100%;
  justify-content: space-between;
  gap: 12px;
  background: var(--white);
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 8px 12px;
  cursor: pointer;
  text-align: right;
  color: var(--ink);
}

.suggest button:last-child { border-bottom: 0; }
.suggest button.is-active, .suggest button:hover { background: var(--lilac-wash); }
.suggest small { color: var(--fili); }

.stack { display: flex; flex-direction: column; gap: 14px; }
.lead { margin: 0 0 16px; color: var(--fili); }
.form-intro p { margin: 0 0 14px; color: var(--fili); }

.btn {
  border-radius: 999px;
  padding: 10px 18px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-primary { background: var(--lilac); color: var(--white); }
.btn-primary:hover { background: var(--lilac-deep); }
.btn-quiet { background: var(--white); border-color: var(--line); color: var(--ink); }
.btn-text { background: transparent; color: var(--fili); padding-inline: 8px; }
.btn:disabled { opacity: 0.6; cursor: default; }

.notice {
  background: var(--lilac-wash);
  color: var(--ink);
  border-radius: 14px;
  padding: 10px 14px;
  margin-bottom: 14px;
}

.notice-error { background: #f6eef1; color: var(--danger); }

.empty { color: var(--fili); }

.message-block, .panel-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 4px solid var(--lilac);
  border-radius: var(--radius);
  padding: 22px;
}

.panel-stack { display: flex; flex-direction: column; gap: 16px; }
.panel-card { max-width: 560px; }
.panel-card h2 { margin: 0 0 8px; }
.panel-card .lead { margin-top: 0; }
.field textarea { min-height: 88px; resize: vertical; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }

.message-block .btn { margin-top: 8px; }

.guest { min-height: 100vh; }

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

.auth-card {
  width: min(460px, 100%);
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 4px solid var(--lilac);
  border-radius: var(--radius);
  padding: 26px 22px 22px;
}

.brand-solo { margin-bottom: 18px; }
.auth-links { margin: 16px 0 0; }
.auth-card .message-block {
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
}

.modal {
  width: min(420px, calc(100vw - 32px));
  border: 0;
  border-radius: 20px;
  padding: 22px;
  color: var(--ink);
  background: var(--white);
}

.modal::backdrop { background: rgba(60, 51, 79, 0.42); }
.modal h3 { margin: 0 0 8px; font-size: 26px; font-weight: 700; }
.modal p { margin: 0 0 16px; color: var(--fili); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }

.export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
}

.export-sheet { width: min(794px, 100%); margin-inline: auto; }

.sheet-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.sheet-brand strong { display: block; font-size: 28px; font-weight: 700; line-height: 1.3; }
.sheet-brand span { color: var(--fili); }

.sheet-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 18px;
  margin: 0 0 16px;
}

.sheet-meta div { display: flex; gap: 8px; }
.sheet-meta dt { color: var(--fili); }
.sheet-meta dd { margin: 0; }

.sheet-table {
  width: 100%;
  border-collapse: collapse;
}

.sheet-table th, .sheet-table td {
  text-align: right;
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
  font-weight: 400;
}

.sheet-table th { color: var(--fili); font-size: 16px; }

.sheet-total {
  display: flex;
  justify-content: space-between;
  margin: 16px 0 0;
  font-size: 22px;
}

.sheet-total strong { font-weight: 700; }

@media (max-width: 959px) {
  .nav-toggle { display: inline-flex; }
  .sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    transform: translateX(100%);
    transition: transform 180ms ease;
  }
  .sidebar.is-open { transform: none; }
  .topbar { padding: 16px 16px 0; }
  .content { width: min(880px, calc(100% - 28px)); }
  .section-reports, .sheet-meta, .item, .item-edit { grid-template-columns: 1fr; }
  .settle, .customer-bar, .report-list li { flex-direction: column; align-items: stretch; }
  .hello { font-size: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  .item.is-new, .sidebar { animation: none; transition: none; }
}

@media print {
  .sidebar, .topbar, .export-actions, .no-print, .backdrop { display: none !important; }
  .shell, .main, .content { display: block; width: auto; margin: 0; }
  .sheet { border: 0; }
}
