/* =========================================
   1. VARIABLES & RESET
   ========================================= */
:root {
    /* COLORS */
    --primary:       #054734;
    --primary-rgb:   5, 71, 52;
    --secondary:     #FFFFFF;
    --secondary-rgb: 255, 255, 255;
    --accent:        #8c2732;
    --bg-app:        #f4f4f4;
    --bg-card:       #FFFFFF;
    --bg-light:      #eeeeee;
    --text-head:     #111111;
    --text-body:     #1a1a1a;
    --text-meta:     #888888;

    /* GRAYS & BORDERS */
    --border-light:  #eeeeee;
    --border-base:   #cccccc;
    --border-hover:  #dddddd;

    /* FONTS */
    --font-head:     'Oswald', sans-serif;
    --font-body:     'Barlow', sans-serif;

    /* SYSTEM VARS */
    --radius-sm:     4px;
    --radius-md:     8px;
    --radius-lg:     12px;
    
    --shadow-sm:     0 2px 4px rgba(0,0,0,0.05);
    --shadow-md:     0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg:     0 8px 24px rgba(0,0,0,0.12);
    --shadow-up:     0 -2px 10px rgba(0,0,0,0.1);

    /* HEADER & FOOTER HEIGHTS */
    --header-h-mob:  110px;
    --footer-h-mob:  70px; 
    
    --spacing-xs:    0.5rem;
    --spacing-sm:    1rem;
    --spacing-md:    2rem;
    --spacing-lg:    4rem;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background-color: var(--bg-app);
    color: var(--text-body);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--text-body); text-decoration: none; transition: all 0.2s ease; }
a:hover { color: var(--primary); }

/* =========================================
   2. TYPOGRAPHY
   ========================================= */
