:root {
  color-scheme: dark;
  --bg: #080a0f;
  --panel: #10151d;
  --panel-2: #151c26;
  --line: rgba(255,255,255,.1);
  --text: #f6f7f9;
  --muted: #9ca8b8;
  --accent: #4dd7b0;
  --accent-2: #79a8ff;
  --danger: #ff6b7a;
  --warning: #f5c15d;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 18% -10%, rgba(77,215,176,.24), transparent 28%),
              linear-gradient(135deg, #080a0f 0%, #111722 48%, #07090d 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.light-theme {
  color-scheme: light;
  --bg: #f7f9fb;
  --panel: #ffffff;
  --panel-2: #f1f5f9;
  --line: rgba(15,23,42,.12);
  --text: #101827;
  --muted: #64748b;
  --accent: #0f766e;
  --accent-2: #2563eb;
  --danger: #dc2626;
  --warning: #b45309;
  background: linear-gradient(180deg, #ffffff 0%, #f7f9fb 48%, #eef3f6 100%);
}

button, input, textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

a {
  color: var(--accent);
  text-decoration: none;
}

.hidden { display: none !important; }

.auth-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  align-items: center;
  gap: 56px;
  padding: 56px clamp(24px, 7vw, 96px);
}

.auth-copy {
  max-width: 680px;
  animation: rise .45s ease both;
}

.brand-line {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-weight: 700;
}

.brand-line span,
.brand span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 7px;
  background: var(--accent);
  color: #05110d;
  font-weight: 900;
}

.auth-copy h1 {
  margin: 28px 0 16px;
  max-width: 760px;
  font-size: clamp(44px, 7vw, 88px);
  line-height: .92;
  letter-spacing: 0;
}

.auth-copy p {
  margin: 0;
  max-width: 560px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.75;
}

.auth-panel {
  border: 1px solid var(--line);
  background: rgba(16,21,29,.84);
  backdrop-filter: blur(18px);
  border-radius: 8px;
  padding: 22px;
  box-shadow: 0 22px 70px rgba(0,0,0,.34);
  animation: rise .55s ease .06s both;
}

body.light-theme .auth-panel,
body.light-theme .rail,
body.light-theme .settings-block,
body.light-theme .account-panel,
body.light-theme .expired-panel,
body.light-theme .project {
  background: rgba(255,255,255,.92);
  box-shadow: 0 18px 46px rgba(15,23,42,.08);
}

body.light-theme input,
body.light-theme select {
  background: #fff;
}

body.light-theme .auth-tab.active {
  background: #101827;
  color: #fff;
}

body.light-theme .brand-line span,
body.light-theme .brand span,
body.light-theme .auth-form button,
body.light-theme .stack-form button,
body.light-theme .primary,
body.light-theme .renew-form button,
body.light-theme .register-purchase-form button {
  color: #fff;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border-radius: 7px;
  background: rgba(255,255,255,.06);
}

.auth-tab {
  min-height: 42px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

.auth-tab.active {
  background: #fff;
  color: #0a0d12;
}

.auth-form,
.stack-form {
  display: none;
  gap: 14px;
  margin-top: 18px;
}

.auth-form.active,
.stack-form {
  display: grid;
}

.register-purchase {
  display: none;
  gap: 12px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.register-purchase.active {
  display: grid;
}

.register-purchase-head {
  display: grid;
  gap: 4px;
}

.register-purchase-head strong {
  font-size: 15px;
}

.register-purchase-head span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.register-purchase-products {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.register-purchase-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  gap: 10px;
  align-items: end;
}

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

input,
select {
  width: 100%;
  min-height: 44px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.07);
  color: var(--text);
  padding: 0 13px;
  outline: none;
}

input:focus {
  border-color: rgba(77,215,176,.72);
}

.auth-form button,
.stack-form button,
.primary,
.renew-form button,
.register-purchase-form button {
  min-height: 44px;
  border-radius: 7px;
  background: var(--accent);
  color: #03110c;
  font-weight: 800;
}

.form-message {
  min-height: 22px;
  margin-top: 12px;
  color: var(--warning);
  font-size: 13px;
}

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

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: rgba(8,10,15,.78);
  backdrop-filter: blur(18px);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: var(--muted);
}

.rail nav {
  display: grid;
  gap: 8px;
}

