:root {
  --forest: #12382c;
  --forest-2: #1c5240;
  --gold: #e6b325;
  --ink: #1c2430;
  --muted: #6d7682;
  --line: #ece8e0;
  --paper: #f5f4f0;
  --card: #fff;
  --teal: #128f72;
  --shadow: 0 10px 30px rgba(18, 56, 44, 0.06);
  --nav: 72px;
  --radius: 18px;
  font-family: Vazirmatn, Tahoma, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--teal); }
img { max-width: 100%; }

.auth {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px 48px;
  background: #fff;
}
.auth-card { width: min(440px, 100%); }
.logo { display: flex; justify-content: center; margin-bottom: 18px; }
.auth h1 { text-align: center; font-size: 28px; font-weight: 700; margin: 0 0 28px; letter-spacing: -0.02em; }
.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.field span { font-size: 14px; font-weight: 600; }
.field input, .field textarea, .field select {
  width: 100%;
  border: 1px solid #eeeae3;
  background: #fbfaf7;
  border-radius: 14px;
  padding: 14px 16px;
  outline: none;
}
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: #c9d7cf; background: #fff; box-shadow: 0 0 0 4px rgba(18, 56, 44, 0.06); }
.btn {
  border: 0;
  background: var(--forest);
  color: #fff;
  border-radius: 14px;
  min-height: 52px;
  padding: 0 18px;
  font-weight: 700;
  width: 100%;
}
.btn:hover { background: var(--forest-2); }
.btn:disabled { opacity: 0.65; cursor: progress; }
.btn.soft { background: #e7f3ee; color: var(--forest); }
.btn.ghost { background: #fff; color: var(--forest); border: 1px solid var(--line); }
.btn.tiny { width: auto; min-height: 38px; border-radius: 12px; padding: 0 12px; font-size: 13px; }
.foot { margin-top: 48px; color: #9aa19a; font-size: 13px; text-align: center; }
.hp { position: absolute; left: -9999px; height: 0; width: 0; opacity: 0; }

.shell { min-height: 100vh; }
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: rgba(245, 244, 240, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: -0.03em; }
.grow { flex: 1; }
.select {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 8px 10px;
  max-width: 46vw;
}
.icon-btn {
  width: 42px; height: 42px; border-radius: 14px;
  border: 1px solid var(--line); background: #fff;
  display: grid; place-items: center; position: relative;
}
.badge {
  position: absolute; top: -4px; left: -4px;
  background: var(--gold); color: #3a2d05;
  border-radius: 99px; font-size: 11px; font-weight: 700;
  min-width: 18px; height: 18px; display: grid; place-items: center; padding: 0 4px;
}
.imp {
  margin: 0 16px 8px;
  background: #fff8e8;
  border: 1px solid #f0e0b0;
  color: #6d5310;
  border-radius: 14px;
  padding: 10px 12px;
  display: flex; gap: 10px; align-items: center; justify-content: space-between;
}
.main { padding: 8px 16px calc(var(--nav) + 24px); max-width: 860px; margin: 0 auto; overflow-x: hidden; }
.page-title { font-size: 28px; margin: 8px 0 16px; font-weight: 800; }
.row > * { min-width: 0; }
.row h2, .row h3, .excerpt, .bubble p, .bubble h3 { overflow-wrap: anywhere; }
.card, .sheet, .bubble { max-width: 100%; }
.sheet { overflow-x: hidden; }

.stats { display: grid; grid-template-columns: 1fr; gap: 12px; }
.stat {
  background: var(--card); border-radius: var(--radius); padding: 16px 18px;
  box-shadow: var(--shadow); border: 1px solid #f3f0ea;
}
.stat b { display: block; font-size: 28px; margin-top: 4px; }
.stat p { margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.tools { display: flex; gap: 8px; margin: 14px 0; }
.tools input[type="search"] {
  flex: 1; border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 12px 14px;
}
.chips { flex: 1; min-width: 0; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; scroll-snap-type: x mandatory; padding: 2px 0; margin: 0; }
.chips::-webkit-scrollbar { display: none; }
.rail { display: flex; align-items: center; gap: 8px; margin: 8px 0 14px; }
.slide { width: 44px; height: 44px; flex: 0 0 auto; border-radius: 16px; border: 1px solid var(--line); background: #fff; color: var(--forest); font-size: 22px; }
.chip {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  min-height: 44px; padding: 0 14px; white-space: nowrap; font-size: 14px; font-weight: 700; color: #243028;
  scroll-snap-align: start; display: inline-flex; align-items: center; gap: 6px;
}
.chip.on { background: var(--forest); color: #fff; border-color: var(--forest); }
.chip.sending { background: #d8f5e4; color: #0f6b3c; border-color: transparent; }
.chip.review { background: #d7f1fb; color: #0b6a86; border-color: transparent; }
.chip.done { background: #eadcff; color: #5b21b6; border-color: transparent; }
.chip.revision { background: #ffd6e2; color: #9f1239; border-color: transparent; }
.chip.approved { background: #d7f5df; color: #166534; border-color: transparent; }
.chip i { font-style: normal; background: rgba(255,255,255,.72); border-radius: 999px; padding: 1px 7px; font-size: 12px; }
.chip.on i { background: rgba(255,255,255,.2); }

.card {
  background: #fff; border: 1px solid #f0ece4; border-radius: 20px;
  padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.card h3 { margin: 0; font-size: 18px; }
.row { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.meta { color: var(--muted); font-size: 13px; margin-top: 10px; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.meta span { min-width: 0; overflow-wrap: anywhere; }
.excerpt { color: #4d5966; font-size: 14px; line-height: 1.85; margin: 8px 0 0; }
.actions { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; }
.linkish { background: none; border: 0; padding: 0; font-weight: 700; color: var(--teal); }
.linkish.amber { color: #c47d12; }
.linkish.violet { color: #6d4bb0; }
.pill { border-radius: 999px; padding: 5px 10px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.mint { background: #e7f6ef; color: #1c7a4d; }
.sky { background: #e7f4fb; color: #1a6f98; }
.blue { background: #e7eefc; color: #2c4ea3; }
.violet { background: #f0e9fb; color: #6947ae; }
.peach { background: #fff1e4; color: #c26a1a; }
.amber { background: #fff6dc; color: #9a7410; }
.rose { background: #fde8ee; color: #c23b5a; }
.ok { background: #e5f7e8; color: #1d7a3a; }

.dock {
  position: fixed; inset-inline: 0; bottom: 0; height: var(--nav);
  background: #fff; border-top: 1px solid var(--line);
  display: flex; justify-content: space-around; align-items: center;
  padding-bottom: env(safe-area-inset-bottom); z-index: 30;
}
.dock a, .dock button {
  background: none; border: 0; color: #8b938c; text-decoration: none;
  display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; font-weight: 600;
}
.dock .on { color: var(--forest); }

.side { display: none; }
.sheet-back {
  position: fixed; inset: 0; background: rgba(20, 24, 22, 0.35);
  z-index: 40; display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  background: #fff; width: min(640px, 100%);
  border-radius: 22px 22px 0 0; padding: 18px 16px 24px;
  max-height: min(92vh, 900px); overflow-x: hidden; overflow-y: auto;
}
.file {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px; margin: 8px 0; background: #fff;
}
.ext {
  width: 48px; height: 48px; border-radius: 16px; background: #f4f1ea;
  display: grid; place-items: center; font-size: 12px; font-weight: 800; color: #5c6560;
}
.file .name { font-weight: 700; }
.file .sub { color: var(--teal); font-size: 12px; }
.drop {
  border: 1.5px dashed #cfe0d6; border-radius: 24px; min-height: 220px;
  display: grid; place-items: center; text-align: center; color: var(--forest); background: #fff; cursor: pointer;
}
.log { font-size: 13px; color: #3d4a44; line-height: 1.9; border-top: 1px solid var(--line); margin-top: 12px; padding-top: 8px; }
.toast {
  position: fixed; bottom: calc(var(--nav) + 12px); left: 50%; transform: translateX(-50%);
  background: var(--forest); color: #fff; border-radius: 999px; padding: 10px 16px; z-index: 70;
  font-weight: 600;
}
.copy.copied { color: var(--forest); background: #e7f6ef; }
.checks { display: flex; flex-direction: column; gap: 6px; max-height: 160px; overflow: auto; }
.checks label { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.tabs { display: flex; gap: 6px; overflow: auto; margin-bottom: 12px; }
.note { background: #fff; border-radius: 16px; padding: 12px 14px; margin-bottom: 8px; border: 1px solid #f0ece4; }
.note.unread { border-color: #ead89a; }
.cal { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 10px; margin-bottom: 10px; }
.cal-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 8px; text-align: center; }
.cal-grid button { border: 0; background: transparent; border-radius: 10px; min-height: 36px; }
.cal-grid button.on { background: var(--forest); color: #fff; }
.muted { color: var(--muted); }
.bar { height: 12px; background: #fff; border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--forest); border-radius: 99px; transition: width .25s ease; }
.meter { background: var(--paper); border-radius: 18px; padding: 12px; margin-top: 8px; }
.warn { background: #fff6f4; color: #8d3a32; border-radius: 12px; padding: 10px 12px; font-size: 13px; }
.thread { display: grid; gap: 10px; min-width: 0; }
.talk { margin: 16px 0 8px; font-size: 15px; }
.bubble { border-radius: 20px; padding: 12px 14px; min-width: 0; }
.bubble.expert { background: #e7f3ee; border: 1px solid #d3e6dc; }
.bubble.customer { background: #fff; border: 1px solid var(--line); }
.bubble .who { font-weight: 700; margin-top: 6px; }
.bubble p { margin: 6px 0 0; line-height: 1.8; }
.bubble h3 { margin: 6px 0 0; font-size: 16px; }
.tag { display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 8px; font-size: 12px; font-weight: 700; background: var(--forest); color: #fff; }
.bubble.customer .tag { background: var(--gold); color: #1c2430; }
.url-row { display: flex; gap: 8px; align-items: flex-start; min-width: 0; margin-top: 8px; }
.url-row a { min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.quick .btn { width: auto; flex: 1 1 140px; }
.composer { margin-top: 12px; background: #f7f6f2; border-radius: 20px; padding: 12px; }
.attach-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 14px; }
.file .grow { min-width: 0; }
.file .name { overflow-wrap: anywhere; }

@media (min-width: 960px) {
  .side {
    display: flex; flex-direction: column; gap: 8px;
    position: fixed; inset-block: 0; inset-inline-start: 0; width: 250px;
    background: #fff; border-inline-end: 1px solid var(--line); padding: 22px 16px; z-index: 25;
  }
  .side a, .side button.nav {
    display: flex; align-items: center; gap: 8px; text-decoration: none; color: #3e4a44;
    background: transparent; border: 0; border-radius: 12px; padding: 10px 12px; font-weight: 600; text-align: right;
  }
  .side a.on, .side button.nav.on { background: #eef6f2; color: var(--forest); }
  .shell { padding-inline-start: 250px; }
  .top .brand { display: none; }
  .dock { display: none; }
  .main { padding: 12px 28px 48px; }
  .toast { bottom: 24px; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .sheet-back { align-items: center; }
  .sheet { border-radius: 22px; box-shadow: 0 24px 80px rgba(0,0,0,.18); }
  .auth h1 { font-size: 34px; }
}
