/* Masaba EE Helper - Utilitarian Desktop Stylesheet */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background-color: #f3f4f6;
  color: #111827;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

.hidden {
  display: none !important;
}

/* Typography */
h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 600;
  color: #111827;
}

.mono {
  font-family: Consolas, "SFMono-Regular", Menlo, Monaco, monospace;
}

.muted {
  color: #6b7280;
  font-size: 12px;
}

/* Forms & Inputs */
label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  margin-bottom: 4px;
}

input[type="text"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 6px 8px;
  font-family: inherit;
  font-size: 14px;
  color: #111827;
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #2563eb;
}

input[readonly] {
  background-color: #f8fafc;
  color: #475569;
}

textarea {
  resize: vertical;
}

.field {
  margin-bottom: 12px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-weight: 400;
  cursor: pointer;
}

.checkbox-row input[type="checkbox"] {
  width: 15px;
  height: 15px;
  margin: 0;
}

/* Buttons */
button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  color: #1f2937;
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  cursor: pointer;
  white-space: nowrap;
}

button:hover,
.btn:hover {
  background-color: #f1f5f9;
  border-color: #94a3b8;
}

.btn-primary {
  background-color: #1e293b;
  border-color: #1e293b;
  color: #ffffff;
}

.btn-primary:hover {
  background-color: #0f172a;
  border-color: #0f172a;
}

.btn-danger {
  color: #991b1b;
  border-color: #fca5a5;
  background-color: #ffffff;
}

.btn-danger:hover {
  background-color: #fef2f2;
  border-color: #f87171;
}

.btn-sm {
  padding: 4px 8px;
  font-size: 12px;
}

/* Auth Screen */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-box {
  width: 100%;
  max-width: 380px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  padding: 24px;
}

.auth-box h1 {
  font-size: 18px;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e2e8f0;
}

.auth-box h2 {
  font-size: 15px;
  margin-bottom: 12px;
}

.alert-box {
  padding: 8px 10px;
  margin-bottom: 12px;
  font-size: 13px;
  border: 1px solid #fca5a5;
  background-color: #fef2f2;
  color: #991b1b;
  border-radius: 3px;
}

.warn-box {
  padding: 8px 10px;
  margin-bottom: 12px;
  font-size: 13px;
  border: 1px solid #fcd34d;
  background-color: #fffbeb;
  color: #92400e;
  border-radius: 3px;
}

.qr-container {
  display: flex;
  justify-content: center;
  padding: 12px;
  margin-bottom: 12px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
}

.qr-container svg {
  max-width: 180px;
  height: auto;
}

.recovery-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 10px;
  margin-bottom: 12px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  font-family: Consolas, monospace;
  font-size: 13px;
}

.button-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.button-row-end {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}

/* Main App Topbar */
.topbar {
  background: #ffffff;
  border-bottom: 1px solid #cbd5e1;
  padding: 0 20px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 100%;
}

.app-title {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
  white-space: nowrap;
}

.nav-tabs {
  display: flex;
  height: 100%;
  gap: 4px;
}

.tab-btn {
  height: 100%;
  padding: 0 14px;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: #4b5563;
  font-size: 13px;
  font-weight: 500;
}

.tab-btn:hover {
  background: #f8fafc;
  color: #111827;
}

.tab-btn.active {
  color: #111827;
  border-bottom-color: #1e293b;
  font-weight: 600;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Main Content Container */
.main-container {
  max-width: 1360px;
  margin: 0 auto;
  padding: 16px 20px;
}

.panel {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  padding: 16px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid #e2e8f0;
}

.panel-header h2 {
  font-size: 15px;
}

/* Toolbar */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 14px;
}

.toolbar-field {
  min-width: 220px;
}

.toolbar-field label {
  margin-bottom: 3px;
}

/* Tables */
.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table.data-table th,
table.data-table td {
  border: 1px solid #cbd5e1;
  padding: 7px 10px;
  text-align: left;
  vertical-align: top;
}

table.data-table th {
  background-color: #f8fafc;
  font-weight: 600;
  color: #1f2937;
  white-space: nowrap;
}

table.data-table tbody tr:hover {
  background-color: #f9fafb;
}

.motor-entry-wrap {
  max-width: 580px;
  margin-bottom: 16px;
}

.motor-entry-wrap input.motor-hp-input,
.motor-entry-wrap input.motor-fla-input {
  width: 100%;
  min-width: 120px;
  font-family: Consolas, monospace;
}

.section-heading {
  font-size: 14px;
  font-weight: 600;
  margin: 18px 0 8px 0;
  color: #111827;
}

.sub-line {
  display: block;
  color: #4b5563;
  font-size: 12px;
  margin-top: 2px;
}

/* Split Layouts (Jobs & Checklists) */
.split-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
  align-items: start;
}

.notes-split {
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 16px;
  margin-top: 12px;
  align-items: start;
}

.list-box {
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  background: #ffffff;
  max-height: calc(100vh - 180px);
  overflow-y: auto;
}

.list-item {
  padding: 8px 10px;
  border-bottom: 1px solid #e2e8f0;
  cursor: pointer;
}

.list-item:last-child {
  border-bottom: none;
}

.list-item:hover {
  background-color: #f8fafc;
}

.list-item.active {
  background-color: #e2e8f0;
}

.list-item-title {
  font-weight: 600;
  font-size: 13px;
  color: #111827;
}

.list-item-meta {
  font-size: 12px;
  color: #4b5563;
  margin-top: 2px;
}

.empty-msg {
  padding: 16px;
  color: #6b7280;
  font-size: 13px;
}

.note-textarea {
  min-height: 380px;
  font-family: Consolas, "SFMono-Regular", Menlo, monospace;
  font-size: 13px;
  line-height: 1.5;
}

.job-desc {
  margin-top: 4px;
  color: #374151;
  font-size: 13px;
  white-space: pre-wrap;
}

/* Checklist Specific */
.inline-add-form {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.inline-add-form input[type="text"] {
  flex: 1;
}

.item-checked-text {
  text-decoration: line-through;
  color: #6b7280;
}

.inline-edit-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.inline-edit-row input[type="text"] {
  flex: 1;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}

.modal-box {
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid #94a3b8;
  border-radius: 3px;
  padding: 18px;
}

.modal-box h3 {
  font-size: 15px;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid #e2e8f0;
}

.divider {
  border: 0;
  border-top: 1px solid #e2e8f0;
  margin: 16px 0;
}

/* Status Notice (Bottom-Right Subtle Notification) */
.toast-stack {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 200;
}

.toast {
  background: #1e293b;
  color: #ffffff;
  padding: 8px 12px;
  border-radius: 3px;
  font-size: 13px;
  border: 1px solid #0f172a;
}

.toast.error {
  background: #991b1b;
  border-color: #7f1d1d;
}

@media (max-width: 860px) {
  .split-layout,
  .notes-split {
    grid-template-columns: 1fr;
  }

  .topbar {
    height: auto;
    flex-wrap: wrap;
    padding: 8px 12px;
  }

  .topbar-left {
    flex-wrap: wrap;
    gap: 12px;
  }

  .tab-btn {
    padding: 8px 10px;
  }
}