.nav,
.logout,
.ghost {
  min-height: 42px;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  padding: 0 12px;
}

.nav.active {
  background: rgba(77,215,176,.14);
  color: var(--text);
}

.logout {
  margin-top: auto;
  color: var(--danger);
}

.main {
  min-width: 0;
  padding: 30px clamp(18px, 3vw, 42px) 56px;
}

.top {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.top h1 {
  margin: 0 0 8px;
  font-size: clamp(30px, 4vw, 52px);
  letter-spacing: 0;
}

.top p {
  margin: 0;
  color: var(--muted);
}

.top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.expire-badge {
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 12px;
  color: var(--muted);
  background: rgba(255,255,255,.05);
}

.notify-prompt {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin: 0 0 18px;
  padding: 14px;
  border: 1px solid rgba(77,215,176,.34);
  border-radius: 8px;
  background: rgba(77,215,176,.1);
}

.notify-prompt strong {
  display: block;
  margin-bottom: 4px;
}

.notify-prompt p {
  margin: 0;
  color: var(--muted);
}

.notify-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
}

.toast-host {
  position: fixed;
  right: 18px;
  top: 18px;
  z-index: 50;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 28px));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 14px;
  color: var(--text);
  background: rgba(16,21,29,.96);
  box-shadow: 0 18px 50px rgba(0,0,0,.28);
}

.toast strong,
.toast span {
  display: block;
}

.toast span {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.45;
}

body.light-theme .toast {
  background: rgba(255,255,255,.98);
  box-shadow: 0 18px 42px rgba(15,23,42,.14);
}

body.modal-open {
  overflow: hidden;
}

.announcement-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(3,7,18,.68);
  backdrop-filter: blur(12px);
}

.announcement-dialog {
  width: min(560px, 100%);
  max-height: min(720px, calc(100svh - 32px));
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 10px;
  background: rgba(16,21,29,.98);
  color: var(--text);
  box-shadow: 0 28px 90px rgba(0,0,0,.46);
  animation: modalRise .18s ease both;
}

body.light-theme .announcement-dialog {
  border-color: rgba(15,23,42,.12);
  background: rgba(255,255,255,.98);
  box-shadow: 0 28px 80px rgba(15,23,42,.18);
}

.announcement-dialog-body {
  position: relative;
  min-height: 0;
  overflow: auto;
  padding: 26px 26px 20px;
}

.announcement-x {
  position: sticky;
  top: 0;
  float: right;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin: -8px -8px 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.08);
  color: var(--text);
  font-size: 24px;
  line-height: 1;
}

.announcement-x:focus-visible,
.announcement-dialog-actions button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.announcement-dialog h2 {
  margin: 0 48px 14px 0;
  font-size: 26px;
  line-height: 1.2;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.announcement-dialog img {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  margin: 6px 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.announcement-dialog p {
  clear: both;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.75;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.announcement-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(16,21,29,.98);
}

body.light-theme .announcement-dialog-actions {
  background: rgba(255,255,255,.98);
}

.ghost {
  text-align: center;
  border: 1px solid var(--line);
  color: var(--text);
}

.wide {
  width: 100%;
}

.view {
  display: none;
}

.view.active {
  display: block;
  animation: rise .28s ease both;
}

.project-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 14px;
  margin: 0 0 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.045);
}

body.light-theme .project-toolbar {
  background: rgba(255,255,255,.78);
}

.project-search {
  flex: 1 1 360px;
  min-width: 0;
}

.project-search label,
.project-pager label {
  gap: 6px;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}

.search-row button,
.project-page-actions button {
  white-space: nowrap;
  text-align: center;
}

.project-pager {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 10px;
  flex: 0 0 auto;
}

.project-pager select {
  width: 84px;
  min-height: 42px;
}

