/* ============================================================
   ABillS — Modern Client Cabinet theme
   Standalone override loaded after client.css.
   No Perl interpolation here (static file).
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --mc-bg: #eef2f7;
  --mc-surface: #ffffff;
  --mc-surface-2: #f8fafc;
  --mc-text: #0f172a;
  --mc-muted: #64748b;
  --mc-border: #e6e9f0;
  --mc-primary: #6366f1;
  --mc-primary-2: #8b5cf6;
  --mc-accent: #06b6d4;
  --mc-ok: #10b981;
  --mc-warn: #f59e0b;
  --mc-danger: #f43f5e;
  --mc-radius: 20px;
  --mc-radius-sm: 14px;
  --mc-shadow: 0 10px 30px -12px rgba(15, 23, 42, 0.25);
  --mc-shadow-sm: 0 4px 14px -6px rgba(15, 23, 42, 0.18);
  --mc-grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 55%, #06b6d4 120%);
}

/* ---------- Resets over legacy client.css ---------- */
html {
  min-width: 0 !important;
}
body {
  margin: 0 !important;
  padding: 0 !important;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif !important;
  font-size: 15px;
  line-height: 1.55;
  color: var(--mc-text);
  background: var(--mc-bg);
  background-image:
    radial-gradient(900px 500px at 100% -10%, rgba(139, 92, 246, 0.18), transparent 60%),
    radial-gradient(800px 500px at -10% 0%, rgba(6, 182, 212, 0.16), transparent 55%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

.page_wrap,
.inner_wrap {
  width: auto !important;
  min-width: 0 !important;
  max-width: none !important;
  background: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  box-shadow: none !important;
}

a {
  color: var(--mc-primary);
  text-decoration: none;
  transition: color .15s ease, opacity .15s ease;
}
a:hover { color: var(--mc-primary-2); }

/* ---------- App bar (form_client_start) ---------- */
.mc-appbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
}
.mc-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.02em;
  color: var(--mc-text);
}
.mc-brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--mc-grad);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 20px;
  box-shadow: var(--mc-shadow-sm);
}
.mc-brand small {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mc-muted);
}
.mc-appbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.mc-page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 26px clamp(14px, 4vw, 36px) 60px;
  text-align: left;
}

/* ---------- Next-fee notice banner ---------- */
.mc-notice {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 20px;
  padding: 14px 18px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.10), rgba(6, 182, 212, 0.10));
  border: 1px solid var(--mc-border);
  color: var(--mc-text);
  font-weight: 600;
  font-size: 15px;
  box-shadow: var(--mc-shadow-sm);
}
.mc-notice::before {
  content: '\1F4C5';
  font-size: 20px;
  line-height: 1;
}
.mc-notice.is-warn {
  background: rgba(244, 63, 94, 0.10);
  border-color: rgba(244, 63, 94, 0.40);
  color: #be123c;
}
.mc-notice.is-warn::before { content: '\26A0'; }

/* ---------- Top info chips (form_client_main) ---------- */
.mc-topinfo {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
}
.mc-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--mc-surface);
  border: 1px solid var(--mc-border);
  border-radius: 999px;
  font-size: 13px;
  color: var(--mc-muted);
  box-shadow: var(--mc-shadow-sm);
}
.mc-chip b { color: var(--mc-text); font-weight: 600; }
.mc-chip .mc-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--mc-ok);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.16);
}
.mc-chip.is-off .mc-dot { background: var(--mc-danger); box-shadow: 0 0 0 4px rgba(244, 63, 94, 0.16); }

/* ---------- App layout: sidebar + content ---------- */
.mc-shell { width: 100%; }
.mc-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}
.mc-sidebar { position: sticky; top: 84px; }
.mc-body { min-width: 0; }
.mc-menu-summary { display: none; }

/* ---------- Navigation menu (vertical sidebar) ----------
   The legacy menu renders as #kabinet-menu > li.inner_menu-item > a.link_button.
   We override the legacy green (#006600 / #007700) theme here. */
