/* Peite site theme: dark navy, glass-style panels, blue/green/violet
   accents, white pill primary actions. Public auth pages use a centred
   .card; the private area uses the sidebar shell (.shell-grid). */

:root {
  color-scheme: dark;
  --bg: #070b14;
  --bg-soft: #0a101c;
  --panel: #0d1524;
  --panel-2: #111b2e;
  --field: #0a1220;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.15);
  --text: #eef2f8;
  --muted: #8b96a9;
  --dim: #657084;
  --primary: #f4f7fb;
  --link: #7aa2ff;
  --accent: #4f8cff;
  --ok: #34d399;
  --err: #f87171;
  --violet: #a78bfa;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  color: var(--text);
  font-family: Inter, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background:
    radial-gradient(1100px 560px at 88% -8%, rgba(79, 140, 255, 0.14), transparent 60%),
    radial-gradient(900px 520px at -8% 108%, rgba(139, 92, 246, 0.11), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}

a { color: var(--link); }

/* ---------- brand ---------- */

a.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  color: var(--text);
  text-decoration: none;
  width: fit-content;
}
.brand .logo { width: 34px; height: 17px; flex: none; }
.brand h1, .brand span { font-size: 20px; font-weight: 600; margin: 0; letter-spacing: -0.01em; color: inherit; }

/* ---------- centred card (register / login) ---------- */

.card {
  width: 100%;
  max-width: 400px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent), var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
  padding: 34px 30px;
}

h2.step-title { font-size: 17px; font-weight: 600; margin: 0 0 6px; letter-spacing: -0.01em; }
p.step-note { font-size: 13.5px; line-height: 1.55; color: var(--muted); margin: 0 0 18px; }

.list-title { margin-top: 30px !important; padding-top: 26px; border-top: 1px solid var(--line); }

/* ---------- form controls ---------- */

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }

input[type="email"], input[type="text"], input[type="date"], input[type="password"], select {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--field);
}
input::placeholder { color: var(--dim); }

select {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%238b96a9' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.22);
}

button {
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.15s ease, background 0.15s ease;
}
button:disabled { opacity: 0.5; cursor: default; }

button.primary { background: var(--primary); color: #0a101c; }
button.primary:hover:not(:disabled) { background: #fff; }

button.link-btn, a.link-btn {
  width: auto;
  background: none;
  border: none;
  color: var(--link);
  font-weight: 500;
  padding: 10px 0 0;
  font-size: 13px;
  text-decoration: none;
}
button.link-btn:hover, a.link-btn:hover { text-decoration: underline; }
a.link-btn { display: block; }

a.btn-link.primary {
  display: block;
  text-align: center;
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--primary);
  color: #0a101c;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  margin-bottom: 4px;
}

.status { min-height: 18px; font-size: 13px; margin-top: 10px; line-height: 1.4; }
.status.error { color: var(--err); }
.status.ok { color: var(--ok); }

.row { display: flex; gap: 12px; }
.row .field { flex: 1; min-width: 0; }

.hidden { display: none !important; }

.success-icon {
  width: 52px; height: 52px; border-radius: 50%;
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.3);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
}
.success-icon svg { width: 24px; height: 24px; }
.success-icon svg path { stroke: var(--ok); }
.success-box { text-align: center; }
.success-box h2 { font-size: 18px; margin: 0 0 8px; }
.success-box p { font-size: 13.5px; color: var(--muted); line-height: 1.55; margin: 0 0 18px; }

.footer-note { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--dim); line-height: 1.55; }
.footer-note a { color: var(--muted); }

/* ---------- private area shell ---------- */

body.shell { display: block; padding: 0; }

.shell-grid { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  padding: 24px 14px 18px;
  background: rgba(10, 16, 28, 0.85);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.sidebar a.brand { margin: 0 10px 28px; }

.side-nav { display: grid; gap: 4px; }
.side-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  color: var(--muted); font-size: 14px; text-decoration: none;
}
.side-nav a:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.side-nav a.active { color: var(--text); background: rgba(255, 255, 255, 0.09); }
.side-nav svg, .signout-btn svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.side-tagline { margin-top: auto; padding: 20px 10px; text-align: center; color: var(--muted); font-size: 13px; line-height: 1.55; }
.side-tagline .logo { display: block; margin: 8px auto 0; width: 26px; height: 13px; opacity: 0.6; }

.side-user { display: flex; align-items: center; gap: 10px; padding: 14px 6px 0; border-top: 1px solid var(--line); }
.avatar {
  width: 34px; height: 34px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700; color: #fff; text-transform: uppercase;
  background: linear-gradient(135deg, #4f8cff, #8b5cf6);
}
.side-user .who { flex: 1; min-width: 0; font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.signout-btn { width: auto; padding: 8px; background: none; color: var(--muted); border-radius: 8px; line-height: 0; }
.signout-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }

main.shell-main { padding: 30px 38px 44px; max-width: 1200px; width: 100%; }

.page-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 22px; }
.page-top h1 { font-size: 24px; margin: 0 0 6px; letter-spacing: -0.02em; }
.page-top p { margin: 0; color: var(--muted); font-size: 14px; }
.top-meta { color: var(--muted); font-size: 13px; white-space: nowrap; padding-top: 6px; }

.panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent), var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 26px 28px;
}
.shell-main .footer-note { margin-top: 20px; border-top: none; padding-top: 0; }

a.back-link { display: inline-block; margin-bottom: 14px; font-size: 13px; text-decoration: none; }

/* ---------- tables ---------- */

