/* ==========================================================================
   W-Music Studio: Professional Dark Indigo Design System & GUI Architecture
   Fonts: 'Kantumruy Pro', Inter, sans-serif
   ========================================================================== */

:root {
  /* Core Surface Colors */
  --bg-body: #080c14;
  --bg-surface: #0e1526;
  --bg-card: #131c31;
  --bg-card-hover: #18233d;
  --bg-card-subtle: rgba(19, 28, 49, 0.6);
  --bg-input: #0a0f1c;

  /* Borders & Dividers */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.14);
  --border-highlight: rgba(99, 102, 241, 0.5);

  /* Typography Colors */
  --text-main: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #8492a6;
  --text-dim: #54627a;

  /* Brand Accents & Gradients */
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --primary-gradient-hover: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  --cyan-gradient: linear-gradient(135deg, #06b6d4 0%, #0284c7 100%);
  --emerald-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
  --amber-gradient: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  --rose-gradient: linear-gradient(135deg, #f43f5e 0%, #dc2626 100%);

  /* Glow Effects */
  --glow-primary: 0 0 24px rgba(99, 102, 241, 0.35);
  --glow-cyan: 0 0 20px rgba(6, 182, 212, 0.3);
  --glow-amber: 0 0 20px rgba(245, 158, 11, 0.25);
  --glow-rose: 0 0 20px rgba(244, 63, 94, 0.3);
  --shadow-elevation: 0 12px 36px -8px rgba(0, 0, 0, 0.55);
  --shadow-card: 0 6px 20px -4px rgba(0, 0, 0, 0.4);

  /* Border Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
}

[hidden] {
  display: none !important;
}

/* ==========================================================================
   Universal Reset & Base Styles
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  font-family: 'Kantumruy Pro', Inter, system-ui, -apple-system, sans-serif;
  background-color: var(--bg-body);
  background-image: 
    radial-gradient(circle at 15% 10%, rgba(99, 102, 241, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(139, 92, 246, 0.06) 0%, transparent 45%),
    linear-gradient(180deg, #080c14 0%, #0b101c 100%);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Keep the application chrome visible while the page content scrolls. */
#appView > header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 300;
}

#appView > .tabs {
  position: fixed;
  top: 73px;
  left: 0;
  right: 0;
  z-index: 290;
}

#appView > .tab-panel {
  padding-top: 145px;
}

/* Quick actions are duplicated by the main navigation. */
.dashboard-shortcuts-panel {
  display: none !important;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(8, 12, 20, 0.7);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.28);
}

::selection {
  background: rgba(99, 102, 241, 0.4);
  color: #ffffff;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* ==========================================================================
   Button System
   ========================================================================== */
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-weight: 600;
  font-size: 13px;
  background: var(--primary-gradient);
  color: #ffffff;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.25);
  user-select: none;
}

button:hover {
  background: var(--primary-gradient-hover);
  box-shadow: var(--glow-primary);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

button.secondary {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-medium);
  color: var(--text-secondary);
  box-shadow: none;
}

button.secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

button.danger {
  background: var(--rose-gradient);
  box-shadow: 0 2px 10px rgba(244, 63, 94, 0.25);
  color: #ffffff;
}

