/* === Reset & Basis === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
    --orange-dark: #c45200; --orange: #e06500; --orange-light: #f28c28; --orange-pale: #fde8d0;
    --orange-bg: #fff7f0; --white: #f5f0eb; --gray-50: #f0ece8; --gray-100: #ebe6e1;
    --gray-200: #e5e5e5; --gray-300: #d4d4d4; --gray-500: #737373; --gray-700: #404040;
    --gray-900: #171717; --text: #1a1a1a; --text-light: #555; --radius: 4px;
    --topbar-h: 36px; --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
html, body { height: 100%; font-family: var(--font); font-size: 14px; color: var(--text); background: #f0ece8; }
body { display: flex; flex-direction: column; overflow: hidden; }
#app { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
a { color: var(--orange-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: var(--font); font-size: 13px; }

/* === Top-Bar === */
.topbar { display: flex; align-items: center; justify-content: space-between; height: var(--topbar-h); padding: 0 14px; background: var(--orange); color: var(--white); font-size: 13px; flex-shrink: 0; border-bottom: 1px solid white; }
.topbar-left { font-weight: 600; letter-spacing: 0.3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; gap: 14px; align-items: center; white-space: nowrap; }
.topbar-right a { color: var(--white); opacity: 0.9; }
.topbar-right a:hover, .topbar-right a.active { opacity: 1; text-decoration: underline; }
.lang-switch { display: inline-flex; gap: 4px; font-weight: 600; }
.lang-switch .sep { opacity: 0.5; }
.print-btn { background: none; border: 1px solid var(--white); color: var(--white); border-radius: var(--radius); padding: 2px 10px; font-size: 12px; cursor: pointer; }
.print-btn:hover { background: rgba(255,255,255,0.2); }

