/* ── Lease Dashboard Styles ─────────────────────────── */

.lease-shell {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
}

/* Header */
.lease-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.lease-header h1 {
  font-size: 24px;
  font-weight: 600;
  margin: 0;
}

.back-link {
  color: var(--text2);
  text-decoration: none;
  font-size: 14px;
  padding: 6px 12px;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.back-link:hover {
  background: var(--surface);
  color: var(--text);
}

/* Main Layout */
.lease-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  min-height: calc(100vh - 120px);
}

/* Sidebar */
.unit-sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  height: fit-content;
  max-height: calc(100vh - 140px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.sidebar-header h2 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.building-filter {
  font-family: var(--font);
  font-size: 12px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}

.unit-search input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font);
  font-size: 13px;
  background: var(--bg);
  color: var(--text);
  margin-bottom: 12px;
}

.unit-search input:focus {
  outline: none;
  border-color: var(--c-renewal);
}

.unit-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
}

.unit-list li {
  padding: 12px;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 4px;
  transition: all 0.15s ease;
}

.unit-list li:hover {
  background: var(--bg);
}

.unit-list li.active {
  background: var(--c-renewal);
  color: white;
}

.unit-list li.loading {
  color: var(--text2);
  cursor: default;
}

.unit-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.unit-code {
  font-weight: 600;
  font-size: 14px;
}

.unit-status {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}

.unit-status.occupied { background: #dcfce7; color: #166534; }
.unit-status.vacant { background: #fee2e2; color: #991b1b; }
.unit-status.pending { background: #fef3c7; color: #92400e; }

.unit-list li.active .unit-status {
  background: rgba(255,255,255,0.2);
  color: white;
}

.unit-tenant {
  font-size: 12px;
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.unit-list li.active .unit-tenant {
  color: rgba(255,255,255,0.8);
}

.unit-sqft {
  font-size: 11px;
  color: var(--text3);
}

.unit-list li.active .unit-sqft {
  color: rgba(255,255,255,0.6);
}

/* Detail Panel */
.detail-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  overflow-y: auto;
  max-height: calc(100vh - 140px);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 400px;
  color: var(--text3);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 14px;
}

/* Detail Sections */
.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.detail-title {
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 4px 0;
}

.detail-subtitle {
  font-size: 14px;
  color: var(--text2);
  margin: 0;
}

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

.btn {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-primary {
  background: var(--c-renewal);
  color: white;
}

.btn-primary:hover {
  filter: brightness(1.1);
}

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
}

.btn-small {
  padding: 4px 10px;
  font-size: 12px;
}

/* Section Cards */
.detail-section {
  margin-bottom: 24px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.section-title {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text2);
  margin: 0;
}

.section-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}

/* Data Grid */
.data-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.data-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.data-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text3);
}

.data-value {
  font-size: 14px;
  color: var(--text);
}

.data-value.highlight {
  color: var(--c-renewal);
  font-weight: 600;
}

.data-value.warning {
  color: var(--c-expiration);
  font-weight: 600;
}

.data-value.muted {
  color: var(--text3);
  font-style: italic;
}

/* Key Dates */
.dates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.date-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.date-card.expiration { border-left: 3px solid var(--c-expiration); }
.date-card.renewal { border-left: 3px solid var(--c-renewal); }
.date-card.escalation { border-left: 3px solid var(--c-cam); }
.date-card.cam { border-left: 3px solid var(--c-cam); }
.date-card.other { border-left: 3px solid var(--c-other); }

.date-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  color: var(--text3);
}

.date-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.date-days {
  font-size: 11px;
  color: var(--text2);
}

.date-days.soon {
  color: var(--c-expiration);
  font-weight: 500;
}

/* Rent Schedule */
.rent-schedule {
  margin: 0;
  padding: 0;
  list-style: none;
}

.rent-period {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.rent-period:last-child {
  border-bottom: none;
}

.rent-period.current {
  background: rgba(0, 122, 255, 0.05);
  margin: 0 -16px;
  padding: 10px 16px;
  border-radius: 6px;
}

.rent-dates {
  font-size: 13px;
  color: var(--text2);
}

.rent-amount {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

/* Utilities Table */
.utilities-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

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

.utilities-table th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text3);
  background: var(--surface);
}

.utilities-table tr:last-child td {
  border-bottom: none;
}

.responsibility-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}

.responsibility-badge.tenant { background: #dbeafe; color: #1e40af; }
.responsibility-badge.landlord { background: #f3e8ff; color: #6b21a8; }

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.tab {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  border: none;
  background: none;
  color: var(--text2);
  cursor: pointer;
  border-radius: 6px 6px 0 0;
  transition: all 0.15s ease;
}

.tab:hover {
  color: var(--text);
  background: var(--bg);
}

.tab.active {
  color: var(--c-renewal);
  background: rgba(0, 122, 255, 0.1);
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.open {
  display: flex;
}

.modal-content {
  background: var(--surface);
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-content.modal-large {
  max-width: 700px;
}

.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;
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text2);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

/* Form Fields */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text2);
  margin-bottom: 6px;
}

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

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--c-renewal);
}

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

/* Responsive */
@media (max-width: 900px) {
  .lease-layout {
    grid-template-columns: 1fr;
  }

  .unit-sidebar {
    max-height: 300px;
  }
}

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
  .unit-status.occupied { background: #166534; color: #dcfce7; }
  .unit-status.vacant { background: #991b1b; color: #fee2e2; }
  .unit-status.pending { background: #92400e; color: #fef3c7; }
  .responsibility-badge.tenant { background: #1e40af; color: #dbeafe; }
  .responsibility-badge.landlord { background: #6b21a8; color: #f3e8ff; }
}

/* Document type badges */
.doc-type-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  background: var(--c-renewal);
  color: white;
}

/* Drop Zone */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--bg);
}

.drop-zone:hover {
  border-color: var(--accent);
  background: var(--surface);
}

.drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--surface);
  transform: scale(1.02);
}

.drop-zone-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.drop-zone-text {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 4px;
}

.drop-zone-hint {
  font-size: 13px;
  color: var(--text2);
}

/* Inline Edit Styles */
.edit-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  padding: 16px;
}

.edit-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.edit-field label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.edit-field input,
.edit-field select,
.edit-field textarea {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  transition: all 0.15s ease;
}

.edit-field input:focus,
.edit-field select:focus,
.edit-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
}

.edit-field input:disabled {
  background: var(--surface);
  color: var(--text3);
  cursor: not-allowed;
}

/* Document Cards - Compact List */
.document-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
}

.document-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.15s ease;
  cursor: pointer;
}

.document-card:hover {
  border-color: var(--c-renewal);
  background: var(--surface);
  transform: translateX(4px);
}

.document-card-icon {
  font-size: 28px;
  flex-shrink: 0;
  width: 40px;
  text-align: center;
}

.document-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.document-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.document-card-filename {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-card-meta {
  font-size: 11px;
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: 8px;
}

.document-card-size {
  color: var(--text3);
}

.document-card-actions {
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.document-card:hover .document-card-actions {
  opacity: 1;
}

.document-card-actions .btn-icon {
  padding: 6px;
  border: none;
  background: none;
  color: var(--text2);
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.document-card-actions .btn-icon:hover {
  background: var(--border);
  color: var(--text);
}
