:root {
  --ink: #1d2433;
  --accent: #ff5a36;
  --accent-2: #ffd23f;
  --bg: #f6f3ee;
  --panel: #ffffff;
  --panel-2: #f9f7f4;
  --line: #e7e2da;
  --text: #1d2433;
  --muted: #6b7280;
  --danger: #dc2626;
  --ok: #059669;
  --shadow: 0 1px 2px rgba(29, 36, 51, .06), 0 8px 24px rgba(29, 36, 51, .08);
  --radius: 12px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
html.dark {
  --bg: #0f131b;
  --panel: #171c27;
  --panel-2: #1d2330;
  --line: #2a3242;
  --text: #e6e8ee;
  --muted: #9aa3b2;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---------- Buttons & fields ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel); padding: 8px 14px; border-radius: 10px; cursor: pointer; font-weight: 550; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { background: var(--panel-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
html.dark .btn.primary { background: var(--accent); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.15); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--panel-2); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { border: 0; background: transparent; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; display: inline-grid; place-items: center; color: var(--text); font-size: 16px; }
.icon-btn:hover { background: var(--panel-2); }
.icon-btn.on { background: var(--ink); color: #fff; }
html.dark .icon-btn.on { background: var(--accent); }
.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=search], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 90, 54, .15); }
textarea { resize: vertical; min-height: 90px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); }
.tag.live { color: var(--ok); border-color: rgba(5, 150, 105, .3); }
.tag.live::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }

/* ---------- Toast ---------- */
#cc-toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 1000; pointer-events: none; }
.cc-toast { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); font-weight: 500; transition: opacity .3s, transform .3s; }
.cc-toast.error { background: var(--danger); }
.cc-toast.ok { background: var(--ok); }
.cc-toast.out { opacity: 0; transform: translateY(8px); }

/* ---------- Modal ---------- */
.cc-modal-back { position: fixed; inset: 0; background: rgba(15, 19, 27, .45); display: grid; place-items: center; z-index: 900; padding: 16px; animation: fade .15s; }
.cc-modal { background: var(--panel); border-radius: 16px; box-shadow: var(--shadow); width: min(440px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; border: 1px solid var(--line); }
.cc-modal.wide { width: min(780px, 100%); }
.cc-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 8px; }
.cc-modal-head h3 { font-size: 17px; }
.cc-modal-body { padding: 8px 18px 12px; overflow: auto; }
.cc-modal-body p { margin: 0 0 10px; }
.cc-modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px 16px; border-top: 1px solid var(--line); }
@keyframes fade { from { opacity: 0; } }

/* ---------- Login ---------- */
.auth-wrap { min-height: 100%; display: grid; place-items: center; padding: 24px; background:
  radial-gradient(circle at 15% 20%, rgba(255, 90, 54, .10), transparent 40%),
  radial-gradient(circle at 85% 80%, rgba(255, 210, 63, .14), transparent 40%), var(--bg); }
.auth-card { width: min(400px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 28px; box-shadow: var(--shadow); }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.auth-brand b { font-size: 20px; letter-spacing: -.02em; }
.auth-card h1 { font-size: 22px; margin-bottom: 4px; }
.auth-card .btn { width: 100%; justify-content: center; padding: 11px; }
.auth-err { color: var(--danger); font-size: 13px; min-height: 18px; margin-bottom: 8px; }

/* ---------- App shell (dashboard) ---------- */
.topbar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 12px; padding: 10px 20px; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 750; font-size: 17px; letter-spacing: -.02em; }
.brand small { font-weight: 500; color: var(--muted); font-size: 12px; }
.tabs { display: flex; gap: 4px; margin-left: 12px; }
.tabs button { border: 0; background: transparent; padding: 7px 12px; border-radius: 8px; cursor: pointer; color: var(--muted); font-weight: 600; }
.tabs button.on { background: var(--panel); color: var(--text); box-shadow: 0 0 0 1px var(--line); }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-weight: 700; font-size: 12px; flex: none; border: 2px solid var(--panel); }
.menu { position: relative; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); min-width: 200px; padding: 6px; z-index: 100; }
.menu-pop button, .menu-pop a { display: flex; width: 100%; text-align: left; border: 0; background: transparent; padding: 8px 10px; border-radius: 8px; cursor: pointer; text-decoration: none; gap: 8px; align-items: center; }
.menu-pop button:hover, .menu-pop a:hover { background: var(--panel-2); }
.menu-pop hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.menu-pop .head { padding: 8px 10px; font-size: 12px; color: var(--muted); }

