:root {
    --bg: #0f1722;
    --bg-card: #162231;
    --bg-card-hover: #1b2a3d;
    --text: #e8eef5;
    --muted: #9aafc4;
    --primary: #f0a500;
    --primary-dark: #c98600;
    --border: #2a3d54;
    --success: #3ecf8e;
    --error: #ff6b6b;
    --info: #5eb3ff;
    --radius: 14px;
    --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
    --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    background: radial-gradient(circle at top right, #1a2f45 0%, var(--bg) 45%);
    color: var(--text);
    font-family: var(--font);
    line-height: 1.5;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.container {
    width: min(1100px, 92vw);
    margin: 0 auto;
}

.site-header {
    border-bottom: 1px solid var(--border);
    background: rgba(15, 23, 34, 0.85);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    gap: 1rem;
}

.brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
    text-decoration: none;
}

.main-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}

.main-nav a {
    color: var(--muted);
    text-decoration: none;
}

.main-nav a:hover {
    color: var(--text);
}

.nav-logout {
    color: var(--primary) !important;
}

.main-content {
    padding: 2rem 0 4rem;
}

.site-footer {
    border-top: 1px solid var(--border);
    padding: 1.25rem 0 2rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

.page-head {
    margin-bottom: 1.5rem;
}

.page-head h1 {
    margin: 0 0 0.35rem;
    font-size: 1.8rem;
}

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

.row-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.login-page {
    min-height: calc(100vh - 4rem);
    display: grid;
    place-items: center;
}

.login-card {
    width: min(420px, 92vw);
    padding: 2rem;
}

.login-brand h1 {
    margin: 0;
    font-size: 1.6rem;
}

.form-stack label,
.form-grid label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 1rem;
}

.form-grid .form-row--pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 0;
}

.form-grid .form-row--pair label {
    margin-bottom: 0;
}

@media (max-width: 640px) {
    .form-grid .form-row--pair {
        grid-template-columns: 1fr;
    }
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="url"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 0.7rem 0.85rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #0c131c;
    color: var(--text);
    font: inherit;
}

select {
    cursor: pointer;
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
        linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 18px) calc(50% + 2px),
        calc(100% - 12px) calc(50% + 2px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    padding-right: 2rem;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid rgba(240, 165, 0, 0.35);
    border-color: var(--primary);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 1.1rem;
    border-radius: 10px;
    border: 1px solid transparent;
    font: inherit;
    cursor: pointer;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #1a1200;
    font-weight: 600;
}

.btn-primary:hover {
    filter: brightness(1.05);
    text-decoration: none;
}

.btn-danger {
    background: transparent;
    border-color: var(--error);
    color: var(--error);
}

.btn-secondary {
    background: #0c131c;
    border-color: var(--border);
    color: var(--text);
}

.btn-secondary:hover {
    background: #121b28;
    border-color: #3a5068;
    color: var(--text);
    text-decoration: none;
}

.btn-block {
    width: 100%;
}

.alert {
    border-radius: 10px;
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
}

.alert-error {
    background: rgba(255, 107, 107, 0.12);
    border: 1px solid rgba(255, 107, 107, 0.35);
}

.alert-success {
    background: rgba(62, 207, 142, 0.12);
    border: 1px solid rgba(62, 207, 142, 0.35);
}

.alert-info {
    background: rgba(94, 179, 255, 0.12);
    border: 1px solid rgba(94, 179, 255, 0.35);
}

.system-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.25rem;
}

.system-card {
    display: block;
    color: inherit;
    text-decoration: none;
    transition: transform 0.15s ease, background 0.15s ease;
}

.system-card:hover {
    transform: translateY(-3px);
    background: var(--bg-card-hover);
    text-decoration: none;
}

.system-card h2 {
    margin: 0.75rem 0 0.35rem;
    font-size: 1.2rem;
}

.system-card p {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.system-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: rgba(240, 165, 0, 0.15);
    color: var(--primary);
    font-weight: 700;
    font-size: 1.2rem;
}

.system-card-link {
    display: inline-block;
    margin-top: 1rem;
    color: var(--primary);
    font-weight: 600;
}

