*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  font-size: 17px;
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  font-family: system-ui, 'Segoe UI', Roboto, 'Helvetica Neue', Tahoma, Arial,
    sans-serif;
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 42%, #0f172a 100%);
  color: #f1f5f9;
  min-height: 100vh;
  line-height: 1.65;
}

a {
  color: #38bdf8;
  text-decoration: none;
}
a:hover {
  color: #7dd3fc;
  text-decoration: underline;
}

.app-shell {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 1rem 3rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.85rem 0;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.brand {
  font-weight: 700;
  font-size: 1.05rem;
  color: #f8fafc;
  letter-spacing: 0.02em;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: flex-end;
}
.nav-links a {
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.45);
  font-size: 0.92rem;
  color: #e2e8f0;
}
.nav-links a:hover {
  background: rgba(56, 189, 248, 0.2);
  text-decoration: none;
  color: #fff;
}

.card {
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 16px;
  padding: 1.15rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.25);
}

@media (max-width: 560px) {
  .card {
    padding: 1rem 0.95rem;
    border-radius: 14px;
  }
}

.card h2,
.card h3 {
  margin: 0 0 0.6rem;
  font-weight: 600;
}

.muted {
  color: #94a3b8;
  font-size: 0.92rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 1.1rem;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  line-height: 1.2;
  min-height: 44px;
}
.btn:hover {
  text-decoration: none;
  filter: brightness(1.05);
}
.btn-primary {
  background: linear-gradient(135deg, #0ea5e9, #2563eb);
  color: #fff;
}
.btn-secondary {
  background: rgba(148, 163, 184, 0.22);
  color: #e2e8f0;
}
.btn-danger {
  background: rgba(239, 68, 68, 0.25);
  color: #fecaca;
  border: 1px solid rgba(248, 113, 113, 0.4);
}

label {
  display: block;
  margin-top: 0.75rem;
  margin-bottom: 0.3rem;
  font-size: 0.92rem;
  color: #cbd5f5;
}

input[type='text'],
input[type='email'],
input[type='password'],
input[type='tel'],
textarea,
select {
  width: 100%;
  max-width: 100%;
  padding: 0.6rem 0.85rem;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(30, 41, 59, 0.9);
  color: #f1f5f9;
  font-size: 1rem;
}
textarea {
  resize: vertical;
  min-height: 120px;
}
input:focus,
textarea:focus,
select:focus {
  outline: 2px solid rgba(14, 165, 233, 0.5);
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.mt-1 {
  margin-top: 1rem !important;
}

table {
  width: 100%;
  border-collapse: collapse;
}
th,
td {
  padding: 0.55rem 0.35rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
  text-align: right;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
}

.badge-ok {
  background: rgba(34, 197, 94, 0.2);
  color: #bbf7d0;
}
.badge-warn {
  background: rgba(251, 191, 36, 0.2);
  color: #fef3c7;
}
.badge-err {
  background: rgba(248, 113, 113, 0.2);
  color: #fecaca;
}
.badge-info {
  background: rgba(59, 130, 246, 0.22);
  color: #dbeafe;
}

.flash {
  border-radius: 12px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.93rem;
}
.flash-error {
  border: 1px solid rgba(248, 113, 113, 0.5);
  background: rgba(127, 29, 29, 0.35);
  color: #fecaca;
}
.flash-success {
  border: 1px solid rgba(52, 211, 153, 0.45);
  background: rgba(6, 78, 59, 0.32);
  color: #d1fae5;
}
.flash-info {
  border: 1px solid rgba(56, 189, 248, 0.45);
  background: rgba(12, 74, 110, 0.28);
  color: #e0f2fe;
}

.sms-body {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.95rem;
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(2, 6, 23, 0.55);
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  margin-top: 0.35rem;
}

.ticket-thread {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.msg {
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  background: rgba(30, 41, 59, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.12);
}
.msg-staff {
  border-color: rgba(14, 165, 233, 0.35);
  background: rgba(14, 116, 144, 0.15);
}
.msg-meta {
  font-size: 0.82rem;
  color: #94a3b8;
  margin-bottom: 0.35rem;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: none;
  justify-content: space-around;
  gap: 0.25rem;
  padding: 0.55rem max(1rem, env(safe-area-inset-right)) 0.55rem
    max(1rem, env(safe-area-inset-left));
  padding-bottom: calc(0.55rem + env(safe-area-inset-bottom));
  background: rgba(15, 23, 42, 0.94);
  border-top: 1px solid rgba(148, 163, 184, 0.2);
  backdrop-filter: blur(8px);
  z-index: 50;
}
.bottom-nav a {
  flex: 1;
  text-align: center;
  padding: 0.45rem 0.35rem;
  font-size: 0.76rem;
  color: #e2e8f0;
  border-radius: 10px;
  text-decoration: none;
}
.bottom-nav a:hover {
  background: rgba(56, 189, 248, 0.12);
}

@media (max-width: 720px) {
  .desktop-only {
    display: none !important;
  }
  .bottom-nav {
    display: flex;
  }
  .app-shell {
    padding-bottom: 5rem;
  }
}

hr.soft {
  border: none;
  border-top: 1px dashed rgba(148, 163, 184, 0.28);
  margin: 1rem 0;
}