button.danger:hover {
  background: linear-gradient(135deg, #e11d48 0%, #be123c 100%);
  box-shadow: var(--glow-rose);
}

button.tiny {
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 6px;
  min-height: auto;
}

/* ==========================================================================
   Input, Select, Textarea Controls
   ========================================================================== */
label {
  display: grid;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.2px;
}

input:not(.settings-input):not(.settings-modal-card *),
select:not(.settings-input):not(.settings-modal-card *),
textarea:not(.settings-input):not(.settings-modal-card *) {
  width: 100%;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  background: var(--bg-input);
  color: var(--text-main);
  transition: all 0.2s ease;
  outline: none;
  font-size: 13.5px;
}

input:not(.settings-input):not(.settings-modal-card *)::placeholder,
textarea:not(.settings-input):not(.settings-modal-card *)::placeholder {
  color: var(--text-dim);
}

input:not(.settings-input):not(.settings-modal-card *):focus,
select:not(.settings-input):not(.settings-modal-card *):focus,
textarea:not(.settings-input):not(.settings-modal-card *):focus {
  border-color: var(--primary);
  background: #0d1424;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.22);
}

select:not(.settings-input):not(.settings-modal-card *) {
  cursor: pointer;
  background-color: var(--bg-input);
}

select:not(.settings-input):not(.settings-modal-card *) option {
  background: #0f172a;
  color: #f8fafc;
}

/* ==========================================================================
   Header Component
   ========================================================================== */
header {
  background: rgba(10, 15, 26, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: white;
  padding: 16px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-brand-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-brand-logo-img {
  width: 46px;
  height: 46px;
  object-fit: contain;
  padding: 5px;
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  box-shadow: 0 0 14px rgba(99, 102, 241, 0.35);
  backdrop-filter: blur(10px);
  flex-shrink: 0;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.header-brand-logo-img:hover {
  transform: scale(1.08);
  border-color: rgba(129, 140, 248, 0.5);
  box-shadow: 0 0 18px rgba(129, 140, 248, 0.55);
}

.header-logo-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: var(--glow-primary);
  flex-shrink: 0;
}

header h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.4px;
  background: linear-gradient(135deg, #ffffff 40%, #c7d2fe 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

header p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

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

.btn-new-song, #newSong {
  background: var(--primary-gradient);
  padding: 8px 18px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-new-song:hover, #newSong:hover {
  box-shadow: var(--glow-primary);
  transform: translateY(-2px);
}

#userBadge {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ==========================================================================
   Navigation Tabs
   ========================================================================== */
.tabs {
  display: flex;
  gap: 8px;
  padding: 10px 32px;
  background: rgba(12, 18, 32, 0.9);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
  position: sticky;
  top: 73px;
  z-index: 90;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.tab:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  transform: translateY(-1px);
}

.tab.active {
  background: var(--primary-gradient);
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.45);
  font-weight: 700;
}

/* ==========================================================================
   Tab Panel & Cards Layout
   ========================================================================== */
.tab-panel {
  padding: 28px 32px 50px;
  max-width: 1440px;
  margin: auto;
  animation: fadeIn 0.25s ease-out;
}

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

.cards {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
}

.card, .panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
  transition: all 0.2s ease;
}

.card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary-gradient);
  opacity: 0.8;
}

.card:hover {
  border-color: var(--border-medium);
  transform: translateY(-2px);
  box-shadow: var(--shadow-elevation);
}

.card small {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
}

.card strong {
  font-size: 32px;
  font-weight: 800;
  display: block;
  margin-top: 8px;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #ffffff 40%, #c7d2fe 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.card.warn::before {
  background: var(--amber-gradient);
}
.card.warn strong {
  background: linear-gradient(135deg, #fef3c7 30%, #f59e0b 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.card.danger-card::before {
  background: var(--rose-gradient);
}
.card.danger-card strong {
  background: linear-gradient(135deg, #ffe4e6 30%, #f43f5e 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.panel h2 {
  margin: 0 0 16px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: #ffffff;
}

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

.section-head h2 {
  margin: 0;
}

.cards + .panel {
  margin-top: 24px;
}

/* ==========================================================================
   Activity, Rows & Lists
   ========================================================================== */
.audit-row, .job-row, .match, .right-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  margin-bottom: 8px;
  transition: all 0.15s ease;
}

.audit-row:hover, .job-row:hover, .match:hover, .right-row:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
}

.audit-row small, .job-row small, .match small {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 4px;
}

/* ==========================================================================
   Login View & Authentication
   ========================================================================== */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  position: relative;
  background: #070a12;
  overflow: hidden;
  padding: 20px;
}

.login-bg-glow {
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  opacity: 0.45;
}

.login-bg-glow.glow-1 {
  top: -100px;
  left: 20%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.35) 0%, transparent 70%);
}

.login-bg-glow.glow-2 {
  bottom: -100px;
  right: 20%;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.3) 0%, transparent 70%);
}

.login-wrapper {
  display: flex;
  align-items: stretch;
  justify-content: center;
  max-width: 1040px;
  width: min(1040px, 94vw);
  position: relative;
  z-index: 2;
  margin: auto;
  padding: 0;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
  animation: scaleIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-showcase {
  flex: 1.15;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 24px 36px 24px 24px;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
}

.login-showcase::after {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 1.5px;
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0.05) 0%,
    rgba(99, 102, 241, 0.6) 18%,
    rgba(168, 85, 247, 0.75) 50%,
    rgba(99, 102, 241, 0.6) 82%,
    rgba(255, 255, 255, 0.05) 100%
  );
  box-shadow: 0 0 12px rgba(129, 140, 248, 0.45);
}

