:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f6f7f9;
  color: #172033;
}

* { box-sizing: border-box; }
body { margin: 0; }
button, input, textarea, select { font: inherit; }
button { border: 0; cursor: pointer; }

.app {
  max-width: 720px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 18px;
}

.topbar, .row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand { font-size: 28px; font-weight: 750; }
.sub { color: #697386; margin-top: 2px; }

.panel {
  background: #fff;
  border: 1px solid #e6e8ee;
  border-radius: 8px;
  padding: 18px;
  margin-top: 18px;
}

.stack { display: grid; gap: 12px; }
.hidden { display: none !important; }

input, textarea, select {
  width: 100%;
  border: 1px solid #d8dde8;
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  color: #172033;
}

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

button {
  min-height: 42px;
  border-radius: 8px;
  padding: 0 14px;
  background: #1f6feb;
  color: #fff;
  font-weight: 650;
}

.secondary { background: #eef4ff; color: #1f56ad; }
.ghost { background: transparent; color: #1f56ad; }
.danger { background: #fff1f0; color: #b42318; }
.icon-btn {
  width: 28px;
  min-height: 28px;
  padding: 0;
  border-radius: 50%;
  background: #eef2f7;
  color: #3b4658;
}

.tabs, .nav, .segments {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 14px 0;
}

.tabs { grid-template-columns: repeat(2, 1fr); }
.tab, .nav-item, .seg {
  background: #eef2f7;
  color: #3b4658;
}
.tab.active, .nav-item.active, .seg.active {
  background: #172033;
  color: #fff;
}

.view { display: grid; gap: 12px; }
h1, h2 { margin: 0; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }

.row-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.current, .detail, .record-card, .edit-box, .inline-status {
  border: 1px solid #e6e8ee;
  border-radius: 8px;
  padding: 12px;
  background: #fafbfc;
}

.inline-status {
  color: #3b4658;
  font-size: 13px;
  line-height: 1.5;
}

.edit-box {
  display: grid;
  gap: 10px;
}

.actions-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.muted { color: #697386; }
.list { display: grid; gap: 10px; }
.record-card { cursor: pointer; }
.record-title { font-weight: 750; margin-bottom: 6px; }
.record-meta { color: #697386; font-size: 13px; line-height: 1.5; }
.detail {
  display: grid;
  gap: 10px;
}
.detail pre {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  line-height: 1.6;
}
.detail ul {
  margin: 0;
  padding-left: 20px;
}
.error-text {
  color: #b42318;
  font-size: 13px;
  margin-top: 4px;
}
.mini-btn {
  min-height: 28px;
  padding: 0 10px;
  margin-top: 6px;
  font-size: 13px;
}
.usage-list { display: grid; gap: 8px; margin-top: 8px; }
.usage-row {
  display: grid;
  grid-template-columns: 1.2fr .8fr .6fr .9fr .9fr .8fr;
  gap: 8px;
  align-items: center;
  border-top: 1px solid #e6e8ee;
  padding-top: 8px;
  font-size: 13px;
  color: #3b4658;
}

.sheet {
  position: fixed;
  inset: 0;
  background: rgba(23, 32, 51, .36);
  display: flex;
  align-items: flex-end;
  padding: 16px;
}
.sheet-card {
  width: min(720px, 100%);
  margin: 0 auto;
  background: #fff;
  border-radius: 12px;
  padding: 18px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #172033;
  color: #fff;
  border-radius: 8px;
  padding: 10px 14px;
  max-width: calc(100vw - 32px);
}

@media (max-width: 560px) {
  .actions-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .usage-row { grid-template-columns: 1fr 1fr; }
}
