:root { color-scheme: dark; }
* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: #0b0c10;
  color: #eaeaf0;
  padding-bottom: 72px;
}

header {
  padding: 16px 18px;
  border-bottom: 1px solid #1f2230;
  background: #0d0f16;
  position: sticky;
  top: 0;
  z-index: 100;
}

h1 {
  font-size: 16px;
  margin: 0 0 6px 0;
}

p {
  margin: 0;
  opacity: 0.8;
  font-size: 13px;
  line-height: 1.35;
}

main {
  display: grid;
  grid-template-columns: 1.15fr 1fr 1fr;
  gap: 12px;
  padding: 12px;
  align-items: start;
}

.card {
  border: 1px solid #1f2230;
  border-radius: 12px;
  overflow: hidden;
  background: #0d0f16;
  min-width: 0;
}

.card h2 {
  font-size: 13px;
  margin: 0;
  padding: 10px 12px;
  border-bottom: 1px solid #1f2230;
  opacity: 0.9;
}

.card .body {
  padding: 12px;
}

textarea {
  width: 100%;
  min-height: 280px;
  background: #0b0c10;
  color: #eaeaf0;
  border: 1px solid #262a3b;
  border-radius: 10px;
  padding: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  line-height: 1.35;
  resize: vertical;
}

input,
select {
  width: 100%;
  background: #0b0c10;
  color: #eaeaf0;
  border: 1px solid #262a3b;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
}

textarea:focus,
input:focus,
select:focus {
  outline: 2px solid #2e3aa0;
  outline-offset: 2px;
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.row > * {
  flex: 1;
  min-width: 160px;
}

.btns {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

button {
  cursor: pointer;
  border: 1px solid #2a2f44;
  background: #121525;
  color: #eaeaf0;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  transition: 0.18s ease;
}

button:hover {
  transform: translateY(-1px);
}

button.primary {
  background: #1a2455;
  border-color: #2e3aa0;
}

button.good {
  background: #0f2a1c;
  border-color: #1f6b44;
}

button.warnBtn {
  background: #3b2d12;
  border-color: #7a5d1d;
}

button.danger {
  background: #321616;
  border-color: #8a2e2e;
}

.small {
  font-size: 12px;
  opacity: 0.75;
  margin-top: 8px;
  line-height: 1.35;
}

.warn {
  color: #ffd37a;
}

code {
  background: #0b0c10;
  border: 1px solid #262a3b;
  padding: 2px 6px;
  border-radius: 8px;
}

.smallRow {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.counter {
  font-size: 12px;
  opacity: 0.75;
}

.badge {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  opacity: 0.85;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #3a3f57;
  display: inline-block;
}

.dot.ok { background: #1f6b44; }
.dot.warn { background: #ffd37a; }
.dot.err { background: #ff6b6b; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 56px;
  transform: translateX(-50%);
  background: #121525;
  border: 1px solid #2a2f44;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 1000;
  max-width: 80vw;
  text-align: center;
}

.toast.show {
  opacity: 1;
}

.rulesPanel {
  margin-top: 10px;
  border: 1px solid #1f2230;
  background: #0d0f16;
  border-radius: 12px;
  padding: 8px 10px;
}

.rulesPanel > summary {
  cursor: pointer;
  font-size: 15px;
  opacity: 0.9;
}

.rulesBody {
  padding: 10px 6px 4px 6px;
  font-size: 12px;
  opacity: 0.85;
  line-height: 1.45;
}

.rulesBody ul {
  margin: 0;
  padding-left: 18px;
}

.templateBtn {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 3000;
  background: #1a2455;
  border: 1px solid #2e3aa0;
  color: #fff;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
}

.templatePanel {
  position: fixed;
  top: 0;
  right: -380px;
  width: 360px;
  height: 100%;
  background: #0d0f16;
  border-left: 1px solid #1f2230;
  z-index: 3001;
  transition: right 0.3s ease;
  display: flex;
  flex-direction: column;
}

.templatePanel.open {
  right: 0;
}

.templateHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid #1f2230;
  font-weight: 600;
  gap: 10px;
}

.templateList {
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.templateItem {
  border: 1px solid #262a3b;
  padding: 10px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 12px;
  line-height: 1.4;
  transition: 0.2s;
}

.templateItem:hover {
  background: #1a2455;
}

.copySuccess {
  background: #1f6b44 !important;
  border-color: #2fa96d !important;
  color: #fff !important;
}

.inputWarning {
  border: 2px solid #ffd37a !important;
}

.inputError {
  border: 2px solid #ff6b6b !important;
}

.reviewPanel {
  margin-top: 12px;
  border: 1px solid #1f2230;
  border-radius: 12px;
  overflow: hidden;
  background: #0b0c10;
}

.reviewHead {
  padding: 10px 12px;
  border-bottom: 1px solid #1f2230;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.reviewBody {
  max-height: 420px;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1380px;
}

th,
td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid #1a1d29;
  font-size: 12px;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  background: #10131d;
  z-index: 1;
  white-space: nowrap;
}

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  white-space: nowrap;
  border: 1px solid #2a2f44;
  background: #121525;
}

.pill.high {
  border-color: #1f6b44;
  background: #0f2a1c;
}

.pill.medium {
  border-color: #7a5d1d;
  background: #3b2d12;
}

.pill.low {
  border-color: #5d647d;
  background: #1a1d29;
}

.pill.bad {
  border-color: #8a2e2e;
  background: #321616;
}

.issueBox {
  border: 1px solid #2a2f44;
  border-radius: 10px;
  padding: 10px;
  margin: 10px 0 0 0;
  background: #10131d;
  font-size: 12px;
}

.issueBox.warnBox {
  border-color: #7a5d1d;
  background: #19140a;
}

.issueBox.errBox {
  border-color: #8a2e2e;
  background: #1d0d0d;
}

.advList {
  margin: 6px 0 0 18px;
  padding: 0;
  line-height: 1.5;
}

.footerMark {
  position: fixed;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  opacity: 0.35;
  letter-spacing: 1px;
  z-index: 999;
}

.footerMark a {
  text-decoration: none;
  color: #8fa2ff;
}

.operatorBox {
  border: 1px solid #2a2f44;
  border-radius: 10px;
  padding: 10px;
  margin-top: 10px;
  background: #0f121a;
  font-size: 12px;
  line-height: 1.5;
}

.editPanel {
  margin-top: 12px;
  border: 1px solid #1f2230;
  border-radius: 12px;
  background: #0b0c10;
  display: none;
  overflow: hidden;
}

.editHead {
  padding: 10px 12px;
  border-bottom: 1px solid #1f2230;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.editBody {
  padding: 12px;
}

.muted {
  opacity: 0.75;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.templateSuggestionList {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.suggestionBtn {
  width: 100%;
  text-align: left;
  border: 1px solid #2a2f44;
  background: #121525;
  color: #eaeaf0;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.suggestionBtn:hover {
  background: #182041;
  border-color: #3a4bb8;
}

.suggestionTitle {
  font-size: 12px;
  font-weight: 600;
}

.suggestionMeta {
  font-size: 11px;
  opacity: 0.8;
  line-height: 1.45;
}

.hidden {
  display: none !important;
}

/* ----------------------------- */
/* DAILY REPORT PAGE             */
/* ----------------------------- */

.daily-report-page {
  display: flex;
  justify-content: center;
  padding: 32px 16px;
}

.daily-report-card {
  width: 100%;
  max-width: 1040px;
  border: 1px solid #1f2230;
  border-radius: 16px;
  background: #0d0f16;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.daily-report-card h1 {
  font-size: 22px;
  margin: 0 0 8px 0;
}

#reportDate {
  margin: 0 0 16px 0;
  font-size: 13px;
  opacity: 0.8;
}

.daily-report-output {
  border: 1px solid #262a3b;
  border-radius: 12px;
  background: #0b0c10;
  padding: 16px 18px;
  min-height: 260px;
  margin-bottom: 16px;
  line-height: 1.55;
  color: #eef2ff;
}

.daily-report-output .advList {
  margin-left: 18px;
}

.daily-report-output li {
  margin: 4px 0;
}

.report-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.report-actions button {
  min-width: 140px;
}

#reportStatus {
  margin-top: 14px;
  font-size: 12px;
  opacity: 0.8;
  line-height: 1.4;
}

#resetModal,
#loginModal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.68);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 4000;
  padding: 16px;
}

#resetModal.hidden,
#loginModal.hidden {
  display: none !important;
}

.modal-box {
  width: 100%;
  max-width: 420px;
  background: #0d0f16;
  border: 1px solid #262a3b;
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.modal-box h2 {
  margin: 0 0 12px 0;
  font-size: 18px;
}

.modal-box input {
  margin-bottom: 12px;
}

#resetMessage,
#loginMessage {
  margin-top: 10px;
  font-size: 12px;
  opacity: 0.85;
  line-height: 1.4;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 18px;
}

.status-item {
  border: 1px solid rgba(100, 130, 255, 0.18);
  background: linear-gradient(180deg, rgba(14, 20, 36, 0.92), rgba(10, 16, 32, 0.74));
  border-radius: 12px;
  padding: 12px 14px;
}

.status-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.7;
  margin-bottom: 6px;
}

