/* Sekretariat – Farben aus dem Logo (Blau/Grün), augenschonend. Standard: "شب" (dunkel). Wahl in den Einstellungen. */
:root, :root[data-theme="mint"] {
  --bg: #dcebe2;
  --bg2: #e6f1ea;
  --card: #eef6f1;
  --card2: #e2efe7;
  --text: #1d2b25;
  --muted: #5b6f66;
  --brand: #2a8a62;        /* Logo-Grün */
  --brand-strong: #1f6f4e;
  --green: #2a8a62;
  --accent: #b9771a;
  --danger: #b42318;
  --danger-bg: #f6ddd7;
  --warn-bg: #f4e7c8;
  --ok: #1f7a50;
  --border: #c5dccf;
  --shadow: 0 4px 14px rgba(30, 80, 55, .10);
  --btn-text: #fff;
  color-scheme: light;
}
:root[data-theme="night"] {
  --bg: #111a23;
  --bg2: #16222d;
  --card: #1a2733;
  --card2: #20303e;
  --text: #e6edf3;
  --muted: #94a6b8;
  --brand: #5eaee8;        /* Globus-Blau */
  --brand-strong: #2f7fc1;
  --green: #4cbf92;        /* Logo-Grün */
  --accent: #f0b65a;
  --danger: #ff7b72;
  --danger-bg: #3b1d1d;
  --warn-bg: #3a2e16;
  --ok: #5fd39f;
  --border: #2b3c4c;
  --shadow: 0 6px 18px rgba(0, 0, 0, .25);
  --btn-text: #0d1720;
  color-scheme: dark;
}
:root[data-theme="sand"] {
  --bg: #ece6da;
  --bg2: #e4dccd;
  --card: #f6f1e7;
  --card2: #efe8da;
  --text: #2a2f36;
  --muted: #6d6a62;
  --brand: #22598f;
  --brand-strong: #1b4a78;
  --green: #2f8a66;
  --accent: #b9771a;
  --danger: #b42318;
  --danger-bg: #f7dfd8;
  --warn-bg: #f6e6c4;
  --ok: #26734f;
  --border: #d8cfbe;
  --shadow: 0 4px 14px rgba(80, 60, 30, .10);
  --btn-text: #fff;
  color-scheme: light;
}
:root[data-theme="ocean"] {
  --bg: #0e1c24;
  --bg2: #10242c;
  --card: #15303a;
  --card2: #1b3a45;
  --text: #e3f1f0;
  --muted: #8fb1b3;
  --brand: #4fc3c9;
  --brand-strong: #2a9aa1;
  --green: #6fd08f;
  --accent: #f2c063;
  --danger: #ff8a80;
  --danger-bg: #3d1f22;
  --warn-bg: #3a3218;
  --ok: #7fe0a8;
  --border: #284956;
  --shadow: 0 6px 18px rgba(0, 0, 0, .28);
  --btn-text: #08181c;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; color: var(--text);
  font-family: "Vazirmatn", -apple-system, "Segoe UI", Tahoma, sans-serif; font-size: 17px; line-height: 1.7; }
body { background: var(--bg); background-image: radial-gradient(1200px 500px at 100% -10%, color-mix(in srgb, var(--brand) 14%, transparent), transparent),
  radial-gradient(900px 500px at -10% 110%, color-mix(in srgb, var(--green) 12%, transparent), transparent); background-attachment: fixed; min-height: 100vh; }
a { color: var(--brand); }

/* ---------- Kopf ---------- */
header { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
header .brandbox { display: flex; align-items: center; gap: 10px; min-width: 0; }
header .logo { width: 38px; height: 38px; border-radius: 10px; background: #fff; padding: 3px; object-fit: contain; }
header .title { font-weight: 800; color: var(--text); line-height: 1.2; }
header .sub { font-size: 12px; color: var(--muted); }
main { padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); max-width: 760px; margin: 0 auto; }

/* ---------- Navigation ---------- */
nav#tabs { position: fixed; bottom: 0; left: 0; right: 0; display: flex; z-index: 5;
  background: color-mix(in srgb, var(--card) 94%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); }
