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

:root {
  /* Import GESEC design tokens */
  --cuivre:      #C79B66;
  --cuivre-light:#f0e4d0;
  --cuivre-pale: #faf5ee;
  --beton:       #6F7884;
  --beton-light: #e8eaec;
  --beton-pale:  #f4f5f6;
  --black-cable: #222B41;

  --vert:   #8BC050;
  --bleu:   #0088BD;
  --jaune:  #F1BB1C;
  --rose:   #CC0177;

  --bg:         #f7f4ef;
  --surface:    #ffffff;
  --surface2:   #f4f2ee;
  --border:     #e5e0d8;
  --border2:    #d4cec4;
  --text:       var(--black-cable);
  --text-muted: var(--beton);
  --text-light: #a8a094;

  --ok:   #8BC050;
  --err:  #e05050;
  --warn: var(--cuivre);

  /* App-specific aliases */
  --primary: var(--black-cable);
  --accent: var(--cuivre);
  --secondary: var(--beton);
  --light-bg: var(--surface2);
}

body {
  font-family: 'Nunito Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  background-color: var(--bg);
  line-height: 1.6;
}

/* Navbar */
.navbar {
  background-color: var(--primary);
  color: white;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.navbar-brand h1 {
  font-size: 1.2rem;
  font-weight: 600;
}

.nav-links {
  display: flex;
  gap: 2rem;
}

.nav-link {
  color: white;
  text-decoration: none;
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  font-size: 0.9rem;
  transition: background-color 0.2s;
}

.nav-link:hover,
.nav-link.active {
  background-color: var(--accent);
}

/* Pages */
.page {
  display: none;
  animation: fadeIn 0.3s ease-in;
}

.page.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-header {
  padding: 1.5rem 2rem;
  background-color: white;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.page-header h2 {
  font-size: 1.5rem;
  color: var(--primary);
}

.btn-back {
  background: none;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  color: var(--primary);
  padding: 0.4rem;
}

/* Home page */
.hero {
  text-align: center;
  padding: 2rem 2rem 1rem;
  background: linear-gradient(135deg, var(--primary) 0%, #2c3e50 100%);
  color: white;
}

.hero h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.week-context {
  font-size: 0.95rem;
  opacity: 0.95;
  padding: 1rem;
  background-color: rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  backdrop-filter: blur(10px);
  margin: 0 auto 0;
  max-width: 600px;
}

.week-context h3 {
  margin: 0 0 0.3rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.week-context p {
  margin: 0;
  font-size: 0.85rem;
  opacity: 0.9;
}

/* Actions Container */
.actions-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.2rem;
  max-width: 900px;
  margin: 0 auto;
  padding: 1.2rem 2rem;
  background-color: white;
  border-bottom: 1px solid var(--border);
}

.action-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.6rem;
  padding: 1rem;
  background-color: var(--surface);
  border-radius: 6px;
  border: 1px solid var(--border);
  justify-content: space-between;
  min-height: 300px;
}

.action-icon {
  font-size: 2rem;
}

.action-day {
  font-size: 1.2rem;
  font-weight: 800;
  color: white;
  background-color: var(--accent);
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  display: inline-block;
}

.action-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary);
}

