@import url("https://fonts.googleapis.com/css2?family=Nunito:wght@400;500;600;700;800;900&display=swap");

:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --text: #172033;
  --muted: #697386;
  --line: #e5e9f2;
  --primary: #6558e8;
  --primary-dark: #5145cd;
  --primary-soft: #eeecff;
  --success: #147d58;
  --success-soft: #e8f7f1;
  --danger: #bd2947;
  --danger-soft: #fff0f3;
  --shadow: 0 18px 48px rgba(28, 38, 64, .10);
  font-family: "Nunito", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); }
a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input { font: inherit; }
button { cursor: pointer; }

.topbar {
  height: 72px;
  padding: 0 clamp(20px, 4vw, 56px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, .95);
  border-bottom: 1px solid var(--line);
}

.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark, .app-icon {
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, #786cf5, #5041cc);
  box-shadow: 0 8px 22px rgba(101, 88, 232, .28);
  font-weight: 800;
}
.brand-mark { width: 38px; height: 38px; border-radius: 11px; font-size: 19px; }
.brand strong, .brand small { display: block; line-height: 1.05; }
.brand strong { font-size: 16px; }
.brand small { color: var(--muted); font-size: 11px; margin-top: 4px; letter-spacing: .06em; text-transform: uppercase; }
.brand-centered { justify-content: center; }
.account { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 14px; }
.account form, .actions form { margin: 0; }
.account-name { color: var(--muted); font-size: 14px; }

