* { box-sizing: border-box; }

body {
  margin: 0;
  font: 15px/1.45 system-ui, sans-serif;
  color: #1c2430;
  background: #eef0f3;
}

.page { max-width: 1120px; margin: 0 auto; padding: 16px; }

.appbar {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
  border-bottom: 1px solid #d9dee7;
}

.appbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

h1 { font-size: 18px; margin: 0; }

button.brand {
  border: 0;
  background: transparent;
  padding: 0;
  font: inherit;
  font-weight: 700;
  color: inherit;
}

.lang-select {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: #5c6b7a;
}

.lang-select select { width: auto; }

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

#logout { color: #5c6b7a; }

.login {
  max-width: 360px;
  margin: 48px auto;
  padding: 20px;
  background: #fff;
  border: 1px solid #d9dee7;
  border-radius: 12px;
}

.login button { width: 100%; margin-top: 8px; }

.hint, .meta { color: #5c6b7a; margin: 0; }

.tab-count {
  display: inline-block;
  min-width: 1.2em;
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 999px;
  background: #e7ebf1;
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

.tabs button[aria-selected="true"] .tab-count {
  background: rgba(255, 255, 255, 0.28);
  color: #fff;
}

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

.tabs { display: flex; gap: 6px; flex-wrap: wrap; }

.tabs button[aria-selected="true"] {
  background: #1f6feb;
  border-color: #1f6feb;
  color: #fff;
}

.section { margin-top: 18px; }
.section h2 { margin-bottom: 8px; }

button.section-toggle {
  display: flex;
  align-items: baseline;
  gap: 8px;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 600;
}

button.section-toggle .mark { color: #5c6b7a; }

.editor {
  background: #fff;
  border: 1px solid #d9dee7;
  border-radius: 10px;
}

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

button.entry-row {
  display: block;
  width: 100%;
  text-align: left;
  background: #fff;
  border: 1px solid #d9dee7;
  border-radius: 10px;
  padding: 12px 14px;
  margin: 0;
}

button.entry-row:hover { background: #f3f7fc; }
button.entry-row.is-hidden { opacity: 0.72; }
.entry-row > strong, .entry-row > span { display: block; }
.entry-row > .entry-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.entry-row > .tags { display: flex; margin: 4px 0; }
.entry-row strong { font-weight: 600; }

.type-chip { flex: 0 0 auto; font-weight: 600; }
.type-chip.tone-major { border-color: #d1242f; color: #d1242f; }
.type-chip.tone-minor { border-color: #e07a1a; color: #e07a1a; }
.type-chip.tone-degradation { border-color: #c9a000; color: #8a6800; }
.type-chip.tone-maintenance { border-color: #1f6feb; color: #1f6feb; }
.type-chip.tone-info { border-color: #8b97a6; color: #5c6b7a; }

.list {
  padding: 12px;
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 24px);
  overflow: auto;
}

.list-head, .actions, .message-actions, .checks {
  display: flex;
  gap: 8px;
  align-items: center;
}

.list-head { justify-content: space-between; margin-bottom: 8px; }

h2 { font-size: 16px; margin: 0; }

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button {
  border: 1px solid #c5ced8;
  background: #fff;
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
}

button.primary { background: #1f6feb; border-color: #1f6feb; color: #fff; }
button.danger { color: #9f1d16; border-color: #e7b8b4; }

button.incident {
  display: block;
  width: 100%;
  text-align: left;
  border-color: transparent;
  background: transparent;
  padding: 8px;
  margin: 0 0 4px;
}

button.incident.active { background: #f3f7fc; border-color: #c5d4ea; }
button.incident.is-hidden { opacity: 0.72; }

.incident > strong, .incident > span { display: block; }
.incident strong { font-weight: 600; }
.snippet {
  color: #5c6b7a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.editor { padding: 16px; }

fieldset {
  border: 1px solid #e1e6ee;
  border-radius: 8px;
  margin: 0 0 14px;
  padding: 12px;
}

legend { font-weight: 600; padding: 0 4px; }

.message-card .meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.more { position: relative; flex: 0 0 auto; margin-left: auto; }

.more-btn {
  border: 0;
  background: transparent;
  padding: 0 4px;
  font-size: 20px;
  line-height: 1;
  letter-spacing: 0;
  color: #5c6b7a;
  list-style: none;
  cursor: pointer;
}

.more-btn::-webkit-details-marker { display: none; }

.more-menu {
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 3;
  min-width: 120px;
  padding: 4px;
  background: #fff;
  border: 1px solid #d9dee7;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(28, 36, 48, 0.12);
}

.more-menu button {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  border-radius: 6px;
}

.more-menu button:hover { background: #eef3f8; }

.message-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 10px;
}

.message-card {
  background: #fff;
  border: 1px solid #d9dee7;
  border-radius: 10px;
  padding: 12px;
  margin: 0 0 14px;
}

.message-card.is-hidden { opacity: 0.72; }

.entry-view fieldset {
  background: #fff;
  border: 1px solid #d9dee7;
  border-radius: 10px;
}

.head-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0 16px;
}

.line {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0 0 8px;
}

.head-fields .line { align-items: center; margin: 0; }

.line[hidden],
#schedule-row[hidden],
label[hidden] { display: none; }

.head-fields .line.block,
.head-fields .line.note { align-items: flex-start; }

.head-fields .line.note .v {
  white-space: pre-wrap;
  min-width: 0;
}

.head-fields .grow { flex: 1 1 auto; min-width: 0; }

.line .k {
  flex: 0 0 160px;
  color: #5c6b7a;
}

.req {
  margin-left: 2px;
  color: #9f1d16;
  font-weight: 700;
  text-decoration: none;
}

.line.title .k,
.line.title .v,
.line.title input {
  font-weight: 700;
  color: #1c2430;
}

label.line { margin: 0; }

.head-fields input[type="url"],
.head-fields input[type="text"],
.head-fields input[type="datetime-local"],
.head-fields select,
.head-fields textarea {
  width: 320px;
  max-width: 100%;
  flex: 0 0 320px;
}

.head-fields textarea { min-height: 72px; }

.chip {
  background: transparent;
  border: 1px solid #d5deea;
  border-radius: 4px;
  padding: 0 5px;
  font-size: 12px;
  line-height: 1.5;
}

.tags { display: flex; flex-wrap: wrap; gap: 6px; }

.tag {
  background: #eef3f8;
  border: 1px solid #d5deea;
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 13px;
}

.facts { display: grid; gap: 8px; margin: 0; }
.facts > div { display: grid; grid-template-columns: 180px 1fr; gap: 8px; }
.facts dt, .facts dd { margin: 0; }
.facts dt { color: #5c6b7a; }
.message-body { white-space: pre-wrap; margin: 6px 0 0; }

label { display: block; margin: 10px 0 4px; }
label.check { display: flex; align-items: center; gap: 6px; margin: 0; }
label.check input { margin: 0; }

input[type="text"], input[type="password"], input[type="url"], input[type="datetime-local"], select, textarea {
  width: 100%;
  border: 1px solid #cfd6e0;
  border-radius: 6px;
  padding: 7px 8px;
  background: #fff;
}

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

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.langs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.tree {
  max-height: 320px;
  overflow: auto;
  border: 1px solid #e4e8ee;
  border-radius: 6px;
  padding: 6px 8px;
}

.node-row { display: flex; align-items: center; gap: 2px; min-height: 26px; }
.node-row label { margin: 0; font-weight: 400; }
.children { margin-left: 18px; }

.twist {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #5c6b7a;
}
.twist-spacer { width: 22px; flex: none; }

.message { border-top: 1px solid #eef1f5; padding-top: 10px; margin-top: 10px; }
.message:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.message.is-hidden textarea, .message.is-hidden select { background: #f7f8fa; }

.badge {
  display: inline-block;
  font-size: 12px;
  line-height: 1.4;
  padding: 0 6px;
  border-radius: 999px;
  background: #e7ebf1;
}
.badge.warn { background: #f3e2e0; color: #8a2b24; }

.actions, .message-actions { margin-top: 12px; }

.error {
  background: #fff1f0;
  color: #9f1d16;
  border: 1px solid #f0c2be;
  padding: 8px 10px;
  border-radius: 8px;
  margin-bottom: 12px;
}

.who { color: #5c6b7a; font-size: 13px; }

pre.record {
  white-space: pre-wrap;
  word-break: break-word;
  background: #f6f8fa;
  padding: 10px;
  max-height: 280px;
  overflow: auto;
  font-size: 12px;
  margin: 8px 0 0;
}

:focus-visible { outline: 2px solid #1f6feb; outline-offset: 2px; }

@media (max-width: 800px) {
  .row, .langs, .facts > div { grid-template-columns: 1fr; }
  .list { position: static; max-height: none; }
}
