/* Tacot Studio Support — clean modern UI (not Discord-themed) */

:root {
  --sp-bg: #07080f;
  --sp-bg-elevated: #0f121c;
  --sp-card: #141824;
  --sp-card-2: #1a1f2e;
  --sp-border: rgba(255, 255, 255, 0.08);
  --sp-border-strong: rgba(255, 255, 255, 0.14);
  --sp-text: #eef0f8;
  --sp-muted: #9aa3bb;
  --sp-dim: #6b738a;
  --sp-accent: #5865f2;
  --sp-accent-2: #eb459e;
  --sp-staff: #7c9cff;
  --sp-visitor: #f0b4d0;
  --sp-ok: #57f287;
  --sp-danger: #ed4245;
  --sp-radius: 18px;
  --sp-radius-sm: 12px;
  --sp-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --sp-font: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body.sp-body {
  margin: 0;
  min-height: 100%;
  font-family: var(--sp-font);
  color: var(--sp-text);
  background-color: var(--sp-bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 15% -10%, rgba(88, 101, 242, 0.28), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(235, 69, 158, 0.14), transparent 50%),
    radial-gradient(ellipse 50% 30% at 50% 100%, rgba(0, 212, 255, 0.05), transparent 55%);
  background-attachment: fixed;
  line-height: 1.55;
}

a {
  color: var(--sp-staff);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* Layout shell */
.sp-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.sp-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem clamp(1rem, 3vw, 2rem);
  border-bottom: 1px solid var(--sp-border);
  background: rgba(7, 8, 15, 0.72);
  backdrop-filter: blur(16px) saturate(1.2);
  position: sticky;
  top: 0;
  z-index: 20;
}

.sp-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--sp-text);
  font-weight: 800;
  letter-spacing: -0.02em;
  text-decoration: none !important;
}
.sp-brand img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  box-shadow: 0 8px 24px rgba(88, 101, 242, 0.35);
}
.sp-brand span {
  font-size: 1.05rem;
}

.sp-top-links {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.sp-top-links a {
  color: var(--sp-muted);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none !important;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
}
.sp-top-links a:hover {
  color: var(--sp-text);
  background: rgba(255, 255, 255, 0.05);
}

.sp-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 1.5rem clamp(1rem, 3vw, 1.5rem) 2rem;
  min-height: 0;
}

/* Start card */
.sp-hero {
  text-align: center;
  margin: 1rem 0 1.5rem;
}
.sp-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--sp-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--sp-muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-bottom: 0.85rem;
}
.sp-pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sp-ok);
  box-shadow: 0 0 10px rgba(87, 242, 135, 0.7);
}
.sp-hero h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.sp-hero h1 em {
  font-style: normal;
  background: linear-gradient(115deg, #fff 10%, #a8b4ff 50%, #f0a0d0 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.sp-hero p {
  margin: 0 auto;
  max-width: 32rem;
  color: var(--sp-muted);
  font-size: 1.02rem;
}

.sp-card {
  background: var(--sp-card);
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius);
  box-shadow: var(--sp-shadow);
  padding: 1.35rem 1.4rem 1.5rem;
}

.sp-field {
  margin-bottom: 0.85rem;
}
.sp-field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--sp-muted);
  margin-bottom: 0.35rem;
}
.sp-field input,
.sp-field textarea {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border-radius: var(--sp-radius-sm);
  border: 1px solid var(--sp-border);
  background: rgba(0, 0, 0, 0.28);
  color: var(--sp-text);
  font: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.sp-field input:focus,
.sp-field textarea:focus {
  border-color: rgba(88, 101, 242, 0.55);
  box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.18);
}
.sp-field textarea {
  resize: vertical;
  min-height: 110px;
}

