/* EGAST Tickets */
:root {
  --navy: #343256; --navy-2: #2a2847; --navy-3: #4a4775;
  --orange: #f57929; --bg: #f6f5f1; --panel: #ffffff; --line: #e6e3ee; --line-2: #efedf4;
  --text: #1f1d33; --muted: #6e6b85; --green: #1e7a3c; --green-bg: #e4f4e8;
  --red: #c62828; --red-bg: #fdeaea; --amber: #a15c00; --amber-bg: #fff3dc;
  --radius: 12px; --shadow: 0 1px 2px rgba(31,29,51,.05), 0 4px 14px rgba(31,29,51,.05);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif; color: var(--text); background: var(--bg); font-size: 14px; -webkit-font-smoothing: antialiased; }
html[dir=rtl] body { font-family: Cairo, Inter, system-ui, sans-serif; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.error { color: var(--red); min-height: 1em; margin: 4px 0 0; font-size: 13px; }
.late { color: var(--red) !important; font-weight: 600; }
button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: var(--text); }
a { color: inherit; }

/* icons (drawn with CSS masks so they take the text colour) */
.i { display: inline-block; width: 18px; height: 18px; flex-shrink: 0; background: currentColor; -webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat; }
.i-search { --m: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%271.9%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Ccircle%20cx%3D%2211%22%20cy%3D%2211%22%20r%3D%227%22/%3E%3Cpath%20d%3D%22M20%2020l-4-4%22/%3E%3C/svg%3E"); }
.i-inbox { --m: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%271.9%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%22M4%2013h4l2%203h4l2-3h4%22/%3E%3Cpath%20d%3D%22M6%205h12l2%208v6H4v-6z%22/%3E%3C/svg%3E"); }
.i-user { --m: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%271.9%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Ccircle%20cx%3D%2212%22%20cy%3D%228%22%20r%3D%224%22/%3E%3Cpath%20d%3D%22M4%2021c0-4%204-6%208-6s8%202%208%206%22/%3E%3C/svg%3E"); }
.i-flag { --m: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%271.9%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%22M5%2021V4h11l-2%204%202%204H5%22/%3E%3C/svg%3E"); }
.i-clock { --m: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%271.9%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Ccircle%20cx%3D%2212%22%20cy%3D%2212%22%20r%3D%229%22/%3E%3Cpath%20d%3D%22M12%207v5l3%202%22/%3E%3C/svg%3E"); }
.i-check { --m: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%271.9%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Ccircle%20cx%3D%2212%22%20cy%3D%2212%22%20r%3D%229%22/%3E%3Cpath%20d%3D%22M8%2012.5l2.5%202.5L16%209.5%22/%3E%3C/svg%3E"); }
.i-grid { --m: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%271.9%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Crect%20x%3D%224%22%20y%3D%224%22%20width%3D%227%22%20height%3D%227%22%20rx%3D%221.5%22/%3E%3Crect%20x%3D%2213%22%20y%3D%224%22%20width%3D%227%22%20height%3D%227%22%20rx%3D%221.5%22/%3E%3Crect%20x%3D%224%22%20y%3D%2213%22%20width%3D%227%22%20height%3D%227%22%20rx%3D%221.5%22/%3E%3Crect%20x%3D%2213%22%20y%3D%2213%22%20width%3D%227%22%20height%3D%227%22%20rx%3D%221.5%22/%3E%3C/svg%3E"); }
.i-folder { --m: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%271.9%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%22M3%207a2%202%200%200%201%202-2h4l2%202h8a2%202%200%200%201%202%202v8a2%202%200%200%201-2%202H5a2%202%200%200%201-2-2z%22/%3E%3C/svg%3E"); }
.i-settings { --m: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%271.9%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Ccircle%20cx%3D%2212%22%20cy%3D%2212%22%20r%3D%223%22/%3E%3Cpath%20d%3D%22M19.4%2015a1.7%201.7%200%200%200%20.3%201.8l.1.1a2%202%200%201%201-2.8%202.8l-.1-.1a1.7%201.7%200%200%200-1.8-.3%201.7%201.7%200%200%200-1%201.5V21a2%202%200%201%201-4%200v-.1a1.7%201.7%200%200%200-1.1-1.5%201.7%201.7%200%200%200-1.8.3l-.1.1a2%202%200%201%201-2.8-2.8l.1-.1a1.7%201.7%200%200%200%20.3-1.8%201.7%201.7%200%200%200-1.5-1H3a2%202%200%201%201%200-4h.1a1.7%201.7%200%200%200%201.5-1.1%201.7%201.7%200%200%200-.3-1.8l-.1-.1a2%202%200%201%201%202.8-2.8l.1.1a1.7%201.7%200%200%200%201.8.3H9a1.7%201.7%200%200%200%201-1.5V3a2%202%200%201%201%204%200v.1a1.7%201.7%200%200%200%201%201.5%201.7%201.7%200%200%200%201.8-.3l.1-.1a2%202%200%201%201%202.8%202.8l-.1.1a1.7%201.7%200%200%200-.3%201.8V9a1.7%201.7%200%200%200%201.5%201H21a2%202%200%201%201%200%204h-.1a1.7%201.7%200%200%200-1.5%201z%22/%3E%3C/svg%3E"); }
.i-plus { --m: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%271.9%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%22M12%205v14M5%2012h14%22/%3E%3C/svg%3E"); }
.i-chat { --m: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%271.9%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%22M4%205h16v11H9l-5%204z%22/%3E%3C/svg%3E"); }
.i-back { --m: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%271.9%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%22M15%206l-6%206%206%206%22/%3E%3C/svg%3E"); }
.i-calendar { --m: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%271.9%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Crect%20x%3D%224%22%20y%3D%225%22%20width%3D%2216%22%20height%3D%2215%22%20rx%3D%222%22/%3E%3Cpath%20d%3D%22M4%2010h16M9%203v4M15%203v4%22/%3E%3C/svg%3E"); }
.i-pen { --m: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%271.9%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%22M4%2020h4L19%209l-4-4L4%2016z%22/%3E%3C/svg%3E"); }
.i-clip { --m: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%271.9%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%22M20%2011.5l-8.2%208.2a5%205%200%200%201-7.1-7.1l8.5-8.5a3.3%203.3%200%200%201%204.7%204.7l-8.5%208.5a1.7%201.7%200%200%201-2.4-2.4l7.8-7.8%22/%3E%3C/svg%3E"); }

.i-leaf { --m: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%271.9%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%22M5%2019c0-8%205-13%2015-14-1%2010-6%2015-14%2015%22/%3E%3Cpath%20d%3D%22M5%2019l7-7%22/%3E%3C/svg%3E"); }
.i-users { --m: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%271.9%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Ccircle%20cx%3D%229%22%20cy%3D%228%22%20r%3D%223.5%22/%3E%3Cpath%20d%3D%22M2.5%2020c0-3.5%203-5.5%206.5-5.5s6.5%202%206.5%205.5%22/%3E%3Cpath%20d%3D%22M16%204.5a3.5%203.5%200%200%201%200%207M18%2014.6c2.2.6%203.5%202.4%203.5%205.4%22/%3E%3C/svg%3E"); }
.i-send { --m: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%271.9%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%22M4%2012l16-8-6%2016-3-7z%22/%3E%3Cpath%20d%3D%22M11%2013l9-9%22/%3E%3C/svg%3E"); }
.i-ticket { --m: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%271.9%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%22M4%207a2%202%200%200%201%202-2h12a2%202%200%200%201%202%202v2a2%202%200%200%200%200%204v2a2%202%200%200%201-2%202H6a2%202%200%200%201-2-2v-2a2%202%200%200%200%200-4z%22/%3E%3Cpath%20d%3D%22M14%205v12%22%20stroke-dasharray%3D%222%202%22/%3E%3C/svg%3E"); }

.i-menu { --m: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%3E%3Cpath%20d%3D%27M4%207h16M4%2012h16M4%2017h16%27/%3E%3C/svg%3E"); }

.i-bell { --m: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%271.9%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%27M6%2016V11a6%206%200%201%201%2012%200v5l2%202H4z%27/%3E%3Cpath%20d%3D%27M10%2020a2%202%200%200%200%204%200%27/%3E%3C/svg%3E"); }

.i-sun { --m: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%271.9%27%20stroke-linecap%3D%27round%27%3E%3Ccircle%20cx%3D%2712%27%20cy%3D%2712%27%20r%3D%274%27/%3E%3Cpath%20d%3D%27M12%202v2M12%2020v2M4.9%204.9l1.4%201.4M17.7%2017.7l1.4%201.4M2%2012h2M20%2012h2M4.9%2019.1l1.4-1.4M17.7%206.3l1.4-1.4%27/%3E%3C/svg%3E"); }

/* buttons & fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent; border-radius: 10px; padding: 9px 16px; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn.primary { background: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy-2); }
.btn.primary:disabled { opacity: .6; cursor: default; }
.btn.ghost { background: #fff; border-color: var(--line); color: var(--text); }
.btn.ghost:hover { border-color: #cfcadf; background: #faf9fc; }
.btn.sm { padding: 6px 11px; font-size: 13px; }
.btn.danger { color: var(--red); }
.btn.danger-fill { background: var(--red); color: #fff; }
.btn.wide { width: 100%; padding: 12px; font-size: 15px; }
.btn .i { width: 16px; height: 16px; }
.link-btn { background: none; border: 0; color: var(--muted); cursor: pointer; margin-top: 14px; text-decoration: underline; }
label { display: block; }
label > span:first-child { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: #3c3a55; }
input[type=text], input[type=password], input[type=search], input[type=date], input:not([type]), select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--navy-3); box-shadow: 0 0 0 3px rgba(52,50,86,.1); }
textarea { resize: vertical; line-height: 1.5; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 17px; height: 17px; margin: 0; accent-color: var(--navy); }
.check > span:first-child, .check span { margin: 0; font-weight: 500; }

/* avatars & badges */
.avatar { width: 36px; height: 36px; border-radius: 50%; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0; letter-spacing: .02em; }
.avatar.sm { width: 30px; height: 30px; font-size: 12px; }
.avatar.xs { width: 24px; height: 24px; font-size: 10px; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 600; }
.badge.open { background: var(--green-bg); color: var(--green); }
.badge.urgent { background: var(--red-bg); color: var(--red); }
.badge.resolved { background: #eceef2; color: #4b5563; }

/* ---------- sign in ---------- */
.auth { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px; background: radial-gradient(circle at 20% 10%, #4a4775 0, var(--navy) 45%, var(--navy-2) 100%); }
.auth-card { width: min(420px, 100%); background: #fff; border-radius: 18px; padding: 34px 32px 26px; box-shadow: 0 24px 60px rgba(0,0,0,.25); display: flex; flex-direction: column; gap: 14px; text-align: start; }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.auth-brand img { width: 40px; height: 40px; }
.auth-brand strong { display: block; font-size: 20px; letter-spacing: .04em; color: var(--navy); line-height: 1; }
.auth-brand span { color: var(--orange); font-weight: 700; font-size: 13px; }
.auth-card h1 { margin: 6px 0 0; font-size: 22px; }
.auth-card p { margin: 0; }
#auth-fields { display: flex; flex-direction: column; gap: 12px; }
.auth-card .link-btn { align-self: center; margin-top: 4px; }

/* ---------- app frame ---------- */
.app { height: 100vh; height: 100dvh; display: grid; grid-template-rows: 58px minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); }
.topbar { background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 18px; gap: 12px; }
.brand { display: flex; align-items: center; gap: 9px; }
.brand img { width: 30px; height: 30px; }
.brand strong { font-size: 17px; letter-spacing: .05em; color: var(--navy); }
.brand span { font-size: 12px; font-weight: 700; color: #fff; background: var(--orange); border-radius: 6px; padding: 2px 8px; }
.top-right { display: flex; align-items: center; gap: 8px; }
.top-btn { background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 6px 12px; cursor: pointer; font-weight: 600; }
.me-wrap { position: relative; }
.me { display: flex; align-items: center; gap: 8px; background: none; border: 1px solid transparent; border-radius: 10px; padding: 4px 8px; cursor: pointer; font-weight: 600; }
.me:hover { background: #f5f4f9; }
.caret { color: var(--muted); font-size: 11px; }
.menu { position: absolute; inset-inline-end: 0; top: calc(100% + 6px); min-width: 230px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 30px rgba(31,29,51,.14); padding: 6px; z-index: 50; }
.menu-who { padding: 10px 12px; border-bottom: 1px solid var(--line-2); margin-bottom: 4px; }
.menu-who strong, .menu-who span { display: block; }
.menu button { display: block; width: 100%; text-align: start; background: none; border: 0; padding: 10px 12px; border-radius: 8px; cursor: pointer; }
.menu button:hover { background: #f5f4f9; }
.menu .danger { color: var(--red); }

.shell { display: grid; grid-template-columns: 236px minmax(300px, 390px) minmax(0, 1fr); min-height: 0; }

/* left menu */
.rail { background: var(--navy); color: #fff; padding: 16px 12px; display: flex; flex-direction: column; gap: 18px; overflow-y: auto; }
.rail-section { display: flex; flex-direction: column; gap: 2px; }
.rail-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: rgba(255,255,255,.5); padding: 0 12px 6px; }
html[dir=rtl] .rail-title { letter-spacing: 0; font-size: 12px; }
.rail-item { display: flex; align-items: center; gap: 11px; width: 100%; background: transparent; border: 0; color: rgba(255,255,255,.82); padding: 9px 12px; border-radius: 9px; cursor: pointer; text-align: start; font-size: 14.5px; }
.rail-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.rail-item.active { background: rgba(255,255,255,.15); color: #fff; font-weight: 600; }
.rail-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.count { font-size: 12px; font-weight: 600; background: rgba(255,255,255,.16); border-radius: 999px; padding: 1px 8px; }
.rail-item.warn .count { background: #e5484d; color: #fff; }
.rail-bottom { margin-top: auto; border-top: 1px solid rgba(255,255,255,.12); padding-top: 10px; }

/* middle: ticket cards */
.list-col { display: flex; flex-direction: column; gap: 12px; padding: 18px 16px 0; border-inline-end: 1px solid var(--line); min-height: 0; background: var(--bg); }
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.list-head h2 { margin: 0; font-size: 22px; color: var(--navy); line-height: 1.15; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.list-sub { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-top: 2px; }
.search { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; color: var(--muted); }
.search input { border: 0; box-shadow: none !important; padding: 10px 0; background: transparent; }
.cards { list-style: none; margin: 0; padding: 0 2px 16px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; flex: 1; min-height: 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 15px; display: flex; flex-direction: column; gap: 8px; cursor: pointer; transition: border-color .15s, box-shadow .15s; outline: none; }
.card:hover, .card:focus-visible { border-color: #cdc8de; box-shadow: var(--shadow); }
.card.selected { border-color: #bfb8dc; background: #f3f1fa; box-shadow: inset 3px 0 0 var(--navy); }
html[dir=rtl] .card.selected { box-shadow: inset -3px 0 0 var(--navy); }
.card-title { font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 8px; line-height: 1.3; }
.card.unread .card-title { font-weight: 800; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--orange); flex-shrink: 0; }
.card-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12.5px; }
.owner { display: inline-flex; align-items: center; gap: 5px; color: #3c3a55; font-weight: 500; }
.owner .i { width: 14px; height: 14px; color: var(--muted); }
.replies { display: inline-flex; align-items: center; gap: 3px; margin-inline-start: 8px; }
.replies .i { width: 13px; height: 13px; }
.empty-list { list-style: none; text-align: center; color: var(--muted); padding: 50px 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty-list .i { width: 34px; height: 34px; opacity: .5; }
.empty-list strong { color: var(--text); }

/* right: the opened ticket */
.detail-col { background: var(--panel); min-height: 0; display: flex; flex-direction: column; }
.placeholder { margin: auto; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 40px; }
.placeholder img { width: 64px; opacity: .18; margin-bottom: 8px; }
.placeholder strong { font-size: 16px; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--navy); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.tk { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 22px 30px 18px; }
#tk-head { flex-shrink: 0; display: flex; flex-direction: column; gap: 10px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.back { display: none; align-items: center; gap: 4px; background: none; border: 0; color: var(--muted); padding: 0; cursor: pointer; font-weight: 600; }
html[dir=rtl] .back .i { transform: scaleX(-1); }
.tk-titlerow { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.tk-titlerow h1 { margin: 0; font-size: 25px; line-height: 1.25; }
.status-ctl select { width: auto; border: 0; border-radius: 10px; padding: 9px 34px 9px 14px; font-weight: 700; cursor: pointer; color: #fff; background: var(--navy) 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='white' stroke-width='3'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center; appearance: none; -webkit-appearance: none; }
html[dir=rtl] .status-ctl select { padding: 9px 14px 9px 34px; background-position: left 12px center; }
.status-ctl.urgent select { background-color: var(--red); }
.status-ctl.resolved select { background-color: #5b6170; }
.status-ctl select option { color: var(--text); background: #fff; }
.tk-sub { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.sep { width: 4px; height: 4px; border-radius: 50%; background: #c6c2d4; }
.tk-meta { display: flex; flex-wrap: wrap; gap: 10px 26px; align-items: center; }
.meta { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; }
.meta .i { color: var(--muted); }
.due-input { width: auto !important; padding: 4px 8px !important; border-radius: 8px !important; font-size: 13.5px; }
.banner { display: flex; align-items: center; gap: 8px; border-radius: 10px; padding: 10px 14px; font-weight: 600; font-size: 13.5px; }
.banner.done { background: var(--green-bg); color: var(--green); }
.banner.late { background: var(--red-bg); color: var(--red); }

.feed { flex: 1; min-height: 0; overflow-y: auto; list-style: none; margin: 0; padding: 6px 0; }
.note { display: flex; gap: 14px; padding: 16px 2px; border-bottom: 1px solid var(--line-2); }
.note-body { flex: 1; min-width: 0; }
.note-who { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.note-who strong { font-size: 14.5px; }
.note-who .muted { font-size: 12.5px; }
.note-text { margin-top: 4px; font-size: 14.5px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.mention { color: var(--navy); background: #ebe8f7; border-radius: 5px; padding: 0 4px; font-weight: 600; }
.event { display: flex; align-items: center; gap: 10px; padding: 10px 2px; font-size: 13px; color: #4b4864; border-bottom: 1px solid var(--line-2); }
.event-line { width: 36px; display: flex; justify-content: center; flex-shrink: 0; }
.event-line::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #c9c4dc; }
.files { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.thumb { display: block; width: 150px; height: 110px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #f3f2f7; cursor: zoom-in; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.thumb:hover img { transform: scale(1.04); }
.file { display: inline-flex; align-items: center; gap: 10px; max-width: 300px; padding: 9px 14px 9px 9px; border: 1px solid var(--line); border-radius: 10px; background: #fff; text-decoration: none; cursor: pointer; }
.file:hover { border-color: #cdc8de; background: #faf9fd; }
.file-ext { width: 40px; height: 40px; border-radius: 8px; background: #eceef2; color: #4b5563; font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.file-ext.pdf { background: var(--red-bg); color: var(--red); }
.file-name { min-width: 0; display: flex; flex-direction: column; font-weight: 600; font-size: 13.5px; }
.file-name, .file-name small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-name small { font-weight: 400; font-size: 12px; }

.composer { flex-shrink: 0; display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.composer textarea { min-height: 86px; max-height: 240px; }
.composer-bar { display: flex; align-items: center; gap: 10px; }
.composer-bar .hint { margin-inline-start: auto; font-size: 12px; }
.pending { display: flex; flex-wrap: wrap; gap: 6px; }
.pending:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: #f1eff7; border-radius: 999px; padding: 4px 6px 4px 10px; font-size: 12.5px; }
.chip .i { width: 13px; height: 13px; }
.chip button { background: none; border: 0; cursor: pointer; color: var(--muted); padding: 0 4px; }
.mention-host { position: relative; }
.mention-pop { position: absolute; inset-inline-start: 0; bottom: calc(100% + 6px); z-index: 30; list-style: none; margin: 0; padding: 5px; min-width: 240px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 30px rgba(31,29,51,.16); }
#new-form .mention-pop { bottom: auto; top: calc(100% + 4px); }
.mention-pop li { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-weight: 500; }
.mention-pop li.on, .mention-pop li:hover { background: #f1eff9; }

/* ---------- settings (admin) ---------- */
.settings { grid-column: 2 / -1; overflow-y: auto; padding: 26px 30px 40px; }
.set-head h2 { margin: 0 0 4px; font-size: 24px; color: var(--navy); }
.set-head p { margin: 0 0 20px; }
.set-grid { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(0, 1.8fr); gap: 20px; align-items: start; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line-2); }
.panel-head h3 { margin: 0; font-size: 16px; }
.pad { padding: 16px 18px; margin: 0; }
.set-list { list-style: none; margin: 0; padding: 0; }
.set-row { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line-2); }
.set-ico { width: 36px; height: 36px; border-radius: 9px; background: #f1eff7; color: var(--navy); display: flex; align-items: center; justify-content: center; }
.set-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.set-main .muted { font-size: 12.5px; }
.set-add { display: flex; gap: 8px; padding: 14px 18px; background: #fbfafd; }
.table-wrap { overflow-x: auto; }
.people { width: 100%; border-collapse: collapse; }
.people th { text-align: start; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 10px 18px; border-bottom: 1px solid var(--line-2); }
.people td { padding: 11px 18px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.people tr.off td { opacity: .55; }
.who { display: flex; align-items: center; gap: 10px; }
.who div { display: flex; flex-direction: column; }
.who strong { white-space: nowrap; }
.set-main strong { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; }
.ar-name { margin-inline-start: 0 !important; }
.who .muted { font-size: 12px; }
.role { display: inline-block; border-radius: 6px; padding: 2px 8px; font-size: 12px; font-weight: 600; background: #eceef2; }
.role.admin { background: #fff0e6; color: #b5541a; }
.role.manager { background: #ebe8f7; color: var(--navy); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { background: #f1eff7; border-radius: 6px; padding: 2px 8px; font-size: 12px; }
.actions { white-space: nowrap; text-align: end; }
.actions .btn + .btn { margin-inline-start: 6px; }

/* ---------- dialogs ---------- */
.modal { position: fixed; inset: 0; z-index: 100; background: rgba(24,22,44,.5); display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-card { width: min(520px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; background: #fff; border-radius: 16px; padding: 22px 24px; box-shadow: 0 24px 60px rgba(0,0,0,.25); }
#new-form, .dialog-form { display: flex; flex-direction: column; gap: 14px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { margin: 0; font-size: 19px; }
.x { background: none; border: 0; font-size: 16px; color: var(--muted); cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.x:hover { background: #f3f2f7; }
.row2 { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: end; }
.row2 .check { padding-bottom: 11px; }
.drop { display: flex; align-items: center; gap: 10px; border: 1.5px dashed #cfcadf; border-radius: 10px; padding: 14px; cursor: pointer; color: var(--muted); }
.drop:hover { border-color: var(--navy-3); color: var(--text); }
.drop input { display: none; }
.drop span { margin: 0 !important; font-weight: 500 !important; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.depts-pick { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin: 0; }
.depts-pick legend { font-size: 13px; font-weight: 600; padding: 0 4px; }
.creds { background: #f7f6fb; border: 1px solid var(--line); border-radius: 12px; padding: 6px 16px; }
.creds div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line-2); }
.creds div:last-child { border: 0; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 15px; letter-spacing: .03em; }

/* ---------- file viewer ---------- */
.viewer { position: fixed; inset: 0; z-index: 200; background: rgba(18,16,36,.75); display: flex; align-items: center; justify-content: center; padding: 24px; }
.viewer-card { background: #fff; border-radius: 14px; width: min(1100px, 100%); height: min(92vh, 100%); display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 24px 60px rgba(0,0,0,.4); }
.viewer-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px 10px 18px; border-bottom: 1px solid var(--line); }
.viewer-head strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-body { flex: 1; min-height: 0; background: #525659; }
.viewer-body iframe { width: 100%; height: 100%; border: 0; display: block; }
.viewer-body.photo { background: #1b1930; display: flex; align-items: center; justify-content: center; }
.viewer-body.photo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer-none { color: #fff; padding: 50px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; }

/* ---------- toasts ---------- */
.toasts { position: fixed; bottom: 20px; inset-inline-end: 20px; z-index: 300; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 40px)); }
.toast { background: var(--navy-2); color: #fff; border-radius: 12px; padding: 12px 16px; box-shadow: 0 10px 30px rgba(0,0,0,.25); font-weight: 500; animation: rise .2s ease-out; }
.toast.strong { background: var(--orange); }
.toast.clickable { cursor: pointer; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ---------- top: Tickets / Chat ---------- */
.modes { display: flex; gap: 4px; background: #f3f2f8; border-radius: 12px; padding: 4px; }
.mode { display: inline-flex; align-items: center; gap: 7px; background: none; border: 0; border-radius: 9px; padding: 7px 16px; font-weight: 600; color: var(--muted); cursor: pointer; }
.mode:hover { color: var(--text); }
.mode.active { background: #fff; color: var(--navy); box-shadow: 0 1px 3px rgba(31,29,51,.12); }
.mode-badge { background: var(--orange); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 7px; min-width: 18px; text-align: center; }
.at { font-weight: 800; color: var(--navy); }

/* ---------- settings extras ---------- */
.ar-name { font-weight: 500; color: var(--muted); margin-inline-start: 8px; font-family: Cairo, sans-serif; }
.panel-head.sub { border-top: 1px solid var(--line); background: #fbfafd; }

/* ---------- chat ---------- */
.shell.mode-chat { grid-template-columns: minmax(300px, 370px) minmax(0, 1fr); }
.chat-list { display: flex; flex-direction: column; gap: 12px; padding: 18px 14px 0; border-inline-end: 1px solid var(--line); background: var(--bg); min-height: 0; }
.chat-items { list-style: none; margin: 0; padding: 0 0 16px; overflow-y: auto; flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 2px; }
.chat-group { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: 12px 10px 6px; list-style: none; }
html[dir=rtl] .chat-group { letter-spacing: 0; font-size: 12px; }
.chat-row { display: flex; align-items: center; gap: 11px; padding: 10px; border-radius: 12px; cursor: pointer; outline: none; }
.chat-row:hover, .chat-row:focus-visible { background: #ecebf3; }
.chat-row.selected { background: #fff; box-shadow: var(--shadow); }
.chat-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.chat-row-top, .chat-row-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.chat-row-top strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14.5px; }
.chat-row-top .muted { font-size: 11.5px; flex-shrink: 0; }
.preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.chat-row.unread .preview { color: var(--text); font-weight: 600; }
.unread-n { background: var(--orange); color: #fff; border-radius: 999px; font-size: 11.5px; font-weight: 700; padding: 1px 7px; flex-shrink: 0; }
.chat-empty { list-style: none; padding: 8px 10px; font-size: 13px; }
.avatar.dept { background: #e9e6f5; color: var(--navy); }
.avatar.dept .i { width: 18px; height: 18px; }
.avatar.sm.dept .i { width: 15px; height: 15px; }

.chat-main { background: #fff; min-height: 0; display: flex; flex-direction: column; }
.convo { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.convo-head { display: flex; align-items: center; gap: 12px; padding: 14px 24px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.convo-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.convo-title strong { font-size: 16.5px; }
.convo-title .muted { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.members { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; cursor: default; }
.msgs { flex: 1; min-height: 0; overflow-y: auto; list-style: none; margin: 0; padding: 18px 24px; background: #faf9f6; display: flex; flex-direction: column; gap: 3px; }
.day { text-align: center; margin: 12px 0 8px; }
.day span { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px; font-size: 12px; color: var(--muted); font-weight: 600; }
.msg { display: flex; align-items: flex-end; gap: 8px; max-width: 78%; margin-top: 8px; }
.msg.joined { margin-top: 0; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.avatar-space { width: 30px; flex-shrink: 0; }
.bubble { background: #fff; border: 1px solid var(--line); border-radius: 14px; border-end-start-radius: 4px; padding: 8px 12px 6px; min-width: 70px; box-shadow: 0 1px 1px rgba(31,29,51,.04); }
.msg.mine .bubble { background: var(--navy); color: #fff; border-color: var(--navy); border-radius: 14px; border-end-end-radius: 4px; }
.bubble-name { font-size: 12.5px; font-weight: 700; color: var(--navy-3); margin-bottom: 2px; }
.bubble-text { white-space: pre-wrap; word-break: break-word; line-height: 1.5; font-size: 14.5px; }
.bubble-time { display: block; text-align: end; font-size: 10.5px; color: var(--muted); margin-top: 3px; }
.msg.mine .bubble-time { color: rgba(255,255,255,.65); }
.msg.mine .mention { background: rgba(255,255,255,.18); color: #fff; }
.bubble .files { margin-top: 6px; }
.msg.mine .file { color: var(--text); }
.chat-start { margin: auto; text-align: center; }
.chat-composer { flex-shrink: 0; border-top: 1px solid var(--line); padding: 10px 16px 12px; display: flex; flex-direction: column; gap: 8px; }
.chat-bar { display: flex; align-items: flex-end; gap: 6px; }
.chat-bar .grow { flex: 1; }
.chat-bar textarea { resize: none; min-height: 44px; max-height: 160px; border-radius: 22px; padding: 11px 16px; background: #f7f6fb; }
.icon-btn { width: 40px; height: 44px; border: 0; background: none; border-radius: 10px; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.icon-btn:hover { background: #f1f0f6; color: var(--navy); }
.at-btn { font-size: 19px; font-weight: 700; }
.send { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--orange); color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
.send:hover { filter: brightness(.95); }
html[dir=rtl] .send .i { transform: scaleX(-1); }
.pick-list { list-style: none; margin: 0; padding: 0; max-height: 55vh; overflow-y: auto; }
.pick { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 10px; cursor: pointer; }
.pick:hover { background: #f3f2f8; }
.pick div { display: flex; flex-direction: column; min-width: 0; }
.pick .muted { font-size: 12.5px; }

/* ---------- smaller screens ---------- */
@media (max-width: 1100px) {
  .shell { grid-template-columns: 76px minmax(280px, 340px) minmax(0, 1fr); }
  .rail { padding: 12px 8px; }
  .rail-title, .rail-label, .count { display: none; }
  .rail-item { justify-content: center; padding: 11px; position: relative; }
  .set-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .topbar { padding: 0 12px; }
  .brand span, #lang-btn { display: none; }
  .mode { padding: 7px 10px; }
  .shell.mode-chat { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
  .shell.mode-chat.show-detail .chat-list { display: none; }
  .shell.mode-chat:not(.show-detail) .chat-main { display: none; }
  .convo-head { padding: 10px 12px; }
  .msgs { padding: 12px; }
  .msg { max-width: 88%; }
  .chat-composer { padding: 8px 10px 10px; }
  #me-name, .caret { display: none; }
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
  /* the left menu becomes a side drawer, opened with ☰ */
  .menu-btn { display: inline-flex; }
  .rail { position: fixed; top: 0; bottom: 0; inset-inline-start: 0; z-index: 160; width: min(300px, 84vw); padding: calc(18px + env(safe-area-inset-top)) 12px calc(16px + env(safe-area-inset-bottom));
          transform: translateX(-105%); visibility: hidden; transition: transform .22s ease, visibility .22s; box-shadow: 8px 0 30px rgba(0,0,0,.25); }
  html[dir=rtl] .rail { transform: translateX(105%); }
  body.rail-open .rail { transform: none !important; visibility: visible; }
  html, body { overflow-x: hidden; }
  body.rail-open .rail-backdrop { opacity: 1; pointer-events: auto; }
  .rail-title, .rail-label, .count { display: block; }
  .count { display: inline-block; }
  .rail-item { justify-content: flex-start; padding: 11px 12px; font-size: 15.5px; }
  .rail-head { display: flex; }
  .list-col { border: 0; padding: 14px 12px 0; }
  .settings { grid-column: 1; padding: 18px 14px 30px; }
  .shell.show-detail .list-col { display: none; }
  .shell:not(.show-detail):not(.mode-chat) .detail-col { display: none; }
  .shell.show-detail { grid-template-rows: minmax(0, 1fr); }
  .tk { padding: 14px 14px 12px; }
  .back { display: inline-flex; }
  .tk-titlerow { flex-direction: column; gap: 10px; }
  .tk-titlerow h1 { font-size: 21px; }
  .composer-bar .hint { display: none; }
  .composer-bar .btn.primary { margin-inline-start: auto; }
  .viewer { padding: 0; } .viewer-card { border-radius: 0; height: 100%; }
  .row2 { grid-template-columns: 1fr; }
  .depts-pick { grid-template-columns: 1fr; }
}

/* department tag on tickets (what managers see on every card) */
.dept-tag { display: inline-flex; align-items: center; gap: 5px; background: #ebe8f7; color: var(--navy); border-radius: 6px; padding: 2px 8px 2px 6px; font-size: 12px; font-weight: 600; line-height: 1.5; white-space: nowrap; }
.dept-tag .i { width: 13px; height: 13px; }
.dept-tag.farm { background: #e6f2e4; color: #2f6b2a; }
.card-id { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.tk-sub .dept-tag { font-size: 13px; padding: 3px 10px 3px 8px; }
.fixed-dept { display: flex; align-items: center; gap: 10px; background: #f7f6fb; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 13px; font-weight: 600; }

/* ---------- phones: installed app ---------- */
.steps { margin: 0; padding-inline-start: 22px; display: flex; flex-direction: column; gap: 10px; font-size: 15px; line-height: 1.5; }
@media (max-width: 760px) {
  input, select, textarea { font-size: 16px !important; }          /* stops iPhone zooming in when you tap a box */
  .composer, .chat-composer { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .cards, .chat-items { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .toasts { bottom: calc(16px + env(safe-area-inset-bottom)); inset-inline: 12px; max-width: none; }
  .modal { align-items: flex-end; padding: 0; }
  .modal-card { border-radius: 18px 18px 0 0; max-height: 92vh; padding-bottom: calc(22px + env(safe-area-inset-bottom)); width: 100%; }
}
@media (display-mode: standalone) { .topbar { padding-top: env(safe-area-inset-top); height: auto; min-height: 58px; } .app { grid-template-rows: auto minmax(0, 1fr); } }

/* phone side menu */
.menu-btn { align-items: center; justify-content: center; width: 40px; height: 40px; margin-inline-end: 4px; border: 0; background: none; border-radius: 10px; color: var(--navy); cursor: pointer; }
.menu-btn:hover { background: #f3f2f8; }
.menu-btn .i { width: 24px; height: 24px; }
.rail-backdrop { position: fixed; inset: 0; z-index: 150; background: rgba(24,22,44,.45); opacity: 0; pointer-events: none; transition: opacity .2s; }
.rail-head { align-items: center; gap: 10px; padding: 0 12px 14px; margin-bottom: 4px; border-bottom: 1px solid rgba(255,255,255,.12); }
.rail-head img { width: 30px; height: 30px; }
.rail-head strong { font-size: 17px; letter-spacing: .05em; }
.rail-head .x { margin-inline-start: auto; color: rgba(255,255,255,.7); font-size: 18px; }
.rail-head .x:hover { background: rgba(255,255,255,.1); }
.list-head .list-where { display: none; }

@media (min-width: 761px) { .menu-btn, .rail-head, .rail-backdrop { display: none !important; } }
@media (max-width: 760px) { .menu-btn { display: inline-flex; } .rail-head { display: flex; } }

@media (max-width: 760px) {
  .topbar { gap: 6px; padding: 0 8px; min-width: 0; }
  .brand strong { display: none; }
  .brand img { width: 28px; height: 28px; }
  .modes { padding: 3px; }
  .mode { padding: 7px 11px; gap: 5px; }
  .top-right { gap: 4px; }
  .me { padding: 2px; }
  .list-head .btn.primary { padding: 9px 12px; }
}
@media (max-width: 360px) { .mode .i { display: none; } }

/* ✕ to close an opened ticket or chat */
.tk-tools { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.close-x { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--muted); font-size: 16px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.close-x:hover { background: #f3f2f8; color: var(--text); border-color: #cfcadf; }
@media (max-width: 760px) {
  .tk-titlerow { flex-direction: column; }
  .tk-titlerow .close-x, .convo-head .close-x { display: none; }   /* phones already have "‹ Tickets" / "‹ Chats" */
}

/* turn on notifications */
.push-banner { display: flex; align-items: center; gap: 10px; background: #fff4ea; border: 1px solid #f9d2b4; color: #7a3d0f; border-radius: 12px; padding: 10px 10px 10px 14px; font-size: 13px; font-weight: 500; }
.push-banner .i { color: var(--orange); }
.push-banner span:not(.i) { flex: 1; }
.push-banner .x { color: #b07a52; }
/* other departments brought into a ticket */
.also { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-inline-start: 6px; }
.pop-kind { margin-inline-start: auto; font-size: 11px; color: var(--muted); font-weight: 600; }

.danger-zone { margin-top: 20px; display: flex; align-items: center; gap: 16px; padding: 16px 18px; border-color: #f3c9c9; }
.dz-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.dz-text .muted { font-size: 13px; }
@media (max-width: 760px) { .danger-zone { flex-direction: column; align-items: stretch; } }

/* ---------- Today dashboard ---------- */
.today { grid-column: 2 / -1; overflow-y: auto; padding: 24px 30px 40px; }
.dash-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.dash-head h2 { margin: 0 0 4px; font-size: 25px; color: var(--navy); }
.dash-head p { margin: 0; }
.day-nav { display: flex; gap: 6px; flex-shrink: 0; }
.day-nav .btn { min-width: 38px; font-size: 17px; }
.day-nav .btn:disabled { opacity: .4; cursor: default; }
html[dir=rtl] .flip { display: inline-block; transform: scaleX(-1); }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.tile { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; text-align: start; background: #fff; border: 1px solid var(--line); border-inline-start: 4px solid; border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); font: inherit; color: var(--text); }
.tile:not(:disabled) { cursor: pointer; } .tile:not(:disabled):hover { border-color: #cfcadf; }
.tile:disabled { cursor: default; }
.tile-ico { grid-row: span 2; width: 40px; height: 40px; border-radius: 11px; display: flex; align-items: center; justify-content: center; }
.tile-n { font-size: 26px; font-weight: 800; line-height: 1.1; }
.tile-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.t-due { border-inline-start-color: #e0a12b; } .t-due .tile-ico { background: var(--amber-bg); color: var(--amber); }
.t-late { border-inline-start-color: #e5484d; } .t-late .tile-ico { background: var(--red-bg); color: var(--red); }
.t-new { border-inline-start-color: var(--navy-3); } .t-new .tile-ico { background: #ebe8f7; color: var(--navy); }
.t-done { border-inline-start-color: #3c9a56; } .t-done .tile-ico { background: var(--green-bg); color: var(--green); }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 18px; align-items: start; }
.dash-col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.dash-panel { min-width: 0; }
.dash-panel .panel-head { flex-wrap: wrap; row-gap: 2px; }
.dash-panel .panel-head { padding: 13px 16px; }
.dash-panel .panel-head h3 { font-size: 15px; }
.empty-note { padding: 18px 16px; margin: 0; font-size: 13.5px; }
.trows, .acts { list-style: none; margin: 0; padding: 0; }
.trow { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--line-2); cursor: pointer; outline: none; }
.trow:last-child { border-bottom: 0; }
.trow:hover, .trow:focus-visible { background: #faf9fd; }
.trow-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.trow-main strong { font-weight: 600; display: flex; align-items: center; gap: 7px; overflow-wrap: anywhere; }
.trow-sub { display: flex; align-items: center; gap: 8px; font-size: 12.5px; flex-wrap: wrap; }
.act { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); cursor: pointer; outline: none; }
.act:last-child { border-bottom: 0; }
.act:hover, .act:focus-visible { background: #faf9fd; }
.act-dot { width: 30px; display: flex; justify-content: center; padding-top: 6px; flex-shrink: 0; }
.act-dot::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #c9c4dc; }
.act-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.act-line { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; }
.act-time { font-size: 12px; flex-shrink: 0; }
.act-ticket { display: flex; align-items: center; gap: 8px; font-size: 13.5px; min-width: 0; }
.act-ticket strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.act-text { font-size: 13px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.act-new .act-line span:first-child { color: var(--navy); font-weight: 600; }
.dept-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.dept-table th { text-align: start; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 9px 16px; border-bottom: 1px solid var(--line-2); }
.dept-table td { padding: 10px 16px; border-bottom: 1px solid var(--line-2); }
.dept-table tbody tr { cursor: pointer; } .dept-table tbody tr:hover { background: #faf9fd; }
.dash-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; color: var(--amber); background: var(--amber-bg); border-radius: 6px; padding: 1px 7px; }
.dash-tag .i { width: 12px; height: 12px; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) {
  .today { grid-column: 1; padding: 16px 12px calc(30px + env(safe-area-inset-bottom)); }
  .dash-head h2 { font-size: 21px; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tile { padding: 12px; }
  .tile-n { font-size: 22px; }
  .tile-ico { width: 34px; height: 34px; }
  .dept-table th, .dept-table td { padding: 9px 10px; }
}

/* simple Today */
.dash-head { align-items: baseline; justify-content: flex-start; gap: 12px; }
@media (min-width: 901px) { .dash-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
@media (max-width: 900px) { .dash-grid { grid-template-columns: minmax(0, 1fr); } .upd-what, .upd-ticket { white-space: normal !important; } }
.count-pill { background: var(--navy); color: #fff; border-radius: 999px; font-size: 12px; font-weight: 700; padding: 1px 9px; }
.upds { list-style: none; margin: 0; padding: 0; }
.upd { display: flex; gap: 14px; padding: 11px 16px; border-bottom: 1px solid var(--line-2); cursor: pointer; outline: none; }
.upd:last-child { border-bottom: 0; }
.upd:hover, .upd:focus-visible { background: #faf9fd; }
.upd-time { width: 64px; flex-shrink: 0; font-size: 12.5px; padding-top: 1px; }
.upd-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.upd-what { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upd-ticket { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.count-pill.orange { background: var(--orange); }
.unread-row { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--line-2); cursor: pointer; outline: none; }
.unread-row:last-child { border-bottom: 0; }
.unread-row:hover, .unread-row:focus-visible { background: #faf9fd; }
.unread-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.unread-main strong { font-weight: 700; }
.unread-main .muted { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* route: Sales → Logistics */
.route { display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.route .arrow { color: var(--orange); font-weight: 800; font-size: 14px; line-height: 1; }

.dash-new { margin-inline-start: auto; }

/* send to several departments: tap-to-select chips */
.field-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: #3c3a55; }
.picks { display: flex; flex-wrap: wrap; gap: 6px; }
.dpick { display: inline-flex; cursor: pointer; }
.dpick input { position: absolute; opacity: 0; pointer-events: none; }
.dpick span { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; background: #fff; color: #3c3a55; transition: background .12s, border-color .12s; user-select: none; }
.dpick:hover span { border-color: #cfcadf; }
.dpick input:checked + span { background: var(--navy); border-color: var(--navy); color: #fff; }
.dpick input:focus-visible + span { box-shadow: 0 0 0 3px rgba(52,50,86,.2); }

/* edit / delete on a ticket's messages */
.note-who .edited { font-size: 12px; font-style: italic; }
.note-acts { margin-inline-start: auto; display: inline-flex; gap: 10px; }
.note-acts .link { background: none; border: 0; padding: 0; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.note-acts .link:hover { color: var(--navy); text-decoration: underline; }
.note-acts .link.danger:hover { color: var(--red); }

.mention-pop li.pop-empty { color: var(--muted); cursor: default; font-size: 13px; }
.mention-pop li.pop-empty:hover { background: none; }

/* phones: ticket details squeezed into a small strip at the top, so the conversation gets the screen */
@media (max-width: 760px) {
  .tk { padding: 8px 12px 10px; }
  #tk-head {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center;
    column-gap: 8px; row-gap: 6px; padding-bottom: 8px;
  }
  #tk-head > .back { grid-column: 1; font-size: 0; gap: 0; width: 30px; height: 30px; justify-content: center; margin-inline-start: -6px; }
  #tk-head > .back .i { width: 20px; height: 20px; }
  #tk-head > .tk-titlerow { display: contents; }
  #tk-head .tk-titlerow h1 {
    grid-column: 2; font-size: 16.5px; line-height: 1.3;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  }
  #tk-head .tk-tools { grid-column: 3; }
  #tk-head .status-ctl select { padding: 6px 26px 6px 10px; font-size: 12.5px; border-radius: 8px; background-position: right 8px center; }
  html[dir=rtl] #tk-head .status-ctl select { padding: 6px 10px 6px 26px; background-position: left 8px center; }
  #tk-head .badge { font-size: 11.5px; }
  #tk-head > .tk-sub, #tk-head > .tk-meta, #tk-head > .banner { grid-column: 1 / -1; }
  #tk-head .tk-sub { font-size: 12px; gap: 6px; flex-wrap: wrap; }
  #tk-head .tk-sub .dept-tag { font-size: 11.5px; padding: 2px 7px 2px 6px; }
  #tk-head .route { gap: 4px; flex-wrap: wrap; }
  #tk-head .tk-meta { gap: 4px 14px; }
  #tk-head .meta { font-size: 12px; gap: 5px; }
  #tk-head .meta .i { width: 14px; height: 14px; }
  #tk-head .due-input { font-size: 12px; padding: 2px 6px !important; min-height: 0; height: 28px; }
  #tk-head .banner { padding: 6px 10px; font-size: 12px; }
  /* smaller writing box */
  .composer { gap: 8px; padding-top: 8px; }
  .composer textarea { min-height: 44px; height: 46px; padding: 11px 12px; font-size: 14px; }
  .composer-bar .btn { padding: 7px 11px; font-size: 13px; }
  .composer-bar .btn .i { width: 15px; height: 15px; }
}

/* voice notes */
.i-mic { --m: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%271.9%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Crect%20x%3D%229%22%20y%3D%223%22%20width%3D%226%22%20height%3D%2211%22%20rx%3D%223%22%2F%3E%3Cpath%20d%3D%22M5.5%2011a6.5%206.5%200%200%200%2013%200%22%2F%3E%3Cpath%20d%3D%22M12%2017.5V21%22%2F%3E%3C%2Fsvg%3E"); }
audio.vn { display: block; height: 38px; width: 250px; max-width: 100%; margin-top: 2px; }
.msg.mine audio.vn { filter: invert(1) hue-rotate(180deg) brightness(1.15); }
.rec-bar { display: flex; align-items: center; gap: 10px; }
.rec-bar .rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #e53935; animation: recPulse 1s ease-in-out infinite; }
.rec-bar .rec-time { font-weight: 700; font-variant-numeric: tabular-nums; color: #b3261e; min-width: 38px; }
.rec-bar .rec-label { flex: 1; color: var(--muted); font-size: 13.5px; }
.rec-bar .rec-cancel { font-size: 17px; }
@keyframes recPulse { 50% { opacity: .25; } }

@media (max-width: 760px) { .chat-bar textarea { font-size: 14px; } }
