:root {
  --bg: #101012;
  --surface: #0e0e10;
  --surface2: #1e1e22;
  --elevated: #2a2a30;
  --panel-bg: #1e1e22;
  --border: #3a3a42;
  --divider: #2a2a30;
  --text: #f2f2f5;
  --text-strong: #ffffff;
  --muted: #9a9aa8;
  --brand: #4caf50;
  --accent: #4a76e9;
  --danger: #e74c3c;
  --input-bg: #28282e;
  --input-border: #454550;
  --card-bg: #2a2a30;
  --content-bg: #18181c;
  --sidebar-bg: #0e0e10;
  --sidebar-text: #e0e0e0;
  --sidebar-muted: #9a9a9a;
  --sidebar-hover: #242428;
  --sidebar-active: #4a76e9;
  --sidebar-active-text: #ffffff;
  --sidebar-divider: #2a2a2a;
  --primary-btn-bg: #4a76e9;
  --primary-btn-hover: #3d66d4;
  --primary-btn-text: #ffffff;
  --secondary-btn-bg: #4caf50;
  --secondary-btn-hover: #43a047;
  --secondary-btn-text: #ffffff;
  --tertiary-bg: #2a2a30;
  --tertiary-hover: #34343c;
  --accent-btn-bg: #4a76e9;
  --accent-btn-text: #ffffff;
  --tab-bg: #1e1e22;
  --tab-active: #4a76e9;
  --tab-hover: #242428;
  --focus-ring: #4a76e9;
  --table-bg: #1c1c21;
  --table-grid: #3a3a42;
  --radius: 10px;
  --font: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.hidden { display: none !important; }

.view { min-height: 100vh; }

/* Login */
#login-view {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px 32px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.login-divider {
  border: none;
  border-top: 2px solid var(--border);
  margin: 0 0 14px;
  opacity: 0.65;
}

.login-logo-wrap {
  min-height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.login-logo {
  display: block;
  max-height: 110px;
  max-width: 100%;
  object-fit: contain;
}

.login-logo-fallback {
  font-size: 1.05rem;
  font-weight: 600;
  text-align: center;
  color: var(--brand);
  padding: 0 8px;
  line-height: 1.35;
}

.login-title {
  margin: 0 0 20px;
  text-align: center;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--brand);
  line-height: 1.3;
}

.login-card input[type="text"],
.login-card input[type="password"] {
  margin-bottom: 10px;
}

label {
  display: block;
  margin: 12px 0 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
}

textarea { font-family: Consolas, monospace; font-size: 0.9rem; }
#theme-json { min-height: 360px; margin-top: 12px; max-width: 640px; width: 100%; box-sizing: border-box; }
#sysinfo-ini { min-height: 280px; margin-top: 8px; max-width: 900px; width: 100%; box-sizing: border-box; }

.btn {
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  padding: 9px 14px;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  filter: brightness(1.06);
  border-color: var(--focus-ring);
}

