:root {
  --bg: #0e0f13;
  --bg-elev: #161821;
  --bg-elev-2: #1d2030;
  --border: #2a2e40;
  --text: #e7e9f1;
  --text-muted: #9ba1b6;
  --accent: #7c5cff;
  --accent-2: #ef4444;
  --danger: #f87171;
  --success: #34d399;
  --warning: #f59e0b;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  background:
    linear-gradient(rgba(14, 15, 19, 0.36), rgba(14, 15, 19, 0.41)),
    url("../assets/background.png") center center / cover no-repeat fixed,
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.25; }
p { margin: .25rem 0; }

.container { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.hidden { display: none !important; }
.muted { color: var(--text-muted); }
.muted-sm { color: var(--text-muted); font-size: .85rem; }

/* ===== Header ===== */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: rgba(14, 15, 19, 0.85);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px;
}
.brand-row { display: flex; align-items: center; gap: 12px; color: var(--text); }
.brand-row:hover { text-decoration: none; }
.brand-mark {
  width: 48px; height: 48px; border-radius: 8px;
  display: grid; place-items: center;
  background: #000;
  color: #ff3a3a;
  font-weight: 800; letter-spacing: 0.5px; font-size: .95rem;
  border: 2px solid #ff3a3a;
  text-shadow: 0 0 4px rgba(255, 58, 58, 0.95), 0 0 10px rgba(255, 58, 58, 0.6);
  box-shadow:
    0 0 6px rgba(255, 58, 58, 0.9),
    0 0 14px rgba(255, 58, 58, 0.55),
    0 0 28px rgba(255, 58, 58, 0.35),
    inset 0 0 6px rgba(255, 58, 58, 0.35);
}
.brand-mark-sm {
  width: 38px; height: 38px; border-radius: 7px;
  font-size: .75rem; border-width: 1.5px;
}
.header-nav { display: flex; align-items: center; gap: 12px; flex-wrap: nowrap; }
.header-nav input[type="search"] {
  background: var(--bg-elev); border: 1px solid var(--border);
  color: var(--text); padding: 8px 12px; border-radius: 10px;
  min-width: 260px; outline: none;
}
.header-nav input[type="search"]:focus { border-color: var(--accent); }

/* ===== Login ===== */
.login-body { display: grid; place-items: center; min-height: 100vh; }
.login-wrapper { width: 100%; max-width: 420px; padding: 24px; }
.login-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
}
.login-card .brand { text-align: center; margin-bottom: 24px; }
.login-card .brand-mark { margin: 0 auto 14px; width: 64px; height: 64px; border-radius: 16px; font-size: 1.1rem; }
.login-card h1 { font-size: 1.4rem; margin: 0; }
.login-card .tagline { color: var(--text-muted); margin-top: 6px; font-size: .9rem; }
.login-form label { display: block; margin-bottom: 14px; }
.login-form label span { display: block; font-size: .85rem; color: var(--text-muted); margin-bottom: 6px; }
.login-form input {
  width: 100%; padding: 11px 12px; border-radius: 10px;
  background: var(--bg-elev-2); border: 1px solid var(--border);
  color: var(--text); outline: none;
}
.login-form input:focus { border-color: var(--accent); }
.note { color: var(--text-muted); font-size: .8rem; text-align: center; margin-top: 12px; }
.skip-link { display: block; text-align: center; margin-top: 6px; font-size: .85rem; }
.login-footer { text-align: center; color: var(--text-muted); font-size: .8rem; margin-top: 16px; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 16px; border-radius: 10px;
  background: var(--bg-elev-2); color: var(--text);
  border: 1px solid var(--border);
  cursor: pointer; font-weight: 600; font-size: .92rem;
  white-space: nowrap; flex-shrink: 0;
  transition: transform .04s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { text-decoration: none; border-color: #3a3f55; }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent-2), #b91c1c);
  border-color: transparent; color: white;
}
.btn-primary:hover { filter: brightness(1.07); }
.btn-translucent { opacity: 0.75; }
.btn-translucent:hover { opacity: 1; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 7px 12px; font-size: .85rem; }
.btn-tiny { padding: 4px 9px; font-size: .78rem; border-radius: 8px; }
.btn-block { display: block; width: 100%; }

/* ===== Gallery ===== */
.main-content { padding: 32px 0 80px; }
.page-intro { margin-bottom: 28px; }
.page-intro h1 { font-size: 1.8rem; }

.card-grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.app-card {
  display: flex; flex-direction: column; gap: 14px;
  background: rgba(22, 24, 33, 0.5);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border: 1px solid rgba(239, 68, 68, 0.5);
  border-radius: var(--radius);
  padding: 18px;
  color: var(--text);
  transition: transform .12s ease, border-color .15s ease, box-shadow .15s ease;
}
.app-card:hover {
  text-decoration: none; transform: translateY(-2px);
  border-color: rgba(255, 107, 107, 0.5);
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.18), 0 8px 24px rgba(0, 0, 0, 0.45);
}
.app-icon {
  width: 56px; height: 56px; border-radius: 14px;
  display: grid; place-items: center;
  font-size: 28px;
}
.app-icon-lg { width: 84px; height: 84px; border-radius: 18px; font-size: 40px; }
.app-card h3 { font-size: 1.05rem; margin: 0; }
.app-desc { color: var(--text-muted); font-size: .92rem; margin-top: 6px; }
.app-card-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: auto;
}
.empty-state { text-align: center; padding: 60px 0; color: var(--text-muted); }

