/* Fahrtkostenabrechnung – Frontend-Styles
   Passt sich ans Theme an: nutzt WordPress-Theme-Farbvariablen
   (--wp--preset--color--*) und die Theme-Schrift, mit dezenten Fallbacks.
   Farbsystem: orange = manuelle Adresse, rot = km-Abweichung, violett = Duplikat.
*/

.fk-app {
	/* Theme-Anbindung: zuerst WP-Theme-Variablen, dann neutraler Fallback.
	   So uebernimmt das Plugin bei Block-Themes automatisch die Theme-Farben. */
	--ink: var(--wp--preset--color--contrast, var(--wp--preset--color--foreground, #1c2530));
	--ink-soft: #5a6675;
	--line: #e6e9ee;
	--line-strong: #d4dae1;
	--paper: var(--wp--preset--color--base, var(--wp--preset--color--background, #ffffff));
	--bg: transparent;
	/* Akzentfarbe fest auf Wunschfarbe (warmes Gold). */
	--brand: #f0c84c;
	--brand-dark: #d9b22f;
	--brand-soft: #fdf6e0;
	/* Textfarbe auf der Akzentfarbe: dunkel, da das Gold zu hell fuer
	   weisse Schrift ist (sonst unlesbar). */
	--on-brand: #2a2410;
	--man: #c97b00;  --man-bg: #fdf4e7;
	--abw: #c0392b;  --abw-bg: #fbecea;
	--dup: #7d3c98;  --dup-bg: #f4ecf7;
	/* Schrift vom Theme erben (kein Google-Fonts-Laden noetig). */
	font-family: inherit;
	color: var(--ink);
	background: var(--bg);
	max-width: 1040px;
	margin: 0 auto;
	padding: 8px 4px 80px;
	line-height: 1.55;
}
.fk-app * { box-sizing: border-box; }

/* Eckige Optik: Formularfelder, Buttons und Container ohne abgerundete Ecken.
   Ausgenommen sind nur runde Status-Pillen (.fk-badge) und der Lade-Spinner. */
.fk-app input,
.fk-app textarea,
.fk-app select,
.fk-app button,
.fk-app .fk-card,
.fk-app .fk-userbox,
.fk-app .fk-hinweis,
.fk-app .ac-input,
.fk-app .ac-drop,
.fk-app .fk-radio,
.fk-app .fk-alert,
.fk-app .fk-add,
.fk-app .fk-summary,
.fk-app .fk-message,
.fk-app .fk-hist-item {
	border-radius: 0;
}

.fk-loading { padding: 40px; text-align: center; color: var(--ink-soft); }
.fk-hinweis {
	background: var(--paper); border: 1px solid var(--line);
	border-radius: 10px; padding: 24px; text-align: center; color: var(--ink-soft);
	max-width: 600px; margin: 24px auto;
}

/* Tabs */
.fk-tabs { display: flex; gap: 4px; margin-bottom: 24px; border-bottom: 2px solid var(--line); }
.fk-tab {
	font-family: inherit; font-size: 14px; font-weight: 600; color: var(--ink-soft);
	background: transparent; border: none; border-bottom: 2px solid transparent;
	padding: 10px 18px; cursor: pointer; margin-bottom: -2px; transition: color .15s, border-color .15s;
}
.fk-tab.active { background: var(--brand); color: var(--on-brand); border-bottom-color: var(--brand); }

/* Header */
.fk-header {
	display: flex; justify-content: space-between; align-items: flex-start;
	gap: 24px; margin-bottom: 28px; padding-bottom: 20px; border-bottom: 2px solid var(--ink);
}
.fk-header h1 {
	font-family: inherit; font-weight: 600; font-size: 30px;
	margin: 0 0 4px; letter-spacing: -0.01em; color: var(--ink);
}
.fk-sub { color: var(--ink-soft); font-size: 14px; }
.fk-userbox {
	background: var(--paper); border: 1px solid var(--line);
	border-radius: 10px; padding: 12px 16px; min-width: 230px; text-align: right;
}
.fk-user-name { font-weight: 700; font-size: 14px; }
.fk-user-meta { color: var(--ink-soft); font-size: 12px; }

.fk-topbar { margin-bottom: 24px; }

/* Felder */
.fk-field { display: flex; flex-direction: column; gap: 5px; }
.fk-field > label {
	font-size: 12px; font-weight: 600; color: var(--ink-soft);
	text-transform: uppercase; letter-spacing: 0.03em;
}
.fk-field input[type="text"],
.fk-field input[type="date"],
.fk-field input[type="number"],
.fk-field textarea,
.fk-select select {
	font-family: inherit; font-size: 14px; color: var(--ink);
	background: var(--paper); border: 1px solid var(--line-strong);
	border-radius: 8px; padding: 11px 13px; width: 100%; outline: none;
	transition: border-color .15s, box-shadow .15s;
}
.fk-field input:focus, .fk-field textarea:focus, .fk-select select:focus {
	border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft);
}
.fk-select { position: relative; }
.fk-select select { appearance: none; cursor: pointer; padding-right: 30px; }
.fk-select::after {
	content: ""; position: absolute; right: 12px; top: 50%; width: 8px; height: 8px;
	border-right: 2px solid var(--ink-soft); border-bottom: 2px solid var(--ink-soft);
	transform: translateY(-70%) rotate(45deg); pointer-events: none;
}

/* Fahrt-Karte */
.fk-card {
	background: var(--paper); border: 1px solid var(--line);
	border-left: 4px solid var(--line-strong);
	border-radius: 14px; padding: 26px 28px; margin-bottom: 22px;
	box-shadow: 0 1px 3px rgba(28,37,48,.05);
}
.fk-card.warn-man { border-left-color: var(--man); }
.fk-card.warn-abw { border-left-color: var(--abw); }
.fk-card.warn-dup { border-left-color: var(--dup); }

.fk-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.fk-card-num { font-family: inherit; font-weight: 700; font-size: 18px; }
.fk-card-badges { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fk-badge {
	display: inline-flex; align-items: center; gap: 4px;
	font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 20px;
}
.fk-badge.man { background: var(--man-bg); color: var(--man); }
.fk-badge.abw { background: var(--abw-bg); color: var(--abw); }
.fk-badge.dup { background: var(--dup-bg); color: var(--dup); }
.fk-remove {
	border: none; background: transparent; color: var(--ink-soft);
	cursor: pointer; padding: 4px 8px; border-radius: 6px; font-size: 13px;
	transition: background .15s, color .15s;
}
.fk-remove:hover { background: var(--abw-bg); color: var(--abw); }

.fk-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 18px; }
.fk-col-3 { grid-column: span 3; }
.fk-col-4 { grid-column: span 4; }
.fk-col-5 { grid-column: span 5; }
.fk-col-6 { grid-column: span 6; }
.fk-col-12 { grid-column: span 12; }

/* Autocomplete */
.ac-wrap { position: relative; }
.ac-inputrow { position: relative; display: flex; align-items: center; }
.ac-input {
	font-family: inherit; font-size: 14px; width: 100%;
	background: var(--paper); border: 1px solid var(--line-strong);
	border-radius: 8px; padding: 9px 30px 9px 11px; outline: none;
	transition: border-color .15s, box-shadow .15s;
}
.ac-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.ac-check { position: absolute; right: 10px; color: var(--brand); font-weight: 700; pointer-events: none; }
.ac-drop {
	position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; right: 0;
	background: var(--paper); border: 1px solid var(--line-strong);
	border-radius: 10px; box-shadow: 0 10px 30px rgba(28,37,48,.12);
	overflow: hidden; max-height: 280px; overflow-y: auto;
}
.ac-section {
	font-size: 11px; font-weight: 700; text-transform: uppercase;
	letter-spacing: .04em; color: var(--ink-soft); padding: 9px 12px 5px;
}
.ac-item {
	display: flex; align-items: center; gap: 10px; width: 100%;
	border: none; background: transparent; cursor: pointer;
	padding: 9px 12px; text-align: left; font-family: inherit; border-top: 1px solid var(--line);
}
.ac-item.hl, .ac-item:hover { background: var(--brand-soft); }
.ac-star { color: var(--brand); font-size: 13px; }
.ac-pin { font-size: 13px; opacity: .7; }
.ac-name { display: block; font-size: 14px; font-weight: 600; color: var(--ink); }
.ac-sub { display: block; font-size: 12px; color: var(--ink-soft); }
.ac-empty {
	display: flex; gap: 8px; align-items: flex-start;
	padding: 12px; font-size: 12.5px; color: var(--man); background: var(--man-bg);
}

/* Radios */
.fk-radios { display: flex; gap: 8px; flex-wrap: wrap; }
.fk-radio {
	display: inline-flex; align-items: center; gap: 7px;
	font-size: 13px; padding: 8px 13px; border-radius: 8px;
	border: 1px solid var(--line-strong); cursor: pointer; background: var(--paper); transition: all .15s;
}
.fk-radio.active { border-color: var(--brand); background: var(--brand-soft); font-weight: 600; }
.fk-radio input { accent-color: var(--brand); }

/* km */
.fk-kmrow { display: flex; gap: 8px; }
.fk-km { max-width: 90px; }
.fk-calc {
	display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
	font-family: inherit; font-size: 13px; font-weight: 600;
	border: 1px solid var(--brand); color: var(--on-brand); background: var(--brand);
	border-radius: 8px; padding: 0 12px; cursor: pointer; transition: all .15s;
}
.fk-calc:hover:not(:disabled) { background: var(--brand-dark); border-color: var(--brand-dark); }
.fk-calc:disabled { opacity: .4; cursor: not-allowed; }
.fk-hint { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--ink-soft); margin-top: 5px; }
.abw-hoch { color: var(--abw); font-weight: 700; }
.abw-ok { color: var(--brand); font-weight: 600; }

/* Betrag */
.fk-betrag-field { text-align: right; }
.fk-betrag { font-family: inherit; font-weight: 700; font-size: 22px; color: var(--ink); line-height: 1.1; }
.fk-betrag-formel { font-size: 11px; color: var(--ink-soft); }

/* Alerts */
.fk-alert { margin-top: 14px; border-radius: 10px; padding: 13px 15px; font-size: 13px; }
.fk-alert.dup { background: var(--dup-bg); border: 1px solid #ddc4e8; }
.fk-alert.abw { background: var(--abw-bg); border: 1px solid #f1c9c4; }
.fk-alert.man { background: var(--man-bg); border: 1px solid #f0d9b3; }
.fk-alert-head { display: flex; align-items: center; gap: 7px; font-weight: 700; margin-bottom: 6px; }
.fk-alert.dup .fk-alert-head { color: var(--dup); }
.fk-alert.abw .fk-alert-head { color: var(--abw); }
.fk-alert.man .fk-alert-head { color: var(--man); }
.fk-alert p { margin: 0 0 8px; }
.fk-alert ul { margin: 0 0 10px; padding-left: 18px; }
.fk-alert-label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 5px; }
.fk-alert textarea { resize: vertical; width: 100%; }

/* Add */
.fk-add {
	display: flex; align-items: center; justify-content: center; gap: 8px;
	width: 100%; font-family: inherit; font-size: 14px; font-weight: 600;
	color: var(--on-brand); background: var(--brand);
	border: 1.5px solid var(--brand); border-radius: 12px; padding: 14px;
	cursor: pointer; transition: background .15s;
}
.fk-add:hover { background: var(--brand-dark); }

/* Summary */
.fk-summary {
	margin-top: 32px; background: var(--paper); border: 1px solid var(--line);
	border-radius: 14px; padding: 28px 30px;
}
.fk-summary-title { font-family: inherit; font-weight: 700; font-size: 18px; margin-bottom: 18px; }
.fk-summary-row, .fk-summary-total {
	display: flex; justify-content: space-between; align-items: center; font-size: 14px; padding: 7px 0;
}
.fk-summary-row { border-bottom: 1px solid var(--line); color: var(--ink-soft); }
.fk-summary-row span:last-child { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.fk-summary-empty { font-size: 13px; color: var(--ink-soft); padding: 6px 0; }
.fk-summary-total {
	margin-top: 10px; padding-top: 14px; border-top: 2px solid var(--ink);
	font-family: inherit; font-weight: 700; font-size: 20px;
}
.fk-summary-total span:last-child { font-variant-numeric: tabular-nums; }

/* Actions */
.fk-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; }
.fk-btn-ghost, .fk-btn-primary {
	display: inline-flex; align-items: center; gap: 8px;
	font-family: inherit; font-size: 14px; font-weight: 600;
	border-radius: 9px; padding: 12px 22px; cursor: pointer; transition: all .15s;
}
.fk-btn-ghost { background: var(--paper); border: 1px solid var(--line-strong); color: var(--ink); }
.fk-btn-ghost:hover { border-color: var(--ink-soft); }
.fk-btn-primary { background: var(--brand); border: 1px solid var(--brand); color: var(--on-brand); }
.fk-btn-primary:hover:not(:disabled) { background: var(--brand-dark); }
.fk-btn-primary:disabled { opacity: .4; cursor: not-allowed; }
.fk-actions-hint {
	display: flex; align-items: center; gap: 6px; justify-content: flex-end;
	font-size: 12.5px; color: var(--ink-soft); margin-top: 8px;
}

/* Meldungen */
.fk-message { padding: 12px 16px; border-radius: 9px; margin-bottom: 16px; font-size: 14px; }
.fk-message.ok { background: var(--brand-soft); color: var(--brand-dark); border: 1px solid #bcd9d6; }
.fk-message.err { background: var(--abw-bg); color: var(--abw); border: 1px solid #f1c9c4; }

/* Success */
.fk-success { text-align: center; padding: 60px 20px; }
.fk-success-icon { font-size: 48px; color: var(--brand); }
.fk-success h2 { font-family: inherit; font-size: 26px; color: var(--ink); margin: 16px 0 8px; }
.fk-success p { color: var(--ink-soft); font-size: 15px; margin-bottom: 24px; }

/* Historie */
.fk-hist-item {
	background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
	padding: 16px 20px; margin-bottom: 12px;
}
.fk-hist-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.fk-hist-beleg { font-weight: 700; font-size: 15px; }
.fk-hist-datum { color: var(--ink-soft); font-size: 13px; }
.fk-hist-gesamt { font-family: inherit; font-weight: 700; font-size: 18px; color: var(--brand); }
.fk-hist-fahrten { font-size: 13px; color: var(--ink-soft); }
.fk-hist-fahrt { padding: 5px 0; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; }
.fk-hist-empty { color: var(--ink-soft); text-align: center; padding: 40px; }

.fk-spin { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--brand-soft); border-top-color: var(--brand); border-radius: 50%; animation: fk-spin 0.7s linear infinite; vertical-align: middle; }
@keyframes fk-spin { to { transform: rotate(360deg); } }

@media (max-width: 720px) {
	.fk-header { flex-direction: column; }
	.fk-userbox { text-align: left; width: 100%; }
	.fk-col-3, .fk-col-4, .fk-col-5, .fk-col-6 { grid-column: span 12; }
	.fk-kmrow { flex-wrap: wrap; }
	.fk-actions { flex-direction: column; }
	.fk-btn-ghost, .fk-btn-primary { justify-content: center; }
}

/* Hilfe-Tab (rechts in der Reiter-Leiste) + Overlay */
.fk-tab-hilfe {
	margin-left: auto;  /* schiebt den Hilfe-Tab ganz nach rechts */
}

.fk-hilfe-overlay {
	position: fixed; inset: 0; z-index: 9999;
	background: rgba(20,25,30,.55);
	display: flex; align-items: flex-start; justify-content: center;
	padding: 40px 16px; overflow-y: auto;
}
.fk-hilfe-overlay[hidden] { display: none; }
.fk-hilfe-box {
	background: var(--paper); color: var(--ink);
	max-width: 680px; width: 100%; border-radius: 0;
	padding: 32px 36px; position: relative;
	box-shadow: 0 10px 40px rgba(0,0,0,.25);
}
.fk-hilfe-close {
	position: absolute; top: 10px; right: 14px;
	background: none; border: none; font-size: 28px; line-height: 1;
	color: var(--ink-soft); cursor: pointer; padding: 4px 8px;
}
.fk-hilfe-close:hover { color: var(--ink); }
.fk-hilfe-inhalt h3 { font-size: 16px; margin: 20px 0 6px; color: var(--ink); }
.fk-hilfe-inhalt h3:first-child { margin-top: 0; }
.fk-hilfe-inhalt p { margin: 0 0 10px; line-height: 1.55; color: var(--ink); }
.fk-hilfe-inhalt a { color: var(--brand-dark); }
