@font-face {
  font-family: "IRANYekan";
  font-style: normal;
  font-weight: 100;
  font-display: swap;
  src: url("/static/fonts/woff/iranyekanwebthinfanum.woff") format("woff");
}

@font-face {
  font-family: "IRANYekan";
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url("/static/fonts/woff/iranyekanweblightfanum.woff") format("woff");
}

@font-face {
  font-family: "IRANYekan";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src:
    local("IRANYekan"),
    local("IRANYekan Regular"),
    url("/static/fonts/woff/iranyekanwebregularfanum.woff") format("woff");
}

@font-face {
  font-family: "IRANYekan";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/static/fonts/woff/iranyekanwebmediumfanum.woff") format("woff");
}

@font-face {
  font-family: "IRANYekan";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/static/fonts/woff/iranyekanwebboldfanum.woff") format("woff");
}

@font-face {
  font-family: "IRANYekan";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("/static/fonts/woff/iranyekanwebextraboldfanum.woff") format("woff");
}

@font-face {
  font-family: "IRANYekan";
  font-style: normal;
  font-weight: 850;
  font-display: swap;
  src: url("/static/fonts/woff/iranyekanwebblackfanum.woff") format("woff");
}

@font-face {
  font-family: "IRANYekan";
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url("/static/fonts/woff/iranyekanwebextrablackfanum.woff") format("woff");
}

:root {
  color-scheme: dark;
  --charcoal: #161a22;
  --charcoal-soft: #1d2430;
  --navy: #27354d;
  --navy-soft: #344966;
  --text: #f1f4fb;
  --muted: #b7c0d0;
  --orange: #ff8e2b;
  --orange-strong: #ff7b14;
  --orange-soft: rgba(255, 142, 43, 0.2);
  --danger: #ff6f7d;
  --success: #64d68f;
  --warning: #ffc86d;
  --glass: rgba(44, 58, 82, 0.42);
  --border: rgba(199, 211, 233, 0.24);
  --font-base: "IRANYekan", Tahoma, sans-serif;
  --tablet-max: 920px;
  --tablet-pad: clamp(14px, 3vw, 28px);
  --mobile-pad: 16px;
  --footer-space: calc(112px + env(safe-area-inset-bottom));
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100dvh;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-base);
  background:
    radial-gradient(1200px 540px at -5% -25%, rgba(61, 79, 114, 0.58) 0%, rgba(61, 79, 114, 0) 68%),
    radial-gradient(900px 540px at 108% -16%, rgba(40, 54, 78, 0.58) 0%, rgba(40, 54, 78, 0) 70%),
    linear-gradient(180deg, var(--charcoal-soft) 0%, var(--charcoal) 55%);
  color: var(--text);
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.tablet-shell {
  width: 100%;
  max-width: var(--tablet-max);
  padding-inline: var(--tablet-pad);
  box-sizing: border-box;
  margin-inline: auto;
}

.page-main {
  padding: 22px 0 var(--footer-space);
}

.page-stack {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.glass {
  background: linear-gradient(145deg, rgba(52, 73, 104, 0.45), rgba(31, 43, 62, 0.52));
  border: 1px solid var(--border);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 16px 44px rgba(8, 12, 20, 0.46);
  backdrop-filter: blur(18px) saturate(145%);
  -webkit-backdrop-filter: blur(18px) saturate(145%);
}

.tb-header {
  position: sticky;
  top: 0;
  z-index: 30;
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 14px 0;
}

.header-row {
  --tb-header-columns: 1fr auto 1fr;
  border-radius: 20px;
  padding: 12px 16px;
  display: grid;
  grid-template-columns: var(--tb-header-columns);
  align-items: center;
  gap: 10px;
}

.header-right,
.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.header-right {
  flex: 0 0 auto;
}

.header-left {
  flex: 0 0 auto;
  justify-content: flex-end;
}

.header-center {
  grid-column: 2;
  justify-self: center;
  width: 100%;
  min-width: 0;
  text-align: center;
}

.header-title {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logo-link {
  text-decoration: none;
}

.logo-mark-wrap {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #f1f4fb;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.logo-mark {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  object-fit: contain;
  display: block;
  padding: 6px;
}

.mobile-chip {
  padding: 6px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 154, 77, 0.36);
  color: #ffe2c8;
  font-size: 0.87rem;
  background: rgba(255, 142, 43, 0.16);
  white-space: nowrap;
}

.profile-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(58, 79, 112, 0.45);
  cursor: pointer;
}