h1, h2, h3, h4, h5 {
    font-family: var(--font-head);
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: var(--spacing-sm);
    color: var(--text-head);
    text-transform: uppercase;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* =========================================
   3. UTILITIES (Helpers)
   ========================================= */
.flex-between { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 15px; }
.flex-align-center { display: flex; align-items: center; gap: 10px; }
.flex-wrap-gap { display: flex; gap: 10px; margin-bottom: 10px; align-items: center; flex-wrap: wrap; }
.flex-1 { flex: 1; }
.flex-end { display: flex; justify-content: flex-end; }
.right-align { display: flex; justify-content: flex-end; }
.gap-10 { gap: 10px; }
.center-text { text-align: center; }

.borderless-row { border: none !important; padding: 5px 0 !important; }
.no-margin { margin: 0 !important; }
.no-padding { padding: 0 !important; }
.mt-5 { margin-top: 5px; }
.mt-lg { margin-top: var(--spacing-lg); }
.mb-10 { margin-bottom: 10px; }
.mb-15 { margin-bottom: 15px; }
.min-w-120 { min-width: 120px; }
.min-w-150 { min-width: 150px; }
.min-h-100 { min-height: 100px; }
.min-h-150 { min-height: 150px; }
.relative { position: relative; }

.text-normal { font-size: 1rem; }
.text-accent { color: var(--accent) !important; }
.text-primary { color: var(--primary) !important; }
.border-accent { border-color: var(--accent) !important; }
.empty-text { margin-top: 0; margin-bottom: 15px; color: var(--text-meta); }
.empty-state { font-size: 1rem; font-weight: normal; color: var(--text-meta); font-style: italic; }

.icon-primary { width: 24px; filter: invert(19%) sepia(45%) saturate(3022%) hue-rotate(143deg) brightness(95%) contrast(97%); }
.small-icon { width: 18px; }

/* =========================================
   4. COMPONENTS: BUTTONS
   ========================================= */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-family: var(--font-head);
    font-weight: 700;
    text-transform: uppercase;
    text-align: center;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.btn-primary { background-color: var(--primary); color: var(--secondary); }
.btn-primary:hover { background-color: rgba(var(--primary-rgb), 0.9); color: var(--secondary); }

.btn-outline { background: transparent; border-color: var(--border-hover); color: var(--text-body); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

.btn-danger { background-color: var(--accent) !important; border-color: var(--accent) !important; color: #fff; }
.btn-danger-outline { color: var(--accent) !important; border-color: var(--accent) !important; transition: all 0.2s ease-in-out; background: transparent; }
.btn-danger-outline:hover { background: var(--accent) !important; color: #fff !important; }

.btn-sm { padding: 8px 16px; font-size: 0.8rem; }
.delete-btn { padding: 6px 10px; color: var(--accent) !important; border-color: var(--accent) !important; }

/* =========================================
   5. LAYOUT: HEADER & FOOTER
   ========================================= */
.site-header {
    background-color: var(--primary);
    color: var(--secondary);
    width: 100%;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
    position: relative;
}

.custom-logo { display: block; height: auto; width: auto; transition: all 0.3s ease; }

.user-toggle-btn {
    background: none; border: none; color: var(--secondary);
    display: flex; align-items: center; cursor: pointer;
    font-family: var(--font-body); font-size: 1rem; padding: 0; text-decoration: none;
}
.user-icon { width: 24px; height: 24px; margin-right: 8px; filter: brightness(0) invert(1); }

@media (max-width: 991px) {
    .header-desktop-view { display: none; }
    .site-header { position: sticky; top: 0; height: var(--header-h-mob); overflow: visible !important; }
    .header-mobile-view { width: 100%; height: 100%; position: static; }
    .site-branding { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); height: auto; z-index: 10; display: block; }
    .custom-logo { height: 90px !important; width: auto !important; object-fit: contain; max-height: none !important; }
    .header-mobile-view .header-user-toggle { position: absolute !important; bottom: 15px !important; right: 20px !important; z-index: 9999 !important; display: block !important; top: auto !important; left: auto !important; background: transparent; }
    .header-mobile-view .user-toggle-btn { display: flex !important; color: var(--secondary) !important; visibility: visible !important; }
    .arrow-icon { display: block !important; width: 12px; margin-left: 5px; filter: brightness(0) invert(1); }
}

@media (min-width: 992px) {
    .header-mobile-view { display: none; }
    .site-header { height: auto; padding: 20px 0; overflow: visible; }
    .header-top-row { display: flex; justify-content: center; margin-bottom: 15px; }
    .custom-logo { max-height: 120px; }
    .header-bottom-row { display: flex; justify-content: center; align-items: flex-end; border-top: 1px solid rgba(var(--secondary-rgb), 0.15); padding-top: 15px; position: relative; }
    .main-navigation ul { list-style: none; display: flex; gap: 35px; margin: 0; padding: 0; }
    .main-navigation a { color: rgba(var(--secondary-rgb), 0.7); font-family: var(--font-head); font-size: 1.1rem; text-transform: uppercase; font-weight: 500; padding-bottom: 4px; border-bottom: 2px solid transparent; }
    .main-navigation a:hover, .main-navigation a.active { color: var(--secondary); border-bottom-color: var(--secondary); }
    .header-desktop-view .header-user-toggle { position: absolute; right: 0; bottom: 0; }
    .arrow-icon { width: 14px; margin-left: 8px; filter: brightness(0) invert(1); }
}

.header-admin-toggle { position: absolute; bottom: 15px; left: 20px; z-index: 9999; }
@media (min-width: 992px) { .header-admin-toggle { left: 0; bottom: 0; } }

.admin-link { text-decoration: none !important; display: flex !important; align-items: center !important; gap: 8px; }
.admin-link .user-text { color: var(--secondary) !important; white-space: nowrap; text-transform: uppercase; font-weight: 500; }
@media (max-width: 991px) { .header-admin-toggle .user-text { font-size: clamp(0.7rem, 2.5vw, 0.9rem) !important; } }

/* Footer */
.site-footer { background-color: var(--primary); color: var(--secondary); z-index: 1000; }
@media (max-width: 991px) {
    .footer-desktop-view { display: none; }
    .site-footer { position: fixed; bottom: 0; left: 0; width: 100%; height: var(--footer-h-mob); box-shadow: var(--shadow-up); padding: 0; }
    body { padding-bottom: var(--footer-h-mob); }
    .mobile-bottom-nav { display: flex; justify-content: space-between; height: 100%; width: 100%; max-width: 600px; margin: 0 auto; }
    .mobile-nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding-top: 8px; height: 100%; color: rgba(var(--secondary-rgb), 0.7); border-top: 4px solid transparent; text-decoration: none; transition: color 0.2s ease; }
    .mobile-nav-item:hover, .mobile-nav-item.active { color: var(--secondary); border-top-color: var(--secondary); }
    .mobile-nav-item img { width: 24px; height: 24px; margin-bottom: 2px; display: block; filter: brightness(0) invert(1); opacity: 0.7; transition: opacity 0.2s ease; }
    .mobile-nav-item:hover img, .mobile-nav-item.active img { opacity: 1; }
    .nav-label { font-size: 0.75rem; font-weight: 500; line-height: 1; }
}
@media (min-width: 992px) {
    .footer-mobile-view { display: none; }
    .site-footer { padding: var(--spacing-md) 0; text-align: center; margin-top: auto; }
    .footer-logo { height: 80px; margin: 0 auto var(--spacing-sm); }
    .footer-copyright { font-size: 0.9rem; opacity: 0.8; }
}

/* =========================================
   6. COMPONENTS: CONTENT BOXES (NEW!)
   ========================================= */
/* Huvudcontainer för en vit box (Kan ersätta .card, .partner-level, .contact-info-box etc) */
.content-box {
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--spacing-md);
    overflow: hidden; /* Viktigt för att headerns färg ska följa de runda hörnen */
    transition: box-shadow 0.2s ease;
    border: 1px solid var(--border-light);
}

.content-box:hover {
    box-shadow: var(--shadow-md);
}

/* Primärgrön header (ex. för Diamantpartners) */
.content-box-header {
    background-color: var(--primary);
    color: var(--secondary);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.content-box-header h2, 
.content-box-header h3 {
    margin: 0;
    color: var(--secondary);
}

/* Vit header (ex. för "Hantera partners" längst upp) */
.content-box-header-light {
    background-color: var(--bg-card);
    color: var(--text-head);
    padding: 15px 20px;
    border-bottom: 1px solid var(--bg-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.content-box-header-light h2,
.content-box-header-light h3 {
    margin: 0;
}

/* App-känsla på mobilen (tajtare padding och textstorlek i box-huvuden) */
@media (max-width: 767px) {
    .content-box-header,
    .content-box-header-light {
        padding: 12px 15px; 
    }
    
    .content-box-header h2,
    .content-box-header h3,
    .content-box-header-light h2,
    .content-box-header-light h3 {
        font-size: 1.15rem;
    }
}

/* Kroppen i boxen */
.content-box-body {
    padding: 10px;
}

/* =========================================
   7. COMPONENTS: DATA LISTS (Neutralized)
   ========================================= */
.data-list-container { margin-top: var(--spacing-sm); }
.data-search-group { margin-bottom: var(--spacing-md); }

.data-table { width: 100%; border-collapse: collapse; text-align: left; }
.data-category-row { background-color: var(--bg-app); }
.data-category-cell { padding: 8px 10px; font-weight: bold; font-family: var(--font-head); text-transform: uppercase; }
.data-item-row { border-bottom: 1px solid var(--border-light); }
.data-item-row:last-child { border-bottom: none; }
.data-img-cell { padding: 10px; width: 70px; }
.data-img-preview { max-height: 30px; max-width: 50px; object-fit: contain; }
.data-title-cell { padding: 10px; font-weight: 500; }
.data-action-cell { padding: 10px; text-align: right; }

.page-title { margin-top: 0; margin-bottom: var(--spacing-md); }
.back-nav { margin-bottom: var(--spacing-sm); }
.back-link { color: var(--text-meta); text-decoration: none; font-family: var(--font-head); font-weight: 700; font-size: 0.9rem; letter-spacing: 0.5px; }

/* =========================================
   8. COMPONENTS: INLINE EDIT & DATA DISPLAY
   ========================================= */
.inline-edit-row { display: flex; justify-content: space-between; align-items: flex-start; padding: 15px 0; border-bottom: 1px solid var(--border-light); }
.inline-edit-row:last-child { border-bottom: none; }
.inline-label { font-family: var(--font-head); font-size: 0.85rem; color: var(--text-meta); text-transform: uppercase; margin-bottom: 5px; display: block; }
.inline-value { font-family: var(--font-body); font-weight: 700; font-size: 1.2rem; color: var(--text-head); flex-grow: 1; white-space: pre-wrap; }
.inline-input-wrapper { display: none; flex-grow: 1; margin-right: 20px; }
.inline-toggle-btn { background: none; border: none; cursor: pointer; padding: 5px; flex-shrink: 0; transition: transform 0.2s; }
.inline-toggle-btn:hover { transform: scale(1.1); }
.inline-content.flex-grow { flex-grow: 1; }

.data-section { position: relative; margin-bottom: var(--spacing-md); }
.section-title { margin-top: 0; margin-bottom: var(--spacing-sm); }
.section-main-title { margin: 0 0 var(--spacing-md) 0; }

.contact-info-display { margin-bottom: 8px; font-size: 1rem; font-weight: 500; }
.contact-role { font-weight: normal; opacity: 0.8; }
.pin-display { margin: 10px 0 0 0; font-family: monospace; font-size: 1.1rem; color: var(--text-main); }

.exposure-tags-container { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.exposure-tag { background: var(--primary); color: #fff; padding: 4px 10px; border-radius: 15px; font-size: 0.85rem; display: flex; align-items: center; gap: 6px; }
.exposure-tag-remove { cursor: pointer; font-weight: bold; opacity: 0.8; }
.exposure-tag-remove:hover { opacity: 1; }
.exposure-view-tag { display: inline-block; background: rgba(0,0,0,0.05); border: 1px solid var(--border-light); padding: 3px 8px; border-radius: 4px; margin: 2px 4px 2px 0; font-size: 0.85rem; color: var(--text-main); font-weight: 500; }

.level-badge-container { display: flex; gap: 15px; flex-wrap: wrap; }
.level-badge { background: var(--bg-card); padding: 4px 8px; border-radius: var(--radius-sm); font-size: 0.85rem; border: 1px solid var(--border-light); }

/* =========================================
   9. COMPONENTS: TABS & PAGE NAV
   ========================================= */
.tabs-page-container, 
.tabs-menu-page-container {
    width: 100%;
    max-width: 1200px;
    margin: var(--spacing-md) auto; /* Skapar luft till headern */
    padding: 0 var(--spacing-sm);   /* Skapar luft till skärmens ytterkanter */
}

.pillbox-nav {
    display: flex;
    background-color: var(--bg-card); 
    padding: 0; 
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
    border: 1px solid rgba(0, 0, 0, 0.1); 
    overflow: hidden; 
    width: 100%; 
}

.pillbox-btn {
    flex: 1; 
    border: none;
    border-right: 1px solid rgba(0, 0, 0, 0.05);
    background: transparent;
    padding: 10px; /* Lite extra touch area */
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-head);
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center; 
    white-space: nowrap;
    text-transform: uppercase;
}

.pillbox-btn:last-child { border-right: none; }
.pillbox-btn:hover { background-color: rgba(0, 0, 0, 0.03); }
.pillbox-btn.active { background-color: var(--primary); color: var(--secondary); }

.tab-pane { display: none; animation: fadeIn 0.3s ease; }
.tab-pane.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* Page Dropdown Header */
.page-dropdown-header { position: relative; margin-bottom: var(--spacing-md); display: flex; flex-direction: column; align-items: center; }
.dropdown-toggle { background: transparent; border: none; font-family: var(--font-head); font-size: 1.5rem; font-weight: 700; color: var(--text-head); display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 10px; text-transform: uppercase; }
.dropdown-icon { width: 20px; height: 20px; transition: transform 0.2s ease; opacity: 0.6; }
.dropdown-toggle.open .dropdown-icon { transform: rotate(180deg); opacity: 1; }

.dropdown-menu { display: none; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); background-color: var(--bg-card); border-radius: var(--radius-md); box-shadow: var(--shadow-md); min-width: 220px; z-index: 100; overflow: hidden; border: 1px solid rgba(0,0,0,0.05); margin-top: 5px; }
.dropdown-menu.show { display: block; animation: fadeIn 0.2s ease; }
.dropdown-item { display: block; padding: 14px 20px; color: var(--text-head); text-decoration: none; font-family: var(--font-head); font-weight: 700; font-size: 0.95rem; text-transform: uppercase; border-bottom: 1px solid rgba(0,0,0,0.05); transition: background-color 0.2s, color 0.2s; text-align: center; }
.dropdown-item:last-child { border-bottom: none; }
.dropdown-item:hover { background-color: var(--bg-app); color: var(--primary); }

.dropdown-list { display: none; position: absolute; top: 100%; left: 0; width: 100%; background: var(--bg-app); border: 1px solid var(--border-base); z-index: 10; max-height: 200px; overflow-y: auto; box-shadow: 0 4px 12px rgba(0,0,0,0.1); border-radius: 4px; }
.dropdown-item-meta { font-size: 0.8rem; color: var(--text-meta); }

/* =========================================
   10. COMPONENTS: FORMS
   ========================================= */
.form-container { background: var(--bg-card); padding: var(--spacing-md); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); }
.form-group { margin-bottom: var(--spacing-sm); }
.form-label { display: block; margin-bottom: var(--spacing-xs); font-family: var(--font-head); font-weight: 700; color: var(--text-head); text-transform: uppercase; font-size: 0.9rem; }
.form-divider { text-align: center; margin: var(--spacing-sm) 0; color: var(--text-meta); font-weight: bold; }

.form-control { display: block; width: 100%; padding: 12px; font-size: 1rem; font-family: var(--font-body); line-height: 1.5; color: var(--text-body); background-color: var(--bg-card); border: 1px solid var(--border-base); border-radius: var(--radius-sm); transition: all .15s ease-in-out; }
.form-control:focus { border-color: var(--primary); outline: 0; box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.2); }
textarea.form-control { min-height: 120px; resize: vertical; }
.small-input { padding: 4px; font-size: 0.9rem; }

select.form-control { background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right 0.75rem center; background-size: 16px 12px; appearance: none; }

.form-check { display: block; position: relative; padding-left: 35px; margin-bottom: 12px; cursor: pointer; font-size: 1rem; user-select: none; }
.form-check input { position: absolute; opacity: 0; cursor: pointer; height: 0; width: 0; }
.checkmark { position: absolute; top: 0; left: 0; height: 22px; width: 22px; background-color: var(--bg-light); border: 1px solid var(--border-base); border-radius: var(--radius-sm); transition: all 0.2s; }
.form-check:hover input ~ .checkmark { background-color: var(--border-hover); }
.form-check input:checked ~ .checkmark { background-color: var(--primary); border-color: var(--primary); }
.checkmark:after { content: ""; position: absolute; display: none; }
.form-check input:checked ~ .checkmark:after { display: block; }
.form-check .checkmark:after { left: 7px; top: 3px; width: 6px; height: 12px; border: solid var(--secondary); border-width: 0 3px 3px 0; transform: rotate(45deg); }

.recipient-multiselect-box { border: 1px solid var(--border-base); border-radius: var(--radius-sm); padding: var(--spacing-sm); max-height: 200px; overflow-y: auto; }

/* =========================================
   11. CARDS (News & Generic)
   ========================================= */
.widget-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: var(--spacing-sm); }
.widget-title { margin: 0; font-size: 1.4rem; }
.widget-link { font-family: var(--font-head); font-weight: 700; color: var(--text-meta); font-size: 0.9rem; }

.card { background-color: var(--bg-card); border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow-sm); transition: transform 0.2s ease, box-shadow 0.2s ease; display: flex; text-decoration: none; color: inherit; }
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.card-news { height: 100px; }
.card-news .card-img { width: 35%; background: var(--bg-light); object-fit: cover; }
.card-news .card-body { width: 65%; padding: 12px; display: flex; flex-direction: column; justify-content: center; }
.news-date { font-family: var(--font-head); font-size: 0.7rem; color: var(--text-meta); font-weight: 700; text-transform: uppercase; margin-bottom: 4px; }
.news-title { font-family: var(--font-head); font-size: 0.95rem; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

@media (min-width: 768px) {
    .card-news { height: 120px; }
    .card-news .card-img { width: 30%; }
    .card-news .card-body { width: 70%; padding: 20px; }
    .news-title { font-size: 1.1rem; }
}

/* =========================================
   12. VIEWS: PARTNERS
   ========================================= */
.partner-section { padding: var(--spacing-md) 0; }
.partner-level-title { text-align: center; margin-bottom: var(--spacing-md); }

.partner-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 1rem; margin-bottom: var(--spacing-lg); }

