:root {
  --red: #8a0303;
  --violet: #4c00ff;
  --white: #fff;
  --bg: #f0f2f5;
  --gray: #333;
  --green: #28a745;
  --yellow: #ffc107;
  --err: #dc3545;
  --b1: #4c00ff;
  --b2: #0077cc;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Poppins", sans-serif;
  background: var(--bg);
  color: var(--gray);
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}

.container {
  width: 100%;
  max-width: 980px;
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  margin-top: 1rem;
  height: fit-content;
}

.header {
  background: linear-gradient(135deg, var(--red), var(--violet));
  color: var(--white);
  padding: 1.2rem 1.5rem;
  text-align: center;
}

.header h1 {
  font-weight: 700;
  font-size: 1.5rem;
}

.header p {
  font-size: 0.82rem;
  margin-top: 0.3rem;
  opacity: 0.95;
}

.content {
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.section {
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 1rem;
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.8rem;
  color: var(--violet);
  border-bottom: 2px solid var(--violet);
  padding-bottom: 0.35rem;
}

.fg {
  margin-bottom: 0.7rem;
}

.fg label {
  display: block;
  margin-bottom: 0.3rem;
  font-weight: 500;
  font-size: 0.8rem;
}

.fg input,
.fg select {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.85rem;
  font-family: "Poppins", sans-serif;
}

.fg input:focus,
.fg select:focus {
  outline: none;
  border-color: var(--violet);
  box-shadow: 0 0 0 2px rgba(76, 0, 255, 0.15);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}

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

.btn {
  border: none;
  padding: 0.6rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: 0.3s;
  text-transform: uppercase;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 0.3rem;
}

.btn:disabled {
  background: #ccc !important;
  color: #444 !important;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--violet);
  color: var(--white);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(76, 0, 255, 0.3);
}

.btn-stop {
  background: var(--red);
  color: var(--white);
}

.btn-stop:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(138, 3, 3, 0.3);
}

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

.stat {
  background: var(--bg);
  padding: 0.8rem 0.55rem;
  border-radius: 10px;
  text-align: center;
}

.stat h3 {
  font-size: 1.35rem;
  font-weight: 700;
}

.stat p {
  font-size: 0.7rem;
  color: #666;
}

.status-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.7rem;
}

.badge {
  display: inline-flex;
  padding: 0.18rem 0.55rem;
  border-radius: 20px;
  font-size: 0.69rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge.success {
  background: #d4edda;
  color: #155724;
}

.badge.warn {
  background: #fff3cd;
  color: #856404;
}

.badge.failed {
  background: #f8d7da;
  color: #721c24;
}

.api-box {
  margin-top: 0.7rem;
  background: #f8f5ff;
  border-left: 3px solid var(--violet);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  font-size: 0.76rem;
  color: #555;
  white-space: pre-wrap;
  word-break: break-word;
}

.log-box {
  max-height: 320px;
  overflow: auto;
  font-family: "Courier New", monospace;
  font-size: 0.73rem;
  line-height: 1.4;
}

.shot-grid {
  margin-top: 0.8rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.8rem;
}

.shot-card {
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 0.55rem;
  background: #fff;
}

.shot-card img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #ececec;
}

.shot-meta {
  margin-top: 0.45rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.68rem;
  color: #555;
  word-break: break-word;
}

.shot-card .btn {
  margin-top: 0.5rem;
  width: 100%;
}

.table-wrap {
  margin-top: 0.5rem;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

th {
  background: var(--bg);
  padding: 0.48rem 0.65rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  color: #666;
  border-bottom: 1px solid #e0e0e0;
}

td {
  padding: 0.45rem 0.65rem;
  border-bottom: 1px solid #f0f0f0;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: #f8f5ff;
}

.empty {
  text-align: center;
  color: #999;
  padding: 1rem;
}

.row-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.auth-wrap {
  max-width: 450px;
}

.auth-note {
  text-align: center;
  color: #666;
  font-size: 0.8rem;
  margin-top: 0.4rem;
}

.error {
  color: var(--err);
  min-height: 1rem;
  font-size: 0.78rem;
  margin-top: 0.5rem;
}

.modal-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: 0.2s;
  z-index: 1000;
}

.modal-bg.visible {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--white);
  padding: 1.2rem;
  border-radius: 14px;
  width: min(92vw, 420px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.mtitle {
  font-size: 1.1rem;
  font-weight: 600;
  text-align: center;
  color: var(--violet);
}

.msub {
  text-align: center;
  margin-top: 0.3rem;
  margin-bottom: 1rem;
  color: #666;
  font-size: 0.82rem;
}

.otp-row {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.otp-row input {
  width: 46px;
  height: 52px;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid #ccc;
}

.otp-row input:focus {
  outline: none;
  border-color: var(--violet);
  box-shadow: 0 0 0 2px rgba(76, 0, 255, 0.15);
}

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