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

:root {
  --bg: #05070d;
  --bg-elevated: #080b14;
  --sidebar-bg: rgba(10, 14, 24, 0.85);
  --card-bg: rgba(255, 255, 255, 0.035);
  --card-border: rgba(255, 255, 255, 0.08);
  --card-border-hover: rgba(255, 255, 255, 0.16);
  --accent: #3b82f6;
  --accent-glow: rgba(59, 130, 246, 0.35);
  --success: #22c55e;
  --success-glow: rgba(34, 197, 94, 0.35);
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.3);
  --warning: #f59e0b;
  --warning-glow: rgba(245, 158, 11, 0.3);
  --text: #f1f5f9;
  --text-secondary: #8b93a7;
  --radius: 1.2rem;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  --blur: blur(20px);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(ellipse 900px 500px at 15% -10%, rgba(59, 130, 246, 0.12), transparent),
    radial-gradient(ellipse 700px 500px at 100% 10%, rgba(34, 197, 94, 0.08), transparent),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ---------------- GRID BACKGROUND (bg.ibelick/background-snippets, adapted to plain CSS + dark theme) ---------------- */
.grid-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-color: var(--bg);
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 6rem 4rem;
}

.grid-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle 800px at 100% 200px, rgba(139, 92, 246, 0.22), transparent);
}

/* ---------------- LOGIN ---------------- */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background:
    radial-gradient(ellipse 800px 600px at 50% 0%, rgba(59, 130, 246, 0.16), transparent),
    radial-gradient(ellipse 600px 500px at 100% 100%, rgba(34, 197, 94, 0.1), transparent),
    var(--bg);
}

.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 380px;
  background: var(--card-bg);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  padding: 2.4rem;
}

.login-brand {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
}

.login-brand span {
  color: var(--text-secondary);
  font-weight: 500;
}

.login-sub {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1.8rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

/* ---------------- FIELDS ---------------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.field span {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.field input,
.field select,
.field textarea {
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  border-radius: 0.7rem;
  padding: 0.7rem 0.9rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field input::placeholder,
.field textarea::placeholder {
  color: rgba(139, 147, 167, 0.6);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.field-error {
  color: #f87171;
  font-size: 0.78rem;
}

.field-hint {
  color: #8b93a7;
  font-size: 0.78rem;
}

.amount-with-currency {
  display: flex;
  gap: 0.5rem;
}

.amount-with-currency input {
  flex: 1;
  min-width: 0;
}

.amount-with-currency .input-select {
  flex: 0 0 auto;
  width: auto;
}

/* ---------------- FILE INPUT (originui/input, adapted to plain CSS) ---------------- */
.field input[type="file"] {
  padding: 0;
  padding-right: 0.9rem;
  font-style: italic;
  color: var(--text-secondary);
  cursor: pointer;
}

.field input[type="file"]::file-selector-button,
.field input[type="file"]::-webkit-file-upload-button {
  height: 100%;
  margin-right: 0.9rem;
  padding: 0.7rem 0.9rem;
  border: none;
  border-right: 1px solid var(--card-border);
  border-radius: 0.7rem 0 0 0.7rem;
  background: rgba(255, 255, 255, 0.04);
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  font-style: normal;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease;
}

.field input[type="file"]:hover::file-selector-button,
.field input[type="file"]:hover::-webkit-file-upload-button {
  background: rgba(255, 255, 255, 0.08);
}

/* ---------------- BUTTONS ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.3rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #2563eb);
  color: #ffffff;
  box-shadow: 0 4px 20px -6px var(--accent-glow);
}

.btn-primary:hover {
  box-shadow: 0 10px 28px -8px var(--accent-glow);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  border: 1px solid var(--card-border);
}

.btn-ghost:hover {
  border-color: var(--card-border-hover);
  color: var(--text);
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

.btn-block {
  width: 100%;
}

.btn-add {
  margin-left: auto;
}

/* ---------------- ALERTS ---------------- */
.alert {
  padding: 0.8rem 1rem;
  border-radius: 0.7rem;
  font-size: 0.88rem;
  margin-bottom: 1.2rem;
  border: 1px solid transparent;
}

.alert-danger {
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.25);
}

.alert-success {
  background: rgba(34, 197, 94, 0.1);
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.25);
}

