
:root {
  --blue: #115cff;
  --blue-dark: #0646d6;
  --navy: #0d1932;
  --muted: #73809a;
  --background: #f3f5f9;
  --white: #fff;
  --border: #e2e7ef;
  --red: #db2828;
  font-family: Inter, system-ui, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--navy);
}

button, input, textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

/* HUVUDLAYOUT */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 325px;
  flex: 0 0 325px;
  background: white;
  border-right: 1px solid var(--border);
  padding: 35px 25px 26px;
  display: flex;
  flex-direction: column;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 140px;
}

.sidebar-logo img {
  max-width: 130px;
  max-height: 130px;
  object-fit: contain;
}

.sidebar-rule {
  border-top: 1px solid #edf0f5;
  margin: 12px 0 32px;
}

.sidebar-nav {
  display: grid;
  gap: 9px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 18px;
  width: 100%;
  border: 0;
  border-radius: 13px;
  background: transparent;
  padding: 19px 24px;
  text-align: left;
  font-size: 17px;
  font-weight: 700;
  color: #69768c;
  text-decoration: none;
}

.nav-link span {
  font-size: 23px;
  width: 25px;
  text-align: center;
}

.nav-link:hover {
  background: #f4f7fc;
}

.nav-link.active {
  background: #eaf0ff;
  color: var(--blue);
}

.sidebar-bottom {
  margin-top: auto;
  border-top: 1px solid #edf0f5;
  padding-top: 22px;
}

.home-link {
  display: block;
  padding: 16px;
  color: #667894;
  text-decoration: none;
  font-weight: 650;
}

/* TOPPANEL */

.app-main {
  min-width: 0;
  flex: 1;
}

.topbar {
  height: 99px;
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 20px 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar strong {
  display: block;
  font-size: 17px;
}

.topbar small {
  display: block;
  color: var(--muted);
  font-size: 15px;
  margin-top: 3px;
}

.online {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #65758e;
  font-weight: 700;
  font-size: 14px;
}

.online-dot {
  height: 10px;
  width: 10px;
  background: #1ab76a;
  border-radius: 50%;
}

/* SIDANS INNEHÅLL */

main {
  max-width: 1500px;
  margin: 0 auto;
  padding: 54px 55px 90px;
}

h1, h2, h3, p {
  margin-top: 0;
}

h1 {
  font-size: clamp(30px, 3.5vw, 44px);
  letter-spacing: -1px;
  margin-bottom: 8px;
}

h2 {
  font-size: clamp(27px, 3vw, 40px);
  letter-spacing: -0.9px;
  margin-bottom: 12px;
}

h3 {
  font-size: 20px;
}

p {
  line-height: 1.55;
}

.muted,
.section-heading p {
  color: var(--muted);
}

.eyebrow {
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 2px;
  margin-bottom: 12px;
}

.loading {
  text-align: center;
  padding: 60px;
  color: var(--muted);
}

.portal-heading {
  margin-bottom: 34px;
}

.portal-heading .muted {
  margin: 0;
}

.workspace {
  margin-top: 25px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-bottom: 36px;
}

.section-heading p {
  margin-bottom: 0;
}

/* VITA RUTOR */

.surface,
.login-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 30px;
  box-shadow: 0 12px 30px rgba(28, 45, 78, 0.035);
}

.login-card {
  max-width: 520px;
  margin: 40px auto;
  padding: 40px;
}

.login-card h1 {
  font-size: 34px;
}

.list-heading {
  margin: 8px 0 20px;
  font-size: 23px;
}

/* FORMULÄR */

label {
  display: block;
  margin: 18px 0 8px;
  font-size: 14px;
  font-weight: 700;
}

input:not([type="hidden"]),
textarea {
  display: block;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid #d4dce9;
  border-radius: 10px;
  background: #fbfcff;
  color: var(--navy);
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 85px;
}

input:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px #115cff18;
}

.editor-form {
  max-width: 700px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

/* KNAPPAR */

.btn {
  border: 1px solid #dce3ee;
  border-radius: 11px;
  padding: 14px 21px;
  min-height: 48px;
  background: white;
  color: #34425c;
  font-size: 15px;
  font-weight: 700;
}

.btn:hover {
  filter: brightness(0.97);
}

.btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.btn.primary {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
  box-shadow: 0 8px 18px #115cff1f;
}

.btn.primary:hover {
  background: var(--blue-dark);
}

.btn.secondary {
  background: white;
  color: #33445e;
}

.btn.danger {
  background: white;
  color: var(--red);
  border-color: #ffbfc2;
}

.btn.full {
  width: 100%;
  margin-top: 24px;
}

/* LISTOR */

.item-list {
  display: grid;
  gap: 0;
}

.item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
  padding: 23px 8px;
  border-bottom: 1px solid #e9edf3;
}