.partner-item, .partner-card { background: transparent; padding: 1rem; display: flex; align-items: center; justify-content: center; border: none; transition: transform 0.2s; min-height: 100px; }
.partner-item:hover, .partner-card:hover { transform: scale(1.05); }
.partner-item img, .partner-card img { max-width: 100%; max-height: 100%; width: 100%; height: 100%; object-fit: contain; }

@media (min-width: 768px) {
    .partner-grid { grid-template-columns: repeat(6, 1fr); }
    .partner-grid-lvl-1 { grid-template-columns: repeat(3, 1fr); }
    .partner-grid-lvl-1 .partner-card { height: 160px; padding: 30px; }
    .partner-grid-lvl-2 { grid-template-columns: repeat(4, 1fr); }
    .partner-grid-lvl-2 .partner-card { height: 130px; padding: 20px; }
    .partner-grid-lvl-3 { grid-template-columns: repeat(6, 1fr); }
    .partner-grid-lvl-3 .partner-card { height: 90px; padding: 10px; }
}

@media (max-width: 767px) {
    .partner-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
    .partner-grid .partner-item { flex: 0 1 calc(33.333% - 10px); min-width: 80px; padding: 5px; min-height: 70px; box-sizing: border-box; }
}

/* =========================================
   13. VIEWS: MESSAGES & CONVERSATIONS
   ========================================= */
