/* ============================================================
   توکن‌های دیزاین (ادغام‌شده از tokens.css) — تم شب/روز
   خودکفا: کل رنگ‌ها اینجاست تا هیچ وابستگی به فایل جدا نباشد
   ============================================================ */
/* ============================================================
   ناشتا — توکن‌های دیزاین (CSS Custom Properties)
   دو تم: :root[data-theme="light"] و [data-theme="dark"]
   ============================================================ */

/* ---------- توکن‌های مشترک (مستقل از تم) ---------- */
:root {
  /* فونت‌ها */
  --font-display: 'Lalezar', 'Vazirmatn', sans-serif;   /* تیترها و تابلو */
  --font-body: 'Vazirmatn', 'Tahoma', sans-serif;       /* متن بدنه */
  --font-mono: 'Courier New', monospace;                /* برچسب placeholder */

  /* اندازه فونت */
  --fs-xs: 0.75rem;
  --fs-sm: 0.85rem;
  --fs-md: 1rem;
  --fs-lg: 1.2rem;
  --fs-xl: 1.55rem;
  --fs-2xl: 2.1rem;

  /* فاصله‌گذاری */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;

  /* گردی گوشه — رترو: گوشه‌های نسبتاً کم‌گرد */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 999px;

  /* عرض ستون اپ مشتری */
  --app-max: 480px;

  /* زمان انیمیشن */
  --t-fast: 0.15s;
  --t-med: 0.3s;
}

/* ---------- تم روز (پیش‌فرض) ---------- */
:root,
:root[data-theme="light"] {
  color-scheme: light;

  /* زمینه و سطح */
  --bg: #F5EBD7;            /* کاغذ */
  --surface: #FBF6EA;       /* کرم کاغذی — کارت‌ها */
  --surface-2: #F0E2C6;     /* سطح فرورفته / زمینه ثانویه */
  --line: #E0CFAC;          /* خط جداکننده و حاشیه */
  --line-strong: #C9B48A;

  /* متن */
  --ink: #3A2A1E;           /* قهوه‌ای مرکب */
  --ink-2: #6E5A45;         /* متن کم‌رنگ */
  --ink-3: #9A876C;         /* متن خیلی کم‌رنگ / placeholder */

  /* برند */
  --lacquer: #8E1B1B;       /* قرمز لاکی — اکشن اصلی */
  --lacquer-2: #6E1212;     /* قرمز تیره — hover/تأکید */
  --on-lacquer: #FBF6EA;    /* متن روی قرمز */
  --mustard: #E8A93C;       /* خردلی — تأکید و ستاره */
  --mustard-soft: #F7E3BC;  /* زمینه خردلی ملایم */
  --gold: #B9852F;          /* طلایی — حاشیه و جزئیات (تیره‌تر برای AA) */
  --gold-soft: #EBD9AF;

  /* وضعیت‌ها */
  --success: #4C7A44;
  --success-soft: #E3EDD9;
  --danger: #A5341F;
  --danger-soft: #F6DFD4;
  --info: #3E5C7A;
  --info-soft: #DFE7EE;
  --warn: #9C6B12;
  --warn-soft: #F7E9C8;

  /* سایه */
  --shadow-1: 0 1px 3px rgba(58, 42, 30, 0.12);
  --shadow-2: 0 4px 14px rgba(58, 42, 30, 0.14);
  --shadow-3: 0 10px 30px rgba(58, 42, 30, 0.20);

  /* تابلو */
  --sign-bg: #8E1B1B;
  --sign-border: #F3E4C2;
  --sign-text: #FBF6EA;
}

/* ---------- تم شب — زغالیِ گرم، نه مشکی خالص ---------- */
[data-theme="dark"] {
  color-scheme: dark;

  --bg: #221711;            /* قهوه‌ای مرکب زغالی */
  --surface: #2E211A;
  --surface-2: #3A2B21;
  --line: #4A392B;
  --line-strong: #5D4834;

  --ink: #F3E8D2;
  --ink-2: #C9B694;
  --ink-3: #96825F;

  --lacquer: #A93228;       /* قرمز تنظیم‌شده برای کنتراست روی زمینه تیره */
  --lacquer-2: #C4463A;
  --on-lacquer: #FBF6EA;
  --mustard: #E8A93C;
  --mustard-soft: #4A3819;
  --gold: #D9A84E;
  --gold-soft: #55422A;

  --success: #8DB87B;
  --success-soft: #33402B;
  --danger: #E07B62;
  --danger-soft: #4A2A1F;
  --info: #8FAECB;
  --info-soft: #2C3A47;
  --warn: #E0B054;
  --warn-soft: #443413;

  --shadow-1: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 4px 14px rgba(0, 0, 0, 0.45);
  --shadow-3: 0 10px 30px rgba(0, 0, 0, 0.55);

  --sign-bg: #7E1A16;
  --sign-border: #E9D6AC;
  --sign-text: #F7EEDA;
}

/* اسکوپ محلی تم روز — باید بعد از بلوک شب باشد تا wrapper روشن داخل روت تیره برنده شود */
[data-theme="light"] {
  color-scheme: light;

  /* زمینه و سطح */
  --bg: #F5EBD7;            /* کاغذ */
  --surface: #FBF6EA;       /* کرم کاغذی — کارت‌ها */
  --surface-2: #F0E2C6;     /* سطح فرورفته / زمینه ثانویه */
  --line: #E0CFAC;          /* خط جداکننده و حاشیه */
  --line-strong: #C9B48A;

  /* متن */
  --ink: #3A2A1E;           /* قهوه‌ای مرکب */
  --ink-2: #6E5A45;         /* متن کم‌رنگ */
  --ink-3: #9A876C;         /* متن خیلی کم‌رنگ / placeholder */

  /* برند */
  --lacquer: #8E1B1B;       /* قرمز لاکی — اکشن اصلی */
  --lacquer-2: #6E1212;     /* قرمز تیره — hover/تأکید */
  --on-lacquer: #FBF6EA;    /* متن روی قرمز */
  --mustard: #E8A93C;       /* خردلی — تأکید و ستاره */
  --mustard-soft: #F7E3BC;  /* زمینه خردلی ملایم */
  --gold: #B9852F;          /* طلایی — حاشیه و جزئیات (تیره‌تر برای AA) */
  --gold-soft: #EBD9AF;

  /* وضعیت‌ها */
  --success: #4C7A44;
  --success-soft: #E3EDD9;
  --danger: #A5341F;
  --danger-soft: #F6DFD4;
  --info: #3E5C7A;
  --info-soft: #DFE7EE;
  --warn: #9C6B12;
  --warn-soft: #F7E9C8;

  /* سایه */
  --shadow-1: 0 1px 3px rgba(58, 42, 30, 0.12);
  --shadow-2: 0 4px 14px rgba(58, 42, 30, 0.14);
  --shadow-3: 0 10px 30px rgba(58, 42, 30, 0.20);

  /* تابلو */
  --sign-bg: #8E1B1B;
  --sign-border: #F3E4C2;
  --sign-text: #FBF6EA;
}


/* صبحانه‌سرای ناشتا — استایل رترو دهه ۶۰ (میلادی ۹۰)
   رنگ‌ها از سیستم دیزاین (tokens.css) می‌آیند تا تم شب/روز خودکار کار کند.
   این بلوک فقط نام‌های قدیمی را به توکن‌های تازه پل می‌زند (به‌صورت مرجع، نه مقدار ثابت،
   تا در هر تم مقدار درست resolve شود). --mustard/--gold/--ink/--line/--mustard-soft
   عمداً اینجا تعریف نمی‌شوند چون مستقیماً از tokens.css با همان نام می‌آیند. */
:root {
    --red: var(--lacquer);
    --red-dark: var(--lacquer-2);
    --cream: var(--bg);
    --paper: var(--surface);
    --ink-soft: var(--ink-2);
    /* مقادیر ثابت (مستقل از تم) برای عناصری که در هر دو تم باید یک‌جور بمانند */
    --mustard-soft: #F6E4BE;   /* پرکننده/متن روشن روی قرمز برند */
    --chip-dark: #241610;      /* تراشه‌های همیشه‌تیره (بنر بسته/نصب/میز) */
    --chip-on: #F6ECD6;        /* متن روشن روی تراشه تیره */
    --on-mustard: #3A2A1E;     /* متن تیره روی پرکننده کرمِ روشن */
    --field: var(--surface);   /* زمینه ورودی‌ها */
}

