/* Sport365 admin - shared shell and component styles.
   Loaded from every page so the browser caches one copy instead of parsing a
   duplicated inline <style> block on each navigation. Page-specific rules stay
   inline and, because this sheet is a cascade layer, they always win. */
@layer base {
    html { overflow-y: scroll; }
    * { box-sizing: border-box; margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; font-size: 13px; }
    body { background-color: #f0f3f8; color: #333; }
    header { background: linear-gradient(135deg, #0d3861 0%, #061c36 100%); min-height: 56px; display: flex; align-items: center; justify-content: space-between; padding: 10px 24px; box-shadow: 0 2px 4px rgba(0,0,0,0.15); }
    .brand-link { display: inline-flex; align-items: center; text-decoration: none; }
    .brand-logo { height: 42px; width: auto; display: block; }
    .header-controls { display: flex; align-items: center; gap: 16px; }
    .date-display { color: #d1e3f8; font-weight: 500; }
    .lang-select { padding: 5px 10px; font-size: 12px; border-radius: 4px; border: 1px solid #315882; background: #112d4e; color: #fff; cursor: pointer; }
    .btn-signout { background: #d63031; color: #fff; border: none; border-radius: 4px; padding: 6px 14px; font-weight: 600; cursor: pointer; }
    .container { display: flex; padding: 16px; gap: 16px; width: 100%; align-items: flex-start; }
    .sidebar { width: 220px; flex-shrink: 0; display: flex; flex-direction: column; gap: 4px; }
    .sidebar-item { background: #ffffff; border: 1px solid #dce2e8; border-radius: 4px; padding: 11px 14px; color: #2c3e50; font-weight: 600; font-size: 12px; text-transform: uppercase; text-decoration: none; display: flex; justify-content: space-between; align-items: center; cursor: pointer; user-select: none; }
    .sidebar-item:hover { background: #eaf1f9; color: #0d3861; }
    .sidebar-item.active { background: #1b4975; color: #ffffff; border-color: #1b4975; }
    .submenu { display: flex; flex-direction: column; gap: 2px; padding-left: 8px; margin-top: 2px; }
    .submenu.hidden { display: none; }
    .submenu-item { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 4px; padding: 9px 14px; color: #4a5568; font-weight: 600; font-size: 11.5px; text-decoration: none; display: block; }
    .submenu-item:hover { background: #e2e8f0; color: #1b4975; }
    .submenu-item.active { background: #2b6cb0; color: #ffffff; border-color: #2b6cb0; }
    .arrow-icon { font-size: 10px; transition: transform 0.2s; }
    .arrow-icon.open { transform: rotate(180deg); }
    .content-area { flex: 1; max-width: 1100px; display: flex; flex-direction: column; gap: 16px; }
    .panel-box { background: #fff; border-radius: 6px; border: 1px solid #e1e7ec; box-shadow: 0 1px 3px rgba(0,0,0,0.04); overflow: hidden; }
    .panel-header { background: #1b4975; color: #fff; font-weight: 600; font-size: 13px; padding: 12px 16px; }
    .table-custom { width: 100%; border-collapse: collapse; }
    .table-custom th, .table-custom td { padding: 11px 14px; border: 1px solid #d7e0ea; text-align: left; }
    .table-custom th { background: #f8fafc; color: #64748b; font-weight: 600; }
    .table-custom tr:nth-child(even) { background-color: #fafbfc; }
    @media screen and (max-width: 820px) { 
                header { flex-direction: column; gap: 10px; } 
                .container { flex-direction: column; } 
                .sidebar { width: 100%; } 
            }
    .table-custom th.num-col, .table-custom td.num-col, .info-table td.num-col { width: 46px; text-align: center; color: #718096; font-weight: 600; }
    .btn-new { background: #00b894; color: #fff; padding: 8px 14px; border-radius: 4px; text-decoration: none; font-weight: 600; font-size: 12px; white-space: nowrap; }
    .btn-new:hover { background: #009874; }
}

/* Role-aware sidebar: the Go server stamps the caller's level on <html>, so
   links for other levels are hidden before the first paint. The old client-side
   filtering in app.js only ran after /auth/me and made the menu flicker. */
html[data-level] .sidebar [data-level] { display: none; }
html[data-level="owner"] .sidebar .submenu-item[data-level="owner"],
html[data-level="super_agent"] .sidebar .submenu-item[data-level="super_agent"],
html[data-level="senior_agent"] .sidebar .submenu-item[data-level="senior_agent"],
html[data-level="master_agent"] .sidebar .submenu-item[data-level="master_agent"],
html[data-level="agent"] .sidebar .submenu-item[data-level="agent"],
html[data-level="member"] .sidebar .submenu-item[data-level="member"] { display: block; }
html[data-level="owner"] .sidebar .sidebar-item[data-level="owner"],
html[data-level="super_agent"] .sidebar .sidebar-item[data-level="super_agent"],
html[data-level="senior_agent"] .sidebar .sidebar-item[data-level="senior_agent"],
html[data-level="master_agent"] .sidebar .sidebar-item[data-level="master_agent"],
html[data-level="agent"] .sidebar .sidebar-item[data-level="agent"],
html[data-level="member"] .sidebar .sidebar-item[data-level="member"] { display: flex; }
html[data-level="owner"] .sidebar .settings-group[data-level="owner"],
html[data-level="super_agent"] .sidebar .settings-group[data-level="super_agent"],
html[data-level="senior_agent"] .sidebar .settings-group[data-level="senior_agent"],
html[data-level="master_agent"] .sidebar .settings-group[data-level="master_agent"],
html[data-level="agent"] .sidebar .settings-group[data-level="agent"],
html[data-level="member"] .sidebar .settings-group[data-level="member"] { display: block; }

/* A member has no accounts underneath, so the whole generation group is empty
   for that level. */
html[data-level="member"] .sidebar .generation-group { display: none; }

/* Owner-only blocks are decided by the level the server stamped on <html>, so
   they are already in place on the first paint instead of popping in after
   /auth/me. */
html[data-level]:not([data-level="owner"]) .owner-only { display: none; }

/* Cross-document view transitions smooth full-page navigation in browsers that
   support them; other browsers simply navigate normally. */
@view-transition { navigation: auto; }
@media (prefers-reduced-motion: no-preference) {
    ::view-transition-old(root),
    ::view-transition-new(root) { animation-duration: 140ms; }
}
