/* Owner console — reuse apimobiz-admin visual system */
@import 'base.css';
@import 'layout.css';
@import 'utilities.css';
@import 'components.css';
@import 'table.css';
@import 'modal.css';
@import 'toast.css';
@import 'admin-shell.css';

h1 {
  color: var(--color-white);
  text-align: center;
  margin: 0;
  padding: var(--space-2) var(--space-4);
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-semibold);
  background: linear-gradient(135deg, #1E3A8A 0%, #3B82F6 100%);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  box-shadow: var(--shadow-lg);
}

.fas, .fa, .far, .fab {
  font-family: "Font Awesome 6 Free", "Font Awesome 6 Pro", "FontAwesome" !important;
}

.owner-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.owner-toolbar .search-input,
.owner-toolbar select,
.owner-toolbar input[type="number"] {
  min-height: 36px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-gray-300);
  border-radius: var(--radius-md);
  font: inherit;
}

.owner-toolbar .field-inline {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.owner-toolbar .field-inline label {
  font-size: var(--font-size-xs);
  color: var(--color-gray-500);
  line-height: 1.2;
  min-height: 1.2em;
}

/* Reports filters: room for long vue labels + buttons level with inputs */
#panel-reports .owner-toolbar .action-buttons {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 36px;
  order: 0;
}

#panel-reports #report-mode {
  min-width: 14.5rem;
  width: max(14.5rem, 100%);
}

#panel-reports #report-month {
  min-width: 9rem;
}

#panel-reports #report-customer {
  min-width: 12rem;
}

#panel-reports #report-year {
  width: 5.5rem;
}

#panel-reports #btn-load-report,
#panel-reports #btn-maximize-reports {
  min-height: 36px;
  height: 36px;
  box-sizing: border-box;
}

.owner-preview {
  margin-top: var(--space-3);
  padding: var(--space-3);
  background: var(--color-gray-50);
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius-lg);
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: var(--font-size-sm);
  max-height: 360px;
  overflow: auto;
}

.modal-section-title {
  margin: var(--space-3) 0 var(--space-2);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-gray-600);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.owner-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.owner-form-grid .form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.owner-form-grid .form-group.full {
  grid-column: 1 / -1;
}

.owner-form-grid label {
  font-size: var(--font-size-sm);
  color: var(--color-gray-600);
}

.owner-form-grid input,
.owner-form-grid select,
.owner-form-grid textarea {
  border: 1px solid var(--color-gray-300);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  font: inherit;
}

.owner-form-grid textarea {
  min-height: 64px;
  resize: vertical;
}

.badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
}

.badge-active { background: #dcfce7; color: #15803d; }
.badge-paused { background: #fef3c7; color: #a16207; }
.badge-draft { background: var(--color-gray-100); color: var(--color-gray-700); }
.badge-sent { background: var(--color-primary-light); color: var(--color-primary); }
.badge-paid_manual { background: #dcfce7; color: #15803d; }

.row-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.25rem;
}

/* Compact owner tables — admin .users-table widths are for 6 user columns */
#customers-table,
#invoices-table {
  table-layout: auto;
  margin-top: 0;
}

#customers-table th,
#customers-table td,
#invoices-table th,
#invoices-table td {
  padding: 0.35rem 0.5rem;
  font-size: var(--font-size-sm);
  vertical-align: middle;
  white-space: nowrap;
  max-width: none;
  overflow: visible;
  text-overflow: clip;
}

#customers-table tr:hover,
#invoices-table tr:hover {
  transform: none;
}

