/* ============================================================
   Tapify — back office
   A control surface for a workshop, not a dashboard template:
   steel greys, one teal signal colour, dense rows over fat cards.
   ============================================================ */

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

:root {
  --paper:   #eef0f3;
  --surface: #ffffff;
  --ink:     #171c23;
  --muted:   #6a7482;
  --line:    #dfe3e9;
  --line-soft:#eaedf1;
  --signal:  #0d6b5e;
  --signal-d:#0a564b;
  --warn:    #a35c06;
  --warn-bg: #fdf6e8;
  --danger:  #a3231f;
  --danger-bg:#fdf1f0;
  --good:    #1c6b3f;
  --good-bg: #eef7f1;

  --r-sm: 6px;
  --r:    9px;
  --r-lg: 14px;
  --pad: 20px;
  --shadow-1: 0 1px 2px rgba(23,28,35,.06), 0 1px 1px rgba(23,28,35,.04);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px; line-height: 1.5;
  color: var(--ink); background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
body.centered {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 24px 16px;
}

/* ---- side rail --------------------------------------------------------
   The nav moves to a fixed left rail so the tool reads as an application,
   not a page with a header. Content then runs wide and left-aligned. */
.topbar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 232px;
  display: flex; flex-direction: column; align-items: stretch;
  gap: 22px; padding: 22px 16px;
  background: var(--ink); color: #fff; z-index: 30;
  overflow-y: auto;
}
.topbar strong {
  font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: none;
  color: #8e9aab; padding: 0 10px 16px; line-height: 1.4;
  border-bottom: 1px solid rgba(255,255,255,.09);
}
.topbar nav { display: flex; flex-direction: column; gap: 3px; align-items: stretch; }
.topbar nav .btn, .topbar nav button {
  justify-content: flex-start; width: 100%;
  padding: 9px 10px; border: none; border-radius: var(--r);
  background: transparent; color: #c3ccd9;
  font-size: 14px; font-weight: 500;
}
.topbar nav .btn:hover { background: rgba(255,255,255,.07); color: #fff; }
.topbar nav .btn.ghost:last-child,
.topbar nav .btn:last-child { margin-top: auto; }

/* ---- content ---- */
.wrap { max-width: 1120px; margin: 0; padding: 34px 40px 70px 272px; }
.wrap.split { display: flex; gap: 30px; align-items: flex-start; flex-wrap: wrap; }
.wrap.split > .panel { flex: 1 1 460px; min-width: 0; }

/* Sections are flat with a hairline, not floating boxes. */
.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: var(--pad);
}
.panel.narrow { width: 100%; max-width: 380px; box-shadow: var(--shadow-1); }
.panel h1 { margin: 0 0 18px; font-size: 22px; font-weight: 600; letter-spacing: -.025em; }
.panel h2 {
  margin: 0 0 16px; font-size: 12px; font-weight: 600; color: var(--muted);
  letter-spacing: .06em;
}

