/* ═══ دفتر گران‌ست — نسخهٔ PHP — استایل (RTL، موبایل‌فرست، برند) ═══ */
@font-face { font-family: Vazirmatn; src: url('fonts/Vazirmatn-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: Vazirmatn; src: url('fonts/Vazirmatn-Medium.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: Vazirmatn; src: url('fonts/Vazirmatn-SemiBold.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: Vazirmatn; src: url('fonts/Vazirmatn-Bold.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --brand-900: #122A19; --brand-800: #1A3C24; --brand-700: #234d2f; --brand-600: #2d6138; --brand-100: #dbe7dd;
  --honey: #82512E; --honey-light: #f6ede4;
  --ivory: #F2EFE7; --ivory-50: #faf9f5;
  --ink: #1c1917; --stone: #57534e; --stone-400: #a8a29e;
  --red: #b91c1c; --green: #15803d; --amber: #b45309;
  --radius: 16px; --shadow: 0 1px 3px rgba(28,25,23,.07), 0 4px 14px rgba(28,25,23,.06);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { height: 100%; }
body { font-family: Vazirmatn, Tahoma, sans-serif; background: var(--ivory); color: var(--ink); min-height: 100dvh; font-size: 14px; line-height: 1.7; }
.boot-loading { display: grid; place-items: center; min-height: 100dvh; color: var(--stone); gap: .75rem; }

/* ── ورود ── */
.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 1rem; background: linear-gradient(160deg, var(--brand-800), var(--brand-600)); }
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 24px; box-shadow: 0 18px 60px rgba(0,0,0,.28); padding: 2rem 1.6rem 1.6rem; text-align: center; }
.login-logo { width: 64px; height: 64px; margin: 0 auto 1rem; display: grid; place-items: center; background: var(--brand-800); color: #fff; border-radius: 20px; }
.login-logo svg { width: 34px; height: 34px; }
.login-card h1 { font-size: 1.15rem; font-weight: 700; }
.login-card .sub { color: var(--stone); font-size: .8rem; margin: .25rem 0 1.4rem; }

/* ── فرم‌ها ── */
.field { text-align: right; margin-bottom: .9rem; }
.field label { display: block; font-size: .75rem; font-weight: 600; color: var(--stone); margin-bottom: .35rem; }
.input { width: 100%; height: 44px; border: 1.5px solid #e7e5e4; border-radius: 12px; padding: 0 .9rem; font: inherit; background: #fff; transition: border-color .15s; }
.input:focus { outline: none; border-color: var(--brand-600); }
textarea.input { height: auto; min-height: 84px; padding: .6rem .9rem; resize: vertical; }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2357534e' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left .9rem center; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; height: 44px; padding: 0 1.1rem; border: none; border-radius: 12px; font: inherit; font-weight: 600; cursor: pointer; transition: .15s; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-primary { background: var(--brand-800); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-600); }
.btn-honey { background: var(--honey); color: #fff; }
.btn-ghost { background: transparent; color: var(--stone); }
.btn-ghost:hover { background: rgba(0,0,0,.05); color: var(--ink); }
.btn-danger { background: var(--red); color: #fff; }
.btn-success { background: var(--green); color: #fff; }
.btn-sm { height: 34px; padding: 0 .8rem; font-size: .8rem; border-radius: 10px; }

/* ── هدر ── */
.topbar { position: sticky; top: 0; z-index: 30; background: var(--brand-800); color: #fff; display: flex; align-items: center; gap: .6rem; padding: .55rem .9rem; }
.topbar .brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; font-size: .95rem; }
.topbar .brand svg { width: 22px; height: 22px; }
.topbar .spacer { flex: 1; }
.topbar .today { font-size: .72rem; opacity: .85; }
.icon-btn { position: relative; background: rgba(255,255,255,.12); border: none; color: #fff; width: 38px; height: 38px; border-radius: 11px; cursor: pointer; display: grid; place-items: center; }
.icon-btn:hover { background: rgba(255,255,255,.22); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn .dot { position: absolute; top: 6px; left: 6px; min-width: 16px; height: 16px; padding: 0 3px; background: #ef4444; color: #fff; border-radius: 99px; font-size: 10px; font-weight: 700; display: grid; place-items: center; }

/* ── ناوبری پایین (موبایل) ── */
.tabbar { position: fixed; bottom: 0; inset-inline: 0; z-index: 40; background: #fff; border-top: 1px solid #e7e5e4; display: flex; justify-content: space-around; padding: .3rem .2rem calc(.3rem + env(safe-area-inset-bottom)); }
.tabbar button { background: none; border: none; font: inherit; color: var(--stone-400); display: grid; place-items: center; gap: 2px; font-size: 10.5px; padding: .3rem .5rem; border-radius: 12px; cursor: pointer; min-width: 58px; }
.tabbar button.active { color: var(--brand-800); font-weight: 600; }
.tabbar button svg { width: 22px; height: 22px; }

/* ── چیدمان ── */
.page { max-width: 860px; margin: 0 auto; padding: 1rem 1rem 5.5rem; }
@media (min-width: 720px) { .page { padding-bottom: 2rem; } .tabbar { display: none; } }
.page-title { font-size: 1.05rem; font-weight: 700; margin: .4rem 0 1rem; display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.page-title .sub { font-size: .75rem; font-weight: 400; color: var(--stone); }

.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.1rem; margin-bottom: .9rem; }
.grid2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: .7rem; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; }
@media (min-width: 720px) { .grid3 { grid-template-columns: repeat(3, 1fr); } }

.stat { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: .95rem .6rem; text-align: center; }
.stat .num { font-size: 1.45rem; font-weight: 700; color: var(--brand-800); }
.stat.hot .num { color: var(--red); }
.stat .lbl { font-size: .7rem; color: var(--stone); }

/* ── لیست‌ها ── */
.list { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.list-item { display: flex; align-items: center; gap: .7rem; padding: .85rem 1rem; border-bottom: 1px solid #f0efec; cursor: pointer; transition: background .12s; }
.list-item:last-child { border-bottom: none; }
.list-item:hover { background: var(--ivory-50); }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .ttl { font-weight: 600; font-size: .87rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .meta { font-size: .72rem; color: var(--stone); margin-top: 1px; }
.empty { text-align: center; color: var(--stone-400); padding: 2.2rem 1rem; font-size: .85rem; }
.empty svg { width: 38px; height: 38px; opacity: .4; margin-bottom: .4rem; }

/* ── بج و وضعیت ── */
.badge { display: inline-flex; align-items: center; font-size: .68rem; font-weight: 600; padding: .15rem .55rem; border-radius: 99px; white-space: nowrap; }
.b-new { background: #eef2ff; color: #4338ca; }
.b-assigned { background: #fef3c7; color: #92400e; }
.b-in_progress { background: #dbeafe; color: #1d4ed8; }
.b-waiting { background: #f3e8ff; color: #7e22ce; }
.b-done, .b-approved { background: #dcfce7; color: #166534; }
.b-closed { background: #e7e5e4; color: #57534e; }
.b-rejected { background: #fee2e2; color: #b91c1c; }
.b-pending { background: #fef3c7; color: #92400e; }
.b-high { background: #fee2e2; color: #b91c1c; }
.b-normal { background: #f1f5f9; color: #475569; }
.b-low { background: #f1f5f9; color: #94a3b8; }

/* ── تب‌ها ── */
.tabs { display: flex; gap: .35rem; background: #e9e7e1; border-radius: 12px; padding: .25rem; margin-bottom: .9rem; overflow-x: auto; }
.tabs button { flex: 1; border: none; background: transparent; font: inherit; font-size: .78rem; font-weight: 600; color: var(--stone); padding: .45rem .6rem; border-radius: 9px; cursor: pointer; white-space: nowrap; }
.tabs button.active { background: #fff; color: var(--brand-800); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.tabs button .cnt { background: var(--honey); color: #fff; border-radius: 99px; font-size: .65rem; padding: 0 .4rem; margin-inline-start: .25rem; }

/* ── مودال ── */
.modal-back { position: fixed; inset: 0; z-index: 60; background: rgba(28,25,23,.45); display: grid; place-items: end center; padding: 0; animation: fade .18s; }
@media (min-width: 640px) { .modal-back { place-items: center; padding: 1rem; } }
.modal { width: 100%; max-width: 520px; background: #fff; border-radius: 22px 22px 0 0; padding: 1.15rem 1.2rem calc(1.2rem + env(safe-area-inset-bottom)); max-height: 88dvh; overflow-y: auto; animation: up .22s; }
@media (min-width: 640px) { .modal { border-radius: 20px; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.modal h3 { font-size: .95rem; margin-bottom: .9rem; display: flex; justify-content: space-between; align-items: center; }
.modal .x { background: none; border: none; cursor: pointer; color: var(--stone-400); padding: .3rem; }

/* ── توست ── */
.toasts { position: fixed; bottom: 5rem; inset-inline: 0; z-index: 90; display: grid; gap: .5rem; justify-items: center; pointer-events: none; }
@media (min-width: 720px) { .toasts { bottom: 1.2rem; } }
.toast { max-width: 92vw; background: var(--ink); color: #fff; padding: .6rem 1.1rem; border-radius: 12px; font-size: .8rem; box-shadow: 0 6px 20px rgba(0,0,0,.25); animation: up .2s; }
.toast.err { background: var(--red); }
.toast.ok { background: var(--green); }

/* ── اعلان‌ها ── */
.notif-panel { position: fixed; top: 60px; inset-inline-end: .6rem; z-index: 70; width: min(92vw, 340px); background: #fff; border-radius: 16px; box-shadow: 0 14px 44px rgba(0,0,0,.2); overflow: hidden; max-height: 60dvh; display: flex; flex-direction: column; }
.notif-panel header { display: flex; justify-content: space-between; align-items: center; padding: .7rem 1rem; font-weight: 700; font-size: .85rem; border-bottom: 1px solid #f0efec; }
.notif-list { overflow-y: auto; }
.notif-item { padding: .7rem 1rem; border-bottom: 1px solid #f5f4f1; font-size: .8rem; }
.notif-item.unread { background: var(--honey-light); }
.notif-item .t { font-weight: 600; }
.notif-item .d { color: var(--stone); font-size: .72rem; margin-top: 1px; }

/* ── حضور ── */
.att-hero { text-align: center; padding: 1.4rem 1rem; }
.att-hero .clock-ico { width: 56px; height: 56px; margin: 0 auto .6rem; display: grid; place-items: center; background: var(--brand-800); color: #fff; border-radius: 18px; }
.att-hero .clock-ico svg { width: 28px; height: 28px; }

/* ── کامنت ── */
.comment { background: var(--ivory-50); border-radius: 12px; padding: .55rem .8rem; margin-bottom: .5rem; font-size: .8rem; }
.comment .who { font-weight: 600; font-size: .72rem; color: var(--brand-700); }
.comment .when { font-size: .65rem; color: var(--stone-400); }

.tabs-actions { display: flex; gap: .5rem; margin-top: .8rem; flex-wrap: wrap; }

.skeleton { height: 58px; border-radius: 12px; background: linear-gradient(90deg, #f0efec 25%, #faf9f5 50%, #f0efec 75%); background-size: 200% 100%; animation: sk 1.2s infinite; margin-bottom: .5rem; }
@keyframes sk { to { background-position: -200% 0; } }
.muted { color: var(--stone-400); font-size: .75rem; }

/* ═══ تختهٔ کانبان وظایف ═══ */
.viewbar { display: flex; gap: .6rem; align-items: center; margin-bottom: .9rem; }
.seg { display: flex; background: #fff; border: 1px solid #e5e1d8; border-radius: 11px; overflow: hidden; flex-shrink: 0; }
.seg button { display: flex; align-items: center; gap: .35rem; padding: .5rem .85rem; background: none; border: none; color: #6b675f; cursor: pointer; font: inherit; font-size: .78rem; font-weight: 600; }
.seg button svg { width: 15px; height: 15px; }
.seg button.active { background: var(--brand-800, #1A3C24); color: #F2EFE7; }
.kanban { display: flex; gap: .7rem; overflow-x: auto; padding: .1rem .1rem .9rem; -webkit-overflow-scrolling: touch; align-items: flex-start; }
.kb-col { min-width: 232px; flex: 1 0 232px; background: #faf8f3; border: 1px solid #ece8de; border-radius: 14px; display: flex; flex-direction: column; max-height: calc(100dvh - 235px); min-height: 120px; }
.kb-col.hint { outline: 2px dashed var(--brand-800, #1A3C24); outline-offset: -4px; background: #f2efe7; }
.kb-head { display: flex; justify-content: space-between; align-items: center; padding: .7rem .8rem .45rem; font-weight: 700; font-size: .8rem; color: var(--brand-800, #1A3C24); position: sticky; top: 0; }
.kb-count { background: #e8e3d6; border-radius: 999px; padding: 0 .55rem; font-size: .72rem; min-width: 1.5rem; text-align: center; font-weight: 700; }
.kb-cards { padding: .15rem .5rem .6rem; display: flex; flex-direction: column; gap: .5rem; overflow-y: auto; flex: 1; }
.kb-card { background: #fff; border: 1px solid #ece8de; border-radius: 12px; padding: .65rem .8rem; box-shadow: 0 1px 3px rgba(26,60,36,.07); cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.kb-card.p-high { border-right: 3px solid #B3261E; }
.kb-card.p-normal { border-right: 3px solid #C9A96B; }
.kb-card.p-low { border-right: 3px solid #dcd7c9; }
.kb-card.dragging { opacity: .92; cursor: grabbing; box-shadow: 0 10px 24px rgba(26,60,36,.28); z-index: 60; position: relative; }
.kb-title { font-size: .84rem; font-weight: 600; line-height: 1.6; margin-bottom: .4rem; }
.kb-meta { display: flex; flex-wrap: wrap; gap: .25rem .55rem; font-size: .7rem; color: #6b675f; align-items: center; }
.kb-urgent { background: #fbe9e7; color: #B3261E; padding: .05rem .45rem; border-radius: 6px; font-weight: 700; }
.kb-due.late { color: #B3261E; font-weight: 700; }
.kb-hint { border: 1.5px dashed #d7d2c4; border-radius: 10px; color: #a39d8f; font-size: .73rem; text-align: center; padding: .8rem .4rem; }
