@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap");

:root {
    --bg: #e9eee9;
    --bg-deep: #dfe6df;
    --panel: #f7faf7;
    --panel-edge: #cfd8cf;
    --ink: #1a2420;
    --ink-soft: #3d4a44;
    --muted: #6a7871;
    --accent: #0f6b5c;
    --accent-hover: #0b5549;
    --accent-soft: #d8efe9;
    --danger: #b42318;
    --danger-soft: #fce8e6;
    --ok: #1b7a45;
    --ok-soft: #e3f5ea;
    --warn-soft: #fff6e5;
    --shadow: 0 1px 0 rgba(26, 36, 32, 0.04), 0 12px 32px rgba(26, 36, 32, 0.06);
    --radius: 14px;
    --radius-sm: 10px;
    --font: "Outfit", "Trebuchet MS", sans-serif;
    --mono: "IBM Plex Mono", ui-monospace, monospace;
    --space: 1.15rem;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    color: var(--ink);
    background:
        radial-gradient(900px 420px at 0% 0%, #c9e4dc 0%, transparent 55%),
        radial-gradient(700px 380px at 100% 10%, #d5e0d8 0%, transparent 50%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent);
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

a:hover { color: var(--accent-hover); }

.wrap {
    width: min(920px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 1.5rem 0 3.5rem;
}

.wrap--wide {
    width: min(1280px, calc(100% - 1.5rem));
}

/* —— Nav —— */
.nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem 1.25rem;
    margin-bottom: 1.75rem;
    padding: 0.75rem 1rem;
    background: rgba(247, 250, 247, 0.88);
    border: 1px solid var(--panel-edge);
    border-radius: 999px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(8px);
}

.brand-link {
    color: var(--ink);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: -0.02em;
    padding-left: 0.35rem;
}

.brand-link:hover { color: var(--accent); }

.nav-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
}

.nav-links a {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
}

.nav-links a:hover { color: var(--ink); background: rgba(15, 107, 92, 0.08); }

.nav-links a.active {
    color: var(--accent);
    background: var(--accent-soft);
}

.nav-user {
    font-size: 0.85rem;
    color: var(--muted);
    padding: 0 0.35rem 0 0.6rem;
    border-left: 1px solid var(--panel-edge);
    margin-left: 0.25rem;
}

/* —— Page header —— */
.hero {
    margin-bottom: 1.35rem;
}

.brand {
    margin: 0 0 0.3rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
}

.hero h1 {
    margin: 0 0 0.4rem;
    font-size: clamp(1.55rem, 3.5vw, 1.95rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.15;
    color: var(--ink);
}

.lede {
    margin: 0;
    max-width: 38rem;
    color: var(--muted);
    font-size: 0.98rem;
}

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.35rem;
}

.page-head .hero { margin: 0; flex: 1 1 240px; }

/* —— Flash —— */
.flash {
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.15rem;
    border: 1px solid transparent;
    font-size: 0.95rem;
}

.flash-ok {
    background: var(--ok-soft);
    border-color: #b7e0c5;
    color: #14532d;
}

.flash-error {
    background: var(--danger-soft);
    border-color: #f0b4ae;
    color: #7f1d1d;
}

.flash a { font-weight: 600; }
.flash ul { margin: 0.5rem 0 0; padding-left: 1.1rem; }

/* —— Panels / sections —— */
.panel {
    background: var(--panel);
    border: 1px solid var(--panel-edge);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.panel + .panel { margin-top: 1rem; }

.panel-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    padding: 1rem 1.25rem 0.85rem;
    border-bottom: 1px solid var(--panel-edge);
    background: linear-gradient(180deg, #fcfdfc 0%, var(--panel) 100%);
}

.panel-head h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 650;
    letter-spacing: -0.02em;
}

.panel-head p {
    margin: 0.2rem 0 0;
    font-size: 0.85rem;
    color: var(--muted);
}

.panel-body {
    padding: 1.15rem 1.25rem 1.25rem;
    display: grid;
    gap: var(--space);
}

.panel-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.65rem;
    padding: 0.95rem 1.25rem;
    border-top: 1px solid var(--panel-edge);
    background: #f1f5f1;
}

.panel-footer .grow-left {
    margin-right: auto;
}

.section-label {
    margin: 0;
    font-size: 0.72rem;
    font-weight: 650;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

.divider {
    height: 1px;
    background: var(--panel-edge);
    margin: 0.15rem 0;
}

/* —— Forms —— */
.card-form,
.auth-card {
    display: grid;
    gap: var(--space);
}

.auth-shell {
    min-height: calc(100vh - 4rem);
    display: grid;
    place-items: center;
    padding: 2rem 0;
}

.auth-card {
    width: min(420px, 100%);
    padding: 1.75rem 1.5rem;
    background: var(--panel);
    border: 1px solid var(--panel-edge);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.auth-card .hero { margin-bottom: 0.25rem; text-align: left; }

label,
.field {
    display: grid;
    gap: 0.4rem;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--ink-soft);
}

.field-hint {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--muted);
}

/* Усі типи інпутів — однаковий вигляд */
input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
input[type="url"],
input[type="search"],
input[type="file"],
select,
textarea {
    width: 100%;
    margin: 0;
    padding: 0.72rem 0.85rem;
    border-radius: var(--radius-sm);
    border: 1px solid #b9c5bd;
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-weight: 400;
    line-height: 1.35;
    appearance: none;
    -webkit-appearance: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="file"] {
    padding: 0.55rem 0.65rem;
    background: #f3f7f4;
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' stroke='%236a7871' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    padding-right: 2.2rem;
}

textarea {
    resize: vertical;
    min-height: 7.5rem;
    font-family: var(--mono);
    font-size: 0.86rem;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(15, 107, 92, 0.18);
}

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

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space);
}

