/* دفتر کلاس — شیوه‌نامهٔ مشترک تمام صفحات */

/* ============ TOKENS ============ */
:root{
  --brand:#16233F; --brand-2:#1E2F52; --brand-contrast:#F6F7FA;
  --accent:#B9852B; --accent-contrast:#1B1300; --accent-soft:#EFDDB2;
  --bg:#F1F2F6; --surface:#FFFFFF; --surface-2:#E9EBF1; --border:#DBDEE7;
  --text:#182238; --text-muted:#5B6478;
  --fixed:#256B49; --fixed-bg:#E1F1E9;
  --variable:#93641C; --variable-bg:#F5EAD3;
  --danger:#A5332F; --danger-bg:#F7E1DF;
  --focus-ring:#2E5FD9;
  --shadow-1:0 1px 2px rgba(22,35,63,.06), 0 1px 1px rgba(22,35,63,.04);
  --shadow-2:0 10px 30px -14px rgba(22,35,63,.35);
  --radius-sm:7px; --radius-md:12px; --radius-lg:18px;
  --font:'Vazirmatn','Segoe UI',Tahoma,sans-serif;
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --brand:#1B2A4C; --brand-2:#24345C; --brand-contrast:#EEF1F8;
    --accent:#D9AD5C; --accent-contrast:#201603; --accent-soft:#4A3A17;
    --bg:#0E1526; --surface:#151F38; --surface-2:#1B2745; --border:#2A3556;
    --text:#E7E9F4; --text-muted:#98A2C0;
    --fixed:#59B98A; --fixed-bg:#153426;
    --variable:#D8AC5B; --variable-bg:#3B2E13;
    --danger:#E27E79; --danger-bg:#3C1B1A;
    --focus-ring:#88A4FF;
    --shadow-1:0 1px 2px rgba(0,0,0,.4);
    --shadow-2:0 14px 34px -14px rgba(0,0,0,.65);
  }
}
:root[data-theme="dark"]{
  --brand:#1B2A4C; --brand-2:#24345C; --brand-contrast:#EEF1F8;
  --accent:#D9AD5C; --accent-contrast:#201603; --accent-soft:#4A3A17;
  --bg:#0E1526; --surface:#151F38; --surface-2:#1B2745; --border:#2A3556;
  --text:#E7E9F4; --text-muted:#98A2C0;
  --fixed:#59B98A; --fixed-bg:#153426;
  --variable:#D8AC5B; --variable-bg:#3B2E13;
  --danger:#E27E79; --danger-bg:#3C1B1A;
  --focus-ring:#88A4FF;
  --shadow-1:0 1px 2px rgba(0,0,0,.4);
  --shadow-2:0 14px 34px -14px rgba(0,0,0,.65);
}

/* ============ RESET / BASE ============ */
*,*::before,*::after{box-sizing:border-box}
html{background:var(--bg)}
body{
  margin:0; background:var(--bg); color:var(--text); font-family:var(--font);
  direction:rtl; line-height:1.65; font-size:16px; -webkit-font-smoothing:antialiased;
  min-height:100dvh; display:flex; flex-direction:column;
}
img{max-width:100%}
h1,h2,h3,h4{font-family:var(--font); font-weight:800; text-wrap:balance; margin:0; color:var(--text)}
p{margin:0}
a{color:inherit}
button,input,textarea,select{font-family:var(--font); font-size:1rem; color:inherit}
[hidden]{display:none !important}
:focus-visible{outline:2.5px solid var(--focus-ring); outline-offset:2px; border-radius:4px}
.skip-link{position:absolute; right:-999px; top:0; background:var(--accent); color:var(--accent-contrast); padding:10px 16px; border-radius:0 0 0 10px; z-index:200; font-weight:700}
.skip-link:focus{right:0}
@media (prefers-reduced-motion: reduce){
  *,*::before,*::after{animation-duration:.001ms !important; animation-iteration-count:1 !important; transition-duration:.001ms !important; scroll-behavior:auto !important}
}
::selection{background:var(--accent-soft); color:var(--accent-contrast)}