.showcase-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  font-weight: 700;
  color: #c7d2fe;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(168, 85, 247, 0.25));
  border: none;
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 12px;
  align-self: flex-start;
}

.showcase-badge .pulse-dot {
  width: 7px;
  height: 7px;
  background: #38bdf8;
  border-radius: 50%;
  box-shadow: 0 0 8px #38bdf8;
}

.showcase-heading {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.35;
  color: #ffffff;
  letter-spacing: -0.3px;
  font-family: "Kantumruy Pro", "Inter", sans-serif;
}

.showcase-subheading {
  display: block;
  font-size: 14px;
  font-weight: 600;
  background: linear-gradient(135deg, #a5b4fc, #e0e7ff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-top: 2px;
}

.showcase-intro {
  margin: 0 0 16px;
  font-size: 12px;
  color: var(--text-muted, #94a3b8);
  line-height: 1.45;
  font-family: "Kantumruy Pro", "Inter", sans-serif;
}

.benefits-list {
  display: grid;
  gap: 10px;
}

.benefit-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: none;
  border-radius: 12px;
  padding: 10px 12px;
  transition: all 0.2s ease;
}

.benefit-card:hover {
  background: rgba(255, 255, 255, 0.075);
  transform: translateY(-1px);
}

.benefit-icon-box {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: rgba(99, 102, 241, 0.18);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
  margin-top: 2px;
}

.benefit-body {
  flex: 1;
  min-width: 0;
}

.benefit-body h3 {
  margin: 0 0 2px;
  font-size: 13px;
  font-weight: 700;
  color: #f1f5f9;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-family: "Kantumruy Pro", "Inter", sans-serif;
}

.benefit-body h3 small {
  font-size: 10.5px;
  font-weight: 600;
  color: #94a3b8;
}

.benefit-body .km-desc {
  margin: 0 0 2px;
  font-size: 11.5px;
  color: #cbd5e1;
  line-height: 1.4;
  font-family: "Kantumruy Pro", sans-serif;
}

.benefit-body .en-desc {
  margin: 0;
  font-size: 10.5px;
  color: #94a3b8;
  line-height: 1.35;
}

.showcase-trust-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: none;
  font-size: 10.5px;
  color: #a5b4fc;
  font-weight: 600;
  flex-wrap: wrap;
}

.login-card {
  flex: 1;
  width: auto;
  max-width: 480px;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: none;
  border-radius: 0;
  padding: 24px 24px 24px 36px;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  z-index: 2;
}

@media (max-width: 960px) {
  .login-wrapper {
    flex-direction: column;
    border-radius: 20px;
    width: min(480px, 94vw);
  }
  .login-card {
    order: 1;
    padding: 24px 20px;
  }
  .login-showcase {
    order: 2;
    border: none;
    padding: 24px 20px;
  }
  .login-showcase::after {
    display: none;
  }
}

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

.login-brand-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.login-brand-logo-img {
  width: 82px;
  height: 82px;
  object-fit: contain;
  padding: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
  backdrop-filter: blur(12px);
  flex-shrink: 0;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.login-brand-logo-img:hover {
  transform: scale(1.06) rotate(-2deg);
  border-color: rgba(129, 140, 248, 0.5);
  box-shadow: 0 0 24px rgba(129, 140, 248, 0.6);
}

.login-logo-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: var(--glow-primary);
  flex-shrink: 0;
}

.login-card h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.4px;
  background: linear-gradient(135deg, #ffffff 40%, #c7d2fe 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.login-brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #c7d2fe;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 2px 8px;
  border-radius: 999px;
  margin-top: 4px;
}

.login-brand-pill .pulse-dot {
  width: 6px;
  height: 6px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 6px #10b981;
}

.login-card p {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
  margin: 10px 0 24px;
}

.login-card-desc {
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 1.5;
  margin: 8px 0 22px !important;
}

.login-card-desc .km-sub {
  display: block;
  color: #cbd5e1;
  font-family: "Kantumruy Pro", sans-serif;
  font-size: 12px;
}

.login-card-desc .en-sub {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}

.login-card form {
  display: grid;
  gap: 16px;
}