.mc-nav {
  display: block;
  padding: 8px;
  background: var(--mc-surface);
  border: 1px solid var(--mc-border);
  border-radius: 18px;
  box-shadow: var(--mc-shadow-sm);
  overflow: hidden;
}
.mc-nav .menu_top,
.mc-nav .menu_bot { display: none !important; }

/* Neutralize the legacy left-column/list chrome */
.mc-nav #kabinet-left_col,
.mc-nav .inner-left_col {
  width: 100% !important;
  float: none !important;
  margin: 0 !important;
  padding: 0 !important;
}
.mc-nav #kabinet-menu,
.mc-nav .inner_menu {
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  box-shadow: none !important;
  list-style: none !important;
  background: none !important;
}

/* List items */
.mc-nav #kabinet-menu .inner_menu-item,
.mc-nav #kabinet-menu .inner_sub_menu-item,
.mc-nav .inner_menu-item,
.mc-nav .inner_sub_menu-item,
.mc-nav li {
  list-style: none !important;
  margin: 2px 0 !important;
  padding: 0 !important;
  border: none !important;
  border-radius: 11px !important;
  background: none !important;
  overflow: hidden;
}

/* Links (kill radiobutton icon + legacy borders) */
.mc-nav #kabinet-menu .inner_menu-item a,
.mc-nav #kabinet-menu .inner_sub_menu-item a,
.mc-nav .inner_menu-item a,
.mc-nav .inner_sub_menu-item a,
.mc-nav li > a {
  display: block !important;
  padding: 11px 14px !important;
  margin: 0 !important;
  border: 1px solid transparent !important;
  border-top: none !important;
  border-radius: 11px !important;
  background: none !important;
  background-image: none !important;
  color: var(--mc-text) !important;
  font: 600 14px 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif !important;
  text-decoration: none !important;
  transition: background .12s ease, color .12s ease;
}
.mc-nav #kabinet-menu .inner_menu-item:first-child a { border: 1px solid transparent !important; }

/* Hover — soft neutral (NOT green) */
.mc-nav #kabinet-menu .inner_menu-item:hover,
.mc-nav #kabinet-menu .inner_menu-item.hovered,
.mc-nav #kabinet-menu .inner_sub_menu-item:hover,
.mc-nav #kabinet-menu .inner_sub_menu-item.hovered,
.mc-nav .inner_menu-item:hover,
.mc-nav .inner_sub_menu-item:hover {
  background: var(--mc-surface-2) !important;
}
.mc-nav #kabinet-menu .inner_menu-item:hover a,
.mc-nav #kabinet-menu .inner_sub_menu-item:hover a,
.mc-nav .inner_menu-item:hover a {
  background: var(--mc-surface-2) !important;
  background-image: none !important;
  color: var(--mc-primary) !important;
  border-top: none !important;
}

/* Active — brand gradient (NOT green) */
.mc-nav #kabinet-menu .inner_menu-item.active,
.mc-nav #kabinet-menu .inner_sub_menu-item.active,
.mc-nav .inner_menu-item.active,
.mc-nav .inner_sub_menu-item.active {
  background: var(--mc-grad) !important;
}
.mc-nav #kabinet-menu .inner_menu-item.active a,
.mc-nav #kabinet-menu .inner_sub_menu-item.active a,
.mc-nav .inner_menu-item.active a {
  background: transparent !important;
  background-image: none !important;
  color: #fff !important;
  border-top: none !important;
}

/* The button() link inside menu is a .link_button — strip its legacy green */
.mc-nav .link_button,
.mc-nav a.link_button {
  display: block !important;
  background: none !important;
  background-image: none !important;
  color: inherit !important;
  box-shadow: none !important;
  border: none !important;
}
.mc-nav .inner_menu-item.active .link_button,
.mc-nav .inner_menu-item.active a.link_button { color: #fff !important; }
.mc-nav .link_button:hover { background: none !important; background-image: none !important; }

/* ---------- Dashboard grid + cards ---------- */
.mc-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 18px;
}
.mc-card {
  grid-column: span 4;
  background: var(--mc-surface);
  border: 1px solid var(--mc-border);
  border-radius: var(--mc-radius);
  padding: 22px;
  box-shadow: var(--mc-shadow-sm);
}
.mc-card.span-6 { grid-column: span 6; }
.mc-card.span-8 { grid-column: span 8; }
.mc-card.span-12 { grid-column: span 12; }

