:root {
  color-scheme: light;
  --bg: #181818;
  --bg-2: #fde9d9;
  --card: #ffffff;
  --ink: #1f1f22;
  --muted: #b8b8b8;
  --accent: #0f766e;
  --accent-2: #e27f5d;
  --stroke: #e8ddd1;
  --shadow: 0 32px 80px rgba(15, 25, 35, 0.15);
  --radius: 4px;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
}

@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600&family=Fraunces:opsz,wght@9..144,600&display=swap");

* {
  box-sizing: border-box;
}

html {
  background-color: var(--bg);
}

body {
  margin: 0;
  background-color: var(--bg);
  /* background-image: url("bg.png"); */
  background-position: top center;
  background-repeat: no-repeat;
  background-size: contain;
  background-attachment: fixed;
  color: var(--ink);
  min-width: 100vh;
}

.page {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 48px 16px 64px;
}

.ambient-grid {
  position: absolute;
  inset: 0;
  /* background-image: linear-gradient(transparent 92%, rgba(15, 118, 110, 0.08)),
    linear-gradient(90deg, transparent 92%, rgba(15, 118, 110, 0.08));
  background-size: 120px 120px;
  mask-image: radial-gradient(circle at 20% 20%, black, transparent 70%); */
  pointer-events: none;
}

.panel {
  width: min(92vw, 520px);
  display: grid;
  gap: 28px;
  animation: float-in 0.8s ease;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), #0f4d4a);
  color: #fff;
  font-weight: 700;
  letter-spacing: 1px;
}

.brand-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #f2eee8;
}

.brand-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
  border: 1px solid var(--stroke);
  display: grid;
  gap: 20px;
}

.card-header h1 {
  margin: 0 0 6px;
  font-family: "Fraunces", "Times New Roman", serif;
  font-size: 32px;
}

.muted {
  margin: 0;
  color: var(--muted);
}

.social-row {
  display: grid;
  gap: 12px;
}

.ghost-btn {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--stroke);
  background: #fff;
  padding: 12px 16px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.2s ease, border 0.2s ease;
}

.ghost-btn:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}

.divider {
  position: relative;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.divider::before,
.divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 42%;
  height: 1px;
  background: var(--stroke);
}

.divider::before {
  left: 0;
}

.divider::after {
  right: 0;
}

.form {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
  font-weight: 500;
}

.field input {
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--stroke);
  font-size: 15px;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

.field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.form-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 14px;
}

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

.primary-btn {
  border: none;
  border-radius: var(--radius);
  padding: 14px 18px;
  background: linear-gradient(135deg, var(--accent), #0c5f58);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 40px rgba(15, 118, 110, 0.25);
}

.link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.hint {
  margin: 0;
  font-size: 14px;
}

.form-error {
  margin: 0;
  font-size: 13px;
  color: #b2442a;
  min-height: 18px;
}

.dashboard-page {
  padding: 56px 16px 80px;
}

.dashboard {
  width: min(94vw, 1040px);
  display: grid;
  gap: 32px;
  animation: float-in 0.8s ease;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.profile-chip {
  background: #fff8f1;
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 10px 18px;
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 14px;
}

.chip-label {
  color: var(--muted);
}

.chip-value {
  font-weight: 600;
}

.dashboard-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.dash-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--stroke);
  padding: 24px;
  display: grid;
  gap: 18px;
  min-height: 200px;
  box-shadow: 0 24px 50px rgba(15, 25, 35, 0.12);
}

.dash-card h2 {
  margin: 0 0 6px;
  font-size: 20px;
}

.dash-logout {
  background: linear-gradient(135deg, #fff3f0, #fff);
}

.danger-btn {
  border: none;
  border-radius: var(--radius);
  padding: 14px 18px;
  background: linear-gradient(135deg, #d24b2a, #a23a22);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.exceptions-card {
  padding: 32px;
}

.exceptions-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.search-box {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  flex: 1;
}

.search-box label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}

.search-box input,
.search-box select {
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--stroke);
  font-size: 14px;
}

.search-box .primary-btn {
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  box-shadow: none;
}

.search-box .primary-btn:hover {
  box-shadow: none;
}

.toolbar-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.toolbar-actions .ghost-btn {
  width: auto;
  padding: 8px 14px;
  font-size: 12px;
}

.toolbar-actions .link {
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  padding: 6px 0;
}

