/* Portal LNY — paleta unificada com Paid Ads LNY (tema claro). */

:root {
    --bg: #f3f4f6;
    --panel: #ffffff;
    --panel-soft: #f9fafb;
    --fg: #111827;
    --fg-soft: #374151;
    --muted: #6b7280;
    --muted-light: #9ca3af;
    --line: #e5e7eb;
    --line-soft: #f3f4f6;

    --accent: #1e40af;
    --accent-dark: #1e3a8a;
    --accent-soft: #dbeafe;

    --header-start: #111827;
    --header-end: #1e3a5f;

    --ok: #10b981;
    --ok-bg: #d1fae5;
    --ok-fg: #065f46;
    --warn: #f59e0b;
    --warn-bg: #fef3c7;
    --warn-fg: #92400e;
    --err: #ef4444;
    --err-bg: #fee2e2;
    --err-fg: #991b1b;

    --shadow-sm: 0 1px 3px rgba(0,0,0,.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,.08);
    --shadow-lg: 0 10px 30px rgba(17,24,39,.12);
}

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

html, body {
    background: var(--bg);
    color: var(--fg);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.5;
    min-height: 100vh;
}

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

code {
    font-family: 'SF Mono', Consolas, 'JetBrains Mono', monospace;
    background: var(--line-soft);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    color: var(--fg-soft);
}

/* ============ Buttons ============ */

button, .btn-primary {
    background: var(--accent);
    color: #fff;
    border: 0;
    border-radius: 6px;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
    font-family: inherit;
    letter-spacing: 0.02em;
}

button:hover, .btn-primary:hover {
    background: var(--accent-dark);
}

.btn-link {
    background: transparent;
    color: #fff;
    opacity: 0.85;
    padding: 6px 0;
    border: 0;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
}
.btn-link:hover { opacity: 1; background: transparent; }

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-danger { background: var(--err); }
.btn-danger:hover { background: var(--err-fg); }

/* ============ Login + 403 (card centrado em bg claro) ============ */

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 48px 40px 36px;
    box-shadow: var(--shadow-lg);
}

.login-brand {
    text-align: center;
    margin-bottom: 32px;
}

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

.login-sub {
    color: var(--muted);
    font-size: 11px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    font-weight: 500;
}

.login-form label {
    display: block;
    margin-bottom: 18px;
}

.login-form label > span {
    display: block;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 6px;
    font-weight: 600;
}

.login-form input[type="text"],
.login-form input[type="password"],
.login-form input[type="email"] {
    width: 100%;
    padding: 11px 14px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--fg);
    font-size: 14px;
    transition: border-color .15s, box-shadow .15s;
    font-family: inherit;
}

.login-form input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.login-erro {
    background: var(--err-bg);
    border: 1px solid #fecaca;
    color: var(--err-fg);
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 16px;
}

.login-form button {
    width: 100%;
    margin-top: 8px;
    padding: 12px;
    font-size: 14px;
}

.login-foot {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
    text-align: center;
    color: var(--muted-light);
    font-size: 12px;
}

.error-card .error-msg {
    text-align: center;
    color: var(--fg-soft);
    font-size: 14px;
    margin: 20px 0 16px;
}

.error-card .error-msg.muted {
    color: var(--muted);
    font-size: 12px;
}

.error-actions {
    text-align: center;
    margin: 20px 0 4px;
}

.error-actions .btn-primary {
    display: inline-block;
    text-decoration: none;
    color: #fff;
}

/* ============ Topbar (index + admin) ============ */

.topbar {
    background: linear-gradient(135deg, var(--header-start), var(--header-end));
    color: #fff;
    padding: 16px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 18px;
}

.topbar-logo {
    height: 26px;
    display: block;
}

.topbar-section {
    color: rgba(255,255,255,.65);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    border-left: 1px solid rgba(255,255,255,.15);
    padding-left: 18px;
    font-weight: 500;
}

.topbar-nav {
    display: flex;
    align-items: center;
    gap: 22px;
    font-size: 13px;
}

.topbar-nav a {
    color: #fff;
    opacity: 0.85;
    transition: opacity .15s;
}
.topbar-nav a:hover { opacity: 1; text-decoration: none; }

.topbar-user {
    color: rgba(255,255,255,.75);
    font-size: 13px;
}

.inline { display: inline; }

/* ============ Portal index (cards de apps) ============ */

.portal-main {
    max-width: 1400px;
    margin: 40px auto;
    padding: 0 32px;
}

