/* Gravity SmartMail admin console. Theme follows the Atlas portal (Atlas.App, Vuetify "atlasTheme"). */
:root {
    --primary: #ff3759;
    --primary-dark: #dd3758;
    --primary-light: #fdeaea;
    --top-bar: #3c3c3c;
    --bg: #f8f9fa;
    --surface: #ffffff;
    --border: #e5e7eb;
    --table-head: #e5e7eb;
    --table-head-text: #374151;
    --text: #1f2937;
    --muted: #6b7280;
    --ok: #2e7d32;
    --ok-bg: #e8f5e9;
    --off: #c62828;
    --off-bg: #ffebee;
    --info: #1565c0;
    --info-bg: #e3f2fd;
    --shadow: 0 2px 1px -1px rgba(0,0,0,.2), 0 1px 1px 0 rgba(0,0,0,.14), 0 1px 3px 0 rgba(0,0,0,.12);
    --header-height: 72px;
    --nav-width: 260px;
}

* { box-sizing: border-box; }

html { height: 100%; }

body {
    margin: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-family: Roboto, Arial, Helvetica, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; font-weight: 500; }
a:hover { color: var(--primary-dark); text-decoration: underline; }

h1 { font-size: 24px; font-weight: 700; margin: 0; line-height: 1.3; }
h2 { font-size: 20px; font-weight: 700; margin: 0; }

code { font-family: Consolas, "Courier New", monospace; font-size: 13px; }

.icon { display: inline-block; vertical-align: middle; flex-shrink: 0; }