#app{max-width:1180px; width:100%; margin:0 auto; padding-inline:20px; flex:1; display:flex; flex-direction:column}

/* ============ TOPBAR ============ */
.topbar{display:flex; align-items:center; justify-content:space-between; gap:16px; padding-block:16px; flex-wrap:wrap}
.brand{display:flex; align-items:center; gap:10px; font-weight:800; font-size:1.15rem; letter-spacing:.2px; cursor:pointer; background:none; border:none; padding:0; color:var(--text); text-decoration:none}
.crest{width:38px; height:38px; border-radius:10px; background:var(--brand); color:var(--accent); display:flex; align-items:center; justify-content:center; flex:none; box-shadow:var(--shadow-1)}
.nav{display:flex; align-items:center; gap:8px; flex-wrap:wrap}
.demo-pill{font-size:.72rem; font-weight:700; color:var(--text-muted); background:var(--surface-2); border:1px solid var(--border); padding:3px 10px; border-radius:999px; letter-spacing:.3px}

/* ============ BUTTONS ============ */
.btn{display:inline-flex; align-items:center; gap:8px; justify-content:center; padding:10px 18px; border-radius:var(--radius-sm); border:1px solid transparent; font-weight:700; font-size:.92rem; cursor:pointer; transition:transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease; line-height:1; min-height:44px; text-decoration:none}
.btn:active{transform:scale(.97)}
.btn-primary{background:var(--brand); color:var(--brand-contrast)}
.btn-primary:hover{box-shadow:var(--shadow-2)}
.btn-accent{background:var(--accent); color:var(--accent-contrast)}
.btn-accent:hover{box-shadow:var(--shadow-2)}
.btn-ghost{background:transparent; color:var(--text); border-color:var(--border)}
.btn-ghost:hover{background:var(--surface-2)}
.btn-danger{background:var(--danger); color:#fff}
.btn-danger:hover{box-shadow:var(--shadow-2)}
.btn-sm{padding:7px 12px; font-size:.82rem; min-height:36px}
.btn-icon{padding:9px; min-width:44px}
.btn[disabled]{opacity:.5; cursor:not-allowed; box-shadow:none; transform:none}

/* ============ HERO ============ */
.hero{display:grid; grid-template-columns:1.05fr .95fr; gap:40px; align-items:center; padding-block:36px 56px}
@media (max-width:900px){ .hero{grid-template-columns:1fr} }
.eyebrow{display:inline-flex; align-items:center; gap:8px; font-size:.78rem; font-weight:700; color:var(--accent); background:var(--accent-soft); border-radius:999px; padding:6px 14px; letter-spacing:.3px}
.hero h1{font-size:clamp(1.9rem,3.4vw,2.7rem); line-height:1.28; margin-block:16px 14px}
.hero .lead{color:var(--text-muted); font-size:1.08rem; max-width:52ch}
.hero-actions{display:flex; gap:12px; margin-top:26px; flex-wrap:wrap}
.hero-stats{display:flex; gap:28px; margin-top:30px; flex-wrap:wrap}
.hero-stats div b{display:block; font-size:1.35rem; font-family:var(--font); font-weight:900; font-variant-numeric:tabular-nums}
.hero-stats div span{font-size:.82rem; color:var(--text-muted)}
.preview-card{background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-lg); box-shadow:var(--shadow-2); overflow:hidden}
.preview-card__bar{display:flex; align-items:center; justify-content:space-between; padding:12px 16px; background:var(--brand); color:var(--brand-contrast)}
.preview-card__bar strong{font-size:.88rem; font-weight:700}
.preview-card__body{padding:16px}

/* ============ SECTIONS ============ */
.view{padding-block:8px 60px; flex:1}
.section-head{margin-block:8px 20px}
.section-head h2{font-size:1.5rem}
.section-head p{color:var(--text-muted); margin-top:6px; max-width:60ch}