.sp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
  padding: 0.85rem 1.2rem;
  border: none;
  border-radius: 999px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.12s, filter 0.12s, box-shadow 0.12s;
}
.sp-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}
.sp-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.sp-btn-primary {
  color: #fff;
  background: linear-gradient(135deg, #5865f2 0%, #6d5ef7 50%, #c44bc4 140%);
  box-shadow: 0 12px 32px rgba(88, 101, 242, 0.35);
}
.sp-btn-ghost {
  width: auto;
  background: rgba(255, 255, 255, 0.05);
  color: var(--sp-text);
  border: 1px solid var(--sp-border);
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 700;
}
.sp-btn-danger {
  width: auto;
  background: rgba(237, 66, 69, 0.15);
  color: #ff8b8b;
  border: 1px solid rgba(237, 66, 69, 0.35);
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 700;
}

.sp-err {
  color: #ff8b8b;
  font-size: 0.88rem;
  min-height: 1.2em;
  margin: 0.65rem 0 0;
}
.sp-meta {
  text-align: center;
  margin-top: 1rem;
  font-size: 0.88rem;
  color: var(--sp-dim);
}
.sp-meta a {
  font-weight: 600;
}

.sp-past {
  margin-top: 1.25rem;
}
.sp-past h3 {
  margin: 0 0 0.55rem;
  font-size: 0.85rem;
  color: var(--sp-muted);
  font-weight: 700;
}
.sp-past-item {
  display: block;
  width: 100%;
  text-align: left;
  margin: 0.4rem 0;
  padding: 0.75rem 0.9rem;
  border-radius: var(--sp-radius-sm);
  border: 1px solid var(--sp-border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--sp-text);
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.sp-past-item:hover {
  border-color: rgba(88, 101, 242, 0.4);
  background: rgba(88, 101, 242, 0.08);
}
.sp-badge {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.sp-badge-open {
  color: var(--sp-ok);
}
.sp-badge-closed {
  color: #ff8b8b;
}

/* Chat */
.sp-chat {
  flex: 1;
  display: none;
  flex-direction: column;
  min-height: min(70vh, 720px);
  background: var(--sp-card);
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius);
  box-shadow: var(--sp-shadow);
  overflow: hidden;
}
.sp-chat.is-open {
  display: flex;
}

.sp-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1.15rem;
  border-bottom: 1px solid var(--sp-border);
  background: rgba(0, 0, 0, 0.2);
}
.sp-chat-head strong {
  display: block;
  font-size: 0.98rem;
}
.sp-chat-head small {
  color: var(--sp-muted);
  font-size: 0.8rem;
}

/* Waiting for staff banner */
.sp-wait-banner {
  display: none;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 1.15rem;
  border-bottom: 1px solid rgba(88, 101, 242, 0.25);
  background: linear-gradient(
    90deg,
    rgba(88, 101, 242, 0.16),
    rgba(235, 69, 158, 0.08)
  );
  color: var(--sp-text);
  font-size: 0.9rem;
  font-weight: 600;
}
.sp-wait-banner.is-on {
  display: flex;
}
.sp-wait-banner.is-replied {
  background: rgba(87, 242, 135, 0.1);
  border-bottom-color: rgba(87, 242, 135, 0.25);
}
.sp-wait-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--sp-accent);
  box-shadow: 0 0 0 0 rgba(88, 101, 242, 0.55);
  animation: sp-pulse 1.4s ease-out infinite;
  flex-shrink: 0;
}
.sp-wait-banner.is-replied .sp-wait-pulse {
  background: var(--sp-ok);
  animation: none;
  box-shadow: none;
}
@keyframes sp-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(88, 101, 242, 0.55);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(88, 101, 242, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(88, 101, 242, 0);
  }
}

.sp-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.15rem 1.15rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  scroll-behavior: smooth;
}

.sp-msg {
  display: flex;
  gap: 0.65rem;
  max-width: 92%;
  animation: sp-in 0.18s ease;
}
@keyframes sp-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.sp-msg.visitor {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.sp-msg.owner,
.sp-msg.system {
  align-self: flex-start;
}

.sp-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.85rem;
  flex-shrink: 0;
  margin-top: 0.15rem;
}
.sp-msg.visitor .sp-avatar {
  background: linear-gradient(135deg, #eb459e, #5865f2);
  color: #fff;
}
.sp-msg.owner .sp-avatar,
.sp-msg.system .sp-avatar {
  background: linear-gradient(135deg, #5865f2, #00d4ff);
  color: #fff;
}

.sp-bubble {
  padding: 0.7rem 0.9rem;
  border-radius: 16px;
  border: 1px solid var(--sp-border);
  background: var(--sp-card-2);
  min-width: 0;
}
.sp-msg.visitor .sp-bubble {
  background: rgba(88, 101, 242, 0.18);
  border-color: rgba(88, 101, 242, 0.28);
  border-bottom-right-radius: 6px;
}
.sp-msg.owner .sp-bubble,
.sp-msg.system .sp-bubble {
  background: rgba(255, 255, 255, 0.04);
  border-bottom-left-radius: 6px;
}
.sp-msg.system .sp-bubble {
  opacity: 0.9;
  font-style: italic;
}

.sp-msg-meta {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-bottom: 0.25rem;
}
.sp-msg-name {
  font-weight: 800;
  font-size: 0.82rem;
}
.sp-msg.visitor .sp-msg-name {
  color: var(--sp-visitor);
}
.sp-msg.owner .sp-msg-name,
.sp-msg.system .sp-msg-name {
  color: var(--sp-staff);
}
.sp-msg-time {
  font-size: 0.72rem;
  color: var(--sp-dim);
}
.sp-msg-body {
  font-size: 0.95rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--sp-text);
}

/* AI staff suggestions */
.sp-suggest {
  border-top: 1px solid var(--sp-border);
  background: rgba(88, 101, 242, 0.06);
  padding: 0.75rem 1rem 0.85rem;
}
.sp-suggest-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.sp-suggest-head strong {
  font-size: 0.88rem;
}
.sp-suggest-summary {
  margin: 0 0 0.55rem;
  font-size: 0.8rem;
  color: var(--sp-muted);
  line-height: 1.4;
}
.sp-suggest-list {
  display: grid;
  gap: 0.45rem;
}
.sp-suggest-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--sp-border);
  background: rgba(0, 0, 0, 0.22);
  color: var(--sp-text);
  font: inherit;
  font-size: 0.88rem;
  line-height: 1.45;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.sp-suggest-item:hover {
  border-color: rgba(88, 101, 242, 0.45);
  background: rgba(88, 101, 242, 0.12);
}
.sp-suggest-item .label {
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--sp-staff);
  margin-bottom: 0.3rem;
}
.sp-suggest-item .body {
  white-space: pre-wrap;
  word-break: break-word;
}
.sp-suggest-loading {
  color: var(--sp-muted);
  font-size: 0.85rem;
  padding: 0.35rem 0;
}

