/* =============================================================================
   Ondřej Smílek | Autorizační a licenční server — base theme
   Neutral, modern, responsive. No external fonts/CDNs. Build-free.
   ============================================================================= */

:root {
    --bg: #eef1f5;
    --surface: #ffffff;
    --text: #1f2733;
    --muted: #6b7585;
    --border: #e2e6ec;
    --primary: #2458c7;
    --primary-dark: #1c459d;
    --success: #1f9d57;
    --success-bg: #e6f6ed;
    --danger: #d23b3b;
    --danger-bg: #fbe9e9;
    --warning: #b9770a;
    --warning-bg: #fbf2dd;
    --info: #2f6fed;
    --info-bg: #e8f0fe;
    --radius: 8px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .1);
    --maxw: 1120px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.55;
    font-size: 16px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 1rem;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
    background: #eef1f5;
    padding: .1em .35em;
    border-radius: 5px;
    font-size: .9em;
}

.muted { color: var(--muted); }

/* --- Topbar / footer ----------------------------------------------------- */
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}
.brand {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text);
    letter-spacing: 0;
}
.brand-long {
    max-width: 70%;
    overflow-wrap: anywhere;
}
.brand:hover { text-decoration: none; }
.topnav { display: flex; align-items: center; gap: 1.25rem; }
.topnav a {
    color: var(--muted);
    font-weight: 500;
}
.topnav a:hover { color: var(--text); text-decoration: none; }
.inline-form { display: inline; margin: 0 0 0 1.25rem; }
.topnav .inline-form { margin-left: 0; }
.linkbtn {
    background: none; border: none; padding: 0; margin: 0;
    color: var(--muted); font: inherit; font-weight: 500; cursor: pointer;
}
.linkbtn:hover { color: var(--text); }

.main {
    flex: 1 0 auto;
    padding: 2rem 1rem 3rem;
}

.footer {
    flex-shrink: 0;
    border-top: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    font-size: .9rem;
    padding: 1.25rem 0;
}
.footer .container { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* --- Public service overview --------------------------------------------- */
.service-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2rem;
    align-items: end;
    padding: 2.75rem 0 1.5rem;
    border-bottom: 1px solid var(--border);
}
.service-header h1 { font-size: 2.35rem; line-height: 1.08; margin: 0 0 .75rem; }
.eyebrow { margin: 0 0 .65rem; color: var(--primary); font-weight: 700; text-transform: uppercase; font-size: .78rem; letter-spacing: .08em; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 46rem; }
.service-actions { display: flex; gap: .75rem; flex-wrap: wrap; justify-content: flex-end; }

.ops-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    margin: 1.25rem 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.ops-tile {
    padding: 1rem 1.1rem;
    border-right: 1px solid var(--border);
    min-width: 0;
}
.ops-tile:last-child { border-right: 0; }
.ops-tile span { display: block; color: var(--muted); font-size: .78rem; text-transform: uppercase; font-weight: 700; letter-spacing: .06em; }
.ops-tile strong { display: block; margin-top: .25rem; font-size: .95rem; line-height: 1.35; }

.ops-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr);
    gap: 1.25rem;
    margin-top: 1.25rem;
}
.ops-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
}
.ops-panel h2 { margin: 0 0 .75rem; font-size: 1.05rem; }
.ops-list { margin: 0; padding-left: 1.1rem; color: var(--muted); }
.ops-list li + li { margin-top: .45rem; }
.endpoint-list { margin: 0; }
.endpoint-list div { padding: .65rem 0; border-top: 1px solid var(--border); }
.endpoint-list div:first-child { border-top: 0; padding-top: 0; }
.endpoint-list dt { font-weight: 700; }
.endpoint-list dd { margin: .2rem 0 0; color: var(--muted); }

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    margin-top: 2.5rem;
}
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
}
.card h2 { font-size: 1.1rem; margin: 0 0 .5rem; }
.card p { margin: 0; color: var(--muted); }