/* ===== Gallery layout with side feed ===== */
.gallery-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 22px;
  align-items: start;
}
.gallery-side .feed-section { position: sticky; top: 88px; max-height: calc(100vh - 110px); overflow-y: auto; }
@media (max-width: 980px) {
  .gallery-layout { grid-template-columns: 1fr; }
  .gallery-side .feed-section { position: static; max-height: none; }
}

.feed-list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 8px;
}
.feed-item {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px;
}
.feed-icon {
  width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center; font-size: 18px;
  flex-shrink: 0;
}
.feed-icon-user {
  background: rgba(52, 211, 153, 0.14); color: #6ee7b7;
}
.feed-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.feed-line { font-size: .9rem; line-height: 1.3; }
.feed-line a { color: var(--text); text-decoration: underline; text-decoration-color: rgba(239, 68, 68, 0.5); }
.feed-notes {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-style: italic;
}
.feed-empty { padding: 8px 4px; }
.feed-time { white-space: nowrap; }

/* ===== Badges ===== */
.badge {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  background: var(--bg-elev-2); color: var(--text-muted);
  border: 1px solid var(--border); font-size: .75rem;
}
.badge-danger { background: rgba(248, 113, 113, 0.12); color: #fca5a5; border-color: rgba(248, 113, 113, 0.25); }
.badge-info { background: rgba(239, 68, 68, 0.14); color: #fca5a5; border-color: rgba(239, 68, 68, 0.3); }
.status-Open { background: rgba(245, 158, 11, 0.12); color: #fcd34d; border-color: rgba(245, 158, 11, 0.25); }
.status-In-Progress { background: rgba(124, 92, 255, 0.15); color: #c4b5fd; border-color: rgba(124, 92, 255, 0.3); }
.status-Closed { background: rgba(52, 211, 153, 0.12); color: #6ee7b7; border-color: rgba(52, 211, 153, 0.25); }

/* ===== Product page ===== */
.product-hero {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 22px; align-items: center;
  background: rgba(22, 24, 33, 0.5);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border: 1px solid rgba(239, 68, 68, 0.5);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 22px;
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.08);
}
.product-hero h1 { font-size: 1.7rem; margin: 4px 0; }
.product-hero .lead { color: var(--text-muted); }
.hero-meta { display: flex; gap: 10px; align-items: center; margin-top: 10px; flex-wrap: wrap; }

.product-grid {
  display: grid; gap: 22px;
  grid-template-columns: minmax(0, 1fr) 320px;
}
@media (max-width: 900px) {
  .product-grid { grid-template-columns: 1fr; }
  .product-hero { grid-template-columns: auto 1fr; }
  .product-hero-actions { grid-column: 1 / -1; }
}

.card-section {
  background: rgba(22, 24, 33, 0.5);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border: 1px solid rgba(239, 68, 68, 0.5);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.08);
}
.card-section h2 {
  font-size: 1.05rem; margin: 0 0 12px;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.notes-list { margin: 0; padding-left: 18px; color: var(--text); }
.notes-list li { margin: 6px 0; }
.versions-table { width: 100%; border-collapse: collapse; }
.versions-table th, .versions-table td {
  padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--border);
  font-size: .92rem;
}
.versions-table th { color: var(--text-muted); font-weight: 600; }

.author-block { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white; font-weight: 700; display: grid; place-items: center;
}
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 10px; margin: 0; }
.kv dt { color: var(--text-muted); font-size: .85rem; }
.kv dd { margin: 0; font-size: .9rem; }

/* ===== Forms ===== */
.inline-form { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.inline-form .row { display: flex; gap: 10px; flex-wrap: wrap; }
.inline-form .row > * { flex: 1; min-width: 130px; }
.inline-form input, .inline-form textarea, .inline-form select {
  background: var(--bg-elev-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 9px;
  padding: 9px 11px; outline: none; font-family: inherit; font-size: .9rem;
}
.inline-form textarea { min-height: 84px; resize: vertical; }
.inline-form input:focus, .inline-form textarea:focus, .inline-form select:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.35);
}

/* ===== Comments & Issues ===== */
.comment, .issue {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px; margin-bottom: 10px;
}
.comment-head, .issue-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.comment p, .issue p { margin: 6px 0 0; color: var(--text); white-space: pre-wrap; }
.issue-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.issue-actions { display: flex; gap: 6px; }

/* ===== Footer ===== */
.site-footer { padding: 20px 0; border-top: 1px solid var(--border); margin-top: 40px; }

/* ===== Roles, chips, avatars ===== */
.badge-admin { background: rgba(239, 68, 68, 0.14); color: #fca5a5; border-color: rgba(239, 68, 68, 0.35); }
.badge-power { background: rgba(245, 158, 11, 0.14); color: #fcd34d; border-color: rgba(245, 158, 11, 0.35); }
.badge-standard { background: rgba(52, 211, 153, 0.14); color: #6ee7b7; border-color: rgba(52, 211, 153, 0.35); }
.badge-success { background: rgba(52, 211, 153, 0.14); color: #6ee7b7; border-color: rgba(52, 211, 153, 0.35); }
.avatar { overflow: hidden; }
.avatar-sm { width: 30px; height: 30px; font-size: .75rem; border-radius: 50%; }
.avatar-md { width: 56px; height: 56px; font-size: 1.1rem; border-radius: 50%; }
.avatar-lg { width: 80px; height: 80px; font-size: 1.6rem; border-radius: 50%; }
.avatar-xl { width: 120px; height: 120px; font-size: 2.2rem; border-radius: 50%; }
.avatar.avatar-img { background: #1f2937; padding: 0; }
.avatar.avatar-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.avatar-preset { background: #111827; padding: 0; }
.avatar.avatar-preset svg { width: 100%; height: 100%; display: block; }

/* ===== Avatar picker ===== */
.modal-wide { max-width: 720px; }
.avatar-section { margin-top: 16px; }
.avatar-section:first-of-type { margin-top: 0; }
.avatar-section-title {
  font-size: .8rem; color: var(--text-muted); letter-spacing: .3px;
  text-transform: uppercase; margin-bottom: 8px;
}
.avatar-upload { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.avatar-upload-actions { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 200px; }
.avatar-grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
}
.avatar-choice {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: var(--bg-elev-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 6px; cursor: pointer;
  color: var(--text); transition: border-color .15s ease, transform .08s ease;
}
.avatar-choice:hover { border-color: var(--accent-2); transform: translateY(-1px); }
.avatar-choice.active { border-color: var(--accent-2); box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.45); }
.avatar-choice-label { font-size: .78rem; color: var(--text-muted); }
.avatar-initials-row { display: flex; gap: 8px; align-items: center; }
.avatar-initials-row input {
  background: var(--bg-elev-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 9px; padding: 9px 11px; width: 100px; text-transform: uppercase;
  font-family: inherit; font-size: .95rem;
}
.avatar-preview-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px; background: var(--bg-elev-2);
  border: 1px solid var(--border); border-radius: 10px;
  margin-bottom: 6px;
}

/* ===== Icon (emoji) picker button + color input sizing ===== */
.icon-row { align-items: stretch; }
.icon-row > label.stacked { flex: 1; min-width: 0; }

.icon-pick-btn {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 9px;
  padding: 8px 12px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color .15s ease;
  height: 44px;
  box-sizing: border-box;
}
.icon-pick-btn:hover { border-color: var(--accent-2); }
.icon-pick-preview {
  width: 30px; height: 30px;
  display: inline-grid; place-items: center;
  font-size: 22px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  flex-shrink: 0;
}
.icon-pick-label { color: var(--text-muted); font-size: .85rem; }

.color-input {
  width: 100%;
  height: 44px;
  padding: 4px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  cursor: pointer;
  box-sizing: border-box;
}
.color-input::-webkit-color-swatch-wrapper { padding: 0; }
.color-input::-webkit-color-swatch { border: 0; border-radius: 6px; }
.color-input::-moz-color-swatch { border: 0; border-radius: 6px; }

/* ===== Emoji picker modal ===== */
.emoji-modal { max-width: 640px; }
.emoji-header {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.emoji-header h2 { margin: 0; flex-shrink: 0; }
.emoji-header input[type="search"] {
  flex: 1; min-width: 200px;
  background: var(--bg-elev-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 9px;
  padding: 9px 12px; outline: none;
}
.emoji-header input[type="search"]:focus { border-color: var(--accent-2); }
.emoji-body {
  max-height: 55vh; overflow-y: auto;
  padding-right: 4px;
}
.emoji-category { margin-bottom: 14px; }
.emoji-category-title {
  font-size: .75rem; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .5px;
  margin-bottom: 6px;
}
.emoji-grid {
  display: grid; gap: 4px;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
}
.emoji-btn {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0; height: 44px;
  font-size: 22px; cursor: pointer;
  display: grid; place-items: center;
  transition: transform .08s ease, border-color .15s ease;
}
.emoji-btn:hover { border-color: var(--accent-2); transform: translateY(-1px); }
.emoji-btn.active { border-color: var(--accent-2); box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.45); }

/* ===== Settings tab ===== */
.settings-grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.settings-list {
  list-style: none; padding: 0; margin: 12px 0 0;
  display: flex; flex-direction: column; gap: 6px;
  max-height: 360px; overflow-y: auto;
}
.settings-list li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center; gap: 10px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 9px; padding: 8px 12px;
}
.settings-add { flex-direction: row; align-items: center; margin-top: 12px; }
.settings-add input { flex: 1; }

.user-chip {
  display: flex; align-items: center; gap: 10px;
  background: transparent; border: 1px solid transparent;
  padding: 5px 12px 5px 6px; border-radius: 10px;
  color: var(--text); cursor: pointer; font-family: inherit;
  font-size: .92rem; font-weight: 600;
  white-space: nowrap; flex-shrink: 0;
  transition: border-color .15s ease, background .15s ease;
}
.user-chip:hover { border-color: var(--accent-2); background: var(--bg-elev-2); }
.user-chip[aria-expanded="true"] { border-color: var(--accent-2); background: var(--bg-elev-2); }
.user-chip-info { display: flex; flex-direction: row; align-items: center; gap: 8px; line-height: 1.15; white-space: nowrap; }
.user-chip-info strong { font-size: .9rem; white-space: nowrap; }
.user-chip-info .badge { margin: 0; align-self: center; white-space: nowrap; }
.user-chip-caret { font-size: .7rem; color: var(--text-muted); margin-left: 2px; }

/* ===== User chip dropdown ===== */
.user-chip-wrap { position: relative; }
.user-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 50;
  min-width: 260px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 8px;
  display: flex; flex-direction: column;
}
.user-menu-head {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 10px 12px;
}
.user-menu-head-info {
  display: flex; flex-direction: column; gap: 2px;
  min-width: 0;
}
.user-menu-head-info strong { font-size: .95rem; }
.user-menu-head-info .muted-sm { font-size: .8rem; line-height: 1.3; }
.user-menu-head-info .badge { margin-top: 4px; align-self: flex-start; }
.user-menu-divider {
  height: 1px; background: var(--border);
  margin: 4px 6px;
}
.user-menu-item {
  display: flex; align-items: center; gap: 10px;
  background: transparent; border: 1px solid transparent;
  color: var(--text); font: inherit; font-weight: 500;
  text-align: left; padding: 9px 10px; border-radius: 8px;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
}
.user-menu-item:hover {
  background: var(--bg-elev-2);
}
.user-menu-icon {
  width: 22px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 1rem;
}
.user-menu-danger { color: var(--danger); }
.user-menu-danger:hover { background: rgba(248, 113, 113, 0.12); }

/* ===== Login role switcher ===== */
.role-switcher {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.role-switcher-title { font-size: .8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px; }
.user-pick-list { display: flex; flex-direction: column; gap: 6px; max-height: 280px; overflow-y: auto; padding-right: 4px; }
.user-pick-group {
  font-size: .7rem; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 1px; margin: 10px 0 4px;
}
.user-pick {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  background: var(--bg-elev-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 10px; color: var(--text);
  cursor: pointer; transition: border-color .15s ease;
}
.user-pick:hover { border-color: var(--accent); }
.user-pick-info { display: flex; flex-direction: column; flex: 1; line-height: 1.2; }
.user-pick-info strong { font-size: .9rem; }

/* ===== Filters / chips ===== */
.filter-row { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.chip {
  background: var(--bg-elev); border: 1px solid var(--border);
  color: var(--text-muted); padding: 6px 12px; border-radius: 999px;
  font-size: .85rem; cursor: pointer;
}
.chip-active { background: var(--accent); border-color: transparent; color: white; }

/* ===== App card additions ===== */
.app-card-top {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
}
.app-icon-sm { width: 38px; height: 38px; font-size: 20px; border-radius: 10px; }

/* ===== Product / sections ===== */
.section-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.section-head h2 { margin: 0; padding: 0; border: 0; }
.notes-list li {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.notes-list .note-text { flex: 1; min-width: 0; }
.row-actions {
  display: inline-flex; gap: 4px;
  flex-shrink: 0;
}
.icon-btn {
  display: inline-grid; place-items: center;
  width: 28px; height: 28px;
  padding: 0; border-radius: 7px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 14px; line-height: 1;
  cursor: pointer; text-decoration: none;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.icon-btn:hover {
  border-color: var(--accent-2);
  color: var(--text);
  text-decoration: none;
}
.icon-btn-danger:hover {
  background: rgba(248, 113, 113, 0.18);
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.45);
}
.versions-table td.version-actions {
  text-align: right; white-space: nowrap;
  width: 100%;
}
.versions-table td.version-actions .icon-btn { margin-left: 4px; }
.versions-table td.version-date { white-space: nowrap; }
.soft-divider { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }
.btn-danger { background: rgba(248, 113, 113, 0.12); color: #fca5a5; border-color: rgba(248, 113, 113, 0.3); }
.btn-danger:hover { background: rgba(248, 113, 113, 0.2); border-color: rgba(248, 113, 113, 0.4); }
.btn:disabled, .btn[disabled] {
  opacity: 0.45; cursor: not-allowed;
}
.btn:disabled:hover, .btn[disabled]:hover {
  filter: none; background: rgba(248, 113, 113, 0.12); border-color: rgba(248, 113, 113, 0.3);
}

/* ===== Modals ===== */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: grid; place-items: center; z-index: 100; padding: 20px;
}
.modal {
  background: rgba(22, 24, 33, 0.5);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px;
  width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow);
}
.modal h2 { margin-top: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

/* ===== Admin tables / tabs ===== */
.admin-tabs { display: flex; gap: 6px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.tab {
  background: transparent; border: 0; color: var(--text-muted);
  padding: 10px 16px; cursor: pointer; font-weight: 600;
  border-bottom: 2px solid transparent; font-size: .92rem;
}
.tab-active { color: var(--text); border-bottom-color: var(--accent-2); }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td {
  padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle;
}
.data-table th { color: var(--text-muted); font-weight: 600; font-size: .85rem; }
.cell-app { display: flex; align-items: center; gap: 10px; }
.actions-cell { text-align: right; white-space: nowrap; }
.actions-cell > * { display: inline-block; vertical-align: middle; margin-left: 6px; }
.actions-cell > *:first-child { margin-left: 0; }

.checkbox-list {
  display: flex; flex-direction: column; gap: 6px;
  max-height: 260px; overflow-y: auto;
  background: var(--bg-elev-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px;
}
.check-row {
  display: flex; align-items: center; gap: 10px; padding: 6px 8px;
  border-radius: 8px; cursor: pointer;
}
.check-row:hover { background: rgba(255,255,255,0.03); }
.check-row input[type="checkbox"] { margin: 0; }

/* ===== Stacked labels & sized textareas in modals ===== */
.inline-form label.stacked {
  display: flex; flex-direction: column; gap: 8px;
  margin: 4px 0;
}
.inline-form label.stacked > span {
  font-size: .85rem; color: var(--text-muted); letter-spacing: .3px;
}
.inline-form label.stacked > textarea,
.inline-form label.stacked > input,
.inline-form label.stacked > select {
  margin: 0;
}
.textarea-short {
  min-height: 90px; resize: vertical;
  background: var(--bg-elev-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 9px;
  padding: 10px 12px; font-family: inherit; font-size: .92rem; outline: none;
}
.textarea-long {
  min-height: 180px; resize: vertical;
  background: var(--bg-elev-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 9px;
  padding: 10px 12px; font-family: inherit; font-size: .92rem; outline: none;
}
.textarea-short:focus, .textarea-long:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.35);
}

/* ===== File dropzone ===== */
.dropzone {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: 12px;
  background: var(--bg-elev-2);
  padding: 22px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.dropzone:hover { border-color: var(--accent); }
.dropzone-active { border-color: var(--accent); background: rgba(124, 92, 255, 0.08); }
.dropzone-inner { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.dropzone-icon { font-size: 22px; }
.dropzone-title { font-weight: 600; }
.dropzone-sub { font-size: .85rem; color: var(--text-muted); }
.dropzone-sub a { color: var(--accent); }
.dropzone-current { margin-top: 6px; }
.kv-line { margin-top: 4px; font-size: .9rem; }
.kv-line .muted-sm { margin-right: 6px; }

/* ===== Form section (fieldset) ===== */
.form-section {
  border: 1px solid rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.04);
  border-radius: 12px;
  padding: 14px 16px 18px;
  margin: 8px 0;
  display: flex; flex-direction: column; gap: 12px;
}
.form-section > legend {
  padding: 2px 10px;
  font-size: .8rem; letter-spacing: .5px;
  text-transform: uppercase;
  color: #fca5a5;
  background: var(--bg-elev);
  border: 1px solid rgba(239, 68, 68, 0.5);
  border-radius: 999px;
}