#customers-table th:nth-child(1),
#customers-table td:nth-child(1),
#customers-table th:nth-child(2),
#customers-table td:nth-child(2),
#customers-table th:nth-child(3),
#customers-table td:nth-child(3),
#customers-table th:nth-child(4),
#customers-table td:nth-child(4),
#customers-table th:nth-child(5),
#customers-table td:nth-child(5),
#invoices-table th:nth-child(1),
#invoices-table td:nth-child(1),
#invoices-table th:nth-child(2),
#invoices-table td:nth-child(2),
#invoices-table th:nth-child(3),
#invoices-table td:nth-child(3),
#invoices-table th:nth-child(4),
#invoices-table td:nth-child(4),
#invoices-table th:nth-child(5),
#invoices-table td:nth-child(5),
#invoices-table th:nth-child(6),
#invoices-table td:nth-child(6),
#invoices-table th:nth-child(7),
#invoices-table td:nth-child(7) {
  width: auto;
}

#customers-table td:nth-child(1),
#invoices-table td:nth-child(1) {
  white-space: normal;
  max-width: 14rem;
}

#customers-table td:nth-child(4),
#customers-table td:nth-child(5),
#invoices-table td:nth-child(4),
#invoices-table td:nth-child(5),
#invoices-table td:nth-child(6),
#invoices-table td:nth-child(7) {
  text-align: left;
}

#customers-table .btn-icon,
#invoices-table .btn-icon {
  width: 1.85rem;
  height: 1.85rem;
  min-height: 1.85rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#customers-table .btn-icon i,
#invoices-table .btn-icon i {
  font-size: 0.75rem;
}

.report-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
  margin: var(--space-3) 0;
}

.report-kpi-card {
  background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-3);
  box-shadow: var(--shadow-sm);
}

.report-kpi-label {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-gray-500);
  margin-bottom: var(--space-1);
}

.report-kpi-value {
  font-size: 1.5rem;
  font-weight: var(--font-weight-bold);
  color: #1e3a8a;
  line-height: 1.2;
}

.report-kpi-hint {
  margin-top: var(--space-1);
  font-size: var(--font-size-xs);
  color: var(--color-gray-500);
}

.report-status {
  margin-bottom: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--color-gray-50);
  border: 1px dashed var(--color-gray-300);
  color: var(--color-gray-600);
  font-size: var(--font-size-sm);
  text-align: center;
}

.report-charts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.report-chart-card {
  position: relative;
  background: var(--color-white);
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.report-chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.report-chart-title {
  margin: 0;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-gray-800);
}

.report-chart-sub {
  margin: 0.15rem 0 0;
  font-size: var(--font-size-xs);
  color: var(--color-gray-500);
  min-height: 1em;
}

.report-chart-canvas-wrap {
  position: relative;
  flex: 1;
  min-height: 260px;
  height: 260px;
  overflow: hidden;
}

.report-chart-canvas-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

/* Global reports focus: hide chrome, keep content */
body.reports-maximized > .container > h1 {
  display: none;
}

body.reports-maximized .admin-topbar,
body.reports-maximized .admin-sidebar,
body.reports-maximized .admin-sidebar-backdrop {
  display: none !important;
}

body.reports-maximized .admin-app {
  min-height: 100vh;
}

body.reports-maximized .admin-body {
  border-radius: 0;
  box-shadow: none;
}

body.reports-maximized .admin-main {
  flex: 1;
  width: 100%;
  max-width: none;
}

body.reports-maximized .report-chart-canvas-wrap {
  min-height: 340px;
  height: 340px;
}

.report-table-wrap {
  margin-top: var(--space-4);
}

.report-table-caption {
  margin: 0 0 var(--space-2);
  font-size: var(--font-size-xs);
  color: var(--color-gray-500);
}

#reports-table th,
#reports-table td {
  padding: 0.35rem 0.5rem;
  font-size: var(--font-size-sm);
  white-space: nowrap;
  max-width: none;
  overflow: visible;
}

#reports-table tr:hover {
  transform: none;
}

@media (max-width: 900px) {
  .report-kpis {
    grid-template-columns: 1fr;
  }

  .report-charts {
    grid-template-columns: 1fr;
  }

  body.reports-maximized .report-chart-canvas-wrap {
    min-height: 280px;
    height: 280px;
  }
}

@media (max-width: 768px) {
  .owner-form-grid {
    grid-template-columns: 1fr;
  }
}
