:root {
  --app-font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  --text-base-size: 1rem;
  --text-small-size: 0.92rem;
  --card-shadow: 0 14px 32px rgba(2, 6, 23, 0.58);
  --card-shadow-hover: 0 22px 44px rgba(2, 6, 23, 0.7);
  --points-glow: 0 10px 24px rgba(56, 189, 248, 0.35);
}

body {
  background: radial-gradient(
    circle at top left,
    #1e293b 0,
    #020617 50%,
    #000 100%
  );
  background-size: 180% 180%;
  animation: gradientShift 18s ease-in-out infinite alternate;
  color: #f9fafb;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  font-family: var(--app-font-family);
  font-size: var(--text-base-size);
  line-height: 1.5;
}

input,
select,
textarea,
button,
.btn,
.table,
.badge {
  font-family: inherit;
}

input::placeholder,
textarea::placeholder,
select::placeholder,
.form-control::placeholder,
.form-select::placeholder {
  color: rgba(156, 163, 175, 0.5) !important;
  opacity: 1;
}

input::-ms-input-placeholder,
textarea::-ms-input-placeholder,
select::-ms-input-placeholder,
.form-control::-ms-input-placeholder,
.form-select::-ms-input-placeholder {
  color: rgba(156, 163, 175, 0.5) !important;
}

button,
.btn,
input[type='button'],
input[type='submit'],
input[type='reset'] {
  background: linear-gradient(
    120deg,
    rgba(56, 189, 248, 0.9),
    rgba(168, 85, 247, 0.9)
  ) !important;
  color: #0b1120 !important;
  border-color: transparent !important;
}

button:hover,
button:focus,
button:active,
.btn:hover,
.btn:focus,
.btn:active,
input[type='button']:hover,
input[type='submit']:hover,
input[type='reset']:hover {
  background: linear-gradient(
    120deg,
    rgba(56, 189, 248, 0.9),
    rgba(168, 85, 247, 0.9)
  ) !important;
  color: #0b1120 !important;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  min-width: 260px;
  background: rgba(15, 23, 42, 0.98);
  backdrop-filter: blur(20px);
  border-right: 1px solid rgba(148, 163, 184, 0.1);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 1060;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  margin-left: 4rem;
}