#msg-app { background: transparent; min-height: 500px; display: flex; flex-direction: column; }
.msg-header { background: var(--bg-card); padding: 15px 20px; border-bottom: 1px solid var(--border-light); display: flex; justify-content: space-between; align-items: center; font-family: var(--font-head); }

.thread-row { background: var(--bg-card); padding: 12px 20px; border-radius: var(--radius-md); box-shadow: 0 2px 8px rgba(0,0,0,0.05); margin-bottom: 12px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; transition: transform 0.2s, box-shadow 0.2s; border: 1px solid var(--border-light); }
.thread-row:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.thread-title { font-weight: 700; color: var(--text-head); font-size: 1.0rem; margin-bottom: 2px; }
.thread-subject { font-size: 0.95rem; color: var(--text-body); margin-bottom: 4px; }
.thread-meta { font-size: 0.8rem; color: var(--text-meta); }
.unread-badge { background: var(--accent); color: white; padding: 2px 8px; border-radius: 12px; font-size: 0.8rem; font-weight: bold; }

#messages-container { flex-grow: 1; padding: 20px; overflow-y: auto; background: rgba(0,0,0,0.01); max-height: 500px; display: flex; flex-direction: column; }
.msg-bubble { padding: 12px 18px; border-radius: 18px; margin-bottom: 15px; max-width: 75%; position: relative; font-size: 0.95rem; }
.msg-mine { background: var(--primary); color: #fff; margin-left: auto; border-bottom-right-radius: 4px; }
.msg-theirs { background: var(--bg-card); color: var(--text-body); margin-right: auto; border-bottom-left-radius: 4px; border: 1px solid var(--border-light); }
.msg-sender { font-size: 0.75rem; opacity: 0.8; margin-bottom: 4px; display: block; font-weight: bold; }

.msg-composer { padding: 15px; background: var(--bg-card); border-top: 1px solid var(--border-light); display: flex; gap: 10px; }

/* =========================================
   14. VIEWS: CONTACT PAGE (Mappas till Content Box)
   ========================================= */
.contact-page-container { padding-top: var(--spacing-md); padding-bottom: var(--spacing-md); }

/* Note: Kan ersättas av .content-box */
.contact-info-box { background-color: var(--bg-card); border-radius: var(--radius-md); padding: var(--spacing-md); margin-bottom: var(--spacing-lg); box-shadow: var(--shadow-sm); text-align: center; }
.contact-info-box h2 { margin-bottom: var(--spacing-md); }

.personal-container { background-color: var(--bg-card); border-radius: var(--radius-lg); padding: var(--spacing-md); box-shadow: var(--shadow-md); }
.personal-category { margin-bottom: var(--spacing-md); }
.personal-category:last-child { margin-bottom: 0; }
.personal-category-title { color: var(--text-head); font-size: 1.2rem; font-weight: 700; margin-bottom: var(--spacing-sm); text-transform: uppercase; }

.personal-row { display: flex; justify-content: space-between; align-items: center; padding: var(--spacing-sm) 0; }
.personal-info { flex-grow: 1; margin-right: var(--spacing-sm); display: flex; flex-direction: column; }
.personal-title { font-size: 0.8rem; color: var(--text-meta); font-weight: 500; margin-bottom: 2px; }
.personal-name { font-size: 1.0rem; font-weight: 700; font-family: var(--font-body); color: var(--text-head); text-transform: uppercase; }

.personal-actions { display: flex; gap: var(--spacing-sm); flex-shrink: 0; }
.personal-actions .btn { width: 35px; height: 35px; padding: 0; display: flex; align-items: center; justify-content: center; font-size: 0; border-radius: var(--radius-sm); }
.personal-actions .btn img { width: 20px; height: 20px; filter: brightness(0) invert(1); }
.personal-actions .btn .icon-hover { display: none; }
.personal-actions .btn:hover .icon-hover { display: block; }
.personal-actions .btn:hover .icon-default { display: none; }

.personal-divider { border: none; border-top: 1px solid var(--border-light); margin: 0; }
.personal-divider:last-child { display: none; }

/* =========================================
   15. WIDGETS: EVENTS & STATS
   ========================================= */
.event-list { display: flex; flex-direction: column; gap: var(--spacing-sm); }
.card-event { display: flex; align-items: center; background-color: var(--bg-card); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); text-decoration: none; color: inherit; transition: transform 0.2s ease, box-shadow 0.2s ease; }
.card-event:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.card-date { display: flex; flex-direction: column; align-items: center; justify-content: center; background-color: var(--primary); color: var(--secondary); font-family: var(--font-head); font-weight: 700; text-align: center; padding: 15px; border-radius: var(--radius-md) 0 0 var(--radius-md); align-self: stretch; width: 80px; }
.card-date .month { font-size: 0.9rem; text-transform: uppercase; opacity: 0.8; line-height: 1; }
.card-date .day { font-size: 1.8rem; line-height: 1; }