.btn.primary:hover:not(:disabled) {
  background: var(--primary-btn-hover);
  border-color: var(--primary-btn-hover);
  filter: none;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn.primary {
  background: var(--primary-btn-bg);
  border-color: var(--primary-btn-bg);
  color: var(--primary-btn-text);
  font-weight: 600;
}
.btn.brand {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.btn.accent {
  background: var(--accent-btn-bg);
  border-color: var(--accent-btn-bg);
  color: var(--accent-btn-text);
}
.btn.danger { background: rgba(231, 76, 60, 0.2); border-color: var(--danger); color: #ffb4ad; }
.btn.link { background: transparent; border: none; color: var(--accent); width: 100%; margin-top: 12px; }
.btn.ghost {
  background: transparent;
  width: 100%;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-start;
}
.btn.icon-btn { background: transparent; border: none; font-size: 1.4rem; padding: 4px 10px; }
#btn-login { width: 100%; margin-top: 20px; }

.alert {
  background: rgba(231, 76, 60, 0.15);
  border: 1px solid var(--danger);
  color: #ffb4ad;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 0.9rem;
}

.success-msg { color: var(--brand); }

/* App shell */
#app-view {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  color: var(--sidebar-text);
}

.brand { font-weight: 700; font-size: 1.05rem; color: var(--brand); margin-bottom: 4px; }

.sidebar-divider {
  border: none;
  border-top: 2px solid var(--border);
  margin: 0 0 16px;
  opacity: 0.65;
}

.sidebar-sub { margin: 0 0 16px; font-size: 0.8rem; color: var(--sidebar-muted); }

.nav-item, .nav-group {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  margin-bottom: 3px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--sidebar-text);
  cursor: pointer;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  min-height: 40px;
}

.nav-item:hover, .nav-group:hover {
  background: var(--sidebar-hover);
  border-color: var(--sidebar-divider);
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  object-fit: contain;
}

.nav-label { flex: 1; }
.nav-toggle { color: var(--sidebar-muted); font-size: 0.85rem; }

.nav-sub {
  margin: 4px 0 10px 16px;
  padding-left: 20px;
  border-left: 2px solid var(--sidebar-divider);
}

.nav-item.sub {
  padding: 8px 10px 8px 4px;
  font-size: 0.86rem;
  min-height: 36px;
}

.nav-group { color: var(--sidebar-text); font-weight: 600; }
.nav-item.active {
  background: var(--sidebar-active);
  color: var(--sidebar-active-text);
  border-color: var(--sidebar-active);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
}

/* icon_dark on colored active btn -> white; icon_light -> no filter */
body[data-icon-variant="dark"] .nav-item.active .nav-icon {
  filter: brightness(0) invert(1);
}
body[data-icon-variant="light"] .nav-item.active .nav-icon {
  filter: none;
}

.nav-group .nav-icon,
.nav-item:not(.active) .nav-icon {
  filter: none;
}

.btn.ghost .nav-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.settings-note {
  margin: 0 0 14px;
  line-height: 1.5;
}

.field-with-btn {
  display: flex;
  gap: 8px;
  align-items: center;
}

.field-with-btn input {
  flex: 1;
  min-width: 0;
}

.field-with-btn .btn {
  flex-shrink: 0;
  white-space: nowrap;
}

.nav-label.emoji {
  font-family: "Segoe UI Emoji", "Segoe UI", system-ui, sans-serif;
}
.nav-item:hover:not(.active), .nav-group:hover { background: var(--sidebar-hover); }

/* Footer — match AP/AR / desktop sidebar_footer_card */
.sidebar-footer {
  margin-top: auto;
  padding: 8px 6px 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: none;
  font-size: 0.85rem;
}
.sidebar-footer-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 6px 2px;
  border: none;
}
.sidebar-user-box {
  margin: 0 auto;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  text-align: left;
  min-width: 70%;
  font-size: 0.82rem;
  line-height: 1.35;
  color: var(--text);
}
.sidebar-user-box #role-label {
  color: var(--muted);
  margin-top: 2px;
}
.sidebar-footer .btn {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  font-size: 0.88rem;
}

.content {
  padding: 24px 28px;
  overflow-y: auto;
  max-height: 100vh;
  background: var(--content-bg);
  color: var(--text);
}
.page h2 { margin: 0 0 16px; }
.page h3 { margin: 0 0 12px; font-size: 1rem; color: var(--muted); }

.hint { margin-top: 10px; color: var(--muted); font-size: 0.88rem; }

.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  align-items: center;
}

.toolbar.toolbar-project {
  flex-wrap: nowrap;
}

.toolbar.toolbar-project .btn {
  min-height: 38px;
  padding: 8px 12px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.toolbar.toolbar-project .toolbar-search {
  margin-left: auto;
  flex: 0 1 220px;
}

.toolbar select { max-width: 240px; width: auto; }
.settings-form-grid .settings-field-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.settings-form-grid .settings-field-row input[type="text"] {
  flex: 1 1 180px;
  min-width: 0;
}

.settings-form-grid .settings-color-pick {
  width: 42px;
  height: 36px;
  padding: 2px;
  flex-shrink: 0;
}

.settings-dir-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.settings-dir-list li {
  border-bottom: 1px solid var(--border);
}

.settings-dir-list li:last-child {
  border-bottom: none;
}

.settings-dir-list .btn.link {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  background: transparent;
  border: none;
  color: var(--text);
}

.settings-dir-list .btn.link:hover {
  background: var(--surface2);
}

.server-browse-crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin: 8px 0 12px;
  padding: 8px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
}

.server-browse-crumbs .btn.link {
  padding: 2px 6px;
  font-size: 0.85rem;
}

.server-crumb-sep {
  color: var(--muted);
}

.server-browse-list .btn.link {
  width: 100%;
  text-align: left;
}

.settings-form-grid .settings-theme-select {
  max-width: 220px;
}

.toolbar-search {
  margin-left: auto;
  min-width: 220px;
  max-width: 320px;
  flex: 1 1 220px;
}

.panel, .card {
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.12);
}

.panel { max-width: 640px; }

.status-list { margin: 0; }
.status-list dt { color: var(--muted); margin-top: 10px; font-size: 0.85rem; }
.status-list dd { margin: 4px 0 0; font-size: 1rem; }

/* Tables */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th { background: var(--surface2); color: var(--muted); font-weight: 600; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: rgba(52, 152, 219, 0.08); }
tbody tr.selected { background: rgba(46, 204, 113, 0.12); }
tbody tr.deleted td:first-child { color: var(--danger); }
tbody tr.archived td:first-child { color: var(--muted); font-style: italic; }
.btn.toggle-on {
  background: rgba(52, 152, 219, 0.25);
  border-color: var(--accent);
  color: var(--accent);
}