.login-card button {
  width: 100%;
  padding: 12px;
  font-size: 14px;
  font-weight: 700;
  margin-top: 6px;
}

#loginMsg {
  font-size: 13px;
  text-align: center;
}

.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 18px 0;
  color: var(--text-dim, #54627a);
  font-size: 11.5px;
  font-weight: 700;
}

.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-divider span {
  padding: 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-google-auth {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 11px 16px;
  background: #ffffff !important;
  color: #1f2937 !important;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-sm, 8px);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  margin-top: 4px;
}

.btn-google-auth:hover {
  background: #f8fafc !important;
  box-shadow: 0 6px 20px rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.btn-google-auth:active {
  transform: translateY(0);
}

.google-icon {
  flex-shrink: 0;
}


/* ==========================================================================
   Catalog Workstation
   ========================================================================== */
main#catalog {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 20px;
  max-width: 1540px;
}

.workflow-guide {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.workflow-guide > div {
  display: grid;
  gap: 3px;
}

.workflow-guide > div strong {
  font-size: 14px;
  color: #ffffff;
}

.workflow-guide > div span {
  font-size: 12px;
  color: var(--text-muted);
}

.workflow-guide nav {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
}

.workflow-guide nav a, .workflow-guide nav button {
  flex: none;
  padding: 7px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.15s ease;
}

.workflow-guide nav a:hover, .workflow-guide nav button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
}

.workflow-guide nav button#workflowExport {
  background: var(--primary-gradient);
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.workflow-guide nav button#workflowExport:hover {
  box-shadow: var(--glow-primary);
}

/* Sidebar */
aside {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow-y: auto;
  height: calc(100vh - 160px);
  position: sticky;
  top: 135px;
  box-shadow: var(--shadow-card);
}

.side-title {
  font-weight: 700;
  font-size: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.02);
  color: #ffffff;
}

.song {
  padding: 12px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.song:hover {
  background: rgba(255, 255, 255, 0.04);
}

.song.active {
  background: rgba(99, 102, 241, 0.14);
  border-left: 3px solid var(--primary);
}

.song strong {
  display: block;
  font-size: 14px;
  line-height: 1.6;
  padding-top: 2px;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.song small {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 3px;
}

/* Editor Form */
.editor {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px 28px;
  box-shadow: var(--shadow-card);
}

.editor-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 16px;
  margin-bottom: 20px;
}

.editor-head h2 {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 800;
  color: #ffffff;
}

.editor h3 {
  margin: 24px 0 12px;
  font-size: 15px;
  font-weight: 700;
  color: #e2e8f0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 8px;
}

.actions {
  display: flex;
  gap: 10px;
}

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

.empty {
  text-align: center;
  padding: 90px 20px;
  color: var(--text-muted);
}

.empty h2 {
  color: #ffffff;
  margin-bottom: 8px;
}

.content-box {
  padding: 18px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.25);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.content-box .notice {
  grid-column: 1 / -1;
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.check input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.notice {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

.template-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  margin: 16px 0;
  flex-wrap: wrap;
}

.template-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.template-group label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.template-group select {
  min-width: 200px;
  max-width: 280px;
  height: 38px;
  padding: 6px 12px;
}

.template-group button {
  height: 38px;
  white-space: nowrap;
}

.upload, .rights-add, .new-holder, .integration-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 10px;
}

.upload input[type="file"] {
  max-width: 330px;
  padding: 8px;
}

.new-holder {
  padding: 16px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  margin-top: 14px;
}

.rights-summary {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

/* ==========================================================================
   Pills & Badges
   ========================================================================== */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: rgba(99, 102, 241, 0.15);
  color: #c7d2fe;
  border: 1px solid rgba(99, 102, 241, 0.3);
  font-size: 11.5px;
  font-weight: 700;
}

.pill.bad {
  background: rgba(244, 63, 94, 0.15);
  color: #fda4af;
  border-color: rgba(244, 63, 94, 0.3);
}

.muted {
  color: var(--text-muted);
  font-size: 12.5px;
}

.ok {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
  margin: 12px 0;
  font-size: 13px;
  font-weight: 600;
}

.error {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: #fda4af;
  margin: 12px 0;
  font-size: 13px;
  font-weight: 600;
}

/* ==========================================================================
   Fingerprints Panel
   ========================================================================== */
#fingerprints .panel {
  padding: 28px;
}

