:root {
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #1f2937;
  background: #eef2f7;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 980px;
  min-height: 100vh;
  background: #eef2f7;
}

button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }

.app-shell {
  display: grid;
  grid-template-rows: 58px 38px 86px minmax(0, 1fr) 28px;
  height: 100vh;
}

.titlebar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  padding: 0 18px;
  background: rgba(255,255,255,.96);
  border-bottom: 1px solid #dbe2ea;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: white;
  font-weight: 800;
  font-size: 13px;
  border-radius: 10px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
}
.brand strong, .brand span { display: block; }
.brand span { color: #7a8494; font-size: 12px; margin-top: 2px; }

.document-title { text-align: center; }
.document-title input {
  width: 260px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 5px 9px;
  text-align: center;
  font-weight: 650;
  background: transparent;
}
.document-title input:focus { outline: none; border-color: #a9bce8; background: white; }
.document-title span { display: block; color: #6b7280; font-size: 11px; margin-top: 2px; }

.title-actions { display: flex; justify-content: flex-end; gap: 8px; }
.title-actions button,
.ribbon button,
.canvas-toolbar button,
.panel-heading button {
  border: 1px solid #cfd7e3;
  border-radius: 7px;
  background: white;
  color: #253044;
  padding: 7px 10px;
}
.title-actions button:hover,
.ribbon button:hover,
.canvas-toolbar button:hover,
.panel-heading button:hover { background: #f4f7fb; }
#exportButton { background: #2563eb; border-color: #2563eb; color: white; }
#exportButton:hover { background: #1d4ed8; }

.ribbon-tabs {
  display: flex;
  align-items: end;
  padding: 0 16px;
  gap: 3px;
  background: #f7f9fc;
  border-bottom: 1px solid #dbe2ea;
}
.ribbon-tab {
  height: 38px;
  padding: 0 15px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: #4b5563;
}
.ribbon-tab.active { color: #1d4ed8; border-bottom-color: #2563eb; font-weight: 650; }

.ribbon {
  display: flex;
  align-items: stretch;
  gap: 10px;
  padding: 9px 16px;
  background: white;
  border-bottom: 1px solid #dbe2ea;
  box-shadow: 0 2px 8px rgba(36, 48, 68, .04);
}
.tool-group {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 14px 13px 0;
  border-right: 1px solid #e4e9f0;
}
.tool-group:last-child { border-right: 0; }
.tool-group-label {
  position: absolute;
  bottom: -2px;
  left: 0;
  color: #8a94a3;
  font-size: 10px;
}
.tool-group label { display: flex; align-items: center; gap: 5px; font-size: 13px; }

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr) 260px;
  background: #e9eef5;
}

.left-panel, .right-panel {
  min-height: 0;
  overflow: auto;
  background: #f9fbfd;
}
.left-panel { border-right: 1px solid #d9e0e9; padding: 12px; }
.right-panel { border-left: 1px solid #d9e0e9; }

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
}
.panel-heading h2, .inspector-section h2 {
  margin: 0;
  color: #596579;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.panel-heading button { width: 28px; height: 28px; padding: 0; }
.layers-heading { margin-top: 22px; }

.page-thumbnail {
  width: 100%;
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 8px;
  padding: 8px;
  text-align: left;
  border: 1px solid #cfd7e3;
  border-radius: 8px;
  background: white;
}
.page-thumbnail.active { border-color: #4f7fe5; box-shadow: 0 0 0 2px rgba(79,127,229,.15); }
.page-number { grid-row: span 2; color: #6b7280; font-size: 12px; }
.mini-page { height: 70px; border: 1px solid #d9e0e9; background: white; border-radius: 3px; }
.page-thumbnail > span:last-child { color: #4b5563; font-size: 12px; }

.layers-list { display: grid; gap: 6px; }
.layer-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 8px;
  border: 1px solid #d9e0e9;
  border-radius: 7px;
  background: white;
  font-size: 12px;
}
.layer-item.active { border-color: #7aa0ed; background: #eef4ff; }
.empty-state { color: #8a94a3; font-size: 12px; }

.canvas-area { position: relative; min-width: 0; min-height: 0; overflow: hidden; }
.canvas-toolbar {
  position: absolute;
  top: 14px;
  left: 50%;
  z-index: 5;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px;
  border: 1px solid #d2dae5;
  border-radius: 9px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 6px 18px rgba(40,52,73,.12);
}
.canvas-toolbar button { width: 30px; height: 28px; padding: 0; }
#zoomValue { min-width: 50px; text-align: center; font-size: 12px; }

.canvas-stage {
  width: 100%;
  height: 100%;
  overflow: auto;
  padding: 72px 60px 60px;
  display: grid;
  place-items: start center;
}
#canvas {
  width: min(100%, 1200px);
  min-width: 760px;
  aspect-ratio: 8 / 5;
  background: white;
  box-shadow: 0 18px 45px rgba(39,51,71,.18), 0 0 0 1px #ccd5e1;
  user-select: none;
  touch-action: none;
}
.canvas-object { cursor: move; }
.selection-box { fill: none; stroke: #2563eb; stroke-width: 2; stroke-dasharray: 7 5; pointer-events: none; }

.inspector-tabs { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid #d9e0e9; }
.inspector-tab {
  padding: 12px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: white;
  color: #667085;
}
.inspector-tab.active { color: #1d4ed8; border-bottom-color: #2563eb; font-weight: 650; }
.inspector-section { padding: 14px; border-bottom: 1px solid #e1e6ee; }
.inspector-section h2 { margin-bottom: 10px; }
#selectionName { margin: 0; font-size: 13px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.field-grid label, .full-field { display: grid; gap: 5px; color: #6b7280; font-size: 11px; }
.field-grid input { width: 100%; }
input[type="number"] {
  border: 1px solid #cfd7e3;
  border-radius: 6px;
  padding: 6px;
  background: white;
}
.full-field { margin-top: 10px; }
input[type="color"] { width: 100%; height: 32px; border: 1px solid #cfd7e3; border-radius: 6px; background: white; }

.statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  color: #647084;
  font-size: 11px;
  background: white;
  border-top: 1px solid #dbe2ea;
}

@media (max-width: 1120px) {
  .workspace { grid-template-columns: 190px minmax(0, 1fr) 230px; }
  .brand span { display: none; }
}
