/* ConLine — design tokens inspirados em shadcn/ui (neutral, 2026) */

:root {
  --radius: 0.625rem;
  --font: "Inter", system-ui, sans-serif;

  --background: oklch(0.99 0 0);
  --foreground: oklch(0.145 0 0);
  --card: oklch(1 0 0);
  --card-foreground: oklch(0.145 0 0);
  --popover: oklch(1 0 0);
  --popover-foreground: oklch(0.145 0 0);
  --primary: oklch(0.205 0 0);
  --primary-foreground: oklch(0.985 0 0);
  --secondary: oklch(0.965 0 0);
  --secondary-foreground: oklch(0.205 0 0);
  --muted: oklch(0.965 0 0);
  --muted-foreground: oklch(0.556 0 0);
  --accent: oklch(0.965 0 0);
  --accent-foreground: oklch(0.205 0 0);
  --destructive: oklch(0.577 0.245 27.325);
  --destructive-foreground: oklch(0.985 0 0);
  --border: oklch(0.922 0 0);
  --input: oklch(0.922 0 0);
  --ring: oklch(0.708 0 0);
  --sidebar: oklch(0.985 0 0);
  --sidebar-border: oklch(0.922 0 0);
  --brand: oklch(0.488 0.17 252);
  --brand-foreground: oklch(0.985 0 0);
  --success: oklch(0.527 0.154 150.069);
  --shadow: 0 1px 2px oklch(0 0 0 / 0.05);
}

