* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-size: 12px;
  color: #222;
  background: #e8e8e8;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ============ LOGIN SCREEN ============ */
.login-screen {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: url('bg.jpeg') center/cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.login-screen::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255,255,255,0.7);
}

.login-screen.hidden {
  display: none;
}

.login-card {
  position: relative;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  width: 360px;
  overflow: hidden;
}

.login-logo {
  background: #fff;
  text-align: center;
  padding: 16px 20px 8px;
  border-radius: 6px 6px 0 0;
}

.login-logo img {
  max-width: 180px;
  height: auto;
}

.login-header {
  background: linear-gradient(to bottom, #e8863a, #d4702a);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  padding: 16px 20px;
  text-align: center;
  letter-spacing: 0.3px;
}

.login-body {
  padding: 24px 28px 20px;
}

.login-field {
  margin-bottom: 14px;
}

.login-field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #555;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.login-input {
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  border: 1px solid #bbb;
  border-radius: 3px;
  background: #fafafa;
  transition: border-color 0.2s;
}

.login-input:focus {
  border-color: #e8863a;
  outline: none;
  box-shadow: 0 0 0 2px rgba(232,134,58,0.2);
  background: #fff;
}

.login-options {
  margin-bottom: 12px;
}

.login-remember {
  font-size: 11px;
  color: #666;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

.login-error {
  background: #fef0f0;
  border: 1px solid #f5c6c6;
  color: #c0392b;
  font-size: 11px;
  padding: 8px 10px;
  border-radius: 3px;
  margin-bottom: 12px;
  text-align: center;
}

.login-error.hidden {
  display: none;
}

.login-btn {
  width: 100%;
  padding: 10px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(to bottom, #e8863a, #d4702a);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.login-btn:hover {
  opacity: 0.9;
}

.login-btn:active {
  opacity: 0.8;
}

.login-footer {
  padding: 10px;
  text-align: center;
  font-size: 10px;
  color: #999;
  background: #f8f8f8;
  border-top: 1px solid #eee;
}

/* Toolbar (title bar) */
.toolbar {
  background: linear-gradient(to bottom, #e8863a, #d4702a);
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px;
  height: 28px;
  user-select: none;
}

.toolbar-title {
  font-size: 12px;
  font-weight: 600;
}

.toolbar-actions {
  display: flex;
  gap: 2px;
}

.toolbar-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  width: 24px;
  height: 20px;
  cursor: pointer;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
}

.toolbar-btn:hover {
  background: rgba(255,255,255,0.2);
}

.toolbar-btn.close:hover {
  background: #e04343;
}

/* Menu bar */
.menubar {
  background: #f0f0f0;
  border-bottom: 1px solid #ccc;
  display: flex;
  padding: 2px 4px;
  gap: 0;
  position: relative;
  z-index: 100;
}

.menu-item-wrap {
  position: relative;
}

.menu-item {
  padding: 3px 10px;
  cursor: pointer;
  border-radius: 2px;
  display: inline-block;
}

.menu-item:hover,
.menu-item-wrap.open .menu-item {
  background: #d0d0f0;
}

.menu-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #f8f8f8;
  border: 1px solid #999;
  box-shadow: 2px 2px 6px rgba(0,0,0,0.2);
  min-width: 180px;
  z-index: 200;
  padding: 2px 0;
}

.menu-item-wrap.open .menu-dropdown {
  display: block;
}

.menu-dropdown-item {
  padding: 4px 20px;
  cursor: pointer;
  font-size: 11px;
  white-space: nowrap;
}

.menu-dropdown-item:hover {
  background: #e8863a;
  color: #fff;
}

.menu-dropdown-item.disabled {
  color: #999;
  cursor: default;
}

.menu-dropdown-item.disabled:hover {
  background: transparent;
  color: #999;
}

.menu-dropdown-sep {
  height: 1px;
  background: #ccc;
  margin: 3px 4px;
}

/* Module navigation */
.module-nav {
  background: #f8f8f8;
  border-bottom: 1px solid #ccc;
  display: flex;
  padding: 4px 6px;
  gap: 2px;
  flex-wrap: wrap;
}

.module-btn {
  background: #e8e8e8;
  border: 1px solid #bbb;
  border-radius: 3px;
  padding: 4px 12px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  color: #333;
  transition: background 0.15s;
}

.module-btn:hover {
  background: #d0e0ff;
  border-color: #88a;
}

.module-btn.active {
  background: #4a8af4;
  color: #fff;
  border-color: #3570cc;
}

/* Action bar */
.action-bar {
  background: #f4f4f4;
  border-bottom: 1px solid #ccc;
  display: flex;
  align-items: center;
  padding: 4px 8px;
  gap: 6px;
  flex-wrap: wrap;
}

.action-btn {
  background: linear-gradient(to bottom, #fafafa, #e4e4e4);
  border: 1px solid #aaa;
  border-radius: 3px;
  padding: 3px 10px;
  cursor: pointer;
  font-size: 11px;
  color: #333;
}

.action-btn:hover {
  background: linear-gradient(to bottom, #e4e4e4, #d0d0d0);
}

.action-separator {
  width: 1px;
  height: 20px;
  background: #ccc;
  margin: 0 4px;
}

.search-input {
  border: 1px solid #aaa;
  border-radius: 2px;
  padding: 3px 6px;
  font-size: 11px;
  width: 200px;
}

.filter-select {
  border: 1px solid #aaa;
  border-radius: 2px;
  padding: 3px 4px;
  font-size: 11px;
  background: #fff;
}

.search-icon {
  color: #e8863a;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
}

.search-icon:hover {
  text-decoration: underline;
}

/* Main content */
.main-content {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Left list panel */
.list-panel {
  width: 45%;
  min-width: 350px;
  border-right: 2px solid #bbb;
  overflow: auto;
  background: #fff;
}

.record-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.record-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

.record-table th {
  background: linear-gradient(to bottom, #f8f8f8, #e0e0e0);
  border: 1px solid #ccc;
  padding: 4px 6px;
  text-align: left;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}

.record-table th:hover {
  background: linear-gradient(to bottom, #e0e0f0, #c8c8d8);
}

.record-table td {
  border: 1px solid #ddd;
  padding: 3px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.record-table tbody tr {
  cursor: pointer;
}

.record-table tbody tr:nth-child(even) {
  background: #f7f9fc;
}

.record-table tbody tr:hover {
  background: #d4e4ff;
}

.record-table tbody tr.selected {
  background: #e8863a;
  color: #fff;
}

.record-table tbody tr.selected td {
  border-color: #2a5ba5;
}

.col-type { width: 70px; }
.col-id { width: 50px; }
.col-company { width: 180px; }
.col-contact { width: 120px; }
.col-phone { width: 110px; }
.col-email { width: 160px; }
.col-postcode { width: 75px; }
.col-status { width: 60px; }

/* Type badges */
.type-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 2px;
  font-size: 10px;
  font-weight: 600;
}

.type-customer { background: #d4edda; color: #155724; }
.type-supplier { background: #cce5ff; color: #004085; }
.type-other { background: #fff3cd; color: #856404; }

.status-active { color: #28a745; font-weight: 600; }
.status-inactive { color: #dc3545; font-weight: 600; }

/* Right detail panel */
.detail-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #f8f8f8;
}

.detail-header {
  background: linear-gradient(to bottom, #e8f0ff, #d8e4f0);
  border-bottom: 1px solid #bbb;
  padding: 6px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 13px;
  color: #2a4a7a;
}

.detail-actions {
  display: flex;
  gap: 4px;
}

.detail-btn {
  background: linear-gradient(to bottom, #fafafa, #e4e4e4);
  border: 1px solid #aaa;
  border-radius: 3px;
  padding: 3px 10px;
  cursor: pointer;
  font-size: 11px;
}

.detail-btn:hover {
  background: linear-gradient(to bottom, #e4e4e4, #d0d0d0);
}

/* Tab navigation */
.tab-nav {
  background: #eee;
  border-bottom: 1px solid #ccc;
  display: flex;
  padding: 0;
  gap: 0;
}

.tab-btn {
  background: linear-gradient(to bottom, #e0e0e0, #d0d0d0);
  border: 1px solid #bbb;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  padding: 5px 14px;
  cursor: pointer;
  font-size: 11px;
  margin-left: 2px;
  margin-top: 3px;
  color: #444;
  font-weight: 500;
}

.tab-btn:hover {
  background: linear-gradient(to bottom, #d0d8f0, #c0c8e0);
}

.tab-btn.active {
  background: #f8f8f8;
  border-bottom: 1px solid #f8f8f8;
  color: #222;
  font-weight: 600;
  margin-bottom: -1px;
}

/* Tab content */
.tab-content {
  flex: 1;
  overflow: auto;
  padding: 0;
}

.tab-pane {
  display: none;
  padding: 12px;
}

.tab-pane.active {
  display: block;
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-grid > .form-section:last-child {
  grid-column: 1 / -1;
}

.form-section {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 10px;
}

.form-section h3 {
  font-size: 12px;
  color: #2a5ba5;
  border-bottom: 1px solid #dde;
  padding-bottom: 4px;
  margin-bottom: 8px;
}

.form-row {
  display: flex;
  align-items: center;
  margin-bottom: 6px;
  gap: 8px;
}

.form-row label {
  width: 100px;
  font-weight: 500;
  text-align: right;
  flex-shrink: 0;
  font-size: 11px;
}

.form-input {
  flex: 1;
  border: 1px solid #bbb;
  border-radius: 2px;
  padding: 3px 6px;
  font-size: 11px;
  font-family: inherit;
}

.form-input:focus {
  border-color: #e8863a;
  outline: none;
  box-shadow: 0 0 3px rgba(58,123,213,0.3);
}

.form-input-sm {
  border: 1px solid #bbb;
  border-radius: 2px;
  padding: 3px 6px;
  font-size: 11px;
  width: 130px;
}

/* Notes */
.notes-container {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 10px;
}

.notes-container h3 {
  font-size: 12px;
  color: #2a5ba5;
  margin-bottom: 4px;
}

.notes-hint {
  font-size: 10px;
  color: #888;
  margin-bottom: 8px;
  font-style: italic;
}

.notes-textarea {
  width: 100%;
  min-height: 250px;
  border: 1px solid #bbb;
  border-radius: 2px;
  padding: 6px;
  font-size: 11px;
  font-family: inherit;
  resize: vertical;
}

.notes-textarea:focus {
  border-color: #e8863a;
  outline: none;
}

/* Sub tables */
.sub-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.sub-header h3 {
  font-size: 12px;
  color: #2a5ba5;
}

.sub-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  background: #fff;
  border: 1px solid #ddd;
}

.sub-table th {
  background: linear-gradient(to bottom, #f0f0f0, #e0e0e0);
  border: 1px solid #ccc;
  padding: 4px 6px;
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
}

.sub-table td {
  border: 1px solid #ddd;
  padding: 3px 6px;
  white-space: nowrap;
}

.sub-table tbody tr:nth-child(even) {
  background: #f7f9fc;
}

.sub-table tbody tr:hover {
  background: #e8f0ff;
}

.action-btn-sm {
  background: linear-gradient(to bottom, #4a8af4, #3570cc);
  border: 1px solid #2a5ba5;
  border-radius: 3px;
  padding: 3px 10px;
  cursor: pointer;
  font-size: 11px;
  color: #fff;
  font-weight: 500;
}

.action-btn-sm:hover {
  background: linear-gradient(to bottom, #3570cc, #2a5ba5);
}

.action-btn-sm.cancel {
  background: linear-gradient(to bottom, #fafafa, #e4e4e4);
  border-color: #aaa;
  color: #333;
}

.action-btn-sm.cancel:hover {
  background: linear-gradient(to bottom, #e4e4e4, #d0d0d0);
}

.action-btn-sm.danger {
  background: linear-gradient(to bottom, #e04343, #c33);
  border-color: #a22;
}

.action-btn-sm.danger:hover {
  background: linear-gradient(to bottom, #c33, #a22);
}

/* Sub forms */
.sub-form {
  background: #fff;
  border: 1px solid #bbc;
  border-radius: 4px;
  padding: 10px;
  margin-top: 10px;
}

.sub-form h4 {
  font-size: 12px;
  color: #2a5ba5;
  margin-bottom: 8px;
  border-bottom: 1px solid #dde;
  padding-bottom: 4px;
}

.form-grid-compact {
  max-width: 500px;
}

.checkbox-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.checkbox-row label {
  width: auto;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: normal;
}

.form-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #eee;
}

/* Activity */
.activity-header {
  margin-bottom: 8px;
}

.activity-header h3 {
  font-size: 12px;
  color: #2a5ba5;
  margin-bottom: 6px;
}

.activity-filters {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* Diary filters */
.diary-filters {
  display: flex;
  gap: 12px;
  margin-bottom: 8px;
  padding: 6px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 3px;
}

.diary-filters label {
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

/* Status bar */
.statusbar {
  background: #e0e4ea;
  border-top: 1px solid #bbb;
  padding: 3px 10px;
  display: flex;
  gap: 20px;
  font-size: 11px;
  color: #555;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  background: #f8f8f8;
  border: 1px solid #888;
  border-radius: 4px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  min-width: 400px;
}

.modal-sm {
  min-width: 320px;
}

.modal-header {
  background: linear-gradient(to bottom, #e8863a, #d4702a);
  color: #fff;
  padding: 6px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 12px;
  border-radius: 4px 4px 0 0;
}

.modal-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
}

.modal-body {
  padding: 14px;
}

.modal-footer {
  padding: 8px 14px;
  border-top: 1px solid #ddd;
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

/* Utility */
.hidden {
  display: none !important;
}

.text-green { color: #28a745; }
.text-red { color: #dc3545; }
.text-blue { color: #e8863a; }
.text-orange { color: #e67e22; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 30px;
  color: #888;
  font-style: italic;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: #f0f0f0;
}

::-webkit-scrollbar-thumb {
  background: #bbb;
  border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
  background: #999;
}

/* Resizer */
.list-panel {
  position: relative;
}

/* Module stub pages */
.module-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.module-page.hidden {
  display: none !important;
}

.module-page-header {
  background: linear-gradient(to bottom, #e8f0ff, #d8e4f0);
  border-bottom: 1px solid #bbb;
  padding: 8px 14px;
  font-weight: 600;
  font-size: 14px;
  color: #2a4a7a;
}

.module-page-body {
  flex: 1;
  overflow: auto;
  background: #f0f2f5;
  display: flex;
  flex-direction: column;
  position: relative;
}

.module-stub {
  text-align: center;
  padding: 40px;
  max-width: 600px;
  margin: auto;
}

.module-stub-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.module-stub h2 {
  font-size: 20px;
  color: #2a4a7a;
  margin-bottom: 8px;
}

.module-stub p {
  color: #666;
  font-size: 13px;
  margin-bottom: 20px;
  line-height: 1.5;
}

.module-stub-features {
  text-align: left;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 14px 20px;
  margin-bottom: 20px;
}

.module-stub-features ul {
  list-style: none;
  padding: 0;
}

.module-stub-features li {
  padding: 4px 0;
  font-size: 12px;
  color: #444;
  border-bottom: 1px solid #f0f0f0;
}

.module-stub-features li:last-child {
  border-bottom: none;
}

.module-stub-features li::before {
  content: "\2714  ";
  color: #28a745;
  font-weight: bold;
}

.module-stub-stats {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-bottom: 20px;
}

.stub-stat {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 12px 24px;
  min-width: 100px;
}

.stub-stat-num {
  display: block;
  font-size: 24px;
  font-weight: 700;
  color: #e8863a;
}

.stub-stat-label {
  display: block;
  font-size: 11px;
  color: #888;
  margin-top: 2px;
}

/* About modal */
.about-content {
  text-align: center;
}

.about-content h3 {
  color: #2a5ba5;
  margin-bottom: 8px;
}

.about-content p {
  font-size: 11px;
  color: #555;
  margin-bottom: 4px;
}

/* Responsive */
@media (max-width: 900px) {
  .main-content {
    flex-direction: column;
  }
  .list-panel {
    width: 100%;
    min-width: 0;
    max-height: 30vh;
    border-right: none;
    border-bottom: 2px solid #bbb;
  }
  .detail-panel {
    min-height: 0;
    flex: 1;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .tab-nav {
    flex-wrap: wrap;
  }
  .tab-btn {
    padding: 4px 8px;
    font-size: 10px;
  }
  .module-nav {
    display: none;
  }
  .action-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
  }
}

/* Green checkmark for boolean fields */
.check-yes {
  color: #28a745;
  font-weight: bold;
}

.check-no {
  color: #ccc;
}

/* Row highlight for type-specific coloring in main table */
tr[data-type="M&E"] td:first-child,
.prefix-me { color: #e67e22; font-weight: 600; }
.prefix-unb { color: #e8863a; font-weight: 600; }

/* ===== Full Module Pages ===== */
.mod-toolbar {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 8px 12px;
  background: #f0f2f5;
  border-bottom: 1px solid #d0d3d8;
  flex-wrap: wrap;
}

.mod-toolbar button {
  padding: 5px 14px;
  font-size: 11px;
  border: 1px solid #aab;
  border-radius: 3px;
  background: linear-gradient(to bottom, #fff, #e8e8e8);
  cursor: pointer;
  white-space: nowrap;
}

.mod-toolbar button:hover {
  background: linear-gradient(to bottom, #e8f0fe, #d0d8e8);
  border-color: #88a;
}

.mod-toolbar input[type="text"] {
  padding: 4px 8px;
  font-size: 11px;
  border: 1px solid #aab;
  border-radius: 3px;
  width: 180px;
}

.mod-toolbar select {
  padding: 4px 6px;
  font-size: 11px;
  border: 1px solid #aab;
  border-radius: 3px;
}

.mod-summary {
  display: flex;
  gap: 12px;
  padding: 10px 12px;
  background: #fafbfc;
  border-bottom: 1px solid #e0e3e8;
  flex-wrap: wrap;
}

.mod-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 16px;
  background: #fff;
  border: 1px solid #dde;
  border-radius: 6px;
  min-width: 100px;
}

.mod-stat-num {
  font-size: 18px;
  font-weight: 700;
  color: #2a5db0;
}

.mod-stat-label {
  font-size: 10px;
  color: #666;
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.mod-table-wrap {
  flex: 1;
  overflow: auto;
  padding: 0;
}

.mod-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.mod-table-wrap thead {
  background: #e8ecf1;
  position: sticky;
  top: 0;
  z-index: 1;
}

.mod-table-wrap th {
  padding: 7px 10px;
  text-align: left;
  font-weight: 600;
  color: #444;
  border-bottom: 2px solid #c8cdd5;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}

.mod-table-wrap th:hover {
  background: #dce2ea;
}

.mod-table-wrap td {
  padding: 6px 10px;
  border-bottom: 1px solid #eee;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.mod-table-wrap tr:hover {
  background: #f0f4ff;
}

.mod-table-wrap tr:nth-child(even) {
  background: #fafbfc;
}

.mod-table-wrap tr:nth-child(even):hover {
  background: #f0f4ff;
}

.mod-table-wrap .edit-btn {
  padding: 2px 10px;
  font-size: 10px;
  border: 1px solid #aab;
  border-radius: 3px;
  background: #fff;
  cursor: pointer;
}

.mod-table-wrap .edit-btn:hover {
  background: #e8f0fe;
}

/* Module badge (status pills) */
.mod-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
}

/* Module form overlay */
.mod-form-wrap {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.35);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
  z-index: 500;
}

.mod-form-wrap.hidden {
  display: none;
}

.mod-form {
  background: #fff;
  border: 1px solid #999;
  border-radius: 6px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  width: 520px;
  max-width: 95vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.mod-form-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: linear-gradient(to bottom, #4a7bc7, #3a5da0);
  color: #fff;
  border-radius: 6px 6px 0 0;
  font-weight: 600;
  font-size: 13px;
}

.mod-form-header button {
  background: none;
  border: none;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}

.mod-form-header button:hover {
  color: #fcc;
}

.mod-form-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}

.mod-form-body label {
  display: block;
  font-weight: 600;
  margin-bottom: 3px;
  margin-top: 10px;
  font-size: 11px;
  color: #444;
}

.mod-form-body label:first-child {
  margin-top: 0;
}

.mod-form-body input,
.mod-form-body select,
.mod-form-body textarea {
  width: 100%;
  padding: 5px 8px;
  font-size: 11px;
  border: 1px solid #bbc;
  border-radius: 3px;
  font-family: inherit;
}

.mod-form-body textarea {
  resize: vertical;
  min-height: 60px;
}

.mod-form-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 10px 16px;
  border-top: 1px solid #ddd;
  background: #f8f9fa;
  border-radius: 0 0 6px 6px;
}

.mod-form-footer button {
  padding: 6px 18px;
  font-size: 11px;
  border: 1px solid #aab;
  border-radius: 3px;
  cursor: pointer;
}

.mod-form-footer .btn-save {
  background: linear-gradient(to bottom, #4a7bc7, #3a5da0);
  color: #fff;
  border-color: #2a4d80;
}

.mod-form-footer .btn-save:hover {
  background: linear-gradient(to bottom, #5a8bd7, #4a6db0);
}

.mod-form-footer .btn-delete {
  background: #dc3545;
  color: #fff;
  border-color: #b02a37;
}

.mod-form-footer .btn-delete:hover {
  background: #c82333;
}

.mod-form-footer .btn-cancel {
  background: linear-gradient(to bottom, #fff, #e8e8e8);
}

/* Quote line items */
.mod-items-section {
  margin-top: 12px;
  border: 1px solid #dde;
  border-radius: 4px;
  overflow: hidden;
}

.mod-items-section table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.mod-items-section th {
  background: #e8ecf1;
  padding: 5px 8px;
  text-align: left;
  font-weight: 600;
  font-size: 10px;
}

.mod-items-section td {
  padding: 4px 6px;
  border-bottom: 1px solid #eee;
}

.mod-items-section input {
  width: 100%;
  padding: 3px 6px;
  font-size: 11px;
  border: 1px solid #ccd;
  border-radius: 2px;
}

.mod-items-section .remove-item-btn {
  background: #dc3545;
  color: #fff;
  border: none;
  border-radius: 3px;
  padding: 2px 8px;
  cursor: pointer;
  font-size: 10px;
}

.mod-items-total {
  padding: 8px 12px;
  text-align: right;
  background: #f8f9fa;
  border-top: 1px solid #dde;
  font-size: 12px;
}

.module-full {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  background: #fff;
}

/* ===== Diary Scheduler ===== */
.diary-scheduler {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.diary-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* Sub-tabs */
.diary-subtabs {
  display: flex;
  background: #eee;
  border-bottom: 1px solid #ccc;
  padding: 0;
}

.diary-subtab {
  background: linear-gradient(to bottom, #e0e0e0, #d0d0d0);
  border: 1px solid #bbb;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  padding: 5px 14px;
  cursor: pointer;
  font-size: 11px;
  margin-left: 2px;
  margin-top: 3px;
  color: #444;
  font-weight: 500;
}

.diary-subtab:hover {
  background: linear-gradient(to bottom, #d0d8f0, #c0c8e0);
}

.diary-subtab.active {
  background: #f8f8f8;
  border-bottom: 1px solid #f8f8f8;
  color: #222;
  font-weight: 600;
  margin-bottom: -1px;
}

/* Toolbar rows */
.diary-toolbar {
  display: flex;
  align-items: center;
  padding: 4px 8px;
  gap: 6px;
  background: #f4f4f4;
  border-bottom: 1px solid #ddd;
  flex-wrap: wrap;
  font-size: 11px;
}

.diary-toolbar label {
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}

.diary-toolbar select,
.diary-toolbar input[type="date"] {
  padding: 2px 4px;
  font-size: 11px;
  border: 1px solid #aab;
  border-radius: 2px;
  background: #fff;
}

.diary-toolbar button {
  background: linear-gradient(to bottom, #fafafa, #e4e4e4);
  border: 1px solid #aaa;
  border-radius: 3px;
  padding: 3px 10px;
  cursor: pointer;
  font-size: 11px;
  white-space: nowrap;
}

.diary-toolbar button:hover {
  background: linear-gradient(to bottom, #e4e4e4, #d0d0d0);
}

.diary-toolbar button.active {
  background: linear-gradient(to bottom, #4a8af4, #3570cc);
  color: #fff;
  border-color: #2a5ba5;
}

.diary-toolbar .tb-sep {
  width: 1px;
  height: 18px;
  background: #ccc;
  margin: 0 2px;
}

.diary-toolbar .auto-refresh-indicator {
  display: inline-block;
  width: 30px;
  height: 14px;
  background: #4CAF50;
  border-radius: 2px;
  margin-left: 2px;
  vertical-align: middle;
}

/* Date range header */
.diary-daterange {
  text-align: center;
  padding: 4px 8px;
  background: #f0f2f5;
  border-bottom: 1px solid #ddd;
  font-weight: 600;
  font-size: 11px;
  color: #333;
}

/* Day columns header */
.diary-dayheader {
  display: grid;
  grid-template-columns: 160px repeat(7, 1fr);
  border-bottom: 2px solid #bbb;
  background: #e8ecf1;
  min-width: 900px;
}

.diary-dayheader-eng {
  padding: 6px 8px;
  font-weight: 600;
  font-size: 11px;
  border-right: 1px solid #ccc;
  background: #dde2ea;
}

.diary-dayheader-day {
  padding: 6px 4px;
  text-align: center;
  font-weight: 600;
  font-size: 11px;
  border-right: 1px solid #ccc;
  color: #333;
}

.diary-dayheader-day.weekend {
  background: rgba(128, 0, 128, 0.08);
}

.diary-dayheader-day:last-child {
  border-right: none;
}

/* Grid scroll area */
.diary-grid-wrap {
  flex: 1;
  overflow: auto;
  min-width: 900px;
}

.diary-grid {
  min-width: 900px;
}

/* Engineer row */
.diary-eng-row {
  border-bottom: 1px solid #ddd;
}

.diary-eng-header {
  display: grid;
  grid-template-columns: 160px 1fr;
  background: #f0f2f5;
  border-bottom: 1px solid #ccc;
  cursor: pointer;
  user-select: none;
}

.diary-eng-header:hover {
  background: #e4e8f0;
}

.diary-eng-name {
  padding: 4px 8px;
  font-weight: 600;
  font-size: 11px;
  color: #333;
  display: flex;
  align-items: center;
  gap: 4px;
  border-right: 1px solid #ccc;
}

.diary-eng-name .collapse-arrow {
  font-size: 8px;
  transition: transform 0.15s;
}

.diary-eng-row.collapsed .collapse-arrow {
  transform: rotate(-90deg);
}

.diary-eng-cells {
  display: grid;
  grid-template-columns: 160px repeat(7, 1fr);
  min-height: 70px;
}

.diary-eng-row.collapsed .diary-eng-cells {
  display: none;
}

.diary-eng-cell-label {
  border-right: 1px solid #ccc;
}

.diary-day-cell {
  border-right: 1px solid #eee;
  padding: 2px;
  min-height: 70px;
  position: relative;
  vertical-align: top;
}

.diary-day-cell:last-child {
  border-right: none;
}

.diary-day-cell.weekend {
  background: rgba(128, 0, 128, 0.06);
}

/* Job blocks */
.diary-block {
  margin: 2px 1px;
  padding: 2px 5px;
  border-radius: 3px;
  font-size: 10px;
  color: #fff;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  position: relative;
  border: 1px solid rgba(0,0,0,0.15);
}

.diary-block:hover {
  opacity: 0.85;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.diary-block.type-job { background: #28a745; }
.diary-block.type-contract { background: #6f42c1; }
.diary-block.type-callback { background: #fd7e14; }
.diary-block.type-meeting { background: #17a2b8; }
.diary-block.type-task { background: #ffc107; color: #333; }
.diary-block.type-general { background: #6c757d; }
.diary-block.type-cover { background: #dc3545; }

.diary-block .block-icon {
  font-size: 9px;
  margin-right: 2px;
}

/* Sidebar */
.diary-sidebar {
  width: 220px;
  border-left: 2px solid #bbb;
  display: flex;
  flex-direction: column;
  background: #f8f8f8;
  flex-shrink: 0;
}

.diary-sidebar-tabs {
  display: flex;
  border-bottom: 1px solid #ccc;
}

.diary-sidebar-tab {
  flex: 1;
  padding: 5px 8px;
  text-align: center;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: #e8e8e8;
  border-bottom: 2px solid transparent;
}

.diary-sidebar-tab.active {
  background: #f8f8f8;
  border-bottom-color: #e8863a;
  font-weight: 600;
}

.diary-sidebar-tab:hover {
  background: #e0e4f0;
}

.diary-sidebar-controls {
  padding: 6px 8px;
  border-bottom: 1px solid #ddd;
}

.diary-sidebar-controls label {
  font-size: 10px;
  font-weight: 600;
  display: block;
  margin-bottom: 3px;
}

.diary-sidebar-controls select {
  width: 100%;
  padding: 2px 4px;
  font-size: 11px;
  border: 1px solid #aab;
  border-radius: 2px;
  margin-bottom: 6px;
}

.diary-sidebar-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
}

.diary-sidebar-btns button {
  padding: 3px 4px;
  font-size: 9px;
  border: 1px solid #aab;
  border-radius: 2px;
  background: linear-gradient(to bottom, #fafafa, #e4e4e4);
  cursor: pointer;
  white-space: nowrap;
}

.diary-sidebar-btns button:hover {
  background: linear-gradient(to bottom, #e4e4e4, #d0d0d0);
}

.diary-eng-list {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.diary-eng-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-bottom: 1px solid #eee;
  font-size: 11px;
  cursor: pointer;
}

.diary-eng-item:hover {
  background: #e8f0ff;
}

.diary-eng-item input[type="checkbox"] {
  margin: 0;
}

.diary-eng-item .eng-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.diary-eng-item .eng-count {
  font-size: 10px;
  color: #666;
  margin-left: auto;
}

.diary-eng-item.highlighted {
  font-weight: 600;
}

.diary-eng-item .eng-color-bar {
  width: 4px;
  height: 16px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* ===== MONTH VIEW ===== */
.diary-month-grid {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.diary-month-header-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 2px solid #bbb;
  background: #e8ecf1;
}

.diary-month-hdr {
  padding: 6px 4px;
  text-align: center;
  font-weight: 600;
  font-size: 11px;
  border-right: 1px solid #ccc;
  color: #333;
}

.diary-month-hdr.weekend {
  background: rgba(128, 0, 128, 0.08);
}

.diary-month-hdr:last-child {
  border-right: none;
}

.diary-month-body {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  flex: 1;
}

.diary-month-cell {
  border-right: 1px solid #e0e0e0;
  border-bottom: 1px solid #e0e0e0;
  padding: 2px;
  min-height: 80px;
  background: #fff;
  overflow: hidden;
}

.diary-month-cell.empty {
  background: #f5f5f5;
}

.diary-month-cell.today {
  background: #e8f4ff;
}

.diary-month-cell.weekend {
  background: rgba(128, 0, 128, 0.04);
}

.diary-month-cell.today.weekend {
  background: #e0ecf8;
}

.diary-month-daynum {
  font-weight: 600;
  font-size: 12px;
  padding: 2px 4px;
  color: #333;
}

.diary-month-cell.today .diary-month-daynum {
  color: #fff;
  background: #e8863a;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.diary-month-entries {
  padding: 0 1px;
}

.diary-month-entries .diary-block {
  font-size: 9px;
  padding: 1px 3px;
  margin: 1px 0;
}

.diary-month-more {
  font-size: 9px;
  color: #666;
  padding: 1px 3px;
  font-style: italic;
}

/* ===== WEEK VIEW (time-based) ===== */
.diary-week-grid {
  min-width: 900px;
}

.diary-week-row {
  display: grid;
  grid-template-columns: 60px repeat(7, 1fr);
  min-height: 32px;
  border-bottom: 1px solid #eee;
}

.diary-week-time {
  padding: 4px 6px;
  font-size: 10px;
  color: #666;
  font-weight: 500;
  border-right: 1px solid #ddd;
  background: #f8f8f8;
  text-align: right;
}

.diary-week-cell {
  border-right: 1px solid #eee;
  position: relative;
  min-height: 32px;
  padding: 1px;
}

.diary-week-cell.weekend {
  background: rgba(128, 0, 128, 0.04);
}

.diary-week-block {
  position: absolute;
  left: 1px;
  right: 1px;
  top: 1px;
  z-index: 2;
  font-size: 9px;
  padding: 2px 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== DAY / WORK DAY VIEW ===== */
.diary-day-grid {
  min-width: 600px;
}

.diary-day-header-row {
  display: flex;
  border-bottom: 2px solid #bbb;
  background: #e8ecf1;
  position: sticky;
  top: 0;
  z-index: 3;
}

.diary-day-time-hdr {
  width: 60px;
  min-width: 60px;
  padding: 6px 4px;
  font-weight: 600;
  font-size: 11px;
  border-right: 1px solid #ccc;
  text-align: center;
}

.diary-day-eng-hdr {
  flex: 1;
  padding: 6px 8px;
  font-weight: 600;
  font-size: 11px;
  border-right: 1px solid #ccc;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.diary-day-eng-hdr:last-child {
  border-right: none;
}

.eng-color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.diary-day-row {
  display: flex;
  min-height: 32px;
  border-bottom: 1px solid #eee;
}

.diary-day-time {
  width: 60px;
  min-width: 60px;
  padding: 4px 6px;
  font-size: 10px;
  color: #666;
  font-weight: 500;
  border-right: 1px solid #ddd;
  background: #f8f8f8;
  text-align: right;
}

.diary-day-cell {
  flex: 1;
  border-right: 1px solid #eee;
  position: relative;
  min-height: 32px;
  padding: 1px;
}

.diary-day-cell:last-child {
  border-right: none;
}

.diary-day-cell.occupied {
  background: rgba(0,0,0,0.02);
}

.diary-day-block {
  position: absolute;
  left: 1px;
  right: 1px;
  top: 1px;
  z-index: 2;
  font-size: 9px;
  padding: 2px 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Week view header override */
.diary-week-header {
  grid-template-columns: 60px repeat(7, 1fr);
}

/* ============ JOBS VIEW ============ */
.jobs-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.jobs-subtabs {
  display: flex;
  background: #eee;
  border-bottom: 1px solid #ccc;
  padding: 0;
}

.jobs-subtab {
  background: linear-gradient(to bottom, #e0e0e0, #d0d0d0);
  border: 1px solid #bbb;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  padding: 5px 14px;
  cursor: pointer;
  font-size: 11px;
  margin-left: 2px;
  margin-top: 3px;
  color: #444;
  font-weight: 500;
}

.jobs-subtab:hover {
  background: linear-gradient(to bottom, #d0d8f0, #c0c8e0);
}

.jobs-subtab.active {
  background: #f8f8f8;
  border-bottom: 1px solid #f8f8f8;
  color: #222;
  font-weight: 600;
  margin-bottom: -1px;
}

.jobs-toolbar {
  display: flex;
  align-items: center;
  padding: 4px 8px;
  gap: 6px;
  background: #f4f4f4;
  border-bottom: 1px solid #ddd;
}

.jobs-auto-refresh {
  font-size: 11px;
  color: #666;
  margin-left: 8px;
}

.jobs-filter-row {
  display: flex;
  align-items: center;
  padding: 4px 8px;
  gap: 6px;
  background: #f8f8f8;
  border-bottom: 1px solid #ddd;
  font-size: 11px;
}

.jobs-filter-row label {
  font-size: 11px;
  color: #555;
}

.jobs-date-input {
  font-size: 11px;
  padding: 2px 4px;
  border: 1px solid #bbb;
  border-radius: 3px;
  width: 110px;
}

.jobs-select {
  font-size: 11px;
  padding: 2px 4px;
  border: 1px solid #bbb;
  border-radius: 3px;
}

.jobs-filter-icons {
  font-size: 10px;
  letter-spacing: 2px;
}

.jobs-table-wrap {
  flex: 1;
  overflow: auto;
}

.jobs-table {
  font-size: 11px;
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
}

.jobs-table th {
  background: #e8e8e8;
  font-size: 10px;
  font-weight: 600;
  padding: 4px 3px;
  border: 1px solid #ccc;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  position: sticky;
  top: 0;
  z-index: 2;
}

.jobs-table td {
  padding: 2px 3px;
  border: 1px solid #e0e0e0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
  max-width: 150px;
}

.jobs-table tbody tr:hover {
  background: #e8f0fe;
  cursor: pointer;
}

.jobs-table tbody tr.selected {
  background: #0060df;
  color: #fff;
}

.jobs-table tbody tr:nth-child(even) {
  background: #fafafa;
}
.jobs-table tbody tr:nth-child(even):hover {
  background: #e8f0fe;
}

.jobs-prefix-cell {
  color: #006600;
  font-weight: 600;
}

.jobs-cell-center {
  text-align: center;
}

.jobs-check {
  color: #006600;
  font-weight: bold;
  font-size: 12px;
}

.jobs-rt {
  font-size: 10px;
  font-weight: 500;
}

.jobs-rt-ok {
  color: #006600;
}

.jobs-rt-late {
  color: #cc0000;
}

.jobs-footer {
  display: flex;
  align-items: center;
  padding: 4px 10px;
  background: #eee;
  border-top: 1px solid #ccc;
  font-size: 11px;
  color: #333;
}

/* ============ JOB SHEET DETAIL VIEW ============ */
.js-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  background: #f0f0f0;
  font-size: 11px;
}

.js-titlebar {
  background: linear-gradient(to bottom, #e8863a, #d4702a);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.js-toolbar {
  display: flex;
  align-items: center;
  padding: 3px 6px;
  gap: 2px;
  background: linear-gradient(to bottom, #f6f6f6, #e8e8e8);
  border-bottom: 1px solid #bbb;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.js-toolbar .action-btn {
  font-size: 11px;
  padding: 3px 8px;
  background: linear-gradient(to bottom, #f8f8f8, #e4e4e4);
  border: 1px solid #aaa;
  border-radius: 3px;
  cursor: pointer;
  white-space: nowrap;
}

.js-toolbar .action-btn:hover {
  background: linear-gradient(to bottom, #e8f0ff, #d0d8f0);
  border-color: #88a;
}

.js-toolbar .action-separator {
  width: 1px;
  height: 20px;
  background: #bbb;
  margin: 0 4px;
}

.js-tabs {
  display: flex;
  background: #e4e4e4;
  border-bottom: 1px solid #aaa;
  padding: 0 4px;
  gap: 1px;
  overflow-x: auto;
  flex-shrink: 0;
}

.js-tab {
  padding: 5px 10px;
  font-size: 11px;
  cursor: pointer;
  background: linear-gradient(to bottom, #ddd, #ccc);
  border: 1px solid #aaa;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  margin-top: 3px;
  white-space: nowrap;
  color: #444;
}

.js-tab:hover {
  background: linear-gradient(to bottom, #d0d8f0, #c0c8e0);
}

.js-tab.active {
  background: #f4f4f4;
  border-bottom: 1px solid #f4f4f4;
  margin-bottom: -1px;
  color: #222;
  font-weight: 600;
}

.js-body {
  padding: 8px 10px;
  background: #f4f4f4;
  min-height: 240px;
}

.js-tab-content {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 8px;
  align-content: start;
}

.js-tab-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

.js-placeholder-text {
  font-size: 13px;
  color: #888;
  font-style: italic;
}

.js-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.js-field {
  display: flex;
  align-items: center;
  gap: 4px;
}

.js-field > label {
  font-size: 11px;
  color: #333;
  min-width: 80px;
  text-align: right;
  flex-shrink: 0;
  white-space: nowrap;
}

.js-field-row {
  display: flex;
  gap: 8px;
}

.js-field-row .js-field > label {
  min-width: 50px;
}

.js-field-inline {
  display: flex;
  align-items: center;
  gap: 4px;
}

.js-field-inline > label {
  font-size: 11px;
  color: #333;
  min-width: 80px;
  text-align: right;
  flex-shrink: 0;
}

.js-input {
  font-size: 11px;
  padding: 2px 4px;
  border: 1px solid #aaa;
  border-radius: 2px;
  background: #fff;
  min-width: 0;
  flex: 1;
}

.js-input:focus {
  border-color: #4488cc;
  outline: none;
  box-shadow: 0 0 2px rgba(68,136,204,0.4);
}

.js-input-wide {
  flex: 2;
}

.js-input-sm {
  max-width: 100px;
  flex: unset;
  width: 100px;
}

.js-input-xs {
  max-width: 65px;
  flex: unset;
  width: 65px;
}

.js-btn-sm {
  font-size: 10px;
  padding: 2px 6px;
  background: linear-gradient(to bottom, #f6f6f6, #e0e0e0);
  border: 1px solid #aaa;
  border-radius: 2px;
  cursor: pointer;
  white-space: nowrap;
}

.js-btn-sm:hover {
  background: linear-gradient(to bottom, #e0e8ff, #d0d8f0);
}

.js-check-label {
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
  cursor: pointer;
}

.js-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 4px 0 4px 84px;
  font-size: 11px;
}

.js-checkboxes label {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.js-address-block {
  margin-left: 84px;
  border: 1px solid #bbb;
  padding: 6px;
  background: #fff;
  min-height: 40px;
}

.js-address-text {
  font-size: 11px;
  color: #333;
  margin-bottom: 4px;
}

.js-address-btns {
  display: flex;
  gap: 4px;
}

/* SLA Box */
.js-sla-box {
  border: 2px solid #e88800;
  background: #fff8f0;
  padding: 8px;
  margin-top: 6px;
  border-radius: 3px;
}

.js-sla-time {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}

.js-sla-time.js-rt-ok {
  color: #006600;
}

.js-sla-time.js-rt-late {
  color: #cc0000;
}

.js-rt-ok {
  color: #006600;
}

.js-rt-late {
  color: #cc0000;
}

.js-sla-label {
  font-size: 10px;
  font-weight: 600;
  color: #444;
  margin-bottom: 2px;
}

.js-sla-detail {
  font-size: 10px;
  color: #666;
}

.js-sla-none {
  font-size: 11px;
  color: #999;
  font-style: italic;
}

/* Bottom section (sub-tabs for Times/Materials/etc.) */
.js-bottom {
  border-top: 1px solid #aaa;
  display: flex;
  flex-direction: column;
  min-height: 140px;
  background: #f4f4f4;
  flex-shrink: 0;
}

.js-bottom-tabs {
  display: flex;
  background: #e4e4e4;
  border-bottom: 1px solid #bbb;
  padding: 0 4px;
  gap: 1px;
}

.js-bottom-tab {
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
  background: linear-gradient(to bottom, #ddd, #ccc);
  border: 1px solid #aaa;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  margin-top: 2px;
  white-space: nowrap;
  color: #444;
}

.js-bottom-tab:hover {
  background: linear-gradient(to bottom, #d0d8f0, #c0c8e0);
}

.js-bottom-tab.active {
  background: #f4f4f4;
  border-bottom: 1px solid #f4f4f4;
  margin-bottom: -1px;
  color: #222;
  font-weight: 600;
}

.js-bottom-toolbar {
  display: flex;
  gap: 4px;
  padding: 4px 8px;
  background: #ececec;
  border-bottom: 1px solid #ccc;
}

.js-bottom-content {
  flex: 1;
  overflow: auto;
  padding: 0;
}

.js-doc-table {
  width: 100%;
  font-size: 11px;
  border-collapse: collapse;
}

.js-doc-table th {
  background: #e0e0e0;
  padding: 3px 6px;
  border: 1px solid #ccc;
  text-align: left;
  font-weight: 600;
  font-size: 10px;
}

.js-doc-table td {
  padding: 3px 6px;
  border: 1px solid #ddd;
}

.js-doc-table tr.selected {
  background: #0060df;
  color: #fff;
}

/* Footer totals */
.js-footer {
  display: flex;
  align-items: flex-start;
  padding: 6px 10px;
  gap: 16px;
  background: linear-gradient(to bottom, #ececec, #ddd);
  border-top: 1px solid #aaa;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.js-footer-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
}

.js-footer-left > label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
}

.js-footer-fields {
  display: flex;
  gap: 8px;
  align-items: center;
}

.js-footer-fields .js-field {
  gap: 3px;
}

.js-footer-fields .js-field > label {
  min-width: auto;
}

.js-footer-totals {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-left: auto;
}

.js-footer-grand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-left: 16px;
}

.js-total-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}

.js-total-row label {
  text-align: right;
  min-width: 80px;
  color: #333;
}

.js-total-row span {
  font-weight: 500;
  min-width: 70px;
  text-align: right;
}

.js-total-gross {
  border-top: 1px solid #999;
  padding-top: 3px;
  margin-top: 2px;
}

.js-grand {
  font-weight: 700;
  font-size: 13px;
  color: #003366;
}

