/* ==========================================================================
   Painel SOCGED — Design System
   Use these classes in your Flask/Jinja2 templates.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Brand */
  --socged-primary: #004d6f;
  --socged-primary-hover: #00405e;
  --socged-primary-dark: #003650;
  --socged-accent: #01b9b4;
  --socged-accent-hover: #019a96;
  --socged-accent-soft: rgba(1, 185, 180, 0.1);

  /* Surfaces */
  --socged-bg: #f8fafb;
  --socged-card: #ffffff;
  --socged-border: #e4e9ed;
  --socged-border-strong: #cfd6dc;

  /* Text */
  --socged-text: #1a1a2e;
  --socged-text-muted: #6b7280;
  --socged-text-subtle: #9ca3af;

  /* Status */
  --socged-success-bg: #dcfce7;
  --socged-success-text: #166534;
  --socged-info-bg: #dbeafe;
  --socged-info-text: #1e40af;
  --socged-neutral-bg: #f1f5f9;
  --socged-neutral-text: #64748b;
  --socged-warn-bg: #fef3c7;
  --socged-warn-text: #92400e;

  /* Effects */
  --socged-radius: 12px;
  --socged-radius-sm: 8px;
  --socged-radius-lg: 16px;
  --socged-shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
  --socged-shadow: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
  --socged-shadow-md: 0 4px 12px rgba(16, 24, 40, 0.06), 0 2px 4px rgba(16, 24, 40, 0.04);
  --socged-shadow-lg: 0 20px 40px -10px rgba(0, 77, 111, 0.18);
  --socged-transition: 160ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--socged-bg);
  color: var(--socged-text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--socged-accent); text-decoration: none; transition: color var(--socged-transition); }
a:hover { color: var(--socged-accent-hover); }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

/* ===================== LAYOUT ===================== */

.socged-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.socged-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--socged-primary);
  color: #fff;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.04), 0 4px 16px rgba(0, 77, 111, 0.15);
}
.socged-header__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
}
.socged-header__logo {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--socged-accent), #00d4ce);
  display: grid; place-items: center;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(1, 185, 180, 0.3);
}
.socged-header__user {
  display: flex;
  align-items: center;
  gap: 12px;
}
.socged-header__avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--socged-accent);
  display: grid; place-items: center;
  font-weight: 600; font-size: 13px;
  color: #fff;
}
.socged-header__name { font-size: 13px; opacity: 0.95; }
.socged-header__logout {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border-radius: var(--socged-radius-sm);
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-size: 13px; font-weight: 500;
  transition: background var(--socged-transition);
}
.socged-header__logout:hover { background: rgba(255,255,255,0.18); }

/* Main */
.socged-main {
  flex: 1;
  padding: 28px 32px 120px;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}

.socged-page-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.socged-page-subtitle {
  color: var(--socged-text-muted);
  font-size: 14px;
  margin-bottom: 24px;
}

/* ===================== CARD ===================== */

.socged-card {
  background: var(--socged-card);
  border: 1px solid var(--socged-border);
  border-radius: var(--socged-radius);
  box-shadow: var(--socged-shadow);
}
.socged-card__header {
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--socged-border);
}
.socged-card__title { font-size: 15px; font-weight: 600; }
.socged-card__body { padding: 22px; }

/* ===================== FILTERS ===================== */

.socged-filters {
  margin-bottom: 20px;
  overflow: hidden;
  transition: all var(--socged-transition);
}
.socged-filters__toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  font-weight: 600;
  font-size: 14px;
  color: var(--socged-text);
}
.socged-filters__toggle-icon {
  transition: transform var(--socged-transition);
  color: var(--socged-text-muted);
}
.socged-filters[data-open="false"] .socged-filters__toggle-icon { transform: rotate(-90deg); }
.socged-filters[data-open="false"] .socged-filters__body { display: none; }

.socged-filters__body {
  padding: 4px 22px 22px;
  border-top: 1px solid var(--socged-border);
}
.socged-filters__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 18px;
}
.socged-filters__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--socged-border);
}

/* ===================== FORM ===================== */

.socged-field { display: flex; flex-direction: column; gap: 6px; }
.socged-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--socged-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.socged-input,
.socged-select {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--socged-border-strong);
  border-radius: var(--socged-radius-sm);
  background: #fff;
  color: var(--socged-text);
  transition: border-color var(--socged-transition), box-shadow var(--socged-transition);
}
.socged-input:focus,
.socged-select:focus {
  outline: none;
  border-color: var(--socged-accent);
  box-shadow: 0 0 0 3px var(--socged-accent-soft);
}
.socged-input::placeholder { color: var(--socged-text-subtle); }
.socged-select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}

