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

/* ==========================================================================
   ReqLord — Indigo Slate design system
   ========================================================================== */

:root{
  /* palette — deep navy/blue primary, muted slate secondary, no purple */
  --color-primary: #1F3B73;
  --color-primary-dark: #142850;
  --color-primary-light: #2F6FED;
  --color-secondary: #5C7290;
  --color-accent: #F5A623;
  --color-accent-dark: #D6870C;

  --color-bg: #F4F6FA;
  --color-surface: #FFFFFF;
  --color-surface-alt: #F7F9FC;

  --color-text: #101828;
  --color-text-muted: #5A6478;
  --color-border: #E2E6EE;

  /* sidebar (dark navy) */
  --color-sidebar-bg: #101C36;
  --color-sidebar-bg-alt: #16233F;
  --color-sidebar-border: rgba(255,255,255,0.08);
  --color-sidebar-text: #C4CCE0;
  --color-sidebar-text-muted: #7E8BAA;
  --color-sidebar-active-bg: rgba(47,111,237,0.18);
  --color-sidebar-active-text: #FFFFFF;

  --color-success: #1FA97A;
  --color-warning: #F0A63B;
  --color-error: #E0483E;
  --color-info: #3B7DE0;

  --color-success-bg: #E6F7EF;
  --color-warning-bg: #FDF1E1;
  --color-error-bg: #FBE9E8;
  --color-info-bg: #E8F0FD;

  --priority-p1: #E0483E;
  --priority-p2: #F0863B;
  --priority-p3: #3B7DE0;
  --priority-p4: #8B90A8;

  --align-aligned: #1FA97A;
  --align-tension: #F0A63B;
  --align-conflict: #E0483E;

  /* typography */
  --font-family: 'Plus Jakarta Sans', 'Inter', system-ui, -apple-system, sans-serif;
  --font-family-heading: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
  --heading-weight: 700;
  --body-weight: 400;
  --body-size: 15px;
  --small-size: 13px;
  --h1-size: 28px;
  --h2-size: 22px;
  --h3-size: 18px;
  --line-height: 1.55;

  /* layout */
  --sidebar-width: 248px;
  --topnav-height: 64px;
  --max-width: 1360px;
  --content-padding: 28px;
  --radius-card: 14px;
  --radius-control: 8px;
  --shadow: 0 1px 2px rgba(30,35,90,0.06), 0 6px 18px rgba(30,35,90,0.07);
  --shadow-hover: 0 4px 10px rgba(30,35,90,0.1), 0 14px 28px rgba(30,35,90,0.12);
  --transition: 160ms ease;
}

/* ==========================================================================
   Reset
   ========================================================================== */

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