nav#tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 9px;
  color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 600; }
nav#tabs a svg { width: 23px; height: 23px; }
nav#tabs a.active { color: var(--brand); }
nav#tabs a.active svg { filter: drop-shadow(0 0 6px color-mix(in srgb, var(--brand) 55%, transparent)); }

/* ---------- Bausteine ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 14px; margin-bottom: 12px; box-shadow: var(--shadow); }
.card.click { cursor: pointer; border-right: 4px solid var(--brand); }
.card.click:active { transform: scale(.99); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); font-size: 14px; }
.small { font-size: 13px; }
.pre { white-space: pre-wrap; }
.badge { display: inline-block; font-size: 12.5px; padding: 1px 9px; border-radius: 999px; background: var(--card2); border: 1px solid var(--border); }
.badge.urgent { background: var(--warn-bg); color: var(--accent); border-color: transparent; }
.badge.scam { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.badge.sent { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); border-color: transparent; }
h2 { font-size: 19px; margin: 4px 0 12px; }
h3 { font-size: 15px; margin: 14px 0 6px; color: var(--brand); }
pre.report { white-space: pre-wrap; font-family: inherit; margin: 0; }
.ltr { direction: ltr; text-align: left; }
textarea, input, select { width: 100%; font: inherit; color: var(--text); background: var(--bg2);
  border: 1px solid var(--border); border-radius: 12px; padding: 10px; }
textarea:focus, input:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--brand) 50%, transparent); border-color: var(--brand); }
textarea { min-height: 160px; }
button { font: inherit; font-weight: 700; border: 0; border-radius: 12px; padding: 11px 16px; cursor: pointer;
  background: linear-gradient(135deg, var(--brand), var(--brand-strong)); color: var(--btn-text); }
button.ghost { background: transparent; color: var(--brand); border: 1px solid var(--border); padding: 6px 12px; }
button.danger { background: var(--danger); color: #fff; }
button.light { background: var(--card2); color: var(--text); border: 1px solid var(--border); }
button:disabled { opacity: .5; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.actions button { flex: 1 1 auto; }
.warn { background: var(--danger-bg); color: var(--danger); padding: 10px 12px; border-radius: 12px; margin-bottom: 10px; }
.filters { display: flex; gap: 6px; margin-bottom: 12px; }
.filters button { flex: 1; padding: 8px; }
details summary { cursor: pointer; color: var(--brand); font-weight: 600; }
#toast { position: fixed; bottom: calc(84px + env(safe-area-inset-bottom)); left: 16px; right: 16px; z-index: 10;
  background: var(--card2); color: var(--text); border: 1px solid var(--border); padding: 12px; border-radius: 14px; text-align: center; box-shadow: var(--shadow); }
.login { max-width: 380px; margin: 60px auto; text-align: center; }
.login img { width: 110px; background: #fff; border-radius: 20px; padding: 8px; margin-bottom: 8px; }

/* ---------- Startseite ---------- */
.hello { margin: 4px 0 14px; }
.hello .big { font-size: 22px; font-weight: 800; }
.hello .date { color: var(--muted); font-size: 14px; }
.quick4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.qa { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px; border-radius: 16px; text-decoration: none;
  background: var(--card); border: 1px solid var(--border); color: var(--text); font-size: 12.5px; font-weight: 700; text-align: center; box-shadow: var(--shadow); }