/* --- Buttons -------------------------------------------------------------- */
.btn {
    display: inline-block;
    padding: .6rem 1.1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-weight: 600;
    font-size: .95rem;
    cursor: pointer;
    text-align: center;
    transition: background .15s, border-color .15s;
}
.btn:hover { text-decoration: none; background: #f0f2f6; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #b62f2f; }
.btn-sm { padding: .35rem .7rem; font-size: .85rem; }
.btn[disabled], .btn:disabled { opacity: .6; cursor: not-allowed; }

/* --- Forms ---------------------------------------------------------------- */
.form-card {
    max-width: 26rem;
    margin: 2rem auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.75rem;
}
.form-card h1 { font-size: 1.4rem; margin: 0 0 1.25rem; }
.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .35rem; }
.field input, .field select, .field textarea {
    width: 100%;
    padding: .6rem .7rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    background: #fff;
    color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(47, 111, 237, .15);
}
.field .hint { font-size: .82rem; color: var(--muted); margin-top: .3rem; }
.field .error { font-size: .82rem; color: var(--danger); margin-top: .3rem; }
.input-action {
    display: flex;
    gap: .5rem;
    align-items: center;
}
.input-action input { flex: 1; min-width: 0; }
.check {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    color: var(--muted);
    font-weight: 600;
}
.check input { width: auto; }
.form-actions { margin-top: 1.25rem; display: flex; gap: .6rem; align-items: center; }
.form-links { margin-top: 1rem; font-size: .9rem; text-align: center; }
.form-links .inline-form { margin: 0; }