.table-wrap { overflow-x: auto; }
table.hist { width: 100%; border-collapse: collapse; font-size: 13px; }
table.hist th {
  text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--dim); padding: 8px 10px; border-bottom: 1px solid var(--line);
}
table.hist td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--text); }
table.hist tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
table.hist td.when, table.hist td.time { white-space: nowrap; color: var(--muted); }
table.hist td a { color: var(--link); text-decoration: none; overflow-wrap: anywhere; }
table.hist td a:hover { text-decoration: underline; }
table.hist .dom { font-size: 11.5px; color: var(--dim); }
table.hist td.num, table.hist th.num { text-align: right; white-space: nowrap; }

.table-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 22px; }
.table-head h2 { margin: 0 0 8px; }
.table-head a { font-size: 13px; color: var(--link); text-decoration: none; }

.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.pager button.link-btn:disabled { opacity: 0.35; }
.page-info { font-size: 12px; color: var(--dim); }

pre.analysis {
  white-space: pre-wrap; font-family: inherit; font-size: 13.5px; line-height: 1.6;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px; margin: 14px 0 0; color: var(--text);
}

/* ---------- daily browsing time chart ---------- */

.daily-chart { margin-bottom: 6px; }
.daily-chart .summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 14px 0; }
.daily-chart .stat { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.daily-chart .stat .label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.daily-chart .stat .value { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }

.chart-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; padding: 16px 16px 8px; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.legend .swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend .swatch.bar { background: var(--accent); }
.legend .swatch.trend { background: var(--violet); }

.chart-wrap { position: relative; width: 100%; overflow-x: auto; }
#dailyChart { width: 100%; height: 260px; display: block; }
#dailyChart .grid-line { stroke: rgba(255, 255, 255, 0.07); }
#dailyChart .axis-text { fill: var(--dim); }

.tooltip {
  position: absolute; pointer-events: none; z-index: 10;
  background: #1b263b; border: 1px solid var(--line-strong); color: var(--text);
  font-size: 12px; padding: 7px 10px; border-radius: 8px;
  transform: translate(-50%, -110%); white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.tooltip .t-date { opacity: 0.65; margin-bottom: 2px; }
.tooltip .t-val { font-weight: 700; }
.empty-msg { text-align: center; color: var(--muted); padding: 40px 0; font-size: 13px; }

/* ---------- plan cards (pricing page + private /account/plan) ---------- */

.plan-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  align-items: stretch;
}

.plan-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent), var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px 24px;
}

.plan-card-featured {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 24px 60px rgba(79, 140, 255, 0.16);
}

.plan-badge {
  position: absolute;
  top: -12px;
  left: 24px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 999px;
}

.plan-card-current {
  border-color: var(--ok);
  box-shadow: 0 0 0 1px var(--ok), 0 24px 60px rgba(52, 211, 153, 0.14);
}

.plan-badge-current { background: var(--ok); color: #06281d; }

.plan-card h2 { margin: 0 0 6px; font-size: 19px; letter-spacing: -0.01em; }

.plan-price { display: flex; align-items: baseline; gap: 4px; margin-bottom: 4px; }
.plan-price .amount { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; }
.plan-price .period { color: var(--muted); font-size: 14px; }

.plan-note { color: var(--muted); font-size: 13px; margin: 0 0 18px; }

.plan-features { list-style: none; margin: 0 0 24px; padding: 0; display: grid; gap: 10px; flex: 1; }
.plan-features li { font-size: 13.5px; color: var(--text); line-height: 1.4; padding-left: 22px; position: relative; }
.plan-features li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(52, 211, 153, 0.16);
  box-shadow: inset 0 0 0 1px rgba(52, 211, 153, 0.4);
}
.plan-features li strong { color: var(--text); }

.plan-cta {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.plan-cta:hover:not(:disabled) { background: rgba(255, 255, 255, 0.05); }
.plan-cta.primary { background: var(--primary); color: #0a101c; border-color: transparent; }
.plan-cta.primary:hover:not(:disabled) { background: #fff; }
.plan-cta:disabled { opacity: 0.5; cursor: default; }

/* ---------- private /account/plan page ---------- */

.plan-loading { color: var(--muted); font-size: 14px; padding: 8px 0; }

.plan-current { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.plan-current-name { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.plan-current-note { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.usage-bar-wrap { margin-bottom: 8px; }
.usage-bar-track { height: 8px; border-radius: 999px; background: var(--field); overflow: hidden; }
.usage-bar-fill { height: 100%; border-radius: 999px; background: var(--accent); transition: width 0.2s ease; }
.usage-bar-fill.usage-bar-full { background: var(--err); }
.usage-bar-label { margin-top: 8px; font-size: 12.5px; color: var(--muted); }

.plan-grid-compact .plan-card { padding: 22px 20px; }
.plan-grid-compact .plan-price .amount { font-size: 26px; }

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .shell-grid { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 16px; border-right: none; border-bottom: 1px solid var(--line); }
  .sidebar a.brand { margin: 0 8px 0 0; }
  .side-nav { display: flex; flex-wrap: wrap; flex: 1; }
  .side-tagline { display: none; }
  .side-user { border-top: none; padding: 0; margin-left: auto; }
  .side-user .who { display: none; }
  main.shell-main { padding: 22px 16px 36px; }
  .panel { padding: 20px 18px; }
  .page-top { flex-direction: column; }
  .plan-grid { grid-template-columns: 1fr; max-width: 420px; }
}

@media (max-width: 560px) {
  .daily-chart .summary { grid-template-columns: 1fr; }
  .row { flex-direction: column; gap: 0; }
  .card { padding: 28px 22px; }
}
