/* Fjordnett Kundeportal – v2 */
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,400;0,14..32,500;0,14..32,600;0,14..32,700;1,14..32,400&display=swap');

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

:root {
    --bg:         #F5F6FA;
    --surface:    #FFFFFF;
    --surface-2:  #F0F1F7;
    --border:     #E2E4EC;
    --border-2:   #CDD0DE;
    --accent:     #2563EB;
    --accent-h:   #1D4ED8;
    --accent-bg:  #EFF4FF;
    --text:       #111827;
    --text-2:     #374151;
    --muted:      #6B7280;
    --subtle:     #9CA3AF;
    --danger:     #DC2626;
    --danger-bg:  #FEF2F2;
    --success:    #16A34A;
    --success-bg: #F0FDF4;
    --warn:       #D97706;
    --warn-bg:    #FFFBEB;
    --sidebar-w:  240px;
    --radius:     8px;
    --shadow:     0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md:  0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
}

html { font-size: 15px; }
body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-h); }

/* ── Sidebar ──────────────────────────────────── */

.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
}

.sidebar-logo {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-logo-mark {
    width: 32px; height: 32px;
    background: var(--accent);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.sidebar-logo-mark svg { width: 16px; height: 16px; }

.sidebar-logo-text {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.3px;
}

.sidebar-logo-text span { color: var(--accent); }

.sidebar-section {
    padding: 16px 12px 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--subtle);
}

.sidebar-nav { flex: 1; padding: 8px 0; list-style: none; overflow-y: auto; }

.sidebar-nav li { padding: 1px 8px; }

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--muted);
    border-radius: 6px;
    transition: background 0.1s, color 0.1s;
}

.sidebar-nav a:hover { background: var(--surface-2); color: var(--text-2); }

.sidebar-nav a.active {
    background: var(--accent-bg);
    color: var(--accent);
}

.sidebar-nav a.active .nav-icon { opacity: 1; }

.nav-icon { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.6; }
.sidebar-nav a.active .nav-icon { opacity: 1; }

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 7px;
    transition: background 0.1s;
    cursor: default;
}

.user-pill:hover { background: var(--surface-2); }

.user-avatar {
    width: 32px; height: 32px;
    background: var(--accent-bg);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    flex-shrink: 0;
    text-transform: uppercase;
}

.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--subtle); }

/* ── Main ──────────────────────────────────────── */

.main {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 40px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-breadcrumb {
    font-size: 13.5px;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.topbar-breadcrumb strong { color: var(--text); font-weight: 600; }

.topbar-actions { display: flex; gap: 10px; align-items: center; }

.content { padding: 32px 40px; flex: 1; max-width: 1100px; }

/* ── Page header ──────────────────────────────── */

.page-header { margin-bottom: 28px; }
.page-title { font-size: 21px; font-weight: 700; letter-spacing: -0.4px; color: var(--text); }
.page-sub { font-size: 13.5px; color: var(--muted); margin-top: 3px; }

/* ── Auth ─────────────────────────────────────── */

.auth-wrap {
    min-height: 100vh;
    display: flex;
    background: var(--bg);
}

.auth-left {
    width: 420px;
    flex-shrink: 0;
    background: var(--accent);
    padding: 48px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.auth-left-logo {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.4px;
}

.auth-left-logo span { opacity: 0.7; }

.auth-left-tagline {
    color: rgba(255,255,255,0.85);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.6px;
    line-height: 1.3;
}

.auth-left-sub {
    color: rgba(255,255,255,0.6);
    font-size: 14px;
    margin-top: 12px;
}

.auth-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 40px;
}

.auth-box {
    width: 100%;
    max-width: 400px;
}

.auth-title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.4px;
    color: var(--text);
    margin-bottom: 4px;
}

.auth-sub-text {
    font-size: 13.5px;
    color: var(--muted);
    margin-bottom: 28px;
}

/* ── Cards ────────────────────────────────────── */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.card-body { padding: 24px; }

.card-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title { font-size: 14px; font-weight: 600; color: var(--text); }

/* ── Stats ────────────────────────────────────── */

.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stat-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.stat-icon {
    width: 32px; height: 32px;
    border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
}

.stat-icon-blue   { background: var(--accent-bg); color: var(--accent); }
.stat-icon-green  { background: var(--success-bg); color: var(--success); }
.stat-icon-yellow { background: var(--warn-bg); color: var(--warn); }
.stat-icon-red    { background: var(--danger-bg); color: var(--danger); }

.stat-value {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.6px;
    color: var(--text);
    line-height: 1;
}

/* ── Table ────────────────────────────────────── */

.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

thead th {
    text-align: left;
    padding: 10px 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}

thead th:first-child { border-radius: 6px 0 0 0; }
thead th:last-child  { border-radius: 0 6px 0 0; }

tbody td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-2);
    vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #FAFBFF; }

/* ── Badges ───────────────────────────────────── */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.1px;
}

.badge::before {
    content: '';
    width: 5px; height: 5px;
    border-radius: 50%;
    background: currentColor;
}

.badge-green  { background: var(--success-bg); color: var(--success); }
.badge-red    { background: var(--danger-bg);  color: var(--danger); }
.badge-yellow { background: var(--warn-bg);    color: var(--warn); }
.badge-blue   { background: var(--accent-bg);  color: var(--accent); }
.badge-gray   { background: var(--surface-2);  color: var(--muted); }

/* ── Alerts ───────────────────────────────────── */

.alert {
    padding: 12px 16px;
    border-radius: 7px;
    font-size: 13.5px;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border: 1px solid;
}

