/* The layout of both sites (templates/panel_base.html), after the Marketian SMS dashboard:
   a white sidebar on the left, a top bar, then the page on a light grey background.
   No fonts or files from other servers. */

:root {
  --primary: #1E3FA8;
  --primary-dark: #17327F;
  --primary-soft: #EDF1FB;
  --accent: #2CC7B8;
  --accent-soft: #E4F7F5;
  --accent-text: #0F7F75;
  --text: #0E1A36;
  --muted: #5C6781;
  --border: #E3E7EF;
  --surface: #F6F7FA;
  --card: #FFFFFF;
  --danger: #B42318;
  --danger-soft: #FDECEA;
  --ok: #18794E;
  --ok-soft: #E7F6EE;
  --warn: #9A5B00;
  --warn-soft: #FFF4DC;
  --sidebar: 245px;
  --topbar: 60px;
  --radius: 12px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--surface);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Bengali", sans-serif;
}

h1, h2, h3, p { margin: 0; }
h1 { font-size: 22px; line-height: 1.25; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
svg { flex-shrink: 0; }
.muted { color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }

.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 12px; top: 12px; z-index: 50; padding: 8px 12px; background: var(--primary); color: #fff; border-radius: 8px; }

/* --- Logo ------------------------------------------------------------------ */
.logo { display: flex; align-items: center; gap: 9px; color: var(--text); font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }
.logo:hover { text-decoration: none; }
.logo-mark { width: 28px; height: 28px; }
.badge-panel {
  padding: 2px 7px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-text);
  font-size: 11px; font-weight: 650; letter-spacing: 0.01em;
}

/* --- Sidebar --------------------------------------------------------------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 30; width: var(--sidebar);
  display: flex; flex-direction: column;
  background: var(--card); border-right: 1px solid var(--border);
}
.sidebar > .logo { height: var(--topbar); flex-shrink: 0; padding: 0 18px; }

.company-box {
  display: flex; align-items: center; gap: 10px;
  margin: 0 12px 14px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--card);
}
.company-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: var(--accent-soft); color: var(--accent-text); }
.company-icon svg { width: 16px; height: 16px; }
.company-text { min-width: 0; display: grid; }
.company-text strong { font-size: 13px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.company-text small { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.side-nav { flex: 1; overflow-y: auto; padding: 0 12px 24px; }
.side-nav ul { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 2px; }
.nav-label { margin: 0 0 6px; padding: 0 12px; font-size: 11px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.side-nav a {
  display: flex; align-items: center; gap: 11px; height: 36px; padding: 0 12px;
  border-radius: 8px; color: var(--muted); font-weight: 550;
}
.side-nav a svg { width: 16px; height: 16px; }
.side-nav a:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.side-nav a.active { background: var(--primary-soft); color: var(--primary); }

/* --- Top bar and page ------------------------------------------------------ */
.main { margin-left: var(--sidebar); min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--topbar);
  display: flex; align-items: center; gap: 10px; padding: 0 24px;
  background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.content { max-width: 1340px; margin: 0 auto; padding: 24px; }
.content > * + * { margin-top: 20px; }

.avatar {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary); color: #fff; font-size: 12px; font-weight: 650; letter-spacing: 0.02em;
}
.user-menu { position: relative; }
.user-menu summary { list-style: none; cursor: pointer; border-radius: 50%; }
.user-menu summary::-webkit-details-marker { display: none; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); width: 230px; padding: 6px;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 30px rgba(14, 26, 54, 0.12);
}
.menu-name { padding: 8px 10px; font-weight: 600; border-bottom: 1px solid var(--border); margin-bottom: 4px; overflow-wrap: anywhere; }
.menu a { display: block; padding: 8px 10px; border-radius: 7px; color: var(--text); }
.menu a:hover { background: var(--surface); text-decoration: none; }

/* The menu button and the dark layer behind an open menu: phones only (see the end). */
.nav-open { position: absolute; opacity: 0; pointer-events: none; }
.nav-button, .nav-shade { display: none; }