.socged-search-select {
  position: relative;
}
.socged-search-select .socged-input {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><path d='m21 21-4.3-4.3'/></svg>");
  background-repeat: no-repeat;
  background-position: 12px center;
  padding-left: 36px;
}

/* ===================== BUTTONS ===================== */

.socged-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border-radius: var(--socged-radius-sm);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--socged-transition);
  white-space: nowrap;
}
.socged-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--socged-accent-soft);
}
.socged-btn--primary {
  background: var(--socged-primary);
  color: #fff;
}
.socged-btn--primary:hover {
  background: var(--socged-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 77, 111, 0.25);
}
.socged-btn--accent {
  background: var(--socged-accent);
  color: #fff;
}
.socged-btn--accent:hover {
  background: var(--socged-accent-hover);
  box-shadow: 0 4px 12px rgba(1, 185, 180, 0.3);
}
.socged-btn--secondary {
  background: #fff;
  color: var(--socged-text);
  border: 1px solid var(--socged-border-strong);
}
.socged-btn--secondary:hover {
  background: var(--socged-bg);
  border-color: var(--socged-primary);
  color: var(--socged-primary);
}
.socged-btn--ghost {
  background: transparent;
  color: var(--socged-text-muted);
}
.socged-btn--ghost:hover { color: var(--socged-text); background: var(--socged-neutral-bg); }
.socged-btn--sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 6px; }
.socged-btn--icon { width: 36px; padding: 0; }

/* ===================== TABLE ===================== */

.socged-table-wrap {
  overflow-x: auto;
  border-radius: var(--socged-radius);
}
.socged-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
.socged-table thead th {
  background: #f9fafb;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--socged-text-muted);
  padding: 12px 16px;
  border-bottom: 1px solid var(--socged-border);
  white-space: nowrap;
}
.socged-table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--socged-border);
  color: var(--socged-text);
  vertical-align: middle;
}
.socged-table tbody tr { transition: background var(--socged-transition); }
.socged-table tbody tr:hover { background: #fafbfc; }
.socged-table tbody tr:last-child td { border-bottom: none; }
.socged-table__checkbox-col { width: 40px; }
.socged-table__actions-col { width: 1%; white-space: nowrap; text-align: right; }
.socged-table__actions { display: inline-flex; gap: 6px; justify-content: flex-end; }

.socged-cell-strong { font-weight: 600; color: var(--socged-text); }
.socged-cell-muted { color: var(--socged-text-muted); font-size: 12px; }

/* Checkbox */
.socged-checkbox {
  appearance: none;
  width: 16px; height: 16px;
  border: 1.5px solid var(--socged-border-strong);
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--socged-transition);
  position: relative;
}
.socged-checkbox:hover { border-color: var(--socged-accent); }
.socged-checkbox:checked {
  background: var(--socged-accent);
  border-color: var(--socged-accent);
}
.socged-checkbox:checked::after {
  content: '';
  position: absolute;
  left: 4px; top: 1px;
  width: 5px; height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* ===================== BADGES ===================== */

.socged-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.socged-badge--success { background: var(--socged-success-bg); color: var(--socged-success-text); }
.socged-badge--info { background: var(--socged-info-bg); color: var(--socged-info-text); }
.socged-badge--neutral { background: var(--socged-neutral-bg); color: var(--socged-neutral-text); }
.socged-badge--warn { background: var(--socged-warn-bg); color: var(--socged-warn-text); }
.socged-badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
}

/* ===================== EMPTY STATE ===================== */

.socged-empty {
  padding: 64px 24px;
  text-align: center;
  color: var(--socged-text-muted);
}
.socged-empty__icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--socged-bg);
  display: grid; place-items: center;
  margin: 0 auto 16px;
  color: var(--socged-accent);
}
.socged-empty__title { font-size: 15px; font-weight: 600; color: var(--socged-text); margin-bottom: 6px; }
.socged-empty__desc { font-size: 13px; max-width: 360px; margin: 0 auto; }

/* ===================== PAGINATION ===================== */