.alert-error   { background: var(--danger-bg);  border-color: #FECACA; color: var(--danger); }
.alert-success { background: var(--success-bg); border-color: #BBF7D0; color: var(--success); }
.alert-info    { background: var(--accent-bg);  border-color: #BFDBFE; color: var(--accent); }
.alert-warn    { background: var(--warn-bg);    border-color: #FDE68A; color: var(--warn); }

/* ── Forms ────────────────────────────────────── */

.form-group { margin-bottom: 18px; }

label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-2);
    margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 9px 12px;
    background: var(--surface);
    border: 1px solid var(--border-2);
    border-radius: 6px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
    appearance: none;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

input::placeholder, textarea::placeholder { color: var(--subtle); }

textarea { resize: vertical; min-height: 90px; }

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

.form-hint { font-size: 12px; color: var(--subtle); margin-top: 5px; }

/* ── Buttons ──────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: 7px;
    font-size: 13.5px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1;
}

.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    box-shadow: 0 1px 2px rgba(37,99,235,0.25);
}

.btn-primary:hover { background: var(--accent-h); color: #fff; border-color: var(--accent-h); }

.btn-outline {
    background: var(--surface);
    color: var(--text-2);
    border-color: var(--border-2);
    box-shadow: var(--shadow);
}

.btn-outline:hover { background: var(--surface-2); color: var(--text); }

.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #B91C1C; color: #fff; }

.btn-ghost { background: transparent; color: var(--muted); border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-sm  { padding: 6px 12px; font-size: 12.5px; border-radius: 5px; }
.btn-full { width: 100%; }

/* ── Package cards ────────────────────────────── */

.packages-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.package-card {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 24px;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
    position: relative;
}

.package-card:hover { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,0.08); }
.package-card.selected { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }

.package-card.selected .pkg-check {
    background: var(--accent);
    border-color: var(--accent);
}

.package-card.selected .pkg-check::after {
    content: '';
    display: block;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: #fff;
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
}

.pkg-check {
    position: absolute;
    top: 16px; right: 16px;
    width: 18px; height: 18px;
    border-radius: 50%;
    border: 2px solid var(--border-2);
    background: var(--surface);
    position: absolute;
}

.package-name { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 8px; }

.package-price {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.6px;
    color: var(--text);
}

.package-price sup { font-size: 14px; font-weight: 600; vertical-align: super; }
.package-price small { font-size: 13px; font-weight: 400; color: var(--muted); }

.package-divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

.package-features { list-style: none; }
.package-features li {
    font-size: 13px;
    color: var(--text-2);
    padding: 3px 0;
    display: flex;
    align-items: center;
    gap: 7px;
}

.package-features li::before {
    content: '';
    width: 14px; height: 14px;
    flex-shrink: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Ccircle cx='7' cy='7' r='7' fill='%23F0FDF4'/%3E%3Cpath d='M4 7l2 2 4-4' stroke='%2316A34A' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
    background-size: cover;
}

/* ── Service cards ────────────────────────────── */

.service-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.service-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.service-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.service-icon {
    width: 40px; height: 40px;
    background: var(--accent-bg);
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    color: var(--accent);
}

.service-name { font-size: 14px; font-weight: 600; color: var(--text); }
.service-domain { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.service-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.service-meta-item { }
.service-meta-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--subtle); margin-bottom: 2px; }
.service-meta-value { font-size: 13px; font-weight: 500; color: var(--text-2); }

.service-card-footer {
    padding-top: 14px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
}

/* ── Support tickets ──────────────────────────── */

.ticket-list { display: flex; flex-direction: column; gap: 10px; }

.ticket-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: box-shadow 0.15s;
    text-decoration: none;
    color: inherit;
}

.ticket-item:hover { box-shadow: var(--shadow-md); color: inherit; }

.ticket-status-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.ticket-status-dot.open      { background: var(--accent); }
.ticket-status-dot.waiting   { background: var(--warn); }
.ticket-status-dot.resolved  { background: var(--success); }
.ticket-status-dot.closed    { background: var(--subtle); }

.ticket-info { flex: 1; min-width: 0; }
.ticket-subject { font-size: 14px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticket-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }

.ticket-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* ── Ticket detail ────────────────────────────── */

.ticket-thread { display: flex; flex-direction: column; gap: 16px; margin-bottom: 24px; }

.ticket-message {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.ticket-message-header {
    padding: 12px 18px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.ticket-message-author { font-weight: 600; color: var(--text); }
.ticket-message-time { color: var(--subtle); font-size: 12px; }
.ticket-message-body { padding: 16px 18px; font-size: 14px; color: var(--text-2); line-height: 1.7; white-space: pre-wrap; }

.ticket-message.staff .ticket-message-header { background: var(--accent-bg); border-color: #BFDBFE; }
.ticket-message.staff .ticket-message-author { color: var(--accent); }

/* ── Misc utilities ───────────────────────────── */

.divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
.text-muted { color: var(--muted); font-size: 13px; }
.text-right { text-align: right; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--muted);
}

.empty-state-icon {
    width: 48px; height: 48px;
    background: var(--surface-2);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 16px;
    color: var(--subtle);
}

.empty-state-title { font-size: 15px; font-weight: 600; color: var(--text-2); margin-bottom: 4px; }
.empty-state-text  { font-size: 13.5px; }

/* ── Responsive ───────────────────────────────── */

@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    .main { margin-left: 0; }
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .packages-grid { grid-template-columns: 1fr; }
    .auth-left { display: none; }
}

@media (max-width: 600px) {
    .content { padding: 20px 16px; }
    .topbar { padding: 0 16px; }
    .stats-row { grid-template-columns: 1fr 1fr; }
}
