:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --sidebar: #1f2328;
  --sidebar-muted: #aeb7c2;
  --text: #1f2933;
  --muted: #667085;
  --line: #d9dee7;
  --line-strong: #b8c0cc;
  --accent: #1f7a5b;
  --accent-strong: #155f46;
  --danger: #b42318;
  --danger-soft: #fde7e4;
  --focus: #2f80ed;
  --shadow: 0 12px 28px rgba(31, 41, 51, 0.08);
  --font: "Inter", "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  margin: 0;
}

button,
input,
textarea {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.admin-app {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: var(--sidebar);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 24px 18px;
  position: sticky;
  top: 0;
}

.brand {
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 28px;
}

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

.nav-link {
  border-radius: 8px;
  color: var(--sidebar-muted);
  display: block;
  padding: 11px 12px;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.sidebar-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  display: grid;
  gap: 12px;
  margin-top: auto;
  padding-top: 18px;
}

.admin-email {
  color: var(--sidebar-muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.content {
  min-width: 0;
  padding: 28px;
}

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

.page-header h1 {
  font-size: 28px;
  line-height: 1.2;
  margin: 0 0 4px;
}

.page-header p {
  color: var(--muted);
  margin: 0;
}

.header-actions,
.modal-actions,
.actions,
.inline-editor {
  align-items: center;
  display: flex;
  gap: 8px;
}

.table-shell {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: auto;
}

.data-table {
  border-collapse: collapse;
  min-width: 900px;
  width: 100%;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  padding: 12px 14px;
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  background: #eef1f5;
  color: #354052;
  font-weight: 650;
  position: sticky;
  top: 0;
  z-index: 1;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.actions-column {
  width: 120px;
}

.wide-actions {
  min-width: 250px;
}

.hash-cell {
  font-family: "SFMono-Regular", Consolas, monospace;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-cell {
  max-width: 420px;
  white-space: normal;
}

.badge {
  background: #eef6f2;
  border: 1px solid #b7dacb;
  border-radius: 999px;
  color: var(--accent-strong);
  display: inline-flex;
  font-size: 12px;
  padding: 4px 8px;
}

.primary-button,
.secondary-button,
.danger-button,
.ghost-button,
.icon-button {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  font-weight: 650;
  justify-content: center;
  min-height: 36px;
  padding: 8px 12px;
  white-space: nowrap;
}

.primary-button {
  background: var(--accent);
  color: #ffffff;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.secondary-button {
  background: #ffffff;
  border-color: var(--line-strong);
  color: var(--text);
}

.secondary-button:hover {
  border-color: var(--focus);
}

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

.ghost-button {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.24);
  color: #ffffff;
}

.icon-button {
  background: #ffffff;
  border-color: var(--line);
  color: var(--text);
  height: 32px;
  padding: 0;
  width: 32px;
}

.icon-button:hover {
  border-color: var(--focus);
}

.icon-button.danger {
  background: var(--danger-soft);
  border-color: #f4b2aa;
  color: var(--danger);
}

.icon-button[disabled],
button[disabled] {
  cursor: not-allowed;
  opacity: 0.5;
}

.compact,
.compact-button {
  min-height: 32px;
  padding: 6px 10px;
}

.compact-button {
  font-size: 12px;
}

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

.input {
  background: #ffffff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--text);
  min-height: 40px;
  outline: none;
  padding: 8px 10px;
  width: 100%;
}

.input:focus,
.result-textarea:focus,
.logs-textarea:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(47, 128, 237, 0.14);
}

.inline-editor {
  min-width: 180px;
}

.inline-editor .input {
  min-height: 32px;
  width: 110px;
}

.modal {
  align-items: center;
  background: rgba(16, 24, 40, 0.45);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 20px;
  position: fixed;
  z-index: 10;
}

.modal[hidden] {
  display: none;
}

.modal-panel {
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(16, 24, 40, 0.26);
  display: grid;
  gap: 16px;
  max-width: 460px;
  padding: 22px;
  width: min(100%, 460px);
}

.modal-panel.wide {
  max-width: 680px;
  width: min(100%, 680px);
}

.modal-panel.confirm-panel {
  max-width: 640px;
  width: min(100%, 640px);
}

.modal-panel h2 {
  font-size: 20px;
  line-height: 1.25;
  margin: 0;
}

.breakable-text {
  line-height: 1.5;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.modal-panel form,
.login-form {
  display: grid;
  gap: 14px;
}

.modal-panel label,
.login-form label {
  color: var(--muted);
  display: grid;
  font-size: 13px;
  gap: 6px;
}

.result-textarea,
.logs-textarea {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--text);
  min-height: 180px;
  outline: none;
  padding: 12px;
  resize: vertical;
  width: 100%;
}

.result-textarea.small {
  min-height: 90px;
}

.logs-grid {
  display: grid;
  gap: 18px;
}

.log-panel {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.log-panel h2 {
  font-size: 18px;
  margin: 0 0 12px;
}

.logs-textarea {
  font-family: "SFMono-Regular", Consolas, monospace;
  min-height: 280px;
}

.audit-table {
  min-width: 1100px;
}

.notice {
  border-radius: 8px;
  margin-bottom: 16px;
  padding: 12px 14px;
}

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

.toast {
  background: #111827;
  border-radius: 8px;
  bottom: 20px;
  color: #ffffff;
  left: 50%;
  padding: 10px 14px;
  position: fixed;
  transform: translateX(-50%);
  z-index: 20;
}

.login-body {
  align-items: center;
  display: flex;
  min-height: 100vh;
  justify-content: center;
  padding: 24px;
}

.login-panel {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 18px;
  max-width: 420px;
  padding: 28px;
  width: 100%;
}

.login-brand {
  color: var(--accent-strong);
  margin-bottom: 0;
}

.login-panel h1 {
  font-size: 24px;
  margin: 0;
}

@media (max-width: 840px) {
  .admin-app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
    position: static;
  }

  .content {
    padding: 18px;
  }

  .page-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-actions {
    flex-wrap: wrap;
  }
}