.card-event .card-body, .card-conversation .card-body { flex-grow: 1; padding: 15px 20px; min-width: 0; }
.event-title, .card-conversation .recipient { font-size: 1.1rem; font-family: var(--font-head); font-weight: 700; margin: 0 0 5px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: uppercase;}
.event-location, .card-conversation .subject { font-size: 0.9rem; color: var(--text-meta); margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-actions { padding: 0 20px; display: flex; align-items: center; }

.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stats-card { background-color: var(--bg-card); border-radius: var(--radius-md); padding: 10px 5px; box-shadow: var(--shadow-sm); border: 1px solid var(--border-light); display: flex; flex-direction: column; justify-content: center; align-items: center; aspect-ratio: 1 / 1; transition: transform 0.2s ease, box-shadow 0.2s ease; }
.stats-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stats-card-value { font-size: clamp(1.2rem, 5vw, 2.2rem); font-family: var(--font-head); font-weight: 700; color: var(--primary); line-height: 1; margin-bottom: 5px; }
.stats-card-label { font-size: clamp(0.6rem, 2.5vw, 0.85rem); color: var(--text-meta); text-transform: uppercase; font-weight: bold; letter-spacing: 0; text-align: center; line-height: 1.2; }

/* =========================================
   16. MODALS, ALERTS & DROPDOWNS
   ========================================= */
.login-dropdown { background-color: var(--bg-card); display: none; position: absolute; top: 100%; left: 0; width: 100%; z-index: 1001; box-shadow: var(--shadow-sm); border-top: 1px solid var(--border-light); }
.login-dropdown.is-open { display: block; }
.login-dropdown .container { padding: var(--spacing-md); }
.login-dropdown form { display: flex; flex-direction: column; gap: var(--spacing-sm); }
.login-dropdown input { width: 100%; padding: 12px; border: 1px solid var(--border-base); border-radius: var(--radius-sm); font-family: var(--font-body); font-size: 1rem; appearance: none; }
.login-dropdown input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.2); }
.login-dropdown button { display: block; width: 100%; padding: 12px 24px; border-radius: var(--radius-sm); font-family: var(--font-head); font-weight: 700; text-transform: uppercase; text-align: center; cursor: pointer; border: 2px solid transparent; transition: all 0.2s ease; background-color: var(--primary); color: var(--secondary); }
.login-dropdown button:hover { background-color: rgba(var(--primary-rgb), 0.9); color: var(--secondary); }
@media (min-width: 992px) {
    .login-dropdown { left: auto; transform: none; right: calc((100% - 1200px) / 2); width: 400px; border-radius: 0 0 var(--radius-md) var(--radius-md); border: 1px solid var(--border-light); border-top: none; }
}

