:root {
  --primary: #4945ff;
  --primary-dark: #3732d7;
  --ink: #32324d;
  --muted: #666687;
  --canvas: #f6f6f9;
  --line: #eaeaef;
  --input-line: #dcdce4;
  --focus: #e8f0fe;
  --danger: #d02b20;
  --white: #fff;
  --shadow: 0 2px 8px rgba(33, 33, 52, .12);
  font-family: "Noto Sans", "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; font-size: 14px; background: var(--canvas); }
button, input, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

.button {
  min-height: 32px; padding: 7px 16px; border: 1px solid var(--primary); border-radius: 4px;
  color: #fff; background: var(--primary); font-size: 12px; font-weight: 700; line-height: 16px;
  transition: background .15s ease, border-color .15s ease;
}
.button:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.button.secondary { color: var(--ink); background: #fff; border-color: var(--input-line); }
.button.secondary:hover { color: var(--primary); border-color: var(--primary); background: #f5f4ff; }
.button.small { min-height: 28px; padding: 5px 10px; }
.button[disabled] { cursor: default; opacity: .55; }
.icon-button { display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 1px solid var(--input-line); border-radius: 4px; color: #8383a6; background: #fff; font-size: 19px; }
.icon-button:hover { border-color: var(--primary); color: var(--primary); }

.field { display: grid; gap: 4px; }
.field label, .field-label { color: var(--ink); font-size: 12px; font-weight: 700; }
.required { color: var(--danger); }
.text-input, .select-input {
  width: 100%; height: 40px; padding: 10px 12px; border: 1px solid var(--input-line); border-radius: 4px; outline: 0;
  color: var(--ink); background: #fff;
}
.text-input:focus, .select-input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px #e5e4ff; }
.text-input::placeholder { color: #8e8ea9; }
.help { margin: 0; color: var(--muted); font-size: 12px; line-height: 18px; }
.message { min-height: 18px; margin: 0; color: var(--danger); font-size: 12px; }

/* Landing and authentication */
.center-page { display: grid; min-height: 100vh; place-items: center; padding: 24px; }
.landing-card { width: min(760px, 100%); padding: 30px; border-radius: 3px; border-top: 2px solid #007eff; background: #fff; box-shadow: 0 2px 4px #e3e9f3; }
.landing-card__content { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; }
.landing-card h1 { margin: 0 0 12px; font-size: 27px; font-weight: 700; }
.environment { display: inline-block; padding: 2px 11px; border: 1px solid #aed4fb; border-radius: 2px; color: #007eff; background: #e6f0fb; font-size: 12px; font-weight: 700; letter-spacing: .5px; }
.landing-card p { margin: 18px 0 0; color: #333740; font-size: 14px; }
.landing-card__right { min-width: 192px; text-align: right; }
.landing-card time { display: block; margin-bottom: 32px; color: #333740; font-size: 12px; }
.landing-card .button { display: inline-flex; width: 100%; align-items: center; justify-content: center; background: #007eff; border-color: #007eff; }

.login-page { background: #f6f6f9; }
.login-card { width: min(552px, 100%); padding: 0 56px 48px; border-radius: 4px; background: #fff; box-shadow: 0 1px 4px rgba(33,33,52,.1); }
.login-brand { display: grid; height: 196px; place-items: center; align-content: center; }
.brand-mark { display: grid; place-items: center; width: 72px; height: 72px; color: #fff; background: transparent; font-size: 25px; font-weight: 800; }
.login-logo { display: block; width: 72px; height: 72px; max-width: none; }
.login-brand h1 { margin: 24px 0 4px; font-size: 32px; line-height: 40px; }
.login-brand p { margin: 0; color: var(--muted); font-size: 16px; }
.login-form { display: grid; gap: 24px; }
.login-form .text-input { background: var(--focus); }
.password-control { display: flex; border: 1px solid var(--input-line); border-radius: 4px; overflow: hidden; }
.password-control input { border: 0; border-radius: 0; }
.password-control .icon-button { border: 0; border-left: 1px solid var(--input-line); border-radius: 0; }
.password-eye { display: block; width: 16px; height: 16px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; color: var(--ink); }
.checkbox-row input { width: 18px; height: 18px; accent-color: var(--primary); }
.login-form .button { width: 100%; }

/* Admin application shell */
.app-shell { display: flex; min-height: 100vh; }
.sidebar { position: fixed; z-index: 2; display: flex; flex-direction: column; width: 224px; height: 100vh; border-right: 1px solid var(--line); background: #fff; }
.product { display: flex; align-items: center; gap: 8px; padding: 16px 12px; border-bottom: 1px solid var(--line); }
.product .brand-mark { width: 32px; height: 32px; border-radius: 7px; font-size: 14px; }
.sidebar-logo { display: block; width: 32px; height: 32px; max-width: none; }
.product strong { display: block; font-size: 14px; }
.product small { color: var(--muted); font-size: 12px; }
.navigation { display: grid; gap: 16px; padding: 12px 8px 40px 12px; overflow: auto; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 4px; color: var(--muted); font-size: 14px; }
.nav-link:hover { color: var(--primary); background: #f5f4ff; }
.nav-link.active { color: var(--primary); background: #f0f0ff; font-weight: 700; }
.nav-icon { display: inline-grid; width: 16px; place-items: center; font-size: 16px; }
.profile { margin-top: auto; display: flex; align-items: center; gap: 8px; padding: 13px 20px 12px; border-top: 1px solid var(--line); }
.avatar { display: grid; flex: 0 0 auto; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: #fff; background: var(--primary); font-size: 12px; font-weight: 700; }
.profile-text { min-width: 0; flex: 1; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout { border: 0; color: var(--muted); background: none; font-size: 16px; }
.main { width: calc(100% - 224px); min-height: 100vh; margin-left: 224px; padding: 56px max(32px, 5vw); }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-header h1 { margin: 0; font-size: 24px; line-height: 32px; }
.page-header p { margin: 5px 0 0; color: var(--muted); }
.header-actions, .toolbar, .form-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.toolbar { margin-bottom: 18px; }
.search { min-width: min(270px, 100%); height: 32px; padding: 6px 10px; border: 1px solid var(--input-line); border-radius: 4px; background: #fff; outline: none; font-size: 12px; }
.search:focus { border-color: var(--primary); }
.section-label { margin: 24px 0 8px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 12px; font-weight: 700; }
.folder-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(205px, 1fr)); gap: 8px; }
.folder-card { display: flex; align-items: center; width: 100%; gap: 12px; min-height: 58px; padding: 10px; border: 1px solid var(--line); border-radius: 4px; color: inherit; background: #fff; box-shadow: 0 1px 2px rgba(33,33,52,.04); text-align: left; }
.folder-card:hover { border-color: var(--primary); background: #fafaff; }
.folder-card.drop-target { border-color: var(--primary); background: #edecff; box-shadow: 0 0 0 2px #d9d8ff; }
.folder-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 3px; color: #47a8e8; background: #e6f4ff; font-size: 16px; }
.folder-card strong { display: block; font-size: 12px; }
.folder-card small { color: var(--muted); font-size: 11px; }
.folder-card > span:nth-child(2) { flex: 1; }
.folder-arrow { color: var(--muted); font-size: 20px; }
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.asset-card { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 4px; background: #fff; box-shadow: 0 1px 2px rgba(33,33,52,.04); }
.asset-card[draggable="true"] { cursor: grab; }
.asset-card.dragging { opacity: .45; cursor: grabbing; }
.asset-preview { display: grid; height: 138px; place-items: center; background: #eef0f3; overflow: hidden; }
.asset-preview img { width: 100%; height: 100%; object-fit: cover; }
.asset-body { padding: 8px; }
.asset-name { display: block; overflow: hidden; font-size: 10px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.asset-meta { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 4px; color: var(--muted); font-size: 10px; }
.tag { padding: 2px 4px; border-radius: 2px; color: #666687; background: #f0f0f4; font-size: 8px; font-weight: 700; }
.tag.vector { color: #32725f; background: #e5f5ef; }
.copy-url, .delete-media { position: absolute; top: 7px; display: grid; place-items: center; width: 26px; height: 26px; border: 0; border-radius: 4px; background: rgba(255,255,255,.92); }
.copy-url { right: 7px; color: var(--ink); opacity: 0; }
.delete-media { left: 7px; color: var(--danger); font-size: 19px; line-height: 1; opacity: 0; }
.copy-url:hover { color: #fff; background: var(--primary); }
.delete-media:hover { color: #fff; background: var(--danger); }
.asset-card:hover .copy-url, .asset-card:hover .delete-media { opacity: 1; }
.empty-state { padding: 56px 20px; border: 1px dashed #c0c0cf; border-radius: 4px; text-align: center; color: var(--muted); background: #fff; }

/* Forms and upload modal */
.panel { max-width: 900px; border: 1px solid var(--line); border-radius: 4px; background: #fff; box-shadow: 0 2px 7px rgba(33,33,52,.1); }
.panel-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); background: #f6f6f9; }
.panel-header h2 { margin: 0; font-size: 14px; }
.panel-content { padding: 24px 40px; }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tab { padding: 17px 16px; border: 0; border-bottom: 2px solid transparent; color: var(--muted); background: transparent; font-size: 11px; font-weight: 700; }
.tab.active { border-color: var(--primary); color: var(--primary); }
.upload-form { display: grid; gap: 24px; padding-top: 24px; }
.drop-zone { display: grid; min-height: 276px; place-items: center; padding: 32px; border: 1px dashed #c0c0cf; border-radius: 4px; background: #f6f6f9; text-align: center; }
.drop-zone.dragging { border-color: var(--primary); background: #efefff; }
.drop-zone input { display: none; }
.drop-zone__content { display: grid; justify-items: center; gap: 12px; }
.upload-icon { color: var(--primary); font-size: 24px; }
.drop-zone strong { color: var(--muted); font-size: 16px; }
.upload-details { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.panel-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 20px; border-top: 1px solid var(--line); background: #f6f6f9; }
.url-pane { display: grid; gap: 14px; }

.settings-layout { display: grid; gap: 20px; max-width: 900px; }
.settings-card { padding: 24px; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.settings-card h2 { margin: 0 0 6px; font-size: 16px; }
.settings-card > p { margin: 0 0 20px; color: var(--muted); }
.settings-form { display: grid; gap: 18px; max-width: 540px; }
.settings-form .button { justify-self: start; }
.users-table { width: 100%; border-collapse: collapse; }
.users-table th, .users-table td { padding: 11px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.users-table th { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.role { display: inline-block; padding: 3px 7px; border-radius: 3px; color: var(--primary); background: #f0f0ff; font-size: 11px; font-weight: 700; }
.role.editor { color: #477eaf; background: #e7f4ff; }
.split { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(260px, .75fr); gap: 20px; }
.embed-demo { display: flex; gap: 8px; max-width: 680px; }
.code-block { overflow: auto; margin: 14px 0; padding: 16px; border-radius: 4px; color: #d9e6ff; background: #32324d; font: 12px/1.6 Consolas, "Courier New", monospace; white-space: pre; }
.modal-backdrop { position: fixed; z-index: 30; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(50,50,77,.28); }
.modal { width: min(500px, 100%); border-radius: 4px; background: #fff; box-shadow: 0 4px 18px rgba(33,33,52,.2); }
.modal-form { display: grid; gap: 18px; padding: 24px 24px 0; }
.modal-body { padding: 0 24px 24px; }
.upload-modal { width: min(830px, 100%); max-height: min(690px, calc(100vh - 40px)); overflow: auto; }
.upload-modal .drop-zone { min-height: 210px; }
.upload-preview-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin-top: 14px; }
.upload-preview { position: relative; display: flex; align-items: center; gap: 10px; min-width: 0; padding: 8px; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.upload-preview > img { flex: 0 0 auto; width: 48px; height: 48px; border-radius: 3px; background: #eef0f3; object-fit: cover; }
.upload-preview__meta { display: grid; min-width: 0; gap: 3px; padding-right: 18px; }
.upload-preview__meta strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.upload-preview__meta small { color: var(--muted); font-size: 10px; }
.upload-preview__remove { position: absolute; top: 5px; right: 5px; display: grid; width: 20px; height: 20px; place-items: center; padding: 0; border: 0; border-radius: 3px; color: var(--muted); background: #f0f0f4; font-size: 16px; line-height: 1; }
.upload-preview__remove:hover { color: #fff; background: var(--danger); }

.toast { position: fixed; z-index: 20; right: 24px; bottom: 24px; max-width: min(390px, calc(100vw - 48px)); padding: 12px 16px; border-radius: 4px; color: #fff; background: #2f6d4f; box-shadow: var(--shadow); font-size: 13px; }
.toast.error { background: #a72b21; }

/* Standalone picker, suited for use in an iframe */
.picker-page { display: grid; height: 100vh; overflow: hidden; place-items: center; background: rgba(50,50,77,.12); }
.picker-shell { display: flex; flex-direction: column; width: min(960px, calc(100vw - 30px)); height: min(640px, calc(100vh - 30px)); overflow: hidden; border-radius: 5px; background: #fff; box-shadow: 0 4px 18px rgba(33,33,52,.2); }
.picker-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); background: #f6f6f9; }
.picker-head h1 { margin: 0; font-size: 16px; }
.picker-content { flex: 1 1 auto; min-height: 0; padding: 20px; overflow: auto; }
.picker-filter { display: inline-flex; gap: 4px; padding: 3px; border: 1px solid var(--input-line); border-radius: 4px; background: #fff; }
.picker-filter__button { min-height: 24px; padding: 3px 9px; border: 0; border-radius: 3px; color: var(--muted); background: transparent; font-size: 11px; font-weight: 700; }
.picker-filter__button:hover { color: var(--primary); background: #f0f0ff; }
.picker-filter__button.active { color: #fff; background: var(--primary); }
.picker-section-title { margin: 18px 0 8px; color: var(--ink); font-size: 12px; }
.picker-section-title:first-child { margin-top: 0; }
.picker-folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.picker-folder { display: flex; align-items: center; width: 100%; gap: 10px; min-height: 50px; padding: 8px; border: 1px solid var(--line); border-radius: 4px; color: var(--ink); background: #fff; text-align: left; }
.picker-folder:hover { border-color: var(--primary); background: #fafaff; }
.picker-folder > span:nth-child(2) { flex: 1; }
.picker-folder strong { display: block; font-size: 11px; }
.picker-folder small, .picker-empty { color: var(--muted); font-size: 10px; }
.picker-empty { margin: 8px 0; }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; min-height: 140px; }
.picker-item { overflow: hidden; padding: 0; border: 2px solid transparent; border-radius: 4px; color: inherit; background: #fff; text-align: left; box-shadow: 0 1px 2px rgba(33,33,52,.1); }
.picker-item:hover, .picker-item.selected { border-color: var(--primary); }
.picker-item img { display: block; width: 100%; height: 112px; object-fit: cover; background: #eef0f3; }
.picker-item span { display: block; overflow: hidden; padding: 7px; font-size: 10px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.picker-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 20px; border-top: 1px solid var(--line); background: #f6f6f9; }

@media (max-width: 720px) {
  .landing-card__content, .page-header { align-items: stretch; flex-direction: column; }
  .landing-card__right { text-align: left; }
  .landing-card time { margin: 12px 0; }
  .login-card { padding: 0 28px 34px; }
  .sidebar { position: static; width: 100%; height: auto; }
  .app-shell { display: block; }
  .navigation { display: flex; gap: 4px; padding-bottom: 12px; overflow-x: auto; }
  .nav-link { flex: 0 0 auto; }
  .profile { display: none; }
  .main { width: 100%; margin: 0; padding: 28px 18px; }
  .split, .upload-details { grid-template-columns: 1fr; }
  .embed-demo { align-items: stretch; flex-direction: column; }
  .picker-shell { width: 100%; height: 100vh; border-radius: 0; }
  .panel-content { padding: 18px; }
  .asset-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