/* Tabs (settings) */
.tabs { margin-top: 8px; }
.tab-bar {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.tab-btn {
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
}

.tab-btn.active { background: var(--surface2); color: var(--text); border-color: var(--border); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.form-grid {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 10px 16px;
  align-items: center;
  max-width: 720px;
}

.settings-form-grid {
  max-width: 640px;
}

.settings-form-grid select,
.settings-form-grid input[type="text"] {
  max-width: 360px;
  width: 100%;
}

.form-grid.compact { max-width: 100%; }
.form-grid.two-col { max-width: 560px; }
.form-grid label { margin: 0; }

/* Launcher */
.launcher-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.launcher-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: left;
  cursor: pointer;
  color: var(--text);
  font: inherit;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.launcher-card:hover { border-color: var(--brand); }
.launcher-card.is-soon,
.launcher-card:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  border-style: dashed;
}
.launcher-title { display: block; font-weight: 600; }
.launcher-desc { display: block; font-size: 0.85rem; color: var(--muted); }

/* Total Dashboard command hub */
.hub-project-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin-bottom: 16px;
}
.hub-project-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 160px;
}
.hub-project-main .hub-k {
  font-size: 0.8rem;
  color: var(--muted);
}
.hub-project-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  flex: 1;
}
.hub-sep { color: var(--muted); }
.hub-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.hub-kpi {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-align: left;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 96px;
}
.hub-kpi:hover:not(.is-soon) { border-color: var(--accent); }
.hub-kpi.is-soon {
  cursor: default;
  opacity: 0.65;
  border-style: dashed;
}
.hub-kpi-title {
  font-size: 0.85rem;
  color: var(--muted);
}
.hub-kpi-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.1;
}
.hub-kpi-sub {
  font-size: 0.8rem;
  color: var(--muted);
}
.hub-section { margin-bottom: 16px; }
.hub-section .panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.hub-section .panel-head h3 { margin: 0; }
.hub-launcher { margin-top: 8px; }
#hub-inbox-table tbody tr.hub-inbox-row { cursor: pointer; }
#hub-inbox-table tbody tr.hub-inbox-row:hover { background: rgba(74, 118, 233, 0.12); }
#hub-inbox-table tbody tr.is-disabled {
  cursor: default;
  opacity: 0.55;
}
#hub-inbox-table tbody tr.is-disabled:hover { background: transparent; }

@media (max-width: 960px) {
  .hub-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .hub-kpi-grid { grid-template-columns: 1fr; }
}

/* Theme editor (match desktop layout) */
.page-divider {
  border: none;
  border-top: 2px solid var(--border);
  margin: 0 0 20px;
}

.theme-editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 640px) 300px;
  gap: 24px;
  align-items: start;
  max-width: 980px;
}

.theme-left {
  min-width: 0;
  max-width: 640px;
}

.theme-field-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.theme-color-row {
  display: grid;
  grid-template-columns: 96px 10px 170px auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  max-width: 460px;
}

.theme-field-row .btn {
  width: auto;
  min-width: 0;
  white-space: nowrap;
}

.theme-key { color: var(--muted); font-size: 0.9rem; }
.theme-colon { color: var(--muted); }

.theme-select { max-width: 220px; width: 100%; }
.theme-color-input {
  max-width: 170px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 6px;
}

.btn.pick-btn {
  min-width: 0;
  width: auto;
  padding: 5px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  background: var(--accent-btn-bg);
  border-color: var(--accent-btn-bg);
  color: var(--accent-btn-text);
}

.btn.pick-btn:hover:not(:disabled) {
  background: var(--primary-btn-hover);
  border-color: var(--primary-btn-hover);
  filter: none;
}

.theme-color-grid { margin: 16px 0; max-width: 460px; }

#theme-json {
  min-height: 300px;
  margin-top: 8px;
  font-family: Consolas, monospace;
  font-size: 0.9rem;
  max-width: 640px;
  width: 100%;
  box-sizing: border-box;
}

.theme-preview-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  min-height: 440px;
  background: var(--surface2);
}

