@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700&display=swap");

:root {
  --bg: #f6f8fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #4f6ef7;
  --accent-2: #22c55e;
  --danger: #ef4444;
  --border: #e5eaf2;
  --sidebar: #f8fafc;
  --shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Manrope", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 230px;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  padding: 6px 10px;
}

.brand-title {
  font-weight: 700;
  letter-spacing: 0.2px;
}

.brand-sub {
  font-size: 12px;
  color: var(--muted);
}

.nav {
  display: grid;
  gap: 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #334155;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
}

.nav-link:hover {
  background: #f0f5ff;
}

.nav-link .nav-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #f1f5ff;
  color: #355ca8;
  flex: 0 0 18px;
}

.nav-link .nav-icon .icon {
  width: 14px;
  height: 14px;
}

.nav-link.active {
  background: #eaf1ff;
  color: #1e3a8a;
  box-shadow: inset 0 0 0 1px #dbe7ff;
}

.nav-link.active .nav-icon {
  background: #dbe7ff;
  color: #1e3a8a;
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  padding: 8px 10px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-2);
}

.content {
  flex: 1;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
  background: #ffffff;
}

.topbar-title {
  font-weight: 700;
  font-size: 20px;
}

.topbar-sub {
  color: var(--muted);
  font-size: 13px;
}

.main {
  padding: 22px 28px 40px;
  display: grid;
  gap: 16px;
}

.card {
  background: var(--card);
  border: 1px solid #eef2f7;
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--shadow);
  position: relative;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 8px;
  gap: 12px;
  flex-wrap: wrap;
}

.card-header .filter-row,
.card-header .link,
.card-header form {
  margin-left: auto;
}

.card-accent::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  border-radius: 12px 12px 0 0;
  background: linear-gradient(90deg, #dbe7ff 0%, #edf2ff 60%, #ffffff 100%);
}