.qa .ic { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; color: #fff; }
.qa .ic svg { width: 24px; height: 24px; }
.ic.blue { background: linear-gradient(135deg, #4aa3e6, #2a6fb0); }
.ic.green { background: linear-gradient(135deg, #4cc596, #2b8f68); }
.ic.amber { background: linear-gradient(135deg, #f4c06a, #d18b22); }
.ic.violet { background: linear-gradient(135deg, #9b8cf0, #6553c9); }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.tile { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 0; background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; padding: 12px 14px; color: var(--text); text-decoration: none; box-shadow: var(--shadow); }
.tile b { font-size: 28px; line-height: 1.2; }
.tile span { font-size: 13.5px; color: var(--muted); }
.tile::after { content: ""; position: absolute; left: -20px; bottom: -20px; width: 70px; height: 70px; border-radius: 50%; opacity: .18; background: var(--c, var(--brand)); }
.tile.t1 { --c: #4aa3e6; } .tile.t1 b { color: #5eaee8; }
.tile.t2 { --c: #f0b65a; } .tile.t2 b { color: var(--accent); }
.tile.t3 { --c: #4cbf92; } .tile.t3 b { color: var(--green); }
.tile.t4 { --c: #ff7b72; }
.tile.attn { border-color: var(--accent); background: var(--warn-bg); }
.tile.attn b { color: var(--accent); }
.hint { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.hint p { margin: 6px 0; }
.sectiontitle { display: flex; align-items: center; gap: 8px; font-weight: 800; margin: 18px 2px 8px; }
.sectiontitle::before { content: ""; width: 4px; height: 18px; border-radius: 4px; background: linear-gradient(var(--brand), var(--green)); }

/* ---------- Mehr / Menü ---------- */
.menu { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; }
.menu .ic { flex: 0 0 auto; width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; color: #fff; }
.menu .ic svg { width: 22px; height: 22px; }
.menu div { display: flex; flex-direction: column; }
.menu b { color: var(--text); }

/* ---------- Gespräch ---------- */
.bubble { max-width: 88%; padding: 10px 13px; border-radius: 16px; margin: 8px 0; line-height: 1.75; box-shadow: var(--shadow); }
.bubble.me { background: linear-gradient(135deg, var(--brand), var(--brand-strong)); color: var(--btn-text); margin-right: 0; margin-left: auto; border-bottom-right-radius: 5px; }
.bubble.bot { background: var(--card); border: 1px solid var(--border); margin-left: 0; margin-right: auto; border-bottom-left-radius: 5px; }
.bubble .done { margin-top: 8px; padding-top: 6px; border-top: 1px dashed var(--border); font-size: 14px; color: var(--ok); }
#chatList { padding-bottom: 110px; }
.chatbox { position: fixed; left: 0; right: 0; bottom: calc(58px + env(safe-area-inset-bottom)); z-index: 4; display: flex; gap: 8px;
  padding: 8px 12px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--border); max-width: 760px; margin: 0 auto; }
.chatbox textarea { min-height: 48px; height: 48px; flex: 1; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.chips button { padding: 6px 12px; font-size: 13.5px; font-weight: 600; background: var(--card2); color: var(--text); border: 1px solid var(--border); border-radius: 999px; }

/* ---------- Formulare / Unterlagen ---------- */
.seg { display: flex; gap: 6px; margin: 10px 0; }
.seg button { flex: 1; padding: 9px; }
.filebtn { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 18px; border: 2px dashed var(--brand); border-radius: 16px;
  color: var(--brand); font-weight: 800; cursor: pointer; margin: 8px 0; background: color-mix(in srgb, var(--brand) 8%, transparent); }
.filebtn svg { width: 34px; height: 34px; }
.check { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.check input { width: auto; }
.form { display: grid; gap: 10px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }
.form label[hidden] { display: none; }
.thumb { max-width: 100%; border-radius: 12px; border: 1px solid var(--border); margin: 6px 0; }
.filelink { display: block; padding: 10px 0; }
.hot { color: var(--accent); font-weight: 700; }

/* ---------- Einstellungen: Farbwahl ---------- */
.themes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.themes button { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px; background: var(--card2); color: var(--text); border: 2px solid var(--border); }
.themes button.on { border-color: var(--brand); }
.themes .sw { width: 100%; height: 34px; border-radius: 8px; }

.chatbox .mic { flex: 0 0 auto; width: 52px; padding: 0; display: grid; place-items: center; background: var(--card2); color: var(--brand); border: 1px solid var(--border); }
.chatbox .mic svg { width: 24px; height: 24px; }
.chatbox .mic.rec { background: var(--danger); color: #fff; animation: pulse 1.2s infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(220, 60, 50, .5); } 50% { box-shadow: 0 0 0 8px rgba(220, 60, 50, 0); } }
