/* Makyan Support — visual language of makyan.com */
:root {
  --mcolor: #16364d;          /* navy (brand) */
  --scolor: #57ff8d;          /* green accent (brand) */
  --bgcolor: #f2f2f2;
  --card: #ffffff;
  --muted: #5f7383;
  --line: #e1e5e9;
  --soft: #f8f8f8;
  --green-soft: #d5ffe2;
  --green-ink: #0d7a3a;
  --blue: #3ea9f5;
  --blue-soft: #e3f2fd;
  --amber: #b26a00;
  --amber-soft: #fff1d6;
  --red: #c62f3c;
  --red-soft: #fde4e6;
  --radius: 8px;
  --shadow: 0 11px 31px -19px rgba(0, 0, 0, 0.68);
  --shadow-sm: 0 2px 10px rgba(22, 54, 77, 0.06);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 16px; line-height: 1.5; color: var(--mcolor);
  background: var(--bgcolor); min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--mcolor); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img { max-width: 100%; }
:focus-visible { outline: 3px solid var(--scolor); outline-offset: 2px; border-radius: 4px; }

/* ---------- Header ---------- */
header.top {
  position: sticky; top: 0; z-index: 10;
  background: rgba(255, 255, 255, .88); backdrop-filter: saturate(1.4) blur(8px);
  box-shadow: var(--shadow);
}
.top-inner { max-width: 1300px; margin: auto; display: flex; align-items: center; gap: 24px; padding: 10px 20px; min-height: 68px; }
.logo { display: flex; align-items: center; gap: 12px; }
.logo img { height: 40px; width: auto; display: block; }
.logo span { font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); border-left: 1px solid var(--line); padding-left: 12px; }
nav.main { display: flex; gap: 4px; margin-left: auto; align-items: center; }
nav.main a { padding: 8px 12px; border-radius: var(--radius); font-size: 15px; position: relative; white-space: nowrap; }
nav.main a:hover { background: var(--soft); text-decoration: none; }
nav.main a.active { font-weight: 600; }
nav.main a.active::after { content: ''; position: absolute; left: 14px; right: 14px; bottom: 2px; height: 3px; background: var(--scolor); border-radius: 2px; }
.badge-dot { display: inline-block; min-width: 20px; padding: 0 6px; height: 20px; line-height: 20px; border-radius: 10px; background: var(--scolor); color: var(--mcolor); font-size: 12px; font-weight: 700; text-align: center; margin-left: 4px; }
.top-tools { display: flex; align-items: center; gap: 10px; }
.lang-switch { display: flex; gap: 2px; font-size: 13px; }
.lang-switch a { padding: 4px 7px; border-radius: 6px; color: var(--muted); text-transform: uppercase; }
.lang-switch a.on { background: var(--mcolor); color: #fff; }
.user-chip { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--mcolor); color: var(--scolor); display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; }
.menu-toggle { display: none; margin-left: auto; background: none; border: 0; padding: 8px; cursor: pointer; color: var(--mcolor); }