.project-page-summary {
  min-height: 42px;
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.project-page-actions {
  display: flex;
  gap: 8px;
}

.project-page-actions button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.project-list {
  display: grid;
  gap: 14px;
}

.project {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 184px;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  background: rgba(16,21,29,.78);
  border-radius: 8px;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

.project,
.project > *,
.project-head > div,
.analysis,
.analysis-grid,
.side {
  min-width: 0;
  max-width: 100%;
}

.project:hover {
  transform: translateY(-2px);
  border-color: rgba(77,215,176,.32);
  background: rgba(19,26,36,.9);
}

body.light-theme .project:hover {
  border-color: rgba(15,118,110,.28);
  background: #fff;
}

.project-head {
  display: flex;
  gap: 13px;
  min-width: 0;
}

.avatar {
  width: 50px;
  height: 50px;
  border-radius: 8px;
  flex: 0 0 auto;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid;
  place-items: center;
  color: #07100d;
  font-weight: 900;
  object-fit: cover;
}

.project h2 {
  margin: 0 0 8px;
  font-size: 20px;
  letter-spacing: 0;
}

.links,
.meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  color: var(--muted);
  font-size: 13px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.links > *,
.meta-line > * {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.analysis {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.analysis strong {
  color: var(--accent);
}

.analysis p {
  margin: 7px 0 0;
  color: #dce4ee;
  line-height: 1.7;
}

body.light-theme .analysis p {
  color: #243244;
}

.analysis-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.analysis-grid div,
.side-stat {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
  background: rgba(255,255,255,.04);
}

.analysis-grid span,
.side-stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.analysis-grid b,
.side-stat b {
  font-weight: 700;
  color: var(--text);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.side {
  display: grid;
  gap: 10px;
  align-content: start;
}

.refresh-ai {
  min-height: 38px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: rgba(77,215,176,.12);
  color: var(--text);
  font-weight: 800;
}

.refresh-ai:disabled {
  cursor: wait;
  opacity: .7;
}

.launch-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  border-left: 1px solid var(--line);
  background: rgba(8,10,15,.62);
  backdrop-filter: blur(18px);
  padding: 30px 18px 24px;
}

body.light-theme .launch-sidebar,
body.light-theme .launch-card {
  background: rgba(255,255,255,.88);
}

body.light-theme .launch-card {
  box-shadow: 0 18px 46px rgba(15,23,42,.08);
}

.launch-side-head {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.launch-side-head h2 {
  margin: 0;
  font-size: 19px;
  line-height: 1.2;
}

.launch-side-head p,
.launch-meta {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.launch-side-head select {
  width: 100%;
  min-height: 38px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.07);
  color: var(--text);
  padding: 0 8px;
  outline: none;
}

body.light-theme .launch-side-head select {
  background: #fff;
}

.launch-side-list {
  display: grid;
  gap: 0;
}

.launch-side-item {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  padding: 11px 0;
  border-top: 1px solid var(--line);
  color: var(--text);
}

.launch-side-item:first-child {
  border-top: 0;
}

.launch-side-item:hover {
  text-decoration: none;
  background: rgba(77,215,176,.06);
}

.launch-side-item .avatar {
  width: 36px;
  height: 36px;
  border-radius: 7px;
}

.launch-side-item strong,
.launch-side-item span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.launch-side-item strong {
  font-size: 13px;
  color: var(--text);
}

.launch-side-item span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.launch-side-item b,
.confidence {
  font-weight: 850;
}

.launch-side-item b.high,
.confidence.high { color: var(--danger); }
.launch-side-item b.mid,
.confidence.mid { color: var(--warning); }
.launch-side-item b.low,
.confidence.low { color: var(--muted); }

.launch-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.launch-filter {
  min-height: 36px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.05);
  color: var(--text);
  padding: 0 12px;
  font-weight: 760;
}

.launch-filter.active {
  background: var(--accent);
  color: #03110c;
  border-color: transparent;
}

body.light-theme .launch-filter.active {
  color: #fff;
}

.launch-list {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.launch-card {
  display: grid;
  gap: 13px;
  padding: 16px;
  border: 1px solid var(--line);
  background: rgba(16,21,29,.78);
  border-radius: 8px;
}

.launch-card-top {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.launch-card h2 {
  margin: 0 0 7px;
  font-size: 20px;
  line-height: 1.25;
}

.launch-time {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid rgba(77,215,176,.24);
  background: rgba(77,215,176,.08);
}

.launch-time span,
.launch-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.launch-time strong {
  font-size: 22px;
  line-height: 1.15;
}

.launch-time b {
  color: var(--accent);
  white-space: nowrap;
}

.launch-card p,
.launch-analysis {
  margin: 0;
  color: var(--text);
  line-height: 1.65;
}

.launch-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.launch-grid div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255,255,255,.04);
}

.launch-grid b {
  display: block;
  overflow-wrap: anywhere;
}

.launch-analysis {
  color: var(--muted);
  font-size: 13px;
}

.compact-empty {
  padding: 14px;
  font-size: 12px;
}

.settings-layout {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.settings-block,
.account-panel,
.expired-panel {
  border: 1px solid var(--line);
  background: rgba(16,21,29,.82);
  border-radius: 8px;
  padding: 18px;
}

.notes-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.note-form,
.note-panel {
  border: 1px solid var(--line);
  background: rgba(16,21,29,.82);
  border-radius: 8px;
  padding: 18px;
}

body.light-theme .note-form,
body.light-theme .note-panel,
body.light-theme .note-card {
  background: rgba(255,255,255,.92);
  box-shadow: 0 18px 46px rgba(15,23,42,.08);
}

.note-form {
  display: grid;
  gap: 13px;
  position: sticky;
  top: 18px;
}

.note-form-head,
.note-panel-head,
.note-card-head,
.note-card-actions,
.note-actions {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
}

.note-form h2,
.note-panel h2,
.note-card h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.3;
}

.note-form p,
.note-panel p {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.note-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.note-form input,
.note-form textarea,
.note-form select,
.note-filter input,
.note-filter select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255,255,255,.07);
  color: var(--text);
  padding: 0 11px;
  outline: none;
}

.note-form textarea {
  min-height: 88px;
  padding: 11px;
  resize: vertical;
  line-height: 1.55;
}

body.light-theme .note-form input,
body.light-theme .note-form textarea,
body.light-theme .note-form select,
body.light-theme .note-filter input,
body.light-theme .note-filter select {
  background: #fff;
}

.note-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.note-panel {
  min-width: 0;
}

.note-filter {
  display: grid;
  grid-template-columns: minmax(160px, 220px) 150px;
  gap: 8px;
}

.note-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.note-card {
  display: grid;
  gap: 13px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.045);
  border-radius: 8px;
  padding: 15px;
}

.note-card-head {
  justify-content: flex-start;
}

.note-card-head h2 {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.note-pin {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(77,215,176,.12);
  color: var(--accent);
  font-size: 12px;
}

.note-body {
  display: grid;
  gap: 11px;
}

.note-analysis strong,
.note-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.note-analysis p,
.note-user-text {
  margin: 0;
  line-height: 1.65;
  color: var(--text);
  white-space: pre-wrap;
}

.note-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.note-grid-wide {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.note-grid div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255,255,255,.04);
}

.note-grid b {
  display: block;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.note-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  color: var(--muted);
  font-size: 12px;
}

.note-card-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.settings-block h2,
.account-panel h2 {
  margin: 0 0 8px;
}

.settings-block p,
.expired-panel p,
.renew-block p {
  color: var(--muted);
  line-height: 1.6;
  margin: 0 0 14px;
}

.tg-state {
  color: var(--muted);
  line-height: 1.7;
}

.toggle {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  color: var(--text);
}

.toggle input {
  width: 18px;
  min-height: 18px;
}

.compact {
  margin-top: 16px;
}

.expired-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 420px);
  gap: 18px;
  align-items: center;
  margin-bottom: 18px;
  border-color: rgba(245,193,93,.35);
}

