:root {
  --bg: #f4f9ff;
  --surface: #ffffff;
  --surface-soft: #f6faff;
  --line: #d7e3f2;
  --line-strong: #c3d5ea;
  --text: #11243f;
  --muted: #667991;
  --primary: #0f62e5;
  --primary-strong: #0743b5;
  --accent: #8a2cff;
  --secondary: #12b8ee;
  --danger: #d64c63;
  --warn: #ad7525;
  --radius: 16px;
  --shadow-sm: 0 10px 24px rgba(17, 45, 84, 0.08);
  --shadow-md: 0 20px 48px rgba(17, 45, 84, 0.12);
  --sidebar-width: 268px;
}

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

body {
  margin: 0;
  color: var(--text);
  font-family: "Manrope", sans-serif;
  background:
    radial-gradient(circle at 8% 6%, rgba(18, 184, 238, 0.1), transparent 32%),
    radial-gradient(circle at 92% 4%, rgba(138, 44, 255, 0.09), transparent 34%),
    linear-gradient(180deg, #fbfdff 0%, #f2f7ff 45%, #edf4fd 100%);
}

.panel-open-lock {
  overflow: hidden;
}

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

.client-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  position: relative;
}

.panel-overlay {
  display: none;
}

.client-sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.client-brand {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
  padding: 0.76rem;
}

.client-brand img {
  width: 100%;
  max-width: 170px;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 10px 16px rgba(15, 98, 229, 0.18));
}

.client-sidebar h1 {
  margin: 0;
  font-family: "Sora", sans-serif;
  font-size: 1.02rem;
  line-height: 1.35;
}

.client-sidebar p {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.client-sidebar nav {
  display: grid;
  gap: 0.36rem;
}

.client-sidebar nav a {
  color: var(--muted);
  font-weight: 700;
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 0.62rem 0.72rem;
  transition: 180ms ease;
}

.client-sidebar nav a:hover,
.client-sidebar nav a.active {
  color: var(--text);
  border-color: rgba(15, 98, 229, 0.2);
  background: linear-gradient(135deg, rgba(18, 184, 238, 0.12), rgba(138, 44, 255, 0.08));
}

.logout-link {
  margin-top: auto;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  padding: 0.52rem 0.78rem;
  border-radius: 10px;
  width: fit-content;
  font-weight: 700;
  background: #fff;
  transition: 180ms ease;
}

.logout-link:hover {
  color: var(--text);
  border-color: rgba(214, 76, 99, 0.4);
  background: rgba(214, 76, 99, 0.08);
}

.client-main {
  padding: 1.16rem;
}

.client-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
  padding: 0.76rem 0.9rem;
}

.client-topbar-title {
  display: flex;
  align-items: center;
  gap: 0.82rem;
  min-width: 0;
}

.panel-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: #fff;
  cursor: pointer;
  padding: 0.55rem;
}

.panel-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 999px;
  background: var(--text);
  margin: 0.24rem 0;
}

.client-topbar h2 {
  margin: 0;
  font-family: "Sora", sans-serif;
  font-size: clamp(1.1rem, 2.1vw, 1.36rem);
}

.client-topbar > span {
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 34vw;
}

.client-alert {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.72rem 0.9rem;
  margin-bottom: 1rem;
  font-weight: 700;
  background: #fff;
}

.client-alert.success {
  border-color: rgba(30, 158, 95, 0.3);
  background: rgba(30, 158, 95, 0.1);
  color: #1e7a4d;
}

.client-alert.error {
  border-color: rgba(214, 76, 99, 0.34);
  background: rgba(214, 76, 99, 0.1);
  color: #8f2f3e;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: 1rem;
  animation: panelRise 320ms ease both;
}

.panel + .panel {
  margin-top: 1rem;
}

.panel h3 {
  margin: 0 0 0.8rem;
  font-family: "Sora", sans-serif;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
}

.stat-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: 0.86rem;
}

