/* SitterIT Tid – all stil för appen. Ingen inline-CSS i HTML. */

:root {
  --navy: #1e3a5f;
  --navy-dark: #172e4b;
  --steel: #3a6d96;
  --steel-light: #e8f0f7;
  --green: #047857;
  --green-dark: #065f46;
  --red: #b91c1c;
  --red-dark: #991b1b;
  --red-light: #fee2e2;
  --amber: #92400e;
  --warning: #fef3c7;
  --warning-border: #fcd34d;

  --slate-900: #0f172a;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;
  --white: #ffffff;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 4px 12px rgba(15, 23, 42, 0.05);
  --focus: 0 0 0 3px rgba(58, 109, 150, 0.35);
  --topbar-h: 60px;
  --sidebar-w: 236px;
}

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

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--slate-700);
  background: var(--slate-50);
}

h1,
h2,
h3 {
  color: var(--slate-900);
  line-height: 1.25;
  margin: 0 0 0.6em;
}

h1 {
  font-size: 1.6rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

h2 {
  font-size: 1.1rem;
  font-weight: 600;
}

h3 {
  font-size: 1rem;
  font-weight: 600;
}

p {
  margin: 0 0 1em;
}

a {
  color: var(--steel);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.lead {
  font-size: 1.05rem;
  color: var(--slate-600);
}

.muted {
  color: var(--slate-500);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Knappar */

.btn,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  min-height: 40px;
  padding: 0.5em 1.1em;
  font: inherit;
  font-weight: 550;
  line-height: 1.2;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--slate-700);
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.btn:hover,
button:hover {
  text-decoration: none;
  background: var(--slate-100);
}

.btn-primary,
button.btn-primary {
  background: var(--green);
  border-color: var(--green);
  color: var(--white);
}

.btn-primary:hover,
button.btn-primary:hover {
  background: var(--green-dark);
  border-color: var(--green-dark);
}

.btn-secondary {
  background: var(--white);
  border-color: var(--slate-200);
  color: var(--navy);
}

.btn-secondary:hover {
  background: var(--steel-light);
  border-color: var(--steel);
}

.btn-danger,
button.btn-danger {
  background: var(--white);
  border-color: var(--red);
  color: var(--red);
}

.btn-danger:hover,
button.btn-danger:hover {
  background: var(--red);
  color: var(--white);
}

.btn-small {
  min-height: 32px;
  padding: 0.3em 0.8em;
  font-size: 0.875rem;
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-on-dark,
button.btn-on-dark {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.3);
  color: var(--white);
}

.btn-on-dark:hover,
button.btn-on-dark:hover {
  background: rgba(255, 255, 255, 0.12);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

/* Kort */

.card {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

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

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.card-header h2 {
  margin: 0;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.card-grid .card {
  margin-bottom: 0;
}

.card-warning {
  background: var(--warning);
  border-color: var(--warning-border);
}

.card-warning h2 {
  color: var(--amber);
}

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
}

.badge {
  display: inline-block;
  padding: 0.15em 0.65em;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 999px;
  white-space: nowrap;
}

.badge-success {
  background: #d1fae5;
  color: var(--green-dark);
}

.badge-neutral {
  background: var(--slate-100);
  color: var(--slate-600);
}

/* Meddelanden */

.alert {
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  margin-bottom: 1.25rem;
}

.alert-error,
.error {
  background: var(--red-light);
  border-color: #fca5a5;
  color: var(--red-dark);
}

p.error {
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid #fca5a5;
}

.alert-info {
  background: var(--steel-light);
  border-color: #bfd3e6;
  color: var(--navy);
}

.alert-warning {
  background: var(--warning);
  border-color: var(--warning-border);
  color: var(--amber);
}

/* Formulär */

.form {
  display: grid;
  gap: 1rem;
  max-width: 520px;
}

.field {
  display: grid;
  gap: 0.35rem;
}

label {
  font-size: 0.875rem;
  font-weight: 550;
  color: var(--slate-700);
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="password"],
select,
textarea {
  width: 100%;
  min-height: 40px;
  padding: 0.5em 0.75em;
  font: inherit;
  color: var(--slate-900);
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--steel);
  box-shadow: var(--focus);
}

.hint {
  font-size: 0.85rem;
  color: var(--slate-500);
}

/* Tabeller */

.table-wrap {
  overflow-x: auto;
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
}

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

th,
td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--slate-100);
}

th {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--slate-500);
  background: var(--slate-50);
  border-bottom-color: var(--slate-200);
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: var(--slate-50);
}