.mc-card-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mc-muted);
  margin-bottom: 12px;
}
.mc-card-value {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--mc-text);
}
.mc-card-sub { margin-top: 6px; font-size: 13px; color: var(--mc-muted); }

/* Hero balance */
.mc-hero {
  grid-column: span 5;
  position: relative;
  overflow: hidden;
  background: var(--mc-grad);
  color: #fff;
  border: none;
  border-radius: var(--mc-radius);
  padding: 26px;
  box-shadow: var(--mc-shadow);
}
.mc-hero::after {
  content: '';
  position: absolute;
  right: -60px; top: -60px;
  width: 220px; height: 220px;
  background: rgba(255, 255, 255, 0.16);
  border-radius: 50%;
}
.mc-hero-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.92;
}
.mc-hero-balance {
  margin: 10px 0 4px;
  font-size: 44px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}
.mc-hero-balance .cur { font-size: 20px; font-weight: 700; opacity: 0.9; margin-left: 6px; }
.mc-hero-sub { font-size: 13.5px; opacity: 0.92; }
.mc-hero-sub:empty { display: none; }
.mc-hero-actions { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; }

.mc-side { grid-column: span 7; display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.mc-side .mc-card { grid-column: auto; }

/* Badges */
.mc-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}
.mc-badge--ok { background: rgba(16, 185, 129, 0.12); color: #047857; }
.mc-badge--off { background: rgba(244, 63, 94, 0.12); color: #be123c; }
.mc-badge .mc-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

/* Buttons (force-override legacy input[type=submit] / .link_button styles) */
.mc-btn,
.mc-login input[type='submit'],
.mc-login button {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-sizing: border-box;
  width: auto;
  height: auto !important;
  min-height: 0 !important;
  padding: 13px 20px !important;
  line-height: 1.25 !important;
  border-radius: 12px !important;
  font-family: inherit !important;
  font-weight: 700 !important;
  font-size: 15px !important;
  border: 1px solid transparent !important;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  transition: transform .12s ease, box-shadow .12s ease, opacity .12s ease;
}
.mc-btn:hover,
.mc-login input[type='submit']:hover { transform: translateY(-1px); opacity: 0.96; }
.mc-btn--primary { background: #fff !important; color: #4f46e5 !important; box-shadow: var(--mc-shadow-sm); }
.mc-btn--ghost { background: rgba(255, 255, 255, 0.18) !important; color: #fff !important; border-color: rgba(255,255,255,0.45) !important; }
.mc-btn--solid,
.mc-login input[type='submit'] {
  background-image: var(--mc-grad) !important;
  background-color: #6366f1 !important;
  color: #fff !important;
  box-shadow: var(--mc-shadow-sm);
}
.mc-btn--soft { background: var(--mc-surface-2) !important; color: var(--mc-text) !important; border-color: var(--mc-border) !important; }

/* Section title */
.mc-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 30px 0 14px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--mc-text);
}
.mc-section-title .ico {
  width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center;
  background: rgba(99, 102, 241, 0.12); color: var(--mc-primary);
  font-size: 16px;
}

/* Chart card */
.mc-chart-card { grid-column: span 12; }
.mc-chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.mc-chart-title { font-size: 16px; font-weight: 800; color: var(--mc-text); }
.mc-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--mc-muted); }
.mc-legend span { display: inline-flex; align-items: center; gap: 7px; }
.mc-legend i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.mc-legend .lg-pay { background: #6366f1; }
.mc-legend .lg-fee { background: #06b6d4; }
.mc-legend .lg-bal { background: #10b981; }
.mc-chart-wrap { position: relative; height: 300px; width: 100%; }
.mc-empty {
  display: grid; place-items: center; height: 280px;
  color: var(--mc-muted); font-size: 14px; text-align: center;
}

/* Range tabs (24h / 7d / month) */
.mc-tabs {
  display: inline-flex;
  padding: 4px;
  gap: 4px;
  background: var(--mc-surface-2);
  border: 1px solid var(--mc-border);
  border-radius: 12px;
}
.mc-tabs button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--mc-muted);
  font: 600 13px/1 'Inter', sans-serif;
  padding: 8px 14px;
  border-radius: 9px;
  cursor: pointer;
  transition: all .15s ease;
}
.mc-tabs button:hover { color: var(--mc-text); }
.mc-tabs button.is-active {
  background: var(--mc-grad);
  color: #fff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, .28);
}

/* Stat summary chips */
.mc-stat-chips {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 4px 0 18px;
}
.mc-stat-chip {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--mc-border);
  border-radius: 12px;
  background: var(--mc-surface-2);
}
.mc-stat-chip .k { font-size: 12px; color: var(--mc-muted); }
.mc-stat-chip .v { font-size: 17px; font-weight: 800; color: var(--mc-text); letter-spacing: -0.01em; }
@media (max-width: 720px) {
  .mc-stat-chips { grid-template-columns: repeat(2, 1fr); }
}