.renew-form {
  display: flex;
  gap: 10px;
}

.renew-form input {
  flex: 1;
}

.renew-block {
  display: grid;
  gap: 12px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.renew-block strong {
  display: block;
  margin-bottom: 4px;
  font-size: 16px;
}

.purchase-panel {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid rgba(77,215,176,.28);
  border-radius: 8px;
  background: rgba(16,21,29,.82);
}

body.light-theme .purchase-panel {
  background: rgba(255,255,255,.92);
  box-shadow: 0 18px 46px rgba(15,23,42,.08);
}

.purchase-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
}

.purchase-head strong {
  display: block;
  font-size: 18px;
}

.purchase-head p {
  margin: 5px 0 0;
  color: var(--muted);
}

.purchase-products {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.purchase-product {
  min-height: 88px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  color: var(--text);
  background: rgba(255,255,255,.04);
}

.purchase-product.active {
  border-color: rgba(77,215,176,.72);
  background: rgba(77,215,176,.12);
}

.purchase-product strong,
.purchase-product span,
.purchase-product b {
  display: block;
}

.purchase-product span {
  margin-top: 5px;
  color: var(--muted);
}

.purchase-product b {
  margin-top: 6px;
  color: var(--accent);
  font-size: 20px;
}

.purchase-form {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr) 180px;
  gap: 10px;
  align-items: end;
}