.admin-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.admin-tile {
    color: inherit;
    text-decoration: none;
}

.admin-tile:hover {
    background: var(--bg-card-hover);
    text-decoration: none;
}

.tile-stat {
    color: var(--primary);
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0.5rem 0 0;
}

.table-card {
    overflow-x: auto;
    padding: 0;
}

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

.data-table th,
.data-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.data-table th {
    color: var(--muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

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

.data-table .actions {
    white-space: nowrap;
}

.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.85rem;
    word-break: break-all;
}

.nginx-export {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.85rem;
    line-height: 1.45;
    overflow-x: auto;
}

.data-list {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 0.5rem 1rem;
    margin: 0;
}

.data-list dt {
    color: var(--muted);
}

.data-list dd {
    margin: 0;
}

.profile-card + .profile-card {
    margin-top: 1rem;
}

.checkbox {
    flex-direction: row !important;
    align-items: center;
    gap: 0.5rem !important;
}

.fieldset {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    margin: 0 0 1rem;
}

.fieldset legend {
    padding: 0 0.35rem;
    color: var(--muted);
}

.form-actions {
    margin-top: 0.5rem;
}

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

.effective-hint {
    margin: -0.5rem 0 1rem;
    padding: 0.65rem 0.85rem;
    background: rgba(94, 179, 255, 0.08);
    border: 1px solid rgba(94, 179, 255, 0.2);
    border-radius: 8px;
}

.help-trigger {
    display: inline-flex;
    align-items: center;
    margin: 0.35rem 0 0;
    padding: 0.4rem 0.85rem;
    font-size: 0.875rem;
    font-family: inherit;
    font-weight: 500;
    color: #d4dde8;
    background-color: #0c131c;
    border: 1px solid #2a3d54;
    border-radius: 8px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.help-trigger:hover {
    background: #121b28;
    border-color: #3a5068;
    color: var(--text);
}

span.hint .help-trigger {
    margin: 0 0 0 0.25rem;
    padding: 0.2rem 0.55rem;
    font-size: 0.82rem;
    vertical-align: baseline;
}

.help-dialog {
    padding: 0;
    border: 1px solid #243447;
    border-radius: 12px;
    max-width: min(720px, 92vw);
    max-height: min(88vh, 900px);
    background-color: #0a1018;
    color: #e8eef5;
    color-scheme: dark;
    box-shadow: 0 24px 56px rgba(0, 0, 0, 0.62);
}

.help-dialog::backdrop {
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(3px);
}

.help-dialog__panel {
    display: flex;
    flex-direction: column;
    max-height: min(88vh, 900px);
    background-color: #0a1018;
    border: none;
    border-radius: inherit;
    box-shadow: none;
    overflow: hidden;
}

.help-dialog__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.15rem;
    border-bottom: 1px solid #243447;
    background: #0c131c;
    flex-shrink: 0;
}

.help-dialog__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: #e8eef5;
}

.help-dialog__close {
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 1px solid #243447;
    border-radius: 8px;
    background: #121b28;
    color: #9aafc4;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.help-dialog__close:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
}

.help-dialog__body {
    padding: 1rem 1.15rem;
    overflow: auto;
    flex: 1 1 auto;
    background: #0a1018;
}

.help-dialog__section + .help-dialog__section {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.help-dialog__section h3 {
    margin: 0 0 0.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: #e8eef5;
}

.help-dialog__list {
    margin: 0 0 0.75rem;
    padding-left: 1.2rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

.help-dialog__list li + li {
    margin-top: 0.35rem;
}

.help-dialog__code {
    margin: 0.5rem 0 0;
    padding: 0.75rem 0.85rem;
    max-height: 14rem;
    overflow: auto;
    background: #0c131c;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.78rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}

.help-dialog__footer {
    display: flex;
    justify-content: flex-end;
    padding: 0.85rem 1.15rem;
    border-top: 1px solid #243447;
    background: #0c131c;
    flex-shrink: 0;
}

code {
    background: #0c131c;
    padding: 0.15rem 0.35rem;
    border-radius: 6px;
    font-size: 0.9em;
}

.page-install {
    min-height: 100vh;
    display: grid;
    place-items: center;
}

.install-wrap {
    width: min(720px, 92vw);
}

.install-card h1 {
    margin-top: 0;
}

@media (max-width: 640px) {
    .data-list {
        grid-template-columns: 1fr;
    }

    .row-between {
        align-items: flex-start;
        flex-direction: column;
    }
}

.embed-html {
    height: 100%;
    width: 100%;
    overflow: hidden;
    background: var(--bg);
}

.embed-html body.embed-body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    display: grid;
    grid-template-rows: auto 1fr;
    background: var(--bg);
}

.embed-body {
    width: 100%;
}

.embed-toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--border);
    background: rgba(15, 23, 34, 0.95);
    backdrop-filter: blur(8px);
    flex-shrink: 0;
}