.status-value {
  font-size: 15px;
  font-weight: 600;
  word-break: break-word;
}

.status-live {
  color: #89f7a1;
}

.status-idle {
  color: #9fb3d9;
}

.section-title {
  margin-bottom: 10px;
}

.report-divider {
  margin: 20px 0;
  opacity: 0.18;
}

.history-box {
  border: 1px solid rgba(100, 130, 255, 0.14);
  background: rgba(10, 16, 32, 0.55);
  border-radius: 12px;
  padding: 12px 14px;
  min-height: 68px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: rgba(210, 220, 255, 0.68);
}

.empty-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.empty-subtitle {
  font-size: 12px;
  opacity: 0.72;
}

.empty-item {
  opacity: 0.6;
}

.btn {
  border-radius: 10px;
  padding: 10px 14px;
  border: 1px solid rgba(100, 130, 255, 0.18);
  transition: 0.18s ease;
}

.btn-refresh {
  background: rgba(18, 24, 42, 0.95);
}

.btn-refresh:hover {
  transform: translateY(-1px);
  border-color: rgba(120, 150, 255, 0.34);
}

.btn-copy {
  background: rgba(12, 34, 24, 0.95);
  border-color: rgba(80, 180, 120, 0.28);
}

.btn-copy:hover {
  transform: translateY(-1px);
  border-color: rgba(100, 220, 150, 0.45);
  box-shadow: 0 0 0 1px rgba(100, 220, 150, 0.08);
}

.btn-reset {
  background: rgba(44, 14, 18, 0.96);
  border-color: rgba(255, 100, 100, 0.34);
}

.btn-reset:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 120, 120, 0.55);
  box-shadow: 0 0 0 1px rgba(255, 120, 120, 0.08);
}

/* ----------------------------- */
/* RESPONSIVE                    */
/* ----------------------------- */

@media (max-width: 1200px) {
  main {
    grid-template-columns: 1fr;
  }

  table {
    min-width: 1180px;
  }
}

@media (max-width: 980px) {
  .status-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .daily-report-card {
    padding: 16px;
  }

  .report-actions {
    flex-direction: column;
  }

  .report-actions button {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .status-strip {
    grid-template-columns: 1fr;
  }
}