* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: #000000;
  color: #ffffff;
  font-family: 'Kanit', sans-serif !important;
  font-size: 18px !important;
}

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

button,
input,
select,
textarea {
  font: inherit;
}

.admin-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: #0f172a;
  border-right: 1px solid rgba(6, 182, 212, 0.2);
  box-shadow: 2px 0 16px rgba(0, 0, 0, 0.4);
}

.brand-link {
  display: block;
  padding: 18px 20px;
  background: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
  font-weight: 700;
  font-size: 20px;
}

.sidebar-section {
  padding: 16px 20px 8px;
  color: #94a3b8;
  font-size: 13px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.sidebar-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(6, 182, 212, 0.08);
  border-left: 3px solid transparent;
  transition: background 200ms, border-left 200ms;
}

.sidebar-menu-item:hover {
  background: rgba(59, 130, 246, 0.07);
  border-left-color: rgba(6, 182, 212, 0.5);
}

.sidebar-menu-title,
.sidebar-menu-desc {
  display: block;
}

.sidebar-menu-title {
  color: #e5e7eb;
  font-size: 16px;
  font-weight: 600;
}

.sidebar-menu-desc {
  color: #06b6d4;
  font-size: 13px;
}

.sidebar-menu-arrow {
  color: #475569;
  font-size: 22px;
  transition: transform 200ms, color 200ms;
}

.sidebar-menu-item:hover .sidebar-menu-title,
.sidebar-menu-item:hover .sidebar-menu-arrow {
  color: #06b6d4;
}

.sidebar-menu-item:hover .sidebar-menu-arrow {
  transform: translateX(3px);
}

.sidebar-menu-active {
  background: rgba(59, 130, 246, 0.12);
  border-left-color: #3b82f6;
}

.sidebar-menu-active .sidebar-menu-title {
  color: #ffffff;
}

.sidebar-menu-active .sidebar-menu-arrow {
  color: #3b82f6;
}

.content {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: -24px -24px 24px;
  padding: 18px 24px;
  background: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
  box-shadow: 0 10px 25px rgba(59, 130, 246, 0.3);
}

.page-eyebrow {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 28px;
  font-weight: 700;
}

h2 {
  margin-bottom: 0;
  font-size: 21px;
}

.card,
.stat-card {
  background: #0f172a;
  border: 1px solid rgba(6, 182, 212, 0.2);
  border-radius: 16px;
  box-shadow: 0 10px 25px rgba(59, 130, 246, 0.15);
}

.card {
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(6, 182, 212, 0.2);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  padding: 18px;
}

.stat-card span {
  display: block;
  color: #94a3b8;
  font-size: 15px;
}

.stat-card strong {
  display: block;
  margin-top: 6px;
  font-size: 36px;
  line-height: 1;
}

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

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  background: #0f172a;
  color: #06b6d4;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-align: left;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(6, 182, 212, 0.3);
}

th,
td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(6, 182, 212, 0.15);
  vertical-align: top;
}

td {
  color: #e5e7eb;
}

tbody tr:hover {
  background: rgba(59, 130, 246, 0.1);
}

.event-order-cell {
  width: 84px;
  vertical-align: middle;
}

.event-drag-handle {
  min-height: 32px;
  padding: 4px 12px;
  border: 1px solid rgba(6, 182, 212, 0.45);
  border-radius: 7px;
  background: rgba(6, 182, 212, 0.14);
  color: #06b6d4;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: grab;
}

.event-drag-handle:active {
  cursor: grabbing;
}

.event-row-dragging {
  opacity: 0.55;
  outline: 1px dashed rgba(6, 182, 212, 0.8);
}

.muted {
  color: #94a3b8;
  font-size: 15px;
}

.empty-cell {
  padding: 28px;
  color: #94a3b8;
  text-align: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 7px 14px;
  border: 0;
  border-radius: 9px;
  background: rgba(15, 23, 42, 0.95);
  color: #e5e7eb;
  cursor: pointer;
  transition: transform 150ms, box-shadow 150ms;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(59, 130, 246, 0.3);
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
  color: #ffffff;
}