/* ---------------- ADMIN SHELL ---------------- */
.admin-shell {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  flex: none;
  background: var(--sidebar-bg);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-right: 1px solid var(--card-border);
  color: var(--text);
  padding: 1.8rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.sidebar-brand {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.sidebar-brand span {
  color: var(--text-secondary);
  font-weight: 500;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.sidebar-nav a {
  padding: 0.65rem 0.8rem;
  border-radius: 0.7rem;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary);
  border: 1px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.sidebar-nav a:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.sidebar-nav a.active {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.35);
  color: #93c5fd;
  box-shadow: 0 0 20px -6px var(--accent-glow);
}

.sidebar-toggle {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 40;
  background: var(--sidebar-bg);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--card-border);
  color: var(--text);
  border-radius: 0.6rem;
  padding: 0.5rem;
  cursor: pointer;
}

.admin-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.4rem 2rem;
  background: rgba(8, 11, 20, 0.6);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--card-border);
}

.admin-header-title {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
}

.admin-header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.admin-header-user {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.online-dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 8px 2px var(--success-glow), 0 0 2px var(--success);
}

.admin-content {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
}

.dashboard-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ---------------- ICON BUTTON (ShadcnStudio/buttons — outline/icon, adapted to plain CSS) ---------------- */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--card-border);
  border-radius: 0.7rem;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--card-border-hover);
  transform: translateY(-1px);
}

.btn-icon-img {
  width: 1.25rem;
  height: 1.25rem;
  object-fit: contain;
}

.btn-icon-loading {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-icon-loading .btn-icon-img {
  animation: btn-icon-spin 0.8s linear infinite;
}

@keyframes btn-icon-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* ---------------- STATS ---------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1.2rem;
}