#fingerprints .panel > h2 {
  margin: 0 0 8px;
  font-size: 22px;
  color: #ffffff;
}

#fingerprints .panel > p {
  max-width: 760px;
  margin: 0;
  color: var(--text-muted);
  line-height: 1.6;
}

#fingerprints .grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: end;
  gap: 16px;
  margin-top: 20px;
}

#fingerprints .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

#fingerprints .actions button {
  min-height: 40px;
}

.match-head {
  margin: 16px 0 10px;
  font-weight: 700;
  font-size: 14px;
  color: #ffffff;
}

.match > strong {
  font-size: 18px;
  color: #6ee7b7;
}

/* ==========================================================================
   Responsive Breakpoints & Mobile Viewer GUI Architecture
   ========================================================================== */
html, body {
  max-width: 100vw;
  overflow-x: hidden;
}

@media (max-width: 1080px) {
  .cards {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 900px) {
  main#catalog {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  aside {
    position: static;
    height: auto;
    max-height: 280px;
    border-radius: var(--radius-md);
  }
  .content-box, .grid {
    grid-template-columns: 1fr;
  }
  .workflow-guide {
    align-items: flex-start;
    flex-direction: column;
    padding: 12px 14px;
    gap: 10px;
  }
  .workflow-guide nav {
    width: 100%;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }
  .workflow-guide nav::-webkit-scrollbar {
    display: none;
  }
}

@media (max-width: 768px) {
  /* Header Mobile Optimization */
  header {
    padding: 12px 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    position: sticky;
    top: 0;
    z-index: 100;
  }
  .header-brand-wrap {
    width: 100%;
    justify-content: space-between;
    align-items: center;
  }
  .header-brand-wrap h1 {
    font-size: 17px;
    letter-spacing: -0.2px;
  }
  .header-brand-wrap p {
    font-size: 11px;
  }
  .header-brand-logo-img {
    width: 38px;
    height: 38px;
  }

  .header-actions {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
  }
  .header-actions::-webkit-scrollbar {
    display: none;
  }

  .btn-replay-intro {
    padding: 6px 10px;
    font-size: 11px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .sub-timer-badge {
    padding: 6px 10px;
    font-size: 11.5px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .btn-new-song, #newSong {
    padding: 7px 14px;
    font-size: 12px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* User Menu Compact Mobile View */
  .user-menu-btn {
    padding: 4px 8px 4px 4px;
    flex-shrink: 0;
    gap: 6px;
  }
  .user-avatar-circle {
    width: 26px;
    height: 26px;
    font-size: 11.5px;
  }
  .user-email-text {
    display: none !important; /* Hide long email address on mobile for ultra-clean layout */
  }
  .user-role-pill {
    font-size: 10.5px;
    padding: 2px 7px;
  }
  .user-dropdown-menu {
    right: 0 !important;
    left: auto !important;
    width: 290px !important;
    max-width: 92vw !important;
  }

  /* Sticky Navigation Tabs */
  .tabs {
    padding: 8px 12px;
    gap: 6px;
    top: 0;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar {
    display: none;
  }
  .tab {
    padding: 6px 13px;
    font-size: 12px;
  }

  /* Dashboard Cards & Layout */
  .cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .card {
    padding: 14px;
  }
  .card strong {
    font-size: 24px;
  }
  .tab-panel {
    padding: 14px 12px 60px;
  }

  /* Editor Screen */
  .editor {
    padding: 16px 14px;
    border-radius: var(--radius-md);
  }
  .editor-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .editor-head h2 {
    font-size: 18px;
  }
  .editor-head .actions {
    width: 100%;
    display: flex;
    gap: 8px;
  }
  .editor-head .actions button {
    flex: 1;
    font-size: 12px;
    padding: 8px 12px;
    justify-content: center;
  }

  /* Rights Holder & Custom Grids */
  .rights-add,
  .new-holder-fields,
  .integration-row {
    grid-template-columns: 1fr !important;
    width: 100%;
  }
  .rights-add button,
  .new-holder-fields button,
  .integration-row button {
    width: 100% !important;
  }

  .template-bar {
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
    gap: 10px;
  }
  .template-group {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }
  .template-group select,
  .template-group button {
    max-width: 100%;
    width: 100%;
  }

  #fingerprints .panel {
    padding: 16px 14px;
  }
  #fingerprints .grid {
    grid-template-columns: 1fr;
  }

  /* Touch input comfort */
  input, select, textarea {
    font-size: 14px;
    padding: 10px 12px;
    border-radius: 8px;
  }
  button {
    min-height: 38px;
  }

  /* Body space for fixed bottom navigation bar */
  body {
    padding-bottom: 74px !important;
  }

  /* Mobile Hamburger Button */
  .mobile-hamburger-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: #ffffff;
    font-size: 18px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .mobile-hamburger-btn:hover {
    background: rgba(99, 102, 241, 0.25);
    border-color: #6366f1;
    box-shadow: 0 0 14px rgba(99, 102, 241, 0.4);
  }

  /* Mobile Bottom Navigation Bar */
  .mobile-bottom-nav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(10, 15, 26, 0.94);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.55);
    z-index: 1000;
    justify-content: space-around;
    align-items: center;
    padding: 0 6px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: transparent;
    border: none;
    color: #94a3b8;
    padding: 6px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: none;
    flex: 1;
    min-width: 0;
    user-select: none;
  }

  .mobile-nav-item:hover {
    background: transparent;
    box-shadow: none;
    transform: none;
  }

  .mob-nav-icon {
    font-size: 19px;
    line-height: 1;
    transition: transform 0.2s ease;
  }

  .mobile-nav-item span {
    font-size: 10.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    color: #94a3b8;
    transition: color 0.15s ease;
  }

  .mobile-nav-item.active {
    color: #818cf8;
    background: rgba(99, 102, 241, 0.16);
    box-shadow: 0 0 14px rgba(99, 102, 241, 0.22) inset;
  }

  .mobile-nav-item.active .mob-nav-icon {
    transform: scale(1.18);
    filter: drop-shadow(0 0 6px rgba(129, 140, 248, 0.75));
  }

  .mobile-nav-item.active span {
    font-weight: 700;
    color: #ffffff;
  }

  .mobile-nav-item:active {
    transform: scale(0.92);
  }
}