/* A real list: one surface, rows divided by hairlines. */
.cards {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.cards > .item, .cards > .panel {
  border: none; border-radius: 0; box-shadow: none;
  border-bottom: 1px solid var(--line-soft);
  padding: 16px 20px;
}
.cards > .item:last-child, .cards > .panel:last-child { border-bottom: none; }
.cards > .item:hover { background: #fafbfc; }

/* ---- forms ---- */
label { display: block; margin-bottom: 14px; font-size: 12.5px; font-weight: 500; color: var(--muted); }
label input, label select, label textarea {
  display: block; width: 100%; margin-top: 6px; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: var(--r);
  font-size: 14.5px; font-family: inherit; font-weight: 400;
  color: var(--ink); background: #fff;
  transition: border-color .12s ease, box-shadow .12s ease;
}
label input:focus, label select:focus, label textarea:focus {
  outline: none; border-color: var(--signal);
  box-shadow: 0 0 0 3px rgba(13,107,94,.13);
}
label input[readonly] { background: var(--paper); color: var(--muted); }
label small { display: block; margin-top: 5px; font-size: 12px; color: var(--muted); font-weight: 400; }
label.check { display: flex; align-items: center; gap: 8px; margin-bottom: 0; color: var(--ink); }
label.check input { width: auto; margin: 0; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid .full { grid-column: 1 / -1; }

.rowline {
  display: flex; gap: 18px; align-items: flex-end; flex-wrap: wrap;
  border-top: 1px solid var(--line-soft); padding-top: 16px; margin-top: 4px;
}
.rowline label { margin-bottom: 0; }
.rowline input[type=color] { width: 46px; height: 36px; padding: 2px; cursor: pointer; }

/* ---- buttons ---- */
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border: 1px solid var(--line); border-radius: var(--r);
  background: #fff; color: var(--ink);
  font-size: 13.5px; font-weight: 500; font-family: inherit;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .12s ease, border-color .12s ease;
}
button:hover, .btn:hover { background: var(--paper); border-color: #c9cfd8; }
button:focus-visible, .btn:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--signal); outline-offset: 2px;
}
.primary, button.primary, .btn.primary {
  background: var(--signal); border-color: var(--signal); color: #fff; font-weight: 600;
}
.primary:hover, button.primary:hover, .btn.primary:hover {
  background: var(--signal-d); border-color: var(--signal-d);
}
button.primary[type=submit] { width: 100%; margin-top: 18px; padding: 11px; }
.rowline button.primary, .filterbar button, .item button { width: auto; margin-top: 0; padding: 8px 14px; }
.btn.danger, button.danger { color: var(--danger); border-color: #e9c9c7; background: #fff; }
.btn.danger:hover, button.danger:hover { background: var(--danger-bg); border-color: #dfa9a6; }

.langpick{display:inline-flex; gap:2px; align-items:center}
.langpick .btn{padding:7px 9px; font-size:12px; font-weight:600; min-width:34px}
.topbar .langpick .btn.on{background:rgba(255,255,255,.22); color:#fff}
.wrap .langpick .btn.on{background:var(--ink); color:#fff; border-color:var(--ink)}
.topbar .btn, .topbar .btn.ghost {
  background: rgba(255,255,255,.09); color: #fff; border-color: rgba(255,255,255,.16);
}
.topbar .btn:hover { background: rgba(255,255,255,.17); border-color: rgba(255,255,255,.28); }
.wrap .btn.ghost { background: #fff; color: var(--ink); border-color: var(--line); }

/* ---- notices ---- */
.error, .ok, .warnbox {
  border-radius: var(--r); padding: 11px 13px; margin-bottom: 16px;
  font-size: 13.5px; line-height: 1.5; border: 1px solid;
}
.error   { background: var(--danger-bg); color: var(--danger); border-color: #f0d3d1; }
.ok      { background: var(--good-bg);   color: var(--good);   border-color: #cfe6d8; }
.warnbox { background: var(--warn-bg);   color: var(--warn);   border-color: #f2e0be; margin-bottom: 0; }
.warnbox a { color: var(--warn); font-weight: 600; }

.checks { list-style: none; padding: 0; margin: 0 0 18px; font-size: 14px; }
.checks li { padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.checks li:last-child { border-bottom: none; }
.checks .good { color: var(--good); }
.checks .bad  { color: var(--danger); }

/* ---- filter bar ---- */
.filterbar {
  display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap;
  padding: 0 0 16px; margin-bottom: 16px;
  background: transparent; border: none; border-radius: 0;
  border-bottom: 1px solid var(--line);
}
.filterbar label { margin-bottom: 0; flex: 0 1 auto; }
.filterbar label input, .filterbar label select { min-width: 190px; }
.filterbar .count { margin-left: auto; font-size: 12.5px; color: var(--muted); padding-bottom: 9px; }

.quota{display:flex;align-items:center;gap:18px;flex-wrap:wrap;
  background:var(--surface);border:1px solid var(--line);border-radius:var(--r-lg);
  padding:16px 20px;margin-bottom:16px}
.quota.full{border-color:#f2e0be;background:var(--warn-bg)}
.quota-nums{font-size:26px;font-weight:600;letter-spacing:-.03em;font-variant-numeric:tabular-nums}
.quota-nums span{font-size:15px;font-weight:500;color:var(--muted);margin-left:3px}
.quota-text{flex:1 1 220px;min-width:0;line-height:1.45}
.quota-text strong{display:block;font-size:13.5px}
.quota-text span{font-size:13px;color:var(--muted)}
.quota.full .quota-text span{color:var(--warn)}
.quota-bar{flex:0 0 160px;height:6px;background:var(--line);border-radius:99px;overflow:hidden}
.quota-bar span{display:block;height:100%;background:var(--signal);border-radius:99px}
.quota.full .quota-bar span{background:var(--warn)}
@media(max-width:620px){.quota-bar{flex:1 1 100%}}

/* ---- list rows ---- */
.item {
  display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
  background: var(--surface);
}
.cards > .panel { display: block; }
.item.off, .panel.off { opacity: .58; }
.item .dot { width: 4px; height: 40px; border-radius: 2px; flex: 0 0 auto; }
.item .meta { flex: 1 1 240px; min-width: 0; }
.item .name { font-size: 14.5px; font-weight: 600; letter-spacing: -.01em; }
.item .sub  { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.item .url  { display: inline-block; margin-top: 3px; font-size: 12px; color: var(--signal); text-decoration: none; word-break: break-all; }
.item .url:hover { text-decoration: underline; }

.tag {
  display: inline-block; margin-left: 6px; padding: 2px 7px;
  border: 1px solid var(--line); border-radius: 20px;
  font-size: 10.5px; font-weight: 500; color: var(--muted);
  background: var(--paper); vertical-align: middle;
}
.stats {
  flex: 0 0 auto; text-align: right; min-width: 82px;
  font-size: 19px; font-weight: 600; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}
.stats span { display: block; font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.item .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.item .acts form { margin: 0; }

.free-ok   { color: var(--good)   !important; }
.free-full { color: var(--warn)   !important; }
.free-over { color: var(--danger) !important; }

.empty { text-align: center; padding: 34px 20px; }
.empty p { color: var(--muted); margin: 0 0 16px; }

.thumb { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); }
.thumb.logo { width: auto; max-width: 86px; height: 36px; border-radius: var(--r-sm); object-fit: contain; background: var(--paper); padding: 3px; }
.tip { font-size: 12px; color: var(--muted); flex: 1 1 150px; }
.hint { font-size: 12.5px; color: var(--muted); text-align: center; margin-top: 14px; }
.hint a { color: var(--signal); }

/* ---- password meter ---- */
.pwmeter { height: 4px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 8px 0 4px; }
.pwmeter span { display: block; height: 100%; width: 0; border-radius: 99px; transition: width .2s ease, background .2s ease; }

/* ---- phone preview ---- */
.preview { flex: 0 0 292px; margin: 0 auto; }
.phone { width: 292px; background: #0d1117; border-radius: 32px; padding: 9px; box-shadow: 0 18px 42px rgba(13,17,23,.28); }
.pcard { background: #fff; border-radius: 24px; overflow: hidden; }
.pbanner { height: 112px; background: var(--signal); display: flex; align-items: flex-start; justify-content: center; padding: 8px 12px; }
.pbanner img { max-height: 50px; max-width: 80%; object-fit: contain; }
.phead { padding: 0 18px 14px; margin-top: -44px; text-align: center; }
.pavatar { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; border: 4px solid #fff; box-shadow: 0 4px 12px rgba(15,23,42,.18); background: #eef1f5; }
.pini { display: flex; align-items: center; justify-content: center; margin: 0 auto; font-size: 27px; font-weight: 600; }
.pcard h2, .pcard h3 { font-size: 18px; margin: 10px 0 2px; letter-spacing: -.02em; }
.prole { font-size: 12.5px; color: var(--muted); margin: 0; }
.pcomp { font-size: 12.5px; font-weight: 600; margin: 2px 0 0; }
.pbio  { font-size: 12px; color: var(--muted); padding: 0 18px; margin: 8px 0 0; text-align: center; line-height: 1.5; }
.prows { padding: 4px 12px; }
.prow  { display: flex; justify-content: space-between; gap: 10px; padding: 9px 6px; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.prow:last-child { border-bottom: none; }
.prow span { color: var(--muted); font-size: 11.5px; }
.prow b { font-weight: 400; text-align: right; word-break: break-word; }
.psave { margin: 12px 14px 16px; padding: 12px; text-align: center; color: #fff; font-weight: 600; border-radius: 12px; font-size: 13.5px; }

/* ---- QR page ---- */
.qrpanel { text-align: center; }
#qrbox img, #qrbox canvas { width: 260px; height: 260px; max-width: 100%; }
.urlline { font-size: 13px; color: var(--muted); word-break: break-all; margin: 16px auto; max-width: 380px; }
.qracts { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* ---- responsive ---- */
@media (max-width: 860px) {
  .grid { grid-template-columns: 1fr; }
  .wrap.split { flex-direction: column; }
  .preview { order: -1; }
}
@media (max-width: 900px) {
  .topbar {
    position: static; width: auto; flex-direction: row; align-items: center;
    justify-content: space-between; gap: 12px; padding: 12px 18px;
    overflow: visible;
  }
  .topbar strong { border: none; padding: 0; color: #fff; font-size: 15px; letter-spacing: -.01em; }
  .topbar nav { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .topbar nav .btn {
    width: auto; background: rgba(255,255,255,.09);
    border: 1px solid rgba(255,255,255,.16);
  }
  .wrap { padding: 22px 18px 60px; }
}

@media (max-width: 620px) {
  .wrap { padding: 18px 14px 50px; }
  .panel { padding: 16px; }
  .filterbar label { flex: 1 1 100%; }
  .filterbar label input, .filterbar label select { min-width: 0; width: 100%; }
  .filterbar .count { margin-left: 0; padding-bottom: 0; }
  .item .stats { text-align: left; }
  .item .acts { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}


/* ============================================================
   Right to left (Arabic). Only the customer-facing pages carry
   dir="rtl"; the admin is pinned to ltr, so these rules never
   affect it.
   ============================================================ */
[dir="rtl"] { text-align: right; }

/* the rail moves to the other edge */
[dir="rtl"] .topbar { left: auto; right: 0; }
[dir="rtl"] .wrap   { padding-left: 40px; padding-right: 272px; }
[dir="rtl"] .topbar strong { text-align: right; }
[dir="rtl"] .topbar nav .btn { justify-content: flex-start; }

/* rows and stats mirror */
[dir="rtl"] .stats { text-align: left; }
[dir="rtl"] .filterbar .count { margin-left: 0; margin-right: auto; }
[dir="rtl"] .tag { margin-left: 0; margin-right: 6px; }
[dir="rtl"] .quota-nums span { margin-left: 0; margin-right: 3px; }

/* labels and hints */
[dir="rtl"] label small,
[dir="rtl"] .hint,
[dir="rtl"] .tip { text-align: right; }
[dir="rtl"] .empty { text-align: center; }

/* Numbers, e-mail addresses and URLs are latin inside arabic text.
   bdi keeps them from being reordered — without this a phone number
   renders as 49+ and a url comes out scrambled. */
[dir="rtl"] .row .v,
[dir="rtl"] .item .url,
[dir="rtl"] .urlline,
[dir="rtl"] .codeline { direction: ltr; text-align: left; unicode-bidi: isolate; }

@media (max-width: 900px) {
  [dir="rtl"] .wrap { padding-left: 18px; padding-right: 18px; }
}