.page { max-width: 1180px; margin: 0 auto; padding: 24px 20px 60px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; }
.page-head input[type=search] { width: 260px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: box-shadow .15s, transform .15s; position: relative; }
.card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.card .thumb { height: 120px; background: var(--panel-2); display: grid; place-items: center; text-decoration: none; border-bottom: 1px solid var(--line); overflow: hidden; }
.card .thumb svg { width: 100%; height: 100%; }
.card .info { padding: 12px 14px; display: grid; gap: 4px; }
.card .title { font-weight: 650; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .meta { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.card .more { position: absolute; top: 8px; right: 8px; background: var(--panel); box-shadow: var(--shadow); opacity: 0; transition: opacity .15s; }
.card:hover .more, .card .more:focus { opacity: 1; }
.new-card { border: 2px dashed var(--line); background: transparent; display: grid; place-items: center; min-height: 190px; cursor: pointer; border-radius: var(--radius); color: var(--muted); font-weight: 650; gap: 6px; }
.new-card:hover { border-color: var(--accent); color: var(--accent); }
.new-card .plus { font-size: 30px; line-height: 1; }
.empty { text-align: center; color: var(--muted); padding: 50px 0; }

.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 10px; }
.tpl { border: 1px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; background: var(--panel); text-align: left; display: grid; gap: 4px; }
.tpl:hover { border-color: var(--accent); }
.tpl.on { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 90, 54, .15); }
.tpl b { font-size: 14px; }
.tpl span { font-size: 12px; color: var(--muted); }
.seg { display: inline-flex; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; margin-bottom: 14px; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; cursor: pointer; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.theme-dots { display: flex; gap: 8px; flex-wrap: wrap; }
.theme-dot { width: 64px; border: 2px solid var(--line); border-radius: 10px; padding: 6px; cursor: pointer; background: none; display: grid; gap: 4px; justify-items: center; font-size: 11px; }
.theme-dot.on { border-color: var(--accent); }
.theme-dot i { display: flex; gap: 2px; }
.theme-dot i b { width: 10px; height: 10px; border-radius: 50%; display: block; }

table.list { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.list th, table.list td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); }
table.list th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--panel-2); }
table.list tr:last-child td { border-bottom: 0; }