/* ---------- Layout ---------- */
main { flex: 1; width: 100%; max-width: 1300px; margin: 0 auto; padding: 32px 20px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { font-size: 26px; font-weight: 700; line-height: 1.25; }
.page-head .sub { color: var(--muted); font-size: 15px; margin-top: 4px; }
.h2-title { position: relative; text-transform: uppercase; font-size: 18px; letter-spacing: 1px; font-weight: 600; margin: 36px 0 16px; z-index: 0; }
.h2-title::before { content: attr(data-t); position: absolute; left: -2px; top: -14px; font-size: 32px; font-weight: 800; letter-spacing: 4px; color: #e2e4e6; z-index: -1; white-space: nowrap; pointer-events: none; }
.grid { display: grid; gap: 20px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.stack > * + * { margin-top: 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.mt { margin-top: 16px; }
.hidden { display: none !important; }

/* ---------- Cards ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 24px; }
.card.pad-0 { padding: 0; overflow: hidden; }
.card h3 { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.card-head h3 { margin: 0; }
.stat { position: relative; overflow: hidden; }
.stat .label { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.stat .value { font-size: 28px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat .hint { font-size: 13px; color: var(--muted); margin-top: 4px; }
.stat.accent { background: var(--mcolor); color: #fff; }
.stat.accent .label, .stat.accent .hint { color: rgba(255,255,255,.7); }
.stat.accent::after { content: ''; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%; border: 18px solid rgba(87,255,141,.25); }
.value.pos { color: var(--green-ink); }
.value.neg { color: var(--red); }
.stat.accent .value.pos { color: var(--scolor); }
.stat.accent .value.neg { color: #ff9aa3; }
a.stat:hover { text-decoration: none; box-shadow: var(--shadow); }

/* ---------- Buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius); border: 1px solid transparent;
  font: inherit; font-size: 15px; font-weight: 500; cursor: pointer; text-decoration: none !important;
  background: var(--mcolor); color: #fff; transition: transform .08s, box-shadow .15s, background .15s; white-space: nowrap;
}
.btn:hover { box-shadow: 0 6px 18px -8px rgba(22,54,77,.6); }
.btn:active { transform: translateY(1px); }
.btn.green { background: var(--scolor); color: var(--mcolor); }
.btn.ghost { background: #fff; color: var(--mcolor); border-color: var(--line); }
.btn.danger { background: #fff; color: var(--red); border-color: #f1c4c8; }
.btn.danger:hover { background: var(--red-soft); }
.btn.sm { padding: 6px 12px; font-size: 14px; }
.btn.block { width: 100%; }
.btn svg { width: 18px; height: 18px; flex: none; }
.link-btn { background: none; border: 0; font: inherit; color: var(--mcolor); cursor: pointer; padding: 0; text-decoration: underline; }
.field { margin-bottom: 16px; }
.field label, .label-s { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.field .help { font-size: 13px; color: var(--muted); margin-top: 6px; }
.field .err { font-size: 13px; color: var(--red); margin-top: 6px; }
.input, select.input, textarea.input {
  width: 100%; font: inherit; font-size: 15px; color: var(--mcolor);
  background: #fff; border: 1px solid #cfd6dc; border-radius: var(--radius); padding: 10px 12px;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--mcolor); box-shadow: 0 0 0 3px rgba(87,255,141,.45); }
.input.bad { border-color: var(--red); }
textarea.input { min-height: 140px; resize: vertical; line-height: 1.55; }
.input-group { display: flex; align-items: stretch; }
.input-group .input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group .addon { display: grid; place-items: center; padding: 0 14px; border: 1px solid #cfd6dc; border-left: 0; border-radius: 0 var(--radius) var(--radius) 0; background: var(--soft); font-weight: 600; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; cursor: pointer; margin-bottom: 10px; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--mcolor); flex: none; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.seg { display: inline-flex; background: var(--soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 3px; flex-wrap: wrap; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 6px 12px; border-radius: 6px; font-size: 14px; }
.seg input:checked + span { background: #fff; box-shadow: var(--shadow-sm); font-weight: 600; }
.seg input:focus-visible + span { outline: 3px solid var(--scolor); }

/* drop zone */
.drop { border: 2px dashed #cfd6dc; border-radius: var(--radius); padding: 14px; text-align: center; color: var(--muted); font-size: 14px; cursor: pointer; transition: .15s; background: var(--soft); }
.drop.over { border-color: var(--scolor); background: var(--green-soft); color: var(--mcolor); }
.drop input { display: none; }
.file-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.file-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; background: #fff; border: 1px solid var(--line); border-radius: 20px; font-size: 13px; max-width: 100%; }
.file-pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.file-pill button { border: 0; background: var(--soft); width: 22px; height: 22px; border-radius: 50%; cursor: pointer; color: var(--muted); }

/* ---------- Flash ---------- */
.flash { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 15px; display: flex; gap: 10px; align-items: center; border-left: 4px solid; background: #fff; box-shadow: var(--shadow-sm); }
.flash.success { border-color: var(--scolor); }
.flash.error { border-color: var(--red); color: var(--red); }
.flash.info { border-color: var(--blue); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: 15px; }
table.list th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 600; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--soft); white-space: nowrap; }
table.list td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }
table.list tbody tr:hover { background: #fafbfc; }
table.list tr.clickable { cursor: pointer; }
table.list td.num, table.list th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.t-title { font-weight: 600; display: block; }
.t-title.unread::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--scolor); box-shadow: 0 0 0 3px var(--green-soft); margin-right: 8px; vertical-align: middle; }
.t-meta { font-size: 13px; color: var(--muted); }
.empty { text-align: center; padding: 48px 24px; color: var(--muted); }
.empty svg { width: 48px; height: 48px; color: #c5ced6; margin-bottom: 8px; }
.amount-neg { color: var(--red); }
.amount-pos { color: var(--green-ink); }

/* ---------- Status pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 20px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st-new { background: var(--blue-soft); color: #1565c0; }
.st-quoted { background: var(--amber-soft); color: var(--amber); }
.st-in_progress { background: #e8eaf6; color: #3949ab; }
.st-done { background: var(--green-soft); color: var(--green-ink); }
.st-rejected { background: var(--red-soft); color: var(--red); }
.st-closed { background: #eceff1; color: #546e7a; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; background: var(--soft); border: 1px solid var(--line); }
.tag.free { background: var(--green-soft); border-color: transparent; color: var(--green-ink); }
.tag.urgent { background: var(--red-soft); border-color: transparent; color: var(--red); }
.tag.high { background: var(--amber-soft); border-color: transparent; color: var(--amber); }
.tag.internal { background: #fff6c8; border-color: transparent; color: #7a5d00; }

/* ---------- Filters ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 16px 24px; border-bottom: 1px solid var(--line); }
.filters .input { width: auto; min-width: 150px; padding: 8px 10px; font-size: 14px; }
.filters .search { flex: 1 1 220px; }
.tabs { display: flex; gap: 4px; padding: 0 16px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a { padding: 14px 12px; font-size: 14px; white-space: nowrap; border-bottom: 3px solid transparent; margin-bottom: -1px; color: var(--muted); }
.tabs a.on { color: var(--mcolor); border-color: var(--scolor); font-weight: 600; }
.tabs a:hover { text-decoration: none; color: var(--mcolor); }
.pager { display: flex; gap: 6px; justify-content: center; padding: 16px; flex-wrap: wrap; }
.pager a, .pager span { min-width: 36px; height: 36px; display: grid; place-items: center; border-radius: var(--radius); border: 1px solid var(--line); background: #fff; font-size: 14px; padding: 0 10px; }
.pager span.on { background: var(--mcolor); color: #fff; border-color: var(--mcolor); }

/* ---------- Ticket thread ---------- */
.ticket-head h1 { font-size: 24px; }
.thread { display: flex; flex-direction: column; gap: 16px; }
.msg { display: flex; gap: 12px; max-width: 88%; }
.msg .bubble { background: #fff; border-radius: var(--radius); padding: 14px 18px; box-shadow: var(--shadow-sm); min-width: 0; flex: 1; }
.msg .who { font-size: 13px; color: var(--muted); margin-bottom: 6px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.msg .who strong { color: var(--mcolor); }
.msg .content { overflow-wrap: anywhere; }
.msg .content p + p { margin-top: 10px; }
.msg .content img { border-radius: 6px; height: auto; }
.msg .content ul, .msg .content ol { padding-left: 22px; margin: 8px 0; }
.msg .content table { border-collapse: collapse; }
.msg .content td, .msg .content th { border: 1px solid var(--line); padding: 4px 8px; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg.mine .bubble { background: var(--mcolor); color: #fff; }
.msg.mine .who, .msg.mine .who strong { color: rgba(255,255,255,.75); }
.msg.mine .content a { color: var(--scolor); }
.msg.op .avatar { background: var(--scolor); color: var(--mcolor); }
.msg.internal .bubble { background: #fffbe6; border: 1px dashed #e6cf6a; color: var(--mcolor); }
.msg.internal .who, .msg.internal .who strong { color: #7a5d00; }
.event { align-self: center; font-size: 13px; color: var(--muted); background: #e8ebee; border-radius: 20px; padding: 5px 14px; text-align: center; max-width: 90%; }
.event strong { color: var(--mcolor); }
.atts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.att { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 6px; background: rgba(22,54,77,.06); font-size: 13px; color: inherit; max-width: 100%; }
.msg.mine .att { background: rgba(255,255,255,.12); color: #fff; }
.att img { width: 64px; height: 48px; object-fit: cover; border-radius: 4px; display: block; }
.att span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }

/* quote box */
.quote { border-radius: var(--radius); padding: 20px 24px; background: var(--mcolor); color: #fff; position: relative; overflow: hidden; }
.quote::after { content: ''; position: absolute; right: -40px; bottom: -40px; width: 140px; height: 140px; border-radius: 50%; border: 22px solid rgba(87,255,141,.22); }
.quote .price { font-size: 32px; font-weight: 700; color: var(--scolor); margin: 4px 0 12px; }
.quote p { color: rgba(255,255,255,.8); font-size: 14px; max-width: 520px; }
.quote .form-actions { position: relative; z-index: 1; margin-top: 16px; }
.quote .btn.ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.35); }

/* side panel */
.facts { list-style: none; }
.facts li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.facts li:last-child { border-bottom: 0; }
.facts li > span:first-child { color: var(--muted); }
.facts li > span:last-child { text-align: right; font-weight: 600; }

/* steps (status progress) */
.steps { display: flex; gap: 6px; margin: 4px 0 6px; }
.steps i { flex: 1; height: 6px; border-radius: 3px; background: var(--line); }
.steps i.on { background: var(--scolor); }
.steps i.bad { background: var(--red); }

/* ---------- Charts (pure CSS bars) ---------- */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding-top: 10px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; min-width: 0; }
.bars .bar .col { width: 100%; max-width: 38px; border-radius: 4px 4px 0 0; background: var(--mcolor); min-height: 2px; position: relative; transition: background .15s; }
.bars .bar .col.zero { background: var(--line); }
.bars .bar:hover .col { background: var(--scolor); }
.bars .bar .m { font-size: 11px; color: var(--muted); text-transform: uppercase; }
.bars .bar .col .tip { position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--mcolor); color: #fff; font-size: 12px; padding: 4px 8px; border-radius: 4px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 2; }
.bars .bar:hover .col .tip, .bars .bar:focus-within .col .tip { opacity: 1; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: calc(100vh - 68px - 120px); display: grid; place-items: center; padding: 20px 0; }
.auth { width: 100%; max-width: 980px; display: grid; grid-template-columns: 1.05fr 1fr; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
.auth-side { background: var(--mcolor); color: #fff; padding: 44px; position: relative; overflow: hidden; }
.auth-side::before { content: ''; position: absolute; width: 260px; height: 260px; border-radius: 50%; border: 36px solid rgba(87,255,141,.18); right: -90px; bottom: -90px; }
.auth-side h2 { font-size: 26px; text-transform: uppercase; letter-spacing: 1px; line-height: 1.3; margin-bottom: 16px; }
.auth-side h2 em { font-style: normal; color: var(--scolor); }
.auth-side ul { list-style: none; margin-top: 28px; position: relative; }
.auth-side li { display: flex; gap: 12px; margin-bottom: 18px; color: rgba(255,255,255,.85); font-size: 15px; }
.auth-side li svg { width: 22px; height: 22px; color: var(--scolor); flex: none; margin-top: 1px; }
.auth-form { padding: 44px; }
.auth-form h1 { font-size: 24px; margin-bottom: 6px; }
.auth-form .sub { color: var(--muted); margin-bottom: 24px; }
.auth-links { margin-top: 20px; font-size: 14px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.auth-links a { text-decoration: underline; text-underline-offset: 3px; }
.msg-card { max-width: 520px; text-align: center; padding: 48px 36px; }
.msg-card svg { width: 56px; height: 56px; color: var(--mcolor); background: var(--green-soft); border-radius: 50%; padding: 12px; margin-bottom: 16px; }

/* ---------- Footer ---------- */
footer.bottom { background: var(--mcolor); color: rgba(255,255,255,.75); font-size: 14px; }
footer.bottom .inner { max-width: 1300px; margin: auto; padding: 26px 20px; display: flex; flex-wrap: wrap; gap: 12px 32px; justify-content: space-between; align-items: center; }
footer.bottom a { color: #fff; }
footer.bottom .contacts { display: flex; gap: 20px; flex-wrap: wrap; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .split { grid-template-columns: 1fr; }
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
}
@media (max-width: 760px) {
  main { padding: 20px 16px 48px; }
  .top-inner { padding: 8px 16px; flex-wrap: wrap; gap: 8px; }
  .logo span { display: none; }
  .menu-toggle { display: block; }
  nav.main, .top-tools { display: none; width: 100%; }
  header.top.open nav.main { display: flex; flex-direction: column; align-items: stretch; margin: 0; }
  header.top.open .top-tools { display: flex; justify-content: space-between; padding: 8px 0 4px; border-top: 1px solid var(--line); }
  nav.main a.active::after { left: 0; right: auto; top: 8px; bottom: 8px; width: 3px; height: auto; }
  .g-2, .g-3, .g-4 { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 22px; }
  .card { padding: 18px; }
  .card-head, .filters { padding: 14px 16px; }
  .filters .input { flex: 1 1 140px; min-width: 0; }
  .msg { max-width: 100%; }
  .msg .avatar { display: none; }
  .auth-form { padding: 28px 20px; }
  table.list.responsive thead { display: none; }
  table.list.responsive, table.list.responsive tbody, table.list.responsive tr, table.list.responsive td { display: block; width: 100%; }
  table.list.responsive tr { padding: 12px 16px; border-bottom: 1px solid var(--line); }
  table.list.responsive td { border: 0; padding: 3px 0; text-align: left !important; }
  table.list.responsive td[data-l]::before { content: attr(data-l) ': '; color: var(--muted); font-size: 13px; }
  .stat .value { font-size: 24px; }
}

/* ---------- Print (statements) ---------- */
@media print {
  header.top, footer.bottom, .no-print, .flash { display: none !important; }
  body { background: #fff; }
  main { padding: 0; max-width: none; }
  .card { box-shadow: none; padding: 0; }
  .stat.accent { background: #fff; color: var(--mcolor); border: 1px solid var(--line); padding: 12px; }
  .stat.accent .label, .stat.accent .hint { color: var(--muted); }
  .stat.accent::after { display: none; }
  .print-only { display: block !important; }
  a { text-decoration: none; }
}
.print-only { display: none; }
.client-side-form .grid.g-2 { grid-template-columns: 1fr; }
.bars-wrap { container-type: inline-size; }
@container (max-width: 460px) { .bars .bar:nth-child(even) .m { visibility: hidden; } .bars .bar .m { font-size: 10px; } }
@media (min-width: 761px) and (max-width: 1100px) { .logo span { display: none; } nav.main a { padding: 8px 9px; font-size: 14px; } }
