:root {
  color-scheme: light;
  --ink: #182230;
  --muted: #687386;
  --line: #e2e7ef;
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --danger: #b42318;
  --success: #067647;
  --shadow: 0 20px 60px rgba(27, 39, 67, .08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: radial-gradient(circle at 12% 8%, #eef0ff 0, transparent 34%), #f6f8fc;
}
button, input { font: inherit; }
a { color: inherit; }
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  min-height: 76px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 16px clamp(20px, 5vw, 72px);
  border-bottom: 1px solid rgba(226, 231, 239, .85);
  background: rgba(255, 255, 255, .76);
  backdrop-filter: blur(14px);
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 800; letter-spacing: -.04em; font-size: 19px; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; color: #fff; background: var(--accent); font-size: 22px; }
.user-bar { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px; }
.user-email { max-width: min(42vw, 320px); overflow-wrap: anywhere; color: #445065; font-size: 13px; }
.role-badge { padding: 5px 9px; border-radius: 999px; color: #4338ca; background: #e9eaff; font-size: 11px; font-weight: 800; letter-spacing: .02em; }
.main-content { width: min(1120px, calc(100% - 40px)); margin: 0 auto; flex: 1; padding: 58px 0 74px; }
.login-layout { display: grid; grid-template-columns: 1.1fr minmax(320px, .9fr); gap: clamp(32px, 7vw, 96px); align-items: center; min-height: 540px; }
.hero-copy { padding: 10px 0; }
.eyebrow { margin: 0 0 13px; color: var(--accent); font-size: 10px; font-weight: 850; letter-spacing: .15em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 18px; font-size: clamp(36px, 5vw, 58px); line-height: 1.09; letter-spacing: -.055em; }
.hero-copy h1 span { color: var(--accent); }
.hero-description { margin-bottom: 0; color: var(--muted); line-height: 1.75; font-size: 15px; }
.panel { border: 1px solid rgba(226, 231, 239, .95); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); }
.login-panel { padding: clamp(25px, 3.5vw, 38px); }
.panel-heading { margin-bottom: 26px; }
.panel-heading h2, .section-heading h2 { margin-bottom: 8px; font-size: 25px; letter-spacing: -.035em; }
.panel-heading > p:last-child { margin-bottom: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.stack-form { display: grid; gap: 10px; }
label { color: #344054; font-size: 12px; font-weight: 750; }
input { width: 100%; min-width: 0; height: 47px; padding: 0 14px; border: 1px solid #d8deea; border-radius: 11px; outline: none; color: var(--ink); background: #fff; font-size: 14px; transition: border-color .16s, box-shadow .16s; }
input::placeholder { color: #9aa4b4; }
input:focus { border-color: #8b86f5; box-shadow: 0 0 0 4px rgba(79, 70, 229, .11); }
.stack-form label:not(:first-child) { margin-top: 9px; }
.button { min-height: 42px; display: inline-flex; justify-content: center; align-items: center; gap: 8px; border: 1px solid transparent; border-radius: 11px; padding: 0 15px; cursor: pointer; text-decoration: none; font-weight: 750; font-size: 13px; transition: background .15s, transform .15s, border-color .15s; }
.button:active { transform: translateY(1px); }
.button:disabled { opacity: .55; cursor: wait; }
.button-primary { color: #fff; background: var(--accent); }
.button-primary:hover:not(:disabled) { background: var(--accent-hover); }
.button-full { width: 100%; min-height: 48px; margin-top: 9px; }
.button-quiet { border-color: var(--line); color: #455167; background: #fff; }
.button-quiet:hover:not(:disabled) { background: #f6f7fb; border-color: #cbd3e0; }
.button-small { min-height: 34px; padding: 0 11px; font-size: 12px; }
.muted-note { margin: 18px 0 0; color: #8993a3; font-size: 11px; line-height: 1.65; }
.status-message { margin: 0 0 24px; padding: 12px 15px; border: 1px solid #d9defd; border-radius: 12px; color: #3730a3; background: #f0f1ff; font-size: 13px; line-height: 1.55; }
.status-message.error { border-color: #f3c6c3; color: var(--danger); background: #fff5f4; }
.status-message.success { border-color: #b8e5d0; color: var(--success); background: #effaf4; }
.dashboard-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 34px; }
.dashboard-intro h1 { margin-bottom: 10px; font-size: clamp(36px, 5vw, 46px); }
.scope-chip { flex: none; padding: 8px 12px; border: 1px solid #dfe3f9; border-radius: 999px; color: #5148c9; background: #f0f1ff; font-size: 12px; font-weight: 750; }
.create-panel { padding: clamp(24px, 4vw, 35px); }
.create-panel .panel-heading { margin-bottom: 22px; }
.create-form { display: grid; grid-template-columns: 1fr 1fr 1.15fr 1.3fr auto; align-items: end; gap: 16px; }
.field-group { min-width: 0; display: grid; gap: 8px; }
.survey-option-group { align-self: center; }
.survey-builder { grid-column: 1 / -1; padding: 16px; border: 1px solid var(--line); border-radius: 13px; background: #fafbff; }
.survey-builder-heading { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-bottom:12px; font-size:13px; }
.survey-question-list { display:grid; gap:8px; }
.survey-question-editor { display:grid; grid-template-columns:minmax(160px,1fr) 140px auto; gap:8px; align-items:center; }
.survey-question-editor input, .survey-question-editor select { min-width:0; height:40px; padding:0 10px; border:1px solid #d8deea; border-radius:9px; background:#fff; }
.survey-questions-container { display:grid; gap:9px; }
.survey-questions-container label { margin-top:8px; }
.survey-response-panel { min-width: 0; width: 100%; margin-top: 0; padding: 18px; border: 1px solid #dfe3f6; border-radius: 15px; background: linear-gradient(145deg, #fbfcff, #f6f8ff); box-shadow: inset 0 1px 0 rgba(255,255,255,.9); }
.survey-response-panel.is-loading { color: var(--muted); }
.survey-response-loading { display: flex; align-items: center; gap: 10px; margin: 0; padding: 12px 2px; font-size: 13px; }
.survey-response-loading::before { content: ""; width: 15px; height: 15px; flex: none; border: 2px solid #dfe3ff; border-top-color: var(--accent); border-radius: 50%; animation: spin .75s linear infinite; }
.survey-response-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.survey-response-heading h3, .survey-response-panel h3 { margin: 0; color: #202a40; font-size: 16px; letter-spacing: -.02em; }
.survey-response-count { display: inline-flex; align-items: center; border: 1px solid #dfe3ff; border-radius: 999px; padding: 5px 10px; color: #4f46e5; background: #f0f1ff; font-size: 11px; font-weight: 800; white-space: nowrap; }
.survey-config-summary { margin: 0 0 14px; color: var(--muted); font-size: 11px; line-height: 1.7; overflow-wrap: anywhere; }
.survey-response-table-wrap { max-width: 100%; overflow-x: auto; border: 1px solid #e3e7f1; border-radius: 11px; background: #fff; }
.survey-response-table { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 420px; font-size: 12px; }
.survey-response-table th, .survey-response-table td { padding: 11px 13px; border-bottom: 1px solid #edf0f6; text-align: left; vertical-align: top; white-space: nowrap; }
.survey-response-table th { color: #48536b; background: #f1f3fb; font-size: 11px; font-weight: 800; }
.survey-response-log-id { color: #5b647a; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 10px; }
.survey-response-table tbody tr:last-child td { border-bottom: 0; }
.survey-response-table tbody tr:nth-child(even) { background: #fbfcff; }
.survey-response-table tbody tr:hover { background: #f2f4ff; }
.survey-response-empty { padding: 20px 16px; border: 1px dashed #d8deef; border-radius: 12px; text-align: center; background: rgba(255,255,255,.75); }
.survey-response-empty strong { color: #344054; font-size: 13px; }
.survey-response-empty p { margin: 7px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.survey-response-hint { margin: 10px 0 0; color: #818ba0; font-size: 10px; line-height: 1.6; }
.survey-response-error-message { margin: 10px 0; color: #8b3030; font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
.survey-response-error-code { display: block; max-width: 100%; padding: 9px 10px; border-radius: 8px; color: #7f1d1d; background: #fff2f1; font-size: 10px; white-space: normal; overflow-wrap: anywhere; }
.survey-edit-overlay { position:fixed; inset:0; z-index:50; display:grid; place-items:center; padding:20px; background:rgba(20,25,40,.48); }
.survey-edit-panel { display:grid; gap:14px; width:min(680px,100%); max-height:85vh; overflow:auto; padding:24px; border-radius:18px; background:#fff; box-shadow:var(--shadow); }
.survey-edit-panel h3 { margin:0; }
.survey-edit-panel > .button { justify-self:start; }
.checkbox-label { display: flex; align-items: center; gap: 9px; cursor: pointer; }
.checkbox-label input { width: 17px; height: 17px; flex: none; margin: 0; accent-color: var(--accent); }
.survey-form { margin-top: 25px; text-align: left; }
.survey-form .hero-description { margin-bottom: 8px; }
.deleted-label { color: #b42318; font-weight: 800; }
.path-input-wrap { display: flex; align-items: center; min-width: 0; overflow: hidden; border: 1px solid #d8deea; border-radius: 11px; background: #fff; }
.path-input-wrap:focus-within { border-color: #8b86f5; box-shadow: 0 0 0 4px rgba(79, 70, 229, .11); }
.path-input-wrap .path-prefix { flex: none; padding-left: 12px; color: #7c8495; font-size: 11px; }
.path-input-wrap input { padding-left: 6px; border: 0; box-shadow: none; }
.field-help { color: #858fa0; font-size: 10px; line-height: 1.5; }
.create-form > .button { min-height: 47px; white-space: nowrap; }
.links-section { margin-top: 48px; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; margin-bottom: 18px; }
.section-heading h2 { display: flex; align-items: center; gap: 10px; margin: 0; }
.count-pill { display: inline-grid; place-items: center; min-width: 25px; height: 25px; padding: 0 7px; border-radius: 8px; color: #596276; background: #e9edf4; font-size: 11px; letter-spacing: 0; }
.links-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 430px), 1fr)); align-items: start; gap: 18px; }
.link-card { min-width: 0; display: flex; flex-direction: column; align-items: stretch; gap: 15px; padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: 0 8px 26px rgba(27, 39, 67, .045); transition: border-color .16s, box-shadow .16s, transform .16s; }
.link-card:hover { border-color: #d7dafb; box-shadow: 0 12px 32px rgba(27, 39, 67, .075); }
.link-main { min-width: 0; flex: 1; }
.link-short { display: inline-block; max-width: 100%; margin-bottom: 7px; color: var(--accent); font-size: 14px; font-weight: 800; overflow-wrap: anywhere; text-decoration: none; }
.link-short:hover { text-decoration: underline; }
.link-original { overflow: hidden; color: #687386; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.link-meta { display: flex; flex-wrap: wrap; gap: 8px 13px; margin-top: 9px; color: #9aa2b0; font-size: 10px; }
.creator-label { color: #6b63d8; }
.link-actions { display: flex; flex: none; flex-wrap: wrap; justify-content: flex-start; gap: 8px; padding-top: 2px; }
.delete-button { border-color: #f2d1cf; color: #b42318; background: #fff; }
.delete-button:hover { background: #fff5f4; }
.empty-state { padding: 45px 20px; border: 1px dashed #d8dfeb; border-radius: 18px; text-align: center; background: rgba(255, 255, 255, .56); }
.empty-icon { display: inline-grid; place-items: center; width: 46px; height: 46px; margin-bottom: 13px; border-radius: 15px; color: var(--accent); background: #eeeeff; font-size: 26px; }
.empty-state h3 { margin-bottom: 7px; font-size: 16px; }
.empty-state p { margin-bottom: 0; color: var(--muted); font-size: 12px; }
.redirect-layout { min-height: 54vh; display: grid; place-items: center; }
.redirect-panel { width: min(100%, 560px); padding: clamp(28px, 5vw, 48px); text-align: center; }
.redirect-panel h1 { margin-top: 12px; margin-bottom: 12px; font-size: clamp(27px, 4vw, 38px); }
.redirect-panel .hero-description { overflow-wrap: anywhere; font-size: 13px; }
.spinner { width: 34px; height: 34px; margin: 0 auto 23px; border: 3px solid #e5e7ff; border-top-color: var(--accent); border-radius: 50%; animation: spin .75s linear infinite; }
.spinner.stopped { display: none; }
.text-link { display: inline-block; margin-top: 24px; color: var(--accent); font-size: 13px; font-weight: 750; }
.privacy-note { margin: 25px 0 0; color: #959cab; font-size: 10px; line-height: 1.6; }
.footer { display: flex; justify-content: space-between; gap: 16px; padding: 20px clamp(20px, 5vw, 72px); border-top: 1px solid rgba(226, 231, 239, .85); color: #8a93a3; background: rgba(255, 255, 255, .5); font-size: 10px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 860px) {
  .main-content { padding-top: 38px; }
  .login-layout { grid-template-columns: 1fr; gap: 25px; max-width: 570px; margin: 0 auto; }
  .hero-copy h1 { font-size: clamp(36px, 9vw, 48px); }
  .create-form { grid-template-columns: 1fr 1fr; }
  .create-form > .button { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .topbar { align-items: flex-start; padding: 14px 18px; }
  .brand { font-size: 17px; }
  .user-bar { gap: 7px; }
  .user-email { max-width: 42vw; font-size: 11px; }
  .main-content { width: min(100% - 28px, 1120px); padding: 30px 0 48px; }
  .dashboard-intro { align-items: flex-start; }
  .dashboard-intro h1 { font-size: 34px; }
  .create-form { grid-template-columns: 1fr; }
  .survey-question-editor { grid-template-columns:1fr; }
  .survey-builder { grid-column:auto; }
  .create-form > .button { grid-column: auto; }
  .link-card { align-items: stretch; flex-direction: column; gap: 14px; padding: 16px; }
  .links-list { grid-template-columns: minmax(0, 1fr); gap: 13px; }
  .survey-response-panel { padding: 14px; }
  .survey-response-table th, .survey-response-table td { padding: 10px; }
  .link-actions { justify-content: flex-start; }
  .section-heading { align-items: center; }
  .footer { padding: 18px; }
}