* { box-sizing: border-box; }

/* هر عنصری با ویژگی hidden واقعاً پنهان بماند.
   بدون این، هر قاعده‌ای که display را ست کند (مثل .menu-card یا .profile-pop)
   پیش‌فرضِ مرورگر برای [hidden] را می‌شکند و عنصر با وجود hidden دیده می‌شود. */
[hidden] { display: none !important; }

body {
    margin: 0;
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    background: var(--cream);
    background-image:
        radial-gradient(circle at 20% 10%, rgba(232, 169, 60, 0.08), transparent 40%),
        radial-gradient(circle at 80% 90%, rgba(142, 27, 27, 0.06), transparent 40%),
        repeating-linear-gradient(45deg, transparent 0 10px, rgba(58, 42, 30, 0.015) 10px 11px);
    color: var(--ink);
    line-height: 1.8;
}

.site-frame {
    max-width: 1024px;
    margin: 0 auto;
    padding: 0 1rem 2rem;
}

a { color: var(--red); text-decoration: none; }
a:hover { color: var(--red-dark); }

h1, h2, h3, .display { font-family: 'Lalezar', 'Vazirmatn', Tahoma, cursive; font-weight: 400; }

/* ---------- سربرگ: تابلوی کافه ---------- */
.site-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.2rem 0 0.8rem;
}

/* بازسازی وکتوری تابلوی واقعی کافه:
   قاب کرم، گوشه‌های بریده هشت‌ضلعی، ستاره گره‌چینی در چهار گوشه، زمینه قرمز لاکی */
.sign-board {
    display: inline-block;
    font-size: 1rem;
    background: linear-gradient(180deg, #F6EDCF, #EADDB4);
    padding: 0.3em;
    clip-path: polygon(1.15em 0, calc(100% - 1.15em) 0, 100% 1.15em,
        100% calc(100% - 1.15em), calc(100% - 1.15em) 100%, 1.15em 100%,
        0 calc(100% - 1.15em), 0 1.15em);
    filter: drop-shadow(0 0.35em 0.7em rgba(43, 22, 16, 0.45));
    line-height: 1;
    text-decoration: none;
}
.sign-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1em;
    padding: 0.45em 1.6em 0.7em;
    background-color: #8E1B1B;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='%23F2E8C9'%3E%3Crect x='7' y='7' width='10' height='10'/%3E%3Crect x='7' y='7' width='10' height='10' transform='rotate(45 12 12)'/%3E%3C/g%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='%23F2E8C9'%3E%3Crect x='7' y='7' width='10' height='10'/%3E%3Crect x='7' y='7' width='10' height='10' transform='rotate(45 12 12)'/%3E%3C/g%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='%23F2E8C9'%3E%3Crect x='7' y='7' width='10' height='10'/%3E%3Crect x='7' y='7' width='10' height='10' transform='rotate(45 12 12)'/%3E%3C/g%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='%23F2E8C9'%3E%3Crect x='7' y='7' width='10' height='10'/%3E%3Crect x='7' y='7' width='10' height='10' transform='rotate(45 12 12)'/%3E%3C/g%3E%3C/svg%3E"),
        radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, 0.12), transparent 55%),
        linear-gradient(180deg, #A82834, #97202A 45%, #7E141E);
    background-repeat: no-repeat;
    background-size: 0.85em 0.85em, 0.85em 0.85em, 0.85em 0.85em, 0.85em 0.85em, 100% 100%, 100% 100%;
    background-position: top 0.28em right 0.28em, top 0.28em left 0.28em,
        bottom 0.28em right 0.28em, bottom 0.28em left 0.28em, center, center;
    clip-path: polygon(0.95em 0, calc(100% - 0.95em) 0, 100% 0.95em,
        100% calc(100% - 0.95em), calc(100% - 0.95em) 100%, 0.95em 100%,
        0 calc(100% - 0.95em), 0 0.95em);
    box-shadow: inset 0 0 2.2em rgba(0, 0, 0, 0.3);
}
.sign-pre {
    font-family: 'Noto Nastaliq Urdu', 'Vazirmatn', serif;
    font-size: 0.95em;
    line-height: 2;
    color: #FDFBF2;
    text-shadow:
        -1px 0 0 #55622F, 1px 0 0 #55622F, 0 -1px 0 #55622F, 0 1px 0 #55622F,
        -1px 1px 0 #55622F, 1px -1px 0 #55622F, 0 0.12em 0.05em rgba(0, 0, 0, 0.35);
}
.sign-main {
    font-family: 'Noto Nastaliq Urdu', 'Vazirmatn', serif;
    font-weight: 700;
    font-size: 2em;
    line-height: 1.7;
    color: #F8F1DC;
    text-shadow:
        -1px 0 0 #241610, 1px 0 0 #241610, 0 -1px 0 #241610, 0 1px 0 #241610,
        -0.06em 0.09em 0 #241610, 0 0.14em 0.1em rgba(0, 0, 0, 0.4);
}
.sign-sm { font-size: 0.62rem; }
.sign-lg { font-size: 1.5rem; }
.sign-hours { font-size: 0.78rem; color: var(--ink-soft); text-align: center; display: block; margin-top: 0.4rem; }
.brand-wrap { display: inline-flex; flex-direction: column; align-items: center; }
@media (max-width: 640px) {
    .sign-lg { font-size: 1.05rem; }
}