.sidebar-logo a {
  display: block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-nav {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem 0;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.9rem;
  border-radius: 0.75rem;
  margin-bottom: 0.2rem;
  color: #e5e7eb;
  text-decoration: none;
  font-size: 0.9rem;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.sidebar-nav a:hover {
  background: linear-gradient(
    120deg,
    rgba(56, 189, 248, 0.18),
    rgba(168, 85, 247, 0.18)
  );
  border-color: rgba(56, 189, 248, 0.35);
  color: #f9fafb;
  transform: translateX(2px);
}

.sidebar-nav a.active {
  background: linear-gradient(
    120deg,
    rgba(56, 189, 248, 0.9),
    rgba(168, 85, 247, 0.9)
  );
  color: #0b1120;
  font-weight: 600;
}

.sidebar-nav a i {
  font-size: 1rem;
  width: 1.15rem;
  text-align: center;
  flex: 0 0 1.15rem;
}

.sidebar-link-label {
  white-space: nowrap;
}

.sidebar-footer {
  margin-top: auto;
  font-size: 0.8rem;
  color: #9ca3af;
}

.sidebar-footer .pill {
  background: #020617;
  color: #e5e7eb;
}

.sidebar-footer .logout-btn {
  background: #dc3545 !important;
  color: #fff !important;
  border-color: #dc3545 !important;
}

.sidebar-footer .logout-btn:hover,
.sidebar-footer .logout-btn:focus,
.sidebar-footer .logout-btn:active {
  background: #bb2d3b !important;
  color: #fff !important;
  border-color: #b02a37 !important;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
  z-index: 1055;
}

.sidebar-overlay.show {
  display: block;
}

.main-area {
  flex: 1;
  min-width: 0;
  padding: 1.5rem 1.75rem;
}

.mobile-top-nav {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
  z-index: 1050;
  padding: 0 1.25rem;
  align-items: center;
  justify-content: space-between;
}

.card {
  background: radial-gradient(
    circle at top left,
    #020617,
    #020617 40%,
    #030712 100%
  );
  border-radius: 0.375rem;
  border: 1px solid #333;
  box-shadow: var(--card-shadow);
  color: #fff;
  transition:
    transform 0.18s ease-out,
    box-shadow 0.18s ease-out;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--card-shadow-hover);
}

.points-value {
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1;
  background: linear-gradient(120deg, #67e8f9, #38bdf8 55%, #facc15 100%);
  -webkit-background-clip: text;
  color: transparent;
  text-shadow: var(--points-glow);
}

.gradient-text {
  background: linear-gradient(120deg, #38bdf8, #a855f7, #f97316);
  -webkit-background-clip: text;
  color: transparent;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  background: linear-gradient(120deg, #38bdf8, #a855f7, #f97316);
  -webkit-background-clip: text;
  color: transparent;
}

.pill {
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
  font-size: 0.8rem;
}

.table-responsive-stack {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 0.5rem;
}

.table-responsive-stack thead {
  background: rgba(255, 255, 255, 0.05);
}

.border-radius {
  border-radius: 1rem;
}

.client-marquee {
  background: #111;
  border-bottom: 1px solid #333;
  color: #fff;
  overflow: hidden;
  white-space: nowrap;
  padding: 12px 0;
  margin: -20px -20px 25px -20px;
  position: relative;
}

.marquee-inner {
  display: inline-block;
  padding-left: 100%;
  animation: marquee-scroll 100s linear infinite;
}

.marquee-inner:hover {
  animation-play-state: paused;
}

.btn:not(.disabled) {
  cursor: pointer !important;
  pointer-events: auto !important;
}

.btn-sm:hover:not(.disabled) {
  transform: translateY(-2px);
  transition: transform 0.2s;
}

.desktop-sidebar-toggle {
  display: none;
}

.client-dashboard .card {
  width: 100%;
}

@media (min-width: 993px) {
  .desktop-sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 1rem;
    left: 1.5rem;
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 0.65rem;
    background: rgba(15, 23, 42, 0.88);
    color: #f8fafc;
    backdrop-filter: blur(8px);
    z-index: 1070;
  }

  .desktop-sidebar-toggle:hover {
    background: rgba(30, 41, 59, 0.95);
  }

  .sidebar {
    transition: width 0.26s ease, min-width 0.26s ease, padding 0.26s ease,
      border-color 0.26s ease;
  }

  .app-shell.desktop-sidebar-collapsed .sidebar {
    width: 86px;
    min-width: 86px;
    padding-left: 0.65rem;
    padding-right: 0.65rem;
  }

  .desktop-sidebar-pref-collapsed .app-shell .sidebar {
    width: 86px;
    min-width: 86px;
    padding-left: 0.65rem;
    padding-right: 0.65rem;
  }

  .app-shell.desktop-sidebar-collapsed .sidebar-logo a {
    font-size: 0 !important;
    line-height: 0;
    text-indent: -9999px;
    overflow: hidden;
  }

  .desktop-sidebar-pref-collapsed .app-shell .sidebar-logo a {
    font-size: 0 !important;
    line-height: 0;
    text-indent: -9999px;
    overflow: hidden;
  }

  .app-shell.desktop-sidebar-collapsed .sidebar-logo a::after {
    content: '';
  }

  .desktop-sidebar-pref-collapsed .app-shell .sidebar-logo a::after {
    content: '';
  }

  .app-shell.desktop-sidebar-collapsed .sidebar-nav a {
    justify-content: center;
    padding-left: 0.55rem;
    padding-right: 0.55rem;
    gap: 0;
  }

  .desktop-sidebar-pref-collapsed .app-shell .sidebar-nav a {
    justify-content: center;
    padding-left: 0.55rem;
    padding-right: 0.55rem;
    gap: 0;
  }

  .app-shell.desktop-sidebar-collapsed .sidebar-link-label,
  .app-shell.desktop-sidebar-collapsed .sidebar-footer .pill {
    display: none;
  }

  .desktop-sidebar-pref-collapsed .app-shell .sidebar-link-label,
  .desktop-sidebar-pref-collapsed .app-shell .sidebar-footer .pill {
    display: none;
  }

  .app-shell.desktop-sidebar-collapsed .sidebar-footer .btn {
    width: 100% !important;
    text-align: center;
  }

  .desktop-sidebar-pref-collapsed .app-shell .sidebar-footer .btn {
    width: 100% !important;
    text-align: center;
  }

  .app-shell.desktop-sidebar-collapsed .sidebar-footer .btn i {
    margin-right: 0 !important;
  }

  .desktop-sidebar-pref-collapsed .app-shell .sidebar-footer .btn i {
    margin-right: 0 !important;
  }
}

@media (max-width: 992px) {
  .sidebar {
    position: fixed;
    right: 0;
    left: auto;
    top: 0;
    width: 280px;
    min-width: 280px;
    transform: translateX(100%);
    border-right: none;
    border-left: 1px solid rgba(148, 163, 184, 0.1);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-toggle-btn {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1070;
    background: transparent;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(148, 163, 184, 0.3);
    color: #fff;
    font-size: 1.2rem;
    padding: 0.25rem 0.75rem;
    border-radius: 0.5rem;
  }

  .sidebar-overlay {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
  }

  .main-area {
    padding: 80px 1rem 2rem 1rem !important;
  }

  .mobile-top-nav {
    display: flex;
  }

  .table-responsive-stack thead {
    display: none;
  }

  .table-responsive-stack,
  .table-responsive-stack tbody,
  .table-responsive-stack tr,
  .table-responsive-stack td {
    display: block;
    width: 100%;
  }

  .table-responsive-stack tr {
    margin-bottom: 1.5rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 1rem;
    padding: 1rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  }

  .table-responsive-stack td {
    text-align: right;
    padding: 0.5rem 0;
    position: relative;
    border: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .table-responsive-stack td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #38bdf8;
    text-transform: uppercase;
    font-size: 0.75rem;
  }

  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table-responsive .table {
    min-width: 640px;
  }

  .invoice-scroll .table {
    min-width: 760px;
    white-space: nowrap;
  }

  body,
  p,
  .table,
  .btn,
  .form-control,
  .form-select,
  .text-secondary,
  .small {
    font-size: var(--text-small-size) !important;
  }

  h2,
  h3,
  h4,
  h5,
  h6 {
    font-size: 1rem !important;
    line-height: 1.35;
  }

  .display-5,
  .display-6,
  .points-value {
    font-size: 1.85rem !important;
  }

  .client-dashboard {
    width: 100%;
    overflow-x: hidden;
  }

  .client-dashboard #vaultUploadForm .d-flex {
    flex-direction: column;
    align-items: stretch !important;
  }

  .client-dashboard #vaultUploadForm .form-control,
  .client-dashboard #vaultUploadForm .form-select,
  .client-dashboard #vaultUploadForm #vaultFileInput,
  .client-dashboard #vaultUploadForm #vaultUrlInput,
  .client-dashboard #vaultUploadForm #vaultAssetLabel,
  .client-dashboard #vaultUploadForm #vaultUploadType {
    min-width: 0 !important;
    width: 100% !important;
  }

  .client-dashboard #socialView {
    gap: 0.5rem !important;
  }

  .client-dashboard #socialView .btn {
    flex: 1 1 calc(50% - 0.5rem);
    justify-content: center;
  }
}