.purchase-form select {
  width: 100%;
  min-height: 44px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.07);
  color: var(--text);
  padding: 0 12px;
  outline: none;
}

body.light-theme .purchase-form select {
  background: #fff;
}

.purchase-form button {
  min-height: 44px;
  border-radius: 7px;
  background: var(--accent);
  color: #03110c;
  font-weight: 800;
}

body.light-theme .purchase-form button {
  color: #fff;
}

.purchase-status {
  color: var(--warning);
  min-height: 22px;
}

.purchase-result {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(77,215,176,.28);
  border-radius: 8px;
  padding: 12px;
  background: rgba(77,215,176,.08);
}

.purchase-result .code {
  overflow-wrap: anywhere;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 1px;
  color: var(--accent);
}

.purchase-result .code.small {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--text);
}

.purchase-result .muted {
  color: var(--muted);
}

.pay-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  min-height: 38px;
  padding: 0 16px;
  border-radius: 8px;
  background: var(--accent);
  color: #03110c;
  font-weight: 800;
  text-decoration: none;
}

button.pay-link {
  border: 0;
}

.inline-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  min-height: 38px;
}

.register-purchase-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

body.light-theme .pay-link {
  color: #fff;
}

.pay-link:hover {
  filter: brightness(.96);
}

.account-panel dl {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 12px;
}

.account-panel dt {
  color: var(--muted);
}

.empty {
  border: 1px dashed var(--line);
  padding: 28px;
  border-radius: 8px;
  color: var(--muted);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes modalRise {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 980px) {
  .auth-screen,
  .app-shell,
  .settings-layout,
  .project,
  .expired-panel,
  .purchase-form,
  .launch-grid,
  .notes-layout,
  .note-form-grid,
  .note-grid,
  .note-grid-wide {
    grid-template-columns: 1fr;
  }
  .note-form {
    position: static;
  }
  .note-panel-head,
  .note-filter {
    grid-template-columns: 1fr;
    display: grid;
    align-items: stretch;
  }
  .launch-sidebar {
    position: static;
    height: auto;
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 18px 14px 22px;
  }
  .rail {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .rail nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
  .nav {
    text-align: center;
    padding: 0 6px;
  }
  .top {
    flex-direction: column;
  }
  .top-actions {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }
  .project-toolbar {
    align-items: stretch;
    flex-direction: column;
  }
  .project-pager {
    justify-content: space-between;
    flex-wrap: wrap;
  }
  .notify-prompt,
  .notify-actions {
    align-items: stretch;
    flex-direction: column;
  }
  .announcement-modal {
    align-items: center;
    padding: 14px;
  }
  .announcement-dialog {
    width: 100%;
    max-height: calc(100svh - 28px);
  }
}

@media (max-width: 620px) {
  .auth-screen {
    padding: 26px 16px;
    align-items: start;
  }
  .auth-copy h1 {
    font-size: 44px;
  }
  .rail nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .main {
    padding: 22px 14px 40px;
  }
  .analysis-grid,
  .renew-form,
  .register-purchase-form,
  .register-purchase-products,
  .search-row,
  .note-card-actions {
    grid-template-columns: 1fr;
    display: grid;
  }
  .note-card-actions button {
    width: 100%;
  }
  .project-pager,
  .project-page-actions,
  .project-page-actions button {
    width: 100%;
  }
  .project-page-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .project-page-summary {
    width: 100%;
    white-space: normal;
  }
  .purchase-products {
    grid-template-columns: 1fr;
  }
  .announcement-dialog-body {
    padding: 18px 16px 16px;
  }
  .announcement-dialog h2 {
    margin-right: 44px;
    font-size: 22px;
  }
  .announcement-dialog img {
    max-height: 230px;
  }
  .announcement-dialog-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .announcement-dialog-actions button {
    width: 100%;
    min-height: 46px;
  }
}
