/* Portal - Nordic Barrier Coating AB */
/* Komplett CSS för hela applikationen (fullständig + Dashboard V2) */

/* ========== Global ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f4f4f4;
    color: #2C3E50;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Utility */
.hidden { display: none !important; }
.center { text-align: center; }

/* ========== LOGIN-SIDA ========== */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #2C3E50 0%, #34495E 50%, #5DADE2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-page.hidden {
    display: none;
}

.login-container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    max-width: 420px;
    width: 100%;
    overflow: hidden;
}

.login-header {
    background: #2C3E50;
    color: white;
    padding: 32px 24px;
    text-align: center;
}

.login-header img {
    max-width: 200px;
    height: auto;
    margin-bottom: 16px;
}

.login-header h1 {
    font-size: 24px;
    margin-bottom: 8px;
}

.login-body {
    padding: 32px 24px;
}

.error-message {
    background: #fee;
    border: 1px solid #fcc;
    color: #c33;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    display: none;
}

.error-message.visible {
    display: block;
}

/* ========== HUVUDAPP ========== */
.app-page {
    display: none;
    min-height: 100vh;
}

.app-page.active {
    display: block;
}

.header {
    background: #2C3E50;
    color: white;
    padding: 20px 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header img {
    max-height: 50px;
    height: auto;
}

.header h1 {
    font-size: 24px;
    font-weight: 700;
}

.user-info {
    color: white;
}

.user-info strong {
    font-size: 18px;
}

.button-group {
    display: flex;
    gap: 10px;
}

/* ========== FLIKAR ========== */
.tabs {
    background: white;
    border-bottom: 1px solid #dee2e6;
    padding: 10px 24px 0 24px;
}

.tab-buttons {
    display: flex;
    gap: 5px;
    align-items: center;
    overflow-x: auto;
}

.tab-button {
    background: #e9ecef;
    color: #495057;
    border: 1px solid #dee2e6;
    border-bottom: none;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    padding: 10px 20px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
    white-space: nowrap;
}

.tab-button:hover {
    background: #dee2e6;
}

.tab-button.active {
    background: #f8f9fa;
    border-bottom: 1px solid #f8f9fa;
    margin-bottom: -1px;
}

/* Röda admin-flikar */
.tab-button.admin-tab {
    background: #e74c3c;
    color: white;
    border-color: #c0392b;
}

.tab-button.admin-tab:hover {
    background: #c0392b;
}

.tab-button.admin-tab.active {
    background: #a93226;
    border-bottom: 1px solid #a93226;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Månadsrapport: röda dagar */
.mr-holiday-row {
  background: #fff5f5 !important;
}
.mr-holiday-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: 10px;
  background: #ffecec;
  color: #c62828;
  font-size: 11px;
}


/* ========== FORMULÄR ========== */
.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

label {
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 14px;
    color: #34495E;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="week"],
select,
textarea {
    padding: 10px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
    font-family: inherit;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #5DADE2;
    box-shadow: 0 0 0 3px rgba(93, 173, 226, 0.08);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

/* ========== KNAPPAR ========== */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #5DADE2;
    color: white;
}

.btn-primary:hover {
    background: #3498DB;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(93,173,226,0.3);
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-warning {
    background: #ffc107;
    color: black;
}

.btn-warning:hover {
    background: #e0a800;
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-info:hover {
    background: #138496;
}

/* ========== CONTAINER & PANELS ========== */
.container {
    max-width: 1400px;
    margin: 24px auto;
    padding: 0 20px;
}

.panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    padding: 24px;
    margin-bottom: 20px;
}

.panel-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
    color: #2C3E50;
    border-bottom: 2px solid #5DADE2;
    padding-bottom: 8px;
}

/* ========== KONTROLLPANEL ========== */
.control-panel {
    background: #f0f4f8;
    border-bottom: 1px solid #dee2e6;
    padding: 15px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ========== TABELLER ========== */
.table-wrapper {
    overflow-x: auto;
    margin-top: 16px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 13px;
    table-layout: fixed;
}

thead {
    background: #34495E;
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

th, td {
    padding: 6px 8px;
    text-align: left;
    border: 0.5px solid #e5e7eb;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

th {
    font-weight: 600;
    font-size: 13px;
}

tbody tr {
    transition: background 0.2s;
}

tbody tr:hover {
    background: #f8f9fa;
}

tbody tr:nth-child(even) {
    background: #f8f9fa;
}

tbody tr.weekend {
    background: #fafafa;
}

tbody tr.red-day {
    background: #fff5f5;
}

tbody tr.approved {
    background: #e8f5e9;
}

/* Fasta kolumnbredder för schema-tabellen (om använd) */
#schedule-table th:nth-child(1),
#schedule-table td:nth-child(1) {
    width: 70px;
    min-width: 70px;
}

#schedule-table th:nth-child(2),
#schedule-table td:nth-child(2) {
    width: 85px;
    min-width: 85px;
}

#schedule-table th:nth-child(3),
#schedule-table td:nth-child(3) {
    width: 55px;
    min-width: 55px;
    text-align: center;
}

/* ========== SAMMANFATTNING (Legacy) ========== */
.summary-panel {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    margin-top: 20px;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.summary-box {
    background: white;
    border-left: 4px solid #5DADE2;
    padding: 12px;
    border-radius: 8px;
}

.summary-label {
    font-size: 11px;
    color: #6b7280;
    margin-bottom: 4px;
}

.summary-value {
    font-size: 20px;
    font-weight: 700;
    color: #2C3E50;
}

/* ========== STATISTIK-KORT ========== */
.stats-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 20px;
}

.stats-card-title {
    font-size: 16px;
    font-weight: 700;
    color: #2C3E50;
    margin-bottom: 15px;
    border-bottom: 2px solid #e74c3c;
    padding-bottom: 8px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.stat-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #5DADE2;
}

.stat-item.warning {
    border-left-color: #ffc107;
}

.stat-item.danger {
    border-left-color: #e74c3c;
}

.stat-item.success {
    border-left-color: #28a745;
}

.stat-label {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #2C3E50;
}

.stat-subtext {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 3px;
}

/* ========== LADDNINGSOVERLAY ========== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay.visible {
    display: flex;
}

.spinner {
    border: 4px solid rgba(255,255,255,0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ========== MEDDELANDEN ========== */
.alert {
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    display: none;
}

.alert.visible { display: block; }

.alert-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.alert-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

/* ========== CHECKBOX ========== */
input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* ========== REDIGERBARA CELLER ========== */
td input {
    width: 100%;
    padding: 2px 4px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 12px;
    height: 28px;
    box-sizing: border-box;
}

td select {
    width: 100%;
    padding: 3px 6px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 12px;
}

/* ========== DIALOG ========== */
.dialog-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

.dialog-overlay.visible { display: flex; }

.dialog-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.dialog-title {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 20px;
    color: #2C3E50;
}

/* ========== EDIT USER BANNER ========== */
.edit-user-banner {
    background: #fff3cd;
    border: 2px solid #ffc107;
    padding: 12px 20px;
    margin: 0 24px 20px 24px;
    border-radius: 8px;
    display: none;
}

.edit-user-banner.visible {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.edit-user-banner strong { color: #856404; }

/* ========== RESPONSIV DESIGN ========== */
@media (max-width: 768px) {
    .header { flex-direction: column; gap: 12px; }
    .header-content { flex-direction: column; }
    .button-group { flex-direction: column; width: 100%; }
    .button-group .btn { width: 100%; }
    .tab-buttons { overflow-x: auto; }
    .form-row { grid-template-columns: 1fr; }
    .control-panel { flex-direction: column; align-items: flex-start; }
    .summary-grid { grid-template-columns: repeat(2, 1fr); }
    #schedule-table { font-size: 11px; }
    #schedule-table th, #schedule-table td { padding: 4px 6px; }
    .stats-grid { grid-template-columns: 1fr; }
}

/* ========== SCHEMAGRID (TILLÄGG / NYA STILAR) ========== */
.schedule-grid-wrapper {
    padding: 12px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.04);
}
.schedule-grid-wrapper .legend {
    display:flex; gap:12px; margin-bottom:8px; align-items:center; flex-wrap:wrap; color: #2C3E50; font-size: 13px;
}
.schedule-grid-wrapper .legend .legend-item {
    display:flex; gap:6px; align-items:center;
}
.schedule-grid-wrapper .legend .color-box {
    width:14px; height:14px; border-radius:3px; display:inline-block; margin-right:6px; vertical-align:middle; border: 1px solid rgba(0,0,0,0.04);
}
.schedule-grid-table {
    width: 100%; border-collapse: collapse; font-size: 12px; table-layout: fixed;
}
.schedule-grid-table th, .schedule-grid-table td {
    border: 1px solid #e5e7eb; text-align: center; padding: 6px; vertical-align: middle; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.schedule-week-header {
    background: #ecf0f1; font-weight: 700; color: #34495E; padding: 8px;
}
.schedule-day-header {
    background: #f8fafc; font-weight: 700; color: #1f2937; font-size: 13px; padding: 6px;
}
.schedule-day-header.holiday {
    background: #fff2f2; color: #f57f17; border-bottom: 2px solid #e57373;
}
.schedule-day-header small {
    display: block; font-size: 11px; color: #64748b;
}
.schedule-day-header.holiday small {
    color: #d32f2f;
}
.schedule-day-cell {
    height: 28px; line-height: 28px; cursor: pointer; user-select: none; transition: background 0.15s, color 0.15s; position: relative; font-weight: 700; color: #1f2937; padding-top: 2px; padding-bottom: 2px;
}
.schedule-day-cell:empty { background: transparent; }

td.schedule-day-cell.holiday-shift {
    background-image: repeating-linear-gradient(
      45deg,
      rgba(255,255,255,0.6),
      rgba(255,255,255,0.6) 4px,
      transparent 4px,
      transparent 8px
    ) !important;
    background-blend-mode: overlay;
}

.schedule-day-cell.leave {
    background: repeating-linear-gradient(45deg, #bbdefb, #bbdefb 6px, #e8f5ff 6px, #e8f5ff 12px); color: #0d47a1;
}
.schedule-day-cell.sick { background: #ffebee; color: #c62828; }
.schedule-day-cell.overtime-approved { background: #fff8e1; color: #7a4f01; }
.schedule-day-cell.shift-day { background: rgba(200,230,201,0.6); color: #2e7d32; }
.schedule-day-cell.shift-night { background: rgba(187,222,251,0.6); color: #0d47a1; }

.schedule-day-cell img, .schedule-day-cell svg { vertical-align: middle; }

.schedule-tooltip {
    background: #2C3E50; color: white; padding: 8px 10px; border-radius: 6px; font-size: 12px; position: fixed; z-index: 20000; max-width: 300px; word-wrap: break-word; box-shadow: 0 6px 18px rgba(0,0,0,0.2);
}
.week-divider td {
    background: #eef7ff; color: #0d3b66; font-weight: 700; padding: 10px 12px; border-top: 2px solid #dbeffd; text-align: left;
}
.schedule-legend-inline {
    display:flex; gap:12px; align-items:center; flex-wrap:wrap;
}
.schedule-legend-inline .legend-item { display:flex; gap:8px; align-items:center; }
.schedule-legend-inline .legend-item .color-box { width:14px; height:14px; border-radius:3px; }
.schedule-team-label {
    text-align: left; padding-left: 10px; font-weight: 700; color: #242424;
}
.schedule-team-label strong { color: #1f2937; }

@media (max-width: 768px) {
    .schedule-grid-table { font-size: 10px; }
    .schedule-day-cell { height: 22px; line-height: 22px; font-size: 11px; }
    .schedule-day-header { font-size: 11px; padding: 4px; }
}

/* ========== MÅNADSRAPPORT JUSTERINGAR ========== */
#tab-content-report #schedule-table td .report-date,
#schedule-table td .report-date {
  display: inline-block; width: 36px; text-align: center; font-weight: 600; font-size: 13px; color: inherit;
}
#tab-content-report #schedule-table select.report-select,
#schedule-table select.report-select {
  width: 100%; min-width: 120px; padding: 6px 8px; border-radius: 6px; border: 1px solid #dcdcdc; background: #fff; box-sizing: border-box; font-size: 13px;
}
#tab-content-report #schedule-table input[type="number"].report-num--small,
#schedule-table input[type="number"].report-num--small {
  width: 100%; padding: 4px 6px; font-size: 13px; border-radius: 6px; border: 1px solid #ddd; text-align: right; box-sizing: border-box;
}
#tab-content-report #schedule-table input[type="text"].report-note--wide,
#schedule-table input[type="text"].report-note--wide {
  min-width: 220px; padding: 6px 8px; font-size: 13px; border-radius: 6px; border: 1px solid #e0e0e0; box-sizing: border-box;
}
#tab-content-report #schedule-table td,
#schedule-table td {
  vertical-align: middle; padding: 8px 10px;
}
#tab-content-report #schedule-table thead th,
#schedule-table thead th {
  padding: 8px 10px; font-size: 13px;
}

/* Fasta kolumnbredder för Månadsrapport */
#tab-content-report #schedule-table th:nth-child(1), #tab-content-report #schedule-table td:nth-child(1) { width: 70px; min-width: 70px; }
#tab-content-report #schedule-table th:nth-child(2), #tab-content-report #schedule-table td:nth-child(2) { width: 100px; min-width: 85px; }
#tab-content-report #schedule-table th:nth-child(3), #tab-content-report #schedule-table td:nth-child(3) { width: 70px; min-width: 73px; text-align: center; }
#tab-content-report #schedule-table th:nth-child(4), #tab-content-report #schedule-table td:nth-child(4) { width: 64px; min-width: 64px; text-align: right; }
#tab-content-report #schedule-table th:nth-child(5), #tab-content-report #schedule-table td:nth-child(5) { width: 120px; min-width: 120px; text-align: left; }
#tab-content-report #schedule-table th:nth-child(6), #tab-content-report #schedule-table td:nth-child(6),
#tab-content-report #schedule-table th:nth-child(7), #tab-content-report #schedule-table td:nth-child(7),
#tab-content-report #schedule-table th:nth-child(8), #tab-content-report #schedule-table td:nth-child(8),
#tab-content-report #schedule-table th:nth-child(9), #tab-content-report #schedule-table td:nth-child(9),
#tab-content-report #schedule-table th:nth-child(10), #tab-content-report #schedule-table td:nth-child(10),
#tab-content-report #schedule-table th:nth-child(11), #tab-content-report #schedule-table td:nth-child(11) {
  width: 64px; min-width: 64px; text-align: right;
}
#tab-content-report #schedule-table th:nth-child(12), #tab-content-report #schedule-table td:nth-child(12) { width: auto; min-width: 160px; overflow: hidden; }

#tab-content-report #schedule-table input.report-num--small { width: 64px; box-sizing: border-box; }
#tab-content-report #schedule-table select.report-select { min-width: 120px; box-sizing: border-box; }
#tab-content-report #schedule-table input.report-note--wide { min-width: 160px; box-sizing: border-box; }

@media (max-width: 960px) {
  #tab-content-report #schedule-table th:nth-child(1), #tab-content-report #schedule-table td:nth-child(1) { width: 60px; min-width: 60px; }
  #tab-content-report #schedule-table th:nth-child(2), #tab-content-report #schedule-table td:nth-child(2) { width: 90px; min-width: 70px; }
  #tab-content-report #schedule-table th:nth-child(3), #tab-content-report #schedule-table td:nth-child(3) { width: 72px; min-width: 64px; }
  #tab-content-report #schedule-table th:nth-child(4), #tab-content-report #schedule-table td:nth-child(4) { width: 64px; min-width: 52px; }
  #tab-content-report #schedule-table th:nth-child(5), #tab-content-report #schedule-table td:nth-child(5) { width: 110px; min-width: 90px; }
  #tab-content-report #schedule-table th:nth-child(6), #tab-content-report #schedule-table td:nth-child(6),
  #tab-content-report #schedule-table th:nth-child(7), #tab-content-report #schedule-table td:nth-child(7),
  #tab-content-report #schedule-table th:nth-child(8), #tab-content-report #schedule-table td:nth-child(8) { width: 52px; }
  #tab-content-report #schedule-table input.report-num--small { width: 52px; }
  #tab-content-report #schedule-table input.report-note--wide { min-width: 120px; }
}
@media (max-width: 640px) {
  #tab-content-report #schedule-table select.report-select, #schedule-table select.report-select { min-width: 90px; padding:5px 6px; }
  #tab-content-report #schedule-table input.report-num--small, #tab-content-report #schedule-table input.report-num--small { width: 44px; padding:4px; }
  #tab-content-report #schedule-table input.report-note--wide, #schedule-table input.report-note--wide { min-width: 120px; }
  #tab-content-report #schedule-table th:nth-child(5), #tab-content-report #schedule-table td:nth-child(5) { width: 90px; min-width: 80px; }
}

.schedule-day-cell.has-change { position: relative; }
.schedule-day-cell.has-change::after {
    content: ""; position: absolute; top: 2px; right: 3px; width: 8px; height: 8px; background: #e74c3c; border-radius: 50%; box-shadow: 0 0 0 1px rgba(0,0,0,0.15);
}

/* ========== LEAVE-MODUL JUSTERINGAR ========== */
.leave-table-wrapper {
    overflow-x: auto; max-width: 100%; border: 1px solid #e5e7eb; border-radius: 8px; background: #fff; padding: 6px; box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.leave-per-day-table {
    width: 100%; border-collapse: collapse; table-layout: auto; font-size: 12px; min-width: 620px;
}
.leave-per-day-table th, .leave-per-day-table td {
    padding: 6px 8px; border: 1px solid #e5e7eb; text-align: left; vertical-align: middle; background: #fff; white-space: nowrap; text-overflow: ellipsis; overflow: hidden;
}
.leave-per-day-table thead th {
    background: #34495E; color: #fff; font-weight: 600; font-size: 12px;
}
.leave-per-day-table tbody tr:nth-child(even) { background: #f8f9fa; }
.leave-per-day-table tbody tr:hover { background: #f0f3f6; }
.leave-per-day-table select.leave-row-type, .leave-per-day-table input.leave-row-hours {
    font-size: 12px; padding: 4px 6px; border: 1px solid #d0d7de; border-radius: 4px; background: #fff; width: 100%; box-sizing: border-box;
}
.leave-per-day-table input.leave-row-hours { text-align: right; }

.leave-actions-cell { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.leave-actions-cell .btn { padding: 6px 10px; font-size: 12px; white-space: nowrap; }
.td-comment { white-space: normal !important; word-break: break-word; max-width: 280px; }
details summary { cursor: pointer; font-weight: 600; font-size: 12px; color: #34495E; }
details[open] summary { color: #2C3E50; }

@media (max-width: 760px) {
    .leave-per-day-table { min-width: 560px; font-size: 11px; }
    .leave-per-day-table th, .leave-per-day-table td { padding: 4px 6px; }
    .leave-actions-cell .btn { padding: 4px 8px; font-size: 11px; }
}
@media (max-width: 520px) {
    .leave-per-day-table { min-width: 520px; }
    .leave-per-day-table select.leave-row-type { min-width: 120px; }
    .leave-per-day-table input.leave-row-hours { width: 70px; }
}

#tab-content-leave .panel { overflow-x: auto; }
#tab-content-leave table { table-layout: auto !important; min-width: 900px; }
#tab-content-leave .leave-actions-cell { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
#tab-content-leave .td-comment { white-space: normal !important; word-break: break-word; max-width: 280px; }

@media (max-width: 1024px) { #tab-content-leave table { min-width: 760px; } }
@media (max-width: 640px) { #tab-content-leave table { min-width: 600px; } }

/* ========== SCHEDULE DIALOG ========== */
.sd-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; margin-top: 6px; }
@media (max-width: 780px) { .sd-two-col { grid-template-columns: 1fr; gap: 12px; } }
.sd-table {
  background: #ffffff; border-radius: 10px; border: 1px solid #e8edf1; box-shadow: 0 6px 20px rgba(18, 38, 63, 0.06); overflow: hidden; font-size: 14px;
}
.sd-table .sd-table-header {
  background: linear-gradient(180deg, rgba(238,247,255,1), rgba(240,248,255,0.95)); padding: 12px 14px; font-weight: 800; color: #0d47a1; border-bottom: 1px solid #eef4fa;
}
.sd-table .sd-table-body { padding: 10px 12px; }
.sd-table .sd-row {
  display: flex; align-items: center; justify-content: space-between; padding: 10px 6px; border-bottom: 1px dashed #f1f5f8;
}
.sd-table .sd-row:last-child { border-bottom: none; }
.sd-row .sd-left { display: flex; gap: 10px; align-items: center; color: #1f2937; font-weight: 700; }
.sd-row .sd-right { display: flex; gap: 8px; align-items: center; }
.sd-table .sd-right select, .sd-table .sd-right input[type="number"] {
  padding: 7px 8px; font-size: 13px; border-radius: 6px; border: 1px solid #d6dde6; background: #fff;
}
.sd-table .sd-right input[type="number"] { width: 64px; text-align: right; }
.sd-btn {
  background: linear-gradient(180deg,#5DADE2,#3498DB); color: #fff; border: none; padding: 8px 12px; border-radius: 8px; font-weight: 700; cursor: pointer; box-shadow: 0 6px 18px rgba(52,152,219,0.18); transition: transform .08s ease, box-shadow .12s ease;
}
.sd-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(52,152,219,0.20); }
.sd-btn:active { transform: translateY(0); }
.sd-empty { color: #6b7280; font-size: 13px; padding: 8px 6px; }
.sd-admin-note { margin-top: 12px; }


/* ========== PORTAL / DASHBOARD V2 (NYTT AVSNITT) ========== */
.dashboard-header { margin-bottom: 20px; }
.dashboard-header h2 { margin: 0; color: #2C3E50; font-size: 24px; }
.dashboard-header p { color: #666; margin-top: 4px; font-size: 15px; }

/* Admin Widgets (Toppraden för admin) */
.admin-dashboard-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.admin-widget {
    background: white;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid rgba(0,0,0,0.05);
    transition: transform 0.2s ease;
}
.admin-widget:hover { transform: translateY(-2px); }

.widget-icon {
    font-size: 24px;
    background: #f4f6f8;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.widget-content h4 { margin: 0; font-size: 14px; color: #666; font-weight: 600; }
.widget-content span { display: block; font-size: 20px; font-weight: 700; color: #2C3E50; line-height: 1.2; margin-top: 2px; }

/* Färger för admin widgets */
.admin-widget.info .widget-icon { background: #e3f2fd; color: #1976d2; }
.admin-widget.warning .widget-icon { background: #fff8e1; color: #f57f17; }
.admin-widget.alert .widget-icon { background: #ffebee; color: #c62828; }

/* Dashboard Cards (Navigering) */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.info-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    border: 1px solid #f0f0f0;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.info-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(93,173,226,0.15);
    border-color: #5DADE2;
}

.info-card h3 { margin: 0; font-size: 15px; color: #6b7280; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.card-data { font-size: 28px; font-weight: 800; color: #2C3E50; margin: 12px 0; letter-spacing: -0.5px; }
.card-meta { font-size: 13px; color: #5DADE2; font-weight: 500; display: flex; align-items: center; gap: 4px; }

/* Columns (Vem jobbar + Anslagstavla) */
.dashboard-columns {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}
@media (max-width: 900px) { .dashboard-columns { grid-template-columns: 1fr; } }

/* Shift lists (Vem jobbar idag) */
.shift-group { margin-bottom: 20px; }
.shift-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-bottom: 4px;
    border-bottom: 2px solid #eee;
}

/* Färger för shift headers */
.shift-header.fm { color: #2980b9; border-color: #a9cce3; }
.shift-header.em { color: #d35400; border-color: #edbb99; }
.shift-header.natt { color: #2c3e50; border-color: #abb2b9; }
.shift-header.dag { color: #27ae60; border-color: #a9dfbf; }

.shift-badge { background: #eee; padding: 2px 8px; border-radius: 10px; color: #555; font-size: 11px; }

.worker-list { display: flex; flex-wrap: wrap; gap: 8px; }

.worker-pill {
    background: white;
    border: 1px solid #e0e0e0;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: #333;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

/* Team dots */
.team-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.team-dot.team-A { background-color: #2ecc71; }
.team-dot.team-B { background-color: #3498db; }
.team-dot.team-C { background-color: #f1c40f; }
.team-dot.team-D { background-color: #9b59b6; }
/* Slut på Dashboard V2 */

/* ==== FIX: återställ skiftschema-färger (placerad sist för högst prioritet) ==== */
#schedule-table .schedule-day-cell, .schedule-grid-table .schedule-day-cell {
  background: transparent !important; color: inherit !important; font-weight: 700; height: 28px; line-height: 28px;
}
#schedule-table .schedule-day-cell.leave, .schedule-grid-table .schedule-day-cell.leave {
  background: repeating-linear-gradient(45deg, #bbdefb, #bbdefb 6px, #e8f5ff 6px, #e8f5ff 12px) !important; color: #0d47a1 !important;
}
#schedule-table .schedule-day-cell.sick, .schedule-grid-table .schedule-day-cell.sick {
  background: #ffebee !important; color: #c62828 !important;
}
#schedule-table .schedule-day-cell.overtime-approved, .schedule-grid-table .schedule-day-cell.overtime-approved {
  background: #fff8e1 !important; color: #7a4f01 !important;
}
#schedule-table .schedule-day-cell.shift-day, .schedule-grid-table .schedule-day-cell.shift-day {
  background: rgba(200,230,201,0.6) !important; color: #2e7d32 !important;
}
#schedule-table .schedule-day-cell.shift-night, .schedule-grid-table .schedule-day-cell.shift-night {
  background: rgba(187,222,251,0.6) !important; color: #0d47a1 !important;
}
#schedule-table .schedule-day-cell[data-team="A"]:not(:empty):not(.leave):not(.sick):not(.holiday),
.schedule-grid-table .schedule-day-cell[data-team="A"]:not(:empty):not(.leave):not(.sick):not(.holiday) {
  background: rgba(200,230,201,0.55) !important; color: #2e7d32 !important;
}
#schedule-table .schedule-day-cell[data-team="B"]:not(:empty):not(.leave):not(.sick):not(.holiday),
.schedule-grid-table .schedule-day-cell[data-team="B"]:not(:empty):not(.leave):not(.sick):not(.holiday) {
  background: rgba(187,222,251,0.55) !important; color: #0d47a1 !important;
}
#schedule-table .schedule-day-cell[data-team="C"]:not(:empty):not(.leave):not(.sick):not(.holiday),
.schedule-grid-table .schedule-day-cell[data-team="C"]:not(:empty):not(.leave):not(.sick):not(.holiday) {
  background: rgba(255,224,178,0.6) !important; color: #8a4b00 !important;
}
#schedule-table .schedule-day-cell[data-team="D"]:not(:empty):not(.leave):not(.sick):not(.holiday),
.schedule-grid-table .schedule-day-cell[data-team="D"]:not(:empty):not(.leave):not(.sick):not(.holiday) {
  background: rgba(225,190,231,0.45) !important; color: #4a2f5a !important;
}
#schedule-table .schedule-day-cell * { color: inherit !important; }
#tab-content-schedule #schedule-table td.schedule-day-cell, #tab-content-report #schedule-table td.schedule-day-cell { background-clip: padding-box; }
#schedule-table td, .schedule-grid-table td { border-color: rgba(0,0,0,0.06) !important; }

.leave-table-wrapper {
    overflow-x: auto; max-width: 100%; border: 1px solid #e5e7eb; border-radius: 8px; background: #fff; padding: 6px; box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.leave-per-day-table { width: 100%; border-collapse: collapse; table-layout: auto; }
/* ... (Behåll allt ovanför) ... */

/* ========== QUICK LINKS (GENVÄGAR) ========== */
.quick-links-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.quick-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    color: #2C3E50;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.quick-btn:hover {
    background: #ffffff;
    border-color: #5DADE2;
    box-shadow: 0 4px 12px rgba(93,173,226,0.15);
    transform: translateY(-2px);
    color: #3498DB;
}

.quick-btn .icon {
    font-size: 18px;
}

/* Speciell stil för adminknappen */
.quick-btn.admin {
    background: #fff3e0;
    border-color: #ffe0b2;
    color: #e65100;
    grid-column: span 2; /* Gör den bredare (tar upp 2 kolumner) */
    justify-content: center;
}

.quick-btn.admin:hover {
    background: #fff8e1;
    border-color: #ffb74d;
    box-shadow: 0 4px 12px rgba(255, 167, 38, 0.2);
}
/* --- Månadsrapport Enhancements --- */

/* 1. Sticky Header & Datum (Lås rubriker och datum vid scroll) */
.table-wrapper {
    max-height: none !important; /* Låt tabellen ta den plats den behöver */
    overflow-y: visible;         /* Ingen scrollbar vertikalt i boxen */
    overflow-x: auto;            /* Behåll scroll i sidled för mobiler */
    position: relative;
    border: none;                /* Tar bort ramen runt hela, ser renare ut */
    box-shadow: none;
}

#schedule-table thead th {
    position: sticky;
    top: 0;
    background-color: #2C3E50; /* Samma som din header-färg */
    color: white;
    z-index: 10;
    box-shadow: 0 2px 2px rgba(0,0,0,0.1);
}

/* Lås datum-kolumnen till vänster (mobilvänligt) */
#schedule-table tbody td:first-child,
#schedule-table thead th:first-child {
    position: sticky;
    left: 0;
    z-index: 11; /* Måste ligga över vanliga celler */
    background-color: #fff; /* Täck innehåll bakom */
    border-right: 2px solid #eee;
}
#schedule-table thead th:first-child {
    z-index: 12; /* Datum-rubriken högst upp i hörnet */
    background-color: #2C3E50;
}

/* 2. Visuell gruppering av Övertid (Kolumn 8,9,10,11) */
/* OBS: Kolumn 7 är den dolda Ledighet-kolumnen, så vi stylar 8-11 */
#schedule-table colgroup col:nth-child(8),
#schedule-table colgroup col:nth-child(9),
#schedule-table colgroup col:nth-child(10),
#schedule-table colgroup col:nth-child(11) {
    background-color: #fffbf2; /* Ljus, ljus gul */
}

/* Kantlinjer för gruppen */
#schedule-table td:nth-child(8), #schedule-table th:nth-child(8) {
    border-left: 2px solid #e0e0e0 !important; /* Start på övertidsblock */
}
#schedule-table td:nth-child(11), #schedule-table th:nth-child(11) {
    border-right: 2px solid #e0e0e0 !important; /* Slut på övertidsblock */
}
#schedule-table td:nth-child(8), 
#schedule-table td:nth-child(9), 
#schedule-table td:nth-child(10), 
#schedule-table td:nth-child(11) {
    background-color: rgba(255, 248, 225, 0.3); /* Svag gul tint */
}

/* 3. Tydligare Helgmarkering */
tr.weekend td {
    background-color: #f8f9fa;
}
tr.weekend td:first-child {
    border-left: 4px solid #bdc3c7; /* Tydlig grå rand på datumet */
}

/* 4. Färgkodade Skift-val (Dropdowns) */
select.shift-select-dag {
    background-color: #fff3cd !important; /* Ljusgul */
    color: #856404 !important;
    font-weight: bold;
    border-color: #ffeeba;
}
select.shift-select-natt {
    background-color: #2c3e50 !important; /* Mörkblå */
    color: #fff !important;
    font-weight: bold;
    border-color: #1a252f;
}

/* 5. Sticky Summary Footer */
.summary-panel {
    position: sticky;
    bottom: 0;
    z-index: 20;
    background: #fff;
    border-top: 4px solid #3498db;
    box-shadow: 0 -4px 10px rgba(0,0,0,0.05);
    margin-top: 0 !important; /* Ta bort standard margin */
    padding: 15px;
}
/* Justera grid för summary så den passar på en rad om möjligt */
.summary-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: space-between;
}
.summary-box {
    flex: 1;
    min-width: 100px;
    text-align: center;
    padding: 5px;
    border: 1px solid #eee;
    border-radius: 4px;
}
/* ===== Portal: badges i "Vem jobbar idag?" ===== */
.worker-pill{
  position: relative;
}

/* Bas-badge */
.worker-badge{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 18px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .2px;
  line-height: 1;
  margin-left: 6px;
  border: 1px solid rgba(0,0,0,0.08);
  white-space: nowrap;
}

/* ÖT */
.worker-badge.ot{
  background: #fff8e1;
  color: #7a4f01;
}

/* SJUK/VAB */
.worker-badge.sick{
  background: #ffebee;
  color: #c62828;
}
/* ===== Portal: gör admin-widgets lika stora ===== */
.admin-dashboard-bar{
  align-items: stretch;
}

.admin-widget{
  height: 100%;
  min-height: 86px; /* justera vid behov */
}
