/* Styles for the logged-in dashboard and account pages. */
:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1d1e22;
  --muted: #5f6470;
  --border: #dcdfe5;
  --primary: #1f5fbf;
  --primary-dark: #174a96;
  --danger: #c0392b;
  --success-bg: #e6f6ea;
  --success-text: #1d6b33;
  --error-bg: #fdecea;
  --error-text: #9b2c22;
  --info-bg: #e8f0fc;
  --info-text: #1b4a8f;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.5; font-size: 16px;
}
a { color: var(--primary); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }

.topbar {
  background: var(--card); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; padding: 10px 16px; flex-wrap: wrap;
}
.topbar .brand img { height: 32px; display: block; }
.topbar .spacer { flex: 1; }
.topbar a { white-space: nowrap; }
.topbar a.plain { color: var(--muted); text-decoration: none; font-size: .95rem; }
.topbar a.plain:hover { color: var(--text); text-decoration: underline; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 20px 16px 48px; }
.narrow { max-width: 460px; margin: 40px auto; padding: 0 16px; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

.alert { border-radius: 10px; padding: 12px 14px; margin-bottom: 16px; }
.alert-success { background: var(--success-bg); color: var(--success-text); }
.alert-error { background: var(--error-bg); color: var(--error-text); }
.alert-info { background: var(--info-bg); color: var(--info-text); }

label { font-weight: 600; display: block; margin-bottom: 4px; }
.field { margin-bottom: 16px; }
.hint { font-size: .85rem; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=url], textarea, select {
  width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--text);
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: var(--primary); }
textarea { resize: vertical; min-height: 90px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; padding: 10px 18px; border-radius: 8px; border: 1px solid transparent;
  background: var(--primary); color: #fff; cursor: pointer; text-decoration: none; min-height: 44px;
}
.btn:hover { background: var(--primary-dark); }
.btn.secondary { background: #fff; color: var(--text); border-color: var(--border); }
.btn.secondary:hover { background: #f0f1f4; }
.btn.danger { background: #fff; color: var(--danger); border-color: var(--border); }
.btn.small { padding: 6px 12px; min-height: 36px; font-size: .9rem; }
.btn.block { width: 100%; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 8px; border: 1px solid var(--border); background: #fff; cursor: pointer;
  font-size: 1.05rem; color: var(--muted); display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { color: var(--text); background: #f0f1f4; }
.icon-btn:disabled { opacity: .35; cursor: default; }

/* Dashboard layout */
.dash { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
@media (max-width: 900px) { .dash { grid-template-columns: minmax(0, 1fr); } }

.share { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.share .url { font-weight: 600; font-size: 1.1rem; word-break: break-all; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tabs a {
  padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap;
}
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }
.tabs a:hover { color: var(--text); }

.link-row {
  display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 12px; border: 1px solid var(--border);
  border-radius: 10px; margin-bottom: 10px; background: #fafbfc;
}
.link-row .inputs { display: grid; gap: 6px; }
.link-row .controls { display: flex; flex-direction: column; gap: 4px; }
@media (min-width: 560px) { .link-row .controls { flex-direction: row; align-items: start; } }
.link-row input[name="title[]"] { font-weight: 600; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 16px; }
.chip {
  border: 1px solid var(--border); background: #fff; border-radius: 999px; padding: 6px 12px; font: inherit; font-size: .9rem; cursor: pointer;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }

.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(110px, 100%), 1fr)); gap: 10px; }
.theme-opt { position: relative; }
.theme-opt input { position: absolute; opacity: 0; }
.theme-opt span {
  display: block; border: 2px solid var(--border); border-radius: 10px; padding: 10px; text-align: center; cursor: pointer; font-weight: 600; font-size: .9rem;
}
.theme-opt .swatch { display: block; height: 54px; border-radius: 6px; margin-bottom: 6px; position: relative; }
.theme-opt .swatch i { position: absolute; left: 12%; right: 12%; height: 10px; border-radius: 4px; }
.theme-opt input:checked + span { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary) inset; }
.theme-opt input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }

.colours { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr)); gap: 12px; }
.colours input[type=color] { width: 100%; height: 44px; border: 1px solid var(--border); border-radius: 8px; padding: 2px; background: #fff; }

.avatar-row { display: flex; align-items: center; gap: 16px; }
.avatar-row img, .avatar-row .placeholder { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; background: #e3e5ea; flex: none; }

.phone {
  border: 10px solid #1d1e22; border-radius: 32px; overflow: hidden; height: 640px; background: #fff; position: sticky; top: 16px;
}
.phone iframe { width: 100%; height: 100%; border: 0; display: block; }
@media (max-width: 900px) { .phone { height: 420px; position: static; } }

.qr { display: flex; gap: 16px; align-items: center; }
.qr #qrcode img, .qr #qrcode canvas { width: 120px; height: 120px; }

.plan-list { padding-left: 1.2em; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.counter { font-size: .9rem; color: var(--muted); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Phone box banner used at the top of account and information pages */
.banner {
  background: linear-gradient(rgba(12, 18, 36, .55), rgba(12, 18, 36, .7)), url("/images/phone-box.jpg") center 62% / cover;
  color: #fff; text-align: center; padding: 44px 16px 96px;
}
.banner h1 { color: #fff; font-size: clamp(1.6rem, 4vw, 2.3rem); margin: 0; }
.banner p { color: #e3e8f2; margin: 8px auto 0; max-width: 36em; }
.banner + .narrow, .banner + .prose, .banner + main > .narrow, .banner + main > .prose { margin-top: -64px; position: relative; }
.prose { max-width: 780px; margin: 40px auto; padding: 0 16px; }
.prose .card { padding: 28px; }
.prose h2 { margin-top: 1.4em; font-size: 1.15rem; }
.prose h2:first-child { margin-top: 0; }
.topbar .btn.small { color: #fff; }
.site-footer { text-align: center; padding: 24px 16px 40px; }
.site-footer a { margin: 0 8px; color: var(--muted); }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: normal; }
.check input { margin-top: 5px; width: auto; }
.inline-check { font-weight: normal; display: inline-flex; gap: 6px; align-items: center; margin-left: 8px; }

/* Statistics tab */
.stats-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.stats-head h2 { margin: 0; }
.range { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.range a { padding: 6px 12px; font-size: .875rem; text-decoration: none; color: var(--muted); font-weight: 600; }
.range a + a { border-left: 1px solid var(--border); }
.range a.active { background: var(--info-bg); color: var(--primary); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.tile .num { font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
.chart { width: 100%; height: auto; display: block; margin-bottom: 8px; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 12px; }
.chart .bar path { fill: var(--primary); }
.chart .bar .hit { fill: transparent; }
.chart .bar:hover .hit { fill: rgba(31, 95, 191, .08); }
.chart .bar:hover path { fill: var(--primary-dark); }
.stats-table { border-collapse: collapse; margin: 8px 0; min-width: 220px; }
.stats-table th, .stats-table td { text-align: left; padding: 4px 16px 4px 0; border-bottom: 1px solid var(--border); }
.stats-table td:last-child, .stats-table th:last-child { text-align: right; padding-right: 0; }
.click-list { list-style: none; padding: 0; margin: 0 0 12px; }
.click-list li { margin-bottom: 12px; }
.click-label { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.click-label span { overflow-wrap: anywhere; }
.click-track { background: #eef0f3; border-radius: 4px; height: 8px; }
.click-bar { background: var(--primary); border-radius: 4px; height: 8px; min-width: 2px; }