.table-wrap {
  display: grid;
  gap: 12px;
  transition: opacity 0.2s ease, filter 0.2s ease;
}

.table-wrap.is-loading {
  filter: blur(2px);
  opacity: 0.7;
  pointer-events: none;
}

.exceptions-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.exceptions-table th,
.exceptions-table td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--stroke);
  vertical-align: top;
}

.exceptions-table tr.has-template td {
  color: #bd1c2f;
}

.exceptions-table tr.has-warning td {
  color: #d27b2a;
}

.exceptions-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.exceptions-table td:last-child {
  text-align: right;
}

.table-action {
  border: none;
  background: transparent;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
}

.pagination-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pagination .ghost-btn {
  width: auto;
  padding: 8px 14px;
  font-size: 12px;
}

.exception-form {
  background: #fff8f1;
  border-radius: var(--radius);
  padding: 24px;
  border: 1px solid var(--stroke);
}

.exception-form textarea {
  resize: vertical;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--stroke);
  font-size: 14px;
}

.form-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.form-mode {
  font-size: 12px;
  padding: 6px 12px;
  border-radius: var(--radius);
  background: #ffffff;
  border: 1px solid var(--stroke);
  font-weight: 600;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.form-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.danger-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 32px rgba(210, 75, 42, 0.25);
}

.monitor-page {
  padding: 56px 16px 80px;
}

.monitor {
  width: min(96vw, 1200px);
  display: grid;
  gap: 28px;
  animation: float-in 0.8s ease;
}

.monitor-header {
  gap: 24px;
}

.monitor-top-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.monitor-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.monitor-card {
  padding: 24px;
  gap: 18px;
}

.monitor-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.monitor-card-header h1 {
  margin: 0 0 6px;
  font-family: "Fraunces", "Times New Roman", serif;
  font-size: 26px;
}

.monitor-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.monitor-chip {
  background: #fff8f1;
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
}

.monitor-table-wrap {
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  overflow-x: auto;
}

.monitor-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 920px;
}

.monitor-table th,
.monitor-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--stroke);
  vertical-align: middle;
  background: #fffdf9;
}

.monitor-table th {
  font-weight: 600;
  color: #6f5b46;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.06em;
  position: sticky;
  top: 0;
  background: #fff4ea;
  z-index: 2;
}

.monitor-table tr:nth-child(even) td {
  background: #fff9f3;
}

.monitor-table tr:hover td {
  background: #fff1e5;
}

.sticky-left {
  position: sticky;
  left: 0;
  z-index: 3;
  box-shadow: 8px 0 18px rgba(15, 25, 35, 0.08);
}

.svc-name {
  font-weight: 600;
}

.cell-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 160px;
}

.cell-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.hostname {
  font-family: ui-monospace, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 11px;
  color: #8b7a6a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.timestamp {
  font-size: 11px;
  color: #8b7a6a;
  white-space: nowrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid transparent;
  width: fit-content;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background-color: #9f8d7a;
}

.status-ok {
  background: rgba(15, 118, 110, 0.12);
  border-color: var(--accent);
  color: #0f766e;
}

.status-ok .status-dot {
  background-color: var(--accent);
  box-shadow: 0 0 6px rgba(15, 118, 110, 0.4);
}

.status-warn {
  background: rgba(226, 127, 93, 0.18);
  border-color: var(--accent-2);
  color: #b45420;
}

.status-warn .status-dot {
  background-color: var(--accent-2);
  box-shadow: 0 0 6px rgba(226, 127, 93, 0.35);
}

.status-error {
  background: rgba(178, 68, 42, 0.12);
  border-color: #b2442a;
  color: #b2442a;
}

.status-error .status-dot {
  background-color: #b2442a;
  box-shadow: 0 0 6px rgba(178, 68, 42, 0.35);
}

.status-pending {
  background: rgba(184, 184, 184, 0.2);
  border-color: #c9b8a6;
  color: #6f5b46;
}

.status-pending .status-dot {
  background-color: #c9b8a6;
  box-shadow: 0 0 6px rgba(201, 184, 166, 0.35);
}

.spark {
  width: 140px;
  height: 28px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid rgba(232, 221, 209, 0.85);
}

.monitor-footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
}

.monitor-footer code {
  font-family: ui-monospace, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 11px;
  background: #fff;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
}

@keyframes float-in {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 520px) {
  .card {
    padding: 24px;
  }
  .card-header h1 {
    font-size: 28px;
  }
}
