/* Rayek — tenant pages.
   Loaded by login.html and app.html. No inline styles anywhere, because the
   Content-Security-Policy forbids them. */

:root {
  --bg: #f5f7f9;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #0f766e;
  --accent-soft: #ecfdf5;
  --danger: #b42318;
  --warn: #b45309;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; }

.wrap { max-width: 780px; margin: 0 auto; padding: 0 18px 72px; }

/* ---------------------------------------------------------------- header */

header {
  position: sticky; top: 0; z-index: 5;
  background: rgba(245, 247, 249, .92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.bar {
  max-width: 780px; margin: 0 auto; padding: 14px 18px;
  display: flex; align-items: center; gap: 14px;
}

.brand { font-weight: 700; font-size: 18px; letter-spacing: -.02em; }

.dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #cbd5e1; display: inline-block; margin-right: 7px;
}
.dot.on { background: #10b981; box-shadow: 0 0 0 3px #10b98122; }

.spacer { flex: 1; }

.who {
  color: var(--muted); font-size: 13px; max-width: 190px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.link {
  background: none; border: 0; color: var(--muted);
  cursor: pointer; padding: 6px 8px; border-radius: 8px;
}
.link:hover { background: #e8edf2; color: var(--ink); }

nav { display: flex; gap: 6px; padding: 14px 0 0; flex-wrap: wrap; }

nav button {
  border: 1px solid transparent; background: none; color: var(--muted);
  padding: 7px 13px; border-radius: 999px; cursor: pointer; font-size: 14px;
}
nav button.active {
  background: var(--card); border-color: var(--line);
  color: var(--ink); font-weight: 600;
}

/* ---------------------------------------------------------------- cards */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.code {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 18px; margin-top: 12px;
}

.code.just-arrived { animation: pop .5s ease-out; }

@keyframes pop {
  from { transform: scale(.985); box-shadow: 0 0 0 3px #0f766e33; }
  to   { transform: none;       box-shadow: none; }
}

.digits {
  font: 600 30px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .14em; color: var(--accent); white-space: nowrap;
}

.code.expired .digits {
  color: #94a3b8;
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

.meta { flex: 1; min-width: 0; }

.meta .top { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }

.sender {
  font-weight: 600; font-size: 13px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 300px;
}

.phone { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

.sub {
  color: var(--muted); font-size: 12px; margin-top: 3px;
  font-variant-numeric: tabular-nums;
}

.count { font-variant-numeric: tabular-nums; }
.count.low  { color: var(--warn); }
.count.gone { color: var(--danger); }

.actions { display: flex; gap: 6px; }

.icon {
  border: 1px solid var(--line); background: #fff; border-radius: 9px;
  width: 38px; height: 38px; display: grid; place-items: center;
  cursor: pointer; color: var(--muted);
}
.icon:hover { background: #f8fafc; color: var(--ink); }
.icon.ok { background: var(--accent-soft); border-color: #a7f3d0; color: var(--accent); }

.empty { text-align: center; padding: 64px 20px; color: var(--muted); }
.empty .big { font-size: 15px; color: var(--ink); font-weight: 600; margin-bottom: 6px; }

/* ---------------------------------------------------------------- forms */

form.stack { display: grid; gap: 12px; margin-top: 16px; }

label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }

input {
  font: inherit; padding: 11px 13px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; color: var(--ink); width: 100%;
}
input:focus { outline: 2px solid #0f766e33; border-color: var(--accent); }

.btn {
  border: 0; border-radius: 10px; padding: 11px 16px;
  background: var(--accent); color: #fff; font-weight: 600; cursor: pointer;
}
.btn:disabled { opacity: .55; cursor: default; }
.btn.ghost { background: #fff; border: 1px solid var(--line); color: var(--ink); }
.btn.small { padding: 7px 11px; font-size: 13px; }
.btn.danger { background: #fff; border: 1px solid #fecaca; color: var(--danger); }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.hint { color: var(--muted); font-size: 12px; }
.err  { color: var(--danger); font-size: 13px; min-height: 18px; }

.pad { padding: 18px; }

.sect { margin-top: 26px; }

.sect h2 {
  font-size: 12px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); margin: 0 0 10px 2px;
}

.list { display: grid; gap: 10px; }

.item { display: flex; align-items: center; gap: 12px; padding: 13px 16px; }
.item .grow { flex: 1; min-width: 0; }

.mono {
  font: 13px ui-monospace, SFMono-Regular, Menlo, monospace;
  word-break: break-all;
}

.pill {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: #f1f5f9; color: var(--muted);
}
.pill.live { background: var(--accent-soft); color: var(--accent); }
.pill.dead { background: #fef2f2; color: var(--danger); }

.note {
  padding: 12px; border-radius: 9px; background: #f8fafc;
  border: 1px solid var(--line);
}

.reveal {
  margin-top: 12px; padding: 14px; border-radius: 10px;
  border: 1px solid #a7f3d0; background: var(--accent-soft);
}
.reveal .warn { color: var(--accent); font-weight: 600; font-size: 12px; }
.reveal .mono { margin: 10px 0; font-size: 14px; }

/* ---------------------------------------------------------------- login */

.login { max-width: 380px; margin: 14vh auto 0; }
.login h1 { font-size: 26px; margin: 0 0 6px; letter-spacing: -.02em; }
.login p { color: var(--muted); margin: 0; }

/* ---------------------------------------------------------------- toast */

#toast {
  position: fixed; left: 50%; bottom: 24px;
  transform: translate(-50%, 20px); opacity: 0;
  background: #0f172a; color: #fff; padding: 10px 16px;
  border-radius: 10px; font-size: 13px;
  transition: .25s; pointer-events: none; z-index: 20;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------------------------------------------------------- misc */

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }

@media (max-width: 560px) {
  .digits { font-size: 25px; }
  .sender { max-width: 150px; }
  .code { gap: 10px; padding: 14px; }
  .field-row { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------- utilities
   These exist because the Content-Security-Policy forbids inline style
   attributes. A layout tweak is a class, never a style="" in a template. */

.strong { font-weight: 600; }
.big    { font-size: 14px; }
.mt     { margin-top: 10px; }
.mt0    { margin-top: 0; }
.mb     { margin-bottom: 8px; }
.tight  { margin: -4px 0 12px; }
.spaced { margin-top: 14px; }
.sect.first { margin-top: 18px; }