/* --- Page heading, date range ---------------------------------------------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.page-head .sub { margin-top: 2px; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.range { display: inline-flex; flex-wrap: wrap; padding: 3px; gap: 2px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; }
.range a, .range button {
  padding: 6px 12px; border: 0; border-radius: 7px; background: none; color: var(--muted);
  font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap;
}
.range a:hover, .range button:hover { color: var(--text); text-decoration: none; }
.range .active { background: var(--primary-soft); color: var(--primary); }

/* --- Cards and stat cards -------------------------------------------------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.card > * + * { margin-top: 10px; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > .card-head { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card.flush > * + * { margin-top: 0; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; min-width: 0; }
.stat-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 550; }
.stat-label svg { width: 16px; height: 16px; color: var(--accent-text); }
.stat-value { margin-top: 6px; font-size: 26px; line-height: 1.2; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat-value small { font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.stat-hint { margin-top: 2px; color: var(--muted); font-size: 12px; }

/* --- Tables ---------------------------------------------------------------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 11px 20px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { background: #FAFBFD; color: var(--muted); font-size: 12px; font-weight: 650; letter-spacing: 0.03em; text-transform: uppercase; white-space: nowrap; }
.table th a { color: inherit; }
.table tbody tr:hover { background: #FAFBFD; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tfoot td { border-top: 1px solid var(--border); border-bottom: 0; background: #FAFBFD; font-weight: 650; }
.table th.num, .table td.num { text-align: right; }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); }

.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.error { background: var(--danger-soft); color: var(--danger); }
.tag.info { background: var(--primary-soft); color: var(--primary); }

/* --- Buttons and forms ----------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--card); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface); text-decoration: none; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-danger { color: var(--danger); }
.btn-block { width: 100%; height: 40px; }

.form { display: grid; gap: 14px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.field { display: grid; gap: 5px; }
.field > span, .field > label { font-size: 13px; font-weight: 600; }
.field small { color: var(--muted); font-size: 12px; }
.field .errorlist, .errorlist { margin: 0; padding: 0; list-style: none; color: var(--danger); font-size: 12px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"],
input[type="url"], input[type="search"], input[type="file"], select, textarea {
  width: 100%; min-height: 38px; padding: 8px 11px;
  border: 1px solid #CDD3DF; border-radius: 8px; background: #fff; color: var(--text); font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
.check { display: flex; align-items: center; gap: 8px; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }

.notice, .messages li { padding: 10px 14px; border-radius: 9px; background: var(--primary-soft); color: var(--primary-dark); }
.notice.error, .messages li.error { background: var(--danger-soft); color: var(--danger); }
.notice.ok, .messages li.success { background: var(--ok-soft); color: var(--ok); }
.notice.warn, .messages li.warning { background: var(--warn-soft); color: var(--warn); }
.messages { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

/* --- A page without the sidebar: login, "no access" ------------------------ */
.plain { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 16px; padding: 24px 16px; }
.plain-card { width: min(400px, calc(100vw - 32px)); padding: 28px; background: var(--card); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 12px 40px rgba(14, 26, 54, 0.06); }
.plain-card > * + * { margin-top: 14px; }
.plain-card > .logo { margin-bottom: 22px; }
.plain-foot { max-width: 400px; text-align: center; color: var(--muted); font-size: 13px; }
.plain-foot:empty { display: none; }

/* --- Smaller screens ------------------------------------------------------- */
@media (max-width: 1180px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  /* The sidebar slides in from the left when the menu button is pressed. */
  .sidebar { transform: translateX(-100%); visibility: hidden; transition: transform 0.18s ease, visibility 0.18s; width: min(280px, 86vw); }
  .nav-open:checked ~ .sidebar { transform: none; visibility: visible; box-shadow: 0 0 40px rgba(14, 26, 54, 0.18); }
  .nav-open:checked ~ .nav-shade { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(14, 26, 54, 0.4); }
  .nav-open:focus-visible ~ .main .nav-button { outline: 2px solid var(--primary); }
  .nav-button { display: grid; place-items: center; width: 38px; height: 38px; margin-left: -8px; border-radius: 8px; color: var(--text); cursor: pointer; }
  .nav-button svg { width: 20px; height: 20px; }
  .main { margin-left: 0; }
  .topbar { padding: 0 16px; }
  .content { padding: 16px; }
  .table th, .table td { padding: 10px 14px; }
}

@media (max-width: 560px) {
  .stats { grid-template-columns: 1fr; gap: 12px; }
  h1 { font-size: 20px; }
  .card { padding: 16px; }
  .range { width: 100%; }
  .range a, .range button { flex: 1; text-align: center; padding: 6px 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
}

/* A script to copy (Data sources > Automatic updates) and the steps under it. */
textarea.code { width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); font: 12.5px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre; overflow: auto; resize: vertical; }
ol.steps { margin: 0 0 12px; padding-left: 20px; display: grid; gap: 8px; }
