:root {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #14263b; background: #eef2f6; font-synthesis: none;
  --navy: #14263b; --blue: #1867ae; --border: #d5dfe9;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; cursor: pointer; border: 1px solid var(--border); border-radius: 8px; color: var(--navy); background: white; }
button:hover { background: #eaf3fc; }
button:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 3px solid #f9a442; outline-offset: 2px; }
button[aria-pressed="true"], button[aria-selected="true"] { background: #dcecfb; color: #074780; border-color: #8bbce4; }
button:disabled { cursor: default; opacity: .6; }
a { color: #0a5794; }
[hidden] { display: none !important; }
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.notice { padding: 6px 16px; text-align: center; color: #673613; background: #ffebb9; font-weight: 750; letter-spacing: .035em; font-size: 12px; }
.topbar { background: var(--navy); color: white; padding: 11px 20px; display: flex; gap: 16px; justify-content: space-between; align-items: center; }
.brand { display: flex; gap: 10px; align-items: center; min-width: 0; }
.brand-mark { width: 36px; height: 36px; background: #277fca; border-radius: 9px; display: grid; place-items: center; font-size: 20px; font-weight: 800; }
.brand strong { display: block; font-size: 16px; letter-spacing: -.02em; }
.brand small { display: block; color: #bfcde0; font-size: 11px; margin-top: 2px; }
.top-right { display: flex; align-items: center; gap: 12px; }
.work-id { font-size: 12px; color: #d8e7f7; }
.status { font-size: 11px; border: 1px solid #839ab5; border-radius: 999px; padding: 5px 10px; white-space: nowrap; }
.top-right button { border-color: #456986; color: white; background: #254662; min-height: 36px; padding: 0 12px; white-space: nowrap; }
.menubar { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--border); background: white; padding: 10px 20px; min-height: 43px; }
.menu-labels { display: flex; align-items: center; flex-wrap: wrap; gap: clamp(10px,2.7vw,30px); font-size: 13px; font-weight: 650; }
.menu-note { font-size: 11px; color: #718095; align-self: center; }
.layout-actions { background: #f8fafd; padding: 9px 15px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.layout-actions button { min-height: 38px; padding: 6px 11px; font-weight: 600; font-size: 12px; }
.mode-link { margin-left: auto; font-size: 12px; font-weight: 700; text-decoration: none; padding: 8px; }
.mode-link:hover { text-decoration: underline; }
.workspace { --project-width: 213px; --properties-width: 240px; display: grid; grid-template-columns: var(--project-width) minmax(0,1fr) var(--properties-width); min-height: 540px; flex: 1; gap: 0; }
.workspace:not(.with-project) { grid-template-columns: minmax(0,1fr) var(--properties-width); }
.workspace:not(.with-properties) { grid-template-columns: var(--project-width) minmax(0,1fr); }
.workspace:not(.with-project):not(.with-properties) { grid-template-columns: minmax(0,1fr); }
.panel { background: #fff; padding: 17px 13px; border-right: 1px solid var(--border); min-width: 0; }
.properties-panel { border-left: 1px solid var(--border); border-right: none; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding-bottom: 12px; border-bottom: 1px solid #e7edf3; }
.panel h2 { font-size: 14px; margin: 0; }
.panel-heading span { color: #8797a9; font-size: 19px; }
.aside-caption { font-size: 11px; color: #697d92; line-height: 1.55; margin: 12px 0; }
.tree-section { border-top: 1px solid #ebeff4; padding: 15px 0 9px; font-size: 12px; }
.tree-section strong { display: block; margin-bottom: 8px; }
.tree-section p { padding: 8px 8px; margin: 2px 0; color: #4a6176; }
.tree-section button { display: block; text-align: left; background: transparent; width: 100%; min-height: 37px; border-color: transparent; padding: 9px; font-size: 12px; }
.tree-section button[aria-current="page"] { background: #e5f1fa; border-color: #b9d7ec; font-weight: 700; }
.work-area { min-width: 0; min-height: 0; display: flex; flex-direction: column; padding: 0; }
.tabbar { display: flex; align-items: stretch; background: #e8edf3; gap: 2px; padding: 7px 9px 0; overflow-x: auto; min-height: 49px; }
.tab-item { display: inline-flex; align-items: center; flex: 0 0 auto; }
.tab-item > button { min-height: 38px; font-size: 12px; background: #f7f9fc; border: 1px solid #d4dfea; border-radius: 8px 8px 0 0; padding: 8px 12px; white-space: nowrap; }
.tab-item > button[aria-selected="true"] { background: #fff; border-bottom-color: #fff; color: #08558e; }
.tab-close { min-height: 29px !important; padding: 0 8px !important; border-radius: 6px !important; background: #fff !important; margin-left: -2px; }
.new-tab { margin-left: 3px; border-radius: 7px 7px 0 0; min-width: 38px; font-size: 20px; font-weight: 700; }
.drawing-shell { flex: 1; display: flex; min-height: 450px; padding: 12px; gap: 9px; background: #f1f4f7; }
.toolbar { width: 54px; flex: 0 0 54px; padding: 7px 5px; background: #fff; box-shadow: 0 1px 5px #263d5110; border: 1px solid var(--border); border-radius: 12px; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.toolbar button { font-size: 21px; font-weight: 700; width: 43px; min-height: 43px; display: grid; place-items: center; }
.toolbar .tool-separator { width: 30px; border-top: 1px solid #d9e3ed; margin: 3px 0; }
.drawing-section { flex: 1; min-width: 0; display: flex; flex-direction: column; background: #fff; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.drawing-heading { display: flex; align-items: center; justify-content: space-between; padding: 12px 15px; flex-wrap: wrap; gap: 7px; border-bottom: 1px solid #e8edf2; }
.drawing-heading strong { font-size: 14px; }
.drawing-heading span { font-size: 10px; color: #b14b2a; font-weight: 750; letter-spacing: .06em; }
.drawing-surface { flex: 1; min-height: 340px; position: relative; display: flex; }
.drawing-surface svg { width: 100%; height: 100%; min-height: 340px; display: block; touch-action: none; user-select: none; }
.app[data-tool="pan"] .drawing-surface svg, .app.is-viewer .drawing-surface svg { cursor: grab; }
.app[data-tool="pan"].is-dragging .drawing-surface svg, .app.is-viewer.is-dragging .drawing-surface svg { cursor: grabbing; }
.scene[hidden] { display: none; }
.bar-shape { fill: none; stroke: #dc8e4f; stroke-width: 17; stroke-linecap: round; stroke-linejoin: round; }
.secondary-part .bar-shape { stroke: #5c9ec6; }
.part-shape { cursor: pointer; }
.part-shape.is-selected .bar-shape { stroke: #bb6427; }
.secondary-part.is-selected .bar-shape { stroke: #216c9b; }
.hole-shape { fill: #fff; stroke: #1a4266; stroke-width: 3; }
.blank-shape { fill: #efd2b3; stroke: #8a562f; stroke-width: 5; }
.canvas-watermark { fill: #a8bac9; font-size: 17px; font-weight: 800; letter-spacing: .13em; }
.canvas-bottom { min-height: 59px; display: flex; gap: 10px; align-items: center; justify-content: space-between; border-top: 1px solid var(--border); padding: 8px 12px; }
.canvas-bottom > span { font-size: 11px; line-height: 1.5; color: #60758b; }
.zoom-actions { display: flex; align-items: center; gap: 5px; }
.zoom-actions button { min-width: 34px; min-height: 36px; font-weight: 700; padding: 5px 9px; }
.zoom-actions output { font-size: 11px; min-width: 45px; text-align: center; }
#resetView { font-size: 11px; font-weight: 500; }
.property { border-bottom: 1px solid #e8eef3; padding: 14px 0; display: grid; gap: 6px; }
.property small { color: #718298; font-size: 11px; }
.property strong, .property span { font-size: 13px; }
.unverified { color: #a05c1e; }
footer { border-top: 1px solid #d4dee9; background: #f8fafd; color: #51677f; font-size: 11px; padding: 9px 17px; text-align: center; }
.is-viewer .editor-only, .is-viewer #projectPanel, .is-viewer #propertiesPanel, .is-viewer #toolbar, .is-viewer .new-tab, .is-viewer .tab-close { display: none !important; }
.is-viewer .workspace { grid-template-columns: minmax(0,1fr) !important; }
/* Tabletin vaakatilassa paneelit vievät oman tilansa, eivät peitä piirtoa tai työkaluja. */
@media (min-width: 761px) and (max-width: 1100px) {
  .workspace { --project-width: 170px; --properties-width: 190px; }
  .panel { padding: 13px 10px; }
}
@media (max-width: 760px) {
  .workspace, .workspace:not(.with-project), .workspace:not(.with-properties) { position: relative; display: block; }
  .workspace > .work-area { min-height: 560px; }
  .workspace .panel { position: absolute; z-index: 4; top: 0; bottom: 0; width: min(255px,75vw); overflow: auto; box-shadow: 0 4px 20px #253c5534; }
  .workspace .properties-panel { right: 0; }
  .workspace .project-panel { left: 0; }
}
@media (max-width: 670px) {
  .topbar { padding: 9px 12px; }
  .top-right { gap: 6px; }
  .brand-mark { width: 29px; height: 29px; font-size: 16px; }
  .brand strong { font-size: 13px; }
  .brand small { font-size: 10px; }
  .work-id, .menu-note { display: none; }
  .status { font-size: 9px; padding: 4px 7px; }
  .menubar { padding: 10px 12px; }
  .menu-labels { font-size: 11px; gap: 12px; }
  .layout-actions { padding: 7px; gap: 5px; }
  .layout-actions button { font-size: 11px; padding: 5px 8px; }
  .mode-link { margin-left: 0; }
  .workspace > .work-area { min-height: 470px; }
  .drawing-shell { padding: 6px; gap: 5px; min-height: 400px; }
  .toolbar { width: 47px; flex-basis: 47px; padding: 5px 2px; }
  .toolbar button { width: 39px; min-height: 41px; }
  .drawing-surface { min-height: 275px; }
  .drawing-surface svg { min-height: 275px; }
  .canvas-bottom { flex-wrap: wrap; }
}
