/* =====================================================================
   Site shell (header + login) and the home page — same look as the
   warehouse design system (inventory.css). Home pieces are hm-* under .iv.
   ===================================================================== */

/* ---------- site header ---------- */
.app-top { position: sticky; top: 0; z-index: 30; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); border-bottom: 1px solid #e2e8f0; }
.app-top-in { height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.app-logo { display: flex; align-items: center; height: 100%; padding: 6px 0; background: none; border: 0; cursor: pointer; }
.app-logo img { height: 38px; width: auto; object-fit: contain; }
.app-top-end { display: flex; align-items: center; gap: 8px; }
.app-icon-btn {
    position: relative; width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 10px; border: 1px solid #cbd5e1; background: #fff; color: #334155; cursor: pointer; transition: background .15s;
}
.app-icon-btn:hover { background: #f1f5f9; }
.app-icon-btn .ti { font-size: 20px; }
.app-badge { position: absolute; top: -5px; left: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #e11d48; color: #fff; font-size: 10.5px; font-weight: 800; line-height: 18px; text-align: center; border: 2px solid #fff; box-sizing: content-box; }
.app-user {
    height: 40px; display: inline-flex; align-items: center; gap: 8px; padding: 0 6px 0 10px;
    border-radius: 10px; border: 1px solid #cbd5e1; background: #fff; color: #0f172a; cursor: pointer; font-weight: 700; font-size: 13.5px;
}
.app-user:hover { background: #f8fafc; }
.app-user .ti { font-size: 16px; color: #94a3b8; }
.app-avatar { width: 28px; height: 28px; border-radius: 8px; background: #eef2ff; color: #4338ca; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; flex-shrink: 0; }
.app-menu { position: absolute; left: 0; top: calc(100% + 8px); width: 220px; background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; box-shadow: 0 12px 32px rgba(15, 23, 42, .12); padding: 6px; z-index: 40; }
.app-menu-head { padding: 8px 10px 10px; border-bottom: 1px solid #f1f5f9; margin-bottom: 4px; }
.app-menu-head .n { font-weight: 800; color: #0f172a; font-size: 14px; }
.app-menu-head .r { font-size: 12px; color: #94a3b8; }
.app-menu button { width: 100%; display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 9px; font-size: 13.5px; color: #334155; text-align: right; background: none; border: 0; cursor: pointer; }
.app-menu button:hover { background: #f8fafc; color: #0f172a; }
.app-menu button .ti { font-size: 18px; color: #64748b; }
.app-menu button.danger, .app-menu button.danger .ti { color: #e11d48; }
.app-menu button.danger:hover { background: #fff1f2; }
.app-menu hr { border: 0; border-top: 1px solid #f1f5f9; margin: 4px 0; }

/* the header is sticky: keep sticky panels below it */
.iv-side, .iv .pw-aside { top: 76px; }
.iv-side { max-height: calc(100vh - 92px); }

/* ---------- login ---------- */
.auth-wrap { flex-grow: 1; display: flex; align-items: center; justify-content: center; padding: 32px 16px; background: #f8fafc; background-image: radial-gradient(#e2e8f0 1px, transparent 1px); background-size: 22px 22px; }
.auth-wrap.hidden { display: none; }
.auth-card { width: 100%; max-width: 410px; background: #fff; border: 1px solid #e2e8f0; border-radius: 20px; padding: 32px 28px 26px; box-shadow: 0 20px 50px rgba(15, 23, 42, .08); }
.auth-card .logo { display: block; height: 52px; width: auto; margin: 0 auto 18px; }
.auth-card h2 { font-size: 22px; font-weight: 800; text-align: center; margin: 0; color: #0f172a; }
.auth-card .sub { font-size: 13.5px; color: #64748b; text-align: center; margin-top: 4px; }
.auth-card form { margin-top: 24px; }
.auth-card form > * + * { margin-top: 14px; }
.auth-card .iv-btn { width: 100%; }
.auth-card .switch { text-align: center; font-size: 13px; color: #64748b; margin-top: 18px; }
.auth-card .switch button { color: #4f46e5; font-weight: 700; background: none; border: 0; cursor: pointer; }
.auth-card .switch button:hover { text-decoration: underline; }

/* ---------- home ---------- */
.iv .hm-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.iv .hm-head h1 { font-size: 26px; font-weight: 800; margin: 0; line-height: 1.3; }
.iv .hm-head .sub { font-size: 14px; color: var(--iv-text-2); margin-top: 2px; }
.iv .hm-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.iv .hm-label { font-size: 13px; font-weight: 700; color: var(--iv-text-2); margin: 0 0 10px; }
.iv .hm-mods { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-bottom: 26px; }
.iv .hm-mod { background: var(--iv-panel); border: 1px solid var(--iv-border-strong); border-radius: var(--iv-radius-lg); display: flex; flex-direction: column; transition: border-color .15s, box-shadow .15s; }
.iv .hm-mod:hover { border-color: #c7d2fe; box-shadow: 0 8px 24px rgba(15, 23, 42, .06); }
.iv .hm-mod-main { display: flex; gap: 14px; align-items: flex-start; padding: 18px 20px 14px; text-align: right; width: 100%; border-radius: var(--iv-radius-lg) var(--iv-radius-lg) 0 0; }
.iv .hm-ico { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--iv-accent-bg); color: var(--iv-accent); }
.iv .hm-ico .ti { font-size: 24px; }
.iv .hm-ico.ok { background: var(--iv-ok-bg); color: var(--iv-ok); }
.iv .hm-ico.dark { background: #f1f5f9; color: #334155; }
.iv .hm-mod-title { font-size: 17px; font-weight: 800; color: var(--iv-text); display: flex; align-items: center; gap: 6px; }
.iv .hm-mod-title .ti-arrow-left { font-size: 16px; color: var(--iv-muted); transition: transform .15s, color .15s; }
.iv .hm-mod-main:hover .ti-arrow-left { transform: translateX(-3px); color: var(--iv-accent); }
.iv .hm-mod-desc { font-size: 13px; color: var(--iv-text-2); margin-top: 2px; }
.iv .hm-stats { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--iv-border); }
.iv .hm-stat { padding: 10px 14px; text-align: right; }
.iv .hm-stat + .hm-stat { border-right: 1px solid var(--iv-border); }
.iv button.hm-stat:hover { background: var(--iv-sub); }
.iv .hm-stat .v { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.25; color: var(--iv-text); }
.iv .hm-stat .l { font-size: 12px; color: var(--iv-text-2); }
.iv .hm-links { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 14px 14px; border-top: 1px solid var(--iv-border); margin-top: auto; }
.iv .hm-links button { height: 30px; padding: 0 11px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: #475569; background: var(--iv-sub); border: 1px solid var(--iv-border) !important; display: inline-flex; align-items: center; gap: 5px; }
.iv .hm-links button:hover { color: var(--iv-accent-text); background: var(--iv-accent-bg); border-color: #c7d2fe !important; }
.iv .hm-links .ti { font-size: 15px; }
.iv .hm-mod.locked { opacity: .6; }
.iv .hm-mod.locked:hover { border-color: var(--iv-border-strong); box-shadow: none; }

.iv .hm-grid { display: grid; grid-template-columns: minmax(0, 1fr) 22rem; gap: 16px; align-items: start; }
.iv .hm-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.iv .hm-proj { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 14px; align-items: center; }
.iv .hm-when { text-align: left; min-width: 92px; }
.iv .hm-notif { display: flex !important; justify-content: flex-start !important; align-items: flex-start !important; gap: 10px !important; }
.iv .hm-notif .ic { width: 32px; height: 32px; border-radius: 9px; background: var(--iv-accent-bg); color: var(--iv-accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.iv .hm-notif .ic .ti { font-size: 17px; }
.iv .hm-notif.unread .strong::after { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--iv-accent); margin-inline-start: 6px; vertical-align: middle; }
.iv .hm-skel { height: 14px; border-radius: 6px; background: linear-gradient(90deg, #f1f5f9, #e2e8f0, #f1f5f9); background-size: 200% 100%; animation: hm-shine 1.2s infinite; }
@keyframes hm-shine { to { background-position: -200% 0; } }

@media (max-width: 1023px) {
    .iv .hm-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 767px) {
    .app-top-in { height: 56px; }
    .app-logo img { height: 32px; }
    .app-user .name { display: none; }
    .iv .hm-head { margin-bottom: 16px; }
    .iv .hm-head h1 { font-size: 21px; }
    .iv .hm-actions { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
    .iv .hm-actions .iv-btn:first-child:nth-last-child(odd) { grid-column: 1 / -1; }
    .iv .hm-mods { grid-template-columns: minmax(0, 1fr); gap: 12px; margin-bottom: 18px; }
    .iv .hm-proj { grid-template-columns: minmax(0, 1fr) auto; }
    .iv .hm-proj .pw-steps { display: none; }
}
