:root {
  --bg: #f5f3ec;
  --card: #ffffff;
  --text: #1f2937;
  --sub: #6b7280;
  --line: #e5e7eb;
  --primary: #0d9488;
  --danger: #b91c1c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Sans SC", "PingFang SC", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 10% 10%, #fff8dc, var(--bg));
  padding-bottom: 72px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(4px);
}

.topbar h1 {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  font-size: 20px;
}

.auth-trigger {
  width: auto;
  margin-top: 0;
  padding: 8px 14px;
  border-radius: 999px;
}

.reminder-trigger {
  position: absolute;
  left: 16px;
  width: 36px;
  height: 36px;
  margin-top: 0;
  padding: 0;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  font-size: 20px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.reminder-trigger.alert {
  color: #b91c1c;
  border-color: #fca5a5;
  background: #fff1f2;
}

.main {
  padding: 12px;
}

.tab-page {
  display: none;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}

.tab-page.active {
  display: block;
}

h2 {
  margin-top: 0;
  font-size: 18px;
}

textarea,
input,
select,
button {
  width: 100%;
  margin-top: 8px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  font-size: 14px;
}

button {
  cursor: pointer;
  background: #fff;
}

button.primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

button.danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

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

.field-tip {
  margin: 10px 0 2px;
  color: var(--sub);
  font-size: 12px;
}

.input-shortcuts {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.input-shortcuts button {
  width: auto;
  margin-top: 0;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  border-color: #99f6e4;
  background: #f0fdfa;
  color: #115e59;
  font-weight: 600;
}

.filters,
.row {
  display: grid;
  gap: 8px;
}

.result-list,
.backup-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
}

.result-list li,
.backup-list li,
.group {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 8px;
  background: #fff;
}

.item-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.item-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.item-actions button {
  width: auto;
  margin-top: 0;
  padding: 4px 10px;
  font-size: 12px;
  line-height: 1.2;
}

.delete-btn,
.done-btn,
.icon-close-btn {
  width: 30px !important;
  height: 30px;
  margin-top: 0;
  padding: 0 !important;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: transparent;
  color: #374151;
  font-size: 20px !important;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.done-btn:hover,
.delete-btn:hover,
.icon-close-btn:hover {
  background: transparent;
  border-color: #9ca3af;
}

.done-btn {
  font-size: 13px !important;
}

.item-problem {
  margin-top: 8px;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.45;
}

.editable-problem {
  cursor: text;
}

.inline-problem-editor {
  width: 100%;
  margin-top: 0;
  min-height: 72px;
  resize: vertical;
  font-family: inherit;
  line-height: 1.45;
}

.detail-reminder-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
}

.detail-reminder-row button {
  width: auto;
  margin-top: 8px;
  padding: 8px 12px;
  font-size: 13px;
}

.detail-reminder-row input {
  margin-top: 8px;
}

#detailSolution {
  height: 50px;
}

.item-meta {
  margin-top: 6px;
  font-size: 11px;
  color: var(--sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bottom-tabs {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border-top: 1px solid var(--line);
  background: #fff;
}

.bottom-tabs button {
  border: none;
  border-radius: 0;
  margin: 0;
  padding: 14px 8px;
  background: transparent;
}

.bottom-tabs button.active {
  background: #ecfeff;
  color: #0f766e;
  font-weight: 700;
}

.admin-panel {
  margin-top: 14px;
  margin-bottom: 0;
  padding: 10px;
  border: 1px solid #dbeafe;
  border-radius: 10px;
  background: #f8fbff;
}

.admin-panel h3 {
  margin: 4px 0 8px;
}

.admin-panel h4 {
  margin: 12px 0 6px;
  font-size: 14px;
}

.export-module {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

dialog {
  width: min(640px, 96vw);
  border: none;
  border-radius: 12px;
}

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

.dialog-head h3 {
  margin: 0;
}

#searchBtn {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.35);
}

pre {
  white-space: pre-wrap;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  font-size: 12px;
}

.hidden {
  display: none;
}

.input-invalid {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.14);
}

#detailAssigneesError {
  margin-top: 4px;
  color: #b91c1c;
}

@media (min-width: 760px) {
  .filters {
    grid-template-columns: repeat(3, 1fr);
  }

  .row {
    grid-template-columns: repeat(2, 1fr);
  }
}
