/* ==========================================================================
   Pharma ERP auth module — self-hosted stylesheet.
   No external fonts, images or scripts (data-residency requirement).
   Corporate, functional, no decorative animation.
   ========================================================================== */

:root {
    --ink: #1c2733;
    --ink-soft: #5a6a7a;
    --line: #d5dde5;
    --paper: #ffffff;
    --page: #eef1f5;
    --brand: #1f4e79;
    --brand-dark: #173a5a;
    --danger: #b02a37;
    --danger-bg: #f8d7da;
    --ok: #1e6f42;
    --ok-bg: #d9f0e2;
    --warn-bg: #fff3cd;
    --warn: #8a6d1a;
    --radius: 6px;
}

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

body {
    font-family: "Segoe UI", -apple-system, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    color: var(--ink);
    background: var(--page);
    line-height: 1.5;
}

h1, h2, h3 { font-weight: 600; color: var(--ink); }
a { color: var(--brand); }

/* ---------- Centred card (login and related pages) ---------- */

.auth-body { min-height: 100vh; }
.auth-main {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}
.auth-card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 2px 10px rgba(28, 39, 51, 0.08);
    width: 100%;
    max-width: 430px;
    padding: 36px 40px 32px;
}
.auth-card.wide-card { max-width: 560px; }
.auth-logo { text-align: center; margin-bottom: 24px; }
.auth-logo h1 { font-size: 20px; margin-top: 10px; }
.auth-subtitle { color: var(--ink-soft); font-size: 13px; margin-top: 2px; }
.auth-footnote {
    margin-top: 18px;
    color: var(--ink-soft);
    font-size: 12px;
    text-align: center;
    max-width: 430px;
}