/* Default non-mobile state: hide mobile navigation */
#userDropdownMenu .dropdown-nav-item,
#userDropdownMenu .dropdown-header-box + .dropdown-section-title {
  display: none !important;
}

#userDropdownMenu #menuOpenAbout {
  display: flex !important;
}

.tabs > .tab[data-tab="help"],
.tabs > .tab[data-tab="about"] {
  display: none !important;
}

.mobile-hamburger-btn {
  display: none;
}
.mobile-bottom-nav {
  display: none;
}

@media (max-width: 480px) {
  .cards {
    grid-template-columns: 1fr;
  }
  header {
    padding: 10px 12px;
  }
  .tab-panel {
    padding: 10px 8px 50px;
  }
  .editor {
    padding: 14px 10px;
  }
}

/* Small-screen polish: keep the workspace comfortable on real phones. */
@media (max-width: 600px) {
  html, body {
    min-width: 0;
    overflow-x: hidden;
  }

  header {
    padding: 10px 12px 8px;
    gap: 8px;
  }

  .header-brand-wrap {
    gap: 9px;
  }

  .header-brand-wrap h1 {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .header-actions {
    gap: 6px;
    justify-content: flex-start;
    overflow: visible;
  }

  /* Use the single Menu action in the bottom navigation on mobile. */
  .mobile-hamburger-btn,
  #userMenuBtn {
    display: none !important;
  }

  #userMenuWrapper {
    width: 0;
    height: 0;
  }

  #userDropdownMenu {
    position: fixed;
    top: auto;
    bottom: calc(70px + env(safe-area-inset-bottom, 0px));
    right: 10px;
  }

  .header-actions > * {
    flex: 0 0 auto;
  }

  .tabs {
    top: 96px;
    padding: 8px 10px;
    gap: 6px;
  }

  .tab-panel {
    width: 100%;
    padding: 14px 10px calc(78px + env(safe-area-inset-bottom, 0px));
  }

  .card, .panel, .dashboard-panel-card, .editor {
    border-radius: 14px;
    padding: 15px;
  }

  .dashboard-hero-banner {
    padding: 18px 15px;
    border-radius: 14px;
  }

  .dashboard-hero-banner h2 {
    font-size: 20px;
    line-height: 1.25;
  }

  .dashboard-hero-actions {
    flex-wrap: wrap;
    gap: 8px;
  }

  .dashboard-hero-actions button {
    flex: 1 1 140px;
  }

  .workflow-guide {
    padding: 13px;
    border-radius: 14px;
  }

  .workflow-guide nav {
    margin-right: -4px;
    padding-right: 4px;
  }

  .editor-head .actions {
    flex-wrap: wrap;
  }

  .editor-head .actions button {
    flex: 1 1 110px;
  }

  .section-head, .shortcuts-header {
    align-items: flex-start;
    gap: 10px;
    flex-wrap: wrap;
  }

  .audit-filters, .metadata-table {
    overflow-x: auto;
  }

  .audit-filters {
    display: grid;
    grid-template-columns: 1fr;
  }

  .mobile-bottom-nav {
    height: calc(64px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .mobile-nav-item {
    padding: 7px 4px;
  }

  /* Navigation is already available in the mobile bottom bar. */
  #userDropdownMenu .dropdown-nav-item,
  #userDropdownMenu .dropdown-header-box + .dropdown-section-title {
    display: none !important;
  }
}