@media (max-width: 640px) {
    .grid-2,
    .grid-3 { grid-template-columns: 1fr; }

    .nav {
        border-radius: var(--radius);
        padding: 0.85rem;
    }

    .nav-user {
        border-left: 0;
        margin-left: 0;
        width: 100%;
        padding: 0.35rem 0 0;
    }
}

.row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space);
    align-items: end;
}

.grow { flex: 1 1 160px; }

.check {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.55rem;
    color: var(--ink);
    font-weight: 500;
    padding: 0.15rem 0;
}

.check input {
    width: 1.05rem;
    height: 1.05rem;
    accent-color: var(--accent);
}

.mode-box {
    margin: 0;
    border: 1px solid var(--panel-edge);
    border-radius: var(--radius-sm);
    padding: 1rem;
    display: grid;
    gap: 0.85rem;
    background: #f3f7f4;
}

.mode-box legend {
    padding: 0 0.35rem;
    font-size: 0.8rem;
    font-weight: 650;
    color: var(--muted);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* —— Buttons —— */
button,
.btn {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 0.65rem 1.2rem;
    font: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    background: #e4ebe5;
    color: var(--ink);
    text-decoration: none;
    transition: background 0.15s ease, transform 0.1s ease;
}

button:hover,
.btn:hover { background: #d5ded7; }

button:active,
.btn:active { transform: translateY(1px); }

button.primary,
.btn.primary {
    background: var(--accent);
    color: #fff;
}

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

button.ghost,
.btn.ghost {
    background: transparent;
    border-color: var(--panel-edge);
    color: var(--ink-soft);
    font-weight: 500;
}

button.ghost:hover,
.btn.ghost:hover {
    background: #fff;
    border-color: #aebbb3;
}

button.danger,
.btn.danger {
    background: transparent;
    color: var(--danger);
    border-color: #f0b4ae;
}

button.danger:hover,
.btn.danger:hover { background: var(--danger-soft); }

button.secondary,
.btn.secondary {
    background: #fff;
    border-color: #b9c5bd;
    color: var(--ink);
}

.inline { display: inline; margin: 0; }

/* —— Dashboard —— */
.grid-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.85rem;
}

@media (max-width: 720px) {
    .grid-cards { grid-template-columns: 1fr; }
}

.stat {
    padding: 1.1rem 1.15rem;
    border-radius: var(--radius);
    border: 1px solid var(--panel-edge);
    background: var(--panel);
    box-shadow: var(--shadow);
    display: grid;
    gap: 0.35rem;
    min-height: 7.5rem;
}

.stat h2 {
    margin: 0;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    font-weight: 650;
}

.stat-num {
    margin: 0;
    font-size: 1.85rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--ink);
}

