/* สีจาก design system ของ Playground Intelligence (docs/design-assets/design-system.md ใน repo หลัก) */
@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Thai:wght@400;600;700&display=swap");

:root {
  --green: #1B5E20;
  --blue: #0277BD;
  --yellow: #FBC02D;
  --red: #C62828;
  --surface: #f8f9fa;
  --card: #ffffff;
  --text: #191c1d;
  --muted: #41493e;
  --line: #e1e3e4;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "IBM Plex Sans Thai", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
}

.navbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 20px;
  padding: 12px 16px;
  background: var(--green);
  color: #fff;
}
.navbar .brand { font-weight: 700; margin-right: 12px; }
.navbar a {
  color: #fff;
  text-decoration: none;
  opacity: 0.85;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
}
.navbar a.active,
.navbar a:hover { opacity: 1; border-bottom-color: var(--yellow); }

.container { max-width: 1000px; margin: 0 auto; padding: 24px 16px 48px; }

h1 { margin: 0 0 4px; font-size: 28px; color: var(--blue); }
h2 { margin: 0 0 8px; font-size: 20px; color: var(--blue); }
.subtitle { margin: 0 0 16px; color: var(--muted); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th { font-size: 14px; color: var(--muted); font-weight: 600; white-space: nowrap; }
td.time { white-space: nowrap; font-variant-numeric: tabular-nums; }
td.zone { font-weight: 600; white-space: nowrap; }
.count { margin: 0 0 8px; color: var(--muted); font-size: 14px; }

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-pending  { background: #fff4cc; color: #6b4e00; border: 1px solid var(--yellow); }
.badge-ack      { background: #e1f1fb; color: #01579b; border: 1px solid var(--blue); }
.badge-resolved { background: #e3f1e3; color: var(--green); border: 1px solid var(--green); }
.badge-unknown  { background: #eeeeee; color: #333333; border: 1px solid #cccccc; }

.alert { border-radius: 8px; padding: 12px 16px; margin-bottom: 16px; }
.alert-warn { background: #fff4cc; border: 1px solid var(--yellow); }
.error { color: var(--red); }

/* Buttons */
.btn {
  display: inline-block;
  background: var(--green);
  color: #fff;
  text-decoration: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  font-size: 16px;
}
.btn:hover { opacity: 0.9; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

button { font: inherit; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--green);
  color: var(--green);
}
.btn-ghost:hover { background: #f0f7f0; }

.btn-ok {
  background: var(--green);
  color: #fff;
  border: none;
}

.btn-danger {
  background: var(--red);
  color: #fff;
  border: none;
}

.btn-blue {
  background: var(--blue);
  color: #fff;
  border: none;
}

.btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}

/* Forms */
label {
  display: block;
  margin-top: 12px;
  margin-bottom: 4px;
  font-weight: 600;
  color: var(--text);
}

input, select, textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 16px;
  font-family: inherit;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(2, 119, 189, 0.1);
}

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

/* Alerts */
.alert {
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
}
.alert-warn { background: #fff4cc; border: 1px solid var(--yellow); }
.alert-error { background: #ffebee; border: 1px solid var(--red); color: var(--red); }
.alert-ok { background: #e3f1e3; border: 1px solid var(--green); color: var(--green); }
.alert-ai { background: #f3e5f5; border: 1px solid #9c27b0; }

.hidden { display: none !important; }

/* Field rows for detail view */
.field-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.field-row strong { min-width: 120px; }
.field-row span { flex: 1; }

/* Response list */
.response {
  margin-bottom: 12px;
  padding: 12px;
  border-left: 4px solid var(--blue);
  background: #f9fafb;
  border-radius: 4px;
}
.response-meta {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 8px;
}
.response-text { color: var(--text); }

/* Navigation user info */
.nav-user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

/* Clickable rows */
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: var(--surface); }

.card { margin-bottom: 16px; }

@media (max-width: 640px) {
  .hide-mobile { display: none; }
  h1 { font-size: 24px; }
  .btn-row { flex-direction: column; }
  .btn-row .btn, .btn-row a { width: 100%; text-align: center; }
  .field-row { flex-direction: column; }
  .field-row strong { margin-bottom: 4px; }
}