.socged-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-top: 1px solid var(--socged-border);
  font-size: 13px;
  color: var(--socged-text-muted);
}
.socged-pagination__pages { display: flex; gap: 4px; }
.socged-pagination__btn {
  min-width: 32px; height: 32px;
  padding: 0 10px;
  border-radius: 6px;
  background: transparent;
  color: var(--socged-text-muted);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--socged-transition);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.socged-pagination__btn:hover { background: var(--socged-neutral-bg); color: var(--socged-text); }
.socged-pagination__btn--active {
  background: var(--socged-primary);
  color: #fff;
}
.socged-pagination__btn--active:hover { background: var(--socged-primary-hover); color: #fff; }
.socged-pagination__btn:disabled,
.socged-pagination__btn--disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* ===================== BULK BAR ===================== */

.socged-bulk-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  z-index: 60;
  background: var(--socged-primary);
  color: #fff;
  padding: 14px 20px;
  border-radius: var(--socged-radius);
  box-shadow: var(--socged-shadow-lg);
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 580px;
  max-width: calc(100vw - 32px);
  transition: transform 250ms cubic-bezier(0.4, 0, 0.2, 1);
}
.socged-bulk-bar[data-visible="true"] { transform: translateX(-50%) translateY(0); }
.socged-bulk-bar__count {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 500;
  padding-right: 16px;
  border-right: 1px solid rgba(255,255,255,0.15);
  white-space: nowrap;
}
.socged-bulk-bar__count-num {
  background: var(--socged-accent);
  color: #fff;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.socged-bulk-bar__input {
  flex: 1;
  height: 38px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--socged-radius-sm);
  padding: 0 12px;
  color: #fff;
  min-width: 220px;
}
.socged-bulk-bar__input::placeholder { color: rgba(255,255,255,0.5); }
.socged-bulk-bar__input:focus {
  outline: none;
  border-color: var(--socged-accent);
  background: rgba(255,255,255,0.15);
}

/* ===================== LOGIN ===================== */

.socged-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 15% 15%, rgba(1, 185, 180, 0.15), transparent 45%),
    radial-gradient(circle at 85% 85%, rgba(0, 77, 111, 0.18), transparent 50%),
    linear-gradient(135deg, #f8fafb 0%, #eef5f7 100%);
}
.socged-login__card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: var(--socged-radius-lg);
  padding: 40px 36px;
  box-shadow: var(--socged-shadow-lg);
  border: 1px solid var(--socged-border);
}
.socged-login__logo {
  width: 64px; height: 64px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--socged-primary), var(--socged-accent));
  display: grid; place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 24px;
  margin: 0 auto 24px;
  box-shadow: 0 8px 24px rgba(0, 77, 111, 0.25);
}
.socged-login__title {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.socged-login__subtitle {
  text-align: center;
  color: var(--socged-text-muted);
  font-size: 14px;
  margin-bottom: 32px;
}
.socged-login__providers { display: flex; flex-direction: column; gap: 12px; }
.socged-login__btn {
  width: 100%;
  height: 48px;
  border-radius: var(--socged-radius-sm);
  border: 1px solid var(--socged-border-strong);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--socged-text);
  transition: all var(--socged-transition);
}
.socged-login__btn:hover {
  border-color: var(--socged-accent);
  background: #fafbfc;
  transform: translateY(-1px);
  box-shadow: var(--socged-shadow-md);
}
.socged-login__btn svg { width: 20px; height: 20px; }
.socged-login__footer {
  margin-top: 28px;
  text-align: center;
  font-size: 12px;
  color: var(--socged-text-subtle);
}

/* ===================== FLASH MESSAGES ===================== */

.socged-flash {
  margin-bottom: 16px;
}
.socged-flash__item {
  padding: 12px 16px;
  border-radius: var(--socged-radius-sm);
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
}
.socged-flash__item--error {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}
.socged-flash__item--warning {
  background: var(--socged-warn-bg);
  color: var(--socged-warn-text);
  border-color: #fde68a;
}
.socged-flash__item--info {
  background: var(--socged-info-bg);
  color: var(--socged-info-text);
  border-color: #bfdbfe;
}
.socged-flash__item--success {
  background: var(--socged-success-bg);
  color: var(--socged-success-text);
  border-color: #bbf7d0;
}

/* ===================== MODAL ===================== */