.action-deadline {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Cards - Hidden, using actions-container instead */
.cards-container {
  display: none;
}

.card {
  background: white;
  border-radius: 6px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s, box-shadow 0.2s;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
}

.card-icon {
  font-size: 2.5rem;
  margin-bottom: 0.8rem;
  text-align: center;
}

.card h3 {
  color: var(--primary);
  margin-bottom: 0.4rem;
  font-size: 1.1rem;
  text-align: center;
}

.card p {
  color: #666;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  line-height: 1.4;
  text-align: center;
}

.card .card-actions {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  align-items: center;
  justify-content: center;
  margin-top: auto;
}

.status-badge {
  display: inline-block;
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.status-badge.open {
  background-color: rgba(139, 192, 80, 0.15);
  color: #4D6B2A;
}

.status-badge.closed {
  background-color: rgba(224, 80, 80, 0.15);
  color: #8B3C3C;
}

.status-badge.soon {
  background-color: rgba(199, 155, 102, 0.15);
  color: #8B6B47;
}

/* Forms */
.form-container {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 1.5rem;
  padding: 0 2rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.publication-form {
  background: white;
  padding: 1.5rem;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.form-row {
  margin-bottom: 1.2rem;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--primary);
  font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 0.6rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.9rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(199, 155, 102, 0.1);
}

.form-group small {
  font-size: 0.8rem;
  color: #999;
  margin-top: 0.2rem;
}

.char-count {
  font-size: 0.8rem;
  color: #999;
  margin-top: 0.2rem;
  text-align: right;
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.radio-group label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: normal;
  cursor: pointer;
  font-size: 0.9rem;
}

.radio-group input[type="radio"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent);
}

.segments-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.6rem;
}

.segments-list label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem;
  background-color: var(--light-bg);
  border-radius: 4px;
  cursor: pointer;
  font-weight: normal;
  font-size: 0.85rem;
}

.segments-list input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent);
}

.form-actions {
  display: flex;
  gap: 0.8rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

/* Buttons */
.btn {
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 4px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

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

.btn-primary:hover {
  background-color: #B8854F;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(199, 155, 102, 0.3);
}

.btn-secondary {
  background-color: var(--secondary);
  color: white;
}

.btn-secondary:hover {
  background-color: #5A6874;
}

/* Preview Panel */
.preview-panel {
  background: white;
  padding: 1.2rem;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  height: fit-content;
  position: sticky;
  top: 1rem;
  min-width: 400px;
}

.preview-panel h3 {
  margin-bottom: 0.8rem;
  color: var(--primary);
  font-size: 1rem;
}

.preview-content {
  min-height: 180px;
  background-color: var(--light-bg);
  padding: 0.8rem;
  border-radius: 4px;
  border-left: 3px solid var(--accent);
  font-size: 0.9rem;
}

.preview-block {
  background: white;
  padding: 0.8rem;
  border-radius: 4px;
  margin-bottom: 0.8rem;
}

.preview-block-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.4rem;
}

.preview-block-description {
  color: #666;
  font-size: 0.85rem;
  line-height: 1.4;
}

.preview-block-meta {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.6rem;
  flex-wrap: wrap;
}

.preview-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* Deadline Alert */
.deadline-alert {
  padding: 0.5rem 0.8rem;
  border-radius: 4px;
  border-left: 2px solid;
  font-size: 0.8rem;
  white-space: nowrap;
}

.deadline-alert.warning {
  background-color: rgba(199, 155, 102, 0.15);
  border-color: var(--warn);
  color: #8B6B47;
}

.deadline-alert.danger {
  background-color: rgba(224, 80, 80, 0.15);
  border-color: var(--err);
  color: #8B3C3C;
}

.deadline-alert.success {
  background-color: rgba(139, 192, 80, 0.15);
  border-color: var(--ok);
  color: #4D6B2A;
}

.deadline-alert h4 {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  display: inline;
}

.deadline-alert p {
  margin: 0;
  font-size: 0.75rem;
  display: inline;
  margin-left: 0.3rem;
}

/* Tracking page */
.tracking-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem 2rem;
}

.week-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  background: white;
  padding: 1rem;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.btn-week-nav {
  background-color: var(--accent);
  color: white;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.btn-week-nav:hover {
  background-color: #B8854F;
  transform: translateY(-1px);
}

.current-week-label {
  font-weight: 700;
  color: var(--primary);
  text-align: center;
  flex: 1;
}

.weeks-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.week-section {
  background: white;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  border: 1px solid var(--border);
}

.week-header {
  background-color: var(--surface2);
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  color: var(--primary);
}

.week-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--border);
}

.week-column {
  border-right: 1px solid var(--border);
}

.week-column:last-child {
  border-right: none;
}