/* ---------- Top bar ---------- */
.app-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    padding: 0 24px;
    background: var(--top-bar);
    color: #fff;
}
.brand { display: flex; align-items: center; gap: 16px; color: #fff; }
.brand:hover { text-decoration: none; color: #fff; }
.brand-logo { width: 100px; height: auto; display: block; }
.brand-product {
    padding-left: 16px;
    border-left: 1px solid rgba(255,255,255,.3);
    font-size: 18px;
    line-height: 1.2;
}
.brand-product strong { font-weight: 700; }
.brand-product small { display: block; font-size: 12px; color: rgba(255,255,255,.7); font-weight: 400; }

.header-info { display: flex; align-items: center; gap: 20px; }
.today { display: flex; align-items: center; gap: 6px; color: rgba(255,255,255,.75); font-size: 13px; }

/* User pill + menu (Atlas: primary rounded button with initials avatar) */
.user-menu { position: relative; }
.user-menu > summary { list-style: none; }
.user-menu > summary::-webkit-details-marker { display: none; }
.user-pill {
    display: flex; align-items: center; gap: 10px;
    height: 48px; padding: 0 14px 0 8px;
    border-radius: 32px;
    background: var(--primary); color: #fff;
    cursor: pointer; user-select: none; font-weight: 500; font-size: 15px;
}
.user-pill:hover { background: var(--primary-dark); }
.avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 50%;
    background: #fff; color: var(--primary); font-size: 14px; font-weight: 600;
}
.user-dropdown {
    position: absolute; right: 0; top: 56px; z-index: 50;
    min-width: 240px; padding: 16px;
    background: var(--surface); color: var(--text);
    border-radius: 4px;
    box-shadow: 0 5px 5px -3px rgba(0,0,0,.2), 0 8px 10px 1px rgba(0,0,0,.14), 0 3px 14px 2px rgba(0,0,0,.12);
}
.user-dropdown .welcome { font-weight: 700; }
.user-dropdown .email { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.user-dropdown hr { border: none; border-top: 1px solid var(--border); margin: 0 -16px 16px; }

/* ---------- Body: sidebar + main ---------- */
.app-body { display: flex; flex: 1; }

.app-nav {
    width: var(--nav-width);
    flex-shrink: 0;
    padding: 24px 8px;
    background: var(--surface);
    border-right: 1px solid var(--border);
}
.nav-section {
    padding: 0 16px;
    margin: 0 0 6px;
    font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em;
    color: #757575;
}
.nav-section + .nav-link { margin-top: 0; }
.nav-link + .nav-section { margin-top: 24px; }
.nav-link {
    display: flex; align-items: center; gap: 28px;
    min-height: 48px; padding: 0 16px;
    color: var(--text); font-weight: 400; font-size: 15px;
    border-radius: 8px;
}
.nav-link .icon { color: #616161; }
.nav-link:hover, .nav-link.active { background: var(--primary-light); color: var(--primary); text-decoration: none; }
.nav-link:hover .icon, .nav-link.active .icon { color: var(--primary); }

.app-main { flex: 1; min-width: 0; padding: 24px; }

/* ---------- Footer ---------- */
.app-footer {
    flex-shrink: 0;
    padding: 8px 16px;
    text-align: center;
    font-size: 12px;
    color: var(--muted);
    background: var(--surface);
    border-top: 1px solid var(--border);
}

/* ---------- Page head ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 32px; }
.page-head p { margin: 8px 0 0; color: var(--muted); font-size: 16px; }
.back-link { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; margin-bottom: 8px; }
.page-title { display: flex; align-items: center; gap: 16px; }

/* ---------- Cards / panels ---------- */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}
.card {
    padding: 24px;
    background: var(--surface);
    border-radius: 4px;
    box-shadow: var(--shadow);
    display: flex; align-items: center; justify-content: space-between;
}
.card-label { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.card-value { font-size: 34px; font-weight: 700; line-height: 1.1; }
.card-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 48px; height: 48px; border-radius: 50%;
    background: var(--primary-light); color: var(--primary);
}

.panel {
    padding: 24px;
    background: var(--surface);
    border-radius: 4px;
    box-shadow: var(--shadow);
}
.panel + .panel { margin-top: 24px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 16px; }

/* ---------- Tables (Atlas: grey header, uppercase bold 12px) ---------- */
.grid { width: 100%; border-collapse: collapse; }
.grid th {
    padding: 12px 16px;
    text-align: left;
    background: var(--table-head);
    color: var(--table-head-text);
    font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .025em;
}
.grid td { padding: 10px 16px; font-size: 15px; background: #fff; border-bottom: 1px solid var(--border); vertical-align: middle; }
.grid tbody tr:hover td { background: #fafafa; }
.grid .name { font-weight: 700; color: var(--text); }
.grid .name:hover { color: var(--primary); }

.tenant-avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 50px; height: 50px; border-radius: 50%; overflow: hidden;
    background: #eeeeee; color: #9e9e9e;
}
.tenant-avatar img { width: 100%; height: 100%; object-fit: contain; }

/* ---------- Chips / badges ---------- */
.chip {
    display: inline-flex; align-items: center; gap: 6px;
    height: 24px; padding: 0 10px;
    border-radius: 12px; border: 1px solid currentColor;
    font-size: 12px; font-weight: 700; letter-spacing: .02em; white-space: nowrap;
}
.chip-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.chip-prod { color: var(--off); }
.chip-dev { color: var(--info); }
.chip-ok { color: var(--ok); background: var(--ok-bg); border-color: transparent; }
.chip-off { color: var(--off); background: var(--off-bg); border-color: transparent; }
.chip-disabled { color: #616161; background: #eeeeee; border-color: transparent; }
.chip-lg { height: 32px; padding: 0 16px; border-radius: 16px; font-size: 14px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 36px; padding: 0 16px;
    border: none; border-radius: 4px;
    font: inherit; font-weight: 500; font-size: 14px; letter-spacing: .0892em; text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 3px 1px -2px rgba(0,0,0,.2), 0 2px 2px 0 rgba(0,0,0,.14), 0 1px 5px 0 rgba(0,0,0,.12);
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-start { background: var(--ok); color: #fff; min-width: 120px; }
.btn-start:hover { background: #1b5e20; }
.btn-stop { background: var(--off); color: #fff; min-width: 120px; }
.btn-stop:hover { background: #8e0000; }
.btn-error { background: #b00020; color: #fff; }
.btn-error:hover { background: #8c001a; }
.btn-block { width: 100%; height: 44px; font-size: 15px; }
.btn:disabled { background: #e0e0e0; color: #9e9e9e; box-shadow: none; cursor: not-allowed; }
.inline-form { display: inline; margin: 0; }

/* ---------- Alerts / text ---------- */
.muted { color: var(--muted); }
.text-error { color: var(--off); }
.alert { padding: 12px 16px; border-radius: 4px; margin-bottom: 24px; }
.alert ul { margin: 0; padding-left: 18px; }
.alert-error { background: var(--off-bg); color: var(--off); }
.alert-info { background: var(--info-bg); color: var(--info); }
.validation-summary-valid { display: none; }

/* ---------- Detail lists ---------- */
.details { display: grid; grid-template-columns: 200px 1fr; gap: 10px 16px; margin: 20px 0 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; }

/* ---------- Tenant details ---------- */
.tenant-info { display: flex; gap: 32px; align-items: flex-start; }
.tenant-info .details { margin-top: 0; flex: 1; }
.tenant-logo {
    flex-shrink: 0; width: 140px; height: 140px;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--border); border-radius: 8px; background: #fff;
}
.tenant-logo img { max-width: 124px; max-height: 124px; object-fit: contain; }
.smtp-provider {
    flex-shrink: 0; width: 200px;
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 16px; border: 1px solid var(--border); border-radius: 8px; background: #fff;
    text-align: center;
}
.smtp-provider-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.smtp-provider-logo { width: 64px; height: 64px; display: flex; align-items: center; justify-content: center; }
.smtp-provider-logo img { width: 64px; height: 64px; object-fit: contain; }
.smtp-provider-logo .icon { color: var(--muted); }
.smtp-provider-name { font-weight: 500; }
.smtp-provider-host { font-size: 12px; color: var(--muted); word-break: break-all; }
.service-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }

/* ---------- Login (Atlas: logo, subtitle, card with primary header) ---------- */
body.anonymous { background: var(--bg); }
.login-page { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 32px 16px; }
.login-logo { width: 150px; margin-top: 32px; }
.login-subtitle { margin: 8px 0 32px; font-size: 18px; font-weight: 300; color: #757575; }
.login-card {
    width: 100%; max-width: 400px;
    background: var(--surface);
    border-radius: 8px; overflow: hidden;
    box-shadow: 0 3px 3px -2px rgba(0,0,0,.2), 0 3px 4px 0 rgba(0,0,0,.14), 0 1px 8px 0 rgba(0,0,0,.12);
}
.login-card-head { padding: 16px 24px; background: var(--primary); color: #fff; }
.login-card-head h1 { font-size: 24px; }
.login-card-head span { font-size: 12px; }
.login-card-body { padding: 16px 24px 24px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 700; font-size: 15px; margin-bottom: 8px; }
.input-icon { position: relative; }
.input-icon .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #757575; pointer-events: none; }
.input-icon input {
    width: 100%; height: 56px; padding: 0 16px 0 44px;
    font: inherit; font-size: 16px; color: var(--text);
    border: 1px solid #9e9e9e; border-radius: 4px; background: #fff;
}
.input-icon input:hover { border-color: var(--text); }
.input-icon input:focus { outline: none; border: 2px solid var(--primary); padding-left: 43px; }
.field-error { display: block; margin-top: 4px; color: var(--off); font-size: 12px; }

/* ---------- Error log ---------- */
.filter-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px; }
.filter-bar label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 500; }
.filter-bar label.grow { flex: 1; min-width: 200px; }
.filter-bar input, .filter-bar select {
    height: 36px; padding: 0 10px;
    font: inherit; font-size: 14px; color: var(--text);
    border: 1px solid #9e9e9e; border-radius: 4px; background: #fff;
}
.filter-bar input:focus, .filter-bar select:focus { outline: none; border-color: var(--primary); }
.filter-bar .input-narrow { width: 110px; }
.filter-actions { display: flex; gap: 8px; }
.btn-plain { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-plain:hover { background: #f3f4f6; color: var(--text); }
.nowrap { white-space: nowrap; }
.log-message { max-width: 520px; }
.log-message a { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.log-full-message { margin: 0; white-space: pre-wrap; word-break: break-word; }
.chip-critical { color: #fff; background: #8e0000; border-color: transparent; }
.chip-login { color: #8a5a00; background: #fff4e5; border-color: transparent; }
.pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 16px; }
pre.exception {
    margin: 0; padding: 16px; max-height: 600px; overflow: auto;
    font-size: 12px; line-height: 1.5; white-space: pre-wrap; word-break: break-word;
    background: #f8f9fa; border: 1px solid var(--border); border-radius: 4px;
}

@media (max-width: 800px) {
    .app-body { flex-direction: column; }
    .app-nav { width: auto; display: flex; overflow-x: auto; padding: 8px; border-right: none; border-bottom: 1px solid var(--border); }
    .nav-section { display: none; }
    .nav-link { gap: 8px; min-height: 40px; }
    .nav-link + .nav-section { margin-top: 0; }
    .today, .brand-product small { display: none; }
    .tenant-info { flex-direction: column; }
    .details { grid-template-columns: 140px 1fr; }
}