.stat-card h4 {
  margin: 0 0 0.4rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.stat-card p {
  margin: 0;
  color: var(--text);
  font-family: "Sora", sans-serif;
  font-size: 1.46rem;
}

.grid-two {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 1rem;
}

form {
  display: grid;
  gap: 0.58rem;
}

label {
  font-weight: 700;
  font-size: 0.88rem;
}

small {
  color: var(--muted);
  font-size: 0.78rem;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
  padding: 0.62rem 0.7rem;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: rgba(14, 99, 244, 0.5);
  box-shadow: 0 0 0 3px rgba(14, 99, 244, 0.13);
}

textarea {
  min-height: 110px;
  resize: vertical;
}

input::file-selector-button {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  padding: 0.35rem 0.6rem;
  margin-right: 0.55rem;
  cursor: pointer;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn {
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 0.58rem 0.88rem;
  cursor: pointer;
  font-family: "Sora", sans-serif;
  font-weight: 700;
  font-size: 0.88rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: 180ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(125deg, var(--primary), #3a8bff);
  color: #fff;
  box-shadow: 0 10px 24px rgba(14, 99, 244, 0.22);
}

.btn-primary:hover {
  box-shadow: 0 14px 28px rgba(14, 99, 244, 0.28);
}

.btn-secondary {
  border-color: var(--line-strong);
  color: var(--text);
  background: #fff;
}

.btn-secondary:hover {
  border-color: rgba(14, 99, 244, 0.42);
  color: var(--primary-strong);
  background: rgba(14, 99, 244, 0.07);
}

.btn-danger {
  border-color: rgba(214, 76, 99, 0.36);
  background: rgba(214, 76, 99, 0.1);
  color: #8b2f3d;
}

.btn-danger:hover {
  background: rgba(214, 76, 99, 0.16);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 0.7rem 0.52rem;
  font-size: 0.89rem;
  vertical-align: top;
}

th {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.81rem;
  font-weight: 800;
  white-space: nowrap;
}

.pill {
  display: inline-block;
  padding: 0.2rem 0.52rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
}

.status-open {
  border-color: rgba(33, 120, 232, 0.32);
  background: rgba(33, 120, 232, 0.11);
  color: #1b59a6;
}

.status-in_progress {
  border-color: rgba(173, 117, 37, 0.36);
  background: rgba(173, 117, 37, 0.11);
  color: #81591d;
}

.status-waiting_client {
  border-color: rgba(22, 174, 151, 0.34);
  background: rgba(22, 174, 151, 0.12);
  color: #0f7567;
}

.status-resolved {
  border-color: rgba(30, 158, 95, 0.34);
  background: rgba(30, 158, 95, 0.12);
  color: #1b794a;
}

.status-closed {
  border-color: rgba(214, 76, 99, 0.34);
  background: rgba(214, 76, 99, 0.11);
  color: #8f2f3f;
}

.reply-thread {
  display: grid;
  gap: 0.7rem;
}

.reply-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem;
  background: #fff;
}

.reply-item header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.4rem;
}

.reply-item header strong {
  font-size: 0.88rem;
}

.reply-item p {
  margin: 0;
  color: var(--muted);
}

.ticket-attachments {
  margin-top: 0.55rem;
  display: grid;
  gap: 0.32rem;
}

.ticket-attachments a {
  font-size: 0.84rem;
  color: var(--primary-strong);
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.auth-card {
  width: min(470px, 94vw);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow-md);
  padding: 1.3rem;
}

.auth-card h1 {
  margin: 0 0 0.5rem;
  font-family: "Sora", sans-serif;
}

.auth-card p {
  margin: 0 0 1rem;
  color: var(--muted);
}

.auth-actions {
  margin-top: 0.7rem;
  color: var(--muted);
}

.auth-actions a {
  color: var(--primary-strong);
  font-weight: 700;
}

.package-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
}

.package-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  padding: 0.8rem;
}

.package-card h4 {
  margin: 0 0 0.3rem;
}

.package-price {
  margin: 0 0 0.45rem;
  font-family: "Sora", sans-serif;
  color: var(--primary-strong);
}

.package-card ul {
  margin: 0.4rem 0 0.65rem;
  padding-left: 1rem;
  color: var(--muted);
}

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

@media (max-width: 1120px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-two {
    grid-template-columns: 1fr;
  }

  .package-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .panel-overlay {
    display: block;
    position: fixed;
    inset: 0;
    border: 0;
    background: rgba(15, 23, 42, 0.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease;
    z-index: 55;
  }

  .client-shell.panel-open .panel-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  .client-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(var(--sidebar-width), 88vw);
    max-width: 330px;
    height: 100vh;
    transform: translateX(-108%);
    transition: transform 260ms ease;
    z-index: 60;
    box-shadow: var(--shadow-md);
  }

  .client-shell.panel-open .client-sidebar {
    transform: translateX(0);
  }

  .panel-toggle {
    display: inline-grid;
    place-content: center;
  }

  .client-main {
    padding: 0.85rem;
  }

  .client-topbar {
    position: sticky;
    top: 0.7rem;
    z-index: 30;
  }
}

@media (max-width: 760px) {
  .stats,
  .package-grid {
    grid-template-columns: 1fr;
  }

  .btn-row .btn,
  .btn-row a {
    width: 100%;
  }

  .client-topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .client-topbar > span {
    max-width: 100%;
  }

  th,
  td {
    font-size: 0.84rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}