html{
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body{
  font-family: var(--font-family);
  font-weight: var(--body-weight);
  font-size: var(--body-size);
  line-height: var(--line-height);
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

img, svg, video{ max-width: 100%; display: block; }

a{ color: var(--color-primary); text-decoration: none; }
a:hover{ color: var(--color-primary-dark); }

ul, ol{ list-style: none; }

button{ font-family: inherit; cursor: pointer; }

h1, h2, h3, h4, h5, h6{
  font-family: var(--font-family-heading);
  font-weight: var(--heading-weight);
  color: var(--color-text);
  line-height: 1.25;
}
h1{ font-size: var(--h1-size); }
h2{ font-size: var(--h2-size); }
h3{ font-size: var(--h3-size); }

p{ margin-bottom: 0.75em; }

table{ border-collapse: collapse; width: 100%; }

/* ==========================================================================
   App shell / layout
   ========================================================================== */

.app-shell{
  display: flex;
  min-height: 100vh;
}

.main-content{
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page-content{
  flex: 1;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--content-padding);
}

.container{
  width: 100%;
}

/* ==========================================================================
   Slim topbar (page title + user/org info — NOT a navigation bar)
   ========================================================================== */

.topbar{
  height: var(--topnav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 28px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar-title{
  font-family: var(--font-family-heading);
  font-weight: 700;
  font-size: 17px;
  color: var(--color-text);
}

.topbar-right{
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-org{
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted);
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  padding: 7px 12px;
}

.nav-user{
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-avatar{
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-dark) 100%);
  color: #241300;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

/* ==========================================================================
   Hamburger menu button (mobile sidebar toggle) — hidden on desktop, the
   sidebar there stays fixed/always-visible exactly as before.
   ========================================================================== */

.hamburger-btn{
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  padding: 0;
  margin-right: 4px;
}

.hamburger-btn .hamburger-line{
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--color-text);
  transition: transform var(--transition), opacity var(--transition);
}

.hamburger-btn[aria-expanded="true"] .hamburger-line:nth-child(1){
  transform: translateY(6px) rotate(45deg);
}
.hamburger-btn[aria-expanded="true"] .hamburger-line:nth-child(2){
  opacity: 0;
}
.hamburger-btn[aria-expanded="true"] .hamburger-line:nth-child(3){
  transform: translateY(-6px) rotate(-45deg);
}

/* Dimmed backdrop shown behind the sidebar overlay on mobile */
.sidebar-backdrop{
  position: fixed;
  inset: 0;
  background: rgba(10,15,35,0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
  z-index: 45;
}

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

/* ==========================================================================
   Sidebar — the single source of navigation ("ReqLord Explorer")
   ========================================================================== */

.sidebar{
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--color-sidebar-bg);
  border-right: 1px solid var(--color-sidebar-border);
  display: flex;
  flex-direction: column;
  z-index: 50;
  overflow-y: auto;
}

.sidebar-header{
  height: var(--topnav-height);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  border-bottom: 1px solid var(--color-sidebar-border);
  font-family: var(--font-family-heading);
  font-weight: 800;
  font-size: 18px;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-header .nav-logo-mark{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-dark) 100%);
  color: #241300;
  font-weight: 800;
  font-size: 15px;
}

.sidebar-nav{
  flex: 1;
  padding-bottom: 20px;
}

.sidebar-group{
  padding: 18px 14px 6px;
}

.sidebar-group-label{
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-sidebar-text-muted);
  padding: 0 10px 8px;
}

.sidebar-link{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-control);
  color: var(--color-sidebar-text);
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
  border-left: 3px solid transparent;
  transition: background var(--transition), color var(--transition);
}

.sidebar-link-icon{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  flex-shrink: 0;
  font-size: 14px;
  line-height: 1;
  opacity: 0.85;
}

.sidebar-link:hover{
  background: var(--color-sidebar-bg-alt);
  color: #fff;
}

.sidebar-link.active{
  background: var(--color-sidebar-active-bg);
  color: var(--color-sidebar-active-text);
  border-left-color: var(--color-accent);
}

/* ==========================================================================
   Page header
   ========================================================================== */

.page-header{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.page-title{
  font-size: var(--h1-size);
  font-weight: 800;
  color: var(--color-text);
  letter-spacing: -0.2px;
}

.page-title-subtitle{
  margin-top: 4px;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-muted);
}

.page-header-actions{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ==========================================================================
   Cards
   ========================================================================== */

.card{
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 20px;
  transition: box-shadow var(--transition), transform var(--transition);
}

.card:hover{
  box-shadow: var(--shadow-hover);
}

.card.card-hoverable{
  cursor: pointer;
}

.card.card-hoverable:hover{
  transform: translateY(-2px);
}

.card-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--color-border);
}

.card-header h1, .card-header h2, .card-header h3{ margin: 0; }

.card-title{
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text);
}

.card-body{ color: var(--color-text); }

.card-footer{
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--color-border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.card-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}

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

.stat-card .stat-value{
  font-family: var(--font-family-heading);
  font-size: 28px;
  font-weight: 800;
  color: var(--color-primary);
}

.stat-card .stat-label{
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
  padding: 11px 20px;
  border-radius: var(--radius-control);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition), color var(--transition), border-color var(--transition);
  text-decoration: none;
}

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

