/* ============================================================
   Future Founders Co — Office Automation System
   Formal corporate theme (navy / gold)
   ============================================================ */

:root {
    --ff-navy: #2f3b4c;
    --ff-navy-dark: #232c39;
    --ff-gold: #d2a45f;
    --ff-gold-dark: #b8894a;
    --ff-bg: #f4f5f7;
    --ff-border: #e2e5ea;
    --ff-text: #2b3442;
    --ff-muted: #6b7686;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    font-size: 15px;
    background: var(--ff-bg);
    color: var(--ff-text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--ff-gold-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Top bar ---------- */
.topbar {
    background: linear-gradient(135deg, var(--ff-navy-dark) 0%, var(--ff-navy) 60%, #3a4759 100%);
    border-bottom: 3px solid var(--ff-gold);
}

.topnav {
    max-width: 1280px;
    margin: 0 auto;
    padding: 8px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none !important;
}

.brand-logo {
    height: 44px;
    width: auto;
    border-radius: 4px;
    background: #fff;
    padding: 2px 4px;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.2; }

.brand-name {
    color: #f4e9d8;
    font-weight: 700;
    font-size: 17px;
    letter-spacing: .4px;
}

.brand-sub {
    color: rgba(244, 233, 216, .65);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.6px;
}

.main-nav {
    list-style: none;
    display: flex;
    gap: 4px;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
}

.main-nav a {
    display: block;
    color: rgba(255, 255, 255, .78);
    padding: 14px 14px;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    margin-bottom: -3px;
    text-decoration: none !important;
}

.main-nav a:hover { color: #fff; }
.main-nav a.active { color: #fff; border-bottom-color: var(--ff-gold); }
.main-nav a.nav-logout { color: #e8b7a6; }

/* Signed-in user chip (top bar) */
.user-chip {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1px;
    padding: 4px 12px;
    margin-left: auto;
    border-left: 1px solid rgba(255, 255, 255, .18);
}

.user-chip-name {
    color: #f4e9d8;
    font-size: 12.5px;
    font-weight: 600;
}

.user-chip-role {
    color: var(--ff-gold);
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
}

@media (max-width: 900px) {
    .user-chip { display: none; }
}

/* ---------- Layout ---------- */
.app-main { flex: 1; }

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px 20px 40px;
}

.app-footer {
    background: var(--ff-navy-dark);
    color: rgba(255, 255, 255, .55);
    font-size: 12.5px;
    text-align: center;
    padding: 14px 20px;
}

/* ---------- Page title ---------- */
.page-title {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.page-title h1 {
    font-size: 21px;
    font-weight: 700;
    color: var(--ff-navy-dark);
    margin: 0;
}

.page-title .rule {
    flex: 1;
    min-width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--ff-gold), transparent);
    border-radius: 2px;
}

.page-actions { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }

/* ---------- Cards ---------- */
.card {
    background: #fff;
    border: 1px solid var(--ff-border);
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(35, 44, 57, .06);
    margin-bottom: 18px;
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--ff-border);
    font-weight: 600;
    color: var(--ff-navy-dark);
}

.card-body { padding: 16px; }

/* ---------- Stats ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stat-card {
    background: #fff;
    border: 1px solid var(--ff-border);
    border-left: 4px solid var(--ff-gold);
    border-radius: 8px;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    box-shadow: 0 1px 2px rgba(35, 44, 57, .06);
}

.stat-value { font-size: 30px; font-weight: 700; color: var(--ff-navy-dark); line-height: 1.1; }
.stat-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--ff-muted);
}
.stat-icon { font-size: 26px; }

/* ---------- Two column ---------- */
.two-col {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 18px;
    align-items: start;
}

.detail-col { grid-template-columns: 1.5fr 1fr; }
.outbox-col { grid-template-columns: 1.4fr 1fr; }

@media (max-width: 900px) {
    .two-col, .detail-col, .outbox-col { grid-template-columns: 1fr; }
}

/* ---------- Tables ---------- */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table thead th {
    background: var(--ff-navy);
    color: #fff;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .6px;
    padding: 10px 12px;
    white-space: nowrap;
}

.table tbody td {
    padding: 10px 12px;
    border-top: 1px solid var(--ff-border);
    vertical-align: middle;
}

.table tbody tr:hover { background: #faf7f1; }
.table .row-active { background: #f6ecdd !important; }
.table .num { text-align: right; }
.table .empty { text-align: center; color: var(--ff-muted); padding: 28px 12px !important; }
.table .nowrap { white-space: nowrap; }
.table-scroll { overflow-x: auto; max-height: 70vh; overflow-y: auto; }

.strong { font-weight: 600; }
.sub { color: var(--ff-muted); font-size: 12px; margin-top: 2px; }

/* Detail tables */
.detail-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.detail-table th {
    text-align: left;
    color: var(--ff-muted);
    font-weight: 600;
    width: 42%;
    padding: 8px 16px;
    border-top: 1px solid var(--ff-border);
    vertical-align: top;
    white-space: nowrap;
}
.detail-table td {
    padding: 8px 16px;
    border-top: 1px solid var(--ff-border);
}
.detail-table.narrow { margin: 14px 0; }

/* ---------- Badges ---------- */
.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
}
.badge-individual { background: #e8eef7; color: #2f5d92; }
.badge-company    { background: #f6ecdd; color: #93682b; }
.badge-sent       { background: #e2f2e5; color: #2e7d43; }
.badge-failed     { background: #f9e3e1; color: #b34038; }
.badge-inactive   { background: #e9eaec; color: #6b7686; }

/* Role badges (users.php) */
.badge-role-admin             { background: #f6ecdd; color: #93682b; }
.badge-role-ceo               { background: #f3e8f7; color: #7b3f92; }
.badge-role-marketing-manager { background: #e8eef7; color: #2f5d92; }
.badge-role-employee          { background: #e9eaec; color: #4c5566; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 6px;
    border: 1px solid var(--ff-border);
    background: #fff;
    color: var(--ff-text);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none !important;
    line-height: 1.3;
}
.btn:hover { border-color: var(--ff-gold); color: var(--ff-gold-dark); }

.btn-primary {
    background: var(--ff-navy);
    border-color: var(--ff-navy);
    color: #fff;
}
.btn-primary:hover { background: var(--ff-navy-dark); color: #fff; border-color: var(--ff-navy-dark); }

.btn-gold {
    background: var(--ff-gold);
    border-color: var(--ff-gold);
    color: #3a2c14;
    font-weight: 600;
}
.btn-gold:hover { background: var(--ff-gold-dark); border-color: var(--ff-gold-dark); color: #fff; }

.btn-danger {
    background: #b34038;
    border-color: #b34038;
    color: #fff;
}
.btn-danger:hover { background: #93332c; color: #fff; border-color: #93332c; }

.btn-sm { padding: 4px 10px; font-size: 12.5px; }
.btn-block { width: 100%; }

.btn-group { display: flex; gap: 4px; flex-wrap: wrap; }

/* ---------- Forms ---------- */
.form-card { padding-bottom: 8px; }

.form-row { margin-bottom: 14px; }

label {
    display: block;
    font-weight: 600;
    font-size: 13.5px;
    color: var(--ff-navy-dark);
    margin-bottom: 5px;
}

input[type="text"], input[type="email"], input[type="password"],
select, textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid #cfd4db;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    color: var(--ff-text);
    background: #fff;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--ff-gold);
    box-shadow: 0 0 0 3px rgba(210, 164, 95, .22);
}

select[multiple] { min-height: 220px; }

.req { color: #b34038; }
.hint { color: var(--ff-muted); font-weight: 400; font-size: 12px; margin-top: 4px; }

.form-section {
    border: 1px solid var(--ff-border);
    border-radius: 8px;
    background: #fff;
    padding: 10px 18px 18px;
    margin: 0 0 18px;
}

.form-section legend {
    font-size: 12.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--ff-gold-dark);
    padding: 0 8px;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 18px;
}
.grid-2 .span-2 { grid-column: 1 / -1; }
@media (max-width: 700px) { .grid-2 { grid-template-columns: 1fr; } }

.form-actions { display: flex; gap: 10px; margin-top: 6px; }

.check-row { display: flex; align-items: flex-end; padding-bottom: 6px; }

.switch { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.switch input { width: 20px; height: 20px; accent-color: var(--ff-navy); }
.switch span { font-weight: 600; color: var(--ff-navy-dark); }

/* Type toggle radio buttons */
.type-toggle { display: flex; gap: 0; flex-wrap: wrap; }
.radio-btn {
    display: block;
    border: 1px solid #cfd4db;
    padding: 9px 16px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13.5px;
    color: var(--ff-navy);
    background: #fff;
    margin-bottom: 0;
}
.radio-btn:first-child { border-radius: 6px 0 0 6px; }
.radio-btn:last-child { border-radius: 0 6px 6px 0; margin-left: -1px; }
.radio-btn input { margin-right: 7px; accent-color: var(--ff-navy); }
.radio-btn:has(input:checked) {
    background: var(--ff-navy);
    border-color: var(--ff-navy);
    color: #fff;
}

/* Filter bar */
.filter-form {
    display: grid;
    grid-template-columns: 2fr 1fr auto auto;
    gap: 10px;
    padding: 14px 16px;
    align-items: center;
}
@media (max-width: 760px) { .filter-form { grid-template-columns: 1fr 1fr; } }

/* Activity log filter (user + action selects) */
.filter-form select[name="user_id"] { grid-column: auto; }
.card.filter-bar .filter-form { grid-template-columns: 2fr 2fr auto auto; }

/* ---------- Alerts ---------- */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    border: 1px solid transparent;
}
.alert-success { background: #e2f2e5; color: #2e7d43; border-color: #bfe0c6; }
.alert-error   { background: #f9e3e1; color: #b34038; border-color: #f0c8c4; }

.error-list { margin: 0; padding-left: 18px; }

.text-danger { color: #b34038; }

/* ---------- Misc ---------- */
.danger-card { border-left: 4px solid #b34038; padding: 18px 20px; }
.actions-col { white-space: nowrap; }
.empty.pad { padding: 30px; text-align: center; color: var(--ff-muted); }

.mail-body {
    padding: 14px 16px;
    border-top: 1px solid var(--ff-border);
    background: #fff;
    max-height: 45vh;
    overflow: auto;
}
.mail-body pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: inherit;
    font-size: 14px;
}

/* Mailbox switcher (Inbox) + sender picker (Compose) */
.mailbox-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.mailbox-tab {
    display: inline-block;
    padding: 7px 14px;
    border: 1px solid #cfd4db;
    border-radius: 20px;
    background: #fff;
    color: var(--ff-text);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none !important;
}
.mailbox-tab:hover { border-color: var(--ff-gold); }
.mailbox-tab.active {
    background: var(--ff-navy);
    border-color: var(--ff-navy);
    color: #fff;
}

/* ---------- Login ---------- */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--ff-navy-dark) 0%, var(--ff-navy) 60%, #3a4759 100%);
}

.login-box {
    background: #fff;
    border-radius: 10px;
    border-top: 4px solid var(--ff-gold);
    padding: 34px 38px;
    width: 360px;
    max-width: 92vw;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .35);
    text-align: center;
}

.login-logo { height: 72px; width: auto; margin-bottom: 12px; }

.login-box h1 {
    font-size: 20px;
    color: var(--ff-navy-dark);
    margin: 0 0 2px;
}

.login-sub {
    color: var(--ff-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1.6px;
    margin: 0 0 22px;
}

.login-box label { text-align: left; }
.login-box input { margin-bottom: 16px; }