.item-row:last-child {
  border-bottom: 0;
}

.item-info {
  flex: 1 1 220px;
  min-width: 0;
}

.item-info h3 {
  font-size: 17px;
  margin: 0 0 5px;
}

.item-info p {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
  overflow-wrap: anywhere;
}

.item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.item-actions .btn {
  padding: 11px 15px;
  min-height: 42px;
}

.context-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 25px 5px;
  border-bottom: 1px solid var(--border);
}

.context-heading h3 {
  font-size: 24px;
  margin-bottom: 4px;
}

.context-heading p {
  margin: 0;
}

/* REDIGERING */

.editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 30px;
  margin-top: 28px;
}

.tip-card {
  background: #f1f6ff;
  border: 1px solid #dce8ff;
  border-radius: 14px;
  padding: 20px;
}

.tip-card h3 {
  color: var(--blue);
}

.tip-card p {
  font-size: 14px;
  color: #586b87;
  margin: 0;
}

.video-editor,
.collapsible-editor {
  background: #f8faff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 25px;
  margin-bottom: 26px;
}

.video-thumbnail {
  width: 95px;
  height: 65px;
  flex: 0 0 95px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #edf3ff;
  color: var(--blue);
  font-size: 27px;
}

.status {
  min-height: 20px;
  margin: 14px 0;
  color: #63748c;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.status.error {
  color: #bd2533;
}

.empty-state {
  padding: 30px;
  text-align: center;
  border: 1px dashed #d2dbe9;
  border-radius: 12px;
  color: var(--muted);
  background: #fbfcff;
}

/* SURFPLATTA */

@media (max-width: 900px) {
  .sidebar {
    width: 235px;
    flex-basis: 235px;
    padding: 22px 14px;
  }

  .topbar {
    padding: 20px 26px;
  }

  main {
    padding: 36px 25px 65px;
  }

  .editor-layout {
    grid-template-columns: 1fr;
  }
}

/* MOBIL */

@media (max-width: 650px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    padding: 10px 16px;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
  }

  .sidebar-logo {
    height: 55px;
  }

  .sidebar-logo img {
    max-height: 50px;
    max-width: 70px;
  }

  .sidebar-rule {
    display: none;
  }

  .sidebar-nav {
    display: flex;
    gap: 4px;
    flex: 1;
  }

  .nav-link {
    font-size: 13px;
    padding: 11px 9px;
    gap: 6px;
  }

  .nav-link span {
    font-size: 17px;
    width: auto;
  }

  .sidebar-bottom {
    border: 0;
    padding: 0;
    margin: 0;
  }

  .sidebar-bottom .nav-link {
    font-size: 12px;
  }

  .home-link {
    display: none;
  }

  .topbar {
    height: 75px;
    padding: 15px 18px;
  }

  .online {
    font-size: 11px;
  }

  main {
    padding: 26px 14px 55px;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    margin-bottom: 22px;
  }

  .surface,
  .login-card {
    padding: 20px;
    border-radius: 16px;
  }

  .item-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .item-actions {
    width: 100%;
  }

  .item-actions .btn {
    flex: 1 1 auto;
  }

  .section-heading > .btn {
    width: 100%;
  }

  .portal-heading {
    margin-bottom: 20px;
  }
}

/* ==========================================
   LEGACY UF – EXTRA KOMPAKT DESIGN
   ========================================== */