@media (max-width: 768px) {
  #appView > .tabs {
    top: 62px;
  }

  #appView > .tab-panel {
    padding-top: 178px;
  }

  header {
    min-height: 62px;
    padding: 9px 12px;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    position: sticky;
    top: 0;
    z-index: 200;
  }

  .header-brand-wrap {
    min-width: 0;
    flex: 1;
    gap: 9px;
  }

  .header-brand-logo-img {
    width: 36px;
    height: 36px;
    padding: 3px;
  }

  .header-brand-wrap h1 {
    max-width: 230px;
    font-size: 15px;
    line-height: 1.2;
  }

  .header-brand-wrap p {
    margin-top: 1px;
    font-size: 8px;
  }

  .header-actions {
    width: auto;
    min-width: 0;
    flex: 0 0 auto;
    padding: 0;
    gap: 0;
  }

  .sub-timer-badge {
    display: inline-flex !important;
    max-width: 150px;
    min-width: 128px;
    min-height: 30px;
    padding: 5px 8px;
    gap: 4px;
    border-radius: 999px;
    font-size: 9px;
    white-space: nowrap;
    overflow: hidden;
  }

  .sub-timer-icon {
    font-size: 10px;
  }

  .sub-timer-text {
    font-size: 8px;
  }

  .sub-timer-text,
  .sub-timer-action {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .sub-timer-action {
    display: none;
  }

  #userMenuBtn {
    display: none !important;
  }

  #userMenuWrapper {
    display: block !important;
    width: 0;
    height: 0;
  }

  .tabs {
    top: 62px;
    padding: 8px 10px;
    gap: 7px;
    border-bottom-color: rgba(255, 255, 255, 0.08);
    flex-wrap: wrap;
    overflow-x: visible;
    justify-content: center;
    z-index: 190;
  }

  .tabs > .tab[data-tab="help"],
  .tabs > .tab[data-tab="about"] {
    display: none !important;
  }

  .tab {
    flex: 1 1 calc(33.333% - 7px);
    min-width: 0;
    padding: 7px 8px;
    font-size: 10.5px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.22);
  }

  #userDropdownMenu {
    position: fixed !important;
    top: auto !important;
    right: 10px !important;
    bottom: calc(70px + env(safe-area-inset-bottom, 0px)) !important;
    max-height: calc(100dvh - 90px) !important;
    overflow-y: auto !important;
  }

  .dashboard-shortcuts-panel {
    display: none !important;
  }

  #dashboard .dashboard-content-grid {
    gap: 12px;
  }

  #dashboard .dashboard-panel-card {
    padding: 14px;
  }

  #dashboard .dashboard-panel-head h2 {
    font-size: 15px;
  }

  #dashboard .dashboard-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  #dashboard .kpi-card {
    min-height: 122px;
    padding: 12px;
    border-radius: 13px;
  }

  #dashboard .kpi-title {
    font-size: 9px;
    letter-spacing: 0.6px;
  }

  #dashboard .kpi-value {
    font-size: 25px;
  }

  #dashboard .kpi-sub {
    font-size: 10px;
  }

  #dashboard .kpi-icon-bubble {
    width: 32px;
    height: 32px;
    font-size: 15px;
  }
}
