/* Gramador Portal – Grundgestaltung (Navy #1b3a5f, Orange #f58216) */
:root {
    --navy: #1b3a5f;
    --navy-dark: #13294a;
    --orange: #f58216;
    --bg: #f4f6f9;
    --card: #ffffff;
    --text: #1d2733;
    --muted: #5b6776;
    --border: #d5dbe3;
    --danger: #b3261e;
    --success-bg: #e6f4ea;
    --success-text: #1e5a2d;
    --error-bg: #fdecea;
    --radius: 10px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
}

a { color: var(--navy); }
a:hover { color: var(--navy-dark); }

:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }

h1 { font-size: 1.6rem; line-height: 1.25; margin: 0 0 1rem; color: var(--navy); }
h2 { font-size: 1.2rem; margin: 0 0 .75rem; color: var(--navy); }

.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 1rem; top: 1rem; background: #fff; padding: .5rem 1rem; z-index: 10; }

/* Kopfbereich */
.site-header { background: #fff; border-bottom: 3px solid var(--orange); position: sticky; top: 0; z-index: 40; }
.nav__icon { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: .4rem !important; }
.nav__icon svg { display: block; }
.site-header__inner {
    max-width: 1100px; margin: 0 auto; padding: .6rem 1rem;
    display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.5rem;
}
.brand { display: inline-flex; align-items: center; gap: .75rem; text-decoration: none; margin-right: auto; }
.brand img { height: 44px; width: auto; display: block; }
.brand__label {
    color: var(--navy); font-weight: 700; font-size: 1.05rem; letter-spacing: .02em;
    padding-left: .75rem; border-left: 2px solid var(--border);
}
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem; }
.nav a, .nav button {
    color: var(--navy); text-decoration: none; background: none; border: 0; font: inherit; font-weight: 600; cursor: pointer;
    padding: .5rem .75rem; border-radius: 6px; min-height: 44px; display: inline-flex; align-items: center;
}
.nav a:hover, .nav button:hover { background: #eef2f7; color: var(--navy-dark); }
.nav a[aria-current="page"] { background: var(--navy); color: #fff; }
.nav form { margin: 0; }

/* Inhalt */
.container { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.container--narrow { max-width: 440px; }
.container--login { max-width: 980px; }

.card {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1.25rem; margin-bottom: 1.25rem;
}

.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

.muted { color: var(--muted); }
.small { font-size: .9rem; }

/* Kennzahlen */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; text-decoration: none; display: block; }
.stat:hover { border-color: var(--navy); }
.stat__value { display: block; font-size: 1.8rem; font-weight: 700; color: var(--navy); line-height: 1.1; }
.stat__label { color: var(--muted); }

/* Schaltflächen */
.btn {
    display: inline-flex; align-items: center; justify-content: center; min-height: 44px;
    padding: .55rem 1rem; border-radius: 8px; border: 1px solid var(--navy);
    background: var(--navy); color: #fff; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--navy-dark); color: #fff; }
.btn--accent { background: var(--orange); border-color: var(--orange); color: var(--navy-dark); }
.btn--accent:hover { background: #e07308; color: var(--navy-dark); }
.btn--ghost { background: #fff; color: var(--navy); }
.btn--ghost:hover { background: #eef2f7; color: var(--navy-dark); }
.btn--danger { background: #fff; border-color: var(--danger); color: var(--danger); }
.btn--danger:hover { background: var(--danger); color: #fff; }
.btn--small { min-height: 36px; padding: .3rem .7rem; font-size: .9rem; }

/* Formulare */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; }
.field { display: flex; flex-direction: column; gap: .3rem; }
.field--full { grid-column: 1 / -1; }
label { font-weight: 600; }
.required { color: var(--danger); }
input[type="text"], input[type="number"], input[type="datetime-local"], input[type="url"], input[type="email"], input[type="password"], input[type="date"], input[type="search"], input[type="tel"], select, textarea {
    width: 100%; min-height: 44px; padding: .5rem .65rem; font: inherit; color: var(--text);
    background: #fff; border: 1px solid #8a96a5; border-radius: 8px;
}
textarea { min-height: 110px; resize: vertical; }
.check { display: flex; align-items: flex-start; gap: .5rem; font-weight: 400; }
.check input { width: 1.2rem; height: 1.2rem; margin-top: .15rem; flex: none; }
.field-error { color: var(--danger); font-size: .9rem; }
.form-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.25rem; }

.filter { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; }
.filter .field { flex: 1 1 200px; }

/* Hinweise */
.alert { border-radius: 8px; padding: .75rem 1rem; margin-bottom: 1rem; }
.alert--success { background: var(--success-bg); color: var(--success-text); }
.alert--error { background: var(--error-bg); color: var(--danger); }

/* Tabellen */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .65rem .75rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }

/* Status-Marken */
.badge { display: inline-block; padding: .15rem .6rem; border-radius: 999px; font-size: .85rem; font-weight: 600; white-space: nowrap; }
.badge--interessent { background: #e3ecf8; color: #1b3a5f; }
.badge--aktiv { background: #e6f4ea; color: #1e5a2d; }
.badge--pausiert { background: #fff1d6; color: #6b4700; }
.badge--gekuendigt { background: #eceff3; color: #47525f; }
.badge--neutral { background: #eceff3; color: #47525f; }

/* Datenlisten */
.details { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .75rem 1.5rem; margin: 0; }
.details dt { color: var(--muted); font-size: .85rem; }
.details dd { margin: 0; }

.site-footer { display: flex; flex-wrap: wrap; justify-content: center; gap: .3rem .5rem; color: var(--muted); font-size: .85rem; padding: 0 1rem 2rem; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--navy); }

/* Anmeldeseite */
.login-card { max-width: 440px; margin: 1rem auto 2rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.25rem; }
.tile {
    display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden; text-decoration: none; color: var(--text);
}
.tile:hover { border-color: var(--navy); color: var(--text); box-shadow: 0 6px 18px rgba(27, 58, 95, .12); }
.tile img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
.tile__body { padding: 1rem 1.25rem 1.25rem; }
.tile__title { display: block; font-weight: 700; font-size: 1.1rem; color: var(--navy); margin-bottom: .25rem; }
.tile__text { display: block; color: var(--muted); }
.tiles--three { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 760px) { .tiles--three { grid-template-columns: 1fr; } }
.login-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem; align-items: start; margin-top: 1rem; }
.login-layout .login-card { max-width: none; margin: 0; }
.login-quick { display: grid; gap: .75rem; }
.tile--row { flex-direction: row; align-items: center; }
.tile--row img { width: 132px; flex: 0 0 132px; }
.tile--row .tile__body { padding: .75rem 1rem; }
.tile--row .tile__title { font-size: 1.02rem; margin-bottom: .1rem; }
.tile--row .tile__text { font-size: .9rem; }
@media (max-width: 760px) {
    .login-layout { grid-template-columns: 1fr; }
    .tile--row img { width: 96px; flex-basis: 96px; }
}
.login-modules {
    margin-top: 3rem; padding: 1.75rem 1.5rem 1.5rem; border-radius: var(--radius);
    background: #e3eaf2; border-top: 4px solid var(--orange);
}
.login-modules__head { margin-bottom: 1.25rem; }
.login-modules h2 { margin: 0; color: var(--navy); font-size: 1.5rem; }
.login-modules__head p { margin: .25rem 0 0; color: var(--muted); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

@media (max-width: 600px) {
    h1 { font-size: 1.35rem; }
    .brand { width: 100%; }
    .brand img { height: 38px; }
    .card { padding: 1rem; }
    .site-header__inner { padding-bottom: .25rem; }
    .nav {
        width: 100%; flex-wrap: nowrap; overflow-x: auto; gap: 0; margin: 0 -.5rem;
        -webkit-overflow-scrolling: touch; scrollbar-width: none;
    }
    .nav::-webkit-scrollbar { display: none; }
    .nav a, .nav button { padding: .45rem .6rem; white-space: nowrap; flex: none; }
}

@media (prefers-reduced-motion: no-preference) {
    .btn, .nav a, .nav button, .stat, .tile { transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease; }
}

/* Block 2: Menü-Zähler, Reiter, Verlauf, Notizen */
.nav__count {
    display: inline-flex; align-items: center; justify-content: center; min-width: 1.4rem; height: 1.4rem;
    margin-left: .4rem; padding: 0 .35rem; border-radius: 999px; background: var(--orange); color: var(--navy-dark);
    font-size: .8rem; font-weight: 700;
}
.nav a[aria-current="page"] .nav__count { background: #fff; }

.tabs { display: flex; flex-wrap: wrap; gap: .25rem; margin-bottom: 1rem; border-bottom: 2px solid var(--border); }
.tabs a {
    padding: .55rem .9rem; text-decoration: none; font-weight: 600; color: var(--muted);
    border-bottom: 3px solid transparent; margin-bottom: -2px; min-height: 44px; display: inline-flex; align-items: center;
}
.tabs a:hover { color: var(--navy); }
.tabs a[aria-current="page"] { color: var(--navy); border-bottom-color: var(--orange); }

.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
    display: inline-flex; align-items: center; min-height: 36px; padding: .3rem .8rem; border-radius: 999px;
    border: 1px solid var(--border); background: #fff; color: var(--navy); text-decoration: none; font-size: .9rem; font-weight: 600;
}
.chip:hover { border-color: var(--navy); }
.chip[aria-current="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline > li { border-left: 3px solid var(--border); padding: 0 0 1.1rem 1rem; position: relative; }
.timeline > li:last-child { padding-bottom: 0; }
.timeline > li::before {
    content: ""; position: absolute; left: -8px; top: .35rem; width: 13px; height: 13px; border-radius: 50%;
    background: #fff; border: 3px solid var(--navy);
}
.timeline > li.is-system::before { border-color: #9aa8b9; }
.timeline > li.is-internal { border-left-color: var(--orange); }
.timeline__meta { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; font-size: .9rem; color: var(--muted); margin-bottom: .25rem; }
.timeline__body { white-space: pre-line; overflow-wrap: anywhere; }
.timeline > li.is-system .timeline__body { color: var(--muted); font-style: italic; }

.badge--orange { background: #fde3c8; color: #7a3a00; }
.badge--navy { background: #e3ecf8; color: var(--navy); }
.badge--done { background: #e6f4ea; color: #1e5a2d; }
.badge--overdue { background: var(--error-bg); color: var(--danger); }
.badge--notiz { background: #eceff3; color: #47525f; }
.badge--gespraech { background: #e3ecf8; color: var(--navy); }
.badge--termin { background: #fff1d6; color: #6b4700; }
.badge--email { background: #e6f4ea; color: #1e5a2d; }
.badge--neu { background: #fde3c8; color: #7a3a00; }
.badge--in_bearbeitung { background: #e3ecf8; color: var(--navy); }
.badge--angebot { background: #fff1d6; color: #6b4700; }
.badge--gewonnen { background: #e6f4ea; color: #1e5a2d; }
.badge--verloren { background: #eceff3; color: #47525f; }
.badge--spam { background: var(--error-bg); color: var(--danger); }

tr.is-unread td:first-child a { font-weight: 700; }
tr.is-unread td:first-child a::before { content: "● "; color: var(--orange); }

.inline-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; }
.inline-form .field { flex: 1 1 180px; }

.keybox {
    background: #fff8ef; border: 2px solid var(--orange); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1.25rem;
}
.keybox code, pre.code {
    display: block; padding: .6rem .75rem; background: #1d2733; color: #f4f6f9; border-radius: 6px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85rem; overflow-x: auto; white-space: pre; margin: .5rem 0;
}
.fields-table th { width: 30%; text-transform: none; letter-spacing: 0; font-size: .9rem; white-space: normal; }
.fields-table td { white-space: pre-line; overflow-wrap: anywhere; }

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

/* Registerkarten (Konto, Gastro) */
.tabs { display: flex; gap: .25rem; border-bottom: 2px solid var(--border); margin: 0 0 1.25rem; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs__item {
    flex: none; padding: .6rem 1rem; text-decoration: none; font-weight: 600; color: var(--muted);
    border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap;
}
.tabs__item:hover { color: var(--navy); }
.tabs__item[aria-current="page"] { color: var(--navy); border-bottom-color: var(--orange); }
