/* GuideMarkr Card Maker v5 — UI styles.
   Calm, print-oriented, neutral-light. Navy + royal-blue accents. */

:root {
  --royal: #175EEC;
  --navy: #0A1B40;
  --ink: #0B0C0D;
  --paper: #FAF9F8;
  --bg: #eef0f4;
  --panel: #ffffff;
  --line: #e2e5ec;
  --line-strong: #d2d7e0;
  --text: #1b2330;
  --muted: #6b7280;
  --danger: #d13c4b;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .06);
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  display: flex; flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
.muted { color: var(--muted); }
.small { font-size: 12px; }
.is-hidden { display: none !important; }

/* -------------------------------------------------------------- topbar */
.topbar {
  display: flex; align-items: center; gap: 18px;
  height: 58px; padding: 0 16px;
  background: var(--panel); border-bottom: 1px solid var(--line);
  z-index: 20;
}
.brand-logo { height: 26px; display: block; }
.tools { display: flex; gap: 14px; align-items: center; }
.tool-group { display: flex; gap: 4px; padding-right: 14px; border-right: 1px solid var(--line); }
.tool-group:last-child { border-right: 0; }
.tool {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 42px; height: 42px; gap: 1px;
  border: 1px solid transparent; border-radius: 8px; background: transparent;
  color: var(--text); cursor: pointer; font-size: 11px; line-height: 1;
}
.tool .ico { font-size: 16px; }
.tool b { font-size: 15px; }
.tool span { font-size: 10px; color: var(--muted); }
.tool:hover { background: #f1f3f8; border-color: var(--line); }
.tool:active { background: #e8ecf5; }

.top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.doc-name { font-size: 13px; color: var(--muted); margin-right: 6px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.btn {
  border: 1px solid var(--line-strong); background: #fff; color: var(--text);
  padding: 8px 14px; border-radius: 8px; font-size: 13px; cursor: pointer; font-weight: 500;
}
.btn:hover { background: #f6f7fb; }
.btn--soft { background: #f4f6fa; border-color: var(--line); }
.btn--primary { background: var(--royal); border-color: var(--royal); color: #fff; }
.btn--primary:hover { background: #1250cf; }
.btn--danger { background: #fff; border-color: #f0c4c9; color: var(--danger); }
.btn--danger:hover { background: #fdf2f3; }

.export-wrap { position: relative; }
.export-menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 180px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow);
  padding: 6px; display: none; z-index: 40;
}
.export-menu.is-open { display: block; }
.export-menu button {
  display: block; width: 100%; text-align: left; border: 0; background: transparent;
  padding: 9px 10px; border-radius: 7px; font-size: 13px; cursor: pointer; color: var(--text);
}
.export-menu button:hover { background: #f1f3f8; }

/* ----------------------------------------------------------- workspace */
.workspace { flex: 1; display: grid; grid-template-columns: 232px 1fr 288px; min-height: 0; }

/* left sidebar */
.sidebar { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.side-tabs { display: flex; padding: 10px; gap: 6px; border-bottom: 1px solid var(--line); }
.side-tab {
  flex: 1; padding: 8px; border: 1px solid var(--line); background: #f6f7fb; color: var(--muted);
  border-radius: 8px; font-size: 12.5px; cursor: pointer; font-weight: 600;
}
.side-tab.is-on { background: var(--navy); color: #fff; border-color: var(--navy); }
.side-section { padding: 14px 12px; flex: 1; min-height: 0; overflow: auto; }
.side-title { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.side-foot { padding: 10px 12px; border-top: 1px solid var(--line); line-height: 1.5; }

.layers { display: flex; flex-direction: column; gap: 3px; }
.layer {
  display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 8px;
  cursor: pointer; border: 1px solid transparent;
}
.layer:hover { background: #f4f6fa; }
.layer.is-sel { background: #e8f0ff; border-color: #cfe0ff; }
.layer-kind { width: 20px; height: 20px; border-radius: 5px; background: #eef1f7; display: grid; place-items: center; font-size: 12px; color: var(--navy); }
.layer-name { flex: 1; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer-eye { border: 0; background: transparent; cursor: pointer; color: var(--muted); font-size: 11px; }

/* center stage */
.stage-wrap { position: relative; min-width: 0; background:
  repeating-conic-gradient(#e9ebf1 0% 25%, #eef0f4 0% 50%) 50% / 22px 22px; }
.stage { position: absolute; inset: 0; overflow: auto; padding: 40px; display: block; }
.stage.is-dropping { outline: 3px dashed var(--royal); outline-offset: -12px; }
.card-holder { margin: auto; display: block; }
.card { position: relative; box-shadow: 0 10px 40px rgba(16,24,40,.18); }

/* elements */
.el { position: absolute; }
.el--text, .el--shape, .el--image { user-select: none; }
.el.is-locked { outline: 1px dashed rgba(10,27,64,.25); }
.el-text { width: 100%; height: 100%; overflow: hidden; white-space: pre-wrap; word-break: break-word; }
.el-text.is-editing { outline: 2px solid var(--royal); background: rgba(255,255,255,.5); cursor: text; }
.img-frame { position: relative; }
.img-el { display: block; }

/* guides + selection layers sit above elements */
.guides, .sel-layer { position: absolute; inset: 0; pointer-events: none; }
.sel-layer { z-index: 5; }

.selbox { position: absolute; border: 1.5px solid rgba(23,94,236,.5); transform-origin: center; }
.selbox--primary { border-color: var(--royal); }
.handle {
  position: absolute; width: 12px; height: 12px; background: #fff; border: 1.5px solid var(--royal);
  border-radius: 3px; pointer-events: all; z-index: 6;
}
.handle--nw { left: -6px; top: -6px; cursor: nwse-resize; }
.handle--n  { left: calc(50% - 6px); top: -6px; cursor: ns-resize; }
.handle--ne { right: -6px; top: -6px; cursor: nesw-resize; }
.handle--e  { right: -6px; top: calc(50% - 6px); cursor: ew-resize; }
.handle--se { right: -6px; bottom: -6px; cursor: nwse-resize; }
.handle--s  { left: calc(50% - 6px); bottom: -6px; cursor: ns-resize; }
.handle--sw { left: -6px; bottom: -6px; cursor: nesw-resize; }
.handle--w  { left: -6px; top: calc(50% - 6px); cursor: ew-resize; }
.handle--rot {
  left: calc(50% - 7px); top: -30px; width: 14px; height: 14px; border-radius: 50%;
  cursor: grab; background: var(--royal); border-color: #fff;
}

/* context menu */
.ctx-menu {
  position: fixed; background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); padding: 6px; z-index: 100; min-width: 170px;
}
.ctx-item { padding: 8px 10px; border-radius: 7px; font-size: 13px; cursor: pointer; }
.ctx-item:hover { background: #f1f3f8; }
.ctx-sep { height: 1px; background: var(--line); margin: 5px 4px; }

/* zoom strip */
.zoomstrip {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 16px;
  display: flex; align-items: center; gap: 10px; padding: 7px 12px;
  background: #fff; border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow); z-index: 8;
}
.mini { border: 1px solid var(--line); background: #f6f7fb; border-radius: 999px; padding: 4px 12px; font-size: 12px; cursor: pointer; }
.zoom-val { font-size: 12px; color: var(--muted); width: 40px; text-align: right; }
#zoom-range { width: 150px; }

/* --------------------------------------------------------- inspector */
.inspector { background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; padding: 4px 0 40px; }
.prop-section { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.prop-title { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--navy); font-weight: 700; margin-bottom: 12px; }
.prop-subtitle { font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin: 14px 0 8px; }
.prop-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.prop-label { font-size: 12.5px; color: var(--muted); flex-shrink: 0; }
.prop-input {
  flex: 1; min-width: 0; max-width: 150px; border: 1px solid var(--line-strong); border-radius: 7px;
  padding: 6px 8px; font-size: 13px; background: #fff; color: var(--text);
}
.prop-input:focus { outline: 2px solid rgba(23,94,236,.35); border-color: var(--royal); }
.prop-textarea { width: 100%; border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px; font-size: 13px; resize: vertical; margin-bottom: 10px; font-family: inherit; }
.prop-range { flex: 1; max-width: 150px; }
.prop-color { width: 40px; height: 30px; border: 1px solid var(--line-strong); border-radius: 7px; background: #fff; padding: 2px; cursor: pointer; }
.prop-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.prop-mini { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--muted); }
.prop-mini .prop-input, .prop-mini select { max-width: none; width: 100%; }
.prop-mini .prop-range { max-width: none; width: 100%; }
.prop-hint { font-size: 11.5px; color: var(--muted); line-height: 1.5; margin-top: 6px; }
.prop-toggle { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 9px; cursor: pointer; }
.prop-flags { display: flex; gap: 16px; margin-top: 4px; }
.prop-wide { width: 100%; margin-bottom: 10px; }

.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 7px; overflow: hidden; }
.seg-btn { border: 0; background: #fff; padding: 6px 11px; font-size: 12px; cursor: pointer; color: var(--muted); border-right: 1px solid var(--line); }
.seg-btn:last-child { border-right: 0; }
.seg-btn.is-on { background: var(--navy); color: #fff; }

/* ------------------------------------------------------- start screen */
.start { position: fixed; inset: 0; background: rgba(238,240,244,.86); backdrop-filter: blur(4px); z-index: 200; overflow: auto; display: grid; place-items: start center; padding: 48px 20px; }
.start-inner { width: min(880px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 24px 70px rgba(16,24,40,.18); padding: 34px; }
.start-head { text-align: center; margin-bottom: 26px; }
.start-logo { height: 42px; }
.start-tag { color: var(--muted); font-size: 14px; max-width: 520px; margin: 14px auto 0; line-height: 1.5; }
.start-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 26px; }
.start-btn { padding: 18px 12px; border: 1px solid var(--line-strong); border-radius: 12px; background: #f7f8fc; font-size: 13.5px; font-weight: 600; cursor: pointer; color: var(--text); }
.start-btn:hover { background: #eef1f8; }
.start-btn--primary { background: var(--royal); border-color: var(--royal); color: #fff; }
.start-btn--primary:hover { background: #1250cf; }
.start-col2 { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; margin-bottom: 24px; }
.start-sect-title { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.start-quick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.quick-card { padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; font-size: 13px; cursor: pointer; text-align: left; }
.quick-card:hover { border-color: var(--royal); color: var(--royal); }
.start-tpls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tpl-card { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--line); border-radius: 9px; background: #fff; cursor: pointer; text-align: left; }
.tpl-card:hover { border-color: var(--royal); }
.tpl-swatch { width: 34px; height: 46px; border-radius: 4px; background: var(--thumb, #e6e9ef); flex-shrink: 0; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); }
.tpl-name { font-size: 12.5px; }
.start-recent-wrap { border-top: 1px solid var(--line); padding-top: 20px; }
.start-recent { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.recent-item { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; cursor: pointer; }
.recent-item:hover { border-color: var(--royal); }
.recent-name { font-size: 13px; font-weight: 600; }
.recent-path { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* toast */
#gm-toast { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 8px; z-index: 300; }
.toast { background: var(--navy); color: #fff; padding: 11px 16px; border-radius: 9px; font-size: 13px; box-shadow: var(--shadow); opacity: 0; transform: translateY(8px); transition: .22s; }
.toast.is-in { opacity: 1; transform: none; }
.toast--warn { background: #b4791b; }
.toast--error { background: var(--danger); }

/* scrollbars */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: #c7cdd8; border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #aeb6c4; background-clip: content-box; }

/* ---- web gate: account/upgrade modal ---- */
.gm-modal{position:fixed;inset:0;background:rgba(10,27,64,.45);display:flex;align-items:center;justify-content:center;z-index:9999}
.gm-modal[hidden]{display:none}
.gm-modal-card{background:#fff;border-radius:14px;padding:26px 28px;max-width:380px;width:92%;box-shadow:0 24px 60px rgba(10,27,64,.28);position:relative}
.gm-modal-card h2{margin:.1rem 0 .6rem;font-size:1.25rem;color:#0A1B40}
.gm-modal-x{position:absolute;top:10px;right:12px;border:0;background:none;font-size:1.5rem;line-height:1;cursor:pointer;color:#8a93a6}
.gm-muted{color:#6b7385;font-size:.86rem;margin:.4rem 0}
.gm-input{width:100%;padding:.6rem .7rem;border:1px solid #d6dae3;border-radius:9px;margin:.5rem 0;font-size:.95rem}
.gm-btn{display:inline-block;width:100%;padding:.62rem 1rem;border-radius:9px;border:1px solid transparent;font-weight:600;cursor:pointer;margin-top:.4rem;font-size:.95rem}
.gm-btn--primary{background:#175EEC;color:#fff}
.gm-btn--soft{background:#eef1f7;color:#0A1B40}
.gm-list{margin:.4rem 0 .8rem;padding-left:1.1rem;color:#2b3550;font-size:.9rem;line-height:1.7}
.gm-buy{display:flex;flex-direction:column;gap:.1rem}
