:root{
  --blue:#0a84ff;
  --green:#76b900;
  --ink:#202124;
  --muted:#777;
  --line:#e5e7eb;
  --soft:#f4f5f7;
  --danger:#ff3b30;
  --safe-top:env(safe-area-inset-top,0px);
  --safe-bottom:env(safe-area-inset-bottom,0px);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;
  color:var(--ink);
  background:#f4f5f7;
}
*{box-sizing:border-box}
html,body{margin:0;min-height:100%;background:#f4f5f7}
body{font-size:16px;-webkit-font-smoothing:antialiased}
button,input,textarea,select{font:inherit}
button,a{-webkit-tap-highlight-color:transparent}
a{color:inherit}
.icon{width:1.5rem;height:1.5rem;display:block;flex:none}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}

/* Login */
.login-body{min-height:100vh;display:grid;place-items:center;padding:24px;background:linear-gradient(165deg,#eef7df,#eef5ff 60%,#fff)}
.login-card{width:min(420px,100%);background:#fff;border-radius:24px;padding:28px;box-shadow:0 18px 60px rgba(0,0,0,.12)}
.brand-mark{width:64px;height:64px;border-radius:18px;background:var(--green);display:grid;place-items:center;color:#fff;margin-bottom:18px}
.brand-mark .icon{width:34px;height:34px}
.login-card h1{margin:0 0 4px;font-size:30px}.login-card p{color:var(--muted);margin:0 0 24px}
.form-field{display:flex;flex-direction:column;gap:7px;margin:14px 0;font-weight:600}
.form-field input,.form-field textarea,.form-field select{width:100%;border:1px solid #d7dce2;border-radius:13px;padding:13px 14px;background:#fff;outline:none}
.form-field input:focus,.form-field textarea:focus,.form-field select:focus{border-color:var(--blue);box-shadow:0 0 0 3px rgba(10,132,255,.12)}
.primary-button,.sheet-button{border:0;background:var(--blue);color:#fff;border-radius:13px;padding:13px 16px;font-weight:700;cursor:pointer}
.primary-button{width:100%;margin-top:10px}.test-login{display:block;color:#888;margin-top:14px;text-align:center}.alert{padding:12px 14px;border-radius:12px;background:#ffe8e7;color:#9b1c15;margin:12px 0}

/* App shell */
.app-shell{min-height:100vh;padding-bottom:calc(78px + var(--safe-bottom))}
.topbar{position:sticky;top:0;z-index:30;background:rgba(255,255,255,.96);backdrop-filter:blur(16px);padding-top:var(--safe-top);border-bottom:3px solid var(--green)}
.topbar-row{height:62px;display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;padding:0 12px;gap:8px}
.topbar-left,.topbar-actions{display:flex;align-items:center;min-width:0;gap:3px}
.topbar-title{font-size:22px;font-weight:700;color:#5f9800;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-left:5px}
.icon-button{appearance:none;border:0;background:transparent;color:var(--blue);width:44px;height:44px;border-radius:50%;display:grid;place-items:center;cursor:pointer;padding:0}
.icon-button:active{background:#eaf4ff}.icon-button .icon{width:29px;height:29px}
.back-label{display:none;color:var(--blue);font-size:18px}

.breadcrumb{height:40px;display:flex;align-items:center;gap:5px;padding:0 16px;background:#fff;border-bottom:1px solid var(--line);overflow-x:auto;white-space:nowrap;font-weight:700;color:#676767}
.breadcrumb a{text-decoration:none;color:#676767}.breadcrumb .separator{color:#aaa}

.search-panel{display:none;padding:8px 12px;background:#fff;border-bottom:1px solid var(--line)}
.search-panel.open{display:block}.search-input{width:100%;border:1px solid #d7dce2;border-radius:12px;padding:11px 14px;outline:none;background:#f7f8fa}

.content{width:min(1100px,100%);margin:0 auto;padding:12px 0 24px}
.page-title{display:flex;align-items:center;justify-content:space-between;padding:6px 16px 14px}.page-title h1{font-size:25px;margin:0}.page-title p{margin:4px 0 0;color:var(--muted)}
.desktop-actions{display:none;gap:8px}

.action-list{background:#fff;border-top:1px solid var(--line);border-bottom:1px solid var(--line);margin-bottom:12px}
.action-row{width:100%;min-height:72px;padding:0 16px;display:flex;align-items:center;gap:14px;border:0;border-bottom:1px solid var(--line);background:#fff;text-decoration:none;color:#6d6d6d;text-align:left;cursor:pointer}
.action-row:last-child{border-bottom:0}.action-row .icon{width:30px;height:30px}.action-row strong{font-weight:600;font-size:18px}.action-row.disabled{opacity:.42;cursor:default}

.folder-list{background:#fff;border-top:1px solid var(--line);border-bottom:1px solid var(--line)}
.folder-row{min-height:74px;padding:0 14px;display:grid;grid-template-columns:46px minmax(0,1fr) auto 24px;align-items:center;border-bottom:1px solid var(--line);text-decoration:none;background:#fff}
.folder-row:last-child{border-bottom:0}.folder-icon{color:#4fc3f7}.folder-icon .icon{width:38px;height:38px;fill:#4fc3f7;stroke:#4fc3f7}.folder-name{font-size:20px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.folder-count{color:#b4b4b4;font-size:14px;margin-right:4px}.folder-row>.icon:last-child{color:#bbb;width:22px;height:22px}

.empty-state{margin:28px 16px;background:#fff;border:1px dashed #cfd4da;border-radius:18px;padding:28px;text-align:center;color:#777}.empty-state .icon{width:54px;height:54px;margin:0 auto 12px;color:#98a1ab}.empty-state h2{color:#333;margin:0 0 6px}

.photo-section-title{padding:18px 16px 10px;margin:0;font-size:18px;color:#555}
.photo-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px;padding:0 4px}
.photo-tile{position:relative;aspect-ratio:1/1;display:block;overflow:hidden;background:#dce1e6;text-decoration:none}.photo-tile img{width:100%;height:100%;object-fit:cover;display:block}.photo-tile:active{opacity:.78}.photo-badge{position:absolute;left:5px;right:5px;bottom:5px;background:rgba(0,0,0,.55);color:#fff;border-radius:5px;padding:4px 5px;font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

.project-list{display:grid;gap:10px;padding:0 12px}
.project-card{background:#fff;border:1px solid #e1e5e9;border-radius:16px;padding:16px;text-decoration:none;display:grid;grid-template-columns:48px minmax(0,1fr) auto;align-items:center;gap:12px;box-shadow:0 3px 12px rgba(0,0,0,.04)}
.project-card .project-icon{width:48px;height:48px;border-radius:14px;background:#eef7df;color:#68a500;display:grid;place-items:center}.project-card .project-icon .icon{width:28px;height:28px}.project-card h2{font-size:18px;margin:0 0 3px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.project-card p{margin:0;color:#777;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.project-card small{display:block;color:#aaa;margin-top:5px}.project-card>.icon{color:#bbb}

/* Bottom navigation */
.bottom-nav{position:fixed;left:0;right:0;bottom:0;z-index:35;height:calc(72px + var(--safe-bottom));padding-bottom:var(--safe-bottom);background:rgba(255,255,255,.96);backdrop-filter:blur(18px);border-top:3px solid var(--green);display:grid;grid-template-columns:1fr 1fr 86px 1fr 1fr;align-items:start}
.nav-button{border:0;background:transparent;text-decoration:none;color:#888;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;font-size:11px;height:69px;padding:7px 2px 2px;cursor:pointer}.nav-button .icon{width:27px;height:27px}.nav-button.active{color:#333}.nav-button:active{background:#f1f4f7}
.camera-fab{width:72px;height:72px;border-radius:50%;border:1px solid #d4d7db;background:#fff;color:var(--blue);display:grid;place-items:center;align-self:end;justify-self:center;transform:translateY(-23px);box-shadow:0 5px 17px rgba(0,0,0,.28);cursor:pointer}.camera-fab .icon{width:35px;height:35px}.camera-fab:active{transform:translateY(-22px) scale(.97)}

/* Dialogs as mobile sheets */
dialog{border:0;padding:0;background:transparent;max-width:none;max-height:none}dialog::backdrop{background:rgba(0,0,0,.42);backdrop-filter:blur(2px)}
.sheet{position:fixed;left:0;right:0;bottom:0;width:100%;background:#fff;border-radius:22px 22px 0 0;padding:10px 18px calc(18px + var(--safe-bottom));box-shadow:0 -20px 50px rgba(0,0,0,.2)}
.sheet-handle{width:44px;height:5px;border-radius:999px;background:#d6d6d6;margin:0 auto 16px}.sheet h2{margin:0 0 14px;font-size:23px}.sheet-actions{display:flex;gap:10px;margin-top:18px}.sheet-actions button{flex:1}.secondary-button{border:0;background:#e9edf1;color:#333;border-radius:13px;padding:13px 16px;font-weight:700;cursor:pointer}.danger-button{border:0;background:var(--danger);color:#fff;border-radius:13px;padding:13px 16px;font-weight:700;cursor:pointer}
.action-sheet-list{display:grid;gap:8px}.action-sheet-item{text-decoration:none;border:0;background:#f4f6f8;border-radius:14px;padding:14px;display:flex;align-items:center;gap:12px;text-align:left;cursor:pointer;color:#222}.action-sheet-item .icon{color:var(--blue)}

.upload-overlay{position:fixed;inset:0;z-index:100;background:rgba(255,255,255,.92);display:none;place-items:center;text-align:center;padding:24px}.upload-overlay.active{display:grid}.spinner{width:48px;height:48px;border:5px solid #dcecff;border-top-color:var(--blue);border-radius:50%;animation:spin .8s linear infinite;margin:0 auto 14px}@keyframes spin{to{transform:rotate(360deg)}}

/* Editor */
.editor-body{margin:0;background:#000;overflow:hidden;touch-action:none}
.editor-shell{height:100dvh;display:grid;grid-template-rows:calc(72px + var(--safe-top)) minmax(0,1fr) calc(88px + var(--safe-bottom));background:#000}
.editor-top{padding-top:var(--safe-top);display:grid;grid-template-columns:70px 1fr 70px;align-items:center;background:#050505;color:#fff;z-index:10}
.editor-round{width:58px;height:58px;border-radius:50%;border:0;background:#dedede;color:#111;display:grid;place-items:center;justify-self:center;cursor:pointer}.editor-round .icon{width:30px;height:30px}.editor-title{text-align:center;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding:0 6px}
.canvas-stage{position:relative;min-height:0;overflow:hidden;display:grid;place-items:center;background:#000}.canvas-stage canvas{display:block;max-width:100%;max-height:100%;touch-action:none;box-shadow:0 0 0 1px rgba(255,255,255,.08)}
.editor-download{position:absolute;right:14px;top:14px;width:50px;height:50px;border-radius:50%;border:0;background:rgba(235,235,235,.9);color:#222;display:grid;place-items:center;cursor:pointer}.editor-download .icon{width:28px;height:28px}
.editor-toolbar{padding-bottom:var(--safe-bottom);background:#e9eaec;color:#111;display:flex;align-items:center;overflow-x:auto;overscroll-behavior-x:contain;scrollbar-width:none;border-top:1px solid #c9c9c9}.editor-toolbar::-webkit-scrollbar{display:none}
.tool-button{flex:0 0 68px;height:72px;border:0;background:transparent;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;font-size:10px;color:#222;cursor:pointer}.tool-button .icon{width:29px;height:29px}.tool-button.active{background:#080808;color:#fff}.tool-button.danger{color:#333}.tool-button:disabled{opacity:.35}
.color-dot{width:27px;height:27px;border-radius:50%;border:3px solid #fff;box-shadow:0 0 0 1px #777;background:#ff3b30}
.editor-help{position:absolute;left:50%;bottom:10px;transform:translateX(-50%);background:rgba(0,0,0,.7);color:#fff;border-radius:999px;padding:7px 12px;font-size:12px;pointer-events:none;transition:opacity .25s;white-space:nowrap}.editor-help.hidden{opacity:0}
.editor-sheet{position:fixed;left:0;right:0;bottom:0;width:100%;background:#fff;border-radius:22px 22px 0 0;padding:12px 18px calc(18px + var(--safe-bottom));box-shadow:0 -20px 50px rgba(0,0,0,.3)}
.editor-sheet h2{margin:0 0 14px}.measure-input,.text-input{width:100%;border:1px solid #d5d9de;border-radius:14px;padding:15px;font-size:20px;outline:none}.measure-input:focus,.text-input:focus{border-color:var(--blue)}
.color-presets{display:grid;grid-template-columns:repeat(6,1fr);gap:12px;margin:14px 0}.color-choice{aspect-ratio:1;border-radius:50%;border:3px solid #fff;box-shadow:0 0 0 1px #aaa;cursor:pointer}.color-choice.selected{box-shadow:0 0 0 3px #111}.width-slider{width:100%}
.toast{position:fixed;left:50%;bottom:calc(104px + var(--safe-bottom));transform:translateX(-50%) translateY(20px);background:rgba(20,20,20,.92);color:#fff;border-radius:999px;padding:10px 16px;opacity:0;pointer-events:none;transition:.2s;z-index:120;white-space:nowrap}.toast.show{opacity:1;transform:translateX(-50%) translateY(0)}

@media(min-width:700px){
  .topbar-row{padding:0 22px}.back-label{display:inline}.content{padding-top:20px}.page-title{padding-left:22px;padding-right:22px}.desktop-actions{display:flex}.photo-grid{grid-template-columns:repeat(5,minmax(0,1fr));gap:8px;padding:0 16px}.folder-list,.action-list{border:1px solid var(--line);border-radius:16px;overflow:hidden;margin-left:16px;margin-right:16px}.project-list{grid-template-columns:repeat(2,minmax(0,1fr));padding:0 20px}.bottom-nav{max-width:680px;left:50%;right:auto;width:680px;transform:translateX(-50%);border-left:1px solid #ddd;border-right:1px solid #ddd}.sheet,.editor-sheet{left:50%;right:auto;width:min(520px,92vw);transform:translateX(-50%);border-radius:22px;margin-bottom:20px}.editor-shell{grid-template-rows:72px minmax(0,1fr) 84px}.editor-top{padding-top:0}.editor-toolbar{justify-content:center;padding-bottom:0}.tool-button{height:82px}.login-card{padding:34px}}

/* Offline-Modus V2.3 */
[hidden]{display:none!important}
.offline-banner{display:none;margin:0 12px 10px;padding:11px 13px;border-radius:13px;background:#fff3cd;border:1px solid #f0d98b;color:#705500;align-items:flex-start;gap:8px;font-size:13px;line-height:1.35}
.offline-banner.show{display:flex}.offline-banner strong{flex:none}.offline-banner span{min-width:0}
.sync-status{appearance:none;width:calc(100% - 24px);margin:0 12px 12px;border:1px solid #d8dde3;border-radius:15px;background:#fff;min-height:62px;padding:10px 12px;display:grid;grid-template-columns:42px minmax(0,1fr) 24px;gap:10px;align-items:center;text-align:left;color:#222;box-shadow:0 2px 8px rgba(0,0,0,.035);cursor:pointer}
.sync-status-icon{width:40px;height:40px;border-radius:50%;display:grid;place-items:center;background:#edf1f5;color:#64707c}.sync-status-icon .icon{width:23px;height:23px}
.sync-status-copy{display:flex;flex-direction:column;gap:3px;min-width:0}.sync-status-copy strong{font-size:15px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.sync-status-copy small{font-size:12px;color:#7c838b;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.sync-chevron{color:#aab0b6}.sync-chevron .icon{width:20px;height:20px}
.sync-status.sync-offline{border-color:#e8cf78;background:#fffaf0}.sync-status.sync-offline .sync-status-icon{background:#ffe9a8;color:#745500}
.sync-status.sync-pending{border-color:#9ec9f7;background:#f7fbff}.sync-status.sync-pending .sync-status-icon{background:#dceeff;color:#0878e8}
.sync-status.sync-running{border-color:#9ec9f7;background:#f7fbff}.sync-status.sync-running .sync-status-icon{background:#dceeff;color:#0878e8}.sync-status.sync-running .sync-status-icon .icon{animation:spin 1s linear infinite}
.sync-status.sync-done{border-color:#b9d99a;background:#fbfff7}.sync-status.sync-done .sync-status-icon{background:#e7f6d8;color:#5b9700}
.sync-status.sync-error{border-color:#efb0aa;background:#fff7f6}.sync-status.sync-error .sync-status-icon{background:#ffe1de;color:#b3261e}
.local-photo{outline:2px solid rgba(10,132,255,.4);outline-offset:-2px}.local-photo-state{position:absolute;top:5px;left:5px;right:5px;background:rgba(10,132,255,.92);color:#fff;border-radius:6px;padding:4px 5px;font-size:10px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-align:center;z-index:2}.local-photo-state.state-error{background:rgba(210,42,34,.94)}.local-photo-state.state-syncing{background:rgba(92,151,0,.94)}.local-photo-state.state-editing{background:rgba(108,76,164,.94)}
.action-sheet-info{padding:8px 14px 2px;color:#7a8188;font-size:12px;text-align:center}
.offline-editor-label{position:absolute;left:12px;top:12px;background:#ffcc00;color:#2c2500;font-size:10px;font-weight:800;letter-spacing:.08em;border-radius:999px;padding:5px 8px;pointer-events:none}
@media(min-width:700px){.sync-status{width:calc(100% - 32px);margin-left:16px;margin-right:16px}.offline-banner{margin-left:16px;margin-right:16px}}