.main-nav { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.main-nav a {
    background: var(--paper);
    border: 1.5px solid var(--gold);
    border-radius: 999px;
    padding: 0.35rem 1.1rem;
    font-weight: 600;
    box-shadow: 0 2px 0 rgba(58, 42, 30, 0.15);
}
.main-nav a:hover { background: var(--mustard-soft); }
.cart-link { position: relative; }
.cart-badge {
    display: inline-block;
    min-width: 1.4em;
    text-align: center;
    background: var(--red);
    color: #fff;
    border-radius: 999px;
    font-size: 0.78rem;
    padding: 0 0.35em;
    margin-inline-start: 0.35em;
}

.closed-banner {
    background: var(--chip-dark);
    color: var(--mustard-soft);
    border-radius: 8px;
    padding: 0.7rem 1rem;
    text-align: center;
    margin: 0.6rem 0;
}

.flash {
    border-radius: 8px;
    padding: 0.8rem 1rem;
    margin: 0.8rem 0;
    border: 1.5px solid;
    text-align: center;
}
.flash-ok { background: #EDF6E8; border-color: #4E7A3A; color: #33551F; }
.flash-error { background: #FBE9E7; border-color: var(--red); color: var(--red-dark); }

/* ---------- هیرو ---------- */
.hero {
    margin: 1.2rem 0 2rem;
    background: linear-gradient(160deg, #F0B94F, var(--mustard) 60%, #D89A2E);
    border: 3px solid var(--red);
    border-radius: 14px;
    box-shadow: 0 10px 24px rgba(58, 42, 30, 0.22), inset 0 0 0 6px rgba(255, 248, 226, 0.35);
    padding: 2.4rem 1.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.hero::before, .hero::after {
    content: '✦';
    position: absolute;
    color: rgba(142, 27, 27, 0.25);
    font-size: 3.5rem;
}
.hero::before { top: 0.6rem; right: 1.2rem; }
.hero::after { bottom: 0.6rem; left: 1.2rem; }
.hero h1 {
    margin: 0;
    font-size: 2.6rem;
    color: var(--red-dark);
    text-shadow: 1px 2px 0 rgba(255, 248, 226, 0.6);
}
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}
.hero .sign-board { margin-bottom: 0.8rem; }
.hero-tagline {
    margin: 0 0 1.2rem;
    font-family: 'Lalezar', 'Vazirmatn', cursive;
    font-size: 1.6rem;
    line-height: 1.6;
    color: var(--red-dark);
    text-shadow: 1px 1px 0 rgba(255, 248, 226, 0.5);
}
@media (max-width: 640px) { .hero-tagline { font-size: 1.25rem; } }
.hero p { margin: 0.4rem 0 1.2rem; font-size: 1.05rem; color: #5C3D14; }
.btn {
    display: inline-block;
    background: var(--red);
    color: #FFE9B0;
    font-family: 'Lalezar', cursive;
    font-size: 1.15rem;
    border: 2px solid var(--red-dark);
    border-radius: 10px;
    padding: 0.5rem 2rem;
    cursor: pointer;
    box-shadow: 0 4px 0 var(--red-dark);
    transition: transform 0.08s, box-shadow 0.08s;
    white-space: nowrap;
    text-align: center;
}
.btn:hover { color: #fff; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--red-dark); }
.btn-sm { font-size: 0.95rem; padding: 0.25rem 1.1rem; box-shadow: 0 3px 0 var(--red-dark); }
.btn-ghost {
    background: var(--paper);
    color: var(--red);
    border-color: var(--gold);
    box-shadow: 0 3px 0 var(--gold);
}

/* ---------- منو ---------- */
.section-title {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin: 2rem 0 1rem;
    color: var(--red-dark);
    font-size: 1.7rem;
}
.section-title::before, .section-title::after {
    content: '';
    flex: 1;
    border-top: 2px dashed var(--gold);
}

.cat-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1rem;
}
.cat-nav a {
    background: var(--red);
    color: var(--mustard-soft);
    border-radius: 6px;
    padding: 0.25rem 1rem;
    font-family: 'Lalezar', cursive;
    font-size: 1.05rem;
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
    gap: 0.8rem;
}
.menu-card {
    background: var(--paper);
    border: 2px solid var(--gold);
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 3px 8px rgba(58, 42, 30, 0.1);
}
/* کارت‌های بدون عکس: بدون بلوک بزرگ خالی — یک نوار باریک تزئینی بالای کارت */
.menu-card.no-img { border-top: 4px solid var(--red); }
.menu-card-img {
    aspect-ratio: 4 / 3;
    background: linear-gradient(135deg, var(--red) 0%, var(--red-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--mustard-soft);
    font-size: 2.4rem;
}
.menu-card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.menu-card-body { padding: 0.7rem 0.85rem 0.85rem; display: flex; flex-direction: column; flex: 1; gap: 0.15rem; }
.menu-card h3 { margin: 0; font-size: 1.1rem; line-height: 1.4; color: var(--red-dark); }
.menu-card .desc { font-size: 0.8rem; color: var(--ink-soft); margin: 0.1rem 0 0.5rem; flex: 1; }
.menu-card .price-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    border-top: 1px dashed var(--line);
    padding-top: 0.6rem;
    margin-top: auto;
}
.menu-card .price-row form { width: 100%; }
.menu-card .price-row .btn { width: 100%; }
.price { font-weight: 700; color: var(--ink); text-align: center; white-space: nowrap; }

/* ---------- جدول‌ها و فرم‌ها ---------- */
.card {
    background: var(--paper);
    border: 2px solid var(--gold);
    border-radius: 12px;
    padding: 1.2rem 1.4rem;
    margin: 1rem 0;
    box-shadow: 0 4px 12px rgba(58, 42, 30, 0.1);
}

table.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { padding: 0.55rem 0.6rem; text-align: right; border-bottom: 1px dashed var(--line); }
.tbl th { color: var(--red-dark); font-family: 'Lalezar', cursive; font-weight: 400; font-size: 1.05rem; }
.tbl tr:last-child td { border-bottom: 0; }

label { display: block; margin: 0.7rem 0 0.25rem; font-weight: 600; font-size: 0.92rem; }
input[type=text], input[type=tel], input[type=password], input[type=number], textarea, select {
    width: 100%;
    padding: 0.55rem 0.7rem;
    border: 1.5px solid var(--line);
    border-radius: 8px;
    background: var(--field);
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--ink);
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--mustard); border-color: var(--gold); }

/* ---------- خطوط سبد خرید ---------- */
/* گرید ثابت به‌جای flex-wrap: قبلاً روی موبایل کنترل تعداد و مبلغ
   نامرتب می‌پیچیدند و خط سبد بهم‌ریخته دیده می‌شد */
.cart-line {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    grid-template-areas: "info qty total del";
    align-items: center;
    gap: 0.5rem 0.7rem;
    padding: 0.7rem 0;
    border-bottom: 1px dashed var(--line);
    transition: opacity var(--t-med) ease, transform var(--t-med) ease;
}
.cart-line-info  { grid-area: info; min-width: 0; }
.cart-line .qty-form { grid-area: qty; }
.cart-line-total { grid-area: total; }
.cart-line-del   { grid-area: del; }

.cart-line-name { font-weight: 700; color: var(--red-dark); }
[data-theme="dark"] .cart-line-name { color: var(--mustard); }
.cart-line-unit { font-size: 0.78rem; }
.cart-line-total {
    font-weight: 700; white-space: nowrap;
    font-variant-numeric: tabular-nums; min-width: 6.5rem; text-align: end;
}
.cart-line-del { margin: 0; }
.cart-line .del-btn { background: transparent; border-color: var(--line-strong); }
.cart-line .del-btn:hover { background: var(--danger-soft); border-color: var(--danger); }

/* روی موبایل: نام در یک سطر، کنترل‌ها در سطر دوم */
@media (max-width: 470px) {
    .cart-line {
        grid-template-columns: auto 1fr auto;
        grid-template-areas:
            "info  info  info"
            "qty   total del";
    }
    .cart-line-total { text-align: center; }
}

/* عددها هنگام تغییر تعداد، نرم عوض شوند */
.cl-qty, .cart-line-total, #cart-subtotal { display: inline-block; }
.val-bump { animation: valBump .35s ease; }
@keyframes valBump {
    0%   { transform: scale(1);    color: inherit }
    40%  { transform: scale(1.18); color: var(--lacquer) }
    100% { transform: scale(1);    color: inherit }
}
.cart-line.removing { opacity: 0; transform: translateX(-12px); }
@media (prefers-reduced-motion: reduce) {
    .val-bump { animation: none; }
    .cart-line { transition: none; }
}
.cart-sumline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.9rem;
    margin-top: 0.3rem;
    font-size: 1.15rem;
    color: var(--red-dark);
    font-weight: 700;
}
.cart-sumline strong { white-space: nowrap; }

.qty-form { display: inline-flex; align-items: center; gap: 0.3rem; }
.qty-btn {
    background: var(--mustard);
    border: 1.5px solid var(--gold);
    border-radius: 6px;
    width: 1.8rem;
    height: 1.8rem;
    font-size: 1rem;
    cursor: pointer;
    line-height: 1;
}
.qty-btn:hover { background: var(--mustard-soft); }

.radio-row { display: flex; gap: 0.6rem; flex-wrap: wrap; margin: 0.4rem 0; }
.radio-row label {
    flex: 1;
    min-width: 130px;
    border: 1.5px solid var(--line);
    border-radius: 8px;
    padding: 0.55rem;
    text-align: center;
    cursor: pointer;
    background: var(--field);
    margin: 0;
    font-weight: 500;
}
.radio-row input { display: none; }
.radio-row label:has(input:checked) {
    border-color: var(--red);
    background: var(--mustard-soft);
    color: var(--on-mustard);
    font-weight: 700;
}

/* ---------- پیگیری سفارش ---------- */
.status-line { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.8rem 0; }
.status-step {
    flex: 1;
    min-width: 100px;
    text-align: center;
    padding: 0.45rem 0.3rem;
    border-radius: 8px;
    background: var(--field);
    border: 1.5px dashed var(--line);
    font-size: 0.82rem;
    color: var(--ink-soft);
}
.status-step.done { background: var(--mustard-soft); border-style: solid; border-color: var(--gold); color: var(--on-mustard); font-weight: 700; }
.status-step.current { background: var(--red); border-color: var(--red-dark); color: #FFE9B0; font-weight: 700; }
.badge {
    display: inline-block;
    border-radius: 999px;
    padding: 0.1rem 0.7rem;
    font-size: 0.8rem;
    font-weight: 700;
    background: var(--mustard-soft);
    color: var(--on-mustard);
    border: 1px solid var(--gold);
}
.badge.canceled { background: #FBE9E7; border-color: var(--red); color: var(--red-dark); }
.badge.delivered { background: #EDF6E8; border-color: #4E7A3A; color: #33551F; }

/* ---------- پاورقی ---------- */
.site-footer {
    margin-top: 3rem;
    text-align: center;
    border-top: 3px double var(--gold);
    padding-top: 1rem;
    color: var(--ink-soft);
    font-size: 0.9rem;
}
.footer-ornament { color: var(--gold); font-size: 1.1rem; letter-spacing: 6px; }
.footer-name { font-family: 'Noto Nastaliq Urdu', 'Lalezar', serif; font-size: 1.3rem; line-height: 2; color: var(--red-dark); margin: 0.2rem 0; }

@media (max-width: 640px) {
    .site-header { justify-content: center; text-align: center; }
    .hero h1 { font-size: 2rem; }
}

/* ---------- محبوب‌ها ---------- */
.popular-row {
    display: flex;
    gap: 0.8rem;
    overflow-x: auto;
    padding: 0.2rem 0.2rem 0.8rem;
    scroll-snap-type: x mandatory;
    scroll-padding-inline-start: 0.2rem;
    scrollbar-width: none;
    /* محو شدن ملایم لبه، تا معلوم باشد ردیف کشویی است و کارتِ بریده اتفاقی به نظر نرسد.
       اگر ردیف جا شود، محو روی فضای خالی می‌افتد و دیده نمی‌شود. */
    mask-image: linear-gradient(to left, #000 calc(100% - 2.5rem), transparent 100%);
}
.popular-row::-webkit-scrollbar { display: none; }
.popular-card {
    min-width: 170px;
    max-width: 170px;
    scroll-snap-align: start;
    border-color: var(--red);
    box-shadow: 0 4px 12px rgba(142, 27, 27, 0.18);
}
.popular-card h3 { font-size: 1.05rem; }

.table-chip {
    background: var(--chip-dark);
    color: var(--mustard-soft);
    border-radius: 999px;
    padding: 0.35rem 1rem;
    font-size: 0.85rem;
}

/* ---------- بنر نصب PWA ---------- */
.pwa-banner {
    position: fixed;
    bottom: 0.8rem;
    right: 0.8rem;
    left: 0.8rem;
    max-width: 480px;
    margin-inline: auto;
    background: var(--chip-dark);
    color: var(--chip-on);
    border: 2px solid var(--gold);
    border-radius: 12px;
    padding: 0.7rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    z-index: 60;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.pwa-banner span { flex: 1; font-size: 0.9rem; }
body.has-pwa-banner { padding-bottom: 5rem; }
.pwa-dismiss {
    background: none;
    border: 0;
    color: var(--chip-on);
    font-size: 1rem;
    cursor: pointer;
    opacity: 0.7;
}

/* ---------- پنل مدیریت ---------- */
.admin-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    background: var(--red);
    border: 2px solid var(--red-dark);
    border-radius: 10px;
    padding: 0.6rem 1rem;
    margin: 1rem 0;
}
.admin-top .brand { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--mustard-soft); }
.admin-top .brand-label { font-family: 'Lalezar', cursive; font-size: 1.15rem; }
.admin-top .sign-board { filter: drop-shadow(0 0.25em 0.4em rgba(0, 0, 0, 0.35)); }
.admin-nav { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.admin-nav a, .admin-nav button {
    background: var(--red-dark);
    color: #F5D9A0;
    border: 1px solid rgba(255, 233, 176, 0.35);
    border-radius: 6px;
    padding: 0.25rem 0.8rem;
    font-family: inherit;
    font-size: 0.88rem;
    cursor: pointer;
}
.admin-nav a:hover, .admin-nav button:hover { background: #5A0E0E; color: #fff; }
.admin-nav a.active { background: var(--mustard); color: var(--red-dark); font-weight: 700; }

.stat-grid {
    display: grid;
    /* auto-fit تک‌کاشیِ یتیم در ردیف بعد می‌ساخت؛ با عرض کمینه‌ی کوچک‌تر
       و پرکردن ردیف، کاشی‌ها یکدست می‌مانند */
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.7rem;
    margin: 1rem 0;
}
.stat-tile {
    background: var(--paper);
    border: 2px solid var(--gold);
    border-radius: 10px;
    padding: 0.85rem 0.55rem;
    text-align: center;
    display: flex; flex-direction: column; justify-content: center; gap: 0.15rem;
    transition: transform var(--t-fast) ease, box-shadow var(--t-fast) ease;
}
.stat-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.stat-tile .num {
    font-family: 'Lalezar', cursive;
    /* اندازه با عرض کاشی کم می‌شود تا مبلغ‌های بلند جا شوند */
    font-size: clamp(1.05rem, 1.4vw + 0.6rem, 1.7rem);
    color: var(--red-dark); display: block;
    line-height: 1.3;
    font-variant-numeric: tabular-nums;
}
/* مبلغ: عدد بزرگ، واحد کوچک زیرش — هیچ‌وقت وسط عدد نمی‌شکند */
.stat-tile .num .mv { white-space: nowrap; }
.stat-tile .num .mu {
    display: block; font-family: var(--font-body);
    font-size: 0.62rem; font-weight: 500; color: var(--ink-3);
    line-height: 1.2; margin-top: 0.1rem;
}
[data-theme="dark"] .stat-tile .num { color: var(--mustard); }
.stat-tile .lbl { font-size: 0.8rem; color: var(--ink-soft); line-height: 1.5; }

.filter-tabs { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.8rem 0; }
.filter-tabs a {
    border: 1.5px solid var(--gold);
    background: var(--paper);
    border-radius: 999px;
    padding: 0.2rem 0.9rem;
    font-size: 0.88rem;
}
.filter-tabs a.active { background: var(--red); color: var(--mustard-soft); border-color: var(--red-dark); }

details.order-det { margin: 0.2rem 0; }
details.order-det summary { cursor: pointer; color: var(--red); font-size: 0.85rem; }
.inline-form { display: inline-flex; gap: 0.3rem; align-items: center; }
.inline-form select { width: auto; padding: 0.3rem 0.5rem; font-size: 0.85rem; }
.muted { color: var(--ink-soft); font-size: 0.85rem; }
.danger-btn { background: #FBE9E7 !important; color: var(--red-dark) !important; border-color: var(--red) !important; }
.tbl .num-cell { white-space: nowrap; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 1rem; }

/* ---------- سوییچ روز/شب ---------- */
.theme-toggle {
    cursor: pointer;
    border: 1.5px solid var(--gold);
    background: var(--paper);
    color: var(--ink);
    border-radius: 999px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.9rem;
    box-shadow: 0 2px 0 rgba(58, 42, 30, 0.15);
    transition: background var(--t-fast, 0.15s);
}
.theme-toggle:hover { background: var(--mustard-soft); }
.theme-toggle .dot {
    width: 13px; height: 13px; border-radius: 50%;
    background: var(--mustard);
    box-shadow: inset -3px -3px 0 rgba(0, 0, 0, 0.18);
}
[data-theme="dark"] .theme-toggle .dot { box-shadow: inset 3px -3px 0 rgba(0, 0, 0, 0.4); }
.theme-toggle .lbl::after { content: "شب"; }
[data-theme="dark"] .theme-toggle .lbl::after { content: "روز"; }
/* در پنل مدیریت، دکمه روی نوار قرمز */
.admin-nav .theme-toggle { background: var(--red-dark); color: #F5D9A0; border-color: rgba(255, 233, 176, 0.35); box-shadow: none; }
.admin-nav .theme-toggle:hover { background: #5A0E0E; color: #fff; }

/* ---------- سربرگ ستون‌های قابل مرتب‌سازی ---------- */
.tbl.sortable th { white-space: nowrap; }
.tbl.sortable th a {
    color: var(--red-dark);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    cursor: pointer;
}
.tbl.sortable th a:hover { color: var(--red); text-decoration: underline; }
.tbl.sortable th.sorted a { color: var(--red); font-weight: 700; }
[data-theme="dark"] .tbl.sortable th a { color: var(--gold); }
[data-theme="dark"] .tbl.sortable th.sorted a { color: var(--mustard); }

/* ---------- منوی پروفایل مدیریت (آیکون سیبیل) ---------- */
.profile-menu { position: relative; display: inline-block; }
.profile-btn {
    width: 40px; height: 40px;
    border-radius: 999px;
    border: 2px solid var(--gold);
    background: var(--paper);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 0 rgba(58, 42, 30, 0.15);
}
.profile-btn:hover { background: var(--mustard-soft); }
.profile-pop[hidden] { display: none !important; }  /* چون display:flex قانون پیش‌فرض [hidden] را خنثی می‌کند */
.profile-pop {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;                     /* در RTL، سمت چپِ دکمه */
    min-width: 230px;
    background: var(--surface);
    border: 2px solid var(--gold);
    border-radius: 12px;
    box-shadow: var(--shadow-3, 0 10px 30px rgba(0,0,0,.3));
    padding: 0.4rem;
    z-index: 80;
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: right;
}
.profile-pop-head {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.5rem 0.6rem;
    border-bottom: 1px dashed var(--line);
    margin-bottom: 0.2rem;
}
.profile-pop-head .profile-avatar { font-size: 1.5rem; }
.profile-pop-head strong { display: block; color: var(--ink); }
.profile-pop-head small { font-size: 0.75rem; }
.profile-pop > a,
.profile-pop .pop-item {
    display: flex; align-items: center; gap: 0.4rem;
    width: 100%;
    text-align: right;
    background: none;
    border: 0;
    border-radius: 8px;
    padding: 0.5rem 0.6rem;
    font-family: inherit;
    font-size: 0.92rem;
    color: var(--ink);
    cursor: pointer;
    text-decoration: none;
}
.profile-pop > a:hover,
.profile-pop .pop-item:hover { background: var(--mustard-soft); color: var(--ink); text-decoration: none; }
.profile-pop > a.active { background: var(--mustard-soft); font-weight: 700; }
.profile-pop .pop-logout { color: var(--red-dark); font-weight: 700; }
.profile-pop form { margin: 0; }
.profile-pop .theme-toggle.pop-item { border: 0; box-shadow: none; justify-content: flex-start; }
.profile-pop .theme-toggle.pop-item .lbl::before { content: "حالت "; }
.profile-pop-foot {
    border-top: 1px dashed var(--line);
    margin-top: 0.3rem;
    padding: 0.5rem 0.6rem 0.2rem;
    font-size: 0.72rem;
    color: var(--ink-soft);
    text-align: center;
    line-height: 1.9;
}

/* ============================================================
   پیگیری سفارش — تایم‌لاین و انیمیشن‌های مراحل
   ============================================================ */
/* روی دسکتاپ/تبلت، ستون پیگیری باریک می‌ماند تا خوانا و جمع‌وجور باشد */
.track-wrap { max-width: 620px; margin-inline: auto; }

.track-hero {
    position: relative;
    overflow: hidden;
    text-align: center;
    border-radius: var(--radius-lg, 14px);
    padding: 2rem 1.2rem 1.6rem;
    background:
        radial-gradient(circle at 50% -20%, rgba(232,169,60,0.28), transparent 60%),
        linear-gradient(160deg, var(--surface), var(--surface-2));
    border: 2px solid var(--gold);
    box-shadow: var(--shadow-2, 0 6px 18px rgba(0,0,0,.15));
    margin-bottom: 1rem;
}
.track-hero .stage-icon {
    font-size: 3.4rem;
    line-height: 1;
    display: inline-block;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,.2));
}
.track-hero h3 { margin: 0.6rem 0 0.2rem; font-size: 1.5rem; color: var(--red-dark); }
[data-theme="dark"] .track-hero h3 { color: var(--gold); }
.track-hero .stage-msg { margin: 0; color: var(--ink-soft); font-size: 0.95rem; }
.track-hero .stage-elapsed { margin: 0.5rem 0 0; font-size: 0.8rem; color: var(--ink-3, var(--ink-soft)); }

/* هاله‌ی نبض پشت آیکون */
.stage-glow::before {
    content: '';
    position: absolute;
    top: 1.4rem; left: 50%;
    width: 120px; height: 120px;
    transform: translateX(-50%);
    background: radial-gradient(circle, rgba(232,169,60,0.35), transparent 70%);
    border-radius: 50%;
    animation: glowPulse 2.4s ease-in-out infinite;
    z-index: 0;
}
.track-hero > * { position: relative; z-index: 1; }
@keyframes glowPulse { 0%,100%{opacity:.5;transform:translateX(-50%) scale(.85)} 50%{opacity:1;transform:translateX(-50%) scale(1.15)} }

/* انیمیشن‌های هر مرحله */
.anim-wait   { animation: waitFlip 2.2s ease-in-out infinite; }
@keyframes waitFlip { 0%,55%{transform:rotate(0)} 70%{transform:rotate(180deg)} 100%{transform:rotate(180deg)} }

.anim-confirmed { animation: pop 0.6s cubic-bezier(.2,1.4,.5,1) both, floaty 3s ease-in-out 0.6s infinite; }
@keyframes pop { 0%{transform:scale(0);opacity:0} 60%{transform:scale(1.25)} 100%{transform:scale(1);opacity:1} }
@keyframes floaty { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-6px)} }

.anim-cooking { animation: sizzle 0.5s ease-in-out infinite alternate; }
@keyframes sizzle { from{transform:rotate(-6deg)} to{transform:rotate(6deg)} }

.anim-ready  { animation: ring 1.2s ease-in-out infinite; transform-origin: 50% 10%; }
@keyframes ring { 0%,60%,100%{transform:rotate(0)} 70%{transform:rotate(14deg)} 80%{transform:rotate(-12deg)} 90%{transform:rotate(8deg)} }

.anim-delivery { animation: ride 2.4s linear infinite; }
@keyframes ride { 0%{transform:translateX(60px) scaleX(-1)} 100%{transform:translateX(-70px) scaleX(-1)} }

.anim-served { animation: floaty 2.6s ease-in-out infinite; }
.anim-pay    { animation: floaty 2.2s ease-in-out infinite; }
.anim-cancel { animation: shakeX 0.8s ease-in-out; opacity:.85; }
@keyframes shakeX { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-8px)} 40%{transform:translateX(8px)} 60%{transform:translateX(-5px)} 80%{transform:translateX(5px)} }

/* بخار متحرک (برای مرحله آماده‌سازی) */
.steam { position: absolute; top: 0.9rem; left: 50%; transform: translateX(-50%); width: 60px; height: 46px; pointer-events: none; z-index: 2; }
.steam span {
    position: absolute; bottom: 0; width: 8px; height: 8px; border-radius: 50%;
    background: rgba(255,255,255,0.55);
    filter: blur(1px);
    animation: rise 2.2s ease-in infinite;
}
[data-theme="dark"] .steam span { background: rgba(255,240,210,0.4); }
.steam span:nth-child(1){ left: 16px; animation-delay: 0s; }
.steam span:nth-child(2){ left: 28px; animation-delay: 0.5s; }
.steam span:nth-child(3){ left: 40px; animation-delay: 1s; }
@keyframes rise { 0%{opacity:0;transform:translateY(0) scale(.7)} 20%{opacity:.9} 100%{opacity:0;transform:translateY(-40px) scale(1.6)} }

/* تایم‌لاین عمودی مراحل */
.track-steps { list-style: none; margin: 0.4rem 0 0; padding: 0; }
.track-steps li {
    position: relative;
    padding: 0 46px 1.3rem 0;
    min-height: 30px;
}
.track-steps li::before {  /* خط اتصال */
    content: ''; position: absolute; right: 16px; top: 26px; bottom: -4px; width: 3px;
    background: var(--line-strong, var(--line));
    border-radius: 3px;
}
.track-steps li:last-child::before { display: none; }
.track-steps li .node {
    position: absolute; right: 4px; top: 2px;
    width: 28px; height: 28px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.9rem;
    background: var(--surface); border: 2.5px solid var(--line-strong, var(--line));
    color: var(--ink-3, var(--ink-soft));
    transition: all .3s;
}
.track-steps li .t-title { font-weight: 700; color: var(--ink-soft); }
.track-steps li .t-sub { font-size: 0.78rem; color: var(--ink-3, var(--ink-soft)); }

.track-steps li.done::before { background: var(--success); }
.track-steps li.done .node { background: var(--success); border-color: var(--success); color: #fff; }
.track-steps li.done .t-title { color: var(--ink); }

.track-steps li.current .node {
    background: var(--mustard); border-color: var(--gold); color: var(--on-mustard, #3A2A1E);
    box-shadow: 0 0 0 6px var(--gold-soft);
    animation: nodePulse 1.6s ease-in-out infinite;
}
.track-steps li.current .t-title { color: var(--red-dark); }
[data-theme="dark"] .track-steps li.current .t-title { color: var(--gold); }
@keyframes nodePulse { 0%,100%{box-shadow:0 0 0 4px var(--gold-soft)} 50%{box-shadow:0 0 0 9px transparent} }

/* نوار پیشرفت افقی کوچک */
.track-progress { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin: 0.3rem 0 1rem; border: 1px solid var(--line); }
.track-progress > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--mustard), var(--gold)); transition: width 0.8s cubic-bezier(.4,0,.2,1); }

@media (prefers-reduced-motion: reduce) {
    .anim-wait,.anim-confirmed,.anim-cooking,.anim-ready,.anim-delivery,.anim-served,.anim-pay,.anim-cancel,
    .stage-glow::before,.steam span,.track-steps li.current .node { animation: none !important; }
}

/* ---------- کلاس‌های کمکی ---------- */
.btn-block { width: 100%; display: block; }
.row { display: flex; gap: 0.6rem; align-items: center; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.table-wrap { overflow-x: auto; }

/* ============================================================
   تعامل‌های سمت کاربر: toast، افزودن، انیمیشن ورود، نوار پایین موبایل
   ============================================================ */
.toast-wrap {
    position: fixed; z-index: 200;
    bottom: 1rem; left: 50%; transform: translateX(-50%);
    display: flex; flex-direction: column; gap: 0.5rem; align-items: center;
    pointer-events: none; width: max-content; max-width: 92vw;
}
.toast {
    background: var(--chip-dark); color: var(--chip-on);
    border: 1.5px solid var(--gold);
    border-radius: 999px;
    padding: 0.55rem 1.3rem;
    font-size: 0.9rem; font-weight: 600;
    box-shadow: var(--shadow-3, 0 10px 30px rgba(0,0,0,.35));
    opacity: 0; transform: translateY(16px) scale(.9);
    transition: all .35s cubic-bezier(.2,1.3,.5,1);
}
.toast.show { opacity: 1; transform: translateY(0) scale(1); }
.toast-error { border-color: var(--danger); background: #4A2018; }

/* badge سبد — انیمیشن پرش */
.cart-badge.bump { animation: badgeBump .5s cubic-bezier(.2,1.5,.4,1); }
@keyframes badgeBump { 0%{transform:scale(1)} 35%{transform:scale(1.6)} 100%{transform:scale(1)} }

/* دکمه افزودن — حالت لودینگ و موفق */
.btn.loading { opacity: .7; pointer-events: none; }
.btn.added { background: var(--success) !important; border-color: var(--success) !important; box-shadow: 0 3px 0 #3a5a30 !important; }
.btn.added::after { content: ' ✓'; }

/* برجستگی کوتاه کارت هنگام افزودن */
.menu-card.flash-add { animation: cardFlash .7s ease; }
@keyframes cardFlash { 0%{box-shadow:0 0 0 0 var(--gold)} 30%{box-shadow:0 0 0 4px var(--gold-soft)} 100%{box-shadow:0 3px 8px rgba(58,42,30,.1)} }

/* انیمیشن ورود عناصر — فقط وقتی JS فعال است مخفی می‌شوند (بدون JS همیشه دیده می‌شوند) */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .5s ease, transform .5s cubic-bezier(.2,.7,.3,1); }
.js .reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .js .reveal { opacity: 1 !important; transform: none !important; transition: none; } }

/* تب دسته‌ها — چسبان و فعال */
.cat-nav {
    position: sticky; top: 0; z-index: 30;
    padding: 0.6rem 0.2rem;
    margin-inline: -0.2rem;
    background: color-mix(in oklab, var(--cream), transparent 8%);
    backdrop-filter: blur(6px);
    overflow-x: auto; scrollbar-width: none;
}
.cat-nav::-webkit-scrollbar { display: none; }
.cat-nav a { transition: transform .15s, background .15s; }
.cat-nav a.active { background: var(--mustard); color: var(--on-mustard); border-color: var(--gold); transform: translateY(-1px); box-shadow: 0 3px 0 var(--gold); }

/* افکت فشردن دکمه افزودن در کارت منو */
.menu-card .btn:active { transform: translateY(2px) scale(.97); }

/* ---------- نوار پایین موبایل (حس اپ) ---------- */
.mobile-nav { display: none; }
@media (max-width: 720px) {
    .mobile-nav {
        display: flex;
        position: fixed; bottom: 0; right: 0; left: 0; z-index: 90;
        background: var(--surface);
        border-top: 2px solid var(--gold);
        box-shadow: 0 -6px 18px rgba(0,0,0,.12);
        padding-bottom: env(safe-area-inset-bottom, 0);
    }
    .mobile-nav a {
        flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
        padding: 0.4rem 0.2rem 0.5rem;
        font-size: 0.68rem; color: var(--ink-soft); text-decoration: none;
        position: relative;
    }
    .mobile-nav a .mi { font-size: 1.25rem; line-height: 1; }
    .mobile-nav a.active { color: var(--red); }
    [data-theme="dark"] .mobile-nav a.active { color: var(--gold); }
    .mobile-nav .mn-badge {
        position: absolute; top: 2px; right: calc(50% - 20px);
        background: var(--red); color: #fff; border-radius: 999px;
        font-size: 0.6rem; min-width: 1.3em; text-align: center; padding: 0 0.25em;
    }
    body { padding-bottom: 4.2rem; }         /* جا برای نوار پایین */
    body.has-pwa-banner { padding-bottom: 8.5rem; }
    .site-header .main-nav { display: none; } /* در موبایل، ناوبری در نوار پایین است */
}

/* ============================================================
   صفحه آشپزخانه — کارت‌های بزرگ و قابل لمس روی تبلت/مانیتور
   ============================================================ */
.kitchen-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 0.9rem;
    align-items: start;
}

.kit-card {
    background: var(--surface);
    border: 2px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 0.85rem 0.95rem 0.75rem;
    box-shadow: var(--shadow-1);
    border-inline-start-width: 7px;
    transition: box-shadow .2s ease, transform .2s ease;
}
.kit-card:hover { box-shadow: var(--shadow-2); }

/* رنگ لبه بر اساس اینکه سفارش چقدر منتظر مانده */
.kit-card.fresh { border-inline-start-color: var(--success); }
.kit-card.warn  { border-inline-start-color: var(--mustard); }
.kit-card.late  { border-inline-start-color: var(--red); }

.kit-head {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 0.5rem; margin-bottom: 0.15rem;
}
.kit-code { font-weight: 700; font-size: 1.15rem; letter-spacing: 0.5px; }
.kit-time {
    font-size: 0.95rem; font-weight: 700; font-variant-numeric: tabular-nums;
    padding: 0.1rem 0.5rem; border-radius: 999px;
    background: var(--surface-2); color: var(--ink-2);
}
.kit-card.warn .kit-time { background: var(--warn-soft); color: var(--warn); }
.kit-card.late .kit-time { background: var(--danger-soft); color: var(--danger); }

.kit-where { font-size: 0.88rem; color: var(--ink-soft); margin-bottom: 0.5rem; }

.kit-items { list-style: none; margin: 0 0 0.5rem; padding: 0; }
.kit-items li {
    padding: 0.3rem 0; font-size: 1.02rem; line-height: 1.5;
    border-bottom: 1px dashed var(--line);
}
.kit-items li:last-child { border-bottom: 0; }
.kit-items b { color: var(--lacquer); margin-inline-end: 0.15rem; }

.kit-note {
    margin: 0 0 0.5rem; font-size: 0.85rem; line-height: 1.6;
    background: var(--surface-2); border-radius: 8px; padding: 0.35rem 0.55rem;
}
.kit-note.kit-warn { background: var(--danger-soft); color: var(--danger); font-weight: 600; }

.kit-actions {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem;
    padding-top: 0.55rem; border-top: 1px solid var(--line);
}
/* دکمه مرحله بعد باید بزرگ و پرکننده باشد — فرمِ دربرگیرنده هم باید کش بیاید،
   چون آیتمِ فلکس فرم است نه خودِ دکمه */
.kit-actions .kit-go-form { flex: 1 1 100%; display: flex; }
.kit-actions .btn.kit-go { flex: 1; padding: 0.6rem 0.7rem; font-size: 0.98rem; }
.kit-actions .badge { order: -1; }

/* روی صفحه‌های کوچک، یک ستون */
@media (max-width: 520px) {
    .kitchen-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   نوار منو: تب دسته‌ها + جستجوی زنده
   ============================================================ */
.menu-bar {
    position: sticky; top: 0; z-index: 30;
    padding: 0.5rem 0.2rem 0.55rem;
    margin-inline: -0.2rem;
    background: color-mix(in oklab, var(--cream), transparent 6%);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid transparent;
    transition: border-color .2s;
}
.menu-bar .cat-nav {
    position: static; padding: 0 0 0.4rem; margin: 0;
    background: none; backdrop-filter: none;
}

.menu-search { position: relative; }
.menu-search input[type="search"] {
    width: 100%; margin: 0;
    padding: 0.55rem 2.3rem 0.55rem 0.9rem;
    font-family: inherit; font-size: 0.95rem;
    color: var(--ink);
    background: var(--field);
    border: 1.5px solid var(--line-strong);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-1);
    transition: border-color .18s, box-shadow .18s;
    /* آیکن ذره‌بین به‌صورت SVG درون‌خط تا وابستگی بیرونی نداشته باشد */
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239A876C' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
    background-size: 1.05rem;
}
.menu-search input[type="search"]::-webkit-search-cancel-button { display: none; }
.menu-search input[type="search"]:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px var(--gold-soft);
}
.menu-search input[type="search"]::placeholder { color: var(--ink-3); }

.menu-search .ms-clear {
    position: absolute; inset-inline-start: 0.45rem; top: 50%; transform: translateY(-50%);
    width: 1.6rem; height: 1.6rem; padding: 0; line-height: 1;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.15rem; font-family: inherit;
    color: var(--ink-2); background: var(--surface-2);
    border: 0; border-radius: 50%; cursor: pointer;
}
.menu-search .ms-clear:hover { color: var(--lacquer); }

.menu-empty {
    text-align: center; color: var(--ink-2);
    padding: 2rem 1rem; margin: 0;
}

/* ستاره محبوب کنار نام غذا */
.pop-star { font-size: 0.8em; vertical-align: 0.15em; }

/* عناصری که فقط با جاوااسکریپت معنا دارند، بدون JS دیده نشوند */
.js-only { display: none; }
.js .js-only { display: block; }

/* ============================================================
   کارت سفارش در پنل — چیدمان ثابت (قبلاً هر کارت جور دیگری می‌افتاد)
   ============================================================ */
.orders-bar {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: 0.6rem; margin-bottom: 0.8rem;
}
.orders-bar .filter-tabs { margin: 0; flex: 1 1 auto; }
.orders-search { display: flex; gap: 0.35rem; align-items: center; flex: 0 1 auto; }
.orders-search input[type="search"] {
    margin: 0; width: 15rem; max-width: 100%;
    padding: 0.42rem 0.7rem; font-family: inherit; font-size: 0.88rem;
    color: var(--ink); background: var(--field);
    border: 1.5px solid var(--line-strong); border-radius: var(--radius-pill);
}
.orders-search input[type="search"]:focus {
    outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft);
}

.order-card { padding: 0.85rem 1rem; }

.oc-top {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 0.8rem; flex-wrap: wrap;
}
.oc-main { min-width: 0; flex: 1 1 16rem; }
.oc-line { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.oc-code { font-size: 1.05rem; letter-spacing: 0.5px; }
.oc-meta {
    margin-top: 0.25rem; font-size: 0.86rem; color: var(--ink-2);
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem;
}
.oc-meta a { color: var(--ink-2); }
.oc-meta a:hover { color: var(--lacquer); }
.oc-meta .sep { color: var(--ink-3); }

.oc-amount {
    font-weight: 700; font-size: 1.08rem; white-space: nowrap;
    font-variant-numeric: tabular-nums; color: var(--lacquer);
    flex: 0 0 auto;
}
[data-theme="dark"] .oc-amount { color: var(--mustard); }

.oc-actions {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem;
    margin-top: 0.7rem; padding-top: 0.65rem; border-top: 1px solid var(--line);
}
.oc-actions .oc-status { margin-inline-end: auto; }
.oc-actions .oc-status select { margin: 0; min-width: 9.5rem; }

/* ابزارهای کم‌کاربرد (چاپ) کوچک و کنار هم، تا کارت شلوغ نشود */
.oc-tools { display: flex; gap: 0.25rem; align-items: center; }
.oc-tools .icon-btn {
    padding: 0.32rem 0.5rem; font-size: 0.95rem; line-height: 1.2;
    min-width: 2rem; text-align: center;
}

@media (max-width: 560px) {
    .oc-amount { flex-basis: 100%; text-align: start; }
    .oc-actions .oc-status { flex: 1 1 100%; margin-inline-end: 0; }
    .oc-actions .oc-status select { flex: 1; }
    .orders-search { flex: 1 1 100%; }
    .orders-search input[type="search"] { flex: 1; width: auto; }
}

/* ============================================================
   داشبورد: خوشامد، نمودار ۱۴ روز، پرفروش‌های امروز
   ============================================================ */
.dash-hello {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: 0.7rem;
    background: var(--paper);
    border: 2px solid var(--gold);
    border-radius: var(--radius-lg);
    padding: 0.85rem 1rem;
    margin: 1rem 0;
}
.dash-quick { display: flex; flex-wrap: wrap; gap: 0.35rem; }

.dash-note {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem;
    border-color: var(--mustard);
    background: var(--warn-soft);
}

/* کاشی‌های قابل کلیک مثل بقیه رفتار می‌کنند ولی لینک هستند */
a.stat-tile { text-decoration: none; color: inherit; }
a.stat-tile:hover { border-color: var(--lacquer); }
.stat-tile.alert { border-color: var(--lacquer); background: var(--danger-soft); }
.stat-tile.alert .num { color: var(--danger); }

.delta {
    display: inline-block; font-size: 0.7rem; font-weight: 700;
    padding: 0 0.35em; border-radius: var(--radius-pill); vertical-align: 0.1em;
}
.delta.up   { background: var(--success-soft); color: var(--success); }
.delta.down { background: var(--danger-soft);  color: var(--danger); }
.delta.flat { background: var(--surface-2);    color: var(--ink-3); }

/* ---- نمودار میله‌ای، تماماً CSS (بدون کتابخانه بیرونی) ---- */
.chart {
    display: flex; align-items: flex-end; gap: 0.3rem;
    height: 150px; margin-top: 0.7rem;
    padding-bottom: 1.3rem;   /* جا برای برچسب روز */
    position: relative;
}
.chart::before {  /* خط کف */
    content: ''; position: absolute; inset-inline: 0; bottom: 1.3rem;
    height: 1px; background: var(--line);
}
.chart-col {
    flex: 1; height: 100%; position: relative;
    display: flex; align-items: flex-end; justify-content: center;
}
.chart-bar {
    width: 100%; max-width: 2.6rem;
    height: var(--h);
    background: linear-gradient(180deg, var(--mustard), var(--gold));
    border-radius: 5px 5px 0 0;
    position: relative;
    transform-origin: bottom;
    animation: barGrow .55s cubic-bezier(.2,.8,.3,1) backwards;
    transition: filter var(--t-fast) ease;
}
/* ستون‌ها یکی‌یکی بالا می‌آیند */
.chart-col:nth-child(1)  .chart-bar { animation-delay: .02s }
.chart-col:nth-child(2)  .chart-bar { animation-delay: .05s }
.chart-col:nth-child(3)  .chart-bar { animation-delay: .08s }
.chart-col:nth-child(4)  .chart-bar { animation-delay: .11s }
.chart-col:nth-child(5)  .chart-bar { animation-delay: .14s }
.chart-col:nth-child(6)  .chart-bar { animation-delay: .17s }
.chart-col:nth-child(7)  .chart-bar { animation-delay: .20s }
.chart-col:nth-child(8)  .chart-bar { animation-delay: .23s }
.chart-col:nth-child(9)  .chart-bar { animation-delay: .26s }
.chart-col:nth-child(10) .chart-bar { animation-delay: .29s }
.chart-col:nth-child(11) .chart-bar { animation-delay: .32s }
.chart-col:nth-child(12) .chart-bar { animation-delay: .35s }
.chart-col:nth-child(13) .chart-bar { animation-delay: .38s }
.chart-col:nth-child(14) .chart-bar { animation-delay: .41s }

.chart-col.is-today .chart-bar {
    background: linear-gradient(180deg, var(--lacquer-2), var(--lacquer));
    box-shadow: 0 0 0 2px var(--gold-soft);
}
.chart-col:hover .chart-bar { filter: brightness(1.08); }

.chart-val {
    position: absolute; top: -1.15rem; inset-inline: 0;
    text-align: center; font-size: 0.65rem; color: var(--ink-2);
    font-variant-numeric: tabular-nums; white-space: nowrap;
}
.chart-x {
    position: absolute; bottom: -1.25rem; inset-inline: 0;
    text-align: center; font-size: 0.68rem; color: var(--ink-3);
}
.chart-col.is-today .chart-x { color: var(--lacquer); font-weight: 700; }

@keyframes barGrow { from { transform: scaleY(0); opacity: .3 } to { transform: scaleY(1); opacity: 1 } }

/* پرفروش‌های امروز */
.today-top { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tt-chip {
    background: var(--surface-2); border: 1px solid var(--line);
    border-radius: var(--radius-pill); padding: 0.25rem 0.75rem; font-size: 0.88rem;
}
.tt-chip b { color: var(--lacquer); }
[data-theme="dark"] .tt-chip b { color: var(--mustard); }

@media (max-width: 560px) {
    .chart { height: 120px; }
    .chart-val { display: none; }        /* روی موبایل عددها شلوغ می‌کنند */
    .dash-hello { flex-direction: column; align-items: stretch; }
}
@media (prefers-reduced-motion: reduce) {
    .chart-bar { animation: none; }
    .stat-tile:hover { transform: none; }
}

/* کاشی سود/زیان — رنگ از توکن تم می‌آید، نه هگز ثابت (در تم شب هم خوانا بماند) */
.stat-tile.good .num { color: var(--success); }
.stat-tile.bad  .num { color: var(--danger); }

/* ============================================================
   جان دادن به سمت مشتری — حرکت‌های ریز و راحتی پیمایش
   ============================================================ */

/* جا برای نوار چسبانِ دسته‌ها هنگام پرش به عنوان دسته.
   scroll-behavior: smooth عمداً روی html گذاشته نمی‌شود: هر پیمایش برنامه‌ای
   (حتی بازگردانی خودکار مرورگر) را انیمیت می‌کرد و با اسکرول دستِ کاربر می‌جنگید.
   نرم بودن، جایی که لازم است، از داخل جاوااسکریپت خواسته می‌شود. */
h2[id^="cat-"] { scroll-margin-top: 6.5rem; }

/* کارت منو: بلند شدن ملایم و بزرگ‌نمایی خیلی کم عکس */
.menu-card {
    transition: transform var(--t-med) cubic-bezier(.2,.7,.3,1),
                box-shadow var(--t-med) ease,
                border-color var(--t-fast) ease;
}
@media (hover: hover) {
    .menu-card:hover {
        transform: translateY(-4px);
        box-shadow: var(--shadow-3);
        border-color: var(--lacquer);
    }
    .menu-card:hover .menu-card-img img { transform: scale(1.06); }
}
.menu-card-img img { transition: transform .5s cubic-bezier(.2,.7,.3,1); }

/* عنوان دسته: خط تزئینی کنارش کمی نفس بکشد */
.section-title { transition: color var(--t-fast) ease; }

/* دکمه بازگشت به بالا — روی منوی بلند خیلی به کار می‌آید */
.to-top {
    position: fixed;
    inset-inline-end: 1rem;
    bottom: 1rem;
    z-index: 40;
    width: 2.7rem; height: 2.7rem;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.15rem; line-height: 1;
    color: var(--on-lacquer); background: var(--lacquer);
    border: 2px solid var(--gold); border-radius: 50%;
    box-shadow: var(--shadow-2); cursor: pointer;
    opacity: 0; visibility: hidden; transform: translateY(10px) scale(.9);
    transition: opacity var(--t-med) ease, transform var(--t-med) ease, visibility var(--t-med);
}
.to-top.show { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { background: var(--lacquer-2); }
@media (max-width: 720px) {
    /* بالای نوار پایینِ موبایل بنشیند */
    .to-top { bottom: 4.6rem; }
    body.has-pwa-banner .to-top { bottom: 9rem; }
}
@media (prefers-reduced-motion: reduce) { .to-top { transition: none; } }

/* ورودی‌ها هنگام فوکوس، حلقه‌ی طلایی بگیرند (یکدست در کل سایت) */
input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px var(--gold-soft);
}
/* دسترسی با کیبورد: مسیر فوکوس روی دکمه‌ها و لینک‌ها دیده شود */
a:focus-visible, button:focus-visible, .btn:focus-visible {
    outline: 2.5px solid var(--gold);
    outline-offset: 2px;
}

/* اکشن‌های ردیف سفارش در «حساب من» — روی موبایل زیر هم و بدون بهم‌ریختگی */
.acc-actions { display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; }
.acc-actions form { margin: 0; }

/* ورودی فایل با ظاهر فارسی (متن دکمه‌ی بومی مرورگر قابل تغییر نیست) */
.file-field {
    display: inline-flex; align-items: center; gap: 0.5rem;
    max-width: 100%; cursor: pointer; margin: 0.2rem 0;
}
.file-field input[type="file"] {
    position: absolute; width: 1px; height: 1px;
    opacity: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.file-field .ff-btn {
    flex: 0 0 auto;
    background: var(--mustard); color: var(--on-mustard);
    border: 1.5px solid var(--gold); border-radius: var(--radius-pill);
    padding: 0.35rem 0.9rem; font-size: 0.88rem; white-space: nowrap;
    transition: filter var(--t-fast) ease, transform var(--t-fast) ease;
}
.file-field:hover .ff-btn { filter: brightness(1.05); }
.file-field:active .ff-btn { transform: translateY(1px); }
.file-field input[type="file"]:focus-visible + .ff-btn {
    outline: 2.5px solid var(--gold); outline-offset: 2px;
}
.file-field .ff-name {
    font-size: 0.82rem; color: var(--ink-3);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.file-field.has-file .ff-name { color: var(--success); font-weight: 600; }

/* ============================================================
   محافظ سرریز افقی — هیچ صفحه‌ای نباید افقی اسکرول شود
   ============================================================ */
/* overflow-x: hidden روی html یک ظرفِ اسکرول تازه می‌سازد و روی موبایل باعث
   می‌شود اسکرول وسط کار به بالای صفحه برگردد. clip همان جلوگیری از سرریز را
   می‌دهد بدون ساختن ظرف اسکرول — و فقط روی body، نه html. */
body { max-width: 100%; overflow-x: clip; }

/* جدول‌های عریض داخل قاب خودشان اسکرول شوند، نه اینکه صفحه را بکشند */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}
.table-wrap table.tbl { min-width: max-content; }

/* هیچ عکس/ویدیویی از قاب بیرون نزند */
img, video, canvas, svg, iframe { max-width: 100%; }

/* کد و آدرس‌های بلند بشکنند تا کارت را پهن نکنند */
code, .oc-meta a { word-break: break-word; overflow-wrap: anywhere; }

/* ============================================================
   گزارش پایان روز — روی صفحه و روی کاغذ
   ============================================================ */
.day-report { margin-top: 0.5rem; }
.dr-head {
    display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
    gap: 0.5rem; padding-bottom: 0.5rem; margin-bottom: 0.3rem;
    border-bottom: 2px solid var(--gold);
}
.dr-head strong { font-family: 'Lalezar', cursive; font-size: 1.25rem; color: var(--lacquer); }
[data-theme="dark"] .dr-head strong { color: var(--mustard); }
.dr-head span { color: var(--ink-2); font-size: 0.9rem; }

.dr-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.dr-box {
    background: var(--paper); border: 2px solid var(--gold);
    border-radius: var(--radius-lg); padding: 0.9rem 1.1rem; margin: 1rem 0;
}
.dr-cols .dr-box { margin: 0; }
.dr-box h4 { margin: 0 0 0.4rem; font-family: 'Lalezar', cursive; font-size: 1.05rem; color: var(--red-dark); }
[data-theme="dark"] .dr-box h4 { color: var(--mustard); }
.dr-warn { color: var(--danger); font-weight: 600; }

.dr-sign {
    display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem;
    margin-top: 1.6rem; padding-top: 0.8rem;
    border-top: 1px dashed var(--line); color: var(--ink-2); font-size: 0.88rem;
}

/* روی کاغذ: فقط خود گزارش، بدون منو و دکمه و رنگ زمینه */
@media print {
    .admin-top, .site-header, .site-footer, .no-print,
    .mobile-nav, .pwa-banner, .to-top, .toast-wrap { display: none !important; }
    body { background: #fff !important; color: #000 !important; }
    .site-frame { max-width: none; padding: 0; }
    .dr-box, .stat-tile, .card { border-color: #999 !important; box-shadow: none !important; background: #fff !important; }
    .stat-tile .num, .dr-head strong, .dr-box h4 { color: #000 !important; }
    .dr-cols { grid-template-columns: 1fr 1fr; }
    a[href]::after { content: none !important; }
    @page { margin: 12mm; }
}