.page-shell { width: min(1440px, calc(100% - 40px)); margin: 42px auto 72px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-heading h1, .form-heading h1 { margin: 4px 0 8px; font-size: clamp(27px, 3vw, 38px); letter-spacing: -.035em; }
.page-heading p, .form-heading p { margin: 0; color: var(--muted); }
.eyebrow { color: var(--primary) !important; font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }

.button {
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-weight: 700;
  line-height: 1;
  transition: background .15s, border-color .15s, transform .15s;
}
.button:hover { text-decoration: none; transform: translateY(-1px); }
.button-primary { color: #fff; background: var(--primary); box-shadow: 0 8px 18px rgba(101, 88, 232, .22); }
.button-primary:hover { background: var(--primary-dark); }
.button-ghost { color: var(--text); background: #fff; border-color: var(--line); }
.button-ghost:hover { border-color: #cbd1de; background: #fafbfe; }
.button-danger { color: var(--danger); background: transparent; }
.button-danger:hover { background: var(--danger-soft); }
.button-small { min-height: 34px; padding: 7px 10px; font-size: 13px; }
.button-wide { width: 100%; margin-top: 4px; }

.alert { padding: 13px 16px; margin: 0 0 20px; border: 1px solid; border-radius: 10px; font-size: 14px; }
.alert-success { color: var(--success); background: var(--success-soft); border-color: #bfe8d8; }
.alert-error { color: var(--danger); background: var(--danger-soft); border-color: #f4bdca; }

.table-card { overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 8px 30px rgba(27, 38, 66, .05); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { padding: 13px 16px; color: var(--muted); background: #fafbfe; border-bottom: 1px solid var(--line); text-align: left; font-size: 11px; letter-spacing: .055em; text-transform: uppercase; white-space: nowrap; }
td { padding: 18px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fcfcff; }
.copy-row { display: flex; align-items: center; gap: 7px; min-width: 240px; }
.copy-row a { overflow: hidden; max-width: 320px; text-overflow: ellipsis; white-space: nowrap; }
.icon-button { width: 28px; height: 28px; display: grid; place-items: center; flex: 0 0 auto; color: var(--muted); background: transparent; border: 0; border-radius: 7px; }
.icon-button:hover { color: var(--primary); background: var(--primary-soft); }
.badge { display: inline-flex; padding: 5px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge-active { color: var(--success); background: var(--success-soft); }
.badge-muted { color: var(--muted); background: #edf0f5; }
.stat-detail { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.actions { display: flex; justify-content: flex-end; gap: 4px; }
.nowrap { white-space: nowrap; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.empty-state { max-width: 620px; margin: 75px auto; padding: 48px 28px; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; }
.empty-state h2 { margin: 15px 0 8px; }
.empty-state p { max-width: 430px; margin: 0 auto 24px; color: var(--muted); line-height: 1.6; }
.empty-icon { width: 56px; height: 56px; display: grid; place-items: center; margin: auto; color: var(--primary); background: var(--primary-soft); border-radius: 16px; font-size: 28px; }

.auth-body, .public-body { min-height: 100vh; background: radial-gradient(circle at 50% 0, #f0edff 0, #f7f8fc 45%, #eef1f7 100%); }
.auth-shell, .public-body { display: grid; place-items: center; padding: 28px 18px; }
.auth-card { width: min(430px, 100%); padding: 38px; background: var(--surface); border: 1px solid rgba(220, 224, 236, .9); border-radius: 20px; box-shadow: var(--shadow); }
.auth-heading { margin: 34px 0 22px; text-align: center; }
.auth-heading h1 { margin: 0 0 7px; font-size: 27px; letter-spacing: -.025em; }
.auth-heading p { margin: 0; color: var(--muted); }

.stack-form { display: grid; gap: 18px; }
.stack-form label > span { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 700; }
.stack-form label > span em { color: var(--muted); font-size: 12px; font-style: normal; font-weight: 500; }
.stack-form label > small { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; }
input[type="text"], input[type="password"], input[type="url"] { width: 100%; min-height: 46px; padding: 10px 12px; color: var(--text); background: #fff; border: 1px solid #ccd2df; border-radius: 9px; outline: none; }
input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(101, 88, 232, .13); }

.form-shell { width: min(760px, calc(100% - 36px)); margin: 34px auto 72px; }
.back-link { display: inline-block; margin-bottom: 18px; color: var(--muted); font-size: 14px; font-weight: 700; }
.form-card { padding: clamp(24px, 5vw, 44px); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 12px 38px rgba(28, 38, 64, .07); }
.form-heading { margin-bottom: 28px; }
.slug-input { display: flex; align-items: center; border: 1px solid #ccd2df; border-radius: 9px; overflow: hidden; }
.slug-input:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(101, 88, 232, .13); }
.slug-input > span { padding-left: 12px; color: var(--muted); font-size: 14px; white-space: nowrap; }
.slug-input input { border: 0; box-shadow: none !important; }
.toggle-row { display: flex; align-items: flex-start; gap: 12px; padding: 14px; background: #f8f9fc; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.toggle-row input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--primary); }
.toggle-row > span { margin: 0 !important; }
.toggle-row strong, .toggle-row small { display: block; }
.toggle-row small { margin-top: 3px; color: var(--muted); font-weight: 400; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 6px; }

.store-shell { width: min(520px, 100%); padding: 50px 30px 34px; text-align: center; background: rgba(255, 255, 255, .92); border: 1px solid rgba(220, 224, 236, .9); border-radius: 24px; box-shadow: var(--shadow); }
.store-shell.compact { padding-bottom: 50px; }
.app-icon { width: 88px; height: 88px; margin: 0 auto 25px; border-radius: 25px; font-size: 42px; }
.preview-logo { width: 88px; height: 88px; display: grid; place-items: center; margin: 0 auto 25px; }
.preview-logo img { width: 88px; height: 88px; object-fit: contain; }
.store-shell h1 { margin: 5px 0 10px; font-size: clamp(28px, 8vw, 40px); letter-spacing: -.035em; }
.store-shell > p:not(.eyebrow) { margin: 0 auto 27px; color: var(--muted); line-height: 1.6; }
.store-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.store-button { min-height: 64px; display: flex; align-items: center; gap: 11px; padding: 10px 14px; color: #fff; background: #11131a; border-radius: 12px; text-align: left; }
.store-button:hover { background: #252832; text-decoration: none; transform: translateY(-1px); }
.store-button small, .store-button strong { display: block; }
.store-button small { font-size: 10px; opacity: .75; }
.store-button strong { margin-top: 2px; font-size: 16px; }
.store-logo { width: 32px; height: 32px; flex: 0 0 auto; object-fit: contain; }
.powered { display: block; margin-top: 32px; color: #9299aa; font-size: 11px; letter-spacing: .09em; text-transform: uppercase; }
.error-code { color: var(--primary); font-size: 54px; font-weight: 900; letter-spacing: -.05em; }

@media (max-width: 900px) {
  .table-card { border: 0; background: transparent; box-shadow: none; overflow: visible; }
  table, tbody { display: block; }
  thead { display: none; }
  tr { display: grid; gap: 10px; margin-bottom: 14px; padding: 17px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
  td { display: grid; grid-template-columns: 105px 1fr; align-items: start; padding: 0; border: 0 !important; }
  td::before { content: attr(data-label); color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
  .actions { justify-content: flex-start; padding-top: 8px; }
  .copy-row { min-width: 0; }
}

@media (max-width: 620px) {
  .topbar { height: 64px; padding: 0 16px; }
  .account > span, .account-name { display: none; }
  .page-shell { width: min(100% - 24px, 1440px); margin-top: 28px; }
  .page-heading { align-items: stretch; flex-direction: column; }
  .page-heading .button { align-self: flex-start; }
  .auth-card { padding: 30px 22px; }
  .form-shell { width: min(100% - 24px, 760px); margin-top: 24px; }
  .form-card { padding: 24px 18px; }
  .slug-input { display: block; }
  .slug-input > span { display: block; padding: 9px 12px 0; }
  .store-shell { padding: 38px 18px 28px; }
  .store-buttons { grid-template-columns: 1fr; }
  td { grid-template-columns: 88px 1fr; }
  .actions { display: flex; }
}