@keyframes gradientShift {
  0% {
    background-position: 0% 0%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 0%;
  }
}

@keyframes marquee-scroll {
  0% {
    transform: translate(0, 0);
  }
  100% {
    transform: translate(-100%, 0);
  }
}

.client-history-timeline {
  position: relative;
  padding: 0.25rem 0 0.25rem 2.25rem;
}

.client-history-item {
  position: relative;
  padding-bottom: 2.1rem;
}

.client-history-item:last-child {
  padding-bottom: 0;
}

.client-history-item:not(:last-child)::before {
  content: "";
  position: absolute;
  left: -1.615rem;
  top: 1.1rem;
  bottom: -0.9rem;
  width: 2px;
  background: rgba(56, 189, 248, 0.35);
}

.client-history-dot {
  position: absolute;
  left: -1.95rem;
  top: 0.3rem;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  background: transparent;
  border: 2px solid #38bdf8;
  z-index: 1;
}

.client-history-item:first-child .client-history-dot {
  background: radial-gradient(circle at 35% 30%, #67e8f9, #38bdf8 70%);
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.18), 0 0 10px rgba(56, 189, 248, 0.5);
  border-color: transparent;
}

.client-history-content {
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid #333;
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.client-history-content:hover {
  transform: translateY(-2px);
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

.client-history-datetime-group {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
}

.client-history-datetime {
  display: inline-block;
  color: #38bdf8;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
}

.client-history-user {
  color: #fff;
  font-weight: 700;
  margin-bottom: 0.3rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.client-history-user i {
  color: #a855f7;
}

.client-history-comment {
  color: #94a3b8;
  white-space: pre-wrap;
  margin: 0;
}

.client-history-comment::before {
  content: "\201C";
  color: #64748b;
  font-weight: 700;
  margin-right: 0.1rem;
}

.client-history-comment::after {
  content: "\201D";
  color: #64748b;
  font-weight: 700;
  margin-left: 0.1rem;
}

.client-history-top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.client-history-edited-badge {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #facc15;
  background: rgba(250, 204, 21, 0.12);
  border: 1px solid rgba(250, 204, 21, 0.35);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
}

.client-history-actions {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
}

.client-history-actions .btn {
  padding: 0.15rem 0.45rem;
  line-height: 1.4;
}

.client-history-edit-form textarea {
  margin-bottom: 0.5rem;
}
