:root {
  --bg: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #eef0ff;
  --accent-contrast: #1f2937;
  --surface: #f9fafb;
  --surface-2: #f3f4f6;
  --danger: #dc2626;
  --success: #bbf7d0;
  --warning: #d97706;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 4px 12px rgba(0, 0, 0, .05);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 16px/1.5 system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  padding-bottom: 72px;
}

/* Header and footer */
.msm-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.msm-header h1 { margin: 0 0 6px 0; font-size: 22px; }
.msm-breadcrumb a {
  color: var(--muted);
  text-decoration: none;
  margin-right: 12px;
}
.msm-breadcrumb a:hover { text-decoration: underline; }

.msm-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  background: var(--surface-2);
}

/* Containers */
.msm-container { max-width: 980px; margin: 24px auto; padding: 0 16px; }
.msm-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin: 16px 0;
}

.container {
  max-width: 570px;
  margin: 24px auto;
  padding: 16px;
}

/* Tables */
.table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.table th, .table td {
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
}
.table th {
  background: var(--surface);
  font-weight: 600;
  font-size: 14px;
}
.table tr:nth-child(even) { background: var(--surface-2); }

/* Forms */
.form { display: grid; gap: 12px; max-width: 640px; }
.label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.input, .select, .textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}
.textarea { min-height: 96px; resize: vertical; }


/* Buttons */
.btn {
  display: inline-block;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid #444;
  background: #f4f4ff;
  color: #111;
  text-decoration: none;
  cursor: pointer;
  font: inherit;
  line-height: 1.2;
  text-align: center;
}

.btn:hover {
  background: #e7e7fb;
}

/* Sizes */
.btn.small {
  padding: 6px 10px;
  font-size: 13px;
}

.btn.large {
  padding: 10px 14px;
  font-size: 15px;
}

/* Variants */
.btn.grey {
  background: #f4f4ff;
  color: #111;
  border-color: #444;
}

.btn.green {
  background: #dff7e2;
  color: #111;
  border-color: #444;
}

.btn.danger {
  background: #ffe0e0;
  color: #111;
  border-color: #444;
}

.btn.warning {
  background: #fff3cd;
  color: #111;
  border-color: #444;
}

.btn.back {
  background: #ffe7e7;
  color: #111;
  border-color: #444;
}

.btn.active {
  background: #e3e6ff;
  color: #111;
  border-color: #444;
  font-weight: 600;
}

.btn:disabled,
.btn.disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: none;
}

/* Color Boxes */
/* Color box */
.color-box {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid #999;
  vertical-align: middle;
}

/* Sticky back buttons */
.sticky-top,
.sticky-bottom {
  position: sticky;
  background: var(--bg);
  padding: 10px 12px;
  z-index: 10;
}

.sticky-top {
  top: 0;
  border-bottom: 1px solid var(--border);
}
.sticky-bottom {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;

  background: var(--bg);
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  z-index: 100;
}

/* Messages */
.msg {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  margin-bottom: 12px;
}
.msg.error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.badge.ok {
  background: #ecfdf5;
  border-color: #bbf7d0;
  color: #065f46;
}
.badge.no {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}
.badge.over {
  background: #86efac;
  border-color: #16a34a;
  color: #166534;
}
/* Utility classes */
.flex { display: flex; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.right { margin-left: auto; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.inline-form { margin: 0; display: inline; }
.muted { color: var(--muted); }

/* Admin form row */
.admin-form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.admin-form-row label {
  flex: 1 0 220px;
  text-align: left;
  font-weight: bold;
  margin-bottom: 0;
  white-space: nowrap;
}

.admin-form-row select,
.admin-form-row input {
  font-size: 15px;
  padding: 6px 10px;
  border-radius: 5px;
  border: 1px solid #bbb;
  margin-left: 0;
}

.admin-form-row button:not(.btn) {
  font-size: 15px;
  padding: 6px 10px;
  border-radius: 7px;
  border: 1px solid #bbb;
  background: #eafbe7;
  transition: background 0.15s;
  cursor: pointer;
  min-width: 80px;
}
.admin-form-row button:not(.btn):hover { background: #c6f7c3; }

.admin-form-row > *:not(label) { margin-left: 8px; }

@media (max-width: 600px) {
  .admin-form-row { flex-direction: column; align-items: stretch; }
  .admin-form-row label { margin-bottom: 4px; }
  .admin-form-row > *:not(label) { margin-left: 0; margin-bottom: 8px; }
}

/* Print defaults */
@media print {
  .no-print { display: none !important; }
  body { background: #fff !important; }
  .container, .msm-section { box-shadow: none !important; }
}

/* Legacy/print helpers */
.printpage { page-break-after: always; }

@media print {
  .classbox { page-break-inside: avoid; margin-bottom: 20px; }
  .printpage { page-break-after: always; }
}

.klassruta {
  border-radius: 10px;
  border: 1.5px solid #ccc;
  padding: 18px 14px;
  margin: 16px 0;
  font-size: 18px;
  background: #fff3f3;
  transition: background 0.3s;
}
.klassruta.green { background: #e4ffe1; border: 2px solid #62b65d; }
.klassruta.red { background: #ffeaea; border: 2px solid #db6363; }

.judgestatus-table tr.bedomda-0 td,
.judgestatus-table tr.bedomda-pa td,
.judgestatus-table tr.bedomda-ok td {
  background: inherit !important;
}
.msm-container.requirements-page {
  max-width: 96vw !important;
}

.msm-container.schedule-page {
  max-width: 96vw !important;
}

.msm-container.summary-page {
  max-width: 96vw !important;
}
.msm-container.models-page {
  max-width: 96vw !important;
}
/* Admin dashboard */
.admin-dashboard {
  max-width: 1200px;
  margin: 24px auto;
  padding: 0 16px 32px;
}

.admin-dashboard-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.admin-dashboard-section {
  margin-top: 26px;
}

.admin-dashboard-section h2 {
  font-size: 22px;
  margin: 0 0 10px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 6px;
}

.admin-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.admin-dashboard-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  background: #fff;
  box-shadow: var(--shadow);
}

.admin-dashboard-card h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.admin-dashboard-card p {
  margin: 0 0 12px;
  color: var(--muted);
}

.admin-dashboard-card .btn {
  display: block;
  width: 100%;
  margin-top: 8px;
}

@media (max-width: 700px) {
  .admin-dashboard-top {
    flex-direction: column;
    align-items: stretch;
  }
}