/* Company logo slot: replace .brand-mark with an <img> of the real logo. */
.brand-mark {
    display: inline-block;
    width: 22px; height: 22px;
    border-radius: 4px;
    background: linear-gradient(135deg, var(--brand) 0%, #2d6da3 100%);
    vertical-align: -4px;
}
.brand-mark.large { width: 44px; height: 44px; border-radius: 8px; }

/* Real logo (auth/assets/logo.jpg); same footprint as the .brand-mark square. */
.brand-logo {
    width: 22px; height: 22px;
    object-fit: cover;
    border-radius: 4px;
    vertical-align: -4px;
}
.brand-logo.large { width: 44px; height: 44px; border-radius: 8px; }

/* ---------- Forms ---------- */

.form-group { margin-bottom: 16px; }
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.hint { color: var(--ink-soft); font-size: 12.5px; margin-top: 4px; }

input[type="text"], input[type="email"], input[type="password"], select {
    width: 100%;
    padding: 9px 11px;
    font-size: 15px;
    font-family: inherit;
    color: var(--ink);
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
input:focus, select:focus {
    outline: 2px solid var(--brand);
    outline-offset: 0;
    border-color: var(--brand);
}
input[readonly] { background: var(--page); color: var(--ink-soft); }

.checkbox-row { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; }
.checkbox-row input { margin-top: 3px; }

.btn {
    display: inline-block;
    padding: 9px 18px;
    font-size: 15px;
    font-family: inherit;
    font-weight: 600;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { background: var(--paper); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { background: var(--page); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-small { padding: 4px 10px; font-size: 13px; }
.btn-block { display: block; width: 100%; }

/* ---------- Alerts / flash ---------- */

.alert { padding: 10px 14px; border-radius: var(--radius); font-size: 14px; margin-bottom: 16px; }
.alert-error { background: var(--danger-bg); color: var(--danger); border: 1px solid #eeb2b8; }
.alert-success { background: var(--ok-bg); color: var(--ok); border: 1px solid #b3ddc3; }
.alert-warning { background: var(--warn-bg); color: var(--warn); border: 1px solid #ead49a; }
.alert ul { margin: 4px 0 0 18px; }

/* ---------- SSO buttons (vendor branding guidelines) ---------- */

.sso-buttons { display: flex; flex-direction: column; gap: 10px; margin-bottom: 4px; }

.sso-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 9px 12px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
}
/* Microsoft: light theme per Microsoft identity guidelines */
.sso-btn.microsoft {
    background: #ffffff;
    border: 1px solid #8c8c8c;
    color: #5e5e5e;
}
.sso-btn.microsoft:hover { background: #f3f3f3; }
/* Google: light theme per Google Sign-In branding guidelines */
.sso-btn.google {
    background: #ffffff;
    border: 1px solid #747775;
    color: #1f1f1f;
}
.sso-btn.google:hover { background: #f6f6f6; }
.sso-btn svg { flex: 0 0 auto; }

.separator {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--ink-soft);
    font-size: 12.5px;
    margin: 18px 0;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.separator::before, .separator::after {
    content: "";
    flex: 1;
    border-top: 1px solid var(--line);
}

.auth-links { margin-top: 16px; text-align: center; font-size: 13.5px; }

/* ---------- TOTP enrolment ---------- */

.qr-box {
    display: flex;
    justify-content: center;
    padding: 14px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin: 12px 0;
}
.manual-key {
    font-family: "Consolas", "Menlo", monospace;
    font-size: 14px;
    background: var(--page);
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    padding: 8px 10px;
    text-align: center;
    word-break: break-all;
    user-select: all;
}
.recovery-codes {
    columns: 2;
    list-style: none;
    font-family: "Consolas", "Menlo", monospace;
    font-size: 15px;
    background: var(--page);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px 18px;
    margin: 12px 0;
}
.recovery-codes li { padding: 3px 0; }

/* ---------- Admin screens ---------- */

.admin-body { background: var(--page); }
.admin-header { background: var(--brand); color: #fff; }
.admin-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.admin-header .brand { font-weight: 600; font-size: 16px; color: #fff; }
.admin-nav { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.admin-nav a { color: #dce8f3; text-decoration: none; font-size: 14px; }
.admin-nav a:hover { color: #fff; text-decoration: underline; }
.admin-user { color: #fff; font-size: 14px; font-weight: 600; }

.admin-main { max-width: 1200px; margin: 0 auto; padding: 24px 20px 48px; }
.admin-main h1 { font-size: 22px; margin-bottom: 16px; }
.admin-main h2 { font-size: 17px; margin: 26px 0 10px; }

.panel {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 20px;
}
.panel-title { font-size: 15px; font-weight: 600; margin-bottom: 12px; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    align-items: end;
}

.table-wrap { overflow-x: auto; }
table.data {
    width: 100%;
    border-collapse: collapse;
    background: var(--paper);
    font-size: 14px;
}
table.data th, table.data td {
    text-align: left;
    padding: 8px 12px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
    white-space: nowrap;
}
table.data td.wrap { white-space: normal; }
table.data th { background: var(--page); font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-soft); }
table.data tr:hover td { background: #f7fafc; }

.badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    border-radius: 10px;
    padding: 1px 9px;
}
.badge-active { background: var(--ok-bg); color: var(--ok); }
.badge-invited { background: #dbe9f6; color: var(--brand); }
.badge-locked { background: var(--warn-bg); color: var(--warn); }
.badge-suspended { background: var(--danger-bg); color: var(--danger); }
.badge-muted { background: var(--page); color: var(--ink-soft); }

.action-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form { display: inline; }

.kv { font-size: 14px; }
.kv dt { font-weight: 600; color: var(--ink-soft); font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.04em; margin-top: 10px; }
.kv dd { margin: 1px 0 0; }

/* ---------- Responsive (down to tablet) ---------- */

@media (max-width: 768px) {
    .auth-card { padding: 26px 22px; }
    .admin-header-inner, .admin-main { padding-left: 14px; padding-right: 14px; }
    .recovery-codes { columns: 1; }
}