.week-column-header {
  background-color: #fafaf9;
  padding: 0.8rem 1rem;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--primary);
  border-bottom: 1px solid var(--border);
}

.publications-list {
  display: flex;
  flex-direction: column;
}

.publication-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}

.publication-item:last-child {
  border-bottom: none;
}

.publication-info {
  flex: 1;
}

.publication-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.4rem;
  color: var(--primary);
}

.publication-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.8rem;
  color: #666;
  flex-wrap: wrap;
}

.publication-status {
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-right: 1rem;
  white-space: nowrap;
}

.status-pending {
  background-color: rgba(199, 155, 102, 0.15);
  color: #8B6B47;
}

.status-validated {
  background-color: rgba(139, 192, 80, 0.15);
  color: #4D6B2A;
}

.status-rejected {
  background-color: rgba(224, 80, 80, 0.15);
  color: #8B3C3C;
}

.status-published {
  background-color: rgba(0, 136, 189, 0.15);
  color: #004D6F;
}

.remi-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
  background: white;
  padding: 1rem;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.remi-actions .btn {
  text-align: center;
}

.generated-code {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  padding: 1.5rem;
  border-radius: 6px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  z-index: 2000;
  width: 98%;
  height: 95vh;
  max-width: none;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.generated-code-header {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
  flex-shrink: 0;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.generated-code h3 {
  margin: 0;
  color: var(--primary);
  font-size: 1rem;
  font-weight: 600;
}

.generated-code-header h3:nth-child(2) {
  text-align: center;
}

.generated-code-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #999;
  padding: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.generated-code-close:hover {
  color: var(--primary);
}

.generated-code-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  overflow: hidden;
  flex: 1;
}

.generated-code-left {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.generated-code-right {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-left: 1px solid var(--border);
  padding-left: 1rem;
  min-width: 0;
}

.generated-code textarea {
  flex: 1;
  padding: 1rem;
  font-family: 'Courier New', monospace;
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  overflow-y: auto;
}

.mjml-preview {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: white;
  overflow-y: auto;
}

.generated-code .btn {
  align-self: flex-start;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 1rem;
  animation: fadeIn 0.2s;
}

.modal-content {
  background: white;
  border-radius: 6px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  max-width: 650px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  color: var(--primary);
  font-size: 1.2rem;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: #999;
  padding: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  color: var(--primary);
}

.modal-body {
  padding: 1.5rem;
  flex: 1;
  overflow-y: auto;
}

.detail-section {
  margin-bottom: 1.5rem;
}

.detail-section:last-of-type {
  margin-bottom: 0;
}

.detail-section h4 {
  color: var(--primary);
  margin-bottom: 0.8rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--accent);
  font-size: 0.95rem;
}

.detail-section p {
  margin-bottom: 0.6rem;
  line-height: 1.5;
  font-size: 0.9rem;
}

.detail-section a {
  color: var(--accent);
  text-decoration: none;
  word-break: break-all;
  font-size: 0.85rem;
}

.detail-section a:hover {
  text-decoration: underline;
}

.modal-actions {
  display: flex;
  gap: 0.8rem;
  padding: 1.5rem;
  border-top: 1px solid var(--border);
  background-color: var(--light-bg);
  flex-wrap: wrap;
}

.modal-actions .btn {
  flex: 1;
  min-width: 120px;
}

/* Responsive */
@media (max-width: 768px) {
  .form-container {
    grid-template-columns: 1fr;
  }

  .preview-panel {
    position: static;
  }

  .cards-container {
    grid-template-columns: 1fr;
  }

  .timeline {
    grid-template-columns: 1fr;
  }

  .hero h2 {
    font-size: 1.5rem;
  }

  .navbar {
    flex-direction: column;
    gap: 0.8rem;
  }

  .filters {
    grid-template-columns: 1fr;
  }

  .publication-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.8rem;
  }

  .modal-actions {
    flex-direction: column;
  }

  .modal-actions .btn {
    width: 100%;
  }
}