/* ---------- Editor ---------- */
body.editor { overflow: hidden; overscroll-behavior: none; }
#stage { position: fixed; inset: 0; touch-action: none; user-select: none; -webkit-user-select: none; }
#stage.mode-pan, #stage.panning { cursor: grab; }
#stage.panning { cursor: grabbing; }
#stage.mode-pen { cursor: crosshair; }
#stage.mode-eraser { cursor: cell; }
#canvas { width: 100%; height: 100%; display: block; }
.ed-top { position: fixed; top: 12px; left: 12px; right: 12px; display: flex; align-items: center; gap: 8px; pointer-events: none; z-index: 20; }
.ed-top > * { pointer-events: auto; }
.pill { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 2px; padding: 4px; }
.pill .sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.title-input { border: 0 !important; background: transparent !important; box-shadow: none !important; font-weight: 650; font-size: 15px; padding: 6px 8px !important; width: 260px; max-width: 34vw; border-radius: 8px !important; }
.title-input:hover { background: var(--panel-2) !important; }
.title-input:focus { background: var(--panel-2) !important; }
.conn { font-size: 12px; padding: 0 8px; color: var(--muted); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.conn::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #9ca3af; }
.conn.on::before { background: var(--ok); }
.conn.off::before { background: var(--danger); }
.peers { display: flex; padding-left: 6px; }
.peers .avatar { margin-left: -8px; width: 30px; height: 30px; }
.ed-tools { position: fixed; left: 12px; top: 50%; transform: translateY(-50%); flex-direction: column; z-index: 20; }
.ed-tools .icon-btn { width: 38px; height: 38px; font-size: 17px; }
.ed-tools .sep { width: 22px; height: 1px; margin: 4px auto; }
.pen-pop { position: fixed; left: 64px; top: 50%; transform: translateY(-50%); z-index: 21; padding: 10px; flex-direction: column; align-items: stretch; gap: 8px; }
.swatches { display: grid; grid-template-columns: repeat(4, 22px); gap: 6px; }
.swatch { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--panel); box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.swatch.on { box-shadow: 0 0 0 2px var(--accent); }
.widths { display: flex; gap: 4px; justify-content: space-between; }
.widths button { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; display: grid; place-items: center; }
.widths button.on { border-color: var(--accent); }
.widths button i { display: block; background: currentColor; border-radius: 99px; width: 16px; }
.ed-zoom { position: fixed; right: 12px; bottom: 12px; z-index: 20; }
.ed-zoom .z { font-size: 12px; min-width: 46px; text-align: center; font-variant-numeric: tabular-nums; cursor: pointer; border: 0; background: none; padding: 6px 0; border-radius: 8px; }
.ed-zoom .z:hover { background: var(--panel-2); }
.ed-hint { position: fixed; left: 12px; bottom: 12px; z-index: 20; font-size: 12px; color: var(--muted); padding: 6px 12px; }
.node-bar { position: fixed; z-index: 25; transform: translate(-50%, -100%); padding: 3px; }
.node-bar .icon-btn { width: 30px; height: 30px; font-size: 14px; }
.color-pop { position: fixed; z-index: 26; padding: 8px; display: grid; grid-template-columns: repeat(7, 22px); gap: 6px; }
.color-pop .reset { grid-column: 1 / -1; font-size: 12px; }
#editor-input { position: fixed; z-index: 30; border: 2px solid var(--accent); border-radius: 8px; padding: 4px 8px; resize: none; overflow: hidden; outline: none; background: #fff; color: #111; font-family: var(--font); line-height: 1.3; min-height: 0; box-shadow: 0 6px 20px rgba(0, 0, 0, .15); white-space: pre-wrap; word-break: break-word; }
.side-panel { position: fixed; top: 64px; right: 12px; bottom: 64px; width: 320px; z-index: 22; flex-direction: column; align-items: stretch; padding: 0; overflow: hidden; }
.side-panel .sp-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.side-panel .sp-body { overflow: auto; padding: 8px; flex: 1; }
.ver { padding: 9px 10px; border-radius: 10px; cursor: pointer; display: grid; gap: 2px; border: 1px solid transparent; }
.ver:hover { background: var(--panel-2); }
.ver.on { border-color: var(--accent); background: var(--panel-2); }
.ver b { font-size: 13px; }
.ver small { color: var(--muted); font-size: 12px; }
.preview-bar { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 23; padding: 6px 6px 6px 14px; gap: 8px; }
.ro-badge { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--accent-2); color: #3b2f00; }
.share-link { display: flex; gap: 6px; }
.share-link input { font-family: ui-monospace, monospace; font-size: 12px; }
.kbd-list { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13px; }
kbd { font-family: ui-monospace, monospace; font-size: 12px; background: var(--panel-2); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px; white-space: nowrap; }
.loading { position: fixed; inset: 0; display: grid; place-items: center; color: var(--muted); z-index: 5; }

.cmt-form { border-top: 1px solid var(--line); padding: 10px 12px; }
.cmt-form textarea { min-height: 54px; font-family: inherit; font-size: 13px; }
.cmt { padding: 9px 10px; border-radius: 10px; display: grid; gap: 3px; }
.cmt:hover { background: var(--panel-2); }
.cmt.res { opacity: .55; }
.cmt .who { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.cmt .who i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.cmt .who b { font-size: 12.5px; }
.cmt .txt { white-space: pre-wrap; word-break: break-word; font-size: 13.5px; }
.cmt .on-node { font-size: 11.5px; color: var(--muted); cursor: pointer; text-decoration: underline dotted; }
.cmt .acts { display: flex; gap: 2px; justify-content: flex-end; opacity: 0; transition: opacity .15s; }
.cmt:hover .acts { opacity: 1; }
.cmt .acts button { border: 0; background: none; cursor: pointer; font-size: 12px; color: var(--muted); padding: 2px 6px; border-radius: 6px; }
.cmt .acts button:hover { background: var(--line); color: var(--text); }
.drop-hl { outline: 3px dashed #ff5a36; outline-offset: -6px; }
.key-box { font-family: ui-monospace, monospace; font-size: 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px; word-break: break-all; white-space: pre-wrap; position: relative; }
.key-box .btn { position: absolute; top: 6px; right: 6px; }

@media (max-width: 720px) {
  .title-input { width: 120px; }
  .ed-top { flex-wrap: wrap; left: 8px; right: 8px; top: 8px; gap: 6px; }
  .ed-top .spacer { display: none; }
  #actions { margin-left: auto; }
  .conn { font-size: 0; gap: 0; padding: 0 6px; }
  .peers .avatar:nth-child(n+4) { display: none; }
  .pill .icon-btn { width: 30px; height: 30px; }
  .ed-tools { top: auto; bottom: 12px; left: 8px; transform: none; flex-direction: row; }
  .ed-tools .sep { width: 1px; height: 22px; margin: 0 4px; }
  .pen-pop { left: 8px; top: auto; bottom: 66px; transform: none; }
  .ed-zoom { right: 8px; bottom: 12px; }
  .ed-zoom .z { display: none; }
  .ed-hint, .hide-sm { display: none !important; }
  .tabs { margin-left: 0; }
  .page-head input[type=search] { width: 100%; }
  .side-panel { left: 12px; width: auto; }
}

/* ---------- Login v1.3 ---------- */
.google-btn { width: 100%; justify-content: center; gap: 10px; padding: 11px; background: var(--panel); text-decoration: none; margin: 4px 0 6px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 12px 0; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.auth-switch { text-align: center; font-size: 13.5px; margin: 14px 0 0; color: var(--muted); }
.auth-switch a { color: var(--accent); font-weight: 600; }
.invite-box { background: rgba(255, 90, 54, .08); border: 1px solid rgba(255, 90, 54, .3); border-radius: 12px; padding: 10px 12px; margin-bottom: 14px; font-size: 13.5px; }
.upgrade-note { background: rgba(255, 210, 63, .14); border: 1px solid rgba(217, 160, 0, .35); border-radius: 12px; padding: 10px 12px; font-size: 13px; }
.plan-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--ink); color: #fff; text-transform: uppercase; letter-spacing: .04em; }
.plan-chip.free { background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.plan-chip.pro, .plan-chip.business { background: var(--accent); }
.usage-bar { height: 6px; background: var(--panel-2); border-radius: 99px; overflow: hidden; border: 1px solid var(--line); }
.usage-bar i { display: block; height: 100%; background: var(--accent); }
.tab-link { padding: 7px 12px; border-radius: 8px; color: var(--accent); font-weight: 650; text-decoration: none; font-size: 14px; }
.tab-link:hover { background: var(--panel); }
.card.pad { padding: 16px 18px; display: block; }
.card.pad:hover { transform: none; }
.team-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
#plan-chip { cursor: pointer; }
/* ---------- Pembayaran ---------- */
.pay { display: grid; grid-template-columns: 260px 1fr; gap: 20px; align-items: start; }
.pay-qr { background: #fff; border: 2px solid var(--ink); border-radius: 16px; padding: 10px; display: grid; place-items: center; min-height: 240px; }
.pay-qr img { width: 100%; height: auto; display: block; }
.pay-amount { font-size: 30px; font-weight: 850; letter-spacing: -.02em; display: flex; align-items: center; gap: 10px; margin: 4px 0; }
.pay-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 0 0 rgba(255, 210, 63, .7); animation: pulse 1.6s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(255, 210, 63, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 210, 63, 0); } }
@media (max-width: 640px) { .pay { grid-template-columns: 1fr; } .pay-qr { max-width: 280px; margin: 0 auto; } }
@media (prefers-reduced-motion: reduce) { .pay-dot { animation: none; } }
.st { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line); }
.st.paid { color: var(--ok); border-color: rgba(5, 150, 105, .35); }
.st.pending { color: #b45309; border-color: rgba(217, 119, 6, .35); }
.st.expired, .st.cancelled, .st.failed { color: var(--muted); }
.auth-forgot { text-align: right; margin: -4px 0 0; font-size: 13px; }
.auth-err.ok { color: var(--ok); }
.mail-ill { font-size: 44px; text-align: center; margin: 4px 0 8px; }
