:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1d212b;
  --border: #2a2f3a;
  --text: #e6e8ee;
  --muted: #8b93a3;
  --accent: #4f8cff;
  --accent-2: #38d39f;
  --warn: #ffb347;
  --bad: #ff5c6c;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { font-size: 20px; font-weight: 700; letter-spacing: .5px; }
.brand span { color: var(--muted); font-weight: 400; }

nav { display: flex; gap: 6px; flex-wrap: wrap; }

nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 14px;
  transition: background .15s, color .15s;
}
nav a:hover { color: var(--text); background: var(--panel-2); }
nav a.active { color: #fff; background: var(--accent); }

main { flex: 1; width: 100%; max-width: 1000px; margin: 0 auto; padding: 28px 24px 40px; }

footer { border-top: 1px solid var(--border); padding: 18px 24px; text-align: center; color: var(--muted); font-size: 13px; }
footer b { color: var(--text); }

.hero { margin-bottom: 26px; }
.hero h1 { font-size: 28px; margin-bottom: 8px; }
.hero p { color: var(--muted); max-width: 720px; }
.hero b { color: var(--text); }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 26px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
}
.card-label { color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.card-value { font-size: 26px; font-weight: 700; }
.card-value.sm { font-size: 19px; word-break: break-all; }
.card-note { color: var(--muted); font-size: 12px; margin-top: 6px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 22px;
}
.panel h2 { font-size: 18px; margin-bottom: 14px; }

.feature-list { list-style: none; }
.feature-list li {
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
  color: var(--muted);
}
.feature-list li:last-child { border-bottom: none; }
.feature-list a { color: var(--accent); text-decoration: none; }
.feature-list a:hover { text-decoration: underline; }

.page-head { margin-bottom: 18px; }
.page-head h1 { font-size: 24px; margin-bottom: 4px; }
.page-head p { color: var(--muted); font-size: 14px; }

.table-wrap {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow-x: auto;
}

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

th {
  text-align: left;
  padding: 12px 16px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .6px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
  white-space: nowrap;
}

td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--panel-2); }
td.dim { color: var(--muted); }
td.money { font-variant-numeric: tabular-nums; font-weight: 600; }
td.empty, .empty { text-align: center; color: var(--muted); padding: 24px; }

.timecell {
  display: flex;
  flex-direction: column;
  line-height: 1.35;
  white-space: normal;
}
.time-range { font-weight: 600; font-variant-numeric: tabular-nums; }
.time-date { color: var(--muted); font-size: 12px; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge.ok { background: rgba(56, 211, 159, .14); color: var(--accent-2); }
.badge.warn { background: rgba(255, 179, 71, .14); color: var(--warn); }
.badge.bad { background: rgba(255, 92, 108, .14); color: var(--bad); }

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 18px;
}
.page-info { color: var(--muted); font-size: 14px; }
.page-btn {
  color: #fff;
  background: var(--accent);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
}
.page-btn:hover { filter: brightness(1.1); }

table.kv { font-size: 14px; }
table.kv td { border-bottom: 1px solid var(--border); padding: 10px 4px; }
table.kv tr:last-child td { border-bottom: none; }
table.kv td:first-child { color: var(--muted); width: 220px; }

.hint { color: var(--muted); font-size: 13px; margin-top: 14px; }
.hint a { color: var(--accent); text-decoration: none; }
.hint a:hover { text-decoration: underline; }

.card-note a { color: var(--accent); text-decoration: none; }
.card-note a:hover { text-decoration: underline; }

.form-panel { margin-bottom: 18px; }

.record-form {
  display: flex;
  gap: 14px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field label { color: var(--muted); font-size: 13px; }

.form-field input,
.form-field select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 12px;
  font-size: 14px;
  min-width: 180px;
}
.form-field select option { background: var(--panel-2); }
.form-field input:focus,
.form-field select:focus { outline: none; border-color: var(--accent); }

.btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.1); }

.form-error {
  background: rgba(255, 92, 108, .12);
  color: var(--bad);
  border: 1px solid rgba(255, 92, 108, .3);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  margin-bottom: 14px;
}

.feed { display: flex; flex-direction: column; gap: 10px; }

.feed-item {
  display: flex;
  gap: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  align-items: flex-start;
}

.feed-time {
  display: flex;
  flex-direction: column;
  line-height: 1.35;
  min-width: 110px;
  border-right: 2px solid var(--accent);
  padding-right: 14px;
  margin-right: 2px;
}
.feed-time .time-range { font-weight: 700; font-variant-numeric: tabular-nums; }
.feed-time .time-date { color: var(--muted); font-size: 12px; }

.feed-body { display: flex; flex-direction: column; gap: 6px; }
.feed-title { font-size: 16px; font-weight: 600; }
.feed-meta { display: flex; gap: 8px; flex-wrap: wrap; }

.tag {
  display: inline-block;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 12px;
}
.tag.dim { color: var(--muted); }

.page-nav {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.timeline-wrap {
  display: flex;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.tl-gutter {
  width: 62px;
  flex-shrink: 0;
  background: var(--panel-2);
  border-right: 1px solid var(--border);
}

.tl-label {
  height: 44px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 4px;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.tl-sched {
  flex: 1;
  position: relative;
  background: repeating-linear-gradient(
    to bottom,
    var(--border) 0 1px,
    transparent 1px 44px
  );
}

.tl-item {
  position: absolute;
  left: 6px;
  right: 6px;
  background: rgba(79, 140, 255, .12);
  border: 1px solid var(--accent);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 6px 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tl-item-time { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent-2); }
.tl-item-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-item-meta { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-item-meta.dim { color: var(--muted); opacity: .85; }

.tl-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 640px) {
  .feed-item { flex-direction: column; gap: 8px; }
  .feed-time { border-right: none; border-bottom: 2px solid var(--accent); padding-right: 0; padding-bottom: 8px; }
  .tl-gutter { width: 50px; }
}

@media (max-width: 640px) {
  .topbar { flex-direction: column; gap: 10px; }
  .card-value { font-size: 22px; }
  .record-form { flex-direction: column; align-items: stretch; }
  .form-field input { min-width: 0; }
}