.dark {
  color-scheme: dark;
  --background: oklch(0.145 0 0);
  --foreground: oklch(0.985 0 0);
  --card: oklch(0.205 0 0);
  --card-foreground: oklch(0.985 0 0);
  --popover: oklch(0.205 0 0);
  --popover-foreground: oklch(0.985 0 0);
  --primary: oklch(0.985 0 0);
  --primary-foreground: oklch(0.205 0 0);
  --secondary: oklch(0.269 0 0);
  --secondary-foreground: oklch(0.985 0 0);
  --muted: oklch(0.269 0 0);
  --muted-foreground: oklch(0.708 0 0);
  --accent: oklch(0.269 0 0);
  --accent-foreground: oklch(0.985 0 0);
  --destructive: oklch(0.704 0.191 22.216);
  --destructive-foreground: oklch(0.985 0 0);
  --border: oklch(1 0 0 / 10%);
  --input: oklch(1 0 0 / 15%);
  --ring: oklch(0.556 0 0);
  --sidebar: oklch(0.185 0 0);
  --sidebar-border: oklch(1 0 0 / 8%);
  --brand: oklch(0.62 0.17 252);
  --brand-foreground: oklch(0.985 0 0);
  --success: oklch(0.696 0.17 162.48);
  --shadow: 0 1px 2px oklch(0 0 0 / 0.2);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  background: var(--background);
  color: var(--foreground);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

.portal {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.25rem 1rem;
  background: var(--sidebar);
  border-right: 1px solid var(--sidebar-border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.25rem 0.5rem;
}

.brand-mark {
  width: 2rem;
  height: 2rem;
  border-radius: calc(var(--radius) - 2px);
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: var(--brand);
  color: var(--brand-foreground);
}

.brand strong {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.2;
}

.brand span {
  color: var(--muted-foreground);
  font-size: 0.75rem;
}

.nav {
  display: grid;
  gap: 0.25rem;
}

.nav-item {
  border: 0;
  background: transparent;
  color: var(--muted-foreground);
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover {
  background: var(--accent);
  color: var(--accent-foreground);
}

.nav-item.active {
  background: var(--secondary);
  color: var(--foreground);
}

.sidebar-footer {
  margin-top: auto;
  padding: 0 0.5rem;
  color: var(--muted-foreground);
  font-size: 0.75rem;
  line-height: 1.5;
}

/* Main */
.main {
  padding: 1.5rem 2rem 2.5rem;
  max-width: 1200px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.eyebrow {
  margin: 0 0 0.25rem;
  color: var(--muted-foreground);
  font-size: 0.75rem;
  font-weight: 500;
}

h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

h3 {
  margin: 0 0 0.25rem;
  font-size: 0.875rem;
  font-weight: 600;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.topbar-actions {
  display: flex;
  gap: 0.5rem;
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.125rem;
  box-shadow: var(--shadow);
}

.stat-card span {
  display: block;
  color: var(--muted-foreground);
  font-size: 0.75rem;
  font-weight: 500;
  margin-bottom: 0.375rem;
}

.stat-card strong {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1;
}

/* Card */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-inset {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--muted);
  border: 1px solid var(--border);
  box-shadow: none;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem 1.25rem 0;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.card-desc {
  margin: 0.25rem 0 0;
  color: var(--muted-foreground);
  font-size: 0.8125rem;
}

.table-wrap {
  padding: 0.75rem 1.25rem 1.25rem;
  overflow: auto;
}

/* Table — estilo shadcn data-table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table thead tr {
  border-bottom: 1px solid var(--border);
}

.data-table th {
  height: 2.5rem;
  padding: 0 0.75rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted-foreground);
  white-space: nowrap;
}

.data-table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover {
  background: var(--muted);
}

.data-table code {
  font-size: 0.8125rem;
  font-family: ui-monospace, monospace;
  color: var(--muted-foreground);
}

.text-muted {
  color: var(--muted-foreground);
}

.cell-name strong {
  display: block;
  font-weight: 500;
}

.cell-name span {
  display: block;
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-top: 0.125rem;
}

.link-cell {
  font-size: 0.8125rem;
  color: var(--brand);
  word-break: break-all;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  border-radius: calc(var(--radius) - 4px);
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--secondary);
  color: var(--secondary-foreground);
  white-space: nowrap;
}

.badge-outline {
  background: transparent;
}

.badge-success {
  border-color: transparent;
  background: oklch(0.527 0.154 150.069 / 12%);
  color: var(--success);
}

.badge-muted {
  color: var(--muted-foreground);
}

/* Status */
.status {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
}

.status::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--muted-foreground);
}

.status.online::before {
  background: var(--success);
}

.status.offline::before {
  background: var(--destructive);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  height: 2.25rem;
  padding: 0 0.875rem;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid transparent;
  background: transparent;
  color: var(--foreground);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

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

.btn-primary {
  background: var(--primary);
  color: var(--primary-foreground);
}

.btn-primary:hover {
  opacity: 0.9;
  background: var(--primary);
}

.btn-outline {
  border-color: var(--border);
  background: var(--background);
}

.btn-outline:hover {
  background: var(--accent);
}

.btn-ghost:hover {
  background: var(--accent);
}

.btn-destructive {
  color: var(--destructive);
}

.btn-destructive:hover {
  background: oklch(0.577 0.245 27.325 / 10%);
}

.btn-sm {
  height: 2rem;
  padding: 0 0.625rem;
  font-size: 0.75rem;
}

.btn-icon {
  width: 2.25rem;
  padding: 0;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  justify-content: flex-end;
}

/* Empty */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--muted-foreground);
}

.empty-state h3 {
  color: var(--foreground);
  margin-bottom: 0.375rem;
}

/* Modal */
.modal {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  width: min(32rem, calc(100vw - 2rem));
  background: var(--popover);
  color: var(--popover-foreground);
  box-shadow: 0 16px 48px oklch(0 0 0 / 0.16);
}

.modal-lg {
  width: min(42rem, calc(100vw - 2rem));
}

.modal::backdrop {
  background: oklch(0 0 0 / 0.5);
}

.modal-body {
  padding: 1.25rem;
}

.modal-header,
.modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.modal-footer {
  margin-top: 1.25rem;
  justify-content: flex-end;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.875rem;
  margin-top: 1rem;
}

.field {
  display: grid;
  gap: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 500;
}

.field-full {
  grid-column: 1 / -1;
}

.field input,
.field select {
  height: 2.25rem;
  padding: 0 0.75rem;
  border: 1px solid var(--input);
  border-radius: calc(var(--radius) - 2px);
  background: var(--background);
  color: var(--foreground);
  font-weight: 400;
}

.field input:focus,
.field select:focus {
  outline: 2px solid var(--ring);
  outline-offset: 1px;
}

.field-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 400;
}

.field-check input {
  width: auto;
}

.options-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 0.875rem;
}

.camera-picker {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.picker-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  background: var(--background);
}

.picker-item.selected {
  border-color: var(--brand);
  background: oklch(0.488 0.17 252 / 6%);
}

.picker-item .info {
  flex: 1;
  min-width: 0;
}

.picker-item strong {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
}

.picker-item span {
  display: block;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.picker-order {
  display: flex;
  gap: 0.25rem;
}

.link-preview {
  margin-top: 1rem;
  padding: 0.75rem;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--border);
  background: var(--muted);
  font-size: 0.8125rem;
  word-break: break-all;
}

.form-message {
  margin: 0.75rem 0 0;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}

.form-message.ok {
  color: var(--success);
}

.form-message.error {
  color: var(--destructive);
}

.toast {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  background: var(--popover);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 0.8125rem;
  z-index: 100;
}

.toast[hidden] {
  display: none !important;
}

.theme-icon::before {
  content: "☀";
}

.dark .theme-icon::before {
  content: "☾";
}

@media (max-width: 900px) {
  .portal {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--sidebar-border);
  }

  .main {
    padding: 1rem;
  }

  .stats-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .card-header {
    flex-direction: column;
  }
}
