/* ==========================================================================
   boehmitools · gemeinsames Design-System
   Wird von der Shell UND von jedem Plugin eingebunden.
   Plugins definieren darüber hinaus nur noch Layout-Spezifisches.
   ========================================================================== */

:root {
  /* Farben – hell */
  --bt-bg:          #f7f4ef;
  --bt-bg-2:        #efeae1;
  --bt-surface:     #ffffff;
  --bt-surface-2:   #fbf9f6;
  --bt-ink:         #1c1a17;
  --bt-ink-soft:    #4a453d;
  --bt-muted:       #7a7267;
  --bt-line:        #ddd6ca;
  --bt-line-soft:   #ebe5da;

  --bt-accent:      #c2410c;
  --bt-accent-hi:   #9a330a;
  --bt-accent-soft: #fdf0e8;
  --bt-accent-ink:  #ffffff;

  --bt-teal:        #0f766e;
  --bt-violet:      #6d28d9;

  --bt-ok:          #15803d;
  --bt-ok-soft:     #eaf6ee;
  --bt-warn:        #a16207;
  --bt-warn-soft:   #fdf5e3;
  --bt-err:         #b3261e;
  --bt-err-soft:    #fbecea;
  --bt-info:        #1d4ed8;
  --bt-info-soft:   #eef2ff;

  /* Form */
  --bt-r-sm: 6px;
  --bt-r:    9px;
  --bt-r-lg: 14px;
  --bt-shadow:    0 1px 2px rgba(28,26,23,.05), 0 4px 14px rgba(28,26,23,.05);
  --bt-shadow-lg: 0 12px 40px rgba(28,26,23,.13);
  --bt-ring: 0 0 0 3px rgba(194,65,12,.18);

  /* Typo */
  --bt-font: ui-sans-serif, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --bt-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --bt-fs:   14px;

  --bt-appbar-h: 54px;
  color-scheme: light;
}

[data-bt-theme="dark"] {
  --bt-bg:          #14161a;
  --bt-bg-2:        #1a1d22;
  --bt-surface:     #1e2228;
  --bt-surface-2:   #252a31;
  --bt-ink:         #eceff3;
  --bt-ink-soft:    #c3cad3;
  --bt-muted:       #8d97a3;
  --bt-line:        #333a44;
  --bt-line-soft:   #2a3038;

  --bt-accent:      #f2792f;
  --bt-accent-hi:   #ff8f4d;
  --bt-accent-soft: #2c211a;
  --bt-accent-ink:  #1a1206;

  --bt-teal:        #3fc4b4;
  --bt-violet:      #a98bf0;

  --bt-ok:          #57cc82;
  --bt-ok-soft:     #17281d;
  --bt-warn:        #e8b654;
  --bt-warn-soft:   #2b2417;
  --bt-err:         #ff8a80;
  --bt-err-soft:    #2d1b1a;
  --bt-info:        #8ec5ff;
  --bt-info-soft:   #17202e;

  --bt-shadow:    0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.28);
  --bt-shadow-lg: 0 16px 46px rgba(0,0,0,.45);
  --bt-ring: 0 0 0 3px rgba(242,121,47,.28);
  color-scheme: dark;
}