/* --- Alerts --------------------------------------------------------------- */
.alert {
    border-radius: 8px;
    padding: .75rem 1rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    font-size: .95rem;
}
.alert-success { background: var(--success-bg); border-color: #bfe6cd; color: #14633a; }
.alert-danger  { background: var(--danger-bg);  border-color: #f2c4c4; color: #93292a; }
.alert-error   { background: var(--danger-bg);  border-color: #f2c4c4; color: #93292a; }
.alert-warning { background: var(--warning-bg); border-color: #ecd9a6; color: #7a4f08; }
.alert-info    { background: var(--info-bg);    border-color: #c5d8fb; color: #1d4699; }

/* --- Tables --------------------------------------------------------------- */
.table-wrap { min-width: 0; max-width: 100%; overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
table.data { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.data th, table.data td { padding: .7rem .85rem; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data thead th { background: #f8f9fb; color: var(--muted); font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .02em; }
table.data tbody tr:hover { background: #fafbfc; }
table.data td.actions { display: flex; gap: .4rem; align-items: center; }

/* --- Badges --------------------------------------------------------------- */
.badge { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.badge-active    { background: var(--success-bg); color: #14633a; }
.badge-issued    { background: var(--success-bg); color: #14633a; }
.badge-pending   { background: var(--warning-bg); color: #7a4f08; }
.badge-suspended { background: var(--warning-bg); color: #7a4f08; }
.badge-expired   { background: #eceff3; color: #5b6573; }
.badge-revoked   { background: var(--danger-bg);  color: #93292a; }
.badge-disabled  { background: #eceff3; color: #5b6573; }
.badge-inactive  { background: #eceff3; color: #5b6573; }
.badge-locked    { background: var(--danger-bg);  color: #93292a; }
.badge-prospect  { background: var(--warning-bg); color: #7a4f08; }
.badge-archived  { background: #eceff3; color: #5b6573; }
.badge-open      { background: var(--warning-bg); color: #7a4f08; }
.badge-done      { background: var(--success-bg); color: #14633a; }
.badge-canceled  { background: #eceff3; color: #5b6573; }

/* --- Dashboard layout (admin) -------------------------------------------- */
.layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: calc(100vh - 60px); flex: 1 0 auto; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); padding: 1.25rem 0; }
.sidebar a { display: block; padding: .55rem 1.25rem; color: var(--muted); font-weight: 500; }
.sidebar a:hover, .sidebar a.active { background: #eef3fe; color: var(--primary); text-decoration: none; }
.sidebar-group { display: block; padding: 1rem 1.25rem .3rem; font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); opacity: .75; }
.sidebar-group:first-child { padding-top: 0; }
.content { min-width: 0; padding: 1.75rem; }
.page-title { font-size: 1.5rem; margin: 0 0 1.25rem; }
.page-subtitle { color: var(--muted); margin: -.75rem 0 1.25rem; max-width: 52rem; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.75rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.25rem; box-shadow: var(--shadow); }
.stat .num { font-size: 1.8rem; font-weight: 700; }
.stat .label { color: var(--muted); font-size: .85rem; }

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}
.detail-grid > div {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .85rem;
    background: #fafbfc;
}
.detail-grid span { display: block; font-size: .78rem; margin-bottom: .2rem; }
.detail-grid strong { display: block; overflow-wrap: anywhere; }

/* --- Admin wizard --------------------------------------------------------- */
.wizard-layout {
    display: grid;
    gap: 1rem;
}
.wizard-panel h2 { margin-top: 0; }
.wizard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
}
.scenario-groups {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}
.scenario-group {
    margin: 0;
    padding: .85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fafbfc;
}
.scenario-group legend {
    padding: 0 .35rem;
    font-size: .82rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .02em;
}
.scenario-list {
    display: grid;
    gap: .65rem;
}
.scenario-option {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .55rem;
    align-items: flex-start;
    padding: .65rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
}
.scenario-option input {
    margin-top: .15rem;
}
.scenario-option strong,
.scenario-option small {
    display: block;
}
.scenario-option small {
    margin-top: .2rem;
    color: var(--muted);
    line-height: 1.35;
}
.wizard-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    align-items: start;
}
.scope-list {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
}
.scope-list code {
    padding: .25rem .45rem;
    border-radius: 6px;
    background: #eef3fe;
    color: var(--primary);
}
.checklist {
    display: grid;
    gap: .55rem;
}
.checklist-item {
    display: flex;
    gap: .65rem;
    align-items: center;
    padding: .65rem .75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fafbfc;
}
.scenario-output {
    display: grid;
    gap: 1rem;
}
.scenario-card h2 {
    margin: .15rem 0 0;
}
.scenario-card h3 {
    margin-bottom: .45rem;
}
.compact-list {
    margin: 0;
    padding-left: 1.1rem;
}
.compact-list li + li {
    margin-top: .35rem;
}

/* --- Choice helpers ------------------------------------------------------- */
.scope-picker {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: .85rem;
}
.scope-group {
    margin: 0;
    padding: .85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fafbfc;
}
.scope-group legend {
    padding: 0 .35rem;
    font-size: .82rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .02em;
}
.scope-option {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .55rem;
    align-items: flex-start;
    padding: .55rem 0;
}
.scope-option + .scope-option {
    border-top: 1px solid var(--border);
}
.scope-option input {
    margin-top: .15rem;
}
.scope-option strong,
.scope-option small {
    display: block;
}
.scope-option small {
    margin-top: .2rem;
    color: var(--muted);
    line-height: 1.35;
}
.license-guide {
    display: grid;
    gap: 1rem;
}
.progressive-setup {
    display: grid;
    gap: 1rem;
}
.setup-step {
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fafbfc;
}
.setup-step h3 {
    margin-top: 0;
}
.setup-result {
    border-color: #b7d8bd;
    background: #f6fbf7;
}
.advanced-wizard {
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
}
.advanced-wizard > summary {
    cursor: pointer;
    font-weight: 700;
}
.advanced-wizard[open] > summary {
    margin-bottom: .75rem;
}
.decision-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: .75rem;
}
.decision-grid.compact {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}
.decision-card {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .65rem;
    align-items: flex-start;
    padding: .85rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
}
.decision-card input {
    margin-top: .2rem;
}
.decision-card strong,
.decision-card small {
    display: block;
}
.decision-card small {
    margin-top: .25rem;
    color: var(--muted);
    line-height: 1.35;
}
.decision-card:has(input:checked) {
    border-color: var(--primary);
    background: #eef3fe;
}
.explain-box {
    padding: .8rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fafbfc;
    color: var(--muted);
}
.choice-row {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem 1rem;
    padding-top: .35rem;
}

/* --- Hosting backups ------------------------------------------------------ */
.backup-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1rem;
    align-items: start;
}
.backup-grid section h3 {
    margin: 0 0 .75rem;
    font-size: 1rem;
}
.choice-list {
    display: grid;
    gap: .65rem;
}
.choice-card {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .65rem;
    align-items: flex-start;
    padding: .75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fafbfc;
}
.choice-card input {
    margin-top: .2rem;
}
.choice-card strong,
.choice-card small {
    display: block;
}
.choice-card small {
    color: var(--muted);
    margin-top: .2rem;
    overflow-wrap: anywhere;
}
.choice-card:has(input:checked) {
    border-color: var(--primary);
    background: #eef3fe;
}
.mail-row {
    padding: .85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fafbfc;
    margin-bottom: .75rem;
}
.restore-components {
    min-width: 16rem;
    border: 1px solid #f2c4c4;
    border-radius: var(--radius);
    padding: .75rem;
}
.restore-components legend {
    padding: 0 .35rem;
    font-weight: 700;
}

/* --- Error page ----------------------------------------------------------- */
.error-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.error-box { text-align: center; background: var(--surface); padding: 2.5rem; border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); }
.error-code { font-size: 3rem; font-weight: 800; color: var(--primary); }
.error-box h1 { margin: .25rem 0 .75rem; }
.error-box p { color: var(--muted); }

/* --- Utilities ------------------------------------------------------------ */
.row { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; }
.between { justify-content: space-between; }
.mt { margin-top: 1rem; }
.mb { margin-bottom: 1rem; }
.toolbar { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.toolbar .grow { flex: 1; }
.toolbar input, .toolbar select { min-height: 2.35rem; }
.danger-zone {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid #f2c4c4;
    border-radius: var(--radius);
    background: var(--danger-bg);
}
.danger-zone p { margin: .15rem 0 0; }
.code-block {
    display: block;
    max-width: 100%;
    overflow: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    padding: .85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #111827;
    color: #f8fafc;
    font-size: .86rem;
    line-height: 1.45;
}
.text-wrap { white-space: normal; overflow-wrap: anywhere; }
.product-summary {
    width: 100%;
    min-width: 16rem;
    max-width: 42rem;
    white-space: normal !important;
}
.product-summary strong,
.product-description {
    display: block;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.product-description { margin-top: .15rem; }
.file-verification-field { flex: 1 1 20rem; min-width: 0; }
.file-verification-field input[type="file"] { max-width: 100%; }
.file-verification-actions { margin: 0; align-self: center; }

@media (max-width: 720px) {
    .layout { grid-template-columns: 1fr; }
    .sidebar {
        display: flex;
        gap: .25rem;
        overflow-x: auto;
        overscroll-behavior-inline: contain;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: .5rem;
        scrollbar-width: thin;
    }
    .sidebar-group { display: none; }
    .sidebar a {
        flex: 0 0 auto;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        padding: .6rem .8rem;
        border-radius: var(--radius-sm);
    }
    .topbar-inner { height: auto; min-height: 60px; padding-top: .75rem; padding-bottom: .75rem; align-items: flex-start; gap: .75rem; }
    .topnav { flex-wrap: wrap; justify-content: flex-end; gap: .75rem; }
    .brand-long { max-width: 100%; }
    .service-header { grid-template-columns: 1fr; align-items: start; gap: 1rem; padding-top: 1.75rem; }
    .service-header h1 { font-size: 1.8rem; }
    .service-actions { justify-content: flex-start; }
    .ops-summary { grid-template-columns: 1fr 1fr; }
    .ops-tile:nth-child(2) { border-right: 0; }
    .ops-tile:nth-child(n+3) { border-top: 1px solid var(--border); }
    .ops-layout { grid-template-columns: 1fr; }
    .content { padding: 1rem; }
    .input-action { align-items: stretch; flex-direction: column; }
    .danger-zone { align-items: stretch; flex-direction: column; }
    .file-verification-row { align-items: stretch; }
    .file-verification-field { flex-basis: 100%; }
    .file-verification-actions,
    .file-verification-actions .btn { width: 100%; }
    table.data td.actions { min-width: 12rem; }
}
