:root {
  --navy: #0B1B3F;
  --navy-2: #15295A;
  --navy-line: rgba(255,255,255,.08);
  --blue: #1E5EFF;
  --blue-600: #1749CC;
  --blue-700: #123A9E;
  --blue-50: #F0F4FF;
  --blue-100: #DFE8FF;
  --blue-200: #C3D3FF;
  --text: #0B1B3F;
  --muted: #6B7A99;
  --faint: #9AA6BF;
  --line: #E7ECF5;
  --bg: #FFFFFF;
  --soft: #F7F9FD;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(11,27,63,.06), 0 4px 16px rgba(11,27,63,.06);
  --shadow-lg: 0 12px 40px rgba(11,27,63,.18);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
/* no rubber-band bounce past the top/bottom of the page (Safari, Chrome) */
html, body { overscroll-behavior: none; }
.sidebar, .drawer, .modal, .col-body { overscroll-behavior: contain; }
body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex: none; background: var(--navy); color: #C9D3EA;
  display: flex; flex-direction: column; padding: 20px 12px; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 24px; color: #fff; font-weight: 700; font-size: 16px; }
.logo { width: 30px; height: 30px; border-radius: 8px; background: var(--blue); display: grid; place-items: center; }
.logo svg { width: 18px; height: 18px; stroke: #fff; fill: none; stroke-width: 1.8; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px;
  color: #C9D3EA; font-weight: 500; position: relative; text-decoration: none;
}
.nav a:hover { background: var(--navy-2); color: #fff; }
.nav a.on { background: var(--navy-2); color: #fff; }
.nav a.on::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--blue); }
.nav .count { margin-left: auto; font-size: 11px; background: var(--blue); color: #fff; border-radius: 10px; padding: 1px 7px; font-weight: 600; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.sync { border-top: 1px solid var(--navy-line); padding: 14px 12px 6px; font-size: 12px; line-height: 1.45; }
.sync .row { display: flex; align-items: center; gap: 8px; }
.sync .dot { width: 7px; height: 7px; border-radius: 50%; background: #6EA0FF; box-shadow: 0 0 0 3px rgba(110,160,255,.18); flex: none; }
.sync.err .dot { background: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,.2); }
.sync .sub { color: #8D9BBC; margin-top: 2px; }
.sync.err .sub { color: #fff; }
.sync button { margin-left: auto; background: none; border: 0; color: #C9D3EA; cursor: pointer; padding: 4px; border-radius: 6px; display: grid; }
.sync button:hover { background: var(--navy-2); color: #fff; }
.sync button.spin svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.logout { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; background: none; border: 0; color: #C9D3EA; cursor: pointer; text-align: left; }
.logout:hover { background: var(--navy-2); color: #fff; }
.topbar { display: none; }

.main { flex: 1; min-width: 0; padding: 32px 40px 60px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
h1 { font-size: 24px; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.sub { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid transparent; border-radius: 8px;
  padding: 8px 14px; font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; background: var(--bg);
}
.btn.primary { background: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-600); }
.btn.ghost { border-color: var(--line); color: var(--text); }
.btn.ghost:hover { border-color: var(--blue-200); background: var(--blue-50); }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: .55; cursor: default; }
.icon-btn { border: 0; background: none; padding: 6px; border-radius: 6px; color: var(--faint); cursor: pointer; display: inline-grid; }
.icon-btn:hover { background: var(--blue-50); color: var(--blue); }
.search { position: relative; max-width: 360px; flex: 1; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search input { width: 100%; padding: 9px 12px 9px 36px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); outline: none; }
.search input:focus, .field input:focus, .field select:focus, .field textarea:focus, .notes:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-100); }
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--bg); padding: 6px 12px; border-radius: 20px; font-size: 12px; font-weight: 500; cursor: pointer; color: var(--muted); }
.chip:hover { border-color: var(--blue-200); color: var(--text); }
.chip.on { background: var(--blue); border-color: var(--blue); color: #fff; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-lead { background: var(--blue-50); color: #4C77E8; }
.b-active { background: var(--blue-100); color: var(--blue-600); }
.b-inactive { background: #F1F3F8; color: #8792AB; }
.b-paid { background: var(--blue); color: #fff; }
.b-unpaid { background: var(--blue-50); color: var(--blue-600); }
.b-overdue { background: var(--navy); color: #fff; }
.b-inquiry { background: var(--blue-50); color: #4C77E8; }
.b-inprogress { background: var(--blue-100); color: var(--blue-600); }
.b-completed { background: var(--blue); color: #fff; }

/* ---------- table ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover td { background: var(--soft); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .muted { color: var(--muted); }
.table .acts { text-align: right; white-space: nowrap; width: 1%; }
.table tr .acts .icon-btn { opacity: 0; }
.table tr:hover .acts .icon-btn { opacity: 1; }
.namecell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--blue-50); color: var(--blue); display: grid; place-items: center; font-weight: 600; font-size: 12px; flex: none; }
.namecell .n { font-weight: 600; }
.namecell .m { color: var(--muted); font-size: 12px; margin-top: 1px; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--blue); background: var(--blue-50); border-radius: 4px; padding: 1px 6px; margin-left: 6px; font-weight: 500; vertical-align: 1px; }
.tag.off { color: var(--muted); background: #F1F3F8; }
.ellipsis { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 56px 16px; }
.empty .t { color: var(--text); font-weight: 600; margin-bottom: 4px; }
.cards-mobile { display: none; }

/* ---------- kanban ---------- */
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; align-items: start; }
.board-label { margin: 28px 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.board.side .col { background: #FAFBFD; }
.col-head .dot.st-none { background: #C9D1E2; }
.col-head .dot.st-open { background: var(--blue); }
.col-head .dot.st-won { background: var(--navy); }
.col-head .dot.st-later { background: var(--blue-200); }
.col-head .dot.st-lost { background: #AEB7CB; }
.card .next { margin-top: 8px; font-size: 12px; background: var(--blue-50); color: var(--blue-700); border-radius: 6px; padding: 6px 8px; }
.card .meta a { color: inherit; }
.b-st-none { background: #F1F3F8; color: #8792AB; }
.b-st-open { background: var(--blue-100); color: var(--blue-600); }
.b-st-won { background: var(--blue); color: #fff; }
.b-st-later { background: var(--blue-50); color: #4C77E8; }
.b-st-lost { background: #EEF0F5; color: #6B7A99; }
.calls { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.call { display: flex; align-items: flex-start; gap: 18px; padding: 14px 18px; border-top: 1px solid var(--line); cursor: pointer; }
.call:first-child { border-top: 0; }
.call:hover { background: var(--soft); }
.call-time { width: 64px; flex: none; font-weight: 700; font-variant-numeric: tabular-nums; padding-top: 2px; color: var(--blue); }
.call-main { flex: 1; min-width: 0; }
.call-main .n { font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.call-main .m { color: var(--muted); font-size: 12px; margin-top: 2px; }
.call-main .next { margin-top: 8px; font-size: 13px; background: var(--blue-50); color: var(--blue-700); border-radius: 6px; padding: 6px 10px; display: inline-block; }
.call-acts { display: flex; gap: 8px; align-items: center; flex: none; }
.call-acts a.btn { text-decoration: none; }
.call.done { opacity: .6; }
.call.done .n { text-decoration: line-through; }
.col { background: var(--soft); border-radius: 12px; padding: 10px; min-height: 180px; transition: background .15s; }
.col.over { background: var(--blue-50); outline: 2px dashed var(--blue-200); outline-offset: -2px; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 8px 8px 12px; font-weight: 600; font-size: 13px; }
.col-head .dot { width: 8px; height: 8px; border-radius: 50%; }
.col-head .n { margin-left: auto; color: var(--muted); font-weight: 500; font-size: 12px; }
.col-empty { color: var(--faint); text-align: center; font-size: 12px; padding: 24px 0; }
.card {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 8px;
  cursor: grab; box-shadow: 0 1px 2px rgba(11,27,63,.04); position: relative;
}
.card:hover { border-color: var(--blue-200); box-shadow: var(--shadow); }
.card.dragging { opacity: .45; }
.card .t { font-weight: 600; padding-right: 52px; }
.card .d { color: var(--muted); font-size: 12px; margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .meta { display: flex; flex-direction: column; gap: 3px; margin-top: 10px; color: var(--muted); font-size: 12px; }
.card .meta span { display: flex; align-items: center; gap: 6px; }
.card .meta svg { width: 13px; height: 13px; }
.card .tools { position: absolute; top: 8px; right: 6px; display: flex; opacity: 0; }
.card:hover .tools { opacity: 1; }
.card .move { display: none; }

/* ---------- dashboard ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat { border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; }
.stat .l { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.stat .l svg { color: var(--blue); }
.stat .v { font-size: 30px; font-weight: 700; margin-top: 10px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .s { color: var(--faint); font-size: 12px; margin-top: 2px; }
.stat.hero { background: var(--blue); border-color: var(--blue); color: #fff; }
.stat.hero .l, .stat.hero .l svg, .stat.hero .s { color: rgba(255,255,255,.8); }
.lists { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.panel { border: 1px solid var(--line); border-radius: 12px; padding: 6px 0; }
.panel h3 { font-size: 14px; margin: 0; padding: 12px 18px 8px; display: flex; justify-content: space-between; align-items: center; }
.panel h3 a { font-size: 12px; font-weight: 500; }
.li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 18px; border-top: 1px solid var(--line); cursor: pointer; }
.li:hover { background: var(--soft); }
.li .n { font-weight: 500; }
.li .m { color: var(--muted); font-size: 12px; margin-top: 2px; }
.li .r { display: flex; align-items: center; gap: 10px; font-variant-numeric: tabular-nums; }
.panel .empty { padding: 28px 16px; }

/* ---------- modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(11,27,63,.42); display: grid; place-items: center; padding: 16px; z-index: 50; animation: fade .12s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--bg); border-radius: 14px; width: 100%; max-width: 460px; max-height: calc(100vh - 32px); overflow: auto; box-shadow: var(--shadow-lg); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 4px; }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal form { padding: 12px 24px 24px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 500; font-size: 13px; margin-bottom: 6px; }
.field label .req { color: var(--blue); }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); outline: none;
}
.field textarea { resize: vertical; min-height: 72px; }
.field.invalid input, .field.invalid select { border-color: var(--navy); box-shadow: 0 0 0 3px var(--blue-100); }
.field .err { color: var(--navy); font-size: 12px; margin-top: 4px; font-weight: 500; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.form-err { background: var(--blue-50); color: var(--navy); border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; font-size: 13px; }

/* ---------- drawer ---------- */
.drawer-wrap { position: fixed; inset: 0; z-index: 40; background: rgba(11,27,63,.28); animation: fade .12s; }
.drawer {
  position: absolute; right: 0; top: 0; bottom: 0; width: min(520px, 100%); background: var(--bg);
  box-shadow: var(--shadow-lg); overflow: auto; animation: slide .18s ease-out;
}
@keyframes slide { from { transform: translateX(24px); opacity: .6; } }
.drawer-head { padding: 22px 24px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 1; }
.drawer-head .top { display: flex; align-items: flex-start; gap: 12px; }
.drawer-head h2 { margin: 0; font-size: 19px; flex: 1; }
.drawer-head .row2 { display: flex; gap: 8px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.drawer-head select { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; background: var(--bg); }
.section { padding: 18px 24px; border-bottom: 1px solid var(--line); }
.section h4 { margin: 0 0 12px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 14px; font-size: 13px; }
.kv .k { color: var(--muted); }
.kv .v { word-break: break-word; white-space: pre-wrap; }
.kv .v.empty-v { color: var(--faint); }
.notes { width: 100%; min-height: 110px; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; outline: none; resize: vertical; }
.timeline { display: flex; flex-direction: column; gap: 10px; }
.tl { display: flex; gap: 10px; font-size: 13px; }
.tl .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--blue-200); margin-top: 6px; flex: none; }
.tl .when { color: var(--faint); font-size: 12px; }
.mini-proj { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); cursor: pointer; }
.mini-proj:first-of-type { border-top: 0; }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-form { display: flex; flex-direction: column; justify-content: center; padding: 48px; max-width: 460px; margin: 0 auto; width: 100%; }
.auth-form .brand { color: var(--text); padding: 0 0 36px; }
.auth-form h1 { font-size: 26px; }
.auth-form .sub { margin-bottom: 24px; }
.auth-form .btn { width: 100%; justify-content: center; padding: 11px; margin-top: 6px; }
.auth-art { background: var(--blue); position: relative; overflow: hidden; display: flex; align-items: flex-end; padding: 48px; color: #fff; }
.auth-art::before { content: ""; position: absolute; width: 640px; height: 640px; border-radius: 50%; border: 90px solid rgba(255,255,255,.08); top: -180px; right: -220px; }
.auth-art::after { content: ""; position: absolute; width: 360px; height: 360px; border-radius: 50%; background: rgba(255,255,255,.07); bottom: 120px; left: -120px; }
.auth-art .q { position: relative; font-size: 22px; font-weight: 600; line-height: 1.35; max-width: 420px; }
.auth-art .q span { display: block; font-size: 13px; font-weight: 400; opacity: .75; margin-top: 12px; }

/* ---------- toast ---------- */
#toast-root { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: var(--shadow-lg); font-size: 13px; animation: fade .15s; }

/* ---------- tablet ---------- */
@media (max-width: 1100px) {
  .main { padding: 28px 24px 48px; }
  .board { gap: 10px; }
  .col { padding: 8px; }
  .card { padding: 10px 12px; }
  .table th, .table td { padding: 11px 10px; }
  .hide-md { display: none; }
}

/* ---------- mobile ---------- */
@media (max-width: 760px) {
  .shell { display: block; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 45; transform: translateX(-100%); transition: transform .2s; height: 100%;
  }
  .shell.menu .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .shell.menu::after { content: ""; position: fixed; inset: 0; background: rgba(11,27,63,.35); z-index: 44; }
  .topbar {
    display: flex; align-items: center; gap: 12px; background: var(--navy); color: #fff; padding: 12px 16px; position: sticky; top: 0; z-index: 30; font-weight: 700;
  }
  .topbar button { background: none; border: 0; color: #fff; padding: 4px; display: grid; cursor: pointer; }
  .topbar .logo { width: 24px; height: 24px; }
  .topbar .logo svg { width: 14px; height: 14px; }
  .main { padding: 20px 16px 48px; }
  .page-head { flex-direction: column; align-items: stretch; }
  .page-head .btn.primary { justify-content: center; }
  .search { max-width: none; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stats .stat:last-child { grid-column: 1 / -1; }
  .stat { padding: 14px 16px; }
  .stat .v { font-size: 24px; }
  .lists { grid-template-columns: 1fr; }
  .board { grid-template-columns: 1fr; }
  .call { flex-wrap: wrap; gap: 6px 12px; padding: 14px; }
  .call-time { width: auto; }
  .call-main { flex-basis: calc(100% - 80px); }
  .call-acts { width: 100%; padding-left: 0; }
  .call-acts .btn { flex: 1; justify-content: center; }
  .card .tools { opacity: 1; }
  .card .move { display: block; margin-top: 10px; }
  .card .move select { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; background: var(--soft); font-size: 12px; }
  .table-wrap { display: none; }
  .cards-mobile { display: flex; flex-direction: column; gap: 10px; }
  .mcard { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
  .mcard .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
  .mcard .n { font-weight: 600; }
  .mcard .f { display: grid; grid-template-columns: 90px 1fr; gap: 6px 10px; font-size: 13px; }
  .mcard .f .k { color: var(--muted); }
  .mcard .f .v { word-break: break-word; }
  .mcard .acts { display: flex; gap: 8px; margin-top: 12px; }
  .grid2 { grid-template-columns: 1fr; gap: 0; }
  .kv { grid-template-columns: 110px 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .auth-form { padding: 32px 16px; }
}

/* calls: overdue + date chips */
.call-time .late { color: var(--navy); font-size: 12px; background: var(--blue-50); border-radius: 4px; padding: 2px 6px; }
.chip b { font-weight: 600; margin-left: 2px; opacity: .75; }
.drawer-head select#cday { max-width: 220px; }

/* demos */
.demo-form { display: flex; gap: 8px; margin-top: 10px; max-width: 560px; }
.demo-form input { flex: 1; min-width: 0; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; outline: none; font-size: 13px; }
.demo-form input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-100); }
@media (max-width: 1100px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .stats .stat:last-child { grid-column: auto; } .demo-form { flex-direction: column; } }

/* tables never push the page sideways: fixed layout, long values cut with … */
.table { table-layout: fixed; }
.table td { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table .ellipsis { max-width: none; }
.table th:nth-child(1) { width: 30%; }
.table th.acts-h, .table td.acts { width: 84px; }
#view .table-wrap { max-width: 100%; }
.lists > *, .li > div:first-child { min-width: 0; }
.li .n, .li .m { overflow-wrap: anywhere; }
.table-wrap .table th:nth-child(2) { width: 130px; }
.table-wrap .table th:nth-child(5) { width: 150px; }
.table-wrap .table th:nth-child(6) { width: 190px; }
.table td .badge { max-width: 100%; }

/* mails */
.mailcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 14px; }
.mailcard { border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.mailcard .mc-head { display: flex; justify-content: space-between; gap: 10px; }
.mailcard .n { font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mailcard .m { color: var(--muted); font-size: 12px; margin-top: 3px; }
.mc-row { display: grid; grid-template-columns: 70px 1fr; align-items: center; gap: 8px; }
.mc-row label { font-size: 12px; color: var(--muted); }
.mailcard input, .mailcard textarea, .tpl input, .tpl textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; outline: none; font-size: 13px; background: var(--bg); }
.mailcard textarea, .tpl textarea { resize: vertical; line-height: 1.5; font-family: inherit; }
.mailcard input:focus, .mailcard textarea:focus, .tpl input:focus, .tpl textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-100); }
.mc-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.tpl { border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 24px; background: var(--soft); }
.tpl-one { margin-bottom: 14px; display: flex; flex-direction: column; gap: 8px; }
.tpl-one h4 { margin: 0; font-size: 13px; }
@media (max-width: 760px) { .mailcards { grid-template-columns: 1fr; } .mc-row { grid-template-columns: 1fr; gap: 4px; } }

/* views, goal bar, delivered */
.tag.view { background: var(--navy); color: #fff; }
.tag.view svg { width: 12px; height: 12px; }
.stat.goal { cursor: pointer; }
.stat .bar { height: 6px; background: var(--blue-50); border-radius: 4px; margin: 10px 0 6px; overflow: hidden; }
.stat .bar span { display: block; height: 100%; background: var(--blue); border-radius: 4px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; border: 1px solid var(--line); border-radius: 20px; padding: 4px 10px; cursor: pointer; color: var(--muted); }
.chk input { margin: 0; accent-color: var(--blue); }
.chk.on { background: var(--blue-50); border-color: var(--blue-200); color: var(--blue-700); }
.dfields { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-top: 10px; font-size: 12px; color: var(--muted); }
.dfields input { margin-left: 6px; border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; font-size: 12px; }
