/*
 * Kund-Portal — design inspirerad av internetport.se
 * Samma palett och komponenter som AF-Portal — mörkblå header, blå/cyan-accent.
 */

/* ---- Tillgänglighet (a11y) ---- */
.skip-link {
    position: absolute; left: -9999px; top: 8px;
    background: #fff; color: #0057ff; padding: 10px 16px;
    border: 3px solid #0057ff; border-radius: 6px;
    font-weight: 700; z-index: 99999; text-decoration: none;
}
.skip-link:focus { left: 8px; outline: 3px solid #ffd60a; }

/* Synliga focus-ringar för tangentbords-användare */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
    outline: 3px solid #ffd60a;
    outline-offset: 2px;
    box-shadow: 0 0 0 5px rgba(255, 214, 10, 0.35);
}

/* a11y-meny i nav */
.a11y-switcher {
    display: inline-flex; gap: 2px;
    background: rgba(255,255,255,0.08);
    border-radius: 999px; padding: 2px; margin: 0 4px;
}
.a11y-switcher a {
    display: inline-block; padding: 4px 10px; border-radius: 999px;
    color: rgba(255,255,255,0.7); font-size: 11px; font-weight: 700;
    text-decoration: none; line-height: 1; min-width: 24px; text-align: center;
}
.a11y-switcher a:hover { color: #fff; background: rgba(255,255,255,0.12); }
.a11y-switcher a.active { color: #0a1a3d; background: #ffd60a; }

/* Större text — skalas via html font-size så rem-baserad design följer med */
body.a11y-text-1 { font-size: 17px; }
body.a11y-text-2 { font-size: 19px; }
body.a11y-text-3 { font-size: 22px; line-height: 1.6; }
body.a11y-text-3 .data-table { font-size: 17px; }

/* Högkontrast — svart bakgrund, gul text, kraftiga ramar (WCAG AAA-style) */
body.a11y-contrast {
    background: #000 !important;
    color: #ffd60a !important;
}
body.a11y-contrast * { color: #ffd60a !important; background-color: transparent !important; border-color: #ffd60a !important; }
body.a11y-contrast a, body.a11y-contrast a * { color: #00ffff !important; text-decoration: underline !important; }
body.a11y-contrast .btn, body.a11y-contrast .panel, body.a11y-contrast .tile,
body.a11y-contrast input, body.a11y-contrast select, body.a11y-contrast textarea,
body.a11y-contrast .badge, body.a11y-contrast .alert {
    background: #000 !important; border: 2px solid #ffd60a !important;
}
body.a11y-contrast .btn-primary, body.a11y-contrast button[type=submit] {
    background: #ffd60a !important; color: #000 !important; border: 2px solid #ffd60a !important;
}
body.a11y-contrast img { filter: grayscale(1) contrast(1.4); }

/* Mörkt läge — mjukare än högkontrast, för ljuskänsliga */
body.a11y-dark {
    --bg: #0f1419; --surface: #1c2128; --border: #30363d;
    --text: #e6edf3; --muted: #9aa4b2;
}
body.a11y-dark .data-table th { background: #1c2128; color: #9aa4b2; }
body.a11y-dark .data-table td { border-color: #30363d; }
body.a11y-dark .panel, body.a11y-dark .tile { background: #1c2128; }
body.a11y-dark .alert-info { background: #0d2942; color: #79c0ff; }
body.a11y-dark .alert-error { background: #3a1f23; color: #ff7b72; }
body.a11y-dark .alert-success { background: #143324; color: #7ee787; }
body.a11y-dark .alert-warning { background: #3a2e10; color: #ffd60a; }
body.a11y-dark input, body.a11y-dark select, body.a11y-dark textarea {
    background: #0d1117; color: #e6edf3; border-color: #30363d;
}

/* Respektera prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .site-nav a.nav-blink { animation: none !important; background: rgba(255, 59, 48, 0.3) !important; }
    .nav-badge { animation: none !important; }
}

:root {
    --bg: #f4f6fb;
    --surface: #ffffff;
    --border: #e2e6ef;
    --text: #0f1a36;
    --muted: #6b7390;
    --primary: #0057ff;
    --primary-dark: #0040c2;
    --accent: #00b4d8;
    --dark: #0a1a3d;
    --success: #1f9d55;
    --warning: #d97706;
    --danger: #d33245;
    --shadow: 0 2px 12px rgba(20, 30, 70, 0.06);
    --shadow-lg: 0 8px 28px rgba(10, 26, 61, 0.10);
    --radius: 12px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1180px; margin: 0 auto; padding: 0 24px; }

/* ---------------- Header / nav ---------------- */
.site-header {
    background: var(--dark);
    color: #fff;
    border-bottom: 3px solid var(--primary);
}
.site-header a { color: #fff; }
.header-inner {
    display: flex; align-items: center; justify-content: space-between;
    height: 68px; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.brand-mark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 64px; height: 64px;
    background: url('https://internetportcom.b-cdn.net/French%20Bulldog-edit2-01%20(2).png') center/contain no-repeat;
    border-radius: 0;
    /* dölj ev. text ("IP", "A") inuti span:en */
    font-size: 0;
    color: transparent;
    text-indent: -9999px;
    overflow: hidden;
    flex-shrink: 0;
}
.brand-text { letter-spacing: 0.2px; }

.site-nav { display: flex; gap: 4px; align-items: center; font-size: 14px; flex-wrap: nowrap; }
.site-nav a {
    padding: 8px 12px;
    border-radius: 8px;
    color: rgba(255,255,255,0.85);
    font-weight: 500;
    white-space: nowrap;
}
@media (max-width: 1100px) {
    .site-nav a { padding: 8px 9px; font-size: 13px; }
    .site-nav { gap: 2px; }
}
.site-nav a:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
    text-decoration: none;
}
.site-nav a.active {
    background: rgba(255,255,255,0.12);
    color: #fff;
}
.nav-badge {
    display: inline-block;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    padding: 0 6px;
    margin-left: 6px;
    border-radius: 9px;
    background: #ff3b30;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    vertical-align: middle;
    box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.7);
}
.site-nav a.nav-blink {
    background: rgba(255, 59, 48, 0.18);
    color: #fff;
    animation: navBlink 1.6s ease-in-out infinite;
}
.site-nav a.nav-blink .nav-badge {
    animation: navBadgePulse 1.6s ease-in-out infinite;
}
@keyframes navBlink {
    0%, 100% { background: rgba(255, 59, 48, 0.18); }
    50%      { background: rgba(255, 59, 48, 0.45); }
}
@keyframes navBadgePulse {
    0%   { box-shadow: 0 0 0 0   rgba(255, 59, 48, 0.7); }
    70%  { box-shadow: 0 0 0 8px rgba(255, 59, 48, 0);   }
    100% { box-shadow: 0 0 0 0   rgba(255, 59, 48, 0);   }
}
.lang-switcher {
    display: inline-flex;
    background: rgba(255,255,255,0.06);
    border-radius: 999px;
    padding: 2px;
    margin: 0 4px;
}
.lang-switcher a {
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    border-radius: 999px;
    color: rgba(255,255,255,0.65);
}
.lang-switcher a:hover { color: #fff; text-decoration: none; background: rgba(255,255,255,0.06); }
.lang-switcher a.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: #fff;
}

.user-chip {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 5px 12px 5px 5px;
    background: rgba(255,255,255,0.06);
    border-radius: 999px;
    font-size: 13px;
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}
.user-chip .user-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    line-height: 1.2;
}
/* Smal viewport — visa bara avatar + första bokstaven */
@media (max-width: 1200px) {
    .user-chip .user-name { max-width: 120px; }
}
@media (max-width: 900px) {
    .user-chip .user-name { display: none; }
}
.user-chip .avatar {
    width: 26px; height: 26px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 12px; color: #fff;
}

/* ---------------- Hero ---------------- */
.hero {
    background: linear-gradient(135deg, #0a1a3d 0%, #0057ff 60%, #00b4d8 100%);
    color: #fff;
    padding: 48px 0 36px;
    margin-bottom: 32px;
}
.hero h1 { margin: 0 0 8px; font-size: 30px; letter-spacing: -0.2px; }
.hero-sub { margin: 0; font-size: 16px; opacity: 0.95; max-width: 720px; }
.hero-meta {
    margin-top: 18px;
    display: flex; gap: 18px; flex-wrap: wrap;
    font-size: 13px;
}
.hero-meta span { opacity: 0.85; }
.hero-meta strong { font-weight: 600; }

/* ---------------- Tiles / dashboard ---------------- */
.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 36px;
}
.tile {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
    display: flex; flex-direction: column; gap: 8px;
    position: relative; overflow: hidden;
}
.tile::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
    background: var(--primary);
}
.tile.tile-accent::before { background: var(--accent); }
.tile.tile-success::before { background: var(--success); }
.tile.tile-warning::before { background: var(--warning); }
.tile.tile-danger::before { background: var(--danger); }

.tile-label {
    font-size: 12px; text-transform: uppercase; letter-spacing: 0.8px;
    color: var(--muted); font-weight: 700;
}
.tile-value { font-size: 30px; font-weight: 700; color: var(--text); }
.tile-meta { font-size: 13px; color: var(--muted); }
.tile a { font-weight: 600; }

/* ---------------- Panels / cards ---------------- */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 28px;
    overflow: hidden;
}
.panel-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}
.panel-head h2, .panel-head h3 { margin: 0; font-size: 17px; }
.panel-head .panel-sub { color: var(--muted); font-size: 13px; }
.panel-body { padding: 24px; }
.panel-body.tight { padding: 0; }

/* ---------------- Tables ---------------- */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td {
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.data-table th {
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px;
    color: var(--muted); font-weight: 700;
    background: #f8f9fc;
}
.data-table tbody tr:hover { background: #fafbfe; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table .actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------------- Badges ---------------- */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}
.badge-active   { background: #e1f5ea; color: var(--success); }
.badge-upcoming { background: #fff4e0; color: var(--warning); }
.badge-ended    { background: #fde2e6; color: var(--danger); }
.badge-draft    { background: #ede9fe; color: #6d28d9; }

/* ---------------- Buttons ---------------- */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 14px; font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); text-decoration: none; }
.btn-secondary { background: #eef1f8; color: var(--text); border-color: #e2e6ef; }
.btn-secondary:hover { background: #dde2ec; text-decoration: none; }
.btn-ghost { background: transparent; color: var(--primary); border-color: var(--border); }
.btn-ghost:hover { background: #f0f5ff; text-decoration: none; }
.btn-danger { background: #fde2e6; color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; text-decoration: none; }
.btn-small { padding: 6px 12px; font-size: 12.5px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------------- Forms ---------------- */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.form-grid label,
.form-stack label {
    display: flex; flex-direction: column; gap: 6px;
    font-size: 13px; font-weight: 600;
}
.form-grid .full { grid-column: 1 / -1; }
.form-stack { display: flex; flex-direction: column; gap: 14px; }

input[type="text"], input[type="email"], input[type="password"],
input[type="date"], input[type="number"], select, textarea {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    background: #fff;
    color: var(--text);
    width: 100%;
}
textarea { resize: vertical; min-height: 100px; }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 87, 255, 0.15);
}
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
.form-hint { font-size: 12px; color: var(--muted); font-weight: 400; }

/* ---------------- Auth ---------------- */
.auth-page {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background:
        radial-gradient(1200px 600px at 0% -10%, rgba(0,180,216,0.18), transparent 50%),
        radial-gradient(1200px 600px at 110% 110%, rgba(0,87,255,0.20), transparent 50%),
        linear-gradient(180deg, #0a1a3d 0%, #06122c 100%);
    padding: 24px;
}
.auth-card {
    background: var(--surface);
    padding: 40px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    position: relative;
}
.auth-card .auth-lang {
    position: absolute;
    top: 14px;
    right: 16px;
    display: inline-flex;
    gap: 2px;
    background: #f1f5f9;
    border-radius: 999px;
    padding: 3px;
    font-size: 11px;
    font-weight: 700;
}
.auth-card .auth-lang a {
    color: var(--muted);
    text-decoration: none;
    padding: 3px 9px;
    border-radius: 999px;
    line-height: 1;
}
.auth-card .auth-lang a.active {
    background: var(--primary);
    color: #fff;
}
.auth-card .auth-brand {
    display: flex; align-items: center; gap: 10px; margin-bottom: 24px;
    font-weight: 700; font-size: 17px; color: var(--text);
}
.auth-card .auth-brand .brand-mark { width: 96px; height: 96px; }
.auth-card h1 { margin: 0 0 6px; font-size: 22px; }
.auth-card .auth-sub { margin: 0 0 24px; color: var(--muted); font-size: 14px; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; }
.auth-card .btn-primary { justify-content: center; padding: 12px; font-size: 15px; }
.auth-footer { text-align: center; margin-top: 22px; font-size: 13px; color: var(--muted); }

/* BankID-knapp + widget */
.auth-divider {
    display: flex; align-items: center; gap: 10px;
    margin: 14px 0;
    color: var(--muted); font-size: 12px;
}
.auth-divider::before, .auth-divider::after {
    content: ''; flex: 1; height: 1px; background: var(--border);
}
.bankid-btn {
    justify-content: center; padding: 12px; font-size: 15px; width: 100%;
}
.bankid-btn svg { color: var(--primary); }
.bankid-widget {
    margin-top: 14px; padding: 16px;
    border: 1px solid var(--border); border-radius: 10px;
    background: #f8f9fc;
    text-align: center;
    display: flex; flex-direction: column; gap: 10px; align-items: center;
}
.bankid-widget img { max-width: 180px; height: auto; margin: 4px auto; }
.bankid-widget .btn { width: 100%; justify-content: center; }

/* ---------------- Alerts ---------------- */
.alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 18px;
    font-size: 14px;
    border: 1px solid transparent;
}
.alert ul { margin: 0; padding-left: 18px; }
.alert-success { background: #e1f5ea; color: #0e6b3b; border-color: #bfe7cf; }
.alert-error   { background: #fde2e6; color: #a4172a; border-color: #f5b9c2; }
.alert-info    { background: #e6f0ff; color: #0a3a99; border-color: #c4d6f9; }
.alert-warning { background: #fff4e0; color: #8a4b00; border-color: #f5d7a3; }

/* ---------------- Empty state ---------------- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px dashed var(--border);
}
.empty-state.small { padding: 32px 20px; }
.empty-state h2, .empty-state h3 { margin-top: 0; }
.empty-state .muted { color: var(--muted); }

/* ---------------- Misc ---------------- */
.muted { color: var(--muted); }
.small { font-size: 12px; }
.flex { display: flex; gap: 10px; align-items: center; }
.spacer { flex: 1; }
.mono { font-family: ui-monospace, "Cascadia Code", "Roboto Mono", monospace; }
.divider { height: 1px; background: var(--border); margin: 18px 0; }

.site-footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 22px 0;
    color: var(--muted);
    font-size: 13px;
    text-align: center;
    margin-top: 60px;
}

/* VPS tab-nav */
.vps-tabs {
    display: flex;
    gap: 2px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px;
    margin-bottom: 20px;
    overflow-x: auto;
    box-shadow: var(--shadow);
}
.vps-tabs a {
    padding: 10px 18px;
    border-radius: 8px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: 0.2px;
    transition: background 0.15s, color 0.15s;
    text-decoration: none;
}
.vps-tabs a:hover {
    background: #f0f5ff;
    color: var(--text);
    text-decoration: none;
}
.vps-tabs a.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: #fff;
    box-shadow: 0 2px 6px rgba(0, 87, 255, 0.25);
}
.vps-tabs a.active:hover {
    color: #fff;
}

/* Crumb-rad ovanför tab-navet */
.vps-crumb {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    font-size: 13px;
    color: var(--muted);
}
.vps-crumb a {
    color: var(--muted);
    font-weight: 500;
}
.vps-crumb a:hover { color: var(--primary); text-decoration: none; }

/* Detalj-rader: titel/värde-grid */
.kv {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 8px 16px;
    font-size: 14px;
}
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }

/* Ticket-tråd */
.ticket-thread { display: flex; flex-direction: column; gap: 14px; }
.ticket-msg {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    background: #fff;
}
.ticket-msg.staff { background: #f0f5ff; border-color: #c7d8ff; }
.ticket-msg .ticket-meta {
    display: flex; justify-content: space-between; gap: 8px;
    font-size: 12px; color: var(--muted);
    margin-bottom: 6px;
}
.ticket-msg .ticket-body { white-space: pre-wrap; font-size: 14px; }

/* =========================================================
   Mobil-anpassning — komplett mobile-first responsive
   ========================================================= */

/* Tablet & mobil */
@media (max-width: 900px) {
    .form-grid { grid-template-columns: 1fr; }
    .hero { padding: 28px 0 22px; }
    .hero h1 { font-size: 22px; line-height: 1.25; }
    .hero-sub { font-size: 14px; }
    .header-inner { flex-direction: column; height: auto; padding: 10px 0; gap: 10px; }
    .site-nav { flex-wrap: wrap; justify-content: center; row-gap: 4px; column-gap: 2px; }
    .site-nav a { padding: 8px 10px; font-size: 13px; }
    .kv { grid-template-columns: 1fr; gap: 2px; }
    .kv dt { font-size: 12px; }
    .kv dd { margin-bottom: 8px; }

    /* Tabeller scrollar horisontellt — säkrar att inget bryter layouten */
    .panel-body.tight { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .data-table { font-size: 13px; min-width: 100%; }
    .data-table th, .data-table td { padding: 8px 10px; }

    /* Stora touch-targets (min 44x44) */
    .btn, .btn-small {
        min-height: 40px; padding-top: 9px; padding-bottom: 9px;
        font-size: 14px;
    }
    .btn-small { min-height: 36px; }

    /* Tile-grid (dashboard) på mobilen — 1 kolumn */
    .tile-grid { grid-template-columns: 1fr; gap: 10px; }
    .tile { padding: 14px; }

    /* Hjälp/manual — sidebar staplas ovanpå */
    main.container > div[style*="grid-template-columns:240px"] {
        grid-template-columns: 1fr !important;
    }

    /* Panel-head wrap */
    .panel-head {
        flex-direction: column; align-items: flex-start; gap: 8px;
    }
    .panel-head h2 { font-size: 17px; }

    /* Hero-knappar / actions */
    .form-actions { flex-wrap: wrap; gap: 8px; }

    /* User-chip kortare på mobil */
    .user-chip { max-width: 180px; padding: 4px 10px 4px 4px; font-size: 12px; }
    .user-chip .avatar { width: 22px; height: 22px; font-size: 11px; }

    /* VPS/Dedicated tabs wrappar till flera rader på mobil — bättre än
       horisontell scroll som klipper tab-text. */
    .vps-tabs {
        display: flex;
        flex-wrap: wrap;
        gap: 2px;
        overflow-x: visible;
        white-space: normal;
    }
    .vps-tabs a {
        padding: 8px 12px;
        flex: 0 1 auto;
        font-size: 13px;
        text-align: center;
    }

    /* Logga ut hela bredden + tydligare avstånd */
    .container { padding-left: 14px; padding-right: 14px; }

    /* Tickets — chat-bubblor använder mer av bredden */
    .ticket-msg > div[style*="max-width:75%"] { max-width: 88% !important; }

    /* Cancel-bekräfta input centreras */
    input[type="text"][name="confirm"] { width: 100% !important; max-width: 200px; }

    /* PDF-detalj-faktura mindre padding */
    .panel-body { padding: 14px; }
}

/* Aggressiva mobil-overrides — force responsive på sidor med inline-styles */
@media (max-width: 900px) {
    /* Tabeller — alltid scrollbara på mobil */
    .data-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
    .panel-body { overflow-x: auto; -webkit-overflow-scrolling: touch; }

    /* Inputs/selects/textareas — fyll bredden */
    input[type="text"], input[type="email"], input[type="password"], input[type="tel"],
    input[type="number"], input[type="date"], input[type="url"],
    select, textarea {
        max-width: 100% !important;
        width: 100%;
        box-sizing: border-box;
        font-size: 16px; /* förhindrar iOS-zoom på fokus */
    }

    /* Inline flex som blir trångt — stacka */
    .flex { flex-wrap: wrap; gap: 8px; }
    .form-actions { flex-wrap: wrap; gap: 8px; }
    .form-actions .btn { flex: 1 1 auto; }

    /* Side-by-side label-grid */
    label { display: block; }

    /* Tickets chat-bubblor — fullbredd */
    .ticket-msg { flex-direction: column !important; }
    .ticket-msg > div[style*="max-width"] { max-width: 100% !important; }

    /* Inline-grids med fixed columns */
    div[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
    div[style*="display:grid"] { gap: 12px !important; }

    /* VPS/Dedicated/VoIP tab-baren — flex-wrap already handles this at 900px */

    /* Auth-kort på mobil — minska shadow + padding */
    .auth-card { box-sizing: border-box; }

    /* Tightera bort tunga marginaler */
    .panel { margin-bottom: 14px; }
    h2 { font-size: 18px; }
    h3 { font-size: 15px; }

    /* Inline width:200/300/400 på inputs/divs — bryt */
    *[style*="width:200"], *[style*="width:300"], *[style*="width:400"], *[style*="width:500"] {
        max-width: 100% !important;
    }
    *[style*="min-width:170"], *[style*="min-width:200"], *[style*="min-width:300"] {
        min-width: 0 !important;
    }

    /* Form-grid */
    .form-grid { grid-template-columns: 1fr !important; gap: 10px; }
    .form-grid .full { grid-column: 1 / -1; }
}

/* Mobil-anpassad header — kompakt logo + nav */
@media (max-width: 700px) {
    .site-header { padding: 6px 0; }
    .header-inner { gap: 6px; padding: 6px 0; }
    /* Hide brand-text + a11y-switcher på smala skärmar — sparar mkt plats */
    .brand-text { display: none; }
    .brand-mark { width: 36px !important; height: 36px !important; }
    .a11y-switcher { display: none; }
    /* Lang-switcher kortare */
    .lang-switcher a { padding: 2px 6px; font-size: 10px; }
    /* User-chip bara avatar */
    .user-chip .user-name { display: none; }
    .user-chip { padding: 3px; max-width: 36px; }
    .user-chip .avatar { width: 28px; height: 28px; font-size: 12px; }
    /* Nav-länkar — kompakt + tight */
    .site-nav { gap: 1px; font-size: 13px; }
    .site-nav a { padding: 6px 7px; font-size: 12px; }
    /* Help-länken (frågetecken) ska vara mindre */
    .site-nav a[title*="Hjälp"] { font-size: 14px !important; padding: 4px 7px; }
    /* Data-tables — visuell scroll-hint */
    .data-table { font-size: 11px; }
    .data-table th, .data-table td { padding: 6px 6px; }
    .panel-body.tight { position: relative; }
    .panel-body.tight::after {
        content: '⇆'; position: absolute; top: 8px; right: 10px;
        color: var(--muted); font-size: 14px; opacity: 0.7;
        pointer-events: none;
    }
    /* Dölj icke-essentiella tabell-kolumner via .mhide-sm class — added per page */
    .data-table .mhide-sm { display: none; }
    /* Generisk regel: i listor med många kolumner, behåll bara de viktigaste
       (första namn-kolumnen + sista action-kolumnen). Override per tabell vid behov. */
    .data-table.compact-mobile th:not(:first-child):not(:last-child):not(.keep-mobile),
    .data-table.compact-mobile td:not(:first-child):not(:last-child):not(.keep-mobile) {
        display: none;
    }
    /* compact-mobile-tabeller behöver inte horisontell scroll → dölj ⇆-hinten */
    .panel-body.tight:has(.data-table.compact-mobile)::after { display: none; }
    /* Action-knappen (sista kolumnen) blir smal "→" på mobil för att rymmas */
    .data-table.compact-mobile td:last-child .btn,
    .data-table.compact-mobile td:last-child a.btn {
        padding: 6px 8px;
        font-size: 12px;
        white-space: nowrap;
    }
    /* Sista cellen får ej wrappa text i mobile */
    .data-table.compact-mobile td:last-child { white-space: nowrap; min-width: 60px; text-align: right; }
    /* Compact-tabell behöver ingen scroll — sätt overflow tillbaka till visible */
    .panel-body.tight:has(.data-table.compact-mobile) { overflow-x: visible; }
    .data-table.compact-mobile { min-width: 0; width: 100%; white-space: normal; }
    .data-table.compact-mobile td { white-space: normal; }
    .data-table.compact-mobile td:last-child { white-space: nowrap; }
    /* Panel-body minskad padding på mobil för mer plats */
    .panel-body.tight { padding: 8px; }
}

/* Liten mobil */
@media (max-width: 480px) {
    .hero h1 { font-size: 19px; }
    .data-table th, .data-table td { padding: 6px 8px; font-size: 12px; }
    .auth-card { padding: 24px 18px; max-width: 100%; margin: 8px; box-shadow: var(--shadow); }
    .auth-card .auth-brand { font-size: 15px; }
    .auth-card h1 { font-size: 19px; }
    .brand-text { font-size: 14px; }
    .a11y-switcher a, .lang-switcher a { padding: 4px 7px; font-size: 10px; }

    /* PayPal/Stripe form-buttons fullbredd */
    .gateway-form, .gateway-btn { width: 100% !important; }

    /* Snabbåtgärder-buttons */
    .form-actions .btn { width: 100%; justify-content: center; }
}

/* === VPS help-info (added 2026-05-28: hide-recreate plan B) === */
.vps-help-info {
    background: #f4f6f9;
    border-left: 3px solid #be1823;
    border-radius: 4px;
    padding: 12px 16px;
    margin: 8px 0;
    font-size: 13px;
}
.vps-help-info .hint { color: #3a3a39; }
.vps-help-info a { color: #be1823; text-decoration: underline; }
.vps-help-info strong { color: #1d1d1c; }

/* === VPS first-time credentials banner (Plan A Task 7) === */
.vps-credentials-banner {
    background: #fef3c7;
    border: 2px solid #f59e0b;
    border-radius: 8px;
    padding: 20px 24px;
    margin: 16px 0 24px;
    box-shadow: 0 2px 8px rgba(245,158,11,0.15);
}
.vps-credentials-banner h3 { margin: 0 0 8px; color: #92400e; font-size: 18px; }
.vps-credentials-banner .warn { color: #92400e; font-size: 13px; margin: 0 0 16px; }
.vps-credentials-banner table { width: 100%; border-collapse: collapse; margin: 0 0 16px; }
.vps-credentials-banner th { text-align: left; padding: 8px 14px 8px 0; font-weight: 600; color: #3a3a39; vertical-align: top; width: 28%; font-size: 14px; }
.vps-credentials-banner td { padding: 8px 0; font-size: 14px; vertical-align: top; }
.vps-credentials-banner code { background: #fef9c3; padding: 3px 8px; border-radius: 3px; font-family: Menlo, Monaco, monospace; font-size: 13px; word-break: break-all; overflow-wrap: anywhere; }
.vps-credentials-banner #cred-pwd { font-size: 15px; font-weight: 600; word-break: break-all; overflow-wrap: anywhere; }
.vps-credentials-banner .btn-mini { background: #1d1d1c; color: #fff; border: none; padding: 4px 10px; border-radius: 3px; cursor: pointer; font-size: 12px; margin-left: 8px; }
.vps-credentials-banner.expired { background: #fee2e2; border-color: #ef4444; }
.vps-credentials-banner.expired h3 { color: #b91c1c; }
.vps-credentials-info { background: #f4f6f9; padding: 10px 14px; border-radius: 4px; margin: 8px 0; font-size: 14px; }
.vps-credentials-info .hint { color: #6b7280; }

/* === Byt nameservers wizard === */
.wizard-shell { max-width: 720px; margin: 24px auto; }

.wizard-steps {
    list-style: none; display: flex; gap: 12px;
    padding: 0; margin: 0 0 24px;
}
.wizard-steps li {
    flex: 1; padding: 10px 14px;
    background: #eef1f8; border-radius: 8px;
    color: var(--muted); font-size: 13px; text-align: center;
    border: 1px solid var(--border);
}
.wizard-steps li.active {
    background: var(--primary); color: #fff; border-color: var(--primary);
    font-weight: 600;
}

.wizard-step { margin-bottom: 16px; }

.ns-presets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.preset-tile.btn {
    flex-direction: column; align-items: flex-start;
    text-align: left; padding: 14px 16px;
    height: auto; white-space: normal;
    transition: border-color 120ms, background 120ms, box-shadow 120ms;
}
.preset-tile.btn:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}
.preset-tile strong { display: block; font-size: 14px; margin-bottom: 4px; color: var(--text); }
.preset-tile span { color: var(--muted); font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

#ns-form label { display: block; margin-bottom: 12px; font-size: 13px; color: var(--text); font-weight: 500; }
#ns-form input {
    width: 100%; padding: 9px 12px; margin-top: 4px;
    border: 1px solid var(--border); border-radius: 8px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 13px; background: var(--surface); color: var(--text);
}
#ns-form input:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 87, 255, 0.12);
}

.ns-diff {
    display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
    margin: 16px 0;
    background: #f4f6fb; padding: 14px; border-radius: 8px;
    border: 1px solid var(--border);
}
.ns-diff h3 {
    margin: 0 0 8px; font-size: 12px;
    color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em;
}
.ns-diff ul {
    margin: 0; padding-left: 18px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 13px; color: var(--text);
}

#validation-status .ok   { color: var(--success); background: #e1f5ea; padding: 10px 14px; border-radius: 8px; border: 1px solid #bfe7cf; }
#validation-status .warn { color: var(--warning); background: #fff4e0; padding: 10px 14px; border-radius: 8px; border: 1px solid #f5d7a3; }

.wizard-warning {
    border-left: 3px solid var(--warning);
}

.confirm-check {
    display: block; margin: 14px 0; font-size: 14px;
    padding: 10px 12px; background: #f4f6fb;
    border: 1px solid var(--border); border-radius: 8px;
    cursor: pointer;
}
.confirm-check input { margin-right: 8px; }

.wizard-nav { display: flex; justify-content: space-between; margin-top: 20px; gap: 12px; }

#submit-result { margin-top: 16px; }
#submit-result .ok   { color: var(--success); font-weight: 600; }
#submit-result .warn { color: var(--danger); font-weight: 600; }

@media (max-width: 600px) {
    .ns-presets, .ns-diff { grid-template-columns: 1fr; }
    .wizard-steps { flex-direction: column; gap: 4px; }
    .wizard-shell { margin: 12px auto; }
}


/* ============================================================
   tile-with-icon — moved from dev-theme.css so live portal
   also gets the icon+body layout (CRITICAL #4)
   ============================================================ */
.tile-with-icon {
    flex-direction: row !important;
    align-items: flex-start;
    gap: 16px !important;
}
.tile-with-icon .tile-icon {
    flex-shrink: 0;
    width: 56px; height: 56px;
    border-radius: 50%;
    background: rgba(190, 24, 35, 0.10);
    color: #be1823;
    display: inline-flex; align-items: center; justify-content: center;
}
.tile-with-icon .tile-icon svg { width: 28px; height: 28px; }
.tile-with-icon .tile-body {
    display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0;
}
.tile-with-icon.tile-warning .tile-icon { background: rgba(217,119,6,.10); color:#d97706; }
.tile-with-icon.tile-accent  .tile-icon { background: rgba(190,24,35,.10); color:#be1823; }
.tile-with-icon.tile-success .tile-icon { background: rgba(29,29,28,.08); color:#1d1d1c; }
@media (max-width: 480px) {
    .tile-with-icon { flex-direction: column !important; align-items: center; text-align: center; }
    .tile-with-icon .tile-body { align-items: center; }
}

/* ============================================================
   Hamburger nav (CRITICAL #1)
   ============================================================ */
.nav-hamburger {
    display: none;
    background: none; border: none; cursor: pointer;
    padding: 6px 8px; border-radius: 4px;
    color: inherit; font-size: 22px; line-height: 1;
    margin-left: auto;
}
@media (max-width: 700px) {
    .nav-hamburger { display: flex; align-items: center; justify-content: center; }
    .site-nav {
        display: none;
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        padding: 8px 0 12px;
        gap: 2px;
        border-top: 1px solid var(--border);
    }
    .site-nav.nav-open { display: flex; }
    .site-nav a, .site-nav form, .site-nav .nav-lang-form { width: 100%; }
    .site-nav .nav-logout-form button { text-align: left; width: 100%; padding: 6px 0; }
    .header-inner { flex-wrap: wrap; }
}

/* ============================================================
   Ticket reply submit row — wrap on mobile (CRITICAL #2)
   ============================================================ */
@media (max-width: 600px) {
    .ticket-reply-actions {
        flex-wrap: wrap !important;
        gap: 8px !important;
    }
    .ticket-reply-actions .btn { width: 100%; text-align: center; }
}