.stat-text {
    margin: 0;
    font-weight: 600;
    font-size: 1.05rem;
}

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

.stat-actions {
    margin-top: auto;
    padding-top: 0.35rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    font-size: 0.88rem;
}

.stat-actions a { font-weight: 600; text-decoration: none; }
.stat-actions a:hover { text-decoration: underline; }

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

.empty {
    padding: 1.25rem;
    border-radius: var(--radius);
    border: 1px dashed #b9c5bd;
    background: rgba(247, 250, 247, 0.7);
    color: var(--muted);
}

.empty p { margin: 0; }

.profile-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.55rem;
}

.profile-list a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.95rem 1.1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--panel-edge);
    background: var(--panel);
    color: var(--ink);
    text-decoration: none;
    box-shadow: var(--shadow);
    transition: border-color 0.15s ease, transform 0.1s ease;
}

.profile-list a:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
}

.profile-list strong { font-weight: 650; }
.profile-list span {
    color: var(--muted);
    font-size: 0.88rem;
    font-variant-numeric: tabular-nums;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.data-table th,
.data-table td {
    text-align: left;
    padding: 0.65rem 0.4rem;
    border-bottom: 1px solid var(--panel-edge);
    vertical-align: middle;
}

.data-table th {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    font-weight: 650;
}

.data-table td:last-child { width: 3rem; text-align: right; }

.data-table code,
.mono {
    font-family: var(--mono);
    font-size: 0.86rem;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin-bottom: 1rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 650;
    background: var(--accent-soft);
    color: var(--accent);
}

.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: #9a6700; }

.danger-zone .panel-body {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
}

.danger-zone .panel-head {
    background: linear-gradient(180deg, #fff8f7 0%, var(--panel) 100%);
}

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

.hint h2 {
    margin: 0 0 0.55rem;
    font-size: 1rem;
    color: var(--ink);
}

.plain-list {
    margin: 0;
    padding-left: 1.1rem;
}

.plain-list li { margin-bottom: 0.35rem; }

.cta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-top: 0.25rem;
}

.check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.35rem 0.85rem;
    padding: 0.65rem 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--panel-edge);
    background: #f3f7f4;
}

.check-grid .check {
    margin: 0;
    font-size: 0.9rem;
}

/* —— Send composer —— */
.composer { margin: 0; }

.composer-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

@media (max-width: 960px) {
    .composer-grid { grid-template-columns: 1fr; }
}

.composer-editor,
.composer-preview {
    margin: 0;
}

.composer-editor-body {
    max-height: none;
}

.composer-preview {
    position: sticky;
    top: 0.75rem;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 1.5rem);
}

.preview-toolbar {
    align-items: center;
}

.device-toggle {
    display: flex;
    gap: 0.25rem;
}

.device-toggle .ghost {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

.device-toggle .ghost.is-active {
    background: var(--accent-soft);
    border-color: transparent;
    color: var(--accent);
}

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

@media (max-width: 520px) {
    .tpl-grid { grid-template-columns: 1fr; }
}

.tpl-card {
    display: grid;
    gap: 0.2rem;
    text-align: left;
    border-radius: var(--radius-sm);
    border: 1px solid var(--panel-edge);
    background: #fff;
    padding: 0.7rem 0.8rem;
    cursor: pointer;
    font: inherit;
    color: var(--ink);
    border-radius: 10px;
}

.tpl-card strong {
    font-size: 0.9rem;
    font-weight: 650;
}

.tpl-card span {
    font-size: 0.78rem;
    color: var(--muted);
    font-weight: 400;
    line-height: 1.35;
}

.tpl-card:hover {
    border-color: #9bb5ac;
}

.tpl-card.is-active {
    border-color: var(--accent);
    background: var(--accent-soft);
    box-shadow: 0 0 0 2px rgba(15, 107, 92, 0.12);
}

#html_content {
    min-height: 16rem;
    font-family: var(--mono);
    font-size: 0.8rem;
    line-height: 1.45;
}