/* Current session (online/offline) under the load chart */
.mc-online {
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid var(--mc-border);
  border-radius: 14px;
  background: var(--mc-surface-2);
}
.mc-online-head {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 14px;
  color: var(--mc-text);
}
.mc-online .mc-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  display: inline-block;
  flex: none;
}
.mc-online.is-online {
  border-color: rgba(16, 185, 129, .35);
  background: rgba(16, 185, 129, .08);
}
.mc-online.is-online .mc-dot {
  background: #10b981;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, .18);
}
.mc-online.is-offline .mc-dot { background: #94a3b8; }
.mc-online.is-offline { color: var(--mc-muted); }
.mc-online .mc-rows { margin-top: 10px; }

/* Definition rows */
.mc-rows { display: flex; flex-direction: column; gap: 2px; }
.mc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 2px;
  border-bottom: 1px dashed var(--mc-border);
}
.mc-row:last-child { border-bottom: none; }
.mc-row .k { color: var(--mc-muted); font-size: 13.5px; }
.mc-row .v { font-weight: 600; color: var(--mc-text); text-align: right; }

/* Generic styling for legacy tables appended below (Dv info / Docs) */
.mc-legacy { margin-top: 26px; }
.mc-legacy table.form,
.mc-legacy table.list {
  width: 100% !important;
  background: var(--mc-surface);
  border: 1px solid var(--mc-border);
  border-radius: var(--mc-radius-sm);
  overflow: hidden;
  box-shadow: var(--mc-shadow-sm);
}
.mc-legacy table th { background: var(--mc-surface-2); color: var(--mc-text); padding: 11px 14px; text-align: left; }
.mc-legacy table td { padding: 10px 14px; border-top: 1px solid var(--mc-border); }
.mc-legacy h3 { text-align: left; color: var(--mc-text) !important; font-style: normal !important; }

/* Key-value table (personal details / info fields) */
.mc-kv { width: 100%; border-collapse: collapse; margin: 0; }
.mc-kv tr td { padding: 10px 2px !important; border-bottom: 1px dashed var(--mc-border); font-size: 14px; vertical-align: top; }
.mc-kv tr:last-child td { border-bottom: none; }
.mc-kv tr td:first-child { color: var(--mc-muted); width: 42%; }
.mc-kv tr td:last-child { color: var(--mc-text); font-weight: 600; }