.theme-preview-shell {
  display: block;
  min-height: 400px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.theme-preview-panel {
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 400px;
  border: none;
  background: #ffffff;
  color: #000000;
}

.theme-preview-panel .preview-input {
  margin-top: 4px;
  background: #ffffff;
  color: inherit;
  border: 1px solid #b8b8b8;
}

.pv-title {
  text-align: center;
  font-weight: 600;
  font-size: 1rem;
}

.pv-divider {
  border: none;
  border-top: 2px solid currentColor;
  opacity: 0.25;
  margin: 4px 0 8px;
}

.pv-btn {
  width: 100%;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  font: inherit;
  cursor: default;
}

.theme-footer {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

@media (max-width: 900px) {
  .theme-editor-layout { grid-template-columns: 1fr; }
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 { margin: 0; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; min-height: 0; }
.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.modal-footer .btn {
  width: auto;
  min-width: 120px;
  margin-top: 0;
  justify-content: center;
}

.modal.modal-wide .modal-footer {
  justify-content: center;
  gap: 12px;
}

.modal.modal-wide .modal-footer .btn {
  min-width: 140px;
}

.modal.modal-wide {
  max-width: 920px;
}

.vendor-select-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.vendor-filter-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1.4fr auto;
  gap: 8px;
  align-items: center;
}

.vendor-filter-row select,
.vendor-filter-row input {
  width: 100%;
  min-width: 0;
}

.vendor-dual-list {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: stretch;
}

.vendor-list-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.vendor-list-title {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.vendor-list-box {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  min-height: 260px;
  max-height: 320px;
  overflow-y: auto;
  padding: 4px 0;
  text-align: left;
}

.vendor-list-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  margin: 0;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--text);
  text-align: left;
  width: 100%;
  box-sizing: border-box;
  cursor: pointer;
}

.vendor-list-item:last-child {
  border-bottom: none;
}

/* Override global `input { width: 100% }` — was stretching checkboxes */
.vendor-list-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-width: 16px;
  max-width: 16px;
  margin: 0;
  padding: 0;
  flex: 0 0 16px;
  accent-color: var(--primary-btn-bg, #4a76e9);
}

.vendor-list-item span {
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.vendor-list-actions {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}

.vendor-list-actions .btn {
  width: 120px;
  justify-content: center;
}

.vendor-list-empty {
  margin: 8px 10px;
  text-align: left;
}

.modal .form-grid { max-width: 100%; }

.modal.modal-project {
  max-width: 720px;
  max-height: 88vh;
}

.modal.modal-project .modal-body {
  max-height: min(62vh, 520px);
}

.modal.modal-project .modal-footer {
  justify-content: center;
  gap: 12px;
}

.modal.modal-project .modal-footer .btn {
  min-width: 140px;
  justify-content: center;
}

.project-form-grid {
  display: grid;
  grid-template-columns: 148px 1fr auto;
  gap: 10px 12px;
  align-items: center;
}

.project-form-grid .btn {
  white-space: nowrap;
  width: auto;
  min-width: 0;
  padding: 9px 12px;
  font-size: 0.88rem;
}

.project-form-grid label.pf-label {
  margin: 0;
  padding: 9px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.88rem;
  color: var(--muted);
}

.project-form-grid .pf-span2 {
  grid-column: 2 / 4;
}

.project-form-grid textarea {
  min-height: 72px;
  resize: vertical;
  font: inherit;
}

.project-form-grid input,
.project-form-grid select,
.project-form-grid textarea {
  width: 100%;
}

.pf-attachments-list {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  max-height: 160px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface2);
}

.pf-attachments-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}

.pf-attachments-list li:last-child {
  border-bottom: none;
}

.pf-att-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.pf-att-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  cursor: pointer;
}

.pf-att-row input[type="checkbox"] {
  flex-shrink: 0;
  width: auto;
}

.pf-att-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}

.pf-att-hint {
  margin: 6px 0 0;
  font-size: 0.82rem;
}

.btn.small {
  padding: 6px 12px;
  font-size: 0.82rem;
  min-width: 0;
  font-weight: 600;
}

.btn.small.settings-browse-folder,
.btn.small.settings-browse-logo,
.btn.small.settings-pick-color {
  background: var(--secondary-btn-bg);
  border-color: var(--secondary-btn-bg);
  color: var(--secondary-btn-text);
}

.btn.small.settings-browse-folder:hover:not(:disabled),
.btn.small.settings-browse-logo:hover:not(:disabled),
.btn.small.settings-pick-color:hover:not(:disabled) {
  background: var(--secondary-btn-hover);
  border-color: var(--secondary-btn-hover);
  filter: none;
}

.sysinfo-panel { max-width: 640px; margin-bottom: 20px; }

.sysinfo-grid {
  grid-template-columns: 140px 1fr;
}

.sysinfo-value {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  font-size: 0.95rem;
}

/* Module launcher popup */
.module-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 99999;
  display: flex;
  padding: 12px;
}

body.module-open #app-view {
  pointer-events: none;
}

.module-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 0;
}

.module-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.module-header h3 { margin: 0; font-size: 1rem; }

.module-frame {
  flex: 1;
  width: 100%;
  border: none;
  min-height: calc(100vh - 72px);
  background: var(--content-bg);
}

@media (max-width: 900px) {
  #app-view { grid-template-columns: 1fr; }
  .sidebar { max-height: none; }
  .theme-editor-grid { grid-template-columns: 1fr; }
}
