:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #1b2430;
  --muted: #6b7686;
  --line: #e3e6eb;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --ok: #15803d;
  --ok-bg: #e7f6ec;
  --warn: #a15c00;
  --warn-bg: #fdf1dc;
  --bad: #b42318;
  --bad-bg: #fdeceb;
  --off-bg: #eceef1;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
h1 { font-size: 22px; margin: 22px 0 14px; }
h2 { font-size: 16px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13.5px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.r { text-align: right; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-bottom: 48px; }

/* Kreu */
.top { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top-in { display: flex; justify-content: space-between; align-items: center; height: 50px; }
.brand { font-weight: 700; color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  padding: 9px 12px; white-space: nowrap; text-decoration: none; color: var(--muted);
  border-bottom: 2px solid transparent; font-weight: 500;
}
.tabs a.on { color: var(--accent); border-bottom-color: var(--accent); }
.link { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; padding: 6px 0; }

/* Kartat */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin: 0 0 14px; }
.card.flush { padding: 0; overflow: hidden; }
.card.narrow { max-width: 400px; margin: 9vh auto 0; }
.card.narrow.left { margin: 0 0 14px; max-width: 520px; }
.card.key { border-color: var(--accent); }
.grid2 { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
.grid2 .card { margin: 0; }
.grid2 { margin-bottom: 14px; }

.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 14px; }
.tile {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px;
  text-decoration: none; color: var(--ink); display: flex; flex-direction: column;
}
.tile .n { font-size: 28px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.tile .l { color: var(--muted); }
.tile .sub { color: var(--muted); font-size: 12.5px; }
.tile.bad .n { color: var(--bad); }

/* Tabelat */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th.r { text-align: right; }
tr:last-child td { border-bottom: 0; }
.card:not(.flush) table th:first-child, .card:not(.flush) table td:first-child { padding-left: 0; }
.card:not(.flush) table th:last-child, .card:not(.flush) table td:last-child { padding-right: 0; }
td.body { max-width: 380px; overflow-wrap: anywhere; }
td.act { white-space: nowrap; text-align: right; }
td { font-variant-numeric: tabular-nums; }

.bar { height: 4px; background: var(--off-bg); border-radius: 2px; margin-top: 4px; min-width: 70px; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 2px; }

/* Etiketat e gjendjes */
.badge, .pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.pill { font-weight: 500; }
.s-queued, .s-cancelled, .pill.off { background: var(--off-bg); color: var(--muted); }
.s-processing, .s-submitted, .s-unknown, .pill.warn { background: var(--warn-bg); color: var(--warn); }
.s-sent, .s-delivered, .pill.ok { background: var(--ok-bg); color: var(--ok); }
.s-failed { background: var(--bad-bg); color: var(--bad); }

.flash { padding: 10px 14px; border-radius: 8px; margin: 0 0 14px; background: var(--ok-bg); color: var(--ok); }
.flash.err { background: var(--bad-bg); color: var(--bad); }

/* Format */
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
input, select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 9px 10px; font: inherit; color: var(--ink);
  background: #fff; border: 1px solid #cfd4dc; border-radius: 7px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
input[type=checkbox] { display: inline-block; width: auto; margin: 0 6px 0 0; }
label.check { display: flex; align-items: center; color: var(--ink); font-size: 14px; margin: 0; white-space: nowrap; }
.btn {
  display: inline-block; padding: 9px 16px; border: 1px solid var(--accent); border-radius: 7px;
  background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn.ghost { background: transparent; color: var(--accent); border-color: #cfd4dc; }
.btn.sm { padding: 5px 11px; font-size: 13.5px; }
.btn:hover { filter: brightness(1.06); }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.filters select, .filters input { width: auto; margin: 0; flex: 1 1 170px; }
.formrow { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.formrow label { flex: 1 1 170px; margin: 0; }

.row { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.row-main { flex: 2 1 220px; min-width: 0; }
.row label.inline { flex: 1 1 130px; margin: 0; }
.row-act { display: flex; gap: 6px; }
.pager { display: flex; gap: 8px; justify-content: center; margin-top: 6px; }

/* Telefon: tabelat e gjata kthehen në karta */
@media (max-width: 720px) {
  table.stack tr:first-child { display: none; }
  table.stack tr { display: block; padding: 10px 14px; border-bottom: 1px solid var(--line); }
  table.stack tr:last-child { border-bottom: 0; }
  .card:not(.flush) table.stack tr { padding-left: 0; padding-right: 0; }
  .card:not(.flush) table.stack tr:last-child { padding-bottom: 0; }
  table.stack td { display: flex; gap: 10px; padding: 2px 0; border: 0; max-width: none; }
  table.stack td[data-l]::before { content: attr(data-l); flex: 0 0 78px; color: var(--muted); font-size: 12.5px; padding-top: 2px; }
  table.stack td.body { display: block; padding: 6px 0; }
  table.stack td.body::before { display: none; }
  table.stack td.act { justify-content: flex-start; padding-top: 6px; }
  table.stack td.act:empty { display: none; }
  .row-act { width: 100%; }
}