.card-accent.info::before {
  background: linear-gradient(90deg, #cfe1ff 0%, #e6efff 60%, #ffffff 100%);
}

.card-accent.warn::before {
  background: linear-gradient(90deg, #ffd7b8 0%, #fff1e7 60%, #ffffff 100%);
}

.card-accent.ok::before {
  background: linear-gradient(90deg, #c8f0d8 0%, #eafaf1 60%, #ffffff 100%);
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.card h2 {
  font-size: 14px;
  font-weight: 700;
  margin: 0;
  padding: 6px 12px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #e6efff 0%, #f3f6ff 55%, #f8fbff 100%);
  color: #1f3b7a;
  border: 1px solid #dde7ff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7);
}

.card h2.info {
  background: linear-gradient(135deg, #e6efff 0%, #f3f6ff 55%, #f8fbff 100%);
  color: #1f3b7a;
  border-color: #dde7ff;
}

.card h2.warn {
  background: linear-gradient(135deg, #fff1e7 0%, #fff7ef 55%, #fffaf5 100%);
  color: #9a4b12;
  border-color: #ffe3cd;
}

.card h2.ok {
  background: linear-gradient(135deg, #eafaf1 0%, #f3fbf7 55%, #fbfffd 100%);
  color: #136640;
  border-color: #d3f1df;
}

.card h2 .pill-icon {
  margin-right: 0;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.grid-5 {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.stat-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
}

.stat-card .stat-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stat-card .pill-icon {
  width: 22px;
  height: 22px;
  border-radius: 8px;
}

.stat-card .pill-icon .icon {
  width: 16px;
  height: 16px;
}

.stat-card .stat-label {
  font-size: 13px;
  font-weight: 600;
  color: #475569;
}

.stat-card .stat-value {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
}

.stat-value.new {
  color: #166534;
}

.stat-value.todo {
  color: #b91c1c;
}

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

.stat-row .stat-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stat-row .stat-label {
  font-size: 13px;
  font-weight: 600;
  color: #475569;
}

.stat-row .pill-icon {
  width: 22px;
  height: 22px;
  border-radius: 8px;
}

.stat-row .pill-icon .icon {
  width: 16px;
  height: 16px;
}

.stat-row + .stat-row {
  margin-top: 10px;
}

.stat-compact .stat {
  padding: 12px 14px;
}

.stat {
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid #eef2f7;
  padding: 14px;
  position: relative;
  overflow: hidden;
}

.stat-info {
  border-left: 4px solid #8bb4ff;
}

.stat-warn {
  border-left: 4px solid #f9b16e;
}

.stat-ok {
  border-left: 4px solid #7bdc9a;
}

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.stat-icon {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #eef2ff;
  color: #1e3a8a;
  flex: 0 0 28px;
}

.stat-icon .icon {
  width: 16px;
  height: 16px;
}

.stat-icon.info { background: #e7efff; color: #1e3a8a; }
.stat-icon.warn { background: #fff1e7; color: #b45309; }
.stat-icon.ok { background: #e9f8ee; color: #15803d; }

.stat-label {
  color: #6b7280;
  font-size: 12px;
}

.stat-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
  line-height: 1.2;
  margin: 0;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #dde7ff;
  background: linear-gradient(135deg, #e6efff 0%, #f3f6ff 55%, #f8fbff 100%);
  color: #1f3b7a;
}

.stat-title.info {
  border-color: #dde7ff;
  background: linear-gradient(135deg, #e6efff 0%, #f3f6ff 55%, #f8fbff 100%);
  color: #1f3b7a;
}
.stat-title.warn {
  border-color: #ffe3cd;
  background: linear-gradient(135deg, #fff1e7 0%, #fff7ef 55%, #fffaf5 100%);
  color: #9a4b12;
}
.stat-title.ok {
  border-color: #d3f1df;
  background: linear-gradient(135deg, #eafaf1 0%, #f3fbf7 55%, #fbfffd 100%);
  color: #136640;
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
  margin: 6px 0;
  word-break: break-word;
}

.stat-sub {
  color: var(--muted);
  font-size: 12px;
}

.form label {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
}

input,
textarea {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  background: #fff;
}

.row-input {
  width: 100%;
  min-width: 180px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 13px;
}

button {
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  line-height: 1.1;
  font-family: inherit;
}

button.danger { background: var(--danger); }
button.ghost { background: white; color: var(--accent); }
.ghost {
  background: white;
  color: var(--accent);
  border: 1px solid var(--border);
  padding: 9px 14px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 13px;
  line-height: 1.1;
  font-family: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.inline { display: inline; }

.badge {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
}

.badge.ok { background: #e9f8ee; color: #15803d; }
.badge.off { background: #fee2e2; color: #b91c1c; }
.badge.warn { background: #fff7ed; color: #b45309; }

.alert {
  background: #fff7ed;
  color: #b45309;
  border: 1px solid #fed7aa;
  border-radius: 12px;
  padding: 10px 12px;
  margin: 0 0 14px 0;
  font-size: 13px;
  font-weight: 600;
}

.alert.warn strong {
  color: #9a3412;
}

.status-icon {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.04);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.status-icon.new { background: #22c55e; }
.status-icon.todo { background: #f43f5e; }
.status-icon.read { background: #94a3b8; }

.status-text.new {
  background: #dcfce7;
  color: #166534;
}

.status-text.todo {
  background: #ffe4e6;
  color: #9f1239;
}

.status-text.read {
  background: #e2e8f0;
  color: #475569;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 600;
  background: #eef2ff;
  color: #1e3a8a;
}

.pill.new {
  background: #dcfce7;
  color: #166534;
}

.pill.todo {
  background: #ffe4e6;
  color: #9f1239;
}

.pill.read {
  background: #e2e8f0;
  color: #475569;
}

.pill.danger {
  background: #fee2e2;
  color: #b91c1c;
}

.link-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eaf1ff;
  color: #1e3a8a;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid #d6e4ff;
  font-size: 12px;
}

.link-pill:hover {
  background: #dde8ff;
}

.pill-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 6px;
  margin-right: 6px;
  background: rgba(15, 23, 42, 0.08);
  color: #334155;
}

.pill-icon.new { background: rgba(22, 163, 74, 0.16); color: #166534; }
.pill-icon.todo { background: rgba(225, 29, 72, 0.16); color: #9f1239; }
.pill-icon.read { background: rgba(100, 116, 139, 0.16); color: #475569; }
.pill-icon.danger { background: rgba(185, 28, 28, 0.16); color: #b91c1c; }
.pill-icon.blue { background: rgba(59, 130, 246, 0.16); color: #1e3a8a; }
.pill-icon.info { background: rgba(79, 110, 247, 0.16); color: #1e3a8a; }
.pill-icon.warn { background: rgba(249, 177, 110, 0.18); color: #9a4b12; }
.pill-icon.ok { background: rgba(34, 197, 94, 0.18); color: #136640; }

.pill-icon .icon {
  width: 12px;
  height: 12px;
}

tbody tr:hover .status-icon {
  transform: scale(1.15);
  box-shadow: 0 0 0 4px rgba(79, 110, 247, 0.12);
}

.small { color: var(--muted); font-size: 13px; }

.error { color: var(--danger); }

.status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 12px;
  flex-wrap: wrap;
}

.action-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.stat-action {
  margin-left: auto;
  margin-top: 6px;
  align-self: flex-end;
}

.log-box {
  background: #0b1220;
  color: #d1d5db;
  padding: 12px;
  border-radius: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  max-height: 420px;
  overflow: auto;
}

.log-line {
  padding: 2px 0;
  border-bottom: 1px dashed rgba(148, 163, 184, 0.2);
}

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

.filter-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: #334155;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
}

.chip.active {
  background: #eaf1ff;
  border-color: #d6e4ff;
  color: #1e3a8a;
}

.login-page {
  background: linear-gradient(180deg, #f7f9ff, #f1f5ff);
}

.login {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  width: min(420px, 92vw);
}

.login-brand {
  margin-bottom: 10px;
}

.code {
  background: #0b1220;
  color: #e2e8f0;
  padding: 12px;
  border-radius: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
}

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

tbody tr {
  position: relative;
}

.row-todo {
  border-left: 4px solid #f43f5e;
}

.row-new {
  border-left: 4px solid #22c55e;
}

.row-read {
  border-left: 4px solid #94a3b8;
}

thead th {
  text-align: left;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

tbody td {
  padding: 8px 4px;
  border-bottom: 1px solid var(--border);
}


.row-todo td,
.row-new td,
.row-read td {
  transition: background 160ms ease, color 160ms ease;
}

.row-todo:hover td {
  background: #ffe4e6;
}

.row-new:hover td {
  background: #dcfce7;
}

.row-read:hover td {
  background: #eef2f7;
  color: #475569;
}

.row-todo td {
  background: #fff1f2;
}

.row-new td {
  background: #f0fdf4;
}

.row-read td {
  background: #f8fafc;
  color: #64748b;
}

@media (max-width: 1100px) {
  .grid-3 { grid-template-columns: 1fr; }
  .grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; flex-wrap: wrap; }
  .content { width: 100%; }
  .topbar { flex-direction: column; align-items: flex-start; gap: 10px; }
  .main { padding: 18px; }
  .grid-5 { grid-template-columns: 1fr; }
}
