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

:root {
  --bg: #ffffff;
  --bg-accent: #e4e4e4;
  --ink: #0b1b22;
  --muted: #4a5b63;
  --primary: #007ead;
  --primary-strong: #00648a;
  --card: #ffffff;
  --border: #e4e4e4;
  --success: #2e8b6b;
  --danger: #cc3d3d;
  --warning: #c58a2a;
  --shadow: 0 16px 50px rgba(7, 22, 30, 0.12);
  --logo: url('/logo-light.svg');
  --surface: #f6f8f9;
  --surface-strong: #eef2f4;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1216;
    --bg-accent: #101b21;
    --ink: #f2f7f9;
    --muted: #9fb0b9;
    --primary: #4fb7de;
    --primary-strong: #6fd0f2;
    --card: #111c22;
    --border: #1f2f36;
    --success: #6dd1a6;
    --danger: #f27a7a;
    --warning: #f1c26f;
    --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
    --logo: url('/logo-dark.svg');
    --surface: #0f191f;
    --surface-strong: #15232a;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Manrope", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 10% 10%, rgba(0, 126, 173, 0.16), transparent 45%),
    radial-gradient(circle at 90% 20%, rgba(0, 126, 173, 0.08), transparent 50%),
    linear-gradient(135deg, var(--bg), var(--bg-accent));
  min-height: 100vh;
}

@media (prefers-color-scheme: dark) {
  body {
    background: radial-gradient(circle at 20% 0%, rgba(79, 183, 222, 0.18), transparent 55%),
      radial-gradient(circle at 80% 10%, rgba(255, 255, 255, 0.06), transparent 55%),
      linear-gradient(135deg, var(--bg), var(--bg-accent));
  }
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  padding: 32px 28px;
  background: rgba(255, 255, 255, 0.1);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(16px);
  transition: background 0.25s ease, box-shadow 0.25s ease, backdrop-filter 0.25s ease;
  position: relative;
  overflow: hidden;
}

.sidebar::before {
  content: '';
  position: absolute;
  inset: -20% -40%;
  background: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.12), transparent 50%),
    radial-gradient(circle at 80% 30%, rgba(0, 126, 173, 0.08), transparent 55%);
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.4s ease;
  transform: translateY(3px);
  pointer-events: none;
}

.sidebar:hover {
  background: rgba(255, 255, 255, 0.14);
  box-shadow: 0 18px 40px rgba(7, 22, 30, 0.12);
  backdrop-filter: blur(18px);
}

.sidebar:hover::before {
  opacity: 1;
  transform: translateY(0);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 24px;
  letter-spacing: 0.02em;
  margin-bottom: 32px;
}