/* Hero action buttons (legacy ABillS buttons inherit a clean look) */
.mc-hero .mc-hero-actions a,
.mc-hero .mc-hero-actions input,
.mc-hero .mc-hero-actions button,
.mc-hero .mc-hero-actions .link_button {
  -webkit-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 18px !important;
  height: auto !important;
  line-height: 1.25 !important;
  border-radius: 12px !important;
  background: #fff !important;
  background-image: none !important;
  color: #4f46e5 !important;
  font-weight: 700 !important;
  font-size: 14px !important;
  border: none !important;
  cursor: pointer;
  box-shadow: var(--mc-shadow-sm);
  text-decoration: none;
}
.mc-hero .mc-hero-actions a:hover,
.mc-hero .mc-hero-actions .link_button:hover { transform: translateY(-1px); opacity: 0.96; }
.mc-hero-sub a, .mc-hero-sub input { color: #fff !important; }

/* Credit advance popup */
.mc-popup {
  position: fixed;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  z-index: 200;
  width: min(440px, 92vw);
  background: var(--mc-surface);
  border: 1px solid var(--mc-border);
  border-radius: 20px;
  padding: 26px;
  box-shadow: 0 30px 80px -20px rgba(15, 23, 42, 0.45);
}
.mc-popup-close {
  position: absolute;
  right: 16px; top: 12px;
  font-size: 22px;
  color: var(--mc-muted);
  cursor: pointer;
  text-decoration: none;
}

/* Neutralize legacy tpl_show wrappers inside the cabinet body */
.mc-body .table_top,
.mc-body .table_bot { display: none !important; }
.mc-body .table_cont {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 0 16px !important;
}

/* Modernize any legacy tables that get appended below the dashboard */
.mc-body table.list,
.mc-body table.form {
  width: 100% !important;
  background: var(--mc-surface);
  border: 1px solid var(--mc-border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--mc-shadow-sm);
  margin: 12px 0;
}
.mc-body table.list th,
.mc-body table.form th {
  background: var(--mc-surface-2);
  padding: 11px 14px;
  text-align: left;
  color: var(--mc-text);
}
.mc-body table.list td,
.mc-body table.form td {
  padding: 10px 14px;
  border-top: 1px solid var(--mc-border);
}
.mc-body h3 { text-align: left; }
#dv_user_info h3 { color: var(--mc-text) !important; font-style: normal !important; margin: 8px 0 !important; }

/* Unify EVERY action button inside the cabinet content (kill legacy green). */
.mc-body .link_button,
.mc-body input[type='submit'],
.mc-body input[type='button'],
.mc-body input[type='reset'],
.mc-body button,
.mc-body .button,
.mc-body .change {
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-sizing: border-box;
  width: auto;
  height: auto !important;
  min-height: 0 !important;
  padding: 9px 16px !important;
  line-height: 1.25 !important;
  border-radius: 10px !important;
  font-family: inherit !important;
  font-weight: 600 !important;
  font-size: 13.5px !important;
  border: 1px solid var(--mc-border) !important;
  background: var(--mc-surface-2) !important;
  background-image: none !important;
  color: var(--mc-primary) !important;
  box-shadow: none !important;
  text-shadow: none !important;
  cursor: pointer;
  text-decoration: none !important;
  vertical-align: middle;
  transition: background .12s ease, transform .12s ease, opacity .12s ease;
}
.mc-body .link_button:hover,
.mc-body input[type='submit']:hover,
.mc-body input[type='button']:hover,
.mc-body button:hover,
.mc-body .button:hover,
.mc-body .change:hover {
  background: #eef2ff !important;
  transform: translateY(-1px);
}
/* Primary submit actions get the brand gradient (still never green). */
.mc-body input[type='submit'],
.mc-body button[type='submit'] {
  background-image: var(--mc-grad) !important;
  background-color: #6366f1 !important;
  border-color: transparent !important;
  color: #fff !important;
  box-shadow: var(--mc-shadow-sm) !important;
}
.mc-body input[type='submit']:hover,
.mc-body button[type='submit']:hover { opacity: 0.95; background-image: var(--mc-grad) !important; }

/* ---------- Support / Messages page (legacy Msgs) in modern style ---------- */
.mc-body input[type='text'],
.mc-body input[type='email'],
.mc-body input[type='password'],
.mc-body input[type='number'],
.mc-body input[type='file'],
.mc-body textarea,
.mc-body select {
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  max-width: 100%;
  padding: 10px 13px !important;
  border: 1px solid var(--mc-border) !important;
  border-radius: 11px !important;
  background: var(--mc-surface-2) !important;
  font-family: inherit !important;
  font-size: 14px !important;
  color: var(--mc-text) !important;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.mc-body textarea { width: 100%; min-height: 130px; line-height: 1.5; resize: vertical; }
.mc-body input[type='text']:focus,
.mc-body textarea:focus,
.mc-body select:focus {
  outline: none;
  border-color: var(--mc-primary) !important;
  background: #fff !important;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.14);
}
.mc-body input[type='file'] { padding: 8px 10px !important; background: var(--mc-surface) !important; }

/* Table captions become modern section headers */
.mc-body table.list caption,
.mc-body table.form caption,
.mc-body .caption,
.mc-body caption {
  caption-side: top;
  text-align: left;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--mc-text);
  padding: 0 0 12px;
}

/* Status filter bar (#rules) — wrap cleanly as a row of pills */
.mc-body #rules { width: 100% !important; }
.mc-body #rules ul { margin: 0; padding: 0; list-style: none; }
.mc-body #rules li {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
}
.mc-body #rules .link_button {
  margin: 0 !important;
  padding: 6px 12px !important;
  border-radius: 999px !important;
  font-size: 12.5px !important;
}