.features{display:grid; grid-template-columns:repeat(auto-fit,minmax(230px,1fr)); gap:16px; margin-top:8px}
.feature{background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-md); padding:20px; box-shadow:var(--shadow-1)}
.feature .ic{width:42px; height:42px; border-radius:10px; display:flex; align-items:center; justify-content:center; background:var(--surface-2); color:var(--brand); margin-bottom:12px}
.feature h3{font-size:1.02rem; margin-bottom:6px}
.feature p{color:var(--text-muted); font-size:.92rem}

.steps{display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:16px}
.step{position:relative; padding:20px; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-md)}
.step .num{font-family:var(--font); font-weight:900; font-size:1.6rem; color:var(--accent); font-variant-numeric:tabular-nums}
.step h3{margin-top:8px; font-size:.98rem}
.step p{color:var(--text-muted); font-size:.88rem; margin-top:6px}

/* ============ AUTH ============ */
.auth-wrap{display:flex; justify-content:center; padding-block:30px 60px}
.auth-card{width:100%; max-width:420px; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-lg); box-shadow:var(--shadow-2); padding:32px}
.auth-card h2{font-size:1.3rem}
.auth-card .sub{color:var(--text-muted); font-size:.9rem; margin-top:6px}
.field{margin-top:18px; display:flex; flex-direction:column; gap:6px}
.field label{font-size:.85rem; font-weight:700}
.field .req{color:var(--danger)}
.field input, .field textarea, .field select{border:1.5px solid var(--border); border-radius:var(--radius-sm); padding:11px 12px; background:var(--bg); min-height:44px; transition:border-color .15s ease}
.field textarea{min-height:80px; resize:vertical}
.field input:focus, .field textarea:focus, .field select:focus{border-color:var(--focus-ring)}
.field .hint{font-size:.78rem; color:var(--text-muted)}
.note-box{display:flex; gap:10px; align-items:flex-start; background:var(--surface-2); border:1px solid var(--border); border-radius:var(--radius-sm); padding:12px 14px; font-size:.85rem; color:var(--text-muted); margin-top:18px}
.note-box svg{flex:none; color:var(--accent); margin-top:2px}
.note-box code{background:var(--surface); padding:1px 6px; border-radius:4px; font-size:.85em}

/* ============ DASHBOARD LAYOUT ============ */
.dash{display:grid; grid-template-columns:220px 1fr; gap:26px; padding-block:26px 60px; align-items:start}
@media (max-width:820px){ .dash{grid-template-columns:1fr} }
.side-nav{position:sticky; top:16px; display:flex; flex-direction:column; gap:4px; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-md); padding:10px}
@media (max-width:820px){ .side-nav{position:static; flex-direction:row; overflow-x:auto} }
.side-nav button{display:flex; align-items:center; gap:10px; padding:10px 12px; border-radius:var(--radius-sm); border:none; background:transparent; text-align:right; cursor:pointer; font-weight:600; color:var(--text-muted); white-space:nowrap}
.side-nav button.active{background:var(--surface-2); color:var(--text)}
.side-nav button:hover{background:var(--surface-2)}

.stat-row{display:grid; grid-template-columns:repeat(auto-fit,minmax(160px,1fr)); gap:14px; margin-bottom:24px}
.stat{background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-md); padding:16px; box-shadow:var(--shadow-1)}
.stat b{display:block; font-size:1.7rem; font-weight:900; font-variant-numeric:tabular-nums}
.stat span{font-size:.82rem; color:var(--text-muted)}
.stat.warn b{color:var(--variable)}
.stat.danger b{color:var(--danger)}

.panel{background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-lg); padding:22px; box-shadow:var(--shadow-1); margin-bottom:22px}
.panel-head{display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:16px; flex-wrap:wrap}
.panel-head h2{font-size:1.12rem}
.panel-head p{color:var(--text-muted); font-size:.85rem; margin-top:4px}