.embed-back {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    white-space: nowrap;
}

.embed-back:hover {
    text-decoration: underline;
}

.embed-title {
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.embed-nav {
    margin-left: auto;
    display: flex;
    gap: 1rem;
    flex-shrink: 0;
}

.embed-nav a {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.92rem;
}

.embed-nav a:hover {
    color: var(--text);
}

.embed-main {
    position: relative;
    min-height: 0;
    min-width: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.embed-frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    border: 0;
    display: block;
    background: var(--bg);
}

/* Teljes képernyős embed: sarok ív ~33px (44 és 22 között), hoverre kinyílik */
.embed-fab-back {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 10000;
    display: inline-flex;
    align-items: flex-start;
    justify-content: flex-start;
    box-sizing: border-box;
    height: 33px;
    width: 33px;
    min-width: 33px;
    padding: 6px 0 0 6px;
    margin: 0;
    gap: 0;
    border: none;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 0 0 33px 0;
    overflow: hidden;
    background: rgba(8, 12, 18, 0.92);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: #e8eef5;
    text-decoration: none;
    box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.32);
    transition:
        width 0.34s cubic-bezier(0.4, 0, 0.2, 1),
        min-width 0.34s cubic-bezier(0.4, 0, 0.2, 1),
        height 0.34s cubic-bezier(0.4, 0, 0.2, 1),
        padding 0.34s cubic-bezier(0.4, 0, 0.2, 1),
        gap 0.34s cubic-bezier(0.4, 0, 0.2, 1),
        border-radius 0.34s cubic-bezier(0.4, 0, 0.2, 1),
        background 0.22s ease,
        box-shadow 0.22s ease;
}

.embed-fab-back:hover,
.embed-fab-back:focus-visible {
    align-items: center;
    justify-content: flex-start;
    width: auto;
    min-width: 33px;
    height: 33px;
    padding: 0 16px 0 10px;
    gap: 8px;
    border-radius: 0 0 18px 0;
    background: rgba(8, 12, 18, 0.97);
    border-color: rgba(240, 165, 0, 0.2);
    box-shadow: 2px 2px 14px rgba(0, 0, 0, 0.4);
    outline: none;
}

.embed-fab-back__icon {
    flex-shrink: 0;
    display: block;
    width: 17px;
    height: 17px;
    color: var(--primary, #f0a500);
    transition: transform 0.28s ease;
}

.embed-fab-back:hover .embed-fab-back__icon,
.embed-fab-back:focus-visible .embed-fab-back__icon {
    transform: translateX(-1px);
}

.embed-fab-back__text {
    display: block;
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    white-space: nowrap;
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    color: #e8eef5;
    transition:
        max-width 0.34s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.26s ease;
}

.embed-fab-back:hover .embed-fab-back__text,
.embed-fab-back:focus-visible .embed-fab-back__text {
    max-width: 11rem;
    opacity: 1;
}

@media (max-width: 480px) {
    .embed-fab-back {
        height: 30px;
        width: 30px;
        min-width: 30px;
        padding: 5px 0 0 5px;
        border-radius: 0 0 30px 0;
    }

    .embed-fab-back:hover,
    .embed-fab-back:focus-visible {
        height: 30px;
        border-radius: 0 0 16px 0;
    }

    .embed-fab-back__icon {
        width: 15px;
        height: 15px;
    }
}