.btn-primary{
  background: linear-gradient(120deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  color: #fff;
  box-shadow: 0 2px 6px rgba(46,58,135,0.28);
}

.btn-primary:hover{
  box-shadow: 0 6px 16px rgba(46,58,135,0.38), 0 0 0 3px rgba(245,166,35,0.18);
  color: #fff;
  transform: translateY(-1px);
}

.btn-secondary{
  background: var(--color-surface);
  color: var(--color-primary);
  border-color: var(--color-primary-light);
}

.btn-secondary:hover{
  background: #EEF0FC;
  color: var(--color-primary-dark);
  border-color: var(--color-primary);
}

.btn-accent{
  background: linear-gradient(120deg, var(--color-accent) 0%, var(--color-accent-dark) 100%);
  color: #2B1600;
  box-shadow: 0 2px 6px rgba(214,135,12,0.32);
}

.btn-accent:hover{
  box-shadow: 0 6px 16px rgba(214,135,12,0.4);
  transform: translateY(-1px);
}

.btn-danger{
  background: var(--color-error);
  color: #fff;
  box-shadow: 0 2px 6px rgba(224,72,62,0.3);
}

.btn-danger:hover{
  background: #C93A31;
  box-shadow: 0 6px 16px rgba(224,72,62,0.38);
  transform: translateY(-1px);
}

.btn-ghost{
  background: transparent;
  color: var(--color-text-muted);
  border-color: transparent;
}

.btn-ghost:hover{
  background: var(--color-surface-alt);
  color: var(--color-text);
}

.btn-sm{
  padding: 6px 12px;
  font-size: 12.5px;
  border-radius: 6px;
}

.btn-lg{
  padding: 14px 26px;
  font-size: 15.5px;
}

.btn-block{ width: 100%; }

.btn:disabled{
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-group{ display: inline-flex; gap: 8px; flex-wrap: wrap; }

/* ==========================================================================
   Forms
   ========================================================================== */

.form-group{
  margin-bottom: 18px;
}

.form-row{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.form-label{
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 6px;
}

.form-label .required{ color: var(--color-error); margin-left: 2px; }

.form-hint{
  font-size: 12.5px;
  color: var(--color-text-muted);
  margin-top: 5px;
}

.form-input,
.form-textarea,
.form-select{
  width: 100%;
  font-family: inherit;
  font-size: 14.5px;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-control);
  padding: 10px 13px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-textarea{
  min-height: 120px;
  resize: vertical;
  line-height: 1.5;
}

.form-select{
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' fill='none' stroke='%235B6180' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus{
  outline: none;
  border-color: var(--color-primary-light);
  box-shadow: 0 0 0 3px rgba(79,95,199,0.18);
}

.form-input::placeholder,
.form-textarea::placeholder{ color: #9DA1BC; }

.form-input.is-invalid,
.form-textarea.is-invalid,
.form-select.is-invalid{
  border-color: var(--color-error);
}

.form-error{
  font-size: 12.5px;
  color: var(--color-error);
  margin-top: 5px;
  font-weight: 600;
}

.form-checkbox,
.form-radio{
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
}

.form-actions{
  display: flex;
  gap: 10px;
  margin-top: 22px;
}

/* ==========================================================================
   Alerts / flash messages
   ========================================================================== */

.alert{
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 16px;
  border-radius: var(--radius-control);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 18px;
}

.alert-success{
  background: var(--color-success-bg);
  color: #0E7A54;
  border-color: rgba(31,169,122,0.3);
}

.alert-warning{
  background: var(--color-warning-bg);
  color: #8A5A0E;
  border-color: rgba(240,166,59,0.35);
}

.alert-error{
  background: var(--color-error-bg);
  color: #A6302A;
  border-color: rgba(224,72,62,0.32);
}

.alert-info{
  background: var(--color-info-bg);
  color: #24549C;
  border-color: rgba(59,125,224,0.3);
}

/* ==========================================================================
   Table
   ========================================================================== */

.table-wrap{
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  overflow: hidden;
  overflow-x: auto;
}

.table{
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table thead th{
  background: var(--color-surface-alt);
  color: var(--color-text-muted);
  text-transform: uppercase;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-align: left;
  padding: 13px 16px;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.table tbody td{
  padding: 13px 16px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
  vertical-align: middle;
}

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

.table tbody tr:nth-child(even){
  background: var(--color-surface-alt);
}

.table tbody tr:hover{
  background: #EEF0FC;
}

.table-actions{
  display: flex;
  gap: 8px;
}

/* ==========================================================================
   Badges
   ========================================================================== */

.badge{
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: 999px;
  line-height: 1.4;
  white-space: nowrap;
}

.badge-primary{ background: #E7EAFB; color: var(--color-primary); }
.badge-secondary{ background: #EDEFFB; color: var(--color-secondary); }
.badge-success{ background: var(--color-success-bg); color: #0E7A54; }
.badge-warning{ background: var(--color-warning-bg); color: #8A5A0E; }
.badge-error{ background: var(--color-error-bg); color: #A6302A; }
.badge-info{ background: var(--color-info-bg); color: #24549C; }
.badge-neutral{ background: #ECEDF4; color: var(--color-text-muted); }

/* priority chips */
.badge-p1{ background: rgba(224,72,62,0.12); color: var(--priority-p1); }
.badge-p2{ background: rgba(240,134,59,0.14); color: var(--priority-p2); }
.badge-p3{ background: rgba(59,125,224,0.13); color: var(--priority-p3); }
.badge-p4{ background: rgba(139,144,168,0.16); color: var(--priority-p4); }

/* alignment verdict badges */
.badge-aligned{ background: var(--color-success-bg); color: var(--align-aligned); }
.badge-tension{ background: var(--color-warning-bg); color: var(--align-tension); }
.badge-conflict{ background: var(--color-error-bg); color: var(--align-conflict); }

/* ==========================================================================
   Kanban board
   ========================================================================== */

.board{
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.board-column{
  flex: 0 0 280px;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: 14px;
  min-height: 200px;
}

.board-column-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 0 4px;
}

.board-column-title{
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
}

.board-column-count{
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-muted);
  padding: 2px 9px;
}

.board-card{
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--priority-p4);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 13px 14px;
  margin-bottom: 10px;
  transition: box-shadow var(--transition), transform var(--transition);
  cursor: pointer;
}

.board-card:hover{
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.board-card.priority-p1{ border-left-color: var(--priority-p1); }
.board-card.priority-p2{ border-left-color: var(--priority-p2); }
.board-card.priority-p3{ border-left-color: var(--priority-p3); }
.board-card.priority-p4{ border-left-color: var(--priority-p4); }

.board-card-title{
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 8px;
  color: var(--color-text);
}

.board-card-meta{
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* ==========================================================================
   Chat (AI refinement)
   ========================================================================== */

.chat-shell{
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  height: 70vh;
  min-height: 0;
  overflow: hidden;
}

.chat-toolbar{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-alt);
}

.chat-messages{
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.chat-bubble{
  max-width: 70%;
  padding: 12px 15px;
  border-radius: 14px;
  font-size: 14.5px;
  line-height: 1.5;
}

.chat-bubble-user{
  align-self: flex-end;
  background: linear-gradient(120deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  color: #fff;
  border-radius: 14px 14px 4px 14px;
}

.chat-bubble-assistant{
  align-self: flex-start;
  background: var(--color-surface-alt);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 14px 14px 14px 4px;
}

.chat-input-bar{
  display: flex;
  gap: 10px;
  align-items: flex-end;
  padding: 14px 18px;
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
}

.chat-input-bar .form-textarea{ min-height: 46px; }

.chat-save-draft{
  margin: 0 18px 14px;
}

/* ==========================================================================
   Refine with AI panel (create/edit requirement form)
   ========================================================================== */

.refine-grid{
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 20px;
  align-items: start;
}

.refine-panel{
  position: sticky;
  top: 16px;
}

.refine-panel-hint{
  font-size: 13px;
  margin: 0 0 14px;
}

.refine-panel-body.is-collapsed .refine-panel-hint,
.refine-panel-body.is-collapsed .refine-chat-shell{
  display: none;
}

.refine-chat-shell{
  height: 460px;
}

.refine-suggestions{
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.suggestion-item{
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  padding: 10px 12px;
  font-size: 13.5px;
  line-height: 1.5;
}

.suggestion-text strong{ color: var(--color-primary); }

.suggestion-apply-btn{ align-self: flex-start; }

/* ==========================================================================
   Misc utilities
   ========================================================================== */

.text-muted{ color: var(--color-text-muted); }
.text-center{ text-align: center; }
.text-right{ text-align: right; }
.flex{ display: flex; }
.flex-between{ display: flex; align-items: center; justify-content: space-between; }
.gap-8{ gap: 8px; }
.gap-12{ gap: 12px; }
.mt-8{ margin-top: 8px; }
.mt-16{ margin-top: 16px; }
.mb-16{ margin-bottom: 16px; }
.empty-state{
  text-align: center;
  padding: 60px 20px;
  color: var(--color-text-muted);
}
.empty-state h3{ margin-bottom: 8px; color: var(--color-text); }

.divider{
  height: 1px;
  background: var(--color-border);
  margin: 20px 0;
}

/* ==========================================================================
   Auth / centered pages (login, magic link)
   ========================================================================== */

.auth-shell{
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 20% 20%, var(--color-primary) 0%, var(--color-primary-dark) 55%, #0A1730 100%);
  padding: 20px;
}

.auth-card{
  width: 100%;
  max-width: 400px;
  background: var(--color-surface);
  border-radius: var(--radius-card);
  box-shadow: 0 20px 50px rgba(10,12,40,0.35);
  padding: 34px 30px;
}

.auth-logo{
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-family-heading);
  font-weight: 800;
  font-size: 20px;
  color: var(--color-primary);
  margin-bottom: 22px;
}

/* ==========================================================================
   Roadmap — lane-per-project week timeline
   ========================================================================== */

.roadmap-scroll{
  overflow-x: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  -webkit-overflow-scrolling: touch;
}

.roadmap-grid{
  position: relative;
  min-width: calc(var(--roadmap-label-width) + (var(--roadmap-weeks) * var(--roadmap-week-width)));
}

.roadmap-today-marker{
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--color-accent);
  z-index: 1;
  pointer-events: none;
}

.roadmap-row{
  display: flex;
  border-bottom: 1px solid var(--color-border);
}

.roadmap-row:last-child{ border-bottom: none; }

.roadmap-label-spacer{
  flex: 0 0 var(--roadmap-label-width);
  width: var(--roadmap-label-width);
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  gap: 8px;
}

.roadmap-track{
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(var(--roadmap-weeks), var(--roadmap-week-width));
}

.roadmap-months-track,
.roadmap-weeks-track{
  min-height: 34px;
}

.roadmap-month-cell{
  grid-row: 1;
  padding: 8px 10px;
  font-weight: 600;
  font-size: var(--small-size);
  color: var(--color-text-muted);
  border-left: 1px solid var(--color-border);
}

.roadmap-week-cell{
  grid-row: 1;
  padding: 8px 6px;
  font-size: 12px;
  color: var(--color-text-muted);
  text-align: center;
  border-left: 1px solid var(--color-border);
}

.roadmap-week-cell.is-today{
  color: var(--color-accent-dark);
  font-weight: 700;
}

.roadmap-months-row .roadmap-label-spacer,
.roadmap-weeks-row .roadmap-label-spacer{
  background: var(--color-surface-alt);
}

.roadmap-lane-toggle{
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  font-family: inherit;
  font-weight: 600;
  font-size: var(--body-size);
  color: var(--color-text);
  padding: 0;
  min-width: 0;
  overflow: hidden;
}

.roadmap-lane-name{
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.roadmap-lane-chevron{
  display: inline-block;
  transition: transform var(--transition);
  color: var(--color-text-muted);
  flex: 0 0 auto;
}

.roadmap-lane.is-collapsed .roadmap-lane-chevron{
  transform: rotate(-90deg);
}

.roadmap-lane-count{ flex: 0 0 auto; }

.roadmap-lane-track{
  grid-auto-flow: row dense;
  grid-auto-rows: minmax(40px, auto);
  align-items: start;
  gap: 6px 0;
  padding: 8px 0;
  position: relative;
}

.roadmap-card{
  position: relative;
  grid-row: auto;
  margin: 0 4px;
  padding: 6px 10px;
  border-radius: 8px;
  border-left: 3px solid var(--color-info);
  background: var(--color-info-bg);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  cursor: pointer;
  overflow: hidden;
  z-index: 2;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition), opacity var(--transition);
}

.roadmap-card:hover{ box-shadow: var(--shadow-hover); }

.roadmap-card.is-executed{
  background: var(--color-success-bg);
  border-left-color: var(--color-success);
  opacity: 0.85;
}

.roadmap-card.is-saving{ opacity: 0.5; }

.roadmap-card.is-clipped-left{ border-top-left-radius: 0; border-bottom-left-radius: 0; }
.roadmap-card.is-clipped-right{ border-top-right-radius: 0; border-bottom-right-radius: 0; }

.roadmap-card-title{
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.roadmap-card-resize{
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 8px;
  cursor: ew-resize;
}

.roadmap-card-resize:hover{ background: rgba(31,59,115,0.12); }

.roadmap-card[draggable="true"]{ cursor: grab; }

.roadmap-legend{
  display: flex;
  gap: 20px;
  margin-top: 12px;
  color: var(--color-text-muted);
  font-size: var(--small-size);
}

.roadmap-legend-item{ display: inline-flex; align-items: center; gap: 6px; }

.roadmap-swatch{
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border-left: 3px solid var(--color-info);
  background: var(--color-info-bg);
}

.roadmap-swatch.is-executed{
  border-left-color: var(--color-success);
  background: var(--color-success-bg);
}

.roadmap-today-swatch{
  display: inline-block;
  width: 2px;
  height: 14px;
  background: var(--color-accent);
}

/* ==========================================================================
   Roadmap detail modal
   ========================================================================== */

.roadmap-modal-backdrop{
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(16,24,40,0.5);
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.roadmap-modal-backdrop.is-visible{ display: flex; }

.roadmap-modal{
  background: var(--color-surface);
  border-radius: var(--radius-card);
  box-shadow: 0 20px 50px rgba(10,12,40,0.35);
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

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

.roadmap-modal-close{
  background: none;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: var(--color-text-muted);
  padding: 4px 8px;
}

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

.roadmap-modal-body{
  padding: 20px;
  overflow-y: auto;
}

.roadmap-modal-footer{
  padding: 14px 20px;
  border-top: 1px solid var(--color-border);
  text-align: right;
}

/* ==========================================================================
   Responsive — 768px breakpoint
   ========================================================================== */

@media (max-width: 768px){
  body.sidebar-locked{
    overflow: hidden;
  }

  .hamburger-btn{
    display: flex;
  }

  .sidebar{
    transform: translateX(-100%);
    transition: transform var(--transition);
    box-shadow: 0 0 0 rgba(0,0,0,0);
    width: min(var(--sidebar-width), 82vw);
  }

  .sidebar.is-open{
    transform: translateX(0);
    box-shadow: 8px 0 24px rgba(20,24,63,0.2);
  }

  .main-content{
    margin-left: 0;
  }

  .topbar{
    padding: 0 14px;
    gap: 10px;
  }

  .topbar-title{
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 15px;
  }

  .topbar-right{
    gap: 10px;
  }

  .topbar-org{
    display: none;
  }

  .nav-user{
    gap: 8px;
  }

  .page-content{
    padding: 16px;
  }

  .page-header{
    flex-direction: column;
    align-items: stretch;
  }

  .page-header-actions{
    width: 100%;
  }

  .page-header-actions .btn{
    flex: 1;
  }

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

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

  .refine-panel{
    position: static;
  }

  .refine-chat-shell{
    height: 60vh;
  }

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

  .board{
    gap: 12px;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
  }

  .board-column{
    flex: 0 0 82vw;
    scroll-snap-align: start;
  }

  .roadmap-label-spacer{
    flex-basis: 140px;
    width: 140px;
    padding: 0 8px;
  }

  .roadmap-lane-name{
    font-size: 13px;
  }

  .page-header-actions .btn-sm{
    min-height: 38px;
  }

  .roadmap-modal{
    max-height: 92vh;
  }

  .table-wrap{
    border-radius: 10px;
  }

  .chat-bubble{
    max-width: 88%;
  }

  .chat-input-bar{
    flex-wrap: wrap;
    padding: 12px 14px;
  }

  .chat-input-bar .form-textarea{
    flex: 1 1 100%;
  }

  .chat-input-bar #refine-send,
  .chat-input-bar .btn{
    flex: 1 1 100%;
  }

  .auth-card{
    padding: 26px 20px;
  }

  .btn-lg{
    padding: 12px 20px;
    font-size: 14.5px;
  }

  /* Touch-friendly tap targets */
  .sidebar-link{
    min-height: 44px;
    padding: 12px 12px;
  }

  .btn{
    min-height: 44px;
  }

  .btn-sm{
    min-height: 38px;
  }

  .form-input,
  .form-textarea,
  .form-select{
    min-height: 44px;
    font-size: 15px;
  }
}

@media (max-width: 420px){
  .nav-user-name{
    display: none;
  }

  .topbar-title{
    font-size: 14px;
  }
}