.stat-card {
  background: var(--card-bg);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  padding: 1.4rem 1.6rem;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.stat-card:hover {
  border-color: var(--card-border-hover);
  transform: translateY(-2px);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.6rem;
}

.stat-value {
  font-family: "JetBrains Mono", monospace;
  font-size: 1.7rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.stat-success .stat-value {
  color: var(--success);
  text-shadow: 0 0 18px var(--success-glow);
}

.stat-warning .stat-value {
  color: var(--warning);
  text-shadow: 0 0 18px var(--warning-glow);
}

.stat-pending .stat-value {
  color: #8b5cf6;
  text-shadow: 0 0 18px rgba(139, 92, 246, 0.35);
}

.stat-pending {
  border-color: rgba(139, 92, 246, 0.25);
}

.stat-rowan .stat-value {
  color: #f1f5f9;
}

.stat-rowan {
  border-color: rgba(16, 185, 129, 0.25);
}

.stat-info .stat-value {
  color: #38bdf8;
  text-shadow: 0 0 18px rgba(56, 189, 248, 0.35);
}

.stat-info {
  border-color: rgba(56, 189, 248, 0.25);
}

.trend-badge {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
}

.trend-up {
  color: #86efac;
}

.trend-down {
  color: #fca5a5;
}

/* ---------------- GRADIENT BLOB CARD (ruixen.ui/gradient-bold-card, adapted to plain CSS) ---------------- */
@keyframes stat-blob-move {
  0% {
    transform: translate(-70%, -70%);
  }
  25% {
    transform: translate(70%, -70%);
  }
  50% {
    transform: translate(70%, 70%);
  }
  75% {
    transform: translate(-70%, 70%);
  }
  100% {
    transform: translate(-70%, -70%);
  }
}

.stat-blob-card {
  position: relative;
  overflow: hidden;
}

.stat-blob-card .stat-label,
.stat-blob-card .stat-value {
  position: relative;
  z-index: 2;
}

.stat-blob {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 110px;
  height: 110px;
  margin: -55px;
  border-radius: 999px;
  filter: blur(20px);
  z-index: 0;
  animation: stat-blob-move 7s linear infinite;
}

.stat-blob-glass {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: rgba(8, 11, 20, 0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.blob-pending {
  background: linear-gradient(90deg, #8b5cf6, #a78bfa, #c4b5fd);
}

.blob-success {
  background: linear-gradient(90deg, #22c55e, #4ade80, #86efac);
}

/* ---------------- CARDS ---------------- */
.card {
  background: var(--card-bg);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  padding: 1.6rem;
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.card-head h2 {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
}

.card-subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.link-more {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
}

.chart-card canvas {
  max-height: 260px;
}

/* ---------------- TABLE ---------------- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.data-table th {
  text-align: left;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--card-border);
}

.data-table td {
  padding: 0.85rem 0.8rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.data-table tfoot td {
  background: rgba(59, 130, 246, 0.08);
  font-weight: 700;
  border-top: 2px solid rgba(255, 255, 255, 0.15);
  border-bottom: none;
}

.global-total-banner {
  font-size: 0.86rem;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  border-radius: 0.7rem;
  padding: 0.6rem 0.9rem;
}

.global-total-banner strong {
  color: var(--text);
}

.pagination {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  justify-content: center;
  margin-top: 2rem;
}

.pagination a,
.pagination span {
  padding: 0.6rem 1.2rem;
  border-radius: 0.8rem;
  font-size: 1.4rem;
  font-weight: 600;
}

.pagination a {
  background: rgba(255, 255, 255, 0.06);
  color: #c9d1e0;
  text-decoration: none;
}

.pagination a:hover {
  background: rgba(255, 255, 255, 0.12);
}

.pagination .current {
  background: var(--accent);
  color: #fff;
}

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

.empty-row {
  text-align: center;
  color: var(--text-secondary);
  padding: 2rem;
}

.actions-cell {
  display: flex;
  gap: 0.9rem;
  align-items: center;
}

.link-action {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.link-danger {
  color: #f87171;
}

.inline-form {
  display: inline;
}

/* ---------------- BADGES ---------------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge-confirmee {
  background: rgba(59, 130, 246, 0.12);
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.3);
}

.badge-postee {
  background: rgba(168, 85, 247, 0.12);
  color: #c4b5fd;
  border-color: rgba(168, 85, 247, 0.3);
}

.badge-payee {
  background: rgba(34, 197, 94, 0.12);
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.3);
  box-shadow: 0 0 14px -4px var(--success-glow);
}

.badge-a-declarer {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.badge-en-cours {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}

.badge-a-venir {
  background: rgba(255, 255, 255, 0.06);
  color: #6b7280;
}

.badge-declaree {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.badge-overdue {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.35);
  margin-left: 0.5rem;
}

.row-overdue {
  background: rgba(239, 68, 68, 0.06);
}

/* ---------------- ASTRYX-STYLE ALERT BANNER ---------------- */
.astryx-banner {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.85rem;
  border-radius: 0.7rem;
  margin: 0;
  max-width: 100%;
  position: relative;
  overflow: hidden;
}

.astryx-banner-warning {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.12), rgba(239, 68, 68, 0.04));
  border: 1px solid rgba(239, 68, 68, 0.35);
  box-shadow: 0 0 18px -10px rgba(239, 68, 68, 0.5);
}

.astryx-banner-icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  min-width: 1.5rem;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.18);
  font-size: 0.75rem;
}

.astryx-banner-pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.35);
  animation: astryx-pulse 1.8s ease-out infinite;
}

@keyframes astryx-pulse {
  0% {
    transform: scale(1);
    opacity: 0.7;
  }
  100% {
    transform: scale(1.8);
    opacity: 0;
  }
}

.astryx-banner-body {
  min-width: 0;
}

.astryx-banner-title {
  font-weight: 700;
  font-size: 0.78rem;
  color: #fca5a5;
  margin-bottom: 0.15rem;
}

.astryx-banner-text {
  font-size: 0.7rem;
  color: #e5e7eb;
  line-height: 1.5;
}

.astryx-banner-text a {
  color: #fca5a5;
  text-decoration: none;
}

/* ---------------- ALERT BANNER ---------------- */
.alert-banner {
  padding: 1.4rem 2rem;
  border-radius: 1.2rem;
  margin-bottom: 2rem;
  font-size: 1.5rem;
}

.alert-banner a {
  text-decoration: underline;
  font-weight: 600;
}

.alert-warning {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #f59e0b;
}

/* ---------------- DECLARATION PAGE ---------------- */
.year-nav {
  display: flex;
  gap: 0.6rem;
}

.text-secondary {
  color: var(--text-secondary);
}

.modal {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.8rem;
  width: 100%;
  max-width: 420px;
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.modal h3 {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.1rem;
  margin-bottom: 1.2rem;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ---------------- FILTERS ---------------- */
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  align-items: center;
}

.input-search,
.input-select {
  font-family: inherit;
  font-size: 0.86rem;
  padding: 0.6rem 0.9rem;
  border-radius: 0.7rem;
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  outline: none;
}

.input-search {
  flex: 1;
  min-width: 180px;
}

.input-search:focus,
.input-select:focus {
  border-color: var(--accent);
}

/* ---------------- FORM ---------------- */
.form-card {
  max-width: 720px;
}

.collab-form {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
}

.form-row-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.calc-preview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  border-radius: 0.9rem;
  padding: 1rem 1.2rem;
}

.calc-item {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.calc-item span {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.calc-item strong {
  font-family: "JetBrains Mono", monospace;
  font-size: 1.1rem;
  font-weight: 600;
}

.calc-item-net strong {
  color: var(--success);
  text-shadow: 0 0 16px var(--success-glow);
}

.form-actions {
  display: flex;
  gap: 0.8rem;
  margin-top: 0.4rem;
}

/* ---------------- SORTABLE TABLE HEADERS ---------------- */
.data-table th.sortable {
  cursor: pointer;
  user-select: none;
}

.data-table th.sortable:hover {
  color: var(--text);
}

.sort-arrow {
  display: inline-block;
  margin-left: 0.2rem;
  opacity: 0.6;
  font-size: 0.7rem;
}

/* ---------------- WORKFLOW DATES ---------------- */
.workflow-dates {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.wf-date {
  font-size: 0.82rem;
  white-space: nowrap;
}

.wf-confirmee {
  color: #22c55e;
}

.wf-postee {
  color: #8b5cf6;
}

.wf-payee {
  color: #f59e0b;
}

/* ---------------- ATTACHMENTS ---------------- */
.attachment-icon {
  margin-left: 0.4rem;
  text-decoration: none;
  filter: grayscale(0.2);
}

.attachment-icon:hover {
  filter: none;
}

.current-attachment {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
  font-size: 0.86rem;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  border-radius: 0.7rem;
  padding: 0.7rem 0.9rem;
}

.current-attachment a {
  color: var(--accent);
  font-weight: 600;
}

.checkbox-field {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
}

/* ---------------- TABLE SCROLL HINT (mobile only) ---------------- */
.table-scroll-hint {
  display: none;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 0.6rem;
}

/* ---------------- SIDEBAR BACKDROP (mobile only) ---------------- */
.sidebar-backdrop {
  display: none;
}

/* ---------------- RESPONSIVE ---------------- */
@media (max-width: 900px) {
  .sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .admin-header {
    padding-left: 4rem;
  }
}

@media (max-width: 768px) {
  /* SIDEBAR: overlay + backdrop to close on outside click */
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  .sidebar-backdrop.open {
    opacity: 1;
    pointer-events: auto;
  }

  /* LAYOUT: full width main content, hamburger visible */
  .admin-main {
    width: 100%;
    margin-left: 0;
  }

  .sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* CARDS STATS: 2 columns */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* TABLEAUX: scrollable + hint visible */
  .data-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .table-scroll-hint {
    display: block;
  }

  /* FORMULAIRE: 1 column, full-width fields */
  .form-row,
  .form-row-3,
  .calc-preview {
    grid-template-columns: 1fr;
  }

  .field input,
  .field select,
  .field textarea {
    width: 100%;
  }

  /* FILTRES: wrap with min 45% width per item */
  .filters-bar {
    flex-wrap: wrap;
    gap: 0.7rem;
  }

  .filters-bar .input-search,
  .filters-bar .input-select {
    min-width: 45%;
    flex: 1 1 45%;
  }

  /* PAGINATION: smaller buttons */
  .pagination a,
  .pagination span {
    padding: 0.4rem 0.8rem;
    font-size: 1.1rem;
  }

  /* WORKFLOW DATES: column, slightly larger legible font */
  .workflow-dates {
    flex-direction: column;
  }

  .wf-date {
    font-size: 1.1rem;
  }

  /* DASHBOARD CHART: ensure full-width container */
  .chart-card canvas {
    width: 100% !important;
  }

  .admin-content {
    padding: 1.2rem;
  }

  /* DASHBOARD ACTIONS: keep alert banner + Google Sheet button on one row */
  .dashboard-actions {
    flex-wrap: nowrap;
    gap: 0.5rem;
  }

  .astryx-banner {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.4rem 0.6rem;
  }

  .astryx-banner-body {
    min-width: 0;
    overflow: hidden;
  }

  .astryx-banner-title,
  .astryx-banner-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .dashboard-actions #sheetExportForm {
    flex-shrink: 0;
  }
}

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

  .filters-bar .input-search,
  .filters-bar .input-select {
    min-width: 100%;
    flex: 1 1 100%;
  }
}