/* ------------------------------------------------------------------ Basis */
* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--bt-font);
  font-size: var(--bt-fs);
  line-height: 1.45;
  color: var(--bt-ink);
  background: var(--bt-bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--bt-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code, pre, kbd { font-family: var(--bt-mono); font-size: .92em; }

::selection { background: var(--bt-accent); color: var(--bt-accent-ink); }

/* ----------------------------------------------------------- App-Bar/Shell */
.bt-appbar {
  position: sticky; top: 0; z-index: 60;
  height: var(--bt-appbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 14px;
  background: var(--bt-surface);
  border-bottom: 1px solid var(--bt-line);
  box-shadow: 0 1px 0 rgba(0,0,0,.02);
}

.bt-brand {
  display: flex; align-items: center; gap: 9px;
  font-weight: 800; letter-spacing: -.02em;
  color: var(--bt-ink); white-space: nowrap;
}
.bt-brand:hover { text-decoration: none; }
.bt-brand-mark {
  width: 26px; height: 26px; border-radius: 8px; flex: none;
  display: grid; place-items: center;
  background: var(--bt-accent); color: var(--bt-accent-ink);
  font-size: 14px; font-weight: 800;
}
.bt-brand small {
  font-weight: 600; color: var(--bt-muted); font-size: 11px;
  letter-spacing: .06em; text-transform: uppercase;
}

.bt-appbar-sep {
  width: 1px; height: 22px; background: var(--bt-line); flex: none;
}

.bt-crumb {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; color: var(--bt-ink);
  min-width: 0;
}
.bt-crumb .bt-crumb-ico { font-size: 15px; }
.bt-crumb span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.bt-appbar-spacer { flex: 1 1 auto; }

.bt-appbar-actions { display: flex; align-items: center; gap: 8px; }

/* Tool-Umschalter */
.bt-switch { position: relative; }
.bt-switch-menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  width: 320px; max-width: 90vw; padding: 6px;
  background: var(--bt-surface);
  border: 1px solid var(--bt-line);
  border-radius: var(--bt-r-lg);
  box-shadow: var(--bt-shadow-lg);
  display: none; z-index: 70;
}
.bt-switch-menu.open { display: block; }
.bt-switch-menu .bt-switch-head {
  font-size: 11px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--bt-muted);
  padding: 8px 10px 4px;
}
.bt-switch-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 9px 10px; border-radius: var(--bt-r);
  color: var(--bt-ink);
}
.bt-switch-item:hover { background: var(--bt-bg-2); text-decoration: none; }
.bt-switch-item.active { background: var(--bt-accent-soft); }
.bt-switch-item .ico { font-size: 17px; line-height: 1.2; flex: none; }
.bt-switch-item b { display: block; font-size: 13px; }
.bt-switch-item i {
  display: block; font-style: normal; font-size: 11.5px;
  color: var(--bt-muted); line-height: 1.35;
}

/* -------------------------------------------------------------- Container */
.bt-main { padding: 18px 16px 60px; max-width: 1140px; margin: 0 auto; }
.bt-main.wide { max-width: 1520px; }
.bt-main.narrow { max-width: 820px; }

.bt-pagehead { margin: 0 0 16px; }
.bt-pagehead h1 {
  margin: 0; font-size: 22px; letter-spacing: -.02em; font-weight: 800;
}
.bt-pagehead p { margin: 5px 0 0; color: var(--bt-muted); }

/* ------------------------------------------------------------------ Karten */
.bt-card {
  background: var(--bt-surface);
  border: 1px solid var(--bt-line);
  border-radius: var(--bt-r-lg);
  padding: 16px;
  box-shadow: var(--bt-shadow);
  margin-bottom: 14px;
}
.bt-card > h2 {
  margin: 0 0 3px; font-size: 15px; font-weight: 750;
  letter-spacing: -.01em; color: var(--bt-ink);
}
.bt-card > h3 {
  margin: 16px 0 7px; font-size: 11.5px; font-weight: 800;
  letter-spacing: .09em; text-transform: uppercase; color: var(--bt-teal);
}
.bt-card > .hint, .bt-hint {
  margin: 0 0 12px; color: var(--bt-muted); font-size: 12.5px;
}
.bt-card-flush { padding: 0; overflow: hidden; }

/* ----------------------------------------------------------------- Buttons */
button, .bt-btn {
  font: inherit; font-weight: 600; cursor: pointer;
  border: 1px solid var(--bt-line);
  background: var(--bt-surface);
  color: var(--bt-ink);
  border-radius: var(--bt-r);
  padding: 8px 13px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  transition: background .13s, border-color .13s, color .13s, transform .06s;
  white-space: nowrap;
}
button:hover, .bt-btn:hover { background: var(--bt-bg-2); text-decoration: none; }
button:active, .bt-btn:active { transform: translateY(1px); }
button:focus-visible, .bt-btn:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none; box-shadow: var(--bt-ring); border-color: var(--bt-accent);
}
button:disabled, .bt-btn:disabled, button[disabled] {
  opacity: .5; cursor: not-allowed; transform: none;
}

