/* ============================================================
   Kenso Portal — Stylesheet
   Ren nordisk design, tydlig typografi, lugna färger.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500;9..40,600&display=swap');

:root {
    --bg:           #f4f2ee;
    --surface:      #ffffff;
    --border:       #dedad3;
    --text:         #1a1917;
    --text-muted:   #7a756e;
    --accent:       #0054f0; /* #2b5c8a */
    --accent-hover: #0054f0; /* #1e4266 */
    --danger:       #b93b3b;
    --success:      #2d7a4f;
    --radius:       6px;
    --shadow:       0 1px 3px rgba(0,0,0,.07), 0 4px 16px rgba(0,0,0,.05);
    --font-display: 'DM Serif Display', Georgia, serif;
    --font-body:    'DM Sans', system-ui, sans-serif;
}

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

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    font-size: 15px;
}

/* ── Login ──────────────────────────────────────────── */

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 3rem 2.5rem 2.5rem;
    width: 100%;
    max-width: 400px;
}

.login-logo {
    font-family: var(--font-display);
    font-size: 1.9rem;
    color: var(--accent);
    margin-bottom: 0.2rem;
}

.login-tagline {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 2.2rem;
    font-weight: 300;
}

/* ── Topbar ─────────────────────────────────────────── */

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

.topbar-brand {
    font-family: var(--font-display);
    font-size: 1.25rem;
    color: var(--accent);
}

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

.topbar-name {
    font-size: 0.875rem;
    color: var(--text-muted);
    cursor: pointer !important;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius);
    transition: background 0.15s, color 0.15s;
    text-decoration: none;
}

.topbar-name::after {
    content: '›';
    font-size: 1rem;
    opacity: 0.5;
    transition: opacity 0.15s, transform 0.15s;
}

.topbar-name:hover {
    background: var(--bg);
    color: var(--accent);
    cursor: pointer !important;
    user-select: none;
}

.topbar-name:hover::after {
    opacity: 1;
    transform: translateX(2px);
}

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

.main-content {
    max-width: 1280px;
    margin: 2.5rem auto;
    padding: 0 1.5rem;
    display: grid;
    gap: 1.5rem;
}

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

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

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

.card-header-left {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.card-title {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 400;
    color: var(--text);
}

.card-icon {
    width: 18px;
    height: 18px;
    opacity: 0.45;
    flex-shrink: 0;
}

.card-body { padding: 1.4rem 1.5rem; }

/* ── Info grid (profile page) ───────────────────────── */

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.2rem;
}

.info-item label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
}

.info-item span,
.info-item a {
    font-size: 0.93rem;
    color: var(--text);
    word-break: break-word;
}

.info-item a { color: var(--accent); text-decoration: none; }
.info-item a:hover { text-decoration: underline; }

/* ── Data table (Excel-style) ───────────────────────── */

.table-wrapper {
    overflow-x: auto;
    width: 100%;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    min-width: 400px;
}

.data-table thead tr {
    background: var(--bg);
    border-bottom: 2px solid var(--border);
}

.data-table th {
    padding: 0.6rem 1rem;
    text-align: left;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    white-space: nowrap;
}

.data-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
}

.data-table tbody tr:last-child {
    border-bottom: none;
}

.data-table tbody tr:hover {
    background: #fafaf8;
}

.data-table td {
    padding: 0.7rem 1rem;
    color: var(--text);
    vertical-align: middle;
    word-break: break-word;
}

.data-table td a {
    color: var(--accent);
    text-decoration: none;
}
.data-table td a:hover { text-decoration: underline; }

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

.form-group { display: flex; flex-direction: column; gap: 0.35rem; }

.form-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.form-group input[type=text],
.form-group input[type=email],
.form-group input[type=tel],
.form-group input[type=url],
.form-group input[type=password],
.form-group select {
    width: 100%;
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.92rem;
    color: var(--text);
    background: var(--bg);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(43,92,138,.1);
    background: #fff;
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1.3rem;
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer !important;
    user-select: none;
    border: none;
    transition: background 0.15s, opacity 0.15s;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-block { width: 100%; margin-top: 0.5rem; padding: 0.75rem; font-size: 0.95rem; }

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg); color: var(--text); }

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

.alert {
    padding: 0.65rem 1rem;
    border-radius: var(--radius);
    font-size: 0.87rem;
    display: none;
    margin-bottom: 1rem;
}
.alert.show { display: block; }
.alert-error   { background: #fdf0f0; border: 1px solid #f0b8b8; color: var(--danger); }
.alert-success { background: #edf7f1; border: 1px solid #9dd5b5; color: var(--success); }

.error-msg { color: var(--danger); font-size: 0.9rem; }
.muted     { color: var(--text-muted); font-size: 0.9rem; }

/* ── Spinner ────────────────────────────────────────── */

.spinner {
    width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .65s linear infinite;
    display: none;
}
.loading .spinner  { display: inline-block; }
.loading .btn-text { display: none; }

@keyframes spin { to { transform: rotate(360deg); } }

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

@media (max-width: 560px) {
    .login-card   { padding: 2rem 1.25rem; }
    .topbar       { padding: 0 1rem; }
    .main-content { padding: 0 1rem; }
    .card-body    { padding: 1rem; }
    .topbar-name  { display: none; }
}

/* ── Breadcrumb ─────────────────────────────────────── */

.breadcrumb-bar {
    max-width: 1280px;
    margin: 1rem auto 0;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.breadcrumb-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}
.breadcrumb-link:hover { text-decoration: underline; }

.breadcrumb-sep { color: var(--text-muted); }

.breadcrumb-current {
    color: var(--text);
    font-weight: 500;
}

/* ── Filter select ──────────────────────────────────── */

.filter-select {
    padding: 0.45rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.88rem;
    color: var(--text);
    background: var(--bg);
    cursor: pointer;
    outline: none;
}
.filter-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(43,92,138,.1);
}

/* ── Modal ──────────────────────────────────────────── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 1rem;
}

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0,0,0,.18);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 1.1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.modal-title {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 400;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: var(--radius);
    transition: background 0.1s;
}
.modal-close:hover { background: var(--bg); color: var(--text); }

.modal-body {
    padding: 1.4rem 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    flex-shrink: 0;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 560px) {
    .form-grid { grid-template-columns: 1fr; }
}

/* ── Danger button ──────────────────────────────────── */

.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover:not(:disabled) { background: #9e2f2f; }
.btn-danger:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-danger-outline {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
}
.btn-danger-outline:hover { background: #fdf0f0; }

/* ── Card header right ──────────────────────────────── */

.card-header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
