/* Blattwerk im Browser – gleiche Farben wie die Windows-Version */
:root {
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-soft: #e8f0fe;
  --accent-line: #c7d8fa;
  --teal: #0d9488;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e3e6ea;
  --window: #f4f5f7;
  --canvas: #edf0f4;
  --hover: #f0f3f7;
  --warn: #d97706;
  --err: #dc2626;
  --ok: #16a34a;
  --ui: "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 14px/1.4 var(--ui);
  color: var(--text);
  background: var(--window);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body > header, body > .toolbar, body > footer { flex: none; }
.sitebar { display: flex; align-items: center; gap: 22px; height: 44px; padding: 0 16px; background: #0f1d33; color: #c9d4e5; font-size: 13.5px; }
.sb-brand { display: flex; align-items: center; gap: 8px; color: #fff; font-weight: 700; text-decoration: none; font-size: 14.5px; }
.sb-brand img { border-radius: 6px; }
.sb-nav { display: flex; gap: 18px; overflow-x: auto; }
.sb-nav a { color: #c9d4e5; text-decoration: none; white-space: nowrap; }
.sb-nav a:hover { color: #fff; }
.sb-nav a.on { color: #fff; font-weight: 600; }
body > main { flex: 1; }
button, input, select { font: inherit; color: inherit; }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.sm { width: 16px; height: 16px; }
.muted { color: var(--muted); font-weight: 400; }
.small { font-size: 12.5px; }
[hidden] { display: none !important; }
:focus:not(:focus-visible) { outline: none; }
:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 1px; }

/* Kopf */
.top {
  display: flex; align-items: center; gap: 10px;
  height: 52px; padding: 0 14px;
  background: #fff; border-bottom: 1px solid var(--border);
}
.logo img { display: block; border-radius: 8px; }
.tb {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 10px;
  border: 0; background: none; border-radius: 8px; cursor: pointer; color: #374151;
}
.tb:hover { background: var(--hover); }
.tb.round { width: 32px; height: 32px; padding: 0; justify-content: center; border: 1.5px solid #374151; border-radius: 50%; font-weight: 600; font-size: 14px; }
.docinfo { padding-left: 10px; border-left: 1px solid var(--border); min-width: 0; }
.docname { font-weight: 650; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
.docsub { color: var(--muted); font-size: 12px; }
.grow { flex: 1; }
.savechip { font-size: 12.5px; color: var(--ok); display: inline-flex; align-items: center; gap: 6px; }
.savechip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.savechip[data-st="busy"] { color: var(--muted); }
.savechip[data-st="err"] { color: var(--warn); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px;
  background: #fff; border: 1px solid #d5d9df; border-radius: 10px; cursor: pointer;
  font-weight: 500; white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--hover); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover:not(:disabled) { background: var(--accent-dark); }
.btn.danger { color: var(--err); border-color: #f3c6c6; }
.btn.danger:hover { background: #fef2f2; }
.btn.wide { width: 100%; margin-top: 8px; }
.split { position: relative; display: flex; }
.split .btn.primary:first-child { border-radius: 10px 0 0 10px; }
.split .caret { border-radius: 0 10px 10px 0; padding: 0 9px; border-left: 1px solid rgba(255, 255, 255, .35); }
.menu {
  position: absolute; right: 0; top: 42px; z-index: 30; width: 260px;
  background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 5px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, .14);
}
.menu button { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; background: none; border-radius: 7px; cursor: pointer; }
.menu button:hover { background: var(--hover); }
.menu button span { display: block; color: var(--muted); font-size: 12.5px; }

/* Werkzeugleiste */
.toolbar {
  display: flex; align-items: center; gap: 2px;
  height: 50px; padding: 0 10px;
  background: #fff; border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tool {
  display: inline-flex; align-items: center; gap: 7px;
  height: 36px; padding: 0 10px;
  background: none; border: 1px solid transparent; border-radius: 10px; cursor: pointer; color: #374151; white-space: nowrap;
}
.tool:hover:not(:disabled) { background: var(--hover); }
.tool.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-dark); }
.tool:disabled { opacity: .35; cursor: default; }
.sep { width: 1px; height: 24px; background: var(--border); margin: 0 6px; }

/* Arbeitsfläche */
main { position: relative; min-height: 0; }
.work { display: grid; grid-template-columns: 1fr 300px; height: 100%; min-height: 0; }
.canvas { position: relative; overflow: hidden; background: var(--canvas); }
svg.sheet { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; user-select: none; }
svg.sheet.panning { cursor: grabbing !important; }
#paper { fill: #fff; filter: drop-shadow(0 1px 2px rgba(15, 23, 42, .10)) drop-shadow(0 6px 18px rgba(15, 23, 42, .07)); }
.s-vis { stroke: #111; stroke-width: var(--w5); fill: none; stroke-linecap: round; stroke-linejoin: round; }
.s-hid { stroke: #111; stroke-width: var(--w25); fill: none; stroke-dasharray: 3 1.5; }
.s-cen { stroke: #111; stroke-width: var(--w25); fill: none; stroke-dasharray: 8 1.5 .5 1.5; }
.s-tan, .s-thin { stroke: #111; stroke-width: var(--w25); fill: none; }
.s-dim { stroke: #111; stroke-width: var(--w25); fill: none; }
.s-frame { stroke: #111; stroke-width: var(--w7); fill: none; }
.s-tframe { stroke: #111; stroke-width: var(--w35); fill: none; }
.fill { fill: #111; }
.t-thin, .t-dimt { fill: #111; }
.t-label { fill: #4b5563; }
/* Hervorhebung */
[class^="hl-s-"] { stroke: var(--accent); stroke-width: calc(var(--w25) * 1.6); fill: none; }
.hl-s-hid { stroke-dasharray: 3 1.5; }
.hl-fill { fill: var(--accent); }
[class^="hl-t-"] { fill: var(--accent); }
.hlgeo { stroke: var(--accent); stroke-width: var(--wh); fill: none; stroke-linecap: round; opacity: .85; }
.hovbox { fill: rgba(37, 99, 235, .08); stroke: var(--accent-line); stroke-width: var(--w25); }
.selbox { fill: rgba(37, 99, 235, .1); stroke: var(--accent); stroke-width: var(--w25); }
.snap { fill: rgba(255, 255, 255, .85); stroke: var(--teal); stroke-width: calc(var(--wh) * .8); }
.snap.on { stroke: var(--accent); fill: var(--accent-soft); }
g.snap line { stroke: var(--teal); }
.viewbox { fill: none; stroke: var(--accent-line); stroke-width: var(--w25); stroke-dasharray: 2 1.5; }
.viewbox.on { stroke: var(--accent); }

.hint {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%);
  max-width: calc(100% - 230px);
  background: #fff; border: 1px solid var(--border); border-radius: 999px;
  padding: 7px 16px; font-size: 13px; color: #374151; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  box-shadow: 0 4px 14px rgba(15, 23, 42, .06); pointer-events: none;
}
.toast {
  position: absolute; left: 50%; top: 16px; transform: translateX(-50%);
  background: #1f2937; color: #fff; border-radius: 10px; padding: 9px 16px; font-size: 13.5px; z-index: 5;
}
.zoombox {
  position: absolute; right: 14px; bottom: 12px;
  display: flex; align-items: center; gap: 2px;
  background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 3px;
}
.zoombox button { width: 30px; height: 30px; border: 0; background: none; border-radius: 8px; cursor: pointer; font-size: 18px; display: grid; place-items: center; color: #374151; }
.zoombox button:hover { background: var(--hover); }
.zoombox span { min-width: 48px; text-align: center; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.textedit {
  position: absolute; z-index: 6; min-width: 160px;
  border: 1.5px solid var(--accent); border-radius: 6px; padding: 2px 6px; background: #fff;
  font-family: Arial, Helvetica, sans-serif; outline: none;
}

/* Seitenleiste */
.side { background: #fff; border-left: 1px solid var(--border); overflow-y: auto; min-height: 0; }
.tabs { display: flex; gap: 2px; padding: 8px 10px 0; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: #fff; z-index: 2; }
.tabs button { flex: 1; padding: 9px 4px; border: 0; background: none; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; font-weight: 500; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.tabpane { padding: 4px 16px 24px; }
.tabpane h3 { font-size: 13px; text-transform: none; margin: 18px 0 8px; font-weight: 650; }
.fld { display: block; margin-bottom: 10px; }
.fld > span { display: block; font-size: 12.5px; color: #4b5563; margin-bottom: 3px; }
.fld input, .fld select {
  width: 100%; height: 34px; padding: 0 9px; border: 1px solid #d5d9df; border-radius: 8px; background: #fff;
}
.fld input:focus, .fld select:focus { outline: 2px solid var(--accent-line); border-color: var(--accent); }
.fld small { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.chk { display: flex; align-items: center; gap: 8px; padding: 4px 0; cursor: pointer; }
.chk input { width: 16px; height: 16px; accent-color: var(--accent); }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.seg button { height: 32px; border: 1px solid #d5d9df; background: #fff; border-radius: 8px; cursor: pointer; font-size: 13px; }
.seg button:hover { background: var(--hover); }
.seg button.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-dark); font-weight: 600; }
.kind { font-size: 12.5px; color: var(--muted); margin: -2px 0 12px; }

.status {
  display: flex; gap: 0; justify-content: flex-end; align-items: center;
  height: 30px; padding: 0 16px; background: #fff; border-top: 1px solid var(--border);
  color: var(--muted); font-size: 12.5px;
}
.status span + span::before { content: "·"; margin: 0 8px; }

/* Startseite */
.start { height: 100%; overflow-y: auto; }
.start-in { max-width: 920px; margin: 0 auto; padding: 48px 28px 40px; }
.start-head { display: flex; gap: 22px; align-items: center; margin-bottom: 30px; }
.start-head img { border-radius: 16px; }
.start-head h1 { margin: 0 0 4px; font-size: 30px; letter-spacing: -.4px; }
.start-head p { margin: 0; color: var(--muted); font-size: 15.5px; }
.drop {
  display: flex; align-items: center; gap: 18px;
  padding: 22px 24px; border: 2px dashed #cfd6df; border-radius: 16px; background: #fafbfc; cursor: pointer;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop-ic { width: 52px; height: 52px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.drop-ic .ic { width: 24px; height: 24px; }
.drop-t { flex: 1; }
.drop-t b { display: block; font-size: 16px; margin-bottom: 2px; }
.drop-t span { color: var(--muted); font-size: 13.5px; }
.start-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 34px; }
.start-cols h2 { font-size: 12.5px; letter-spacing: .08em; text-transform: uppercase; color: #4b5563; margin: 0 0 12px; font-weight: 650; }
.ex { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 6px; border: 0; background: none; cursor: pointer; text-align: left; font-size: 15px; border-radius: 8px; }
.ex:hover { background: #fff; }
.ex .ic { color: var(--teal); }
.ex small { color: var(--muted); font-size: 13px; }
.resume-b { display: flex; gap: 12px; align-items: center; width: 100%; padding: 12px; background: #fff; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; text-align: left; margin-bottom: 10px; }
.resume-b:hover { border-color: var(--accent-line); }
.resume-b .ic { color: var(--accent); }
.resume-b small { display: block; color: var(--muted); font-size: 12.5px; }
.linkbtn { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 6px 0; }
.linkbtn:hover { text-decoration: underline; }
.start-foot { margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13.5px; }
.start-foot a { color: var(--accent); }

/* Warten, Fenster */
.busy { position: absolute; inset: 0; background: rgba(244, 245, 247, .7); display: grid; place-items: center; z-index: 20; }
.busybox { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 18px 24px; display: flex; gap: 14px; align-items: center; box-shadow: 0 10px 30px rgba(15, 23, 42, .1); }
.spinner { width: 22px; height: 22px; border: 2.5px solid var(--accent-soft); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.modal { position: fixed; inset: 0; background: rgba(15, 23, 42, .35); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal-box { background: #fff; border-radius: 16px; padding: 24px 26px; max-width: 560px; width: 100%; box-shadow: 0 20px 50px rgba(15, 23, 42, .25); }
.modal-box h2 { margin: 0 0 14px; font-size: 19px; }
.keys { width: 100%; border-collapse: collapse; font-size: 13.5px; margin-bottom: 12px; }
.keys td { padding: 6px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.keys td:first-child { font-weight: 600; width: 42%; padding-right: 12px; }

@media (max-width: 860px) {
  .work { grid-template-columns: 1fr; grid-template-rows: 1fr 240px; }
  .side { border-left: 0; border-top: 1px solid var(--border); }
  .tool span, .tb span, #bSaveFile span { display: none; }
  .start-cols { grid-template-columns: 1fr; gap: 20px; }
  .drop { flex-wrap: wrap; }
  .hint { display: none; }
}