button.primary, .bt-btn.primary {
  background: var(--bt-accent); border-color: var(--bt-accent);
  color: var(--bt-accent-ink); font-weight: 700;
}
button.primary:hover, .bt-btn.primary:hover {
  background: var(--bt-accent-hi); border-color: var(--bt-accent-hi);
}
button.ghost, .bt-btn.ghost {
  background: transparent; border-color: var(--bt-line); color: var(--bt-muted);
}
button.ghost:hover, .bt-btn.ghost:hover { color: var(--bt-ink); background: var(--bt-bg-2); }
button.danger, .bt-btn.danger { color: var(--bt-err); border-color: var(--bt-err); background: transparent; }
button.danger:hover, .bt-btn.danger:hover { background: var(--bt-err-soft); }
button.mini, .bt-btn.mini { padding: 4px 9px; font-size: 12px; border-radius: var(--bt-r-sm); }
button.icon, .bt-btn.icon { padding: 7px 9px; }

.bt-btnrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------------------------------------------------------------- Formulare */
label, .bt-label {
  display: block; font-size: 11.5px; font-weight: 700;
  color: var(--bt-muted); margin: 10px 0 4px;
  letter-spacing: .02em;
}
label.bt-inline, .bt-check {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 600; color: var(--bt-ink-soft);
  margin: 0; text-transform: none; letter-spacing: 0;
}
.bt-check input { width: auto; }

input[type=text], input[type=url], input[type=number], input[type=password],
input[type=search], textarea, select {
  width: 100%; font: inherit;
  padding: 8px 10px;
  color: var(--bt-ink);
  background: var(--bt-surface);
  border: 1px solid var(--bt-line);
  border-radius: var(--bt-r);
  transition: border-color .13s, box-shadow .13s;
}
input::placeholder, textarea::placeholder { color: var(--bt-muted); opacity: .75; }
textarea { resize: vertical; min-height: 54px; line-height: 1.5; }
select { cursor: pointer; }
input[type=color] {
  width: 36px; height: 34px; padding: 2px; cursor: pointer;
  border: 1px solid var(--bt-line); border-radius: var(--bt-r-sm);
  background: var(--bt-surface);
}
input[type=checkbox], input[type=radio] { accent-color: var(--bt-accent); }

.bt-row { display: flex; gap: 10px; flex-wrap: wrap; }
.bt-row > * { flex: 1; min-width: 130px; }
.bt-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bt-grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.bt-grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (max-width: 760px) {
  .bt-grid2, .bt-grid3, .bt-grid4 { grid-template-columns: 1fr; }
}

/* -------------------------------------------------------------------- Tabs */
.bt-tabs {
  display: flex; gap: 3px; flex-wrap: wrap;
  border-bottom: 1px solid var(--bt-line);
  padding: 0 2px;
}
.bt-tab {
  padding: 8px 13px; font-size: 13px; font-weight: 650;
  color: var(--bt-muted); background: transparent;
  border: none; border-bottom: 2px solid transparent;
  border-radius: var(--bt-r-sm) var(--bt-r-sm) 0 0;
  margin-bottom: -1px; cursor: pointer;
}
.bt-tab:hover { color: var(--bt-ink); background: var(--bt-bg-2); }
.bt-tab.active { color: var(--bt-accent); border-bottom-color: var(--bt-accent); background: transparent; }

/* ------------------------------------------------------------------ Badges */
.bt-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .02em;
  background: var(--bt-bg-2); color: var(--bt-ink-soft);
  border: 1px solid var(--bt-line-soft);
}
.bt-badge.ok   { background: var(--bt-ok-soft);   color: var(--bt-ok);   border-color: transparent; }
.bt-badge.warn { background: var(--bt-warn-soft); color: var(--bt-warn); border-color: transparent; }
.bt-badge.err  { background: var(--bt-err-soft);  color: var(--bt-err);  border-color: transparent; }
.bt-badge.info { background: var(--bt-info-soft); color: var(--bt-info); border-color: transparent; }
.bt-badge.accent { background: var(--bt-accent-soft); color: var(--bt-accent); border-color: transparent; }

.bt-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }

/* ------------------------------------------------------------------ Notice */
.bt-notice {
  border: 1px solid var(--bt-line);
  border-left: 3px solid var(--bt-muted);
  background: var(--bt-surface-2);
  border-radius: 0 var(--bt-r) var(--bt-r) 0;
  padding: 10px 13px; font-size: 12.5px; color: var(--bt-ink-soft);
  margin-bottom: 12px;
}
.bt-notice.ok   { border-left-color: var(--bt-ok);   background: var(--bt-ok-soft); }
.bt-notice.warn { border-left-color: var(--bt-warn); background: var(--bt-warn-soft); }
.bt-notice.err  { border-left-color: var(--bt-err);  background: var(--bt-err-soft); }
.bt-notice.info { border-left-color: var(--bt-info); background: var(--bt-info-soft); }
.bt-notice code { background: rgba(128,128,128,.16); padding: 1px 5px; border-radius: 4px; }
.bt-notice b { color: var(--bt-ink); }