.mc-body blink { animation: none; font-weight: 700; color: #f59e0b; }

/* Make legacy fixed-width tables fluid (send form 500px, show sidebar 200px) */
.mc-body table[width] { width: 100% !important; max-width: 100% !important; }
.mc-body td[width], .mc-body th[width] { width: auto !important; }

/* Neutralize nested legacy tables so the thread reads as clean blocks */
.mc-body table.form table,
.mc-body table.list table {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  margin: 0 !important;
}
.mc-body table.form table th,
.mc-body table.form table td,
.mc-body table.list table th,
.mc-body table.list table td {
  border: 0 !important;
  background: transparent !important;
  padding: 4px 6px !important;
}

/* Thread: each message / reply is a clean stacked card */
.mc-body table.form { margin: 14px 0 !important; }
.mc-body table.form > tbody > tr > th.even {
  background: var(--mc-surface-2) !important;
  padding: 10px 14px !important;
  text-align: left;
}
/* Author label = role badge (Оператор / Користувач) */
.mc-body .title_color {
  display: inline-block;
  font-weight: 800 !important;
  font-size: 12.5px;
  letter-spacing: .01em;
  color: var(--mc-primary) !important;
  background: transparent !important;
}
.mc-body .form_title {
  font-size: 15px; font-weight: 800; color: var(--mc-text) !important;
  background: transparent !important; padding: 6px 0 10px !important;
}
.mc-body .medium { color: var(--mc-muted) !important; font-size: 12px; }

/* Message body (main message + each reply) reads as a soft bubble */
.mc-body table.form > tbody > tr > td.odd,
.mc-body table.form > tbody > tr > td.even {
  background: var(--mc-surface-2) !important;
  border-radius: 10px !important;
  padding: 13px 15px !important;
  line-height: 1.6;
  color: var(--mc-text) !important;
  word-break: break-word;
  overflow-wrap: anywhere;
}
/* The submit band in the send / reply forms */
.mc-body table.form > tbody > tr > th.even:last-child { border-radius: 10px !important; }

/* Mobile: stack the two-column message view and shrink list density */
@media (max-width: 720px) {
  .mc-body table.list th, .mc-body table.list td,
  .mc-body table.form th, .mc-body table.form td { padding: 8px 9px; font-size: 13px; }
  .mc-body table.form textarea { min-height: 150px; }
  /* msgs_show outer 2-col layout -> stack */
  .mc-body table.form > tbody > tr > td[valign='top'] { display: block; width: 100% !important; }
  /* Wide ticket list scrolls horizontally inside its own box (no page overflow) */
  .mc-body table.list {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ---------- Login ---------- */
.mc-login {
  min-height: 70vh;
  display: grid;
  place-items: center;
  padding: 40px 16px;
}
.mc-login-card {
  width: 100%;
  max-width: 420px;
  background: var(--mc-surface);
  border: 1px solid var(--mc-border);
  border-radius: 24px;
  padding: 34px 30px;
  box-shadow: var(--mc-shadow);
  text-align: center;
}
.mc-login-mark {
  width: 58px; height: 58px; margin: 0 auto 16px;
  border-radius: 16px;
  background: var(--mc-grad);
  display: grid; place-items: center;
  color: #fff; font-size: 28px;
  box-shadow: var(--mc-shadow-sm);
}
.mc-login-title { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 4px; }
.mc-login-sub { color: var(--mc-muted); font-size: 14px; margin-bottom: 24px; }
.mc-field { text-align: left; margin-bottom: 16px; }
.mc-field label { display: block; font-size: 13px; font-weight: 600; color: var(--mc-muted); margin-bottom: 7px; }
.mc-input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  border: 1px solid var(--mc-border);
  border-radius: 12px;
  font-size: 15px;
  font-family: inherit;
  background: var(--mc-surface-2);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.mc-input:focus {
  outline: none;
  border-color: var(--mc-primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.14);
}
.mc-login .mc-btn { width: 100%; justify-content: center; padding: 13px; font-size: 15px; margin-top: 6px; }
.mc-login-foot { margin-top: 20px; font-size: 13px; color: var(--mc-muted); }
.mc-login-foot a { font-weight: 600; }
.mc-contact { margin-top: 14px; font-size: 13px; color: var(--mc-muted); }

/* ---------- Messages ---------- */
.message, .msg, .error, .info { border-radius: var(--mc-radius-sm) !important; }

/* ---------- Select box (language) ---------- */
.mc-select {
  padding: 9px 12px;
  border: 1px solid var(--mc-border);
  border-radius: 10px;
  background: var(--mc-surface);
  font-family: inherit;
  font-size: 14px;
  color: var(--mc-text);
}

/* ---------- Responsive ---------- */
/* Desktop: sidebar is forced open via JS; hide the mobile toggle and
   guarantee the nav is visible even if the <details> stays closed. */
@media (min-width: 901px) {
  .mc-menu-summary { display: none !important; }
  details.mc-sidebar > .mc-nav,
  details.mc-sidebar:not([open]) > .mc-nav { display: block !important; }
  details.mc-sidebar::details-content { display: block !important; content-visibility: visible !important; }
}

@media (max-width: 960px) {
  .mc-card, .mc-hero, .mc-side, .mc-card.span-6, .mc-card.span-8 { grid-column: span 12; }
  .mc-side { grid-template-columns: 1fr 1fr; }
}

/* Tablet / mobile: single column, collapsible menu */
@media (max-width: 900px) {
  .mc-layout { grid-template-columns: 1fr; gap: 14px; }
  .mc-sidebar { position: static; }
  .mc-menu-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    list-style: none;
    cursor: pointer;
    padding: 13px 16px;
    border-radius: 14px;
    background: var(--mc-surface);
    border: 1px solid var(--mc-border);
    box-shadow: var(--mc-shadow-sm);
    font-weight: 700;
    color: var(--mc-text);
    -webkit-user-select: none;
    user-select: none;
  }
  .mc-menu-summary::-webkit-details-marker { display: none; }
  .mc-menu-summary::before { content: '\2630'; font-size: 18px; color: var(--mc-primary); }
  details.mc-sidebar[open] .mc-menu-summary { margin-bottom: 10px; }
  .mc-page { padding: 18px 14px 48px; }
  .mc-chart-wrap { height: 240px; }
}

@media (max-width: 560px) {
  .mc-side { grid-template-columns: 1fr; }
  .mc-hero-balance { font-size: 36px; }
  .mc-brand { font-size: 16px; }
  .mc-card { padding: 18px; }
  .mc-hero { padding: 22px; }
  .mc-appbar { padding: 12px 16px; }
  .mc-topinfo { gap: 7px; }
  .mc-chip { font-size: 12px; padding: 6px 11px; }
  .mc-chart-wrap { height: 220px; }
}

/* Hide legacy promo clutter that breaks the clean look (kept accessible) */
#siteheart_button_231651 { display: none !important; }