/* === Page States === */
.page-status { display: flex; align-items: center; justify-content: center; flex: 1; font-size: 16px; color: var(--gray-500); padding: 40px 20px; text-align: center; }
.page-status.error { color: #991b1b; }

/* === Tool Content Container === */
.tool-content { flex: 1; overflow-y: auto; padding: 16px 20px; }

/* === Modal (Impressum) === */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal { background: var(--white); border-radius: 6px; width: 90%; max-width: 600px; max-height: 80vh; display: flex; flex-direction: column; box-shadow: 0 8px 30px rgba(0,0,0,0.2); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; background: var(--orange); color: var(--white); border-radius: 6px 6px 0 0; font-weight: 600; }
.modal-header button { background: none; border: none; color: var(--white); font-size: 20px; line-height: 1; cursor: pointer; }
.modal-body { padding: 16px; overflow-y: auto; flex: 1; }

/* === POA Styles === */
.poa-body { font-size: 13px; max-width: 800px; margin: 0 auto; }
.poa-disclaimer { background: #fef3cd; border: 1px solid #ffd76e; padding: 8px 12px; border-radius: var(--radius); margin-bottom: 12px; font-size: 12px; }
.poa-header { text-align: right; font-size: 14px; margin-bottom: 12px; padding: 8px; }
.poa-notice { background: #1e3a5f; color: #fff; padding: 8px 12px; border-radius: var(--radius); margin-bottom: 12px; font-size: 12px; }
.poa-section { display: flex; gap: 12px; margin-bottom: 12px; padding: 8px 0 8px 12px; border-left: 3px solid var(--gray-300); }
.poa-content { flex: 1; min-width: 0; }
.poa-section-title { font-size: 14px; color: #888; font-weight: bold; margin-bottom: 6px; }
.poa-text { font-size: 12px; margin-bottom: 8px; line-height: 1.4; }
.poa-field { margin-bottom: 6px; }
.poa-field label { display: block; font-size: 10px; color: var(--gray-500); margin-top: 2px; }
.poa-field-row { display: flex; gap: 12px; }
.poa-input { width: 100%; padding: 4px 6px; border: none; border-bottom: 1px solid #ccc; background: var(--gray-50); font-size: 13px; font-family: var(--font); outline: none; }
.poa-input:focus { border-bottom-color: var(--orange); background: var(--orange-pale); }
.poa-field-short { max-width: 200px; }
.poa-isin { margin-bottom: 6px; }
.poa-sig-line { border-bottom: 1px solid #000; height: 40px; }
.poa-sig-row { margin-top: 16px; }
.poa-footer { font-size: 12px; line-height: 1.5; }
.poa-footer p { margin-bottom: 6px; }
.poa-return-item { margin: 3px 0; }

/* === COH Styles === */
.coh-body { font-size: 13px; }
.coh-disclaimer { background: #fef3cd; border: 1px solid #ffd76e; padding: 8px 12px; border-radius: var(--radius); margin-bottom: 12px; font-size: 12px; }
.coh-header { margin-bottom: 12px; font-size: 13px; }
.coh-bank-input { width: 99%; height: 60px; resize: none; font-family: var(--font); font-size: 12px; border: 1px solid #ccc; border-radius: var(--radius); padding: 4px; }
.coh-table { width: 100%; border-collapse: collapse; border: 2px solid #000; font-size: 12px; margin-bottom: 12px; }
.coh-th { border: 1px solid #000; padding: 4px 6px; font-weight: bold; vertical-align: top; background: var(--gray-50); text-align: left; }
.coh-th small { font-weight: normal; font-style: italic; color: #555; }
.coh-td { border: 1px solid #ccc; padding: 4px 6px; vertical-align: top; }
.coh-input { width: 100%; padding: 3px 5px; border: none; border-bottom: 1px solid #ccc; background: var(--gray-50); font-size: 12px; font-family: var(--font); outline: none; box-sizing: border-box; }
.coh-input:focus { border-bottom-color: #2a7ab5; background: #e8f4fd; }
.coh-w-name { width: 140px; min-width: 90px; }
.coh-w-street { width: 180px; min-width: 110px; }
.coh-w-bldg { width: 55px; min-width: 40px; max-width: 55px; }
.coh-w-plz { width: 70px; min-width: 50px; max-width: 70px; }
.coh-w-town { width: 130px; min-width: 80px; }
.coh-w-ctry { width: 38px; min-width: 30px; max-width: 38px; }
.coh-w-date { width: 85px; min-width: 65px; max-width: 85px; }
.coh-w-reg { width: 80px; min-width: 55px; max-width: 80px; }
.coh-w-regno { width: 120px; min-width: 70px; }
.coh-select { padding: 3px 5px; border: 1px solid #ccc; border-radius: var(--radius); font-size: 12px; font-family: var(--font); background: var(--gray-50); width: 100%; box-sizing: border-box; }
.coh-name-fields { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px; }
.coh-name-fields .coh-input { margin-bottom: 0; flex: 1 1 auto; min-width: 60px; }
.coh-field-row { display: flex; gap: 6px; }
.coh-person-toggle { display: flex; align-items: center; gap: 6px; font-size: 11px; color: #888; user-select: none; margin-bottom: 4px; }
.coh-person-toggle span { cursor: pointer; transition: color .15s; }
.coh-person-toggle span.active { color: #1a1a1a; font-weight: 600; }
.coh-switch { position: relative; display: inline-block; width: 34px; height: 18px; flex-shrink: 0; }
.coh-switch input { opacity: 0; width: 0; height: 0; }
.coh-slider { position: absolute; inset: 0; background: #2a7ab5; border-radius: 18px; cursor: pointer; transition: background .2s; }
.coh-slider::before { content: ''; position: absolute; left: 2px; top: 2px; width: 14px; height: 14px; background: #fff; border-radius: 50%; transition: transform .2s; }
.coh-switch input:checked + .coh-slider { background: #28a745; }
.coh-switch input:checked + .coh-slider::before { transform: translateX(16px); }
.coh-remove-btn { background: #dc3545; color: #fff; border: none; border-radius: var(--radius); cursor: pointer; padding: 2px 8px; font-size: 14px; }
.coh-remove-btn:hover { background: #b02a37; }
.coh-add-btn { background: #28a745; color: #fff; border: none; border-radius: var(--radius); cursor: pointer; padding: 2px 10px; font-size: 14px; }
.coh-add-btn:hover { background: #1e7e34; }
.coh-confirm { margin: 12px 0; font-size: 13px; }
.coh-sig-table { width: 100%; border-bottom: 2px solid #000; padding-bottom: 8px; margin-bottom: 12px; }
.coh-sig-line { border-bottom: 1px solid #000; height: 40px; }
.coh-field-label { font-size: 10px; color: #666; margin-top: 2px; }
.coh-footer { font-size: 12px; line-height: 1.5; }
.coh-footer p { margin-bottom: 6px; }
.coh-return-item { margin: 3px 0; }
.coh-print-only { display: none; }

/* === Fristenrechner Styles === */
.cal-content { padding: 8px; font-size: 12px; }
.cal-top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 6px; font-weight: bold; font-size: 13px; }
.cal-title { font-size: 15px; }
.cal-top input[type="date"] { font-size: 14px; padding: 2px 6px; border: 1px solid #aaa; border-radius: 3px; }
.cal-radios { display: flex; gap: 4px; flex-wrap: wrap; }
.cal-radios label { display: inline-flex; align-items: center; gap: 3px; border: 1px solid #999; border-radius: 3px; padding: 2px 7px; cursor: pointer; font-size: 11px; font-weight: normal; background: #ddd; user-select: none; }
.cal-radios input[type="radio"] { display: none; }
.cal-radios label.sel { background: #90ee90; color: #330099; font-weight: bold; }
.cal-scroll { overflow-x: auto; }
.cal-table { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 1px; }
.cal-table td, .cal-table th { background: #d3d3d3; padding: 1px; font-size: 10px; text-align: center; overflow: hidden; white-space: nowrap; }
.cal-label { width: 20%; text-align: left !important; font-size: 10px; font-weight: bold; padding: 2px 4px !important; white-space: normal !important; word-break: break-word; line-height: 1.25; background: #e8e8e8 !important; }
.cal-mh { background: white !important; font-size: 10px; }
.cal-dh { font-weight: normal; }
.cal-hol { background: orange !important; }
.cal-wknd { background: yellow !important; }
.cal-mark-r { background: red !important; }
.cal-mark-hv { background: repeating-linear-gradient(45deg,#888 0,#888 2px,#ddd 2px,#ddd 7px) !important; }
.cal-today { outline: 2px solid #0055cc; outline-offset: -2px; }
.cal-legend { margin-top: 6px; font-size: 10px; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.cal-sw { display: inline-block; width: 14px; height: 14px; border: 1px solid #888; vertical-align: middle; margin-right: 3px; }
.cal-footer { margin-top: 6px; font-size: 10px; color: #555; }

/* === Responsive === */
@media (max-width: 700px) {
    .poa-field-row { flex-direction: column; gap: 4px; }
}

/* === Print === */
@media print {
    .topbar { display: none !important; }
    body, #app, .tool-content { overflow: visible !important; height: auto !important; }

    /* POA Print */
    .poa-disclaimer { display: none !important; }
    .poa-input { background: transparent !important; }
    .poa-notice { color: #000 !important; background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }

    /* COH Print */
    .coh-disclaimer { display: none !important; }
    .coh-screen-only { display: none !important; }
    .coh-print-only { display: inline !important; }
    .coh-input, .coh-select { background: transparent !important; border: none !important; }
    .coh-future-note { display: none !important; }
}