.profile-trigger {
  font: inherit;
  color: inherit;
}

.profile-menu-wrap {
  position: relative;
}

.profile-menu {
  position: absolute;
  top: calc(100% + 6px);
  inset-inline-start: 0;
  min-width: 120px;
  padding: 6px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(29, 36, 48, 0.96);
  box-shadow: 0 12px 24px rgba(8, 12, 20, 0.42);
  display: none;
  z-index: 40;
}

.profile-menu.open {
  display: block;
}

@media (hover: hover) and (pointer: fine) {
  .profile-menu-wrap:hover .profile-menu {
    display: block;
  }
}

.profile-menu-item {
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: start;
  padding: 8px 10px;
  cursor: pointer;
}

.profile-menu-item:hover,
.profile-menu-item:focus-visible {
  background: rgba(255, 142, 43, 0.16);
}

.dashboard-wrap {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.auth-layout {
  width: min(540px, 100%);
  margin-inline: auto;
}

.auth-card {
  padding: 22px;
}

.welcome-card {
  display: grid;
  gap: 12px;
}

.page-badge {
  display: inline-flex;
  width: fit-content;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 154, 77, 0.34);
  color: #ffe3cc;
  background: rgba(255, 142, 43, 0.16);
  font-size: 0.82rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.feature-item {
  border: 1px solid rgba(199, 211, 233, 0.18);
  border-radius: 14px;
  padding: 12px;
  background: rgba(34, 45, 64, 0.35);
}

.feature-item h3 {
  margin: 0 0 6px;
  font-size: 0.95rem;
}

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

.supply-cta-inline {
  display: grid;
  justify-items: center;
  gap: 8px;
  width: 100%;
  margin-inline: auto;
}

.btn-plus {
  width: 104px;
  height: 104px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(155deg, #ffa64f, #ff7b14);
  color: #fff7ef;
  font-size: 2.9rem;
  font-weight: 800;
  box-shadow: 0 16px 34px rgba(255, 123, 20, 0.42);
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 220ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .btn-plus:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 36px rgba(255, 123, 20, 0.5);
  }
}

.btn-plus:active {
  transform: translateY(1px);
  box-shadow: 0 10px 22px rgba(255, 123, 20, 0.36);
}

.btn-plus:focus-visible {
  outline: 2px solid rgba(255, 197, 141, 0.9);
  outline-offset: 3px;
}

.supply-cta-text {
  margin: 0;
  font-weight: 700;
  color: #ffe5ce;
  text-align: center;
  white-space: nowrap;
}

.table-card {
  border-radius: 24px;
  padding: 18px;
}

.inventory-header h2,
h2 {
  margin: 0 0 6px;
  font-size: 1.1rem;
}

.section-head {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
}

p {
  margin: 0;
}

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

.table-wrap {
  width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

.inventory-table {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
}

.inventory-table th,
.inventory-table td {
  text-align: right;
  padding: 12px 10px;
  border-bottom: 1px solid rgba(173, 188, 214, 0.21);
  vertical-align: middle;
}

.inventory-table th {
  font-size: 0.9rem;
  color: #d6deea;
  font-weight: 600;
  white-space: nowrap;
}

.status-chip {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  border: 1px solid transparent;
}

.status-pending {
  color: #e7eef8;
  background: rgba(132, 153, 187, 0.25);
}

.status-warn {
  color: #2d2f37;
  background: rgba(255, 200, 109, 0.72);
}

.status-ok {
  color: #daffea;
  background: rgba(100, 214, 143, 0.25);
}

.status-bad {
  color: #ffd9dd;
  background: rgba(255, 111, 125, 0.24);
}

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

.row-actions form {
  margin: 0;
}

.btn-row {
  border: 1px solid rgba(255, 154, 77, 0.28);
  background: rgba(255, 142, 43, 0.15);
  color: #ffe8d3;
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  white-space: nowrap;
}

.btn-row-secondary {
  border-color: rgba(171, 194, 230, 0.24);
  background: rgba(84, 109, 148, 0.24);
  color: #e6eefc;
}

.btn-row-danger {
  background: rgba(255, 111, 125, 0.2);
  border-color: rgba(255, 150, 160, 0.36);
}

.empty-state {
  padding: 18px;
  border: 1px dashed rgba(255, 158, 87, 0.43);
  border-radius: 14px;
}

.message {
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.9rem;
  margin-top: 12px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 320ms ease, transform 320ms ease;
}

.message:empty {
  display: none;
}

.message.message-enter {
  opacity: 1;
  transform: translateY(0);
}

.message.message-exit {
  opacity: 0;
  transform: translateY(-4px);
}

.message.error {
  color: #ffd9de;
  background: rgba(255, 111, 125, 0.2);
  border: 1px solid rgba(255, 150, 160, 0.34);
}

.message.success {
  color: #d7ffea;
  background: rgba(100, 214, 143, 0.18);
  border: 1px solid rgba(129, 225, 166, 0.3);
}

.supplier-register-state {
  transition: opacity 280ms ease, transform 280ms ease;
}

.supplier-register-animated {
  opacity: 1;
  transform: translateY(0);
}

.supplier-register-state--empty {
  opacity: 0;
  transform: translateY(6px);
}

.supplier-register-card {
  display: grid;
  gap: 8px;
}

.supplier-register-form {
  display: grid;
  gap: 4px;
}

.field-required {
  color: var(--danger);
}

.supplier-register-readonly {
  display: grid;
  gap: 6px;
}

.supplier-register-readonly > div {
  border: 1px solid rgba(214, 223, 238, 0.24);
  border-radius: 12px;
  padding: 10px;
}

.supplier-register-intro {
  margin: 0 0 6px;
}

.supplier-register-form textarea {
  resize: vertical;
}

.supplier-register-fade-in {
  animation: supplierRegisterFade 260ms ease both;
}

.supplier-register-status-loading {
  margin: 0;
  opacity: 0.88;
}

.supplier-register-status-message--hidden {
  display: none;
}

.supplier-register-status-loading--hidden {
  display: none;
}

@keyframes supplierRegisterFade {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 768px) {
  .supplier-register-card {
    gap: 10px;
  }

  .supplier-register-form {
    gap: 8px;
  }

  #supplier-submit {
    width: 100%;
    margin-top: 10px;
  }
}

.is-loading {
  opacity: 0.82;
}

label {
  display: block;
  margin-top: 10px;
  font-size: 0.89rem;
  color: #e2e9f7;
}

input,
textarea,
button,
select {
  font: inherit;
  font-family: var(--font-base);
}

.card,
.card-wide {
  border-radius: 24px;
  padding: 16px;
  background: var(--glass);
  border: 1px solid var(--border);
  backdrop-filter: blur(18px) saturate(145%);
  -webkit-backdrop-filter: blur(18px) saturate(145%);
}

.otp-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(56px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.otp-box {
  text-align: center;
  font-size: 1.35rem;
  letter-spacing: 0.08em;
}

.otp-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.otp-actions a {
  color: #ffd5b0;
  text-decoration: none;
}

.otp-actions a.disabled {
  color: #9da5b4;
  pointer-events: none;
}

.stack-form,
.profile-form {
  display: grid;
  gap: 2px;
}

input,
textarea,
select {
  width: 100%;
  margin-top: 6px;
  border-radius: 12px;
  border: 1px solid rgba(214, 223, 238, 0.24);
  background: rgba(35, 48, 70, 0.65);
  color: var(--text);
  padding: 11px 12px;
}

input:focus,
textarea:focus,
select:focus,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 1px;
}

textarea {
  resize: vertical;
}

button[type="submit"] {
  width: 100%;
  margin-top: 14px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(160deg, var(--orange), var(--orange-strong));
  color: #fff9f4;
  padding: 12px;
  cursor: pointer;
}

.enamad-placeholder {
  width: clamp(118px, 34vw, 160px);
  aspect-ratio: 1 / 1;
  margin: 24px auto 0;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(214, 223, 238, 0.24);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.enamad-placeholder a {
  display: block;
  width: 100%;
  height: 100%;
}

.enamad-placeholder img {
  cursor: pointer;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.auth-layout .enamad-placeholder {
  opacity: 0.95;
}

.field-error {
  color: #ffd0d6;
}

.input-error {
  border-color: #ff7e8b;
}

.no-scroll {
  overflow: hidden;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
}

.modal.is-open {
  display: block;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 13, 20, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-panel {
  position: relative;
  width: min(680px, calc(100vw - 24px));
  max-height: 86vh;
  overflow-y: auto;
  margin: 6vh auto 0;
  border-radius: 20px;
  padding: 18px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.modal-head h3 {
  margin: 0;
  font-size: 1.05rem;
}

.modal-close {
  margin: 0;
  border: 1px solid rgba(255, 149, 70, 0.36);
  background: rgba(255, 142, 43, 0.15);
  color: #ffe8d3;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  font-size: 1.25rem;
  cursor: pointer;
}

.tb-footer {
  position: fixed;
  right: 0;
  left: 0;
  bottom: 12px;
  z-index: 35;
  width: 100%;
  display: flex;
  justify-content: center;
  padding-bottom: env(safe-area-inset-bottom);
}

.tb-header > .tablet-shell,
.tb-footer > .tablet-shell {
  width: 100%;
  margin-inline: auto;
}

.footer-nav {
  border-radius: 18px;
  padding: 10px 14px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.footer-item {
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: #e2eaf8;
  border-radius: 12px;
  padding: 8px 6px;
  min-height: 58px;
  width: 100%;
}

.footer-item.active,
.footer-item:hover {
  background: var(--orange-soft);
  color: #fff1e3;
}

.footer-item small {
  font-size: 0.72rem;
}

.page-auth .tb-footer {
  display: none;
}

.page-auth .page-main {
  padding-bottom: 36px;
}

@media (max-width: 768px) {
  .tablet-shell {
    width: 100%;
    max-width: 100%;
    margin-inline: auto;
    padding-inline: var(--mobile-pad);
  }

  .tb-header {
    padding-top: 10px;
    --tb-header-columns: 1fr 2fr 1fr;
  }

  .header-row {
    padding: 10px 12px;
  }

  .mobile-chip {
    display: none;
  }

  .page-main {
    padding-top: 14px;
    padding-bottom: calc(108px + env(safe-area-inset-bottom));
  }

  .supply-panel,
  .table-card {
    border-radius: 16px;
    padding: 12px;
  }

  .inventory-table {
    min-width: 600px;
  }

  .row-actions {
    justify-content: flex-end;
  }

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

@media (max-width: 480px) {
  .tablet-shell {
    padding-inline: 12px;
  }

  .header-row {
    border-radius: 16px;
    padding: 10px;
  }

  .footer-nav {
    padding: 8px 10px;
    gap: 6px;
  }

  .footer-item {
    min-height: 54px;
    padding: 6px 4px;
  }
}

/* ========================================
   Countdown Timer & Circular Progress
   ======================================== */

.timer-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
}

.timer-progress {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.timer-progress-bg {
  fill: none;
  stroke: var(--glass);
  stroke-width: 6;
}

.timer-progress-ring {
  fill: none;
  stroke: var(--orange);
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.3s ease, stroke 0.3s ease;
}

.timer-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.timer-display {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  direction: ltr;
  letter-spacing: 0.5px;
}

/* Timer States */
.timer-warning .timer-progress-ring {
  stroke: var(--warning);
}

.timer-danger .timer-progress-ring {
  stroke: var(--danger);
  animation: timer-pulse 1s ease-in-out infinite;
}

.timer-expired .timer-progress-ring {
  stroke: var(--muted);
}

.timer-expired .timer-display {
  color: var(--muted);
}

@keyframes timer-pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

/* Timer in Table Context */
.inventory-table td .timer-wrapper {
  margin: 0 auto;
}

/* Timer Cell Styling */
td.timer-cell {
  text-align: center;
  vertical-align: middle;
  padding: 12px 8px;
}

/* Responsive adjustments */
@media (max-width: 920px) {
  .timer-wrapper {
    width: 70px;
    height: 70px;
  }

  .timer-display {
    font-size: 16px;
  }

  .timer-progress-bg,
  .timer-progress-ring {
    stroke-width: 5;
  }
}

@media (max-width: 600px) {
  .timer-wrapper {
    width: 60px;
    height: 60px;
  }

  .timer-display {
    font-size: 14px;
  }

  .timer-progress-bg,
  .timer-progress-ring {
    stroke-width: 4;
  }
}

/* Admin Panel - Text-only Timer */
.admin-timer-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  direction: ltr;
  display: inline-block;
  padding: 4px 8px;
  background: var(--glass);
  border-radius: 6px;
  border: 1px solid var(--border);
}

.admin-timer-text.warning {
  color: var(--warning);
  border-color: var(--warning);
}

.admin-timer-text.danger {
  color: var(--danger);
  border-color: var(--danger);
}

.admin-timer-text.expired {
  color: var(--muted);
}
