:root {
  --bg-card: #ffffff;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --accent: #1f7a4a;
  --border: #e5e7eb;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text-primary);
  line-height: 1.5;
  background: linear-gradient(135deg, #4fae6a 0%, #d6f5df 100%);
  background-attachment: fixed;
  min-height: 100vh;
  min-width: 1200px; /* desktop-first for now */
}

body.index-page{overflow:hidden}
.index-page #appCard{overflow:visible}
.table-scroll{overflow:auto;scrollbar-gutter:stable}
.table-scroll thead th{position:sticky;top:0;z-index:5;background:rgba(255,255,255,0.96)}

.topbar {
  width: 96vw;
  margin: 0 auto;
  padding: .6rem 1rem 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: .5rem;
}

.user-menu { position: relative; }

.user-btn,
button,
.btn {
  border: 1px solid var(--accent);
  background: #fff;
  color: var(--accent);
  border-radius: 10px;
  padding: .55rem .95rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.user-btn:hover,
button:hover,
.btn:hover {
  background: #f0fdf4;
}

.back-btn{
  color: #1f2937;
  border-color: #9ca3af;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,.08);
}

.back-btn:hover{
  background: #f9fafb;
}

.user-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + .4rem);
  min-width: 180px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
  padding: .4rem;
  display: none;
  z-index: 50;
}

.user-dropdown.open { display: block; }

.menu-item {
  display: block;
  width: 100%;
  text-align: left;
  background: #fff;
  color: #111827;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: .45rem .6rem;
  cursor: pointer;
}

.menu-item:hover { background: #f3f4f6; }

header { background: transparent; border: none; }

header .container {
  width: 96vw;
  margin: 0 auto;
  padding: 1rem 1rem 1.25rem;
}

.brand {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0;
}

.brand img {
  width: min(460px, 90%);
  height: auto;
  display: block;
}

main {
  width: 96vw;
  margin: 0 auto;
  padding: 0 1rem 2rem;
}

.wrap {
  max-width: 1800px;
  margin: 0 auto;
  padding: 0;
}

.narrow-wrap{
  max-width: 980px;
}

.card {
  background-color: rgba(255, 255, 255, .92);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .08);
  backdrop-filter: blur(4px);
}

.prose-card{
  font-size: 1.05rem;
  line-height: 1.75;
}

.prose-card h2{
  margin-top: 0;
  margin-bottom: 1rem;
}

.prose-card p{
  margin: 0 0 1rem;
  max-width: 70ch;
}

.prose-card p:last-child{
  margin-bottom: 0;
}

.component-grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap:16px;
}

.component-card{
  height:100%;
}

.component-card h3{
  margin-top:0;
  margin-bottom:.85rem;
  color:#14532d;
}

.component-card p{
  margin:0 0 1rem;
}

.component-card p:last-child{
  margin-bottom:0;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.muted {
  color: var(--text-secondary);
  font-size: .9em;
}

.hidden { display: none; }

.fade-panel{opacity:1;transform:translateY(0);transition:opacity .18s ease, transform .18s ease}
.fade-panel.hidden{display:block !important;opacity:0;transform:translateY(4px);pointer-events:none;height:0;overflow:hidden;margin:0;padding:0;border:0}

input, button, select, textarea {
  padding: 8px;
  margin: 4px 0;
  font: inherit;
}

label {
  display: block;
  font-weight: 600;
  font-size: .9em;
  color: #374151;
  margin-top: 8px;
}

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

th, td {
  border-bottom: 1px solid #eee;
  padding: 8px;
  text-align: left;
}
.requirements-table th{white-space:nowrap}
.requirements-table th,
.requirements-table td{border-bottom:none !important}

.filters-row{display:flex;align-items:center;gap:10px;margin:10px 0 12px;flex-wrap:nowrap}
.filter-box{position:relative}
.filter-box summary{list-style:none;cursor:pointer;border:1px solid var(--accent);background:#fff;color:var(--accent);border-radius:10px;padding:.45rem .75rem;font-weight:600}
.filter-box summary::-webkit-details-marker{display:none}
.filter-box.in-table summary{border:none;background:transparent;color:var(--text-primary);padding:0;font-weight:700;white-space:nowrap}
.filter-box.in-table summary::after{content:' ▾';color:#6b7280;font-weight:600}
.filter-options{position:absolute;z-index:20;top:calc(100% + 6px);left:0;min-width:250px;max-height:280px;overflow:auto;background:#fff;border:1px solid var(--border);border-radius:10px;padding:8px;box-shadow:0 10px 24px rgba(0,0,0,.12)}
.filter-options label{display:flex;gap:8px;align-items:flex-start;margin:4px 0;font-weight:500}

.requirements-table{table-layout:fixed}
.requirements-table th:nth-child(1), .requirements-table td:nth-child(1){width:105px}
.requirements-table th:nth-child(2), .requirements-table td:nth-child(2){width:330px}
.requirements-table th:nth-child(3), .requirements-table td:nth-child(3){width:170px}
.requirements-table th:nth-child(4), .requirements-table td:nth-child(4){width:220px}
.requirements-table th:nth-child(5), .requirements-table td:nth-child(5){width:auto}

.requirements-table tr{height:auto}
.requirements-table td{vertical-align:top;line-height:1.4;overflow:hidden;padding-top:10px;padding-bottom:10px;min-height:3.8em}
.requirements-table td:nth-child(1),
.requirements-table td:nth-child(3),
.requirements-table td:nth-child(4){
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.requirements-table td:nth-child(2){
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.requirements-table td:nth-child(5){
  overflow:hidden;
}
.snippet-cell{overflow:hidden}

#rows tr:nth-child(odd) { background: rgba(255,253,245,0.92); }
#rows tr:nth-child(even) { background: rgba(250,246,232,0.92); }
#rows tr:hover { background: rgba(219,242,226,0.95) !important; }
#rows tr { transition: background-color .15s ease; }



.badge{display:inline-block;padding:.18rem .48rem;border-radius:999px;border:1px solid transparent;font-size:.78rem;font-weight:600;line-height:1.2;white-space:nowrap}
.badge.status-faststallt{background:#eaf8ee;border-color:#b9e3c3;color:#156b33}
.badge.status-nytt_kravforslag{background:#f3f4f6;border-color:#e5e7eb;color:#374151}
.badge.status-under_implementation{background:#eef6ff;border-color:#cfe3ff;color:#1e4f8a}
.badge.status-avvisat{background:#fef2f2;border-color:#fecaca;color:#991b1b}
.badge.status-avvecklat{background:#fff7ed;border-color:#fed7aa;color:#9a3412}
.badge-app{background:#eef9ff;border-color:#cbe9ff;color:#0f4f79;margin-right:4px;margin-bottom:3px}
.cell-snippet{color:#374151;white-space:normal;line-height:1.4;height:2.8em;max-height:2.8em;overflow:hidden;display:block}
.cell-snippet-inner{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden}
.cell-snippet, .cell-snippet *{line-height:1.4 !important}
.cell-snippet .muted-more{color:#6b7280}
.token-chip{display:inline;padding:0 .08em;border-radius:3px;background:#fff3cd;color:#7a4b00;font-weight:600;vertical-align:baseline}
.token-chip.token-unknown{background:#fee2e2;color:#7f1d1d}
.req-keyword{font-weight:800}

.grid { display: grid; grid-template-columns: 220px 1fr; gap: 8px 14px; }
.k { font-weight: 700; color: #374151; }
.v { white-space: pre-wrap; }