.btn-light {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.btn-danger {
  background: #ef4444;
  color: #ffffff;
}

.btn-sm {
  min-height: 32px;
  padding: 4px 13px;
  border-radius: 7px;
  font-size: 16px;
}

.badge {
  display: inline-block;
  margin: 2px;
  padding: 4px 9px;
  border: 1px solid rgba(59, 130, 246, 0.4);
  border-radius: 6px;
  background: rgba(59, 130, 246, 0.2);
  color: #3b82f6;
  font-size: 15px;
  font-weight: 500;
}

.badge-cyan {
  border-color: rgba(6, 182, 212, 0.45);
  background: rgba(6, 182, 212, 0.18);
  color: #06b6d4;
}

.badge-purple {
  border-color: rgba(139, 92, 246, 0.45);
  background: rgba(139, 92, 246, 0.18);
  color: #8b5cf6;
}

.badge-success {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.badge-warning {
  border-color: rgba(251, 191, 36, 0.4);
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
}

.alert {
  margin-bottom: 18px;
  padding: 12px 16px;
  border: 1px solid;
  border-radius: 12px;
  font-weight: 500;
}

.alert-success {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
  color: #10b981;
}

.alert-danger {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #ef4444;
}

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

.form-grid-wide {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-stack {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: #e5e7eb;
  font-weight: 500;
}

input,
select,
textarea {
  width: 100%;
  border: 1.5px solid rgba(6, 182, 212, 0.3);
  border-radius: 9px;
  background: #0f172a;
  color: #ffffff;
  font-size: 18px;
  padding: 10px 12px;
  outline: none;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: #06b6d4;
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.2);
}

.wide {
  grid-column: 1 / -1;
}

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

.check-row input {
  width: 20px;
  height: 20px;
}

.form-actions,
.button-row,
.action-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.form-actions {
  align-self: end;
}

.event-form {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.event-form-section {
  display: grid;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(6, 182, 212, 0.18);
}

.event-form-section:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.event-form-section h3 {
  margin: 0;
  color: #06b6d4;
  font-size: 18px;
  font-weight: 600;
}

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

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

.event-form .span-2 {
  grid-column: span 2;
}

.event-form .span-full {
  grid-column: 1 / -1;
}

.event-form textarea {
  min-height: 96px;
}

.event-form-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  align-items: end;
}

.event-form-actions {
  justify-content: flex-end;
}

.event-list-header {
  align-items: flex-start;
}

.event-list-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.event-list-tools form {
  margin: 0;
}

.reward-form {
  border-bottom: 1px solid rgba(6, 182, 212, 0.2);
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.table-actions form {
  margin: 0;
}

.copy-input {
  display: inline-block;
  width: min(440px, 100%);
  margin-right: 8px;
  font-size: 15px;
}

.copy-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.copy-row .copy-input {
  margin-right: 0;
}

.highlight-card {
  border-color: rgba(16, 185, 129, 0.55);
  box-shadow: 0 14px 34px rgba(16, 185, 129, 0.14);
}

.link-result {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.limit-editor {
  display: grid;
  gap: 10px;
}

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

.limit-editor h3 {
  margin: 0;
  color: #06b6d4;
  font-size: 18px;
}

.limit-config-table input {
  min-width: 150px;
}

.limit-config-table td {
  vertical-align: middle;
}

.limit-pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 280px;
}

.limit-pill-list-disabled {
  opacity: 0.58;
}

.limit-pill {
  display: inline-grid;
  gap: 2px;
  min-width: 116px;
  padding: 7px 9px;
  border: 1px solid rgba(6, 182, 212, 0.35);
  border-radius: 7px;
  background: rgba(6, 182, 212, 0.1);
  color: #e5e7eb;
  font-size: 14px;
  line-height: 1.2;
}

.limit-pill strong {
  color: #06b6d4;
  font-size: 13px;
}

.limit-pill-full {
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.14);
}

.limit-pill-over {
  border-color: rgba(239, 68, 68, 0.75);
  background: rgba(239, 68, 68, 0.22);
  box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.28);
}

.limit-pill-full strong {
  color: #ef4444;
}

.row-highlight {
  background: rgba(16, 185, 129, 0.13);
}

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 20%, rgba(59, 130, 246, 0.28), transparent 28%),
    radial-gradient(circle at 80% 80%, rgba(236, 72, 153, 0.22), transparent 32%),
    #000000;
}

.login-card {
  width: min(460px, 100%);
  padding: 28px;
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-radius: 20px;
  background: #0f172a;
  box-shadow: 0 20px 60px rgba(59, 130, 246, 0.2);
}

.login-card h1 {
  margin-bottom: 8px;
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.login-card p {
  color: #94a3b8;
}

@media (max-width: 1100px) {
  .stat-grid,
  .grid-two,
  .form-grid,
  .form-grid-wide,
  .event-form-grid,
  .event-form-grid-two,
  .event-form-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .event-form-actions {
    justify-content: flex-start;
  }
}

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

  .sidebar {
    position: static;
    height: auto;
  }

  .content {
    padding: 16px;
  }

  .topbar {
    margin: -16px -16px 16px;
    padding: 16px;
    align-items: flex-start;
    flex-direction: column;
  }

  .stat-grid,
  .grid-two,
  .form-grid,
  .form-grid-wide,
  .event-form-grid,
  .event-form-grid-two,
  .event-form-options {
    grid-template-columns: 1fr;
  }

  .event-form .span-2,
  .event-form .span-full {
    grid-column: 1 / -1;
  }
}