.portal-main h1 {
    font-weight: 600;
    color: var(--fg);
    font-size: 20px;
    margin-bottom: 24px;
    letter-spacing: -0.01em;
}

.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 18px;
}

.app-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 24px;
    text-decoration: none;
    color: var(--fg);
    transition: border-color .18s, transform .18s, box-shadow .18s;
    position: relative;
    overflow: hidden;
    display: block;
}

.app-card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--accent);
}

.app-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    text-decoration: none;
}

.app-card h2 {
    color: var(--fg);
    font-size: 16px;
    margin: 0 0 6px 0;
    font-weight: 600;
}

.app-card p {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
    margin: 0 0 20px 0;
    min-height: 40px;
}

.app-card .app-open {
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
}

.app-icon {
    width: 40px;
    height: 40px;
    background: var(--accent-soft);
    border-radius: 8px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    font-size: 20px;
}

.app-icon-chart::after  { content: "📊"; }
.app-icon-users::after  { content: "👥"; }
.app-icon-box::after    { content: "📦"; }

.empty {
    color: var(--muted);
    padding: 40px;
    text-align: center;
    border: 1px dashed var(--line);
    border-radius: 10px;
    background: var(--panel);
}

/* ============ Admin ============ */

.admin-main {
    max-width: 1400px;
    margin: 40px auto;
    padding: 0 32px;
}

.admin-section {
    margin-bottom: 40px;
}

.admin-section h1, .admin-section h2 {
    color: var(--fg);
    font-weight: 600;
    margin: 0 0 20px 0;
    letter-spacing: -0.01em;
}

.admin-section h1 { font-size: 20px; }
.admin-section h2 { font-size: 16px; }

.users-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.users-table th {
    background: var(--panel-soft);
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    text-align: left;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
}

.users-table td {
    padding: 14px;
    border-bottom: 1px solid var(--line-soft);
    vertical-align: top;
    font-size: 13px;
    color: var(--fg-soft);
}

.users-table tr:last-child td { border-bottom: 0; }
.users-table tr:hover { background: var(--panel-soft); }

.users-table td.center { text-align: center; }

.users-table input[type="text"],
.users-table input[type="email"],
.users-table input[type="password"] {
    width: 100%;
    padding: 6px 8px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 4px;
    color: var(--fg);
    font-size: 13px;
    margin-bottom: 4px;
    font-family: inherit;
}

.users-table input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-soft);
}

.users-table small {
    color: var(--muted-light);
    font-size: 11px;
}

.apps-cell {
    max-width: 420px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    margin: 2px 4px 2px 0;
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 14px;
    font-size: 12px;
    cursor: pointer;
    color: var(--fg-soft);
    transition: background .12s, border-color .12s;
}

.chip input { margin: 0; accent-color: var(--accent); }

.chip:has(input:checked) {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent-dark);
    font-weight: 500;
}

.actions {
    white-space: nowrap;
    text-align: right;
    min-width: 180px;
}

.actions button {
    margin: 0 0 4px 4px;
}

/* Coluna "Senha" inline tem seu proprio td agora */
.users-table .pw-inline {
    width: 100%;
    min-width: 120px;
}

.create-form {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 24px;
    max-width: 960px;
    box-shadow: var(--shadow-sm);
}

.create-form .grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 20px;
    margin-bottom: 18px;
}

.create-form label {
    display: block;
}

.create-form label > span {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin-bottom: 6px;
    font-weight: 600;
}

.create-form input[type="text"],
.create-form input[type="email"],
.create-form input[type="password"],
.create-form input:not([type]) {
    width: 100%;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--fg);
    font-size: 14px;
    font-family: inherit;
}

.create-form input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.check-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px 0 20px 0;
    font-size: 13px;
    color: var(--fg-soft);
    cursor: pointer;
}

.check-inline input { accent-color: var(--accent); }

.apps-picker { margin-bottom: 20px; }

.label-block {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin-bottom: 10px;
    font-weight: 600;
}

/* ============ Flash messages ============ */

.flash-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;
}

.flash {
    padding: 12px 18px;
    border-radius: 8px;
    font-size: 13px;
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-md);
    min-width: 280px;
    animation: slide-in .3s ease;
    color: var(--fg-soft);
}

.flash-ok    { border-left: 3px solid var(--ok); }
.flash-error { border-left: 3px solid var(--err); }

@keyframes slide-in {
    from { transform: translateX(20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