.form-grid{display:grid; grid-template-columns:repeat(2,1fr); gap:14px 16px}
@media (max-width:600px){ .form-grid{grid-template-columns:1fr} }
.form-grid .span-2{grid-column:1 / -1}
.type-toggle{display:flex; gap:8px}
.type-opt{flex:1; border:1.5px solid var(--border); border-radius:var(--radius-sm); padding:10px 12px; cursor:pointer; display:flex; align-items:center; gap:8px; font-size:.86rem; font-weight:600; background:var(--bg)}
.type-opt input{accent-color:var(--brand)}
.type-opt.checked{border-color:var(--brand); background:var(--surface-2)}

/* ============ WEEK NAV ============ */
.week-nav{display:flex; align-items:center; justify-content:space-between; gap:12px; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-md); padding:10px 14px; margin-bottom:16px; flex-wrap:wrap}
.week-nav__label{display:flex; flex-direction:column; align-items:center; gap:4px; text-align:center}
.week-nav__label strong{font-size:.92rem; font-variant-numeric:tabular-nums}

/* ============ DAY BOARD ============ */
.board{display:grid; grid-template-columns:repeat(auto-fit,minmax(230px,1fr)); gap:14px}
.board.compact{grid-template-columns:repeat(auto-fit,minmax(190px,1fr)); gap:10px}
.day-card{background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-md); overflow:hidden; display:flex; flex-direction:column}
.day-card__head{padding:10px 14px; background:var(--surface-2); font-weight:800; font-size:.9rem; display:flex; justify-content:space-between; align-items:center}
.day-card__body{padding:10px; display:flex; flex-direction:column; gap:8px; flex:1}
.day-empty{color:var(--text-muted); font-size:.8rem; padding:14px 6px; text-align:center}

.chip{border-inline-start:4px solid var(--fixed); background:var(--bg); border-radius:8px; padding:10px 12px; display:flex; flex-direction:column; gap:6px}
.chip.variable{border-inline-start-color:var(--variable)}
.chip.cancelled{border-inline-start-color:var(--danger); opacity:.85}
.chip-time{font-weight:800; font-size:.85rem; font-variant-numeric:tabular-nums; display:flex; align-items:center; gap:6px; color:var(--text)}
.chip-title{font-weight:700; font-size:.92rem}
.chip.cancelled .chip-title{text-decoration:line-through; color:var(--text-muted)}
.chip-meta{display:flex; flex-wrap:wrap; gap:10px; font-size:.78rem; color:var(--text-muted)}
.chip-meta span{display:flex; align-items:center; gap:4px}
.badge{display:inline-flex; align-items:center; gap:4px; font-size:.7rem; font-weight:700; padding:3px 9px; border-radius:999px; width:fit-content}
.badge.fixed{background:var(--fixed-bg); color:var(--fixed)}
.badge.variable{background:var(--variable-bg); color:var(--variable)}
.badge.cancelled{background:var(--danger-bg); color:var(--danger)}
.chip-reason{font-size:.78rem; color:var(--danger); background:var(--danger-bg); border-radius:6px; padding:6px 8px}
.chip-actions{display:flex; gap:6px; margin-top:4px; flex-wrap:wrap}

/* ============ ANNOUNCEMENTS ============ */
.ann-list{display:flex; flex-direction:column; gap:12px}
.ann{border:1px solid var(--border); border-radius:var(--radius-md); padding:14px 16px; background:var(--bg)}
.ann-top{display:flex; justify-content:space-between; gap:10px; align-items:flex-start}
.ann h4{font-size:.98rem}
.ann time{font-size:.76rem; color:var(--text-muted); white-space:nowrap; font-variant-numeric:tabular-nums}
.ann p{color:var(--text-muted); font-size:.88rem; margin-top:6px}
.ann-actions{display:flex; gap:6px; margin-top:10px}

