:root {
  --ink: #13212b;
  --muted: #5b6b76;
  --paper: #f3f7f4;
  --panel: rgba(255, 255, 255, 0.78);
  --line: rgba(19, 33, 43, 0.12);
  --accent: #0f7a63;
  --accent-deep: #0a5747;
  --warm: #e8a24a;
  --danger: #b42318;
  --shadow: 0 24px 60px rgba(19, 33, 43, 0.12);
  --radius: 18px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Sora", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(1000px 520px at 12% -10%, rgba(15, 122, 99, 0.22), transparent 60%),
    radial-gradient(800px 480px at 90% 8%, rgba(232, 162, 74, 0.18), transparent 55%),
    linear-gradient(180deg, #eef5f1 0%, #f7f3ea 48%, #eef2f6 100%);
}

.atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(19, 33, 43, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(19, 33, 43, 0.03) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(circle at 50% 20%, black, transparent 75%);
}

.hidden {
  display: none !important;
}

.brand {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.hero-brand {
  margin: 0 0 0.4rem;
  font-size: clamp(2.8rem, 7vw, 4.8rem);
  line-height: 0.95;
  color: var(--accent-deep);
  animation: rise 0.7s ease both;
}

h1,
h2 {
  font-family: var(--font-display);
  letter-spacing: -0.03em;
  margin: 0;
}

h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1.1;
  animation: rise 0.8s ease 0.05s both;
}

h2 {
  font-size: 1.45rem;
}

.lead,
.muted {
  color: var(--muted);
}

.lead {
  max-width: 36rem;
  margin: 0.75rem 0 0;
  animation: rise 0.8s ease 0.12s both;
}

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

.login-panel,
.create-panel,
.panel {
  background: var(--panel);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.login-panel {
  width: min(420px, 100%);
  padding: 2rem;
  animation: rise 0.6s ease both;
}

.login-panel .brand {
  margin: 0;
  font-size: 2.4rem;
  color: var(--accent-deep);
}

.login-panel h1 {
  margin-top: 0.4rem;
  font-size: 1.6rem;
}

label {
  display: grid;
  gap: 0.4rem;
  margin-top: 1rem;
  font-size: 0.88rem;
  font-weight: 500;
}

input,
textarea,
button,
a.button {
  font: inherit;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 0.95rem;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
textarea:focus {
  border-color: rgba(15, 122, 99, 0.55);
  box-shadow: 0 0 0 4px rgba(15, 122, 99, 0.12);
}

textarea {
  min-height: 220px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  line-height: 1.45;
}

button,
.top-actions a {
  appearance: none;
  border: 0;
  border-radius: 12px;
  padding: 0.85rem 1.15rem;
  background: var(--accent);
  color: white;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, background 0.2s ease, opacity 0.2s ease;
}

button:hover,
.top-actions a:hover {
  background: var(--accent-deep);
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
}

button.ghost,
a.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

button.ghost:hover,
a.ghost:hover {
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  transform: translateY(-1px);
}

a.ghost.small-btn {
  padding: 0.45rem 0.7rem;
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border-radius: 12px;
}

/* акцент только для главной кнопки почты */
a.mail-jump {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff !important;
  border: 1px solid var(--accent);
  font-weight: 600;
  text-decoration: none;
}

a.mail-jump:hover {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
  color: #fff !important;
  transform: translateY(-1px);
}

.hero-mail-actions {
  margin: 1.1rem 0 0;
  animation: rise 0.8s ease 0.18s both;
}

.shared-box {
  margin-top: 0.75rem;
  padding: 0.8rem 0.9rem;
  border-radius: 12px;
  border: 1px dashed rgba(15, 122, 99, 0.35);
  background: rgba(15, 122, 99, 0.08);
}

.shared-box strong {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.86rem;
}

.shared-creds {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
  margin-bottom: 0.55rem;
}

.shared-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.badge-shared {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: rgba(232, 162, 74, 0.22);
  color: #8a5a12;
  font-size: 0.72rem;
  font-weight: 600;
}

.error {
  color: var(--danger);
  margin: 0.8rem 0 0;
}

.app-view {
  min-height: 100vh;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 4vw;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand-lockup {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.brand-lockup .brand {
  font-size: 1.55rem;
  color: var(--accent-deep);
}

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

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

main {
  width: min(1100px, 92vw);
  margin: 0 auto;
  padding: 2.5rem 0 4rem;
}

.hero-create {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 1.5rem;
  align-items: start;
  min-height: calc(100vh - 7rem);
}

.hero-copy {
  padding-top: 1.5rem;
}

.create-panel {
  padding: 1.25rem;
  animation: rise 0.85s ease 0.15s both;
}

.names-label {
  margin-top: 0;
}

.controls {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 0.8rem;
}

.controls.three {
  grid-template-columns: 1fr 1.2fr 0.7fr;
}

.hint {
  margin: 0.7rem 0 0;
  font-size: 0.86rem;
}

.tight {
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
}

.tiny {
  font-size: 0.8rem;
}

.wrap {
  flex-wrap: wrap;
}

.inline-filter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-size: 0.88rem;
}

.inline-filter select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  background: rgba(255, 255, 255, 0.9);
  font: inherit;
}

.export-menu {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.groups-list {
  display: grid;
  gap: 0.75rem;
}

.group-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.8rem 1rem;
  align-items: start;
  padding: 0.95rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.55);
}

.group-card .shared-box {
  grid-column: 1 / -1;
}

.group-card h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
}

.group-meta {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.group-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: flex-end;
}

.group-chip {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: rgba(15, 122, 99, 0.12);
  color: var(--accent-deep);
  font-size: 0.8rem;
  font-weight: 600;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.1rem;
}

.cta-row.compact {
  margin-top: 0;
}

.status {
  margin: 0.9rem 0 0;
  color: var(--accent-deep);
  font-weight: 500;
}

.panel {
  margin-top: 1.25rem;
  padding: 1.25rem;
  animation: rise 0.5s ease both;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.9rem;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 480px;
  background: rgba(255, 255, 255, 0.65);
}

th,
td {
  text-align: left;
  padding: 0.8rem 0.95rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.94rem;
}

th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: rgba(243, 247, 244, 0.8);
}

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

code,
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.warn {
  margin: 0.9rem 0 0;
  color: #8a5a12;
  background: rgba(232, 162, 74, 0.16);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  font-size: 0.9rem;
}

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

.danger-btn {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(180, 35, 24, 0.25);
  padding: 0.45rem 0.7rem;
  font-size: 0.85rem;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.small-btn {
  padding: 0.45rem 0.7rem;
  font-size: 0.85rem;
}

.danger-btn:hover {
  background: rgba(180, 35, 24, 0.08);
  color: var(--danger);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 860px) {
  .hero-create {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .controls,
  .controls.three {
    grid-template-columns: 1fr;
  }

  .topbar {
    padding: 0.9rem 4vw;
  }

  .panel-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .group-card {
    grid-template-columns: 1fr;
  }

  .group-actions {
    justify-content: flex-start;
  }
}
