body {
    background: #EEE;
    color: #222;

    --hilight-color: #83b6d6;
    --color-false: #b31515;
    --color-true: #10801a;
}

:root {
    --ps-ink: #1f1f1f;
    --ps-muted: #555;
    --ps-dark: #222;
    --ps-line: #cfcfcf;
    --ps-line-soft: #e2e2e2;
    --ps-tile: #f6f6f6;
    --ps-bar: #bdbdbd;
    --ps-danger: #a3302a;
    --ps-ok: #4a6b3a;
    --ps-warn: #8a5a00;
    --ps-radius: 6px;
}

html, body { padding: 0; margin: 0; height: 100%; font-family: sans-serif; }
a { text-decoration: none; color:inherit; }
h1 { padding: 0; margin: 0 0 20px 0; font-size: 20px;  }

button, .btn {
    padding:4px 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    user-select: none; cursor: pointer;
    display: inline-flex;
    align-items: center;
    background: #EEE; font-weight: bold;
    font-size: 14px; box-shadow: 1px 1px 5px rgba(0,0,0,0.05);
    gap:10px;
    line-height: 23px;
}
button.subtle, .btn.subtle {
    align-self: flex-start;
    border: 1px dashed #b5b5b5;
    background: #fff;
    color: #333;
}
button > *, .btn > * { vertical-align: middle; display: inline-block; }
button.saved .icon {
    background-image:url('/assets/images/cloud_saved.svg') !important;
}
button.loading .icon {
    background-image:url('/assets/images/spinner.svg') !important;
    animation: spin 0.75s linear infinite;
    transform-origin: center center;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

.icon { display: inline-block; cursor: pointer; width: 24px; height: 24px; background-position: center center; background-size: contain; background-repeat: no-repeat; }
.icon.gear { background-image:url('/assets/images/gear.svg'); }
.icon.plus { background-image:url('/assets/images/plus.svg'); }
.icon.search { background-image:url('/assets/images/search.svg'); }
.icon.arrowup { background-image:url('/assets/images/up.svg'); }
.icon.arrowdown { background-image:url('/assets/images/down.svg'); }
.icon.update { background-image:url('/assets/images/update.svg'); }
.icon.cancel { background-image:url('/assets/images/cancel.svg'); }
.icon.delete { background-image:url('/assets/images/delete.svg'); }
.icon.cloud_save { background-image:url('/assets/images/cloud_save.svg'); }
.icon.cloud_saved { background-image:url('/assets/images/cloud_saved.svg'); }
.icon.spinner { background-image:url('/assets/images/spinner.svg'); animation: spin 0.75s linear infinite; transform-origin: center center; }
.icon.copy { background-image:url('/assets/images/copy.svg'); }

.hidden { display: none !important; }
.empty { opacity: 0.6; font-style: italic; font-size: 90%; }

input, textarea { display: block; width: 100%; resize:none; padding: 8px; box-sizing: border-box; border:1px solid #EEE; border-radius: 4px; }
textarea { min-height:100px; }


header { display: block; padding: 12px 20px; color: #222; border-bottom: 1px solid #BBB; background: #FFF; }
header .logo { display: flex; gap: 10px; font-size: 16px; font-weight: bold; color: #666; align-items: center; }
header .logo svg { width: 24px; height: 24px; vertical-align: top; }

.main { display: flex; width: 100%; min-height: 100%; align-items: stretch; }
.main > div:first-child { width: 200px; padding: 20px; border-right: 1px solid #BBB; background: #FFF; }
.main > div:last-child { flex:1; padding: 20px; }
.main .menu a { box-sizing: border-box; display: flex; align-items: center; gap:8px; width: 100%; margin-bottom: 10px; font-size: 15px; }
.main .menu > a > *:first-child { width:24px; }
.main .menu a img { width: 100%; vertical-align: top; }
.main .menu .title { margin-top: 20px; font-weight: bold; }
.main .menu .title:first-child { margin-top: 0; }
.main .menu .sub { padding: 8px; background: #EEE; border-radius: 10px; box-sizing: border-box; }
.menu .submenu, .menu .submenuitems { padding-left:20px; margin-bottom: 20px; }
.menu .submenuitems { border-left: 1px solid #EEE; margin-left: 10px; }
.menu .submenuitems > a { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding:8px; margin-bottom: 5px; font-size: 14px; opacity: 0.9; }
.menu .submenuitems > a > span:last-child { opacity: 0.7; font-size: 12px; }
.menu .submenuitems > a.selected { opacity: 1; border-radius: 6px;
    background: rgb(238, 237, 251);
    color: rgb(59, 48, 184);
    font-weight: 600; }
.menu .submenu > a {
    display: flex; align-items: center; gap: 10px; padding:10px; border-radius: 8px; text-decoration: none; justify-content: space-between;
}
.menu .submenu > a > span:nth-child(2) { flex:1; }
.menu .submenu > a > span:last-child { opacity: 0.7; font-size: 12px; }
.menu .submenu > a.selected {  background: rgb(238, 237, 251); color: rgb(59, 48, 184); }

.pageheader { display: flex; width: 100%; align-items: center; padding: 0 0 20px 0; }
.pageheader > * { flex: 1; }
.pageheader > *:last-child { text-align: right; display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.pageheader button, .pageheader .btn { background: #FFF; }

.breadcrumb { list-style: none; padding: 0; margin: 0; }
.breadcrumb li { margin-right: 5px; display: inline-block; }
.breadcrumb li:after { content:'>'; padding-left: 10px; font-size: 70%; margin-right: 5px; display: inline-block; }
.breadcrumb li:last-child:after { display: none; }

.projectsdiv {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 30px;
}

.projectsdiv > * {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    border: 2px solid transparent;
    background: #FFF;
    box-shadow: 0px 0px 10px rgba(0,0,0,0.2);
    position: relative;
    text-align: center;
    max-width: 200px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}
.projectsdiv .title { display: block; position: absolute; padding: 15px; text-align: center; left: 0; right: 0; bottom: 0; font-size: 14px; }
.projectsdiv .amount { position: absolute; right:15px; bottom: 15px; padding:3px 5px; font-size: 12px; color: #FFF; font-weight: bold; background: blue; border-radius: 2px; min-width: 16px; text-align: center; }
.projectsdiv .icon { position: absolute; left:15px; bottom: 15px; z-index: 5; }
.projectsdiv .img { position:absolute; top: 20px; left: 20px; right: 20px; bottom: 55px; background-position: center center; background-size: contain; background-repeat: no-repeat; }
.projectsdiv > .newproject { border-style: dashed; }
.projectsdiv > .newproject img { display: block; width:80px; margin: auto; }


.collectiondata .cell { background:#FFF; margin-bottom: 30px; }
.collectiondata .head { padding:10px; border-bottom: 1px solid #EEE; display: flex; align-items: center; }
.collectiondata .head > * { flex: 1; text-align: left; }
.collectiondata .head > *:last-child { text-align: right; }
.collectiondata .head:last-child { border:none; }
.collectiondata .head .name { font-weight: bold; }
.collectiondata .head .type { font-size: 90%; padding: 2px 5px; background-color: #EEE; border-radius: 2px; margin-left:10px; }
.collectiondata .head .type a { color: #0f85b4; }
.collectiondata .head .required { float: right; font-size: 90%; color:var(--color-false); }
.collectiondata .body { padding: 10px; }

.collectionentriestbl { background: #FFF; border: 0; border-collapse: collapse; width: 100%; table-layout: fixed; }
.collectionentriestbl td, .collectionentriestbl th { padding: 10px 14px; border-bottom: 1px solid #CCC; text-align: left; }
.collectionentriestbl th { border-bottom-width: 3px; font-weight: bold; }
.collectionentriestbl tr:last-child td { border-bottom: none; }
.collectionentriestbl .action { width:70px; white-space: nowrap; text-align: right; }
.collectionentriestbl .action .icon { display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; margin-left: 4px; opacity: .7; }
.collectionentriestbl .action .icon:hover { opacity: 1; color: var(--brand); }

.collectionentry { background:#FFF; padding:30px; }
.collectionentry .cell { padding: 5px 15px; margin-bottom: 30px; display: flex; width: 100%; flex-direction: column; gap:10px; border-left: 2px solid #CCC; }
.collectionentry .cell > *:first-child { font-weight: bold; }
.collectionentry .cell > *:last-child { flex:1; }
.collectionentry .cell:last-child { margin:0; }
.collectionentry input, .collectionentry textarea { border:none; border-bottom: 1px solid #CCC; border-radius: 0; }


.checkbox { display: block; margin-top: 2px; }
.checkbox input { display: none; }
.checkbox label { cursor: pointer; position: relative; display: inline-block; width: 100%; max-width: 70px; height: 14px; border-radius: 10px; background: #EEE; }
.checkbox .handle { position: absolute; display: inline-block; left:0; top:50%; transform:translate(-50%,-50%); transition: all 300ms; width: 20px; height: 20px; border-radius: 50%; background:var(--color-false); box-shadow: 0 0 5px rgba(0,0,0,0.2); }
.checkbox input:checked + label .handle { left:100%; background:var(--color-true); }

.linkitemrow { display: block; }
.linkitemrow .btn { margin-right: 20px; }
.itemlist .item { display: flex; align-items: center; margin-bottom: 10px; gap: 20px; width: 100%; }
.itemlist .item > *:first-child { flex: 1; }
.itemlist .item > *:last-child { width:20px; text-align: right; }
.itemlist .item.inline > *:first-child { display: flex; align-items: center; gap: 20px; }
.itemlist .item.inline .field { flex:1; }
.itemlist .item:first-child .arrowup { opacity: 0.2; }
.itemlist .item:last-child .arrowdown { opacity: 0.2; }


.searchfield { display: block; position: relative; }
.searchfield .icon { position: absolute; left:10px; top: 50%; transform: translate(0, -50%); }
.searchfield input { text-indent: 30px; }
.searchfield:after { content: ''; position: absolute; top: 50%; right: 10px; width:8px; height:8px; margin-top: -6px; transform: rotateZ(45deg); border-right:2px solid #222;border-bottom:2px solid #222; }
.searchfield .dropdown { user-select: none; position: absolute; z-index: 100; left: 0; top:100%; right:0; background: #FFF; border-radius: 0 0 5px 5px; box-shadow: 1px 1px 10px rgba(0,0,0,0.2); }
.searchfield .dropdown > * { cursor: pointer; padding: 10px; display: block; border-bottom: 1px solid #CCC; }
.searchfield .dropdown > *:hover { background: var(--hilight-color); }
.searchfield .dropdown > *:last-child { border-bottom: none; }

.imageupload { display: flex; gap: 30px; width: 100%; user-select: none; align-items: center; }
.imageupload input { display: none; }
.imageupload > *:first-child { width: 160px; max-width: 160px; }
.imageupload > *:last-child { flex: 1; }
.imageupload .container { cursor: pointer; display: block; width: 100%; text-align: center; padding: 40px; box-sizing: border-box; border:1px dashed #AAA; background-size: contain; background-position: center center; background-repeat: no-repeat; }
.imageupload button { cursor: pointer; display: block; width: 120px; text-align: center; background: #EEE; padding: 8px 10px; border:none; border-radius: 4px; margin:10px 0; }


.pagecontent { display: block; margin-bottom: 20px; }
.pagecontent .header { display: flex; gap:20px; margin-bottom:10px; align-items: center; width: 100%; box-sizing: border-box;  }
.pagecontent .header > * { flex: 1; }
.pagecontent .header > *:first-child { width: 60px; flex: none; }
.pagecontent .header > *:first-child .icon:first-child { margin-right:5px; }
.pagecontent:first-child .header .arrowup { opacity: 0.3; }
.pagecontent:last-child .header .arrowdown { opacity: 0.3; }
.pagecontent .header > *:last-child { width: 20px; flex: none; text-align: right; padding-right: 5px; }
.pagecontent .content { cursor: pointer; background: #EEE; border-radius: 4px; display: flex; gap:10px; padding: 5px; width: 100%; box-sizing: border-box; min-width: 0; contain: inline-size; }
.pagecontent .content > * { box-sizing: border-box; padding: 10px; min-height: 200px; flex: 1; background: #FFF; border-radius: 4px; position: relative; min-width: 0; }
.pagecontent .content .icon { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }
.pagecontent .content textarea { border:none; box-sizing: border-box; outline: none; min-height: 0; }
.pagecontent .imageupload { height: 100%; align-items: stretch; }
.pagecontent .imageupload > *:first-child { max-width: none; flex: 1; }
.pagecontent .imageupload > *:last-child { position: absolute; text-align: right; bottom:0; }

.prop { display: inline-block; overflow: hidden; white-space: nowrap; width: 100%; text-overflow: ellipsis; }
.prop.date { font-size: 80%; color: #444; border:1px solid #91BBCF; border-radius:2px; padding: 5px; width: 100%; text-align: center; box-sizing: border-box; }
.prop.status { width: 12px; height: 12px; border-radius: 50%; background:var(--color-false); }
.prop.status.active { background: var(--color-true); }
.prop.img { border:1px solid #91BBCF; border-radius:2px; width:50px; height: 50px; background-image: var(--image); background-position: center center; background-size: contain; background-repeat: no-repeat; }


/* Dialog */
.blackbox { position: fixed; left: 0; right: 0; top: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index:99; }
.dialog { box-shadow: 3px 3px 15px rgba(0,0,0,0.4); overflow: hidden; z-index: 100; display: none; position: fixed; width: 95%; max-width:600px; transform: translate(-50%,-50%); top:50%; left: 50%; background: #FFF; border-radius:5px; }
.dialog .title { background: #222; color: #FFF; padding: 10px; display: block; position: relative; }
.dialog .title .image, .dialog .title svg { width: 14px; height: 14px; position: absolute; right: 10px; top: 50%; transform: translate(0,-50%); cursor: pointer; }
.dialog .buttons { display: block; padding: 10px; border-top: 1px solid #EEE; overflow: hidden; text-align: right; }
.dialog .buttons > * { margin-right: 20px;  }
.dialog .buttons > *:first-child { float: left; }
.dialog .buttons > *:last-child { margin-right: 0; }
.dialog .tabs { text-align: center; margin: 10px; display: flex; gap: 10px; align-content: stretch; user-select:none; }
.dialog .tabs label { display: inline-block; padding: 6px 20px; border: 1px solid #AAA; flex:1; border-radius: 5px; cursor: pointer;  }
.dialog .tabs input { display: none; }
.dialog .tabs input:checked + label { border-color: #00A; background:#2E6BB5; color: #FFF; }
.dialog .dialogcontent { display: flex; flex-direction: column; gap: 20px; padding:20px 20px; overflow-y: auto; border-top: 1px solid #EEE;  position:relative; }
.dialog .description { line-height: 1.6; font-size: 15px; display:flex; align-items: center; padding:20px;
    background: #CEF; }
.dialog .description > * { flex:1; padding:5px; }
.dialog .description > *:first-child { flex: 0.12; padding:0 10px 0 0; }
.dialog .description img, .dialog .description svg { width: 100%; vertical-align: top; opacity: 0.8; }
.dialog .description svg:hover .controller { transform: translate(-15%,30%) rotateZ(-90deg); transform-origin: center center; transition: all 200ms; }
.dialog .dialogcontent [data-tab] { display: none; }
.dialog.filepicker { max-width:1200px; }
.dialog.filepicker .fileselect { display: grid; grid-template-columns: repeat(auto-fill,minmax(160px,1fr)); gap:20px; }
.dialog.filepicker [data-tab] { height: inherit; }
.dialog.filepicker .splitwindow { display: flex; width: 100%; align-items: start; gap:20px; height: inherit; }
.dialog.filepicker .splitwindow > *:first-child { flex: 1; overflow-y: scroll;height: 100%;padding-right: 20px;}
.dialog.filepicker .splitwindow > *:last-child { width:300px; }
.dialog.filepicker .splitwindow .imagepreview { display: block; margin-bottom: 15px; width: 100%; aspect-ratio: 16/9; background-position: center center; background-repeat: no-repeat; background-size:contain; background-color:#CCC; }
.dialog.filepicker .splitwindow .btn { margin-top: 15px; }
.dialog.filepicker .inputrow { display: flex; gap:10px; align-items: center; width: 100%; }
.dialog.filepicker .inputrow > *:first-child { flex: 1; }
.dialog.filepicker .row { font-size: 90%; opacity: 0.8; margin-top: 15px; display: block; }
.dialog.filepicker input[type="file"] { display: none; }
.dialog .directory { display:inline-block; width:100%; background:#FFF; cursor:pointer; }
.dialog .directory .dirgrid { display: grid; grid-template-columns:1fr 1fr; }
.dialog .directory .image { display:block; width:100%; border:1px solid #444; height:0; padding-bottom:80%; background-position:center center; background-size:contain; background-repeat:no-repeat; background-color:#CCC; }
.dialog .directory .name { padding:10px 10px 0 10px; text-align:center; display:block; font-size: 90%; }
.dialog .directory.selected { color:#2E6BB5; }
.dialog .directory.selected .image { outline:4px solid #2E6BB5; }
.dialog .dbreadcrumb { display:block; margin-bottom:15px; cursor:pointer; font-size: 90%; }
.dialog .dbreadcrumb .dir:before { margin:0 5px; content:'-'; }
.dialog .upload { font-size:20px; text-align:center; display:block; position:absolute; top:0; right:0; left:0; bottom:0; cursor:pointer; }
.dialog .upload > span { position:absolute; left:50%; top:50%; transform:translate(-50%,-50%); width:90%; }
.dialog input, .dialog select { width: 100%; box-sizing: border-box; padding: 6px; border: 1px solid #CCC; border-radius: 5px; }

/* Upload UI */
.upload { display: flex; align-items: center; gap:20px; }
.upload > * { width: 100%; }
.upload > *:first-child { width: 100px; }
.upload .uploadbox { width: 100px; height: 100px; border: 2px solid #DDD; display: inline-block; cursor: pointer; background-color:#F0F0F0; background-size: contain; background-repeat: no-repeat; background-position: 50% 50%; vertical-align: top; }
.upload button { display: block; margin: 10px 0; width:160px; }
.upload input { display: none; }

.itemrow { display: flex; align-items: center; gap:20px; width: 100%; }
.itemrow > * { position: relative; }
.itemrow > *:first-child {  }
.itemrow > *:nth-child(2) { width: 80px; }
.itemrow > *:nth-child(3) { flex: 1; }
.itemrow > *:last-child { text-align: right; }
.itemrow .percent { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); user-select: none; opacity: 0.7; }

.abtn_warning { color: #f46060; background: none; border:none; font-weight: normal; box-shadow: none; }
.abtn_warning .icon { fill: #f46060; }


/* Layout presets */
.ps-presets { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.ps-preset {
    height: 60px;
    padding: 10px;
    display: flex;
    gap: 4px;
    background: var(--ps-tile);
    border: 2px solid var(--ps-line-soft);
    border-radius: 8px;
    cursor: pointer;
}
.ps-preset span {
    display: block;
    flex-basis: 0;
    min-width: 0;
    height: 100%;
    background: var(--ps-bar);
    border-radius: 3px;
}
.ps-preset:hover { border-color: var(--ps-bar); }
.ps-preset.is-active { border-color: var(--ps-dark); }
.ps-preset.is-active span { background: var(--ps-dark); }

.ps-preset--custom {
    flex-direction: column; align-items: center; justify-content: center;
    padding: 6px; color: #666; font-size: 12px; font-weight: 600;
}
.ps-columns { display: flex; flex-direction: column; gap: 10px; }
.section { display: flex; flex-direction: column; gap: 10px; }
.ps-label {
    font-size: 13px; font-weight: 600; color: var(--ps-muted);
    text-transform: uppercase; letter-spacing: .04em;
}body {
    background: #EEE;
    color: #222;

    --hilight-color: #83b6d6;
    --color-false: #b31515;
    --color-true: #10801a;
}

/* ============================================================
   Brand buttons, landing page and auth pages
   ============================================================ */
:root { --brand: #3b30b8; --brand-ink: #2a2290; }

/* App header: logo left, account/logout right — always one row */
header { display: flex; align-items: center; justify-content: space-between; flex-wrap: nowrap; gap: 16px; }
header > .logo { flex-shrink: 0; }
.headernav { display: flex; align-items: center; gap: 16px; flex-wrap: nowrap; }
.headernav > a:not(.btn) {
    color: #666; font-weight: 600; font-size: 14px;
    white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis;
}
.headernav > a:not(.btn):hover { color: var(--brand); }
.headernav .btn.logout { gap: 8px; background: #fff; color: #555; flex-shrink: 0; white-space: nowrap; line-height: normal; }
.headernav .btn.logout:hover { color: var(--ps-danger); border-color: var(--ps-danger); }
.headernav .btn.logout svg { width: 16px; height: 16px; flex-shrink: 0; }

button.primary, .btn.primary {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
}
button.primary:hover, .btn.primary:hover { background: var(--brand-ink); border-color: var(--brand-ink); }
.btn.large, button.large { padding: 10px 20px; font-size: 15px; border-radius: 8px; }
.btn.block, button.block { width: 100%; justify-content: center; }

/* Shared top bar for landing + auth pages */
.siteheader {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 28px; background: #fff; border-bottom: 1px solid var(--ps-line);
}
.siteheader .logo { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 700; color: #444; }
.siteheader .logo svg { width: 26px; height: 26px; vertical-align: top; }
.siteheader nav { display: flex; align-items: center; gap: 18px; }
.siteheader nav a { font-weight: 600; color: #444; font-size: 14px; }
.siteheader nav a.btn { color: #fff; }

/* ---- Auth pages (login / register / password / 404) ---- */
.authbody { display: flex; flex-direction: column; min-height: 100%; background: #EEE; }
.authmain { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.authcard {
    width: 100%; max-width: 380px; background: #fff;
    border: 1px solid var(--ps-line-soft); border-radius: 12px;
    padding: 32px; box-shadow: 0 10px 40px rgba(0,0,0,.06);
}
.authcard h1 { font-size: 24px; margin-bottom: 6px; }
.authcard .sub { margin: 0 0 22px 0; color: var(--ps-muted); font-size: 14px; }
.authcard .row { margin-bottom: 16px; }
.authcard .row label { display: block; font-size: 13px; font-weight: 600; color: #555; margin-bottom: 6px; }
.authcard input {
    width: 100%; box-sizing: border-box; padding: 10px 12px;
    border: 1px solid #d5d5d5; border-radius: 8px; font-size: 14px;
}
.authcard input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(59,48,184,.12); }
.authcard button { margin-top: 6px; }
.authcard .form-group { margin-bottom: 16px; }
.authcard .error {
    display: block; margin-bottom: 16px; padding: 10px 12px; border-radius: 8px;
    background: #fdecec; color: var(--ps-danger); font-size: 13px;
    border: 1px solid #f3c9c9;
}
.authcard .error.success { background: #eaf5ea; color: var(--ps-ok); border-color: #c7e2c0; }
.authcard .authlinks { display: flex; justify-content: space-between; gap: 12px; margin-top: 18px; }
.authcard .authlinks a { font-size: 13px; color: var(--brand); font-weight: 600; }
.authcard.notfound { text-align: center; }
.authcard.notfound h1 { font-size: 52px; margin-bottom: 4px; }

/* ============================================================
   Collection schema editor (collection.php)
   ============================================================ */
.ceditor { max-width: 920px; }
.ceditor-meta {
    display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 26px;
    padding: 18px; background: #fff; border: 1px solid var(--ps-line-soft); border-radius: 12px;
}
.ceditor-meta .row { flex: 1; min-width: 220px; }
.ceditor-meta label { display: block; font-size: 13px; font-weight: 600; color: #555; margin-bottom: 6px; }
.ceditor-meta input {
    width: 100%; box-sizing: border-box; padding: 10px 12px;
    border: 1px solid #d5d5d5; border-radius: 8px; font-size: 14px;
}
.ceditor-meta input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(59,48,184,.12); }

.ceditor-fields-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.ceditor-fields-head h2 { margin: 0; font-size: 17px; }

.fields { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.fieldrow { background: #fff; border: 1px solid var(--ps-line-soft); border-radius: 10px; padding: 12px; }
.fieldrow:hover { border-color: #d7d3f0; }
.fr-main { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fr-order { display: inline-flex; flex-direction: column; }
.fr-order .icon { width: 18px; height: 16px; opacity: .5; }
.fr-order .icon:hover { opacity: 1; }
.fieldrow .f-key {
    width: 170px; padding: 8px 10px; border: 1px solid #d5d5d5; border-radius: 7px;
    font-family: monospace; font-size: 13px;
}
.fieldrow .f-type { padding: 8px 10px; border: 1px solid #d5d5d5; border-radius: 7px; font-size: 13px; background: #fff; }
.fieldrow .f-key:focus, .fieldrow .f-type:focus { outline: none; border-color: var(--brand); }
.fr-toggles { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #555; cursor: pointer; white-space: nowrap; }
.chk input { width: auto; margin: 0; }
.fieldrow .f-del { opacity: .5; }
.fieldrow .f-del:hover { opacity: 1; }
.fieldrow .f-desc {
    width: 100%; box-sizing: border-box; margin-top: 10px; padding: 7px 10px;
    border: 1px solid #e4e4e4; border-radius: 7px; font-size: 13px;
}
.fieldrow .f-desc:focus { outline: none; border-color: var(--brand); }

.fr-custom { margin-top: 12px; padding: 12px; background: #f7f7fb; border: 1px solid var(--ps-line-soft); border-radius: 8px; }
.fr-custom-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--ps-muted); margin-bottom: 10px; }
.proplist { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.proprow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.proprow input, .proprow select { padding: 6px 9px; border: 1px solid #d5d5d5; border-radius: 6px; font-size: 13px; background: #fff; }
.proprow .p-key { width: 120px; font-family: monospace; }
.proprow .p-name { width: 150px; }
.proprow .p-del { opacity: .5; margin-left: auto; }
.proprow .p-del:hover { opacity: 1; }

.fields-empty {
    padding: 22px; text-align: center; color: var(--ps-muted); font-size: 14px;
    border: 1px dashed var(--ps-line); border-radius: 10px; margin-bottom: 14px;
}

.savestatus { display: inline-block; margin-top: 14px; }
.savestatus.error { color: var(--ps-danger); }
.savestatus.ok { color: var(--ps-ok); }

/* Simple form card (project new/edit) */
.formcard {
    max-width: 560px; padding: 22px; background: #fff;
    border: 1px solid var(--ps-line-soft); border-radius: 12px;
}
.formcard .row { margin-bottom: 18px; }
.formcard .row:last-of-type { margin-bottom: 8px; }
.formcard label { display: block; font-size: 13px; font-weight: 600; color: #555; margin-bottom: 6px; }
.formcard input, .formcard select {
    width: 100%; box-sizing: border-box; padding: 10px 12px;
    border: 1px solid #d5d5d5; border-radius: 8px; font-size: 14px; background: #fff;
}
.formcard input:focus, .formcard select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(59,48,184,.12); }
.crumbrow { display: flex; align-items: baseline; flex-wrap: wrap; }
.crumbrow .breadcrumb { display: inline-flex; }
.crumbtail { color: var(--ps-muted); margin-left: 8px; white-space: nowrap; }

/* Project image uploader */
.imgupload { display: flex; align-items: center; gap: 14px; }
.imgpreview {
    width: 72px; height: 72px; flex-shrink: 0; border-radius: 10px;
    border: 1px dashed var(--ps-line); background: #f6f6f9;
    background-position: center; background-size: contain; background-repeat: no-repeat;
}
.imgupload.has-image .imgpreview { border-style: solid; border-color: var(--ps-line-soft); }
.imgupload.loading .imgpreview { opacity: .5; }
.imgactions { display: flex; gap: 8px; flex-wrap: wrap; }
.imgremove { display: none; }
.imgupload.has-image .imgremove { display: inline-flex; }

/* ============================================================
   /app dashboard
   ============================================================ */
.dashboard { max-width: 1100px; }
.muted { color: var(--ps-muted); }
.small { font-size: 12px; }

.dash-head { margin-bottom: 18px; }
.dash-head h1 { margin-bottom: 4px; }
.dash-head p { margin: 0; font-size: 14px; }

.dash-stats { display: flex; gap: 14px; margin-bottom: 30px; flex-wrap: wrap; }
.dash-stats .stat {
    display: flex; flex-direction: column; min-width: 120px;
    padding: 14px 18px; background: #fff; border: 1px solid var(--ps-line-soft);
    border-radius: 10px;
}
.dash-stats .num { font-size: 26px; font-weight: 700; line-height: 1; }
.dash-stats .lbl { font-size: 12px; color: var(--ps-muted); margin-top: 6px; text-transform: uppercase; letter-spacing: .04em; }

/* Company section */
.company { margin-bottom: 34px; }
.company-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding-bottom: 12px; margin-bottom: 16px; border-bottom: 1px solid var(--ps-line-soft);
}
.company-title { display: flex; align-items: center; gap: 12px; }
.company-title h2 { margin: 0; font-size: 17px; }
.company-avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
    background: rgba(59,48,184,.10); color: var(--brand); font-weight: 700; font-size: 17px;
}
.company-actions { display: flex; align-items: center; gap: 10px; }
.company-empty { margin: 0; }

/* Role badges */
.badge {
    display: inline-block; padding: 3px 9px; border-radius: 999px;
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
    background: #eee; color: #555;
}
.badge.small { padding: 2px 8px; font-size: 10px; }
.badge.role-owner       { background: rgba(59,48,184,.12); color: var(--brand); }
.badge.role-editor      { background: #e3effb; color: #1d6fb8; }
.badge.role-contributor { background: #e5f5ec; color: #1f8a4c; }
.badge.role-reviewer    { background: #fdf0da; color: #9a6400; }
.badge.role-viewer      { background: #eceef2; color: #5b6370; }

/* Project cards */
.project-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px;
}
.project-card {
    background: #fff; border: 1px solid var(--ps-line-soft); border-radius: 12px;
    padding: 14px; transition: box-shadow .15s, border-color .15s;
}
.project-card:hover { border-color: #cdc9ef; box-shadow: 0 6px 20px rgba(0,0,0,.06); }
.project-main { display: flex; align-items: center; gap: 12px; }
.project-img {
    display: inline-flex; align-items: center; justify-content: center;
    width: 42px; height: 42px; flex-shrink: 0; overflow: visible;
    background-position: center; background-size: contain; background-repeat: no-repeat;
    color: var(--brand); font-weight: 700; font-size: 17px;
}
.project-info { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.project-name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-meta { margin-top: 2px; }

.collection-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.collection-list.empty { margin-top: 12px; }
.collection-chip {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 5px 6px 5px 11px; border-radius: 8px; background: #f6f6f9;
    border: 1px solid var(--ps-line-soft); font-size: 13px; max-width: 100%;
}
.collection-chip:hover { background: #eeedf8; border-color: #d7d3f0; color: var(--brand); }
.collection-chip .cc-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.collection-chip .cc-count {
    display: inline-flex; align-items: center; justify-content: center; min-width: 20px;
    padding: 0 6px; height: 18px; border-radius: 6px; background: #fff;
    border: 1px solid var(--ps-line-soft); font-size: 11px; font-weight: 700; color: var(--ps-muted);
}

/* Empty dashboard */
.empty-state {
    text-align: center; padding: 60px 24px; background: #fff;
    border: 1px dashed var(--ps-line); border-radius: 14px;
}
.empty-state h2 { margin: 0 0 8px; }
.empty-state p { margin: 0 0 20px; color: var(--ps-muted); }

/* ============================================================
   Project dashboard (project.php detail view)
   ============================================================ */
.projhead { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.projhead-main { display: flex; align-items: flex-start; gap: 16px; }
.projhead-img {
    display: inline-flex; align-items: center; justify-content: center;
    width: 56px; height: 56px; flex-shrink: 0;
    background-position: center; background-size: contain; background-repeat: no-repeat;
    color: var(--brand); font-weight: 700; font-size: 22px;
}
.projhead-main h1 { margin: 4px 0 6px; font-size: 24px; }
.projhead-main .breadcrumb { font-size: 12px; }
.projhead-meta { display: flex; gap: 14px; flex-wrap: wrap; }
.projhead-meta a { color: var(--brand); }
.projhead-actions { flex-shrink: 0; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.projhead-actions .btn { background: #fff; }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 30px 0 14px; }
.section-head h2 { margin: 0; font-size: 17px; }

.col-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.col-card { background: #fff; border: 1px solid var(--ps-line-soft); border-radius: 12px; padding: 14px; transition: box-shadow .15s, border-color .15s; }
.col-card:hover { border-color: #cdc9ef; box-shadow: 0 6px 20px rgba(0,0,0,.06); }
.col-card-main { display: flex; align-items: center; gap: 12px; }
.col-icon { width: 34px; height: 34px; flex-shrink: 0; background: url('/assets/images/page.svg') center/contain no-repeat; opacity: .75; }
.col-info { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.col-name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.col-card-actions { display: flex; gap: 16px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--ps-line-soft); }
.col-card-actions a { font-size: 13px; font-weight: 600; color: var(--brand); }
.col-card-actions a:hover { color: var(--brand-ink); }

.activity { background: #fff; border: 1px solid var(--ps-line-soft); border-radius: 12px; overflow: hidden; }
.activity-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--ps-line-soft); }
.activity-item:last-child { border-bottom: none; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--ps-bar); }
.activity-dot.activity-create { background: var(--ps-ok); }
.activity-dot.activity-edit { background: var(--brand); }
.activity-text { flex: 1; font-size: 14px; }
.activity-when { white-space: nowrap; }

@media (max-width: 760px) {
    .col-grid { grid-template-columns: 1fr; }
}

/* Members page */
.inviteform { max-width: none; margin-bottom: 22px; }
.inviterow { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.inviterow .m-email { flex: 1; min-width: 220px; padding: 10px 12px; border: 1px solid #d5d5d5; border-radius: 8px; font-size: 14px; }
.inviterow .m-role { padding: 10px 12px; border: 1px solid #d5d5d5; border-radius: 8px; font-size: 14px; background: #fff; }
.inviterow .m-email:focus, .inviterow .m-role:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(59,48,184,.12); }

.memberlist { background: #fff; border: 1px solid var(--ps-line-soft); border-radius: 12px; overflow: hidden; }
.member { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-bottom: 1px solid var(--ps-line-soft); }
.member:last-child { border-bottom: none; }
.member-avatar { width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0; background: #eee; object-fit: cover; }
.member-info { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.member-name { font-weight: 600; font-size: 14px; }
.member-scope { padding: 2px 8px; border: 1px solid var(--ps-line-soft); border-radius: 999px; }
.member-remove { flex-shrink: 0; }
.member-remove:hover { color: var(--ps-danger); border-color: var(--ps-danger); }

/* ---- Marketing landing ---- */
.landingbody { display: flex; flex-direction: column; min-height: 100%; background: #fff; }
.landing { flex: 1; }
.landing .hero {
    text-align: center; padding: 90px 24px 70px;
    background: radial-gradient(1200px 400px at 50% -10%, rgba(59,48,184,.10), transparent);
}
.landing .hero h1 { font-size: 44px; line-height: 1.1; margin: 0 auto 18px; max-width: 760px; }
.landing .hero p { font-size: 18px; color: var(--ps-muted); max-width: 560px; margin: 0 auto 30px; }
.landing .hero .cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

.landing .features {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px;
    max-width: 1000px; margin: 20px auto 40px; padding: 0 24px;
}
.landing .feature {
    border: 1px solid var(--ps-line-soft); border-radius: 14px; padding: 26px; background: #fff;
}
.landing .feature .ficon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 52px; height: 52px; border-radius: 12px; margin-bottom: 14px;
    background: rgba(59,48,184,.10); color: var(--brand);
}
.landing .feature h3 { margin: 0 0 8px; font-size: 18px; }
.landing .feature p { margin: 0; color: var(--ps-muted); font-size: 14px; line-height: 1.5; }

.landing .closing { text-align: center; padding: 60px 24px 80px; }
.landing .closing h2 { font-size: 30px; margin: 0 0 8px; }
.landing .closing p { color: var(--ps-muted); margin: 0 0 24px; }

.sitefooter {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 28px; border-top: 1px solid var(--ps-line); color: var(--ps-muted); font-size: 13px;
}
.sitefooter nav { display: flex; gap: 18px; }
.sitefooter nav a { color: var(--ps-muted); }

@media (max-width: 760px) {
    .landing .features { grid-template-columns: 1fr; }
    .landing .hero h1 { font-size: 34px; }
}