.composer-more {
    border: 1px solid var(--panel-edge);
    border-radius: var(--radius-sm);
    background: #f3f7f4;
    padding: 0.55rem 0.85rem;
}

.composer-more summary {
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--ink-soft);
    list-style: none;
}

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

.composer-more-body {
    display: grid;
    gap: var(--space);
    padding: 0.75rem 0 0.35rem;
}

.mail-chrome {
    padding: 0.75rem 1.15rem;
    border-bottom: 1px solid var(--panel-edge);
    background: #fbfcfb;
    display: grid;
    gap: 0.35rem;
}

.mail-chrome-row {
    display: grid;
    grid-template-columns: 3.2rem 1fr;
    gap: 0.5rem;
    align-items: baseline;
    font-size: 0.88rem;
}

.mail-label {
    color: var(--muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 650;
}

.mail-value {
    color: var(--ink-soft);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mail-subject {
    font-weight: 650;
    color: var(--ink);
}

.preview-frame-wrap {
    flex: 1;
    min-height: 420px;
    background: #e4ebe5;
    padding: 1rem;
    display: flex;
    justify-content: center;
    overflow: auto;
}

.preview-frame-wrap iframe {
    width: 100%;
    max-width: 640px;
    height: min(70vh, 720px);
    border: 0;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 8px 28px rgba(26, 36, 32, 0.12);
    transition: max-width 0.2s ease;
}

.preview-frame-wrap[data-device="mobile"] iframe {
    max-width: 375px;
}

/* —— Help / guide —— */
.nav-help {
    border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--panel-edge));
    background: var(--accent-soft) !important;
    color: var(--accent) !important;
}

.nav-help.active,
.nav-help:hover {
    background: var(--accent) !important;
    color: #fff !important;
    border-color: transparent;
}

.guide-video-body {
    padding-top: 0.35rem !important;
}

.video-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    overflow: hidden;
    background: #0f1412;
    border: 1px solid var(--panel-edge);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
}

.video-frame iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.guide-steps {
    display: grid;
    gap: 1.15rem;
}

.guide-step {
    display: grid;
    grid-template-columns: 2.4rem 1fr;
    gap: 0.85rem 1rem;
    padding: 0.35rem 0 1rem;
    border-bottom: 1px solid var(--panel-edge);
}

.guide-step:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.guide-step-num {
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 999px;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 1rem;
    color: #fff;
    background: var(--accent);
    flex-shrink: 0;
}

.guide-step-body h3 {
    margin: 0.15rem 0 0.75rem;
    font-size: 1.15rem;
    letter-spacing: -0.02em;
}

.guide-block {
    margin-bottom: 0.85rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    background: #f3f7f4;
    border: 1px solid var(--panel-edge);
}

.guide-block h4 {
    margin: 0 0 0.45rem;
    font-size: 0.95rem;
    font-weight: 650;
    color: var(--ink);
}

.guide-block p,
.guide-note {
    margin: 0;
    color: var(--ink-soft);
    font-size: 0.95rem;
    line-height: 1.55;
}

.guide-note {
    margin-top: 0.65rem;
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    background: rgba(15, 107, 92, 0.08);
}

.guide-list,
.guide-ol {
    margin: 0;
    padding-left: 1.2rem;
    color: var(--ink-soft);
    font-size: 0.95rem;
    line-height: 1.55;
}

.guide-list li,
.guide-ol li {
    margin-bottom: 0.35rem;
}

.ts {
    display: inline-block;
    margin-left: 0.25rem;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    color: var(--accent);
    background: #fff;
    border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--panel-edge));
    vertical-align: middle;
}

@media (max-width: 560px) {
    .guide-step {
        grid-template-columns: 1fr;
    }
}

.guide-video-gap {
    margin-bottom: 1rem;
}

.guide-video-gap a {
    font-weight: 650;
}

.guide-ip-list {
    margin: 0.55rem 0 0.35rem;
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    background: #fff;
    border: 1px solid var(--panel-edge);
    font-family: var(--mono);
    font-size: 0.88rem;
    line-height: 1.55;
    color: var(--ink);
    overflow-x: auto;
}

.guide-block .badge {
    margin-left: 0.35rem;
    vertical-align: middle;
}