/* Toppmeny */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  height: var(--topbar-h);
  padding: 0 1.25rem;
  background: var(--navy);
  color: var(--white);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.15);
}

.brand,
.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 650;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.brand {
  color: var(--white);
  min-width: calc(var(--sidebar-w) - 2.5rem);
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--green);
  color: var(--white);
  font-weight: 700;
}

.topbar-company {
  flex: 1;
  min-width: 0;
}

.company-name {
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.muted-on-dark {
  color: rgba(255, 255, 255, 0.65);
}

.company-switch {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 340px;
}

.company-switch select {
  min-height: 34px;
  padding: 0.3em 0.6em;
  color: var(--white);
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
}

.company-switch select option {
  color: var(--slate-900);
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.topbar-user form {
  margin: 0;
}

.user-name {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.9rem;
  white-space: nowrap;
}

.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  width: 40px;
  min-height: 40px;
  padding: 0 9px;
  background: transparent;
  border-color: rgba(255, 255, 255, 0.3);
}

.menu-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
}

.menu-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--white);
  border-radius: 1px;
}

/* Vänstermeny och innehåll */

.shell {
  display: flex;
  min-height: calc(100vh - var(--topbar-h));
}

.sidebar {
  flex: 0 0 var(--sidebar-w);
  padding: 1.25rem 0.75rem;
  background: var(--white);
  border-right: 1px solid var(--slate-200);
}

.nav {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
}

.nav-secondary {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--slate-200);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  color: var(--slate-600);
  font-weight: 500;
}

.nav-link:hover {
  background: var(--slate-100);
  color: var(--slate-900);
  text-decoration: none;
}

.nav-link.active {
  background: var(--steel-light);
  color: var(--steel);
  font-weight: 600;
}

.nav-icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.content {
  flex: 1;
  min-width: 0;
  max-width: 1200px;
  padding: 2rem 2.5rem 3rem;
}

.page-title {
  margin-bottom: 0.3rem;
}

.page-title + .lead {
  margin-bottom: 1.75rem;
}

.content > h2 {
  margin-top: 2rem;
}

/* Sidor utan meny */

body.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
  background: linear-gradient(160deg, var(--navy) 0%, var(--steel) 100%);
}

.auth-panel {
  width: 100%;
  max-width: 420px;
}

.auth-brand {
  justify-content: center;
  width: 100%;
  margin-bottom: 1.25rem;
  color: var(--white);
  font-size: 1.2rem;
}

.auth-card {
  padding: 2rem;
  border: 0;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.2);
}

.auth-card h1 {
  font-size: 1.35rem;
}

.auth-back {
  display: block;
  margin-top: 1.25rem;
  text-align: center;
  color: var(--white);
  opacity: 0.85;
  text-decoration: none;
}

.auth-back:hover,
.auth-back:focus-visible {
  opacity: 1;
  text-decoration: underline;
}

.auth-card .form {
  max-width: none;
}

.auth-card form + form,
.auth-card p + form {
  margin-top: 1rem;
}

.divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.25rem 0;
  color: var(--slate-400);
  font-size: 0.85rem;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--slate-200);
}

.choice-list {
  list-style: none;
  margin: 0 0 1.25rem;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.choice-list form {
  margin: 0;
}

.choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  padding: 0.8rem 1rem;
  text-align: left;
  border-radius: var(--radius);
}

.choice:hover {
  border-color: var(--steel);
  background: var(--steel-light);
}

.choice-title {
  color: var(--slate-900);
  font-weight: 600;
}

.choice-meta {
  color: var(--slate-500);
  font-size: 0.85rem;
  font-weight: 400;
}

/* Mobil */

@media (max-width: 900px) {
  .menu-toggle {
    display: inline-flex;
  }

  .brand {
    min-width: 0;
  }

  .topbar {
    gap: 0.75rem;
    padding: 0 0.75rem;
  }

  .user-name {
    display: none;
  }

  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    bottom: 0;
    left: 0;
    z-index: 15;
    width: var(--sidebar-w);
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow);
  }

  .sidebar.open {
    transform: none;
  }

  .content {
    padding: 1.5rem 1rem 2.5rem;
  }

  .card {
    padding: 1.25rem;
  }
}

@media (max-width: 560px) {
  .topbar .brand {
    font-size: 0.95rem;
  }

  .company-switch {
    max-width: 160px;
  }
}