@media (min-width: 901px) {

  /* Smalare sidomeny */
  .sidebar {
    width: 250px;
    flex-basis: 250px;
    padding: 18px 18px 20px;
  }

  .sidebar-logo {
    height: 105px;
  }

  .sidebar-logo img {
    max-width: 90px;
    max-height: 90px;
  }

  .sidebar-rule {
    margin: 10px 0 18px;
  }

  .nav-link {
    font-size: 14px;
    padding: 12px 15px;
    gap: 12px;
    border-radius: 10px;
  }

  .nav-link span {
    font-size: 17px;
  }

  /* Mindre toppanel */
  .topbar {
    height: 70px;
    padding: 12px 30px;
  }

  .topbar strong {
    font-size: 14px;
  }

  .topbar small {
    font-size: 12px;
  }

  .online {
    font-size: 12px;
  }

  /* Mindre rubriker och avstånd */
  main {
    padding: 28px 32px 55px;
  }

  h1 {
    font-size: 29px;
  }

  h2 {
    font-size: 27px;
  }

  h3 {
    font-size: 17px;
  }

  p {
    font-size: 13px;
  }

  .eyebrow {
    font-size: 10px;
    margin-bottom: 7px;
  }

  .portal-heading {
    margin-bottom: 18px;
  }

  .portal-heading .muted,
  .section-heading p {
    font-size: 13px;
  }

  .section-heading {
    margin-bottom: 18px;
    gap: 14px;
  }

  .workspace {
    margin-top: 16px;
  }

  /* Mindre vita rutor */
  .surface {
    padding: 18px;
    border-radius: 14px;
  }

  .list-heading {
    font-size: 18px;
    margin: 5px 0 12px;
  }

  /* Kompaktare maskin- och problemlistor */
  .item-row {
    padding: 12px 5px;
    gap: 12px;
  }

  .item-info h3 {
    font-size: 14px;
  }

  .item-info p {
    font-size: 12px;
  }

  .item-actions {
    gap: 6px;
  }

  /* Mindre knappar */
  .btn {
    font-size: 12px;
    padding: 9px 13px;
    min-height: 36px;
    border-radius: 8px;
  }

  .item-actions .btn {
    padding: 8px 11px;
    min-height: 34px;
  }

  /* Mindre formulär */
  label {
    font-size: 12px;
    margin: 12px 0 6px;
  }

  input:not([type="hidden"]),
  textarea {
    padding: 10px 12px;
    font-size: 12px;
    border-radius: 8px;
  }

  .form-actions {
    margin-top: 15px;
    gap: 8px;
  }

  .context-heading {
    padding: 15px 4px;
  }

  .context-heading h3 {
    font-size: 19px;
  }

  .video-editor,
  .collapsible-editor {
    padding: 17px;
    margin-bottom: 18px;
  }

  .tip-card {
    padding: 15px;
  }

  .tip-card p {
    font-size: 12px;
  }
}

/* FÖRETAGETS ÖVERSIKT */

.overview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.overview-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
}

.overview-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: #eaf0ff;
  color: var(--blue);
  border-radius: 10px;
  font-size: 22px;
  margin-bottom: 18px;
}

.overview-card p {
  color: var(--muted);
  margin-bottom: 6px;
}

.overview-card h3 {
  font-size: 24px;
  margin-bottom: 18px;
}

@media (max-width: 650px) {
  .overview-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================
   FÖRETAGSÖVERSIKT – SAMMA SOM ADMIN
   ========================================== */

.overview-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px;
  margin-bottom: 22px;
}

.overview-heading h2 {
  font-size: 27px;
  margin: 0 0 5px;
}

.overview-heading p {
  margin: 0;
  font-size: 14px;
}

.overview-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.overview-toolbar .btn {
  background: white;
}

.overview-search {
  margin-bottom: 22px;
}

.overview-search input {
  width: 100%;
  background: white;
  border: 1px solid #dce4ef;
  border-radius: 11px;
  padding: 15px 18px;
  font-size: 14px;
}

.overview-tree {
  display: grid;
  gap: 15px;
}

.overview-machine-card {
  background: white;
  border: 1px solid #dfe6ef;
  border-radius: 17px;
  overflow: hidden;
}

.overview-machine-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 15px;
  padding: 20px 25px;
}

.overview-entry-info {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.overview-entry-info h3,
.overview-entry-info h4 {
  font-size: 17px;
  margin: 0 0 4px;
  color: #0d1932;
}

.overview-entry-info p {
  font-size: 13px;
  margin: 0;
}

.overview-symbol {
  display: grid;
  place-items: center;
  flex: 0 0 45px;
  height: 45px;
  border-radius: 11px;
  background: #eaf0ff;
  color: #115cff;
  font-size: 22px;
}

.overview-symbol.small {
  flex-basis: 38px;
  height: 38px;
  background: transparent;
  color: #0d1932;
  font-size: 19px;
}

.overview-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}

.overview-actions .btn {
  font-size: 13px;
  min-height: 38px;
  padding: 9px 14px;
}

.overview-problems {
  border-top: 1px solid #e8edf5;
  padding: 12px 16px 16px;
}

.overview-problem-row {
  border: 1px solid #e3e9f2;
  border-radius: 12px;
  background: #f8f9fc;
  margin-bottom: 10px;
  overflow: hidden;
}

.overview-problem-row:last-child {
  margin-bottom: 0;
}

.overview-problem-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 17px;
}

.overview-videos {
  border-top: 1px solid #e2e7ef;
  padding: 10px 17px;
  background: white;
}

.overview-video-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-bottom: 1px solid #edf0f5;
}

.overview-video-row:last-child {
  border-bottom: 0;
}

.overview-video-name {
  font-size: 13px;
  font-weight: 650;
}

.overview-empty {
  color: #73809a;
  padding: 14px;
  font-size: 13px;
  margin: 0;
}

@media (max-width: 650px) {
  .overview-heading {
    align-items: flex-start;
  }

  .overview-toolbar {
    width: 100%;
  }

  .overview-toolbar .btn {
    flex: 1 1 auto;
  }

  .overview-machine-header,
  .overview-problem-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .overview-actions {
    width: 100%;
  }

  .overview-actions .btn {
    flex: 1 1 auto;
  }

  .overview-video-row {
    flex-wrap: wrap;
  }
}


/* ==========================================
   LEGACY UF × FÖRETAG – TOPPRAD
   ========================================== */

.app-main {
  min-width: 0;
  flex: 1;
}

.app-main > .topbar {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between !important;
  flex-wrap: nowrap !important;

  position: relative;
  width: 100%;
  height: 88px !important;
  min-height: 88px !important;
  margin: 0 !important;
  padding: 0 40px !important;

  background-color: #ffffff !important;
  border-bottom: 1px solid #e2e7ef !important;
  box-sizing: border-box;
}

.app-main > .topbar > .topbar-company {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 16px !important;
  min-width: 0;
}

.app-main > .topbar .topbar-company strong {
  display: inline !important;
  margin: 0 !important;
  font-size: 19px !important;
  font-weight: 750;
  line-height: 1.3;
  color: #0d1932;
  white-space: nowrap;
}

.app-main > .topbar .topbar-x {
  display: inline-block;
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
  color: #73809a;
}

.app-main > .topbar > .online {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 10px !important;
  margin-left: auto !important;
  color: #65758e;
  white-space: nowrap;
}

.app-main > .topbar .online-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  background: #1ab76a;
  border-radius: 50%;
}

@media (max-width: 650px) {
  .app-main > .topbar {
    height: auto !important;
    min-height: 75px !important;
    padding: 16px !important;
    gap: 12px;
    flex-wrap: wrap !important;
  }

  .app-main > .topbar > .topbar-company {
    gap: 9px !important;
    flex-wrap: wrap;
  }

  .app-main > .topbar .topbar-company strong {
    font-size: 15px !important;
  }

  .app-main > .topbar .topbar-x {
    font-size: 17px;
  }

  .app-main > .topbar > .online {
    margin-left: 0 !important;
    font-size: 11px;
  }
}
/* Flytta Legacy UF-loggan åt vänster */
.sidebar img {
  transform: translateX(-35px);
}
.login-pill {
  cursor: pointer;
  font: inherit;
}
/* LEGACY UF – LOGGA IN-KNAPP */

.company-login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;

    width: 100%;
    min-height: 54px;
    margin-top: 24px;
    padding: 14px 24px;

    background: #1763ff;
    color: #ffffff;

    border: none;
    border-radius: 12px;

    font-family: Arial, sans-serif;
    font-size: 17px;
    font-weight: 600;
    text-decoration: none;

    cursor: pointer;
    box-shadow: 0 6px 18px rgba(23, 99, 255, 0.18);

    transition: background 0.2s ease,
                transform 0.2s ease,
                box-shadow 0.2s ease;
}

.company-login-btn:hover {
    background: #0d50dc;
    transform: translateY(-2px);
    box-shadow: 0 9px 22px rgba(23, 99, 255, 0.24);
}

.company-login-btn:active {
    transform: translateY(0);
}

.company-login-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

.company-login-btn span {
    font-size: 22px;
    font-weight: 400;
}