.socged-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  display: grid; place-items: center;
  z-index: 100;
  padding: 24px;
}
.socged-modal {
  background: #fff;
  width: 100%;
  max-width: 640px;
  max-height: calc(100vh - 48px);
  border-radius: var(--socged-radius-lg);
  box-shadow: var(--socged-shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.socged-modal__header {
  padding: 22px 24px;
  border-bottom: 1px solid var(--socged-border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.socged-modal__title { font-size: 17px; font-weight: 600; }
.socged-modal__subtitle { font-size: 13px; color: var(--socged-text-muted); margin-top: 4px; }
.socged-modal__close {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: grid; place-items: center;
  color: var(--socged-text-muted);
  transition: all var(--socged-transition);
}
.socged-modal__close:hover { background: var(--socged-neutral-bg); color: var(--socged-text); }
.socged-modal__body { padding: 22px 24px; overflow-y: auto; }
.socged-modal__footer {
  padding: 18px 24px;
  border-top: 1px solid var(--socged-border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: #fafbfc;
}

.socged-modal__summary {
  background: var(--socged-bg);
  border: 1px solid var(--socged-border);
  border-radius: var(--socged-radius-sm);
  padding: 12px 14px;
  margin-bottom: 18px;
  font-size: 13px;
}
.socged-modal__summary-title {
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--socged-text);
}

.socged-compact-table { width: 100%; font-size: 12px; }
.socged-compact-table td {
  padding: 6px 0;
  border-bottom: 1px dashed var(--socged-border);
  color: var(--socged-text-muted);
}
.socged-compact-table tr:last-child td { border-bottom: none; }
.socged-compact-table td:first-child { font-weight: 500; color: var(--socged-text); }

.socged-textarea {
  width: 100%;
  min-height: 80px;
  padding: 12px;
  border: 1px solid var(--socged-border-strong);
  border-radius: var(--socged-radius-sm);
  background: #fff;
  resize: vertical;
  transition: border-color var(--socged-transition), box-shadow var(--socged-transition);
}
.socged-textarea:focus {
  outline: none;
  border-color: var(--socged-accent);
  box-shadow: 0 0 0 3px var(--socged-accent-soft);
}

/* ===================== RESEND FORM PAGE ===================== */

.socged-resend {
  max-width: 640px;
  margin: 0 auto;
}
.socged-resend__title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
}
.socged-resend__doc-info {
  background: var(--socged-bg);
  border: 1px solid var(--socged-border);
  border-radius: var(--socged-radius-sm);
  padding: 16px 18px;
  margin-bottom: 20px;
}
.socged-resend__doc-info h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--socged-primary);
  margin-bottom: 10px;
}
.socged-resend__doc-info p {
  font-size: 13px;
  color: var(--socged-text-muted);
  margin-bottom: 4px;
}
.socged-resend__doc-info p strong {
  color: var(--socged-text);
}
.socged-resend__doc-item {
  padding: 8px 0;
}
.socged-resend__divider {
  border: none;
  border-top: 1px solid var(--socged-border);
  margin: 8px 0;
}
.socged-resend__actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

/* ===================== SELECT2 OVERRIDES ===================== */

.select2-container--default .select2-selection--single {
  height: 40px;
  border: 1px solid var(--socged-border-strong);
  border-radius: var(--socged-radius-sm);
  padding: 0 12px;
  display: flex;
  align-items: center;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
  padding-left: 0;
  line-height: 40px;
  color: var(--socged-text);
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 40px;
}
.select2-container--default.select2-container--focus .select2-selection--single {
  border-color: var(--socged-accent);
  box-shadow: 0 0 0 3px var(--socged-accent-soft);
}
.select2-dropdown {
  border: 1px solid var(--socged-border-strong);
  border-radius: var(--socged-radius-sm);
  box-shadow: var(--socged-shadow-md);
}
.select2-results__option--highlighted {
  background-color: var(--socged-accent-soft) !important;
  color: var(--socged-text) !important;
}

/* ===================== RESPONSIVE ===================== */

@media (max-width: 768px) {
  .socged-main { padding: 20px 16px 120px; }
  .socged-header { padding: 0 16px; }
  .socged-header__name { display: none; }
  .socged-bulk-bar {
    min-width: 0;
    left: 16px; right: 16px;
    transform: translateX(0) translateY(120%);
    flex-wrap: wrap;
  }
  .socged-bulk-bar[data-visible="true"] { transform: translateX(0) translateY(0); }
  .socged-filters__grid { grid-template-columns: 1fr; }
}