/* ------------------------------------------------------------------ Status */
.bt-status {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 13px; border-radius: var(--bt-r);
  background: var(--bt-surface); border: 1px solid var(--bt-line);
  font-size: 13px; color: var(--bt-ink-soft); margin: 12px 0;
  box-shadow: var(--bt-shadow);
}
.bt-status.ok   { border-color: var(--bt-ok);   color: var(--bt-ok); }
.bt-status.error{ border-color: var(--bt-err);  color: var(--bt-err); }
.bt-status.warn { border-color: var(--bt-warn); color: var(--bt-warn); }
.bt-status.busy { border-color: var(--bt-accent); color: var(--bt-accent); }

/* -------------------------------------------------------------------- Item */
.bt-item {
  border: 1px solid var(--bt-line);
  border-radius: var(--bt-r);
  background: var(--bt-surface-2);
  padding: 11px 13px; margin: 10px 0;
}
.bt-item-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 7px;
}
.bt-item-head .n {
  font-weight: 800; font-size: 11px; color: var(--bt-teal);
  letter-spacing: .05em;
}
.bt-item-head .spacer { flex: 1; }

/* ------------------------------------------------------------------ Tabelle */
.bt-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.bt-table th {
  text-align: left; font-size: 11px; font-weight: 800;
  letter-spacing: .07em; text-transform: uppercase; color: var(--bt-muted);
  padding: 9px 10px; border-bottom: 1px solid var(--bt-line);
  background: var(--bt-surface-2);
}
.bt-table td { padding: 9px 10px; border-bottom: 1px solid var(--bt-line-soft); vertical-align: top; }
.bt-table tr:last-child td { border-bottom: none; }
.bt-table tbody tr:hover { background: var(--bt-surface-2); }

/* --------------------------------------------------------------------- Log */
.bt-log {
  font-family: var(--bt-mono); font-size: 12px; line-height: 1.55;
  background: #0f1115; color: #d7dde6;
  border: 1px solid var(--bt-line); border-radius: var(--bt-r);
  padding: 12px 13px; overflow: auto; white-space: pre-wrap;
  word-break: break-word; min-height: 180px; max-height: 60vh;
}
.bt-log .l-err  { color: #ff9a90; }
.bt-log .l-ok   { color: #7fdca2; }
.bt-log .l-warn { color: #ffd28a; }
.bt-log .l-meta { color: #7d8896; }

/* ------------------------------------------------------------------- Toast */
#bt-toaster {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  z-index: 100; display: flex; flex-direction: column; gap: 8px;
  align-items: center; pointer-events: none;
}
.bt-toast {
  background: var(--bt-ink); color: var(--bt-bg);
  padding: 10px 18px; border-radius: var(--bt-r);
  font-size: 13px; font-weight: 600; max-width: 92vw;
  box-shadow: var(--bt-shadow-lg);
  opacity: 0; transform: translateY(8px);
  transition: opacity .2s, transform .2s;
}
.bt-toast.show { opacity: .97; transform: none; }
.bt-toast.err { background: var(--bt-err); color: #fff; }
.bt-toast.ok  { background: var(--bt-ok);  color: #fff; }

/* ------------------------------------------------------------------ Helpers */
.bt-muted { color: var(--bt-muted); font-size: 12.5px; }
.bt-spacer { flex: 1; }
.bt-mono { font-family: var(--bt-mono); }
.bt-empty {
  color: var(--bt-muted); font-size: 13px; text-align: center;
  padding: 26px 14px; border: 1px dashed var(--bt-line);
  border-radius: var(--bt-r); background: var(--bt-surface-2);
}
.bt-scroll { overflow: auto; }
.bt-hidden { display: none !important; }

/* Scrollbars */
* { scrollbar-color: var(--bt-line) transparent; scrollbar-width: thin; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--bt-line); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }
