:root {
    --bg: #f3f4f6;
    --card: #ffffff;
    --text: #111827;
    --muted: #6b7280;
    --border: #e5e7eb;
    --primary: #111827;
    --primary-hover: #374151;
    --secondary: #f9fafb;
    --accent: #92400e;
    --accent-hover: #78350f;
    --notice-bg: #fffbeb;
    --notice-border: #f59e0b;
    --summary-bg: #fefce8;
    --summary-border: #111827;
    --success: #16a34a;
    --danger: #dc2626;
    --blue: #2563eb;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(146, 64, 14, 0.08), transparent 32%),
        linear-gradient(180deg, #f9fafb 0%, var(--bg) 100%);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    line-height: 1.45;
}

.container {
    width: min(1040px, calc(100% - 32px));
    margin: 0 auto;
    padding: 38px 0 56px;
}

h1 {
    margin: 0 0 12px;
    font-size: clamp(30px, 4vw, 44px);
    line-height: 1.05;
    letter-spacing: -0.04em;
    font-weight: 850;
}

h2 {
    margin: 26px 0 14px;
    font-size: 21px;
    letter-spacing: -0.02em;
}

h3 {
    margin: 20px 0 10px;
    font-size: 17px;
}

.intro {
    margin: 0 0 24px;
    max-width: 760px;
    color: var(--muted);
    font-size: 17px;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 24px;
    box-shadow: 0 18px 45px rgba(17, 24, 39, 0.08);
    margin-bottom: 22px;
}

.card h2:first-child {
    margin-top: 0;
}

form.card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 20px;
    align-items: start;
}

form.card > label,
form.card > .checkbox-row,
form.card > button,
form.card > .notice,
form.card > div,
form.card > input[type="hidden"] {
    min-width: 0;
}

label {
    display: block;
    margin: 0 0 6px;
    color: #374151;
    font-size: 14px;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: var(--text);
    border-radius: 10px;
    padding: 11px 12px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #111827;
    box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.12);
}

input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    background: #f9fafb;
    border: 1px solid var(--border);
    border-radius: 12px;
}

.checkbox-row label {
    margin: 0;
    font-weight: 650;
    font-size: 14px;
}

#gruppe_internet_werbung,
#gruppe_redaktionell_online,
#gruppe_social_media,
#gruppe_zuschlaege_internet,
#gruppe_zuschlaege_redaktionell {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 20px;
    padding: 18px;
    border-radius: 16px;
    background: #f9fafb;
    border: 1px solid var(--border);
}

#gruppe_social_media {
    display: block;
}

button,
.button-primary,
.button-secondary,
.copy-button {
    appearance: none;
    border: 0;
    cursor: pointer;
    border-radius: 11px;
    padding: 11px 17px;
    font-size: 15px;
    font-weight: 750;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

button:hover,
.button-primary:hover,
.button-secondary:hover,
.copy-button:hover {
    transform: translateY(-1px);
}

button,
.button-primary {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(17, 24, 39, 0.16);
}

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

.button-secondary {
    background: #ffffff;
    color: var(--text);
    border: 1px solid #d1d5db;
}

.button-secondary:hover {
    background: var(--secondary);
}

.copy-button {
    background: var(--accent);
    color: #ffffff;
}

.copy-button:hover {
    background: var(--accent-hover);
}

.secondary-copy {
    background: #374151;
}

.secondary-copy:hover {
    background: #1f2937;
}

button[type="submit"] {
    grid-column: 1 / -1;
    width: 100%;
    margin-top: 4px;
    font-size: 16px;
}

.button-row,
.copy-button-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.notice {
    background: var(--notice-bg);
    border-left: 4px solid var(--notice-border);
    color: #78350f;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 14px;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #ffffff;
    margin: 12px 0 20px;
}

th,
td {
    padding: 11px 13px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    text-align: left;
    font-size: 14px;
}

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

th {
    width: 38%;
    background: #f9fafb;
    color: #374151;
    font-weight: 800;
}

td {
    color: #111827;
}

thead th {
    background: #111827;
    color: #ffffff;
    border-bottom: 0;
}

.total-row th,
.total-row td {
    background: #e5e7eb;
    font-weight: 850;
}

.summary-card {
    border: 2px solid var(--summary-border);
    background: var(--summary-bg);
    margin-bottom: 24px;
}

.summary-card h2 {
    margin-top: 0;
}

.summary-table {
    background: #ffffff;
    margin-bottom: 14px;
}

.summary-table th {
    background: #111827;
    color: #ffffff;
    width: auto;
}

.summary-table td {
    font-weight: 650;
}

.summary-calc-label {
    padding-left: 20px !important;
    font-weight: 650;
}

.summary-detail-table {
    margin-top: 14px;
}

.summary-detail-table th {
    width: 60%;
}

.word-copy-table {
    width: 100% !important;
    max-width: 100% !important;
    table-layout: fixed;
}

.word-copy-table th {
    text-align: center;
}

.word-copy-table td {
    vertical-align: top;
    overflow-wrap: break-word;
}

.helper {
    margin-top: 24px;
    background: rgba(255, 255, 255, 0.75);
}

.helper p {
    margin: 8px 0;
}

.section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.section-title-row h2 {
    margin-bottom: 0;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    color: #ffffff;
    font-weight: 850;
    font-size: 22px;
    line-height: 1;
}

.status-r {
    background: var(--danger);
}

.status-u {
    background: var(--blue);
}

a {
    color: inherit;
}

@media (max-width: 760px) {
    .container {
        width: min(100% - 20px, 1040px);
        padding-top: 22px;
    }

    .card {
        padding: 18px;
        border-radius: 15px;
    }

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

    #gruppe_internet_werbung,
    #gruppe_redaktionell_online,
    #gruppe_social_media,
    #gruppe_zuschlaege_internet,
    #gruppe_zuschlaege_redaktionell {
        grid-template-columns: 1fr;
        padding: 14px;
    }

    th,
    td {
        padding: 9px 10px;
        font-size: 13px;
    }

    .button-row,
    .copy-button-row {
        flex-direction: column;
    }

    .button-row a,
    .copy-button-row button,
    .button-primary,
    .button-secondary {
        width: 100%;
    }
}

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

.header-action {
    flex: 0 0 auto;
    margin-top: 4px;
}

.form-section {
    grid-column: 1 / -1;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 20px;
    background: #ffffff;
}

.form-section + .form-section {
    margin-top: 4px;
}

.form-section-header {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 18px;
}

.form-section-header h2 {
    margin: 0 0 4px;
}

.form-section-header p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.form-step {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: #111827;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 850;
    flex: 0 0 auto;
}

.section-grid,
.dynamic-group,
.checkbox-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 20px;
}

.dynamic-group,
.checkbox-grid {
    margin-top: 16px;
}

.full-width {
    grid-column: 1 / -1;
}

.social-info {
    display: block;
}

.action-section {
    background: transparent;
    border: 0;
    padding: 0;
}

.action-section button {
    margin-top: 0;
}

@media (max-width: 760px) {
    .page-header {
        flex-direction: column;
    }

    .header-action {
        width: 100%;
    }

    .section-grid,
    .dynamic-group,
    .checkbox-grid {
        grid-template-columns: 1fr;
    }

    .form-section {
        padding: 16px;
    }
}

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

.header-action {
    flex: 0 0 auto;
    margin-top: 4px;
}

.form-section {
    grid-column: 1 / -1;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 20px;
    background: #ffffff;
}

.form-section + .form-section {
    margin-top: 4px;
}

.form-section-header {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 18px;
}

.form-section-header h2 {
    margin: 0 0 4px;
}

.form-section-header p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.form-step {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: #111827;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 850;
    flex: 0 0 auto;
}

.section-grid,
.dynamic-group,
.checkbox-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 20px;
}

.dynamic-group,
.checkbox-grid {
    margin-top: 16px;
}

.full-width {
    grid-column: 1 / -1;
}

.social-info {
    display: block;
}

.action-section {
    background: transparent;
    border: 0;
    padding: 0;
}

.action-section button {
    margin-top: 0;
}

@media (max-width: 760px) {
    .page-header {
        flex-direction: column;
    }

    .header-action {
        width: 100%;
    }

    .section-grid,
    .dynamic-group,
    .checkbox-grid {
        grid-template-columns: 1fr;
    }

    .form-section {
        padding: 16px;
    }
}

.result-card {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.result-section {
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    background: #ffffff;
}

.result-section + .result-section {
    margin-top: 0;
}

.result-section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 14px;
}

.result-section-header h2,
.result-section h2 {
    margin: 0 0 4px;
}

.result-section-header p,
.section-subtitle {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.final-result-section {
    border-color: #111827;
    background: #f9fafb;
}

.final-result-section h2 {
    font-size: 24px;
}

.result-section table:last-child {
    margin-bottom: 0;
}

@media (max-width: 760px) {
    .result-section {
        padding: 16px;
    }

    .result-section-header {
        flex-direction: column;
    }
}
