/* NetworkLaguna — shared theme, Diamond-inspired (FacturaLaguna look & feel) */

@font-face {
  font-family: 'Nunito';
  src: url('/fonts/nunito-v12-latin-ext_latin-regular.woff2') format('woff2'),
       url('/fonts/nunito-v12-latin-ext_latin-regular.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Nunito';
  src: url('/fonts/nunito-v12-latin-ext_latin-600.woff2') format('woff2'),
       url('/fonts/nunito-v12-latin-ext_latin-600.woff') format('woff');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Nunito';
  src: url('/fonts/nunito-v12-latin-ext_latin-700.woff2') format('woff2'),
       url('/fonts/nunito-v12-latin-ext_latin-700.woff') format('woff');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-light: #eef2ff;
  --content-bg: #f3f5f9;
  --card-bg: #ffffff;
  --border: #e4e7eb;
  --text: #495057;
  --text-secondary: #6c757d;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --font: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0, 0, 0, .06);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, .25);
  --topbar-height: 60px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--content-bg);
}
h1, h2, h3 { color: #1f2937; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
[hidden] { display: none !important; }

/* ---------- Auth pages ---------- */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-shell {
  display: flex;
  width: 960px;
  max-width: 100%;
  min-height: 560px;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow-lg);
}
.auth-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px;
  background: #fff;
}
.auth-logo {
  width: 100%;
  max-width: 280px;
  height: auto;
  margin-bottom: 28px;
}
.auth-panel h1 { margin: 0 0 4px; font-size: 26px; font-weight: 700; }
.auth-panel .subtitle { margin: 0 0 24px; color: var(--text-secondary); }
.auth-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px;
  color: #fff;
  background: linear-gradient(180deg, rgba(79, 70, 229, .92) 0%, rgba(30, 30, 45, .96) 100%);
}
.auth-hero-logo { width: 100%; max-width: 280px; height: auto; margin-bottom: 24px; }
.auth-hero h2 { margin: 0 0 12px; font-size: 30px; color: #fff; }
.auth-hero p { margin: 0; color: rgba(255, 255, 255, .82); line-height: 1.6; }
.auth-hero ul { margin: 20px 0 0; padding-left: 18px; color: rgba(255, 255, 255, .85); line-height: 1.8; }

.auth-body .card {
  width: min(100%, 520px);
  padding: 36px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-lg);
}
.auth-body .card .auth-logo { max-width: 240px; margin-bottom: 20px; }
.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.card h1 { margin: 0 0 8px; font-size: 28px; line-height: 1.2; }
.subtitle { margin: 0 0 24px; color: var(--text-secondary); line-height: 1.5; }

label { display: block; margin: 16px 0 6px; font-weight: 600; }
input[type="text"], input[type="email"], input[type="password"], select {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  color: var(--text);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .15);
}
.checkbox {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 18px;
  font-weight: 400;
  line-height: 1.5;
}
.checkbox input { margin-top: 4px; }
.captcha { margin: 22px 0 8px; min-height: 65px; }

.btn, button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 11px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover, button:hover { background: var(--primary-dark); }
button:disabled { opacity: .65; cursor: wait; }
.btn-block { width: 100%; }
.btn-outline { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-sm { width: auto; padding: 7px 12px; font-size: 13px; }

.message { min-height: 24px; margin: 14px 0 0; line-height: 1.5; }
.message.error { color: var(--danger); }
.message.success { color: #067647; font-weight: 600; }
.alert { padding: 12px 16px; border-radius: var(--radius); font-size: 13px; margin: 0 0 16px; }
.alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.footnote { margin: 20px 0 0; color: var(--text-secondary); font-size: 13px; line-height: 1.6; }

/* ---------- App layout ---------- */
.app-body { min-height: 100vh; background: var(--content-bg); }
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .08);
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); font-weight: 700; }
.brand img { height: 36px; width: auto; }
.brand span { font-size: 15px; font-weight: 600; color: var(--text-secondary); }
.topbar .logout { margin: 0; }
.topbar .logout button { width: auto; padding: 7px 12px; }

.page { max-width: 1280px; margin: 0 auto; padding: 24px; }
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.page-header h1 { margin: 0; font-size: 26px; }
.page-header .eyebrow { margin-bottom: 4px; }

.app-body .card {
  margin-bottom: 20px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.toolbar-card { padding: 16px 20px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin: 0; }
.toolbar label { margin: 0; font-size: 13px; }
.toolbar select { min-width: 180px; }
.toolbar button { width: auto; }
.table-card { overflow-x: auto; }
.table { width: 100%; min-width: 900px; border-collapse: collapse; font-size: 13px; }
.table th {
  padding: 12px 14px;
  text-align: left;
  background: var(--content-bg);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:hover { background: rgba(79, 70, 229, .03); }
.table tbody tr:last-child td { border-bottom: 0; }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
}
.empty { padding: 32px; text-align: center; color: var(--text-secondary); }
.muted { color: var(--text-secondary); }

/* Admin tabs and app detail */
.admin-tabs {
  display: flex;
  gap: 18px;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.admin-tabs a {
  padding: 8px 2px;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 14px;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.admin-tabs a:hover { color: var(--primary); text-decoration: none; }
.admin-tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }
.card-body { padding: 20px; }
.card h2 { margin: 0 0 12px; font-size: 18px; color: #1f2937; }
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px 24px;
}
.detail-item { display: flex; flex-direction: column; gap: 4px; }
.detail-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.detail-value { font-size: 14px; color: var(--text); word-break: break-word; }
.manifest-pre {
  margin: 0 0 20px;
  padding: 16px;
  max-height: 360px;
  overflow: auto;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}
.manifest-input {
  width: 100%;
  min-height: 260px;
  margin: 6px 0 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  resize: vertical;
}
.manifest-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .15);
}
.manifest-form label { margin-top: 0; }
.manifest-form button { width: auto; }
.alert ul { margin: 8px 0 0; padding-left: 18px; }
.alert-danger strong { display: block; margin-bottom: 4px; }

@media (max-width: 820px) {
  .auth-shell { flex-direction: column; min-height: 0; }
  .auth-panel, .auth-hero { padding: 32px; }
  .page { padding: 16px; }
  .topbar { padding: 0 16px; }
  .brand span { display: none; }
  .page-header { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 640px) {
  .auth-body { padding: 12px; }
  .auth-body .card { padding: 24px; }
  .auth-hero { display: none; }
  .auth-panel { padding: 28px; }
  .auth-logo { max-width: 220px; }
  .card h1 { font-size: 24px; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar select, .toolbar button { width: 100%; }
  .topbar { gap: 10px; }
  .brand img { height: 30px; }
  .table { min-width: 0; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: 12px 16px; border-bottom: 1px solid var(--border); }
  .table td {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 6px 0;
    border: 0;
    text-align: right;
  }
  .table td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    text-align: left;
    font-weight: 700;
    color: var(--text-secondary);
  }
  .table tbody tr:hover { background: transparent; }
  .table tbody tr:last-child { border-bottom: 0; }
}

@media (max-width: 380px) {
  .auth-body .card { padding: 20px; }
  .captcha { transform: scale(.92); transform-origin: top left; }
}