/* ============ TELEGRAM LOG ============ */
.tg-log{display:flex; flex-direction:column; gap:12px}
.tg-bubble{background:var(--surface-2); border:1px solid var(--border); border-radius:var(--radius-md); padding:12px 14px; max-width:480px}
.tg-bubble__head{display:flex; align-items:center; gap:8px; font-size:.78rem; font-weight:700; color:var(--brand)}
.tg-bubble__head .dot{width:8px; height:8px; border-radius:50%; background:#2FA96A}
.tg-bubble p{font-size:.86rem; margin-top:8px; white-space:pre-line}
.tg-bubble time{display:block; margin-top:8px; font-size:.72rem; color:var(--text-muted); font-variant-numeric:tabular-nums}
.empty-state{text-align:center; padding:34px 16px; color:var(--text-muted)}
.empty-state svg{margin-bottom:10px; color:var(--border)}

/* ============ MODAL ============ */
.modal-backdrop{position:fixed; inset:0; background:rgba(10,14,26,.55); display:flex; align-items:center; justify-content:center; padding:20px; z-index:100}
.modal{background:var(--surface); border-radius:var(--radius-lg); width:100%; max-width:460px; box-shadow:var(--shadow-2); max-height:90vh; overflow-y:auto}
.modal-head{display:flex; justify-content:space-between; align-items:center; padding:18px 20px; border-bottom:1px solid var(--border)}
.modal-head h3{font-size:1.05rem}
.modal-body{padding:20px}
.modal-foot{display:flex; gap:10px; justify-content:flex-end; padding:16px 20px; border-top:1px solid var(--border)}
.checkline{display:flex; align-items:center; gap:8px; font-size:.88rem; margin-top:14px}
.checkline input{accent-color:var(--brand); width:18px; height:18px}

/* ============ TOAST ============ */
#toast-region{position:fixed; bottom:20px; inset-inline-start:20px; display:flex; flex-direction:column; gap:10px; z-index:150; max-width:340px}
.toast{background:var(--brand); color:var(--brand-contrast); padding:13px 16px; border-radius:var(--radius-sm); box-shadow:var(--shadow-2); display:flex; align-items:center; gap:10px; font-size:.86rem; font-weight:600; animation:toast-in .25s ease-out}
.toast.success{background:var(--fixed)}
@keyframes toast-in{from{opacity:0; transform:translateY(8px)} to{opacity:1; transform:translateY(0)}}

/* ============ JALALI DATE PICKER ============ */
.jp-root{position:relative}
.jp-trigger{display:flex; align-items:center; gap:8px; width:100%; border:1.5px solid var(--border); border-radius:var(--radius-sm); padding:11px 12px; background:var(--bg); min-height:44px; cursor:pointer; text-align:right; color:var(--text)}
.jp-trigger:hover{border-color:var(--focus-ring)}
.jp-panel{position:absolute; z-index:60; top:calc(100% + 6px); right:0; width:300px; max-width:calc(100vw - 40px); background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-md); box-shadow:var(--shadow-2); padding:12px}
.jp-nav{display:flex; align-items:center; justify-content:space-between; margin-bottom:8px}
.jp-nav strong{font-size:.88rem}
.jp-weekdays{display:grid; grid-template-columns:repeat(7,1fr); gap:2px; margin-bottom:4px}
.jp-wd{text-align:center; font-size:.72rem; color:var(--text-muted); font-weight:700}
.jp-grid{display:grid; grid-template-columns:repeat(7,1fr); gap:3px}
.jp-cell{display:flex; align-items:center; justify-content:center; aspect-ratio:1; border:none; border-radius:8px; background:transparent; font-size:.82rem; font-variant-numeric:tabular-nums; cursor:pointer; color:var(--text)}
.jp-cell:not(.jp-empty):not(:disabled):hover{background:var(--surface-2)}
.jp-cell:disabled{color:var(--text-muted); opacity:.35; cursor:not-allowed}
.jp-cell.jp-friday:disabled{opacity:.22}
.jp-cell.jp-today{box-shadow:inset 0 0 0 1.5px var(--accent)}
.jp-cell.jp-selected{background:var(--brand); color:var(--brand-contrast)}
.jp-empty{cursor:default}

footer{border-top:1px solid var(--border); padding-block:20px; margin-top:30px; color:var(--text-muted); font-size:.82rem; text-align:center}