.brand-mark {
  width: 72px;
  height: 72px;
  border-radius: 14px;
  background: var(--logo) center/contain no-repeat;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nav a {
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 500;
  color: var(--muted);
  transition: all 0.2s ease;
}

.nav a.active,
.nav a:hover {
  color: var(--ink);
  background: rgba(0, 126, 173, 0.12);
}

.main {
  padding: 40px 48px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.page-header h1 {
  font-size: 32px;
  margin: 0;
}

.section-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  margin-bottom: 32px;
}

.card {
  background: var(--card);
  padding: 20px 22px;
  border-radius: 18px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

@media (prefers-color-scheme: dark) {
  .card {
    border: 1px solid rgba(58, 47, 36, 0.9);
  }
}

.card h3 {
  margin-top: 0;
  font-size: 18px;
}

.card p {
  margin: 6px 0 0;
  color: var(--muted);
}

.list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.list-item {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 14px;
  padding: 14px 18px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

@media (prefers-color-scheme: dark) {
  .list-item {
    background: rgba(27, 23, 19, 0.9);
  }
}

.badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.badge.open {
  background: rgba(47, 125, 75, 0.15);
  color: var(--success);
}

.badge.warn {
  background: rgba(180, 125, 34, 0.15);
  color: var(--warning);
}

.action-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.button {
  border: none;
  background: var(--primary);
  color: #fff;
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(0, 126, 173, 0.25);
}

.button:focus-visible,
.nav a:focus-visible,
.field input:focus-visible {
  outline: 2px solid var(--primary-strong);
  outline-offset: 2px;
}

.button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.status-pill {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.status-open {
  background: rgba(0, 126, 173, 0.18);
  color: var(--primary);
}

.status-active {
  background: rgba(0, 126, 173, 0.18);
  color: var(--primary);
}

.status-in_progress {
  background: rgba(241, 194, 111, 0.2);
  color: var(--warning);
}

.status-resolved {
  background: rgba(46, 139, 107, 0.2);
  color: var(--success);
}

.status-closed {
  background: rgba(204, 61, 61, 0.2);
  color: var(--danger);
}

.priority-low {
  color: var(--muted);
}

.priority-medium {
  color: var(--primary);
}

.priority-high {
  color: var(--warning);
}

.priority-urgent {
  color: var(--danger);
}

.empty-state {
  padding: 24px;
  border-radius: 16px;
  background: var(--surface);
  color: var(--muted);
  border: 1px dashed var(--border);
}

.loading {
  opacity: 0.7;
}
.button.secondary {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.auth-aside {
  padding: 64px;
  background: linear-gradient(160deg, rgba(191, 107, 45, 0.18), transparent 60%),
    radial-gradient(circle at 20% 10%, rgba(255, 255, 255, 0.7), transparent 50%),
    var(--bg);
}

.auth-aside h1 {
  font-size: 42px;
  margin-bottom: 16px;
}

.auth-card {
  padding: 64px 72px;
  background: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

@media (prefers-color-scheme: dark) {
  .auth-card {
    background: rgba(27, 23, 19, 0.95);
  }
}

.auth-card h2 {
  margin-top: 0;
  font-size: 28px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.field input {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 14px;
  background: transparent;
  color: var(--ink);
}

.field select {
  padding: 12px 38px 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 14px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2366747d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 12px center / 16px;
  color: var(--ink);
  appearance: none;
}

.logo-prominent {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.logo-prominent .brand-mark {
  width: 100%;
  border-radius: 24px;
}

.logo-prominent span {
  font-size: 28px;
  font-weight: 600;
}

.fade-in {
  animation: fadeIn 0.5s ease forwards;
}

.log-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.log-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.log-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
}

.log-message {
  margin-top: 8px;
  font-weight: 500;
}

.section-divider {
  height: 1px;
  background: var(--line);
  margin: 20px 0;
  opacity: 0.6;
}

.api-key-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 12px 0 16px;
}

.api-key-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.project-card {
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.project-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
  border-color: rgba(0, 126, 173, 0.35);
}

.rich-editor {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  overflow: hidden;
}

.rich-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.rich-toolbar button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  padding: 6px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 12px;
}

.rich-toolbar button:hover {
  border-color: rgba(0, 126, 173, 0.4);
  background: rgba(0, 126, 173, 0.08);
}

.rich-area {
  min-height: 140px;
  padding: 12px;
  outline: none;
  font-size: 14px;
  line-height: 1.6;
}

.loading-panel {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  border-style: dashed;
  border-color: rgba(0, 126, 173, 0.35);
  background: linear-gradient(120deg, rgba(0, 126, 173, 0.08), rgba(0, 126, 173, 0.02));
}

.loading-orb {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(0, 126, 173, 0.6), rgba(0, 126, 173, 0.1));
  box-shadow: 0 0 20px rgba(0, 126, 173, 0.2);
  animation: pulseOrb 1.4s ease-in-out infinite;
}

.loading-lines {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.loading-title {
  font-weight: 600;
  letter-spacing: 0.01em;
}

.loading-dots span {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 4px;
  border-radius: 50%;
  background: rgba(0, 126, 173, 0.5);
  animation: dotPulse 1s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes pulseOrb {
  0%,
  100% {
    transform: scale(0.95);
    opacity: 0.7;
  }
  50% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes dotPulse {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  50% {
    transform: translateY(-3px);
    opacity: 1;
  }
}

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

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.notice {
  min-height: 20px;
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--danger);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(9, 16, 20, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 50;
}

.modal-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--card);
  padding: 24px 28px;
  border-radius: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  max-width: 380px;
}

.notice[data-kind="success"] {
  color: var(--success);
}

.sidebar-footer {
  margin-top: 32px;
  display: grid;
  gap: 12px;
}

.tenant-switcher {
  display: grid;
  gap: 6px;
}

.tenant-label {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tenant-select {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
}
.user-chip {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(191, 107, 45, 0.12);
  font-size: 13px;
  color: var(--muted);
}

.nav a.disabled {
  opacity: 0.45;
  pointer-events: none;
}

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

.project-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 24px;
}

.project-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.project-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.project-card.selected {
  border-color: rgba(0, 126, 173, 0.6);
  box-shadow: 0 0 0 2px rgba(0, 126, 173, 0.2);
}

.settings-panel {
  position: sticky;
  top: 32px;
  display: grid;
  gap: 16px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.toggle {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
}

.toggle.small {
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.toggle input {
  accent-color: var(--primary);
}

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

.meta {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.status-archived {
  background: rgba(204, 61, 61, 0.16);
  color: var(--danger);
}

@media (max-width: 1100px) {
  .project-layout {
    grid-template-columns: 1fr;
  }

  .settings-panel {
    position: static;
  }
}

.filter-card {
  margin-bottom: 24px;
}

.filter-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.team-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 24px;
}

.member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

.member-actions select {
  min-width: 140px;
  padding: 12px 38px 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 14px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2366747d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 12px center / 16px;
  color: var(--ink);
  appearance: none;
}

.invite-card {
  position: sticky;
  top: 32px;
  display: grid;
  gap: 12px;
}

@media (max-width: 1100px) {
  .team-layout {
    grid-template-columns: 1fr;
  }

  .invite-card {
    position: static;
  }
}

.issue-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 24px;
}

.issue-layout section,
.issue-layout aside {
  min-width: 0;
}

.issue-list {
  display: grid;
  gap: 16px;
  align-content: start;
  min-height: 200px;
  grid-template-columns: 1fr;
}

.issue-summary {
  margin-bottom: 12px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.issue-card {
  cursor: pointer;
  display: grid;
  gap: 8px;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.issue-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(0, 126, 173, 0.18);
}

.issue-card h3 {
  margin-top: 0;
  margin-bottom: 6px;
}

.issue-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: flex-end;
}

.issue-card.selected {
  border-color: rgba(0, 126, 173, 0.6);
  box-shadow: 0 0 0 2px rgba(0, 126, 173, 0.2);
}

.media-gallery {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  margin-bottom: 16px;
}

.media-thumb img {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  object-fit: cover;
  aspect-ratio: 4 / 3;
}

.upload-dropzone {
  position: relative;
  border-radius: 14px;
  border: 1px dashed var(--border);
  padding: 16px;
  background: var(--surface);
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
  cursor: pointer;
}

.upload-dropzone p {
  margin: 4px 0 0;
  color: var(--muted);
}

.upload-dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-dropzone.dragover {
  border-color: var(--primary);
  box-shadow: 0 10px 24px rgba(0, 126, 173, 0.18);
}

.detail-panel {
  position: sticky;
  top: 32px;
  display: grid;
  gap: 16px;
}

.detail-panel.loading {
  position: relative;
  overflow: hidden;
}

.detail-panel.loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 0%, rgba(0, 126, 173, 0.12) 45%, transparent 90%);
  animation: shimmer 1.4s ease-in-out infinite;
}

textarea {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 14px;
  background: transparent;
  color: var(--ink);
  resize: vertical;
}

.issue-meta .priority-low,
.issue-meta .priority-medium,
.issue-meta .priority-high,
.issue-meta .priority-urgent {
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.08em;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.chip {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(0, 126, 173, 0.12);
  color: var(--primary);
}

.toast-stack {
  position: fixed;
  right: 24px;
  bottom: 24px;
  display: grid;
  gap: 10px;
  z-index: 80;
}

.toast {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: var(--shadow);
  animation: toastIn 0.25s ease forwards;
  font-size: 13px;
}

.toast.success {
  border-color: rgba(46, 139, 107, 0.35);
}

.pulse {
  animation: pulse 0.45s ease;
}

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

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.02);
  }
  100% {
    transform: scale(1);
  }
}

.accordion {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--surface);
}

.accordion summary {
  cursor: pointer;
  font-weight: 600;
}

.accordion-content {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.accordion pre {
  background: var(--bg);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 12px;
  white-space: pre-wrap;
  color: var(--muted);
  border: 1px solid var(--border);
}

@media (max-width: 1100px) {
  .issue-layout {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    position: static;
  }
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .auth-page {
    grid-template-columns: 1fr;
  }

  .auth-aside,
  .auth-card {
    padding: 36px 28px;
  }
}
