* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: #f4f5f7;
  color: #1a1a1a;
}
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  background: #17181c; color: #fff; padding: 14px 24px;
}
.topbar h1 { font-size: 17px; margin: 0; }
.topbar .logout { color: #ccc; text-decoration: none; font-size: 13px; }
.topbar .logout:hover { color: #fff; }

.tabs {
  display: flex; gap: 4px; padding: 12px 24px 0; background: #fff; border-bottom: 1px solid #e0e0e6;
}
.tabs a {
  padding: 10px 16px; text-decoration: none; color: #555; font-size: 14px;
  border-bottom: 2px solid transparent;
}
.tabs a.active { color: #111; border-bottom-color: #6a5acd; font-weight: 600; }

main { padding: 20px 24px; max-width: 1200px; margin: 0 auto; }
.muted { color: #888; }
.count-banner { margin: 0 0 10px; font-weight: 600; }

table.tickets { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; }
table.tickets th, table.tickets td {
  text-align: left; padding: 10px 12px; border-bottom: 1px solid #eee; font-size: 13px; vertical-align: top;
}
table.tickets th { background: #f0f0f4; font-weight: 600; }
table.tickets .summary { max-width: 280px; }

.badge {
  display: inline-block; padding: 3px 8px; border-radius: 12px; font-weight: 700; font-size: 12px; color: #fff;
}
.badge.p5 { background: #e02424; }
.badge.p4 { background: #f97316; }
.badge.p3 { background: #eab308; color: #1a1a1a; }
.badge.p2 { background: #22c55e; }
.badge.p1 { background: #94a3b8; }

.tag {
  display: inline-block; padding: 2px 8px; border-radius: 10px; background: #eee; font-size: 11px; margin-right: 4px;
}
.tag.ok { background: #dcfce7; color: #166534; }

.btn {
  display: inline-block; padding: 7px 14px; border-radius: 6px; border: 1px solid #ccc;
  background: #fff; color: #222; text-decoration: none; font-size: 13px; cursor: pointer;
}
.btn.primary { background: #6a5acd; border-color: #6a5acd; color: #fff; }
.btn.loading { opacity: .7; cursor: wait; }

.spinner {
  display: inline-block; width: 12px; height: 12px;
  border: 2px solid #ccc; border-top-color: #6a5acd; border-radius: 50%;
  animation: spin .7s linear infinite; vertical-align: -1px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.detail .back { display: inline-block; margin-bottom: 14px; color: #555; text-decoration: none; font-size: 13px; }
.meta-form {
  display: flex; align-items: flex-end; gap: 12px; margin: 10px 0 18px; padding: 12px;
  background: #fff; border: 1px solid #e0e0e6; border-radius: 8px; flex-wrap: wrap;
}
.meta-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: #555; }
.meta-form select { padding: 6px 8px; border: 1px solid #ccc; border-radius: 6px; font-size: 13px; }
.detail h2 { margin: 4px 0 8px; }
.detail .meta { color: #555; font-size: 13px; margin-bottom: 18px; }
.detail h3 { font-size: 14px; margin: 18px 0 8px; }

.box {
  background: #fff; border: 1px solid #e0e0e6; border-radius: 8px; padding: 14px;
  white-space: pre-wrap; word-wrap: break-word; font-size: 13px; max-height: 320px; overflow-y: auto;
}
.sent-box { background: #f0fdf4; border-color: #bbf7d0; }

textarea {
  width: 100%; border: 1px solid #e0e0e6; border-radius: 8px; padding: 12px;
  font-family: inherit; font-size: 14px; resize: vertical;
}
.actions { margin-top: 10px; display: flex; gap: 10px; align-items: center; }

.flash { padding: 10px 14px; border-radius: 8px; font-size: 13px; }
.flash.ok { background: #dcfce7; color: #166534; }
.flash.warn { background: #fef3c7; color: #92400e; }
.error { color: #dc2626; font-size: 13px; }

.login-body { display: flex; align-items: center; justify-content: center; height: 100vh; }
.login-box {
  background: #fff; padding: 32px; border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,.08);
  display: flex; flex-direction: column; gap: 10px; width: 280px;
}
.login-box h1 { font-size: 18px; margin: 0; }
.login-box input { padding: 10px; border: 1px solid #ccc; border-radius: 6px; font-size: 14px; }
.login-box button {
  padding: 10px; border: none; border-radius: 6px; background: #6a5acd; color: #fff;
  font-size: 14px; cursor: pointer;
}