.alert-box { padding: var(--spacing-md); border-radius: var(--radius-sm); }
.alert-warning { background-color: rgba(255, 100, 100, 0.05); border: 1px dashed var(--accent); }
.alert-success { background-color: rgba(100, 255, 100, 0.05); border: 1px solid var(--border-base); }
.alert-empty { border: 1px dashed var(--border-base); }
.alert-title { margin-top: 0; margin-bottom: 10px; font-weight: 600; }
.alert-title.text-success { color: var(--text-head); margin: 0; }
.alert-title.text-accent { color: var(--accent); }

.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 1000; align-items: center; justify-content: center; }
.modal-content { background: var(--bg-app); padding: var(--spacing-md); border-radius: var(--radius-md); max-width: 400px; width: 90%; box-shadow: 0 10px 25px rgba(0,0,0,0.3); }
.modal-title { margin-top: 0; }
.modal-text { font-size: 0.9rem; margin-bottom: 15px; }
.instruction-box { background-color: var(--bg-light); padding: var(--spacing-sm); border-radius: var(--radius-sm); border: 1px solid var(--border-base); margin-bottom: var(--spacing-md); }
.instruction-title { font-size: 1rem; margin-top: 0; }
.instruction-text { font-size: 0.9rem; margin-bottom: 10px; }



.ad-surface {
                cursor: pointer;
                transition: fill 0.2s ease, opacity 0.2s ease;
                stroke: transparent;
                stroke-width: 10;
            }
            .ad-surface:hover {
                fill: var(--accent);
                opacity: 1;
                stroke: var(--accent);
                stroke-opacity: 0.3;
            }
            
            .sarg-segment {
                fill: none;
                stroke: var(--primary);
                stroke-width: 8;
                cursor: pointer;
                transition: stroke 0.2s ease;
            }
            .sarg-segment:hover {
                stroke: var(--accent);
            }