/* Office 2010 Blue theme — local DevExpress XAF-inspired look */
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  font-size: 12px;
  color: #333;
  background: #d6e8f8;
}
a { color: #1565a8; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Login ---- */
.login-page {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #d6e8f8;
  background-image: linear-gradient(180deg, #c5dff4 0%, #d6e8f8 40%, #e8f2fb 100%);
}
.login-box {
  width: 420px;
  background: #fff;
  border: 1px solid #8eb4d4;
  box-shadow: 0 2px 8px rgba(0,60,120,.18);
  border-radius: 2px;
}
.login-header {
  background: linear-gradient(180deg, #5b9bd5 0%, #2e75b6 100%);
  color: #fff;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.login-header .lock {
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.2);
  border-radius: 3px;
  font-size: 14px;
}
.login-body { padding: 18px 22px 22px; }
.login-welcome {
  margin: 0 0 16px;
  color: #444;
  line-height: 1.45;
}
.login-field { margin-bottom: 12px; }
.login-field label {
  display: block;
  margin-bottom: 4px;
  color: #333;
  font-weight: 600;
}
.login-field input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #a0b8d0;
  border-radius: 2px;
  font-size: 12px;
  outline: none;
}
.login-field input:focus { border-color: #2e75b6; box-shadow: 0 0 0 1px #9dc3e6; }
.login-actions { margin-top: 16px; text-align: right; }
.btn {
  display: inline-block;
  padding: 5px 16px;
  border: 1px solid #7aa3c7;
  background: linear-gradient(180deg, #f5faff 0%, #d6e8f8 50%, #c5dff4 100%);
  color: #1a3a5c;
  border-radius: 2px;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
}
.btn:hover { background: linear-gradient(180deg, #fff 0%, #e8f2fb 50%, #d0e6f7 100%); }
.btn:active { background: #c5dff4; }
.btn-primary {
  background: linear-gradient(180deg, #5b9bd5 0%, #2e75b6 100%);
  border-color: #1f5a96;
  color: #fff;
  font-weight: 600;
}
.btn-primary:hover { background: linear-gradient(180deg, #6aa8de 0%, #3a85c4 100%); }
.login-error {
  background: #fff3f3;
  border: 1px solid #e0a0a0;
  color: #a03333;
  padding: 8px 10px;
  margin-bottom: 12px;
  border-radius: 2px;
}

/* ---- Shell ---- */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-height: 100%;
}
.top-bar {
  background: linear-gradient(180deg, #4a90c8 0%, #2e75b6 60%, #2468a8 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  height: 36px;
  flex-shrink: 0;
  border-bottom: 1px solid #1a5080;
}
.top-bar-left, .top-bar-right { display: flex; align-items: center; gap: 2px; }
.tb-btn {
  background: transparent;
  border: 1px solid transparent;
  color: #fff;
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
  border-radius: 2px;
  font-family: inherit;
  white-space: nowrap;
}
.tb-btn:hover {
  background: rgba(255,255,255,.15);
  border-color: rgba(255,255,255,.25);
}
.tb-btn a { color: inherit; text-decoration: none; }
.brand-chip {
  font-weight: 600;
  font-size: 12px;
  margin-right: 10px;
  opacity: .95;
}

.body-row {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ---- Left nav ---- */
.nav-pane {
  width: 220px;
  min-width: 220px;
  background: #fff;
  border-right: 1px solid #8eb4d4;
  overflow-y: auto;
  overflow-x: hidden;
  flex-shrink: 0;
}
.nav-pane-title {
  padding: 8px 10px;
  font-weight: 600;
  color: #1a5080;
  background: linear-gradient(180deg, #eef5fb 0%, #dceaf6 100%);
  border-bottom: 1px solid #b8d0e8;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.nav-tree { list-style: none; margin: 0; padding: 4px 0 12px; }
.nav-tree ul { list-style: none; margin: 0; padding: 0 0 0 14px; }
.nav-item { user-select: none; }
.nav-row {
  display: flex;
  align-items: center;
  padding: 3px 8px 3px 6px;
  cursor: pointer;
  gap: 4px;
  line-height: 18px;
  border: 1px solid transparent;
}
.nav-row:hover { background: #eef5fb; }
.nav-row.selected {
  background: #fff2b8;
  border-color: #e0c060;
}
.nav-arrow {
  width: 12px;
  height: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: #666;
  flex-shrink: 0;
}
.nav-arrow.empty { visibility: hidden; }
.nav-icon {
  width: 14px; height: 14px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  opacity: .85;
}
.nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-row a { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; }
.nav-children.collapsed { display: none; }

/* ---- Main content ---- */
.content-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #d6e8f8;
  padding: 8px;
  overflow: hidden;
}
.content-card {
  flex: 1;
  background: #fff;
  border: 1px solid #8eb4d4;
  display: flex;
  flex-direction: column;
  min-height: 0;
  box-shadow: 0 1px 3px rgba(0,60,120,.08);
}
.view-caption {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: linear-gradient(180deg, #f0f7fc 0%, #e2eef8 100%);
  border-bottom: 1px solid #b8d0e8;
  font-size: 14px;
  font-weight: 600;
  color: #1a3a5c;
}
.view-caption .cap-icon {
  width: 20px; height: 20px;
  background: #2e75b6;
  color: #fff;
  border-radius: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}
.view-body {
  flex: 1;
  overflow: auto;
  padding: 0;
  background: #fff;
}

/* ---- Grid toolbar ---- */
.grid-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 6px;
  background: linear-gradient(180deg, #f7fbfe 0%, #e8f2fb 100%);
  border-bottom: 1px solid #c5d8ea;
}
.grid-tb-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  font-family: inherit;
  color: #1a3a5c;
  border-radius: 2px;
}
.grid-tb-btn:hover {
  background: #fff;
  border-color: #8eb4d4;
}
.grid-tb-btn .ico { font-size: 12px; }

/* ---- Data grid ---- */
.data-grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.data-grid th {
  background: linear-gradient(180deg, #eef5fb 0%, #d6e8f8 100%);
  border: 1px solid #b8d0e8;
  padding: 5px 8px;
  text-align: left;
  font-weight: 600;
  color: #1a3a5c;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
.data-grid td {
  border: 1px solid #e0e8f0;
  padding: 4px 8px;
  vertical-align: middle;
}
.data-grid tr:nth-child(even) td { background: #f7fbfe; }
.data-grid tr:hover td { background: #fff8dc; }
.data-grid tr.selected td {
  background: #fff2b8 !important;
}
.data-grid .filter-row td {
  background: #fffef5;
  padding: 2px 4px;
}
.data-grid .filter-row input {
  width: 100%;
  border: 1px solid #c5d8ea;
  padding: 2px 4px;
  font-size: 11px;
  font-family: inherit;
}
.grid-wrap { overflow: auto; flex: 1; }
.empty-hint {
  padding: 40px 20px;
  text-align: center;
  color: #888;
  font-size: 13px;
}
.welcome-panel {
  padding: 24px;
  color: #444;
  line-height: 1.6;
}
.welcome-panel h2 { margin: 0 0 8px; color: #1a3a5c; font-size: 18px; }
.quick-search-panel {
  padding: 20px;
  min-height: 200px;
}

/* ---- Footer ---- */
.app-footer {
  height: 24px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #e2eef8 0%, #c5dff4 100%);
  border-top: 1px solid #8eb4d4;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 12px;
  font-size: 11px;
  color: #1a5080;
  gap: 8px;
}
.app-footer .sep { color: #8eb4d4; }

/* ---- Modal ---- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(30,60,90,.35);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: #fff;
  border: 1px solid #8eb4d4;
  box-shadow: 0 4px 20px rgba(0,40,80,.25);
  width: 440px;
  max-width: 94vw;
  border-radius: 2px;
}
.modal-header {
  background: linear-gradient(180deg, #5b9bd5 0%, #2e75b6 100%);
  color: #fff;
  padding: 8px 12px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
}
.modal-body { padding: 14px 16px; }
.modal-footer {
  padding: 8px 16px 14px;
  text-align: right;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.form-row { margin-bottom: 10px; }
.form-row label {
  display: block;
  margin-bottom: 3px;
  font-weight: 600;
  color: #333;
}
.form-row input, .form-row textarea, .form-row select {
  width: 100%;
  padding: 5px 7px;
  border: 1px solid #a0b8d0;
  font-size: 12px;
  font-family: inherit;
  border-radius: 2px;
}
.form-row textarea { min-height: 60px; resize: vertical; }

.modal.modal-wide { width: 820px; }
.modal-body { max-height: min(70vh, 640px); overflow: auto; }
.form-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border-bottom: 1px solid #8eb4d4;
  margin: 0 0 12px;
}
.form-tab {
  border: 1px solid transparent;
  border-bottom: none;
  background: linear-gradient(180deg, #f5faff 0%, #d6e8f8 100%);
  color: #1a3a5c;
  padding: 6px 10px;
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  margin-right: 2px;
  border-radius: 3px 3px 0 0;
}
.form-tab.active {
  background: #fff;
  border-color: #8eb4d4;
  font-weight: 600;
  position: relative;
  top: 1px;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 16px;
}
.form-span { grid-column: 1 / -1; }
.form-row.form-check label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
.form-row.form-check input { width: auto; }
.data-grid td a { font-weight: 600; }
@media (max-width: 700px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-span { grid-column: auto; }
}

/* read-only / auto-generated fields in the legacy Contacts forms (lockno 2026-10-06) */
.form-row input[readonly] { background: #E4E7EB; color: #555; border-color: #B9C2CC; cursor: not-allowed; }
