:root {
  --bg: #f4f5fb;
  --card: #ffffff;
  --text: #22243a;
  --muted: #6b6f8e;
  --line: #e3e5f0;
  --teal: #2ec4b6;
  --violet: #7c5cff;
  --red: #e5484d;
  --green: #2fa36b;
  --navy: #181a30;
  color-scheme: light;
}

/* Dark: the system's choice unless the parent picked one (the theme button, data-theme on <html>). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) {
    --bg: #111223;
    --card: #1c1e36;
    --text: #eceefb;
    --muted: #9da1c4;
    --line: #2c2f4f;
    color-scheme: dark;
  }
}
:root[data-theme=dark] {
  --bg: #111223;
  --card: #1c1e36;
  --text: #eceefb;
  --muted: #9da1c4;
  --line: #2c2f4f;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}

.top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--navy);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 2;
}
.logo { width: 40px; height: 40px; }
.brand { font-weight: 700; font-size: 20px; }
.home { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.grow { flex: 1; }
.round { width: 36px; height: 36px; padding: 0; border-radius: 50%; background: #2a2d4d; color: #fff; font-size: 17px; display: inline-flex; align-items: center; justify-content: center; }
.round.avatar { background: var(--violet); font-weight: 600; font-size: 15px; }
.account-wrap { position: relative; }
.account-menu { position: absolute; right: 0; top: 44px; width: 260px; background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 14px; padding: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); display: grid; gap: 2px; z-index: 6; }
.account-head { display: flex; gap: 10px; align-items: center; padding: 6px 6px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.account-head .round { flex: none; }
.account-menu .nav-item { gap: 10px; justify-content: flex-start; }
.account-menu .out { color: var(--red); border-top: 1px solid var(--line); border-radius: 0 0 10px 10px; margin-top: 4px; }
.live { color: var(--muted); font-size: 12px; }
.live.on { color: var(--green); }

.shell { max-width: 760px; margin: 0 auto; }
main { padding: 16px; display: grid; gap: 16px; min-width: 0; align-content: start; }
body.with-nav .shell { max-width: 1180px; display: grid; grid-template-columns: 230px minmax(0, 1fr); }

/* Menu: a column on wide screens, a drawer behind ☰ on phones. */
.nav { position: sticky; top: 60px; align-self: start; display: grid; align-content: start; gap: 6px; padding: 16px 0 16px 16px; max-height: calc(100vh - 60px); overflow-y: auto; }
.nav-group { display: grid; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 10px; color: var(--text); background: none; text-decoration: none; font-size: 15px; text-align: left; }
.nav-item .label { flex: 1; }
.nav-item .icon { width: 22px; text-align: center; }
.nav-item .chevron { color: var(--muted); font-size: 12px; transition: transform .15s; }
.nav-group.open > .nav-item .chevron { transform: rotate(90deg); }
.nav-item:hover { background: var(--line); }
.nav-item.active { background: var(--violet); color: #fff; }
.nav-sub { display: grid; gap: 2px; }
.nav-sub .nav-item { padding: 6px 10px 6px 42px; font-size: 14px; color: var(--muted); }
.nav-sub .nav-item.active { color: #fff; }
.nav-child { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.nav-child .bar { height: 6px; margin: 6px 0; }
.badge { background: var(--red); color: #fff; border-radius: 999px; font-size: 12px; padding: 0 7px; }
.menu { display: none; background: none; color: #fff; font-size: 22px; padding: 4px 8px; }
.child-pick { width: auto; max-width: 180px; background: #2a2d4d; color: #fff; border-color: #3a3e66; padding: 6px 10px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.cards .wide { grid-column: 1 / -1; }
.big { font-size: 28px; font-weight: 700; }
h2[id] { scroll-margin-top: 72px; } /* below the sticky header */
.bar.thin { height: 6px; margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 4px 4px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); }
.chip .link { text-decoration: none; padding: 2px 8px; }
.chip.allowed { border-color: var(--green); }
.message { display: grid; gap: 2px; border-top: 1px solid var(--line); padding-top: 8px; font-size: 15px; }
.message .reply { padding-left: 12px; font-size: 14px; }
.card a { color: var(--violet); }

@media (max-width: 900px) {
  body.with-nav .shell { display: block; max-width: 760px; }
  .menu:not(.hidden) { display: inline-block; }
  /* align-self: stretch, or the desktop "start" makes the fixed drawer as tall as its items and cuts them off. */
  .nav { position: fixed; top: 60px; left: 0; bottom: 0; align-self: stretch; overscroll-behavior: contain; width: 270px; max-height: none; background: var(--card); border-right: 1px solid var(--line); padding: 16px; z-index: 5; transform: translateX(-105%); transition: transform .2s; }
  body.nav-open .nav { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35); }
}
@media (max-width: 600px) {
  .brand { display: none; }
  .cards { grid-template-columns: 1fr; }
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
}
.verify { max-width: 1180px; margin: 12px auto 0; padding: 10px 16px; display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; background: var(--card); border: 1px solid var(--violet); border-radius: 12px; font-size: 15px; }
@media (max-width: 1212px) { .verify { margin: 12px 16px 0; } }
.card.narrow { max-width: 420px; margin: 24px auto; width: 100%; }
.card.alert { border-color: var(--violet); }
.card h2 { margin: 0 0 8px; font-size: 18px; }
h1 { margin: 0 0 4px; font-size: 22px; }

.stack { display: grid; gap: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.muted { color: var(--muted); }
.center { text-align: center; }
.small { font-size: 14px; }
.hidden { display: none !important; }
.error { color: var(--red); min-height: 1.2em; margin: 8px 0 0; }

label { display: grid; gap: 4px; font-size: 14px; color: var(--muted); }
input, select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  width: 100%;
}
input[type=checkbox] { width: auto; }
.check { display: flex; gap: 8px; align-items: center; color: var(--text); font-size: 16px; }

button {
  font: inherit;
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  background: var(--line);
  color: var(--text);
}
button.primary { background: var(--violet); color: #fff; }
button.ok { background: var(--green); color: #fff; }
button.danger { background: var(--red); color: #fff; }
button.link { background: none; color: inherit; text-decoration: underline; padding: 4px; }
button:disabled { opacity: .5; cursor: default; }

.tabs { display: flex; gap: 6px; margin: 14px 0; }
.tab { flex: 1; }
.tab.active { background: var(--violet); color: #fff; }

.bar { height: 12px; border-radius: 6px; background: var(--line); overflow: hidden; margin: 8px 0; }
.bar > span { display: block; height: 100%; background: var(--teal); }
.bar.over > span { background: var(--red); }

.apps { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 4px; font-size: 14px; }
.apps li { display: flex; justify-content: space-between; }

.device { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.dot.on { background: var(--green); }
.device .name { flex: 1; min-width: 140px; }

.request { display: grid; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); }
.request:first-of-type { border-top: 0; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 600px) { .grid4 { grid-template-columns: 1fr 1fr; } }
.month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.month .day { border: 1px solid var(--line); border-radius: 10px; padding: 4px 6px; min-height: 52px; cursor: pointer; display: grid; align-content: space-between; }
.month .day.future { cursor: default; opacity: .5; }
.month .day.over { border: 2px solid var(--red); }
.month .day.today { outline: 2px solid var(--violet); }
@media (max-width: 480px) { .grid2 { grid-template-columns: 1fr; } }

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: var(--navy);
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  max-width: calc(100% - 32px);
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 10;
}
.overlay .card { max-width: 440px; width: 100%; }

/* Despre, Confidențialitate, Termeni: long text on its own page. */
.doc h2 { margin: 18px 0 6px; }
.doc h3 { margin: 12px 0 4px; font-size: 16px; }
.doc ul { padding-left: 20px; margin: 6px 0; display: grid; gap: 4px; }
.doc p { margin: 6px 0; }
.about-hero { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.about-hero h1 { font-size: 28px; }
.footer-links { display: flex; gap: 6px 14px; justify-content: center; flex-wrap: wrap; }
.footer-links a { color: inherit; }
a.button-link { display: inline-block; padding: 10px 14px; border-radius: 10px; background: var(--violet); color: #fff; text-decoration: none; }
.check a { color: var(--violet); }

/* Installed apps: tabs over a table; the table scrolls sideways on a phone. */
.subtabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.subtab { background: none; border-radius: 0; border-bottom: 2px solid transparent; color: var(--muted); padding: 8px 12px; white-space: nowrap; }
.subtab.active { border-color: var(--violet); color: var(--text); font-weight: 600; }
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 620px; }
table.list th { text-align: left; font-weight: 500; color: var(--muted); font-size: 13px; padding: 8px 6px; }
table.list td { border-top: 1px solid var(--line); padding: 8px 6px; vertical-align: middle; }
table.list .actions { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }
table.list .actions button { padding: 5px 9px; font-size: 13px; }
.pill { display: inline-block; font-size: 12px; padding: 0 8px; border-radius: 999px; background: var(--line); color: var(--text); }
.pill.new { background: var(--violet); color: #fff; }
.red { color: var(--red); }
.green { color: var(--green); }

/* "Părerea ta": stars and our answers */
.stars { gap: 2px; }
.star { background: none; border: 0; padding: 2px 4px; font-size: 24px; line-height: 1; color: var(--line); cursor: pointer; }
.star.on { color: #f5b301; }
.reply { background: var(--bg); border-left: 3px solid var(--violet); border-radius: 8px; padding: 8px 12px; font-size: 15px; }

/* The register form's trap field: off screen, not display:none (some scripts skip hidden fields). */
.trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