.sp-composer {
  padding: 0.85rem 1rem 1rem;
  border-top: 1px solid var(--sp-border);
  background: rgba(0, 0, 0, 0.18);
}
.sp-composer form {
  display: flex;
  align-items: flex-end;
  gap: 0.55rem;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--sp-border);
  border-radius: 16px;
  padding: 0.4rem 0.45rem 0.4rem 0.85rem;
}
.sp-composer textarea {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--sp-text);
  font: inherit;
  resize: none;
  max-height: 140px;
  min-height: 24px;
  padding: 0.55rem 0;
  outline: none;
}
.sp-composer textarea::placeholder {
  color: var(--sp-dim);
}
.sp-send {
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #5865f2, #8b5cf6);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  flex-shrink: 0;
}
.sp-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.sp-hint {
  margin: 0.45rem 0.15rem 0;
  font-size: 0.78rem;
  color: var(--sp-dim);
  min-height: 1.1em;
}
.sp-hint.ok {
  color: var(--sp-ok);
}
.sp-hint.error {
  color: #ff8b8b;
}

/* Inbox layout */
.sp-inbox {
  display: none;
  grid-template-columns: 300px 1fr;
  height: 100vh;
  height: 100dvh;
  width: 100%;
}
.sp-inbox.is-on {
  display: grid;
}
@media (max-width: 800px) {
  .sp-inbox {
    grid-template-columns: 1fr;
    grid-template-rows: 38vh 1fr;
  }
}

.sp-inbox-side {
  border-right: 1px solid var(--sp-border);
  background: rgba(7, 8, 15, 0.65);
  backdrop-filter: blur(12px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.sp-inbox-side-head {
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--sp-border);
  font-weight: 800;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.sp-inbox-side-head span {
  font-weight: 600;
  color: var(--sp-muted);
  font-size: 0.82rem;
}
.sp-ticket-list {
  overflow-y: auto;
  flex: 1;
}
.sp-ticket-item {
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--sp-border);
  cursor: pointer;
  transition: background 0.12s;
}
.sp-ticket-item:hover,
.sp-ticket-item.active {
  background: rgba(88, 101, 242, 0.12);
}
.sp-ticket-item strong {
  display: block;
  font-size: 0.92rem;
  margin-bottom: 0.15rem;
}
.sp-ticket-item .preview {
  color: var(--sp-muted);
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sp-inbox-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: rgba(15, 18, 28, 0.5);
}
.sp-inbox-empty {
  margin: auto;
  text-align: center;
  color: var(--sp-muted);
  padding: 2rem;
}
.sp-inbox-empty h2 {
  margin: 0 0 0.35rem;
  color: var(--sp-text);
}

.sp-gate {
  max-width: 420px;
  margin: 12vh auto;
  padding: 2rem 1.5rem;
  text-align: center;
  background: var(--sp-card);
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius);
  box-shadow: var(--sp-shadow);
}
.sp-gate h1 {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
}
.sp-gate p {
  color: var(--sp-muted);
  margin: 0 0 1.25rem;
}

@media (max-width: 560px) {
  .sp-main {
    padding-top: 1rem;
  }
  .sp-card {
    padding: 1.1rem;
  }
  .sp-msg {
    max-width: 100%;
  }
}
