/* Notification bell + dropdown, the shared activity row, and the Activity
   report screen. Auto-linked by `stylesheet_link_tag :app` (all stylesheets). */

@layer components {
  /* --- topbar notification bell + badge --- */
  .notif { position: relative; display: flex; }
  .notif-bell {
    position: relative; width: 36px; height: 36px; flex-shrink: 0;
    display: grid; place-items: center; cursor: pointer;
    border: 1px solid var(--line-strong); border-radius: 9px;
    background: var(--surface); color: var(--text-2);
  }
  .notif-bell:hover { background: var(--surface-2); color: var(--text); }
  .notif-badge {
    position: absolute; top: -5px; right: -5px;
    min-width: 17px; height: 17px; padding: 0 4px; box-sizing: border-box;
    border-radius: 999px; background: var(--danger-fg); color: #fff;
    font-size: 10.5px; font-weight: 800; line-height: 16px; text-align: center;
    box-shadow: 0 0 0 2px var(--surface);
  }
  .notif-badge[hidden] { display: none; }

  /* --- dropdown panel --- */
  .notif-panel {
    position: absolute; top: calc(100% + 8px); right: 0;
    width: 360px; max-width: 92vw;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--r-lg); box-shadow: var(--shadow-pop); z-index: 70;
    overflow: hidden; opacity: 0; transform: translateY(-6px); pointer-events: none;
    transition: opacity .14s ease, transform .14s ease;
  }
  .notif-panel.open { opacity: 1; transform: none; pointer-events: auto; }
  .notif-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 11px 14px; border-bottom: 1px solid var(--line);
  }
  .notif-title { font-weight: 700; font-size: 13.5px; color: var(--text); }
  .notif-all { font-size: 12px; color: var(--primary); text-decoration: none; }
  .notif-all:hover { text-decoration: underline; }
  .notif-list { max-height: 62vh; overflow-y: auto; }
  .notif-empty { padding: 26px 14px; text-align: center; color: var(--muted); font-size: 13px; }

  /* --- activity row: shared by the dropdown and the report feed --- */
  .act-row {
    position: relative; display: flex; gap: 10px; align-items: flex-start;
    padding: 10px 14px; border-bottom: 1px solid var(--line);
    text-decoration: none; color: var(--text);
  }
  .act-row:hover { background: var(--surface-2); }
  .act-row.unread {
    background: color-mix(in srgb, var(--primary) 8%, var(--surface));
    box-shadow: inset 3px 0 0 var(--primary);
  }
  .act-ic {
    flex-shrink: 0; width: 30px; height: 30px; border-radius: 8px;
    display: grid; place-items: center; font-size: 15px; background: var(--surface-2);
  }
  .act-orders     { background: color-mix(in srgb, #1c75bc 16%, var(--surface)); }
  .act-delivery   { background: color-mix(in srgb, #2f9e63 16%, var(--surface)); }
  .act-inventory  { background: color-mix(in srgb, #b3540f 16%, var(--surface)); }
  .act-production { background: color-mix(in srgb, #7b5bd6 16%, var(--surface)); }
  .act-system     { background: color-mix(in srgb, #946800 18%, var(--surface)); }
  .act-main { flex: 1; min-width: 0; }
  .act-title { font-size: 13px; font-weight: 650; color: var(--text); }
  .act-detail { font-size: 12px; color: var(--text-2); margin-top: 1px; word-break: break-word; }
  .act-meta { display: flex; gap: 8px; margin-top: 3px; font-size: 11px; color: var(--muted); flex-wrap: wrap; }
  .act-time { flex-shrink: 0; font-size: 11px; color: var(--muted); white-space: nowrap; }
}

@layer screens {
  .act-wrap { max-width: 880px; }
  .act-summary {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
    gap: 10px; margin-bottom: 16px;
  }
  .act-stat {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--r-md); padding: 12px 14px;
  }
  .act-stat-n { font-size: 22px; font-weight: 800; color: var(--text); line-height: 1; }
  .act-stat-l { font-size: 12px; color: var(--text-2); margin-top: 5px; }

  .act-tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
  .act-tab {
    padding: 6px 14px; border-radius: var(--r-pill); font-size: 13px; font-weight: 600;
    text-decoration: none; color: var(--text-2); border: 1px solid var(--line); background: var(--surface);
  }
  .act-tab:hover { background: var(--surface-2); }
  .act-tab.on { background: var(--primary); color: #fff; border-color: var(--primary); }

  .act-feed {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--r-lg); overflow: hidden;
  }
  .act-feed .act-row:last-child { border-bottom: none; }
  .act-day {
    padding: 9px 14px; font-size: 11.5px; font-weight: 700; letter-spacing: .04em;
    text-transform: uppercase; color: var(--muted);
    background: var(--surface-2); border-bottom: 1px solid var(--line);
  }
  .act-empty { padding: 40px 14px; text-align: center; color: var(--muted); }

  /* Roles & permissions matrix */
  .role-form { max-width: 940px; }
  .role-card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--r-lg); padding: 14px 16px; margin-bottom: 12px;
  }
  .role-card.is-admin { opacity: .9; }
  .role-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
  .role-name { font-weight: 700; font-size: 15px; color: var(--text); }
  .role-cols { display: grid; grid-template-columns: 1.7fr 1fr; gap: 20px; }
  @media (max-width: 720px) { .role-cols { grid-template-columns: 1fr; } }
  .role-col-label {
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
    color: var(--muted); margin-bottom: 8px;
  }
  .role-checks { display: flex; flex-wrap: wrap; gap: 7px 16px; }
  .role-check { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text); white-space: nowrap; }
  .role-check input { accent-color: var(--primary); width: 15px; height: 15px; }
}
