﻿:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #1f6feb;
  --accent-soft: #e8f0ff;
  --danger: #d93025;
  --danger-soft: #ffeceb;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top right, #ffffff 0%, #f0f3f8 45%, #edf1f5 100%);
}

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

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.login-card {
  width: min(440px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: 0 12px 45px rgba(15, 23, 42, 0.08);
  padding: 2rem;
}

.login-card h1 {
  margin: 0;
  font-size: 1.7rem;
}

.login-card p {
  margin: 0.5rem 0 1.5rem;
  color: var(--muted);
}

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

.sidebar {
  border-right: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(8px);
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.brand {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.menu-link {
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  color: #374151;
  transition: background 0.15s ease, color 0.15s ease;
}

.menu-link:hover {
  background: #eef2ff;
}

.menu-link.active {
  background: var(--accent-soft);
  color: #0f3a7a;
  font-weight: 700;
}

.user {
  margin-top: auto;
  color: var(--muted);
  font-size: 0.9rem;
}

.main {
  padding: 1.4rem;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.page-header h1 {
  margin: 0;
  font-size: 1.5rem;
}

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

.header-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}

.panel h2 {
  margin: 0 0 0.8rem;
  font-size: 1.02rem;
}

code {
  font-family: "JetBrains Mono", "Fira Code", "Consolas", monospace;
  font-size: 0.88em;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid var(--border);
  padding: 0.72rem 0.55rem;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

tbody tr:hover {
  background: #fafcff;
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:focus-visible {
  outline: 2px solid #b8d4ff;
  outline-offset: -2px;
}

.unread td {
  font-weight: 700;
}

.actions {
  text-align: right;
  white-space: nowrap;
}

.actions > * {
  vertical-align: middle;
}

.actions > * + * {
  margin-left: 0.45rem;
}

.inline {
  display: inline-flex;
}

.inline-center {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.table-wrap {
  overflow-x: auto;
}

.btn {
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  padding: 0.56rem 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.14s ease, transform 0.14s ease;
}

.btn:hover {
  filter: brightness(0.96);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-muted {
  background: #eef2f7;
  color: #111827;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 0.7rem;
  font: inherit;
  background: #fff;
}

input:focus,
select:focus,
textarea:focus,
.editor:focus {
  outline: 2px solid #b8d4ff;
  border-color: #6ea8ff;
}

label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: #374151;
}

.stack {
  display: grid;
  gap: 0.85rem;
}

.inline-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.inline-form input {
  max-width: 220px;
}

.retention-input {
  max-width: 90px !important;
}

.search-form input {
  max-width: 380px;
}

.suffix {
  color: var(--muted);
  font-size: 0.9rem;
}

.tabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.8rem;
}

.tab {
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  color: #374151;
}

.tab.active {
  background: var(--accent-soft);
  color: #0f3a7a;
  font-weight: 700;
}

.editor-toolbar {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.editor-toolbar button {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  padding: 0.35rem 0.55rem;
  cursor: pointer;
}

.editor {
  min-height: 170px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.7rem;
  background: #fff;
  overflow: auto;
}

.message-body {
  white-space: pre-wrap;
  line-height: 1.6;
}

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.attachment-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.4rem 0.65rem;
  font-size: 0.9rem;
  color: #1f2937;
  background: #f9fbff;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.flash {
  border-radius: 11px;
  padding: 0.66rem 0.78rem;
  margin-bottom: 0.8rem;
  border: 1px solid transparent;
}

.flash.success {
  background: #ebfff0;
  border-color: #b4efc2;
  color: #0f5d24;
}

.flash.error {
  background: #fff0f0;
  border-color: #f1c0c0;
  color: #842029;
}

.empty {
  text-align: center;
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.hint {
  color: var(--muted);
  font-size: 0.85rem;
}

.list {
  margin: 0;
  padding-left: 1.2rem;
  color: #374151;
  display: grid;
  gap: 0.35rem;
}

.dns-value code {
  display: inline-block;
  max-width: 460px;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

body.htmx-request .main {
  opacity: 0.75;
  transition: opacity 0.12s ease;
}

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

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--border);
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

  .menu {
    flex-direction: row;
  }

  .user {
    margin-top: 0;
    margin-left: auto;
  }

  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
}